refactor(protocol): extract server contracts (#33708)
This commit is contained in:
parent
f9dac262ff
commit
56a37c3640
77 changed files with 1070 additions and 878 deletions
|
|
@ -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 })
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue