refactor(protocol): extract server contracts (#33708)

This commit is contained in:
Kit Langton 2026-06-25 04:15:31 +02:00 committed by GitHub
commit 56a37c3640
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
77 changed files with 1070 additions and 878 deletions

View file

@ -1,7 +1,8 @@
export * as Location from "./location"
import { Effect, Schema } from "effect"
import { AbsolutePath } from "./schema"
import { AbsolutePath, optionalOmitUndefined } from "./schema"
import { ProjectID } from "./project-id"
import { WorkspaceID } from "./workspace-id"
export interface Ref extends Schema.Schema.Type<typeof Ref> {}
@ -12,3 +13,16 @@ export const Ref = Schema.Struct({
Schema.withConstructorDefault(Effect.succeed(undefined)),
),
}).annotate({ identifier: "Location.Ref" })
export class Info extends Schema.Class<Info>("Location.Info")({
directory: AbsolutePath,
workspaceID: optionalOmitUndefined(WorkspaceID),
project: Schema.Struct({
id: ProjectID,
directory: AbsolutePath,
}),
}) {}
export function response<S extends Schema.Top>(data: S) {
return Schema.Struct({ location: Info, data })
}