refactor(schema): extract public event definitions (#33579)
This commit is contained in:
parent
858f35f1b3
commit
24b0132bc5
93 changed files with 2743 additions and 2127 deletions
32
packages/schema/src/workspace-event.ts
Normal file
32
packages/schema/src/workspace-event.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
export * as WorkspaceEvent from "./workspace-event"
|
||||
|
||||
import { Schema } from "effect"
|
||||
import { Event } from "./event"
|
||||
import { WorkspaceID } from "./workspace-id"
|
||||
|
||||
export const ConnectionStatus = Schema.Struct({
|
||||
workspaceID: WorkspaceID,
|
||||
status: Schema.Literals(["connected", "connecting", "disconnected", "error"]),
|
||||
})
|
||||
export type ConnectionStatus = typeof ConnectionStatus.Type
|
||||
|
||||
export const Ready = Event.define({
|
||||
type: "workspace.ready",
|
||||
schema: {
|
||||
name: Schema.String,
|
||||
},
|
||||
})
|
||||
|
||||
export const Failed = Event.define({
|
||||
type: "workspace.failed",
|
||||
schema: {
|
||||
message: Schema.String,
|
||||
},
|
||||
})
|
||||
|
||||
export const Status = Event.define({
|
||||
type: "workspace.status",
|
||||
schema: ConnectionStatus.fields,
|
||||
})
|
||||
|
||||
export const Definitions = Event.inventory(Ready, Failed, Status)
|
||||
Loading…
Add table
Add a link
Reference in a new issue