refactor(schema): tighten public contracts (#33771)
This commit is contained in:
parent
5682371d0a
commit
9e9d405d7e
49 changed files with 759 additions and 897 deletions
|
|
@ -8,22 +8,25 @@ import { ProjectID } from "./project-id"
|
|||
export const ID = ProjectID
|
||||
export type ID = typeof ID.Type
|
||||
|
||||
export const Vcs = Schema.Literal("git")
|
||||
export const Vcs = Schema.Literal("git").annotate({ identifier: "Project.Vcs" })
|
||||
export const Icon = Schema.Struct({
|
||||
url: optional(Schema.String),
|
||||
override: optional(Schema.String),
|
||||
color: optional(Schema.String),
|
||||
})
|
||||
}).annotate({ identifier: "Project.Icon" })
|
||||
export interface Icon extends Schema.Schema.Type<typeof Icon> {}
|
||||
export const Commands = Schema.Struct({
|
||||
start: optional(
|
||||
Schema.String.annotate({ description: "Startup script to run when creating a new workspace (worktree)" }),
|
||||
),
|
||||
})
|
||||
}).annotate({ identifier: "Project.Commands" })
|
||||
export interface Commands extends Schema.Schema.Type<typeof Commands> {}
|
||||
export const Time = Schema.Struct({
|
||||
created: NonNegativeInt,
|
||||
updated: NonNegativeInt,
|
||||
initialized: optional(NonNegativeInt),
|
||||
})
|
||||
}).annotate({ identifier: "Project.Time" })
|
||||
export interface Time extends Schema.Schema.Type<typeof Time> {}
|
||||
|
||||
export const Info = Schema.Struct({
|
||||
id: ID,
|
||||
|
|
@ -35,7 +38,7 @@ export const Info = Schema.Struct({
|
|||
time: Time,
|
||||
sandboxes: Schema.Array(Schema.String),
|
||||
}).annotate({ identifier: "Project" })
|
||||
export type Info = typeof Info.Type
|
||||
export interface Info extends Schema.Schema.Type<typeof Info> {}
|
||||
|
||||
const Updated = define({ type: "project.updated", schema: Info.fields })
|
||||
export const Event = { Updated, Definitions: inventory(Updated) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue