Files
t3code/packages/contracts/src/project.ts

27 lines
977 B
TypeScript

import { Schema } from "effect";
import { PositiveInt, TrimmedNonEmptyString } from "./baseSchemas";
export const PROJECT_SEARCH_ENTRIES_MAX_LIMIT = 200;
export const ProjectSearchEntriesInput = Schema.Struct({
cwd: TrimmedNonEmptyString,
query: TrimmedNonEmptyString.check(Schema.isMaxLength(256)),
limit: PositiveInt.check(Schema.isLessThanOrEqualTo(PROJECT_SEARCH_ENTRIES_MAX_LIMIT)),
});
export type ProjectSearchEntriesInput = typeof ProjectSearchEntriesInput.Type;
export const ProjectEntryKind = Schema.Literals(["file", "directory"]);
export const ProjectEntry = Schema.Struct({
path: TrimmedNonEmptyString,
kind: ProjectEntryKind,
parentPath: Schema.optional(TrimmedNonEmptyString),
});
export type ProjectEntry = typeof ProjectEntry.Type;
export const ProjectSearchEntriesResult = Schema.Struct({
entries: Schema.Array(ProjectEntry),
truncated: Schema.Boolean,
});
export type ProjectSearchEntriesResult = typeof ProjectSearchEntriesResult.Type;