@opencode/schema 0.0.0-reserved → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +164 -0
- package/dist/agent.js +46 -0
- package/dist/catalog.d.ts +69 -0
- package/dist/catalog.js +4 -0
- package/dist/command.d.ts +76 -0
- package/dist/command.js +13 -0
- package/dist/config/agent.d.ts +42 -0
- package/dist/config/agent.js +20 -0
- package/dist/config/command.d.ts +28 -0
- package/dist/config/command.js +13 -0
- package/dist/config/compaction.d.ts +14 -0
- package/dist/config/compaction.js +13 -0
- package/dist/config/experimental.d.ts +17 -0
- package/dist/config/experimental.js +16 -0
- package/dist/config/formatter.d.ts +11 -0
- package/dist/config/formatter.js +11 -0
- package/dist/config/lsp.d.ts +20 -0
- package/dist/config/lsp.js +16 -0
- package/dist/config/mcp.d.ts +18 -0
- package/dist/config/mcp.js +14 -0
- package/dist/config/media.d.ts +15 -0
- package/dist/config/media.js +14 -0
- package/dist/config/model.d.ts +18 -0
- package/dist/config/model.js +28 -0
- package/dist/config/plugin.d.ts +11 -0
- package/dist/config/plugin.js +10 -0
- package/dist/config/policy.d.ts +10 -0
- package/dist/config/policy.js +8 -0
- package/dist/config/provider.d.ts +173 -0
- package/dist/config/provider.js +72 -0
- package/dist/config/reference.d.ts +21 -0
- package/dist/config/reference.js +18 -0
- package/dist/config/tool-output.d.ts +8 -0
- package/dist/config/tool-output.js +8 -0
- package/dist/config/warming.d.ts +10 -0
- package/dist/config/warming.js +16 -0
- package/dist/config/watcher.d.ts +7 -0
- package/dist/config/watcher.js +7 -0
- package/dist/config/websearch.d.ts +9 -0
- package/dist/config/websearch.js +13 -0
- package/dist/config/worktree.d.ts +7 -0
- package/dist/config/worktree.js +7 -0
- package/dist/config.d.ts +180 -0
- package/dist/config.js +138 -0
- package/dist/connection.d.ts +28 -0
- package/dist/connection.js +15 -0
- package/dist/credential.d.ts +191 -0
- package/dist/credential.js +39 -0
- package/dist/durable-event-manifest.d.ts +3 -0
- package/dist/durable-event-manifest.js +5 -0
- package/dist/event-log.d.ts +14 -0
- package/dist/event-log.js +17 -0
- package/dist/event-manifest.d.ts +12758 -0
- package/dist/event-manifest.js +47 -0
- package/dist/event.d.ts +142 -0
- package/dist/event.js +110 -0
- package/dist/file-diff.d.ts +21 -0
- package/dist/file-diff.js +18 -0
- package/dist/filesystem-v1.d.ts +1 -0
- package/dist/filesystem-v1.js +1 -0
- package/dist/filesystem.d.ts +118 -0
- package/dist/filesystem.js +35 -0
- package/dist/form.d.ts +1259 -0
- package/dist/form.js +120 -0
- package/dist/ide-event.d.ts +76 -0
- package/dist/ide-event.js +10 -0
- package/dist/identifier.d.ts +3 -0
- package/dist/identifier.js +24 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +41 -0
- package/dist/installation-event.d.ts +149 -0
- package/dist/installation-event.js +16 -0
- package/dist/instruction-entry.d.ts +29 -0
- package/dist/instruction-entry.js +26 -0
- package/dist/instruction.d.ts +13 -0
- package/dist/instruction.js +8 -0
- package/dist/integration-id.d.ts +5 -0
- package/dist/integration-id.js +3 -0
- package/dist/integration.d.ts +1604 -0
- package/dist/integration.js +85 -0
- package/dist/legacy-event.d.ts +1 -0
- package/dist/legacy-event.js +1 -0
- package/dist/llm.d.ts +4 -0
- package/dist/llm.js +3 -0
- package/dist/location.d.ts +37 -0
- package/dist/location.js +22 -0
- package/dist/lsp-event.d.ts +67 -0
- package/dist/lsp-event.js +4 -0
- package/dist/mcp-event.d.ts +222 -0
- package/dist/mcp-event.js +24 -0
- package/dist/mcp.d.ts +138 -0
- package/dist/mcp.js +111 -0
- package/dist/model.d.ts +247 -0
- package/dist/model.js +116 -0
- package/dist/models-dev.d.ts +69 -0
- package/dist/models-dev.js +7 -0
- package/dist/money.d.ts +10 -0
- package/dist/money.js +5 -0
- package/dist/permission-saved.d.ts +18 -0
- package/dist/permission-saved.js +12 -0
- package/dist/permission-v1.d.ts +1 -0
- package/dist/permission-v1.js +1 -0
- package/dist/permission.d.ts +311 -0
- package/dist/permission.js +46 -0
- package/dist/persistent-pty.d.ts +559 -0
- package/dist/persistent-pty.js +55 -0
- package/dist/plugin.d.ts +132 -0
- package/dist/plugin.js +37 -0
- package/dist/project-id.d.ts +5 -0
- package/dist/project-id.js +3 -0
- package/dist/project.d.ts +264 -0
- package/dist/project.js +46 -0
- package/dist/prompt-input.d.ts +143 -0
- package/dist/prompt-input.js +25 -0
- package/dist/prompt.d.ts +297 -0
- package/dist/prompt.js +61 -0
- package/dist/provider.d.ts +105 -0
- package/dist/provider.js +50 -0
- package/dist/pty-ticket.d.ts +8 -0
- package/dist/pty-ticket.js +7 -0
- package/dist/pty.d.ts +462 -0
- package/dist/pty.js +43 -0
- package/dist/question-v1.d.ts +1 -0
- package/dist/question-v1.js +1 -0
- package/dist/question.d.ts +15 -0
- package/dist/question.js +15 -0
- package/dist/reference.d.ts +120 -0
- package/dist/reference.js +30 -0
- package/dist/rpc.d.ts +111 -0
- package/dist/rpc.js +9 -0
- package/dist/schema.d.ts +10 -0
- package/dist/schema.js +14 -0
- package/dist/server-event.d.ts +132 -0
- package/dist/server-event.js +5 -0
- package/dist/session-compaction-event.d.ts +87 -0
- package/dist/session-compaction-event.js +10 -0
- package/dist/session-error.d.ts +9 -0
- package/dist/session-error.js +8 -0
- package/dist/session-event.d.ts +21315 -0
- package/dist/session-event.js +557 -0
- package/dist/session-fork.d.ts +26 -0
- package/dist/session-fork.js +11 -0
- package/dist/session-id.d.ts +6 -0
- package/dist/session-id.js +10 -0
- package/dist/session-inbox.d.ts +748 -0
- package/dist/session-inbox.js +47 -0
- package/dist/session-message.d.ts +2007 -0
- package/dist/session-message.js +227 -0
- package/dist/session-metadata.d.ts +8 -0
- package/dist/session-metadata.js +9 -0
- package/dist/session-provider-context.d.ts +54 -0
- package/dist/session-provider-context.js +17 -0
- package/dist/session-revert.d.ts +672 -0
- package/dist/session-revert.js +63 -0
- package/dist/session-stats.d.ts +186 -0
- package/dist/session-stats.js +53 -0
- package/dist/session-status-event.d.ts +299 -0
- package/dist/session-status-event.js +45 -0
- package/dist/session-transfer.d.ts +897 -0
- package/dist/session-transfer.js +8 -0
- package/dist/session-v1.d.ts +1 -0
- package/dist/session-v1.js +1 -0
- package/dist/session.d.ts +236 -0
- package/dist/session.js +55 -0
- package/dist/shell.d.ts +381 -0
- package/dist/shell.js +58 -0
- package/dist/skill.d.ts +133 -0
- package/dist/skill.js +48 -0
- package/dist/snapshot.d.ts +4 -0
- package/dist/snapshot.js +3 -0
- package/dist/token-usage.d.ts +14 -0
- package/dist/token-usage.js +14 -0
- package/dist/tool.d.ts +78 -0
- package/dist/tool.js +22 -0
- package/dist/tui-event.d.ts +307 -0
- package/dist/tui-event.js +53 -0
- package/dist/v1/filesystem.d.ts +78 -0
- package/dist/v1/filesystem.js +8 -0
- package/dist/v1/legacy-event.d.ts +108 -0
- package/dist/v1/legacy-event.js +15 -0
- package/dist/v1/permission.d.ts +316 -0
- package/dist/v1/permission.js +41 -0
- package/dist/v1/question.d.ts +444 -0
- package/dist/v1/question.js +57 -0
- package/dist/v1/session.d.ts +7657 -0
- package/dist/v1/session.js +535 -0
- package/dist/vcs-event.d.ts +76 -0
- package/dist/vcs-event.js +11 -0
- package/dist/vcs.d.ts +35 -0
- package/dist/vcs.js +23 -0
- package/dist/websearch.d.ts +108 -0
- package/dist/websearch.js +31 -0
- package/dist/workspace-event.d.ts +247 -0
- package/dist/workspace-event.js +25 -0
- package/dist/workspace-id.d.ts +6 -0
- package/dist/workspace-id.js +16 -0
- package/dist/workspace.d.ts +15 -0
- package/dist/workspace.js +14 -0
- package/dist/worktree-event.d.ts +153 -0
- package/dist/worktree-event.js +18 -0
- package/dist/worktree.d.ts +277 -0
- package/dist/worktree.js +82 -0
- package/package.json +33 -6
- package/README.md +0 -5
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export * as Reference from "./reference.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
export declare const Event: {
|
|
4
|
+
Updated: Schema.Struct<{
|
|
5
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
6
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
7
|
+
};
|
|
8
|
+
readonly created: Schema.Finite;
|
|
9
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
10
|
+
readonly type: Schema.Literal<"reference.updated">;
|
|
11
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
12
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
13
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
14
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
15
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
16
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
17
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
18
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
19
|
+
}>, never, never>;
|
|
20
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
21
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
22
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
23
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
24
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
25
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
26
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
27
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
28
|
+
}>, never, never>;
|
|
29
|
+
}>>, never, never>;
|
|
30
|
+
readonly data: Schema.Struct<{}>;
|
|
31
|
+
}> & {
|
|
32
|
+
type: "reference.updated";
|
|
33
|
+
durability: "ephemeral";
|
|
34
|
+
durable: undefined;
|
|
35
|
+
data: Schema.Struct<{}>;
|
|
36
|
+
};
|
|
37
|
+
Definitions: readonly [Schema.Struct<{
|
|
38
|
+
readonly id: Schema.brand<Schema.String, "Event.ID"> & {
|
|
39
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
40
|
+
};
|
|
41
|
+
readonly created: Schema.Finite;
|
|
42
|
+
readonly metadata: Schema.decodeTo<Schema.optional<Schema.toType<Schema.$Record<Schema.String, Schema.Unknown>>>, Schema.optionalKey<Schema.$Record<Schema.String, Schema.Unknown>>, never, never>;
|
|
43
|
+
readonly type: Schema.Literal<"reference.updated">;
|
|
44
|
+
readonly location: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Struct<{
|
|
45
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
46
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
47
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
48
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
49
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
50
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
51
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
52
|
+
}>, never, never>;
|
|
53
|
+
}>>>, Schema.optionalKey<Schema.Struct<{
|
|
54
|
+
readonly directory: Schema.brand<Schema.String, "AbsolutePath">;
|
|
55
|
+
readonly workspaceID: Schema.decodeTo<Schema.optional<Schema.toType<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
56
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
57
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
58
|
+
}>>, Schema.optionalKey<Schema.brand<Schema.String, "Workspace.ID"> & {
|
|
59
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
60
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
61
|
+
}>, never, never>;
|
|
62
|
+
}>>, never, never>;
|
|
63
|
+
readonly data: Schema.Struct<{}>;
|
|
64
|
+
}> & {
|
|
65
|
+
type: "reference.updated";
|
|
66
|
+
durability: "ephemeral";
|
|
67
|
+
durable: undefined;
|
|
68
|
+
data: Schema.Struct<{}>;
|
|
69
|
+
}];
|
|
70
|
+
};
|
|
71
|
+
export interface LocalSource extends Schema.Schema.Type<typeof LocalSource> {
|
|
72
|
+
}
|
|
73
|
+
export declare const LocalSource: Schema.Struct<{
|
|
74
|
+
readonly type: Schema.Literal<"local">;
|
|
75
|
+
readonly path: Schema.brand<Schema.String, "AbsolutePath">;
|
|
76
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
77
|
+
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
78
|
+
}>;
|
|
79
|
+
export interface GitSource extends Schema.Schema.Type<typeof GitSource> {
|
|
80
|
+
}
|
|
81
|
+
export declare const GitSource: Schema.Struct<{
|
|
82
|
+
readonly type: Schema.Literal<"git">;
|
|
83
|
+
readonly repository: Schema.String;
|
|
84
|
+
readonly branch: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
85
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
86
|
+
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
87
|
+
}>;
|
|
88
|
+
export declare const Source: Schema.Union<readonly [Schema.Struct<{
|
|
89
|
+
readonly type: Schema.Literal<"local">;
|
|
90
|
+
readonly path: Schema.brand<Schema.String, "AbsolutePath">;
|
|
91
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
92
|
+
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
93
|
+
}>, Schema.Struct<{
|
|
94
|
+
readonly type: Schema.Literal<"git">;
|
|
95
|
+
readonly repository: Schema.String;
|
|
96
|
+
readonly branch: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
97
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
98
|
+
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
99
|
+
}>]>;
|
|
100
|
+
export type Source = typeof Source.Type;
|
|
101
|
+
export declare const Info: Schema.Struct<{
|
|
102
|
+
readonly name: Schema.String;
|
|
103
|
+
readonly path: Schema.brand<Schema.String, "AbsolutePath">;
|
|
104
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
105
|
+
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
106
|
+
readonly source: Schema.Union<readonly [Schema.Struct<{
|
|
107
|
+
readonly type: Schema.Literal<"local">;
|
|
108
|
+
readonly path: Schema.brand<Schema.String, "AbsolutePath">;
|
|
109
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
110
|
+
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
111
|
+
}>, Schema.Struct<{
|
|
112
|
+
readonly type: Schema.Literal<"git">;
|
|
113
|
+
readonly repository: Schema.String;
|
|
114
|
+
readonly branch: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
115
|
+
readonly description: Schema.decodeTo<Schema.optional<Schema.toType<Schema.String>>, Schema.optionalKey<Schema.String>, never, never>;
|
|
116
|
+
readonly hidden: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Boolean>>, Schema.optionalKey<Schema.Boolean>, never, never>;
|
|
117
|
+
}>]>;
|
|
118
|
+
}>;
|
|
119
|
+
export interface Info extends Schema.Schema.Type<typeof Info> {
|
|
120
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export * as Reference from "./reference.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { optional } from "./schema.js";
|
|
4
|
+
import { ephemeral, inventory } from "./event.js";
|
|
5
|
+
import { AbsolutePath } from "./schema.js";
|
|
6
|
+
const Updated = ephemeral({ type: "reference.updated", schema: {} });
|
|
7
|
+
export const Event = { Updated, Definitions: inventory(Updated) };
|
|
8
|
+
export const LocalSource = Schema.Struct({
|
|
9
|
+
type: Schema.Literal("local"),
|
|
10
|
+
path: AbsolutePath,
|
|
11
|
+
description: Schema.String.pipe(optional),
|
|
12
|
+
hidden: Schema.Boolean.pipe(optional),
|
|
13
|
+
}).annotate({ identifier: "Reference.LocalSource" });
|
|
14
|
+
export const GitSource = Schema.Struct({
|
|
15
|
+
type: Schema.Literal("git"),
|
|
16
|
+
repository: Schema.String,
|
|
17
|
+
branch: Schema.String.pipe(optional),
|
|
18
|
+
description: Schema.String.pipe(optional),
|
|
19
|
+
hidden: Schema.Boolean.pipe(optional),
|
|
20
|
+
}).annotate({ identifier: "Reference.GitSource" });
|
|
21
|
+
export const Source = Schema.Union([LocalSource, GitSource])
|
|
22
|
+
.pipe(Schema.toTaggedUnion("type"))
|
|
23
|
+
.annotate({ identifier: "Reference.Source" });
|
|
24
|
+
export const Info = Schema.Struct({
|
|
25
|
+
name: Schema.String,
|
|
26
|
+
path: AbsolutePath,
|
|
27
|
+
description: Schema.String.pipe(optional),
|
|
28
|
+
hidden: Schema.Boolean.pipe(optional),
|
|
29
|
+
source: Source,
|
|
30
|
+
}).annotate({ identifier: "Reference.Info" });
|
package/dist/rpc.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export * as Rpc from "./rpc.js";
|
|
2
|
+
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
|
+
import type { JsonSchema, Schema } from "effect";
|
|
4
|
+
import type { Event } from "./event.js";
|
|
5
|
+
import type { Location } from "./location.js";
|
|
6
|
+
import type { Tool } from "./tool.js";
|
|
7
|
+
export type ErrorMap = Readonly<Record<string, Tool.ValueSchema>> & {
|
|
8
|
+
readonly [Name in `rpc.${string}`]?: never;
|
|
9
|
+
};
|
|
10
|
+
export interface Method {
|
|
11
|
+
readonly input: Tool.ValueSchema;
|
|
12
|
+
readonly output: Tool.ValueSchema;
|
|
13
|
+
readonly errors?: ErrorMap;
|
|
14
|
+
}
|
|
15
|
+
export type PortableValueSchema = StandardSchemaV1<unknown, unknown> | JsonSchema.JsonSchema;
|
|
16
|
+
export interface PortableMethod extends Method {
|
|
17
|
+
readonly input: PortableValueSchema;
|
|
18
|
+
readonly output: PortableValueSchema;
|
|
19
|
+
readonly errors?: Readonly<Record<string, PortableValueSchema>> & {
|
|
20
|
+
readonly [Name in `rpc.${string}`]?: never;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
type EventDataObject = Readonly<Record<string, unknown>>;
|
|
24
|
+
type EventValueSchema = Schema.Codec<EventDataObject, EventDataObject> | StandardSchemaV1<unknown, EventDataObject> | (JsonSchema.JsonSchema & {
|
|
25
|
+
readonly type: "object";
|
|
26
|
+
});
|
|
27
|
+
type PortableEventValueSchema = StandardSchemaV1<unknown, EventDataObject> | (JsonSchema.JsonSchema & {
|
|
28
|
+
readonly type: "object";
|
|
29
|
+
});
|
|
30
|
+
export interface EventDefinition {
|
|
31
|
+
readonly schema: EventValueSchema;
|
|
32
|
+
}
|
|
33
|
+
export type PortableEventDefinition = EventDefinition & {
|
|
34
|
+
readonly schema: PortableEventValueSchema;
|
|
35
|
+
};
|
|
36
|
+
export interface Definition {
|
|
37
|
+
readonly id: string;
|
|
38
|
+
readonly methods: Readonly<Record<string, Method>> & {
|
|
39
|
+
readonly events?: never;
|
|
40
|
+
};
|
|
41
|
+
readonly events: Readonly<Record<string, EventDefinition>>;
|
|
42
|
+
}
|
|
43
|
+
export interface PortableDefinition extends Definition {
|
|
44
|
+
readonly methods: Readonly<Record<string, PortableMethod>> & {
|
|
45
|
+
readonly events?: never;
|
|
46
|
+
};
|
|
47
|
+
readonly events: Readonly<Record<string, PortableEventDefinition>>;
|
|
48
|
+
}
|
|
49
|
+
export declare function define<const D extends Definition>(definition: D): D;
|
|
50
|
+
export type Input<S extends Tool.ValueSchema> = S extends Schema.Top ? S["Encoded"] : S extends StandardSchemaV1 ? StandardSchemaV1.InferInput<S> : unknown;
|
|
51
|
+
export type Output<S extends Tool.ValueSchema> = S extends Schema.Top ? S["Type"] : S extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<S> : unknown;
|
|
52
|
+
export type HandlerOutput<S extends Tool.ValueSchema> = S extends Schema.Top ? Output<S> : Input<S>;
|
|
53
|
+
type MethodErrors<M extends Method> = M extends {
|
|
54
|
+
readonly errors: infer Errors extends ErrorMap;
|
|
55
|
+
} ? Errors : never;
|
|
56
|
+
type ErrorSchema<M extends Method, Name extends ErrorName<M>> = MethodErrors<M>[Name];
|
|
57
|
+
type ErrorData<Data> = unknown extends Data ? {
|
|
58
|
+
readonly data: Data;
|
|
59
|
+
} : undefined extends Data ? {
|
|
60
|
+
readonly data?: Data;
|
|
61
|
+
} : {
|
|
62
|
+
readonly data: Data;
|
|
63
|
+
};
|
|
64
|
+
type ErrorDataArguments<Data> = unknown extends Data ? [data: Data] : undefined extends Data ? [data?: Data] : [data: Data];
|
|
65
|
+
type Simplify<A> = {
|
|
66
|
+
readonly [K in keyof A]: A[K];
|
|
67
|
+
};
|
|
68
|
+
declare const HandlerErrorTypeId: unique symbol;
|
|
69
|
+
export interface Failure<Type extends string = string, Data = unknown> {
|
|
70
|
+
readonly type: Type;
|
|
71
|
+
readonly message: string;
|
|
72
|
+
readonly data?: Data;
|
|
73
|
+
}
|
|
74
|
+
export type SystemError = Failure<"rpc.unavailable" | "rpc.method_not_found" | "rpc.invalid_input" | "rpc.invalid_output" | "rpc.internal", never>;
|
|
75
|
+
export type ErrorName<M extends Method> = M extends {
|
|
76
|
+
readonly errors: infer Errors extends ErrorMap;
|
|
77
|
+
} ? Exclude<keyof Errors & string, `rpc.${string}`> : never;
|
|
78
|
+
export type HandlerErrorFor<M extends Method, Name extends ErrorName<M>> = Simplify<{
|
|
79
|
+
readonly type: Name;
|
|
80
|
+
readonly message: string;
|
|
81
|
+
readonly [HandlerErrorTypeId]: true;
|
|
82
|
+
} & ErrorData<HandlerOutput<ErrorSchema<M, Name>>>>;
|
|
83
|
+
export type HandlerError<M extends Method> = {
|
|
84
|
+
readonly [Name in ErrorName<M>]: HandlerErrorFor<M, Name>;
|
|
85
|
+
}[ErrorName<M>];
|
|
86
|
+
export type MethodErrorFor<M extends Method, Name extends ErrorName<M>> = Simplify<{
|
|
87
|
+
readonly type: Name;
|
|
88
|
+
readonly message: string;
|
|
89
|
+
} & ErrorData<Output<ErrorSchema<M, Name>>>>;
|
|
90
|
+
export type MethodError<M extends Method> = {
|
|
91
|
+
readonly [Name in ErrorName<M>]: MethodErrorFor<M, Name>;
|
|
92
|
+
}[ErrorName<M>];
|
|
93
|
+
export type ErrorArguments<M extends Method, Name extends ErrorName<M>> = [
|
|
94
|
+
type: Name,
|
|
95
|
+
message: string,
|
|
96
|
+
...data: ErrorDataArguments<HandlerOutput<ErrorSchema<M, Name>>>
|
|
97
|
+
];
|
|
98
|
+
export type ErrorFactory<M extends Method> = <Name extends ErrorName<M>>(...args: ErrorArguments<M, Name>) => HandlerErrorFor<M, Name>;
|
|
99
|
+
export type EventInputData<S extends EventValueSchema> = S extends JsonSchema.JsonSchema ? EventDataObject : HandlerOutput<S>;
|
|
100
|
+
export type EventData<S extends EventValueSchema> = S extends JsonSchema.JsonSchema ? EventDataObject : Output<S>;
|
|
101
|
+
export type EventInput<D extends Definition> = {
|
|
102
|
+
[Name in keyof D["events"] & string]: [name: Name, data: EventInputData<D["events"][Name]["schema"]>];
|
|
103
|
+
}[keyof D["events"] & string];
|
|
104
|
+
type EventPayloadFor<D extends Definition, Name extends keyof D["events"] & string> = Omit<Event.Payload<Event.EphemeralDefinition>, "type" | "data" | "durable" | "location"> & {
|
|
105
|
+
readonly type: `rpc.${D["id"]}.${Name}`;
|
|
106
|
+
readonly data: EventData<D["events"][Name]["schema"]>;
|
|
107
|
+
readonly location: Location.Ref;
|
|
108
|
+
};
|
|
109
|
+
export type EventPayload<D extends Definition, Name extends keyof D["events"] & string = keyof D["events"] & string> = {
|
|
110
|
+
readonly [K in Name]: EventPayloadFor<D, K>;
|
|
111
|
+
}[Name];
|
package/dist/rpc.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * as Rpc from "./rpc.js";
|
|
2
|
+
export function define(definition) {
|
|
3
|
+
const reserved = Object.values(definition.methods)
|
|
4
|
+
.flatMap((method) => Object.keys(method.errors ?? {}))
|
|
5
|
+
.find((name) => name.startsWith("rpc."));
|
|
6
|
+
if (reserved)
|
|
7
|
+
throw new Error(`RPC error names starting with "rpc." are reserved: ${reserved}`);
|
|
8
|
+
return definition;
|
|
9
|
+
}
|
package/dist/schema.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const PositiveInt: Schema.Int;
|
|
3
|
+
export declare const NonNegativeInt: Schema.Int;
|
|
4
|
+
export declare const RelativePath: Schema.brand<Schema.String, "RelativePath">;
|
|
5
|
+
export type RelativePath = typeof RelativePath.Type;
|
|
6
|
+
export declare const AbsolutePath: Schema.brand<Schema.String, "AbsolutePath">;
|
|
7
|
+
export type AbsolutePath = typeof AbsolutePath.Type;
|
|
8
|
+
export declare const optional: <S extends Schema.Top>(schema: S) => Schema.decodeTo<Schema.optional<Schema.toType<S>>, Schema.optionalKey<S>, never, never>;
|
|
9
|
+
export declare const statics: <S extends object, M extends Record<string, unknown>>(methods: (schema: S) => M) => (schema: S) => S & M;
|
|
10
|
+
export declare const DateTimeUtcFromMillis: Schema.decodeTo<Schema.DateTimeUtc, Schema.Finite, never, never>;
|
package/dist/schema.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DateTime, Option, Schema, SchemaGetter } from "effect";
|
|
2
|
+
export const PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));
|
|
3
|
+
export const NonNegativeInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));
|
|
4
|
+
export const RelativePath = Schema.String.pipe(Schema.brand("RelativePath"));
|
|
5
|
+
export const AbsolutePath = Schema.String.pipe(Schema.brand("AbsolutePath"));
|
|
6
|
+
export const optional = (schema) => Schema.optionalKey(schema).pipe(Schema.decodeTo(Schema.optional(Schema.toType(schema)), {
|
|
7
|
+
decode: SchemaGetter.passthrough({ strict: false }),
|
|
8
|
+
encode: SchemaGetter.transformOptional(Option.filter((value) => value !== undefined)),
|
|
9
|
+
}));
|
|
10
|
+
export const statics = (methods) => (schema) => Object.assign(schema, methods(schema));
|
|
11
|
+
export const DateTimeUtcFromMillis = Schema.Finite.pipe(Schema.decodeTo(Schema.DateTimeUtc, {
|
|
12
|
+
decode: SchemaGetter.transform((value) => DateTime.makeUnsafe(value)),
|
|
13
|
+
encode: SchemaGetter.transform((value) => DateTime.toEpochMillis(value)),
|
|
14
|
+
}));
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export * as ServerEvent from "./server-event.js";
|
|
2
|
+
export declare const Connected: import("effect/Schema").Struct<{
|
|
3
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
4
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
5
|
+
};
|
|
6
|
+
readonly created: import("effect/Schema").Finite;
|
|
7
|
+
readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
|
|
8
|
+
readonly type: import("effect/Schema").Literal<"server.connected">;
|
|
9
|
+
readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
|
|
10
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
11
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
12
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
13
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
14
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
15
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
16
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
17
|
+
}>, never, never>;
|
|
18
|
+
}>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
|
|
19
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
20
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
21
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
22
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
23
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
24
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
25
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
26
|
+
}>, never, never>;
|
|
27
|
+
}>>, never, never>;
|
|
28
|
+
readonly data: import("effect/Schema").Struct<{}>;
|
|
29
|
+
}> & {
|
|
30
|
+
type: "server.connected";
|
|
31
|
+
durability: "ephemeral";
|
|
32
|
+
durable: undefined;
|
|
33
|
+
data: import("effect/Schema").Struct<{}>;
|
|
34
|
+
};
|
|
35
|
+
export declare const Disposed: import("effect/Schema").Struct<{
|
|
36
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
37
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
38
|
+
};
|
|
39
|
+
readonly created: import("effect/Schema").Finite;
|
|
40
|
+
readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
|
|
41
|
+
readonly type: import("effect/Schema").Literal<"global.disposed">;
|
|
42
|
+
readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
|
|
43
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
44
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
45
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
46
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
47
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
48
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
49
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
50
|
+
}>, never, never>;
|
|
51
|
+
}>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
|
|
52
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
53
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
54
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
55
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
56
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
57
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
58
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
59
|
+
}>, never, never>;
|
|
60
|
+
}>>, never, never>;
|
|
61
|
+
readonly data: import("effect/Schema").Struct<{}>;
|
|
62
|
+
}> & {
|
|
63
|
+
type: "global.disposed";
|
|
64
|
+
durability: "ephemeral";
|
|
65
|
+
durable: undefined;
|
|
66
|
+
data: import("effect/Schema").Struct<{}>;
|
|
67
|
+
};
|
|
68
|
+
export declare const Definitions: readonly [import("effect/Schema").Struct<{
|
|
69
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
70
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
71
|
+
};
|
|
72
|
+
readonly created: import("effect/Schema").Finite;
|
|
73
|
+
readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
|
|
74
|
+
readonly type: import("effect/Schema").Literal<"server.connected">;
|
|
75
|
+
readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
|
|
76
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
77
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
78
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
79
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
80
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
81
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
82
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
83
|
+
}>, never, never>;
|
|
84
|
+
}>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
|
|
85
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
86
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
87
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
88
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
89
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
90
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
91
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
92
|
+
}>, never, never>;
|
|
93
|
+
}>>, never, never>;
|
|
94
|
+
readonly data: import("effect/Schema").Struct<{}>;
|
|
95
|
+
}> & {
|
|
96
|
+
type: "server.connected";
|
|
97
|
+
durability: "ephemeral";
|
|
98
|
+
durable: undefined;
|
|
99
|
+
data: import("effect/Schema").Struct<{}>;
|
|
100
|
+
}, import("effect/Schema").Struct<{
|
|
101
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
102
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
103
|
+
};
|
|
104
|
+
readonly created: import("effect/Schema").Finite;
|
|
105
|
+
readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
|
|
106
|
+
readonly type: import("effect/Schema").Literal<"global.disposed">;
|
|
107
|
+
readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
|
|
108
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
109
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
110
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
111
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
112
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
113
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
114
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
115
|
+
}>, never, never>;
|
|
116
|
+
}>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
|
|
117
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
118
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
119
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
120
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
121
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
122
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
123
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
124
|
+
}>, never, never>;
|
|
125
|
+
}>>, never, never>;
|
|
126
|
+
readonly data: import("effect/Schema").Struct<{}>;
|
|
127
|
+
}> & {
|
|
128
|
+
type: "global.disposed";
|
|
129
|
+
durability: "ephemeral";
|
|
130
|
+
durable: undefined;
|
|
131
|
+
data: import("effect/Schema").Struct<{}>;
|
|
132
|
+
}];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * as ServerEvent from "./server-event.js";
|
|
2
|
+
import { Event } from "./event.js";
|
|
3
|
+
export const Connected = Event.ephemeral({ type: "server.connected", schema: {} });
|
|
4
|
+
export const Disposed = Event.ephemeral({ type: "global.disposed", schema: {} });
|
|
5
|
+
export const Definitions = Event.inventory(Connected, Disposed);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export * as SessionCompactionEvent from "./session-compaction-event.js";
|
|
2
|
+
export declare const Compacted: import("effect/Schema").Struct<{
|
|
3
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
4
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
5
|
+
};
|
|
6
|
+
readonly created: import("effect/Schema").Finite;
|
|
7
|
+
readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
|
|
8
|
+
readonly type: import("effect/Schema").Literal<"session.compacted">;
|
|
9
|
+
readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
|
|
10
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
11
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
12
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
13
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
14
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
15
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
16
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
17
|
+
}>, never, never>;
|
|
18
|
+
}>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
|
|
19
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
20
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
21
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
22
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
23
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
24
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
25
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
26
|
+
}>, never, never>;
|
|
27
|
+
}>>, never, never>;
|
|
28
|
+
readonly data: import("effect/Schema").Struct<{
|
|
29
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
30
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
31
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
32
|
+
};
|
|
33
|
+
}>;
|
|
34
|
+
}> & {
|
|
35
|
+
type: "session.compacted";
|
|
36
|
+
durability: "ephemeral";
|
|
37
|
+
durable: undefined;
|
|
38
|
+
data: import("effect/Schema").Struct<{
|
|
39
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
40
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
41
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
export declare const Definitions: readonly [import("effect/Schema").Struct<{
|
|
46
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
47
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
48
|
+
};
|
|
49
|
+
readonly created: import("effect/Schema").Finite;
|
|
50
|
+
readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
|
|
51
|
+
readonly type: import("effect/Schema").Literal<"session.compacted">;
|
|
52
|
+
readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
|
|
53
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
54
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
55
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
56
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
57
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
58
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
59
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
60
|
+
}>, never, never>;
|
|
61
|
+
}>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
|
|
62
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
63
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
64
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
65
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
66
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
67
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
68
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
69
|
+
}>, never, never>;
|
|
70
|
+
}>>, never, never>;
|
|
71
|
+
readonly data: import("effect/Schema").Struct<{
|
|
72
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
73
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
74
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
75
|
+
};
|
|
76
|
+
}>;
|
|
77
|
+
}> & {
|
|
78
|
+
type: "session.compacted";
|
|
79
|
+
durability: "ephemeral";
|
|
80
|
+
durable: undefined;
|
|
81
|
+
data: import("effect/Schema").Struct<{
|
|
82
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
83
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
84
|
+
descending: (id?: string) => string & import("effect/Brand").Brand<"SessionID">;
|
|
85
|
+
};
|
|
86
|
+
}>;
|
|
87
|
+
}];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * as SessionCompactionEvent from "./session-compaction-event.js";
|
|
2
|
+
import { Event } from "./event.js";
|
|
3
|
+
import { SessionID } from "./session-id.js";
|
|
4
|
+
export const Compacted = Event.ephemeral({
|
|
5
|
+
type: "session.compacted",
|
|
6
|
+
schema: {
|
|
7
|
+
sessionID: SessionID,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export const Definitions = Event.inventory(Compacted);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * as SessionError from "./session-error.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
export interface Error extends Schema.Schema.Type<typeof Error> {
|
|
4
|
+
}
|
|
5
|
+
export declare const Error: Schema.Struct<{
|
|
6
|
+
readonly type: Schema.String;
|
|
7
|
+
readonly message: Schema.String;
|
|
8
|
+
readonly status: Schema.decodeTo<Schema.optional<Schema.toType<Schema.Int>>, Schema.optionalKey<Schema.Int>, never, never>;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * as SessionError from "./session-error.js";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
import { optional } from "./schema.js";
|
|
4
|
+
export const Error = Schema.Struct({
|
|
5
|
+
type: Schema.String,
|
|
6
|
+
message: Schema.String,
|
|
7
|
+
status: Schema.Int.check(Schema.isBetween({ minimum: 100, maximum: 599 })).pipe(optional),
|
|
8
|
+
}).annotate({ identifier: "Session.StructuredError" });
|