@swirls/looms 0.0.1 → 0.1.0
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/CHANGELOG.md +53 -0
- package/README.md +2 -0
- package/dist/actor/cell.d.ts +9 -4
- package/dist/actor/cell.js +7 -11
- package/dist/actor/host.d.ts +7 -3
- package/dist/actor/host.js +55 -32
- package/dist/actor/index.d.ts +1 -1
- package/dist/actor/index.js +1 -1
- package/dist/actor/routing.d.ts +12 -1
- package/dist/actor/routing.js +57 -51
- package/dist/agent/agent-session.d.ts +5 -0
- package/dist/agent/agent-session.js +270 -0
- package/dist/agent/definitions-store.d.ts +2 -3
- package/dist/agent/definitions-store.js +2 -4
- package/dist/agent/definitions.d.ts +46 -20
- package/dist/agent/definitions.js +36 -8
- package/dist/agent/effects.d.ts +359 -2
- package/dist/agent/effects.js +60 -34
- package/dist/agent/events.d.ts +175 -19
- package/dist/agent/events.js +45 -10
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +1 -0
- package/dist/agent/llm.d.ts +11 -2
- package/dist/agent/llm.js +13 -3
- package/dist/agent/module.d.ts +812 -78
- package/dist/agent/module.js +16 -4
- package/dist/agent/scope.d.ts +174 -18
- package/dist/agent/signals.d.ts +24 -1
- package/dist/agent/signals.js +77 -0
- package/dist/agent/threads.d.ts +3 -33
- package/dist/agent/threads.js +20 -25
- package/dist/agent/tool-schema.js +0 -1
- package/dist/agent/types.d.ts +49 -4
- package/dist/agent/types.js +5 -5
- package/dist/ai-vercel/index.d.ts +1 -0
- package/dist/ai-vercel/index.js +1 -0
- package/dist/ai-vercel/messages.js +22 -7
- package/dist/ai-vercel/vercel-evaluator.d.ts +23 -0
- package/dist/ai-vercel/vercel-evaluator.js +68 -0
- package/dist/ai-vercel/vercel-llm.js +64 -44
- package/dist/approval/effects.d.ts +89 -0
- package/dist/approval/module.d.ts +179 -29
- package/dist/approval/projections.d.ts +0 -14
- package/dist/approval/projections.js +20 -3
- package/dist/approval/signals.d.ts +2 -0
- package/dist/approval/signals.js +18 -2
- package/dist/cli/cli.js +2 -0
- package/dist/cli/commands.js +12 -16
- package/dist/client/client.d.ts +1195 -18
- package/dist/client/client.js +118 -120
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/sse.d.ts +13 -0
- package/dist/client/sse.js +38 -44
- package/dist/cloudflare/alarm-scheduler.d.ts +12 -2
- package/dist/cloudflare/alarm-scheduler.js +34 -7
- package/dist/cloudflare/durable-object.d.ts +10 -2
- package/dist/cloudflare/durable-object.js +59 -28
- package/dist/cloudflare/event-store.d.ts +7 -2
- package/dist/cloudflare/event-store.js +8 -7
- package/dist/cloudflare/index.d.ts +2 -2
- package/dist/cloudflare/index.js +2 -2
- package/dist/cloudflare/router.js +13 -14
- package/dist/core/catalog.d.ts +3 -3
- package/dist/core/catalog.js +2 -5
- package/dist/core/coalesce.js +5 -3
- package/dist/core/compose.d.ts +2 -1
- package/dist/core/compose.js +18 -2
- package/dist/core/definition-store.d.ts +11 -0
- package/dist/core/definition-store.js +6 -0
- package/dist/core/effects.d.ts +127 -15
- package/dist/core/effects.js +89 -17
- package/dist/core/envelope.d.ts +27 -7
- package/dist/core/envelope.js +20 -6
- package/dist/core/event-codec.d.ts +4 -2
- package/dist/core/event-codec.js +10 -5
- package/dist/core/event-index.js +1 -3
- package/dist/core/fold.d.ts +3 -0
- package/dist/core/fold.js +171 -24
- package/dist/core/ids.d.ts +5 -0
- package/dist/core/ids.js +35 -2
- package/dist/core/index.d.ts +5 -1
- package/dist/core/index.js +5 -1
- package/dist/core/kind.d.ts +22 -0
- package/dist/core/kind.js +17 -0
- package/dist/core/limits.d.ts +34 -0
- package/dist/core/limits.js +46 -0
- package/dist/core/match.d.ts +1 -0
- package/dist/core/match.js +10 -1
- package/dist/core/module-scope.d.ts +22 -20
- package/dist/core/module-scope.js +38 -28
- package/dist/core/module.d.ts +16 -5
- package/dist/core/module.js +4 -0
- package/dist/core/projection.d.ts +13 -13
- package/dist/core/projection.js +9 -5
- package/dist/core/protocol.d.ts +68 -11
- package/dist/core/protocol.js +82 -11
- package/dist/core/replay.d.ts +312 -3
- package/dist/core/replay.js +11 -1
- package/dist/core/schema.d.ts +8 -19
- package/dist/core/schema.js +25 -80
- package/dist/core/serialize.js +2 -4
- package/dist/core/snapshot-store.d.ts +2 -1
- package/dist/core/snapshot-store.js +8 -2
- package/dist/core/snapshots.d.ts +5 -1
- package/dist/core/snapshots.js +10 -15
- package/dist/core/sqlite-store.js +56 -11
- package/dist/core/state.d.ts +142 -4
- package/dist/core/state.js +78 -0
- package/dist/core/store.d.ts +38 -3
- package/dist/core/store.js +77 -22
- package/dist/core/thread.d.ts +10 -9
- package/dist/core/types.d.ts +5 -8
- package/dist/core/types.js +28 -24
- package/dist/core/validate-event.js +14 -4
- package/dist/core/worker-callback.d.ts +17 -0
- package/dist/core/worker-callback.js +1 -0
- package/dist/debugger/components/event-stream.js +9 -10
- package/dist/debugger/events/protocol-summarize.js +26 -0
- package/dist/debugger/lib/event-meta.js +1 -2
- package/dist/evaluator/definitions-store.d.ts +11 -0
- package/dist/evaluator/definitions-store.js +8 -0
- package/dist/evaluator/definitions.d.ts +18 -0
- package/dist/evaluator/definitions.js +4 -0
- package/dist/evaluator/effects.d.ts +226 -0
- package/dist/evaluator/effects.js +132 -0
- package/dist/evaluator/evaluator.d.ts +24 -0
- package/dist/evaluator/evaluator.js +67 -0
- package/dist/evaluator/events.d.ts +59 -0
- package/dist/evaluator/events.js +21 -0
- package/dist/evaluator/index.d.ts +11 -0
- package/dist/evaluator/index.js +11 -0
- package/dist/evaluator/module.d.ts +606 -0
- package/dist/evaluator/module.js +25 -0
- package/dist/evaluator/projections.d.ts +50 -0
- package/dist/evaluator/projections.js +20 -0
- package/dist/evaluator/scope.d.ts +59 -0
- package/dist/evaluator/scope.js +7 -0
- package/dist/evaluator/signals.d.ts +3 -0
- package/dist/evaluator/signals.js +17 -0
- package/dist/evaluator/threads.d.ts +62 -0
- package/dist/evaluator/threads.js +117 -0
- package/dist/evaluator/types.d.ts +125 -0
- package/dist/evaluator/types.js +51 -0
- package/dist/projectors/delivery.d.ts +83 -0
- package/dist/projectors/delivery.js +182 -0
- package/dist/projectors/index-model.d.ts +1 -1
- package/dist/projectors/index-model.js +4 -6
- package/dist/projectors/index.d.ts +2 -0
- package/dist/projectors/index.js +2 -0
- package/dist/projectors/memory.d.ts +1 -1
- package/dist/projectors/memory.js +10 -8
- package/dist/projectors/postgres.js +44 -58
- package/dist/projectors/projector.d.ts +17 -0
- package/dist/projectors/projector.js +26 -1
- package/dist/projectors/sqlite-delivery.d.ts +4 -0
- package/dist/projectors/sqlite-delivery.js +147 -0
- package/dist/projectors/sqlite.js +23 -23
- package/dist/projectors/with-projectors.d.ts +7 -2
- package/dist/projectors/with-projectors.js +27 -28
- package/dist/react/notify.js +11 -8
- package/dist/react/react.d.ts +2 -3
- package/dist/react/react.js +14 -30
- package/dist/react/sse.d.ts +1 -1
- package/dist/react/sse.js +1 -1
- package/dist/react/store.d.ts +2 -2
- package/dist/react/store.js +109 -119
- package/dist/runtime/cancellation.d.ts +16 -0
- package/dist/runtime/cancellation.js +129 -0
- package/dist/runtime/deadline-transition-planner.d.ts +31 -0
- package/dist/runtime/deadline-transition-planner.js +139 -0
- package/dist/runtime/dispatch-effect.d.ts +3 -2
- package/dist/runtime/dispatch-effect.js +7 -13
- package/dist/runtime/errors.d.ts +51 -0
- package/dist/runtime/errors.js +39 -0
- package/dist/runtime/{runtime-helpers.d.ts → helpers.d.ts} +24 -4
- package/dist/runtime/{runtime-helpers.js → helpers.js} +56 -19
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/index.js +3 -3
- package/dist/runtime/ingress.d.ts +15 -0
- package/dist/runtime/ingress.js +42 -0
- package/dist/runtime/local-effect-executor.d.ts +21 -0
- package/dist/runtime/local-effect-executor.js +137 -0
- package/dist/runtime/looms.d.ts +22 -4
- package/dist/runtime/looms.js +54 -36
- package/dist/runtime/observer.d.ts +45 -0
- package/dist/runtime/observer.js +11 -0
- package/dist/runtime/repository.d.ts +55 -0
- package/dist/runtime/repository.js +278 -0
- package/dist/runtime/retry-policy.d.ts +16 -0
- package/dist/runtime/retry-policy.js +29 -0
- package/dist/runtime/run-execution-context.d.ts +30 -0
- package/dist/runtime/run-execution-context.js +56 -0
- package/dist/runtime/run-start.d.ts +4 -0
- package/dist/runtime/run-start.js +44 -0
- package/dist/runtime/runtime.d.ts +6 -87
- package/dist/runtime/runtime.js +233 -470
- package/dist/runtime/server/auth.d.ts +40 -0
- package/dist/runtime/server/auth.js +40 -0
- package/dist/runtime/server/fetch-handler.d.ts +14 -0
- package/dist/runtime/server/fetch-handler.js +51 -0
- package/dist/runtime/server/http.d.ts +37 -0
- package/dist/runtime/server/http.js +62 -0
- package/dist/runtime/server/route-table.d.ts +55 -0
- package/dist/runtime/server/route-table.js +74 -0
- package/dist/runtime/server/routes/effects.d.ts +3 -0
- package/dist/runtime/server/routes/effects.js +59 -0
- package/dist/runtime/server/routes/operations.d.ts +3 -0
- package/dist/runtime/server/routes/operations.js +14 -0
- package/dist/runtime/server/routes/runs.d.ts +3 -0
- package/dist/runtime/server/routes/runs.js +192 -0
- package/dist/runtime/server.d.ts +2 -8
- package/dist/runtime/server.js +4 -211
- package/dist/runtime/sse.d.ts +2 -1
- package/dist/runtime/sse.js +24 -17
- package/dist/runtime/types.d.ts +115 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/wake-engine.d.ts +20 -0
- package/dist/runtime/wake-engine.js +311 -0
- package/dist/runtime/wake-scheduler.d.ts +3 -4
- package/dist/runtime/wake-scheduler.js +25 -31
- package/dist/runtime/worker-callbacks.d.ts +16 -0
- package/dist/runtime/worker-callbacks.js +167 -0
- package/dist/runtime/worker-effect-dispatch.d.ts +36 -0
- package/dist/runtime/worker-effect-dispatch.js +126 -0
- package/dist/s2/config.d.ts +1 -1
- package/dist/s2/config.js +1 -1
- package/dist/s2/lite.js +70 -82
- package/dist/s2/pagination.d.ts +15 -0
- package/dist/s2/pagination.js +36 -0
- package/dist/s2/projector.js +6 -5
- package/dist/s2/snapshot-store.js +148 -163
- package/dist/s2/store.d.ts +3 -21
- package/dist/s2/store.js +71 -165
- package/dist/testing/index.d.ts +15 -0
- package/dist/testing/index.js +53 -16
- package/dist/workflow/definitions-store.d.ts +2 -3
- package/dist/workflow/definitions-store.js +2 -2
- package/dist/workflow/definitions.d.ts +78 -22
- package/dist/workflow/definitions.js +80 -14
- package/dist/workflow/effects.d.ts +359 -13
- package/dist/workflow/effects.js +214 -115
- package/dist/workflow/events.d.ts +149 -5
- package/dist/workflow/events.js +27 -5
- package/dist/workflow/graph.d.ts +56 -0
- package/dist/workflow/graph.js +207 -0
- package/dist/workflow/index.d.ts +1 -0
- package/dist/workflow/index.js +1 -0
- package/dist/workflow/module.d.ts +1047 -266
- package/dist/workflow/projections.d.ts +14 -12
- package/dist/workflow/projections.js +30 -8
- package/dist/workflow/scope.d.ts +146 -4
- package/dist/workflow/threads.d.ts +383 -155
- package/dist/workflow/threads.js +308 -110
- package/package.json +8 -2
- package/dist/runtime/events-api.d.ts +0 -4
- package/dist/runtime/events-api.js +0 -84
package/dist/core/protocol.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
1
|
+
import { Effect, Schema } from 'effect';
|
|
2
2
|
import { defineEventCatalog } from './catalog.js';
|
|
3
|
+
import { WaitConditionSchema } from './effects.js';
|
|
3
4
|
import { JsonValueSchema } from './envelope.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
match: Schema.optional(JsonValueSchema),
|
|
7
|
-
});
|
|
8
|
-
const WaitOnTimerSchema = Schema.Struct({
|
|
9
|
-
timerAt: Schema.Number,
|
|
10
|
-
});
|
|
11
|
-
export const WaitConditionSchema = Schema.Union([WaitOnEventSchema, WaitOnTimerSchema]);
|
|
5
|
+
import { DEFAULT_DEFINITION_VERSION } from './module.js';
|
|
6
|
+
const DefinitionVersionSchema = Schema.String.pipe(Schema.withDecodingDefaultKey(Effect.succeed(DEFAULT_DEFINITION_VERSION)));
|
|
12
7
|
export const protocolCatalog = defineEventCatalog('runtime', {
|
|
13
8
|
'run.started': Schema.Struct({
|
|
14
9
|
rootThreadId: Schema.optional(Schema.String),
|
|
15
10
|
kind: Schema.String,
|
|
16
11
|
definitionName: Schema.String,
|
|
12
|
+
definitionVersion: DefinitionVersionSchema,
|
|
17
13
|
input: JsonValueSchema,
|
|
14
|
+
requestedThreadId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
18
15
|
}),
|
|
19
16
|
'run.completed': Schema.Struct({
|
|
20
17
|
output: Schema.NullOr(JsonValueSchema),
|
|
21
18
|
error: Schema.NullOr(Schema.String),
|
|
22
19
|
}),
|
|
20
|
+
'run.cancelled': Schema.Struct({
|
|
21
|
+
reason: Schema.optional(Schema.String),
|
|
22
|
+
}),
|
|
23
23
|
'thread.started': Schema.Struct({
|
|
24
24
|
threadId: Schema.String,
|
|
25
25
|
kind: Schema.String,
|
|
26
26
|
definitionName: Schema.String,
|
|
27
|
+
definitionVersion: DefinitionVersionSchema,
|
|
27
28
|
input: JsonValueSchema,
|
|
28
29
|
parentThreadId: Schema.NullOr(Schema.String),
|
|
29
30
|
}),
|
|
@@ -39,6 +40,9 @@ export const protocolCatalog = defineEventCatalog('runtime', {
|
|
|
39
40
|
threadId: Schema.String,
|
|
40
41
|
reason: Schema.optional(Schema.String),
|
|
41
42
|
}),
|
|
43
|
+
'thread.cancel.requested': Schema.Struct({
|
|
44
|
+
threadId: Schema.String,
|
|
45
|
+
}),
|
|
42
46
|
'wait.registered': Schema.Struct({
|
|
43
47
|
waitId: Schema.String,
|
|
44
48
|
threadId: Schema.optional(Schema.String),
|
|
@@ -57,7 +61,7 @@ export const protocolCatalog = defineEventCatalog('runtime', {
|
|
|
57
61
|
'timer.set': Schema.Struct({
|
|
58
62
|
timerId: Schema.String,
|
|
59
63
|
waitId: Schema.String,
|
|
60
|
-
wakeAt: Schema.
|
|
64
|
+
wakeAt: Schema.Finite,
|
|
61
65
|
}),
|
|
62
66
|
'timer.fired': Schema.Struct({
|
|
63
67
|
timerId: Schema.String,
|
|
@@ -67,8 +71,62 @@ export const protocolCatalog = defineEventCatalog('runtime', {
|
|
|
67
71
|
effectId: Schema.String,
|
|
68
72
|
error: Schema.String,
|
|
69
73
|
}),
|
|
74
|
+
'effect.attempt.started': Schema.Struct({
|
|
75
|
+
effectId: Schema.String,
|
|
76
|
+
attempt: Schema.Finite,
|
|
77
|
+
}),
|
|
78
|
+
'effect.queued': Schema.Struct({
|
|
79
|
+
effectId: Schema.String,
|
|
80
|
+
attempt: Schema.Finite,
|
|
81
|
+
deadlineAt: Schema.NullOr(Schema.Finite),
|
|
82
|
+
}),
|
|
83
|
+
'effect.dispatched': Schema.Struct({
|
|
84
|
+
effectId: Schema.String,
|
|
85
|
+
attempt: Schema.Finite,
|
|
86
|
+
deadlineAt: Schema.NullOr(Schema.Finite),
|
|
87
|
+
}),
|
|
88
|
+
'effect.worker.started': Schema.Struct({
|
|
89
|
+
effectId: Schema.String,
|
|
90
|
+
attempt: Schema.Finite,
|
|
91
|
+
deadlineAt: Schema.NullOr(Schema.Finite),
|
|
92
|
+
}),
|
|
93
|
+
'effect.heartbeat': Schema.Struct({
|
|
94
|
+
effectId: Schema.String,
|
|
95
|
+
attempt: Schema.Finite,
|
|
96
|
+
heartbeatAt: Schema.Finite,
|
|
97
|
+
deadlineAt: Schema.NullOr(Schema.Finite),
|
|
98
|
+
}),
|
|
99
|
+
'effect.cancel.requested': Schema.Struct({
|
|
100
|
+
effectId: Schema.String,
|
|
101
|
+
attempt: Schema.Finite,
|
|
102
|
+
deadlineAt: Schema.NullOr(Schema.Finite),
|
|
103
|
+
}),
|
|
104
|
+
'effect.cancelled': Schema.Struct({
|
|
105
|
+
effectId: Schema.String,
|
|
106
|
+
attempt: Schema.Finite,
|
|
107
|
+
}),
|
|
108
|
+
'effect.completed': Schema.Struct({
|
|
109
|
+
effectId: Schema.String,
|
|
110
|
+
attempt: Schema.Finite,
|
|
111
|
+
}),
|
|
112
|
+
'effect.timed_out': Schema.Struct({
|
|
113
|
+
effectId: Schema.String,
|
|
114
|
+
attempt: Schema.Finite,
|
|
115
|
+
timeout: Schema.String,
|
|
116
|
+
}),
|
|
117
|
+
'effect.ambiguous': Schema.Struct({
|
|
118
|
+
effectId: Schema.String,
|
|
119
|
+
attempt: Schema.Finite,
|
|
120
|
+
error: Schema.String,
|
|
121
|
+
}),
|
|
122
|
+
'effect.retry.scheduled': Schema.Struct({
|
|
123
|
+
effectId: Schema.String,
|
|
124
|
+
attempt: Schema.Finite,
|
|
125
|
+
nextAttemptAt: Schema.Finite,
|
|
126
|
+
error: Schema.String,
|
|
127
|
+
}),
|
|
70
128
|
'snapshot.taken': Schema.Struct({
|
|
71
|
-
seq: Schema.
|
|
129
|
+
seq: Schema.Finite,
|
|
72
130
|
stateHash: Schema.String,
|
|
73
131
|
state: Schema.optional(JsonValueSchema),
|
|
74
132
|
}),
|
|
@@ -79,15 +137,28 @@ export const protocolCatalog = defineEventCatalog('runtime', {
|
|
|
79
137
|
export const PROTOCOL_TYPES = [
|
|
80
138
|
'runtime.run.started',
|
|
81
139
|
'runtime.run.completed',
|
|
140
|
+
'runtime.run.cancelled',
|
|
82
141
|
'runtime.thread.started',
|
|
83
142
|
'runtime.thread.completed',
|
|
84
143
|
'runtime.thread.failed',
|
|
85
144
|
'runtime.thread.cancelled',
|
|
145
|
+
'runtime.thread.cancel.requested',
|
|
86
146
|
'runtime.wait.registered',
|
|
87
147
|
'runtime.wait.satisfied',
|
|
88
148
|
'runtime.timer.set',
|
|
89
149
|
'runtime.timer.fired',
|
|
90
150
|
'runtime.effect.failed',
|
|
151
|
+
'runtime.effect.attempt.started',
|
|
152
|
+
'runtime.effect.queued',
|
|
153
|
+
'runtime.effect.dispatched',
|
|
154
|
+
'runtime.effect.worker.started',
|
|
155
|
+
'runtime.effect.heartbeat',
|
|
156
|
+
'runtime.effect.cancel.requested',
|
|
157
|
+
'runtime.effect.cancelled',
|
|
158
|
+
'runtime.effect.completed',
|
|
159
|
+
'runtime.effect.timed_out',
|
|
160
|
+
'runtime.effect.ambiguous',
|
|
161
|
+
'runtime.effect.retry.scheduled',
|
|
91
162
|
'runtime.snapshot.taken',
|
|
92
163
|
'runtime.signal.received',
|
|
93
164
|
];
|
package/dist/core/replay.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import { type RuntimeEffect } from './effects';
|
|
3
|
+
import { type EventEnvelope } from './envelope';
|
|
3
4
|
import { type FoldRegistry } from './fold';
|
|
4
5
|
import { type RunState } from './state';
|
|
5
6
|
export interface ReplayStep {
|
|
@@ -7,7 +8,315 @@ export interface ReplayStep {
|
|
|
7
8
|
event: EventEnvelope;
|
|
8
9
|
before: RunState;
|
|
9
10
|
after: RunState;
|
|
10
|
-
effects: RuntimeEffect[];
|
|
11
|
+
effects: readonly RuntimeEffect[];
|
|
11
12
|
}
|
|
13
|
+
export declare const ReplayStepSchema: Schema.Struct<{
|
|
14
|
+
readonly seq: Schema.Finite;
|
|
15
|
+
readonly event: Schema.Struct<{
|
|
16
|
+
readonly id: Schema.String;
|
|
17
|
+
readonly runId: Schema.String;
|
|
18
|
+
readonly seq: Schema.Finite;
|
|
19
|
+
readonly ts: Schema.Finite;
|
|
20
|
+
readonly type: Schema.String;
|
|
21
|
+
readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
22
|
+
readonly threadId: Schema.NullOr<Schema.String>;
|
|
23
|
+
readonly parentThreadId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
24
|
+
readonly causationId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
25
|
+
readonly correlationId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
26
|
+
readonly effectId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
27
|
+
readonly origin: Schema.Union<readonly [Schema.Struct<{
|
|
28
|
+
readonly type: Schema.Literal<"thread">;
|
|
29
|
+
readonly threadId: Schema.String;
|
|
30
|
+
}>, Schema.Struct<{
|
|
31
|
+
readonly type: Schema.Literal<"external">;
|
|
32
|
+
readonly actorId: Schema.optional<Schema.String>;
|
|
33
|
+
}>, Schema.Struct<{
|
|
34
|
+
readonly type: Schema.Literal<"system">;
|
|
35
|
+
}>]>;
|
|
36
|
+
readonly ephemeral: Schema.optional<Schema.Boolean>;
|
|
37
|
+
readonly idempotencyKey: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
38
|
+
}>;
|
|
39
|
+
readonly before: Schema.Struct<{
|
|
40
|
+
readonly runId: Schema.String;
|
|
41
|
+
readonly status: Schema.Union<readonly [Schema.Literal<"running">, Schema.Literal<"completed">, Schema.Literal<"failed">, Schema.Literal<"cancelled">]>;
|
|
42
|
+
readonly rootThreadId: Schema.NullOr<Schema.String>;
|
|
43
|
+
readonly startIdentity: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
|
|
44
|
+
readonly kind: Schema.String;
|
|
45
|
+
readonly definitionName: Schema.String;
|
|
46
|
+
readonly definitionVersion: Schema.String;
|
|
47
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
48
|
+
readonly requestedThreadId: Schema.NullOr<Schema.String>;
|
|
49
|
+
readonly idempotencyKey: Schema.NullOr<Schema.String>;
|
|
50
|
+
readonly rootThreadId: Schema.String;
|
|
51
|
+
}>>, never>;
|
|
52
|
+
readonly threads: Schema.$Record<Schema.String, Schema.Struct<{
|
|
53
|
+
readonly threadId: Schema.String;
|
|
54
|
+
readonly kind: Schema.String;
|
|
55
|
+
readonly definitionName: Schema.String;
|
|
56
|
+
readonly definitionVersion: Schema.withDecodingDefaultKey<Schema.String, never>;
|
|
57
|
+
readonly parentThreadId: Schema.NullOr<Schema.String>;
|
|
58
|
+
readonly status: Schema.Union<readonly [Schema.Literal<"running">, Schema.Literal<"waiting">, Schema.Literal<"completed">, Schema.Literal<"failed">, Schema.Literal<"cancelled">]>;
|
|
59
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
60
|
+
readonly output: Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
61
|
+
readonly error: Schema.NullOr<Schema.String>;
|
|
62
|
+
readonly state: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
63
|
+
}>>;
|
|
64
|
+
readonly waits: Schema.$Record<Schema.String, Schema.Struct<{
|
|
65
|
+
readonly waitId: Schema.String;
|
|
66
|
+
readonly threadId: Schema.String;
|
|
67
|
+
readonly on: Schema.Union<readonly [Schema.Struct<{
|
|
68
|
+
readonly type: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>;
|
|
69
|
+
readonly match: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
70
|
+
}>, Schema.Struct<{
|
|
71
|
+
readonly timerAt: Schema.Finite;
|
|
72
|
+
}>]>;
|
|
73
|
+
readonly tag: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
74
|
+
}>>;
|
|
75
|
+
readonly outstandingEffects: Schema.$Array<Schema.Struct<{
|
|
76
|
+
readonly effectId: Schema.String;
|
|
77
|
+
readonly threadId: Schema.String;
|
|
78
|
+
readonly causingSeq: Schema.Finite;
|
|
79
|
+
readonly causingEventId: Schema.String;
|
|
80
|
+
readonly effect: Schema.Union<readonly [Schema.Struct<{
|
|
81
|
+
readonly type: Schema.Literal<"runtime.spawn">;
|
|
82
|
+
readonly childThreadId: Schema.String;
|
|
83
|
+
readonly kind: Schema.String;
|
|
84
|
+
readonly definitionName: Schema.String;
|
|
85
|
+
readonly definitionVersion: Schema.withDecodingDefaultKey<Schema.String, never>;
|
|
86
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
87
|
+
}>, Schema.Struct<{
|
|
88
|
+
readonly type: Schema.Literal<"runtime.wait">;
|
|
89
|
+
readonly waitId: Schema.String;
|
|
90
|
+
readonly on: Schema.Union<readonly [Schema.Struct<{
|
|
91
|
+
readonly type: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>;
|
|
92
|
+
readonly match: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
93
|
+
}>, Schema.Struct<{
|
|
94
|
+
readonly timerAt: Schema.Finite;
|
|
95
|
+
}>]>;
|
|
96
|
+
readonly tag: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
97
|
+
}>, Schema.Struct<{
|
|
98
|
+
readonly type: Schema.Literal<"runtime.emit">;
|
|
99
|
+
readonly event: Schema.Struct<{
|
|
100
|
+
readonly type: Schema.String;
|
|
101
|
+
readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
102
|
+
readonly threadId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
103
|
+
readonly parentThreadId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
104
|
+
readonly causationId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
105
|
+
readonly correlationId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
106
|
+
readonly effectId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
107
|
+
readonly origin: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
108
|
+
readonly type: Schema.Literal<"thread">;
|
|
109
|
+
readonly threadId: Schema.String;
|
|
110
|
+
}>, Schema.Struct<{
|
|
111
|
+
readonly type: Schema.Literal<"external">;
|
|
112
|
+
readonly actorId: Schema.optional<Schema.String>;
|
|
113
|
+
}>, Schema.Struct<{
|
|
114
|
+
readonly type: Schema.Literal<"system">;
|
|
115
|
+
}>]>>;
|
|
116
|
+
readonly ephemeral: Schema.optional<Schema.Boolean>;
|
|
117
|
+
readonly id: Schema.optional<Schema.String>;
|
|
118
|
+
readonly ts: Schema.optional<Schema.Finite>;
|
|
119
|
+
readonly idempotencyKey: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
120
|
+
}>;
|
|
121
|
+
readonly tag: Schema.optional<Schema.String>;
|
|
122
|
+
}>, Schema.Struct<{
|
|
123
|
+
readonly type: Schema.Literal<"runtime.complete">;
|
|
124
|
+
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
125
|
+
}>, Schema.Struct<{
|
|
126
|
+
readonly type: Schema.Literal<"runtime.fail">;
|
|
127
|
+
readonly error: Schema.String;
|
|
128
|
+
}>, Schema.Struct<{
|
|
129
|
+
readonly type: Schema.Literal<"runtime.cancel">;
|
|
130
|
+
readonly threadId: Schema.String;
|
|
131
|
+
readonly tag: Schema.optional<Schema.String>;
|
|
132
|
+
}>, Schema.Struct<{
|
|
133
|
+
readonly type: Schema.String;
|
|
134
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
135
|
+
readonly tag: Schema.optional<Schema.String>;
|
|
136
|
+
}>]>;
|
|
137
|
+
}>>;
|
|
138
|
+
readonly effectExecutions: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.Struct<{
|
|
139
|
+
readonly effectId: Schema.String;
|
|
140
|
+
readonly attempt: Schema.Finite;
|
|
141
|
+
readonly status: Schema.Union<readonly [Schema.Literal<"queued">, Schema.Literal<"dispatched">, Schema.Literal<"started">, Schema.Literal<"heartbeat">, Schema.Literal<"retry_wait">, Schema.Literal<"cancel_requested">, Schema.Literal<"timed_out">, Schema.Literal<"ambiguous">, Schema.Literal<"running">]>;
|
|
142
|
+
readonly nextAttemptAt: Schema.NullOr<Schema.Finite>;
|
|
143
|
+
readonly deadlineAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
|
|
144
|
+
readonly startedAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
|
|
145
|
+
readonly lastHeartbeatAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
|
|
146
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
147
|
+
}>>, never>;
|
|
148
|
+
readonly completedEffectIds: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
149
|
+
readonly processedIdempotencyKeys: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
150
|
+
}>;
|
|
151
|
+
readonly after: Schema.Struct<{
|
|
152
|
+
readonly runId: Schema.String;
|
|
153
|
+
readonly status: Schema.Union<readonly [Schema.Literal<"running">, Schema.Literal<"completed">, Schema.Literal<"failed">, Schema.Literal<"cancelled">]>;
|
|
154
|
+
readonly rootThreadId: Schema.NullOr<Schema.String>;
|
|
155
|
+
readonly startIdentity: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Struct<{
|
|
156
|
+
readonly kind: Schema.String;
|
|
157
|
+
readonly definitionName: Schema.String;
|
|
158
|
+
readonly definitionVersion: Schema.String;
|
|
159
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
160
|
+
readonly requestedThreadId: Schema.NullOr<Schema.String>;
|
|
161
|
+
readonly idempotencyKey: Schema.NullOr<Schema.String>;
|
|
162
|
+
readonly rootThreadId: Schema.String;
|
|
163
|
+
}>>, never>;
|
|
164
|
+
readonly threads: Schema.$Record<Schema.String, Schema.Struct<{
|
|
165
|
+
readonly threadId: Schema.String;
|
|
166
|
+
readonly kind: Schema.String;
|
|
167
|
+
readonly definitionName: Schema.String;
|
|
168
|
+
readonly definitionVersion: Schema.withDecodingDefaultKey<Schema.String, never>;
|
|
169
|
+
readonly parentThreadId: Schema.NullOr<Schema.String>;
|
|
170
|
+
readonly status: Schema.Union<readonly [Schema.Literal<"running">, Schema.Literal<"waiting">, Schema.Literal<"completed">, Schema.Literal<"failed">, Schema.Literal<"cancelled">]>;
|
|
171
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
172
|
+
readonly output: Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
173
|
+
readonly error: Schema.NullOr<Schema.String>;
|
|
174
|
+
readonly state: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
175
|
+
}>>;
|
|
176
|
+
readonly waits: Schema.$Record<Schema.String, Schema.Struct<{
|
|
177
|
+
readonly waitId: Schema.String;
|
|
178
|
+
readonly threadId: Schema.String;
|
|
179
|
+
readonly on: Schema.Union<readonly [Schema.Struct<{
|
|
180
|
+
readonly type: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>;
|
|
181
|
+
readonly match: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
182
|
+
}>, Schema.Struct<{
|
|
183
|
+
readonly timerAt: Schema.Finite;
|
|
184
|
+
}>]>;
|
|
185
|
+
readonly tag: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
186
|
+
}>>;
|
|
187
|
+
readonly outstandingEffects: Schema.$Array<Schema.Struct<{
|
|
188
|
+
readonly effectId: Schema.String;
|
|
189
|
+
readonly threadId: Schema.String;
|
|
190
|
+
readonly causingSeq: Schema.Finite;
|
|
191
|
+
readonly causingEventId: Schema.String;
|
|
192
|
+
readonly effect: Schema.Union<readonly [Schema.Struct<{
|
|
193
|
+
readonly type: Schema.Literal<"runtime.spawn">;
|
|
194
|
+
readonly childThreadId: Schema.String;
|
|
195
|
+
readonly kind: Schema.String;
|
|
196
|
+
readonly definitionName: Schema.String;
|
|
197
|
+
readonly definitionVersion: Schema.withDecodingDefaultKey<Schema.String, never>;
|
|
198
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
199
|
+
}>, Schema.Struct<{
|
|
200
|
+
readonly type: Schema.Literal<"runtime.wait">;
|
|
201
|
+
readonly waitId: Schema.String;
|
|
202
|
+
readonly on: Schema.Union<readonly [Schema.Struct<{
|
|
203
|
+
readonly type: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>;
|
|
204
|
+
readonly match: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
205
|
+
}>, Schema.Struct<{
|
|
206
|
+
readonly timerAt: Schema.Finite;
|
|
207
|
+
}>]>;
|
|
208
|
+
readonly tag: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
209
|
+
}>, Schema.Struct<{
|
|
210
|
+
readonly type: Schema.Literal<"runtime.emit">;
|
|
211
|
+
readonly event: Schema.Struct<{
|
|
212
|
+
readonly type: Schema.String;
|
|
213
|
+
readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
214
|
+
readonly threadId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
215
|
+
readonly parentThreadId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
216
|
+
readonly causationId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
217
|
+
readonly correlationId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
218
|
+
readonly effectId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
219
|
+
readonly origin: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
220
|
+
readonly type: Schema.Literal<"thread">;
|
|
221
|
+
readonly threadId: Schema.String;
|
|
222
|
+
}>, Schema.Struct<{
|
|
223
|
+
readonly type: Schema.Literal<"external">;
|
|
224
|
+
readonly actorId: Schema.optional<Schema.String>;
|
|
225
|
+
}>, Schema.Struct<{
|
|
226
|
+
readonly type: Schema.Literal<"system">;
|
|
227
|
+
}>]>>;
|
|
228
|
+
readonly ephemeral: Schema.optional<Schema.Boolean>;
|
|
229
|
+
readonly id: Schema.optional<Schema.String>;
|
|
230
|
+
readonly ts: Schema.optional<Schema.Finite>;
|
|
231
|
+
readonly idempotencyKey: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
232
|
+
}>;
|
|
233
|
+
readonly tag: Schema.optional<Schema.String>;
|
|
234
|
+
}>, Schema.Struct<{
|
|
235
|
+
readonly type: Schema.Literal<"runtime.complete">;
|
|
236
|
+
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
237
|
+
}>, Schema.Struct<{
|
|
238
|
+
readonly type: Schema.Literal<"runtime.fail">;
|
|
239
|
+
readonly error: Schema.String;
|
|
240
|
+
}>, Schema.Struct<{
|
|
241
|
+
readonly type: Schema.Literal<"runtime.cancel">;
|
|
242
|
+
readonly threadId: Schema.String;
|
|
243
|
+
readonly tag: Schema.optional<Schema.String>;
|
|
244
|
+
}>, Schema.Struct<{
|
|
245
|
+
readonly type: Schema.String;
|
|
246
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
247
|
+
readonly tag: Schema.optional<Schema.String>;
|
|
248
|
+
}>]>;
|
|
249
|
+
}>>;
|
|
250
|
+
readonly effectExecutions: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.Struct<{
|
|
251
|
+
readonly effectId: Schema.String;
|
|
252
|
+
readonly attempt: Schema.Finite;
|
|
253
|
+
readonly status: Schema.Union<readonly [Schema.Literal<"queued">, Schema.Literal<"dispatched">, Schema.Literal<"started">, Schema.Literal<"heartbeat">, Schema.Literal<"retry_wait">, Schema.Literal<"cancel_requested">, Schema.Literal<"timed_out">, Schema.Literal<"ambiguous">, Schema.Literal<"running">]>;
|
|
254
|
+
readonly nextAttemptAt: Schema.NullOr<Schema.Finite>;
|
|
255
|
+
readonly deadlineAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
|
|
256
|
+
readonly startedAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
|
|
257
|
+
readonly lastHeartbeatAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
|
|
258
|
+
readonly lastError: Schema.NullOr<Schema.String>;
|
|
259
|
+
}>>, never>;
|
|
260
|
+
readonly completedEffectIds: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
261
|
+
readonly processedIdempotencyKeys: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
|
|
262
|
+
}>;
|
|
263
|
+
readonly effects: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
264
|
+
readonly type: Schema.Literal<"runtime.spawn">;
|
|
265
|
+
readonly childThreadId: Schema.String;
|
|
266
|
+
readonly kind: Schema.String;
|
|
267
|
+
readonly definitionName: Schema.String;
|
|
268
|
+
readonly definitionVersion: Schema.withDecodingDefaultKey<Schema.String, never>;
|
|
269
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
270
|
+
}>, Schema.Struct<{
|
|
271
|
+
readonly type: Schema.Literal<"runtime.wait">;
|
|
272
|
+
readonly waitId: Schema.String;
|
|
273
|
+
readonly on: Schema.Union<readonly [Schema.Struct<{
|
|
274
|
+
readonly type: Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>;
|
|
275
|
+
readonly match: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
276
|
+
}>, Schema.Struct<{
|
|
277
|
+
readonly timerAt: Schema.Finite;
|
|
278
|
+
}>]>;
|
|
279
|
+
readonly tag: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
280
|
+
}>, Schema.Struct<{
|
|
281
|
+
readonly type: Schema.Literal<"runtime.emit">;
|
|
282
|
+
readonly event: Schema.Struct<{
|
|
283
|
+
readonly type: Schema.String;
|
|
284
|
+
readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
285
|
+
readonly threadId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
286
|
+
readonly parentThreadId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
287
|
+
readonly causationId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
288
|
+
readonly correlationId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
289
|
+
readonly effectId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
290
|
+
readonly origin: Schema.optional<Schema.Union<readonly [Schema.Struct<{
|
|
291
|
+
readonly type: Schema.Literal<"thread">;
|
|
292
|
+
readonly threadId: Schema.String;
|
|
293
|
+
}>, Schema.Struct<{
|
|
294
|
+
readonly type: Schema.Literal<"external">;
|
|
295
|
+
readonly actorId: Schema.optional<Schema.String>;
|
|
296
|
+
}>, Schema.Struct<{
|
|
297
|
+
readonly type: Schema.Literal<"system">;
|
|
298
|
+
}>]>>;
|
|
299
|
+
readonly ephemeral: Schema.optional<Schema.Boolean>;
|
|
300
|
+
readonly id: Schema.optional<Schema.String>;
|
|
301
|
+
readonly ts: Schema.optional<Schema.Finite>;
|
|
302
|
+
readonly idempotencyKey: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
303
|
+
}>;
|
|
304
|
+
readonly tag: Schema.optional<Schema.String>;
|
|
305
|
+
}>, Schema.Struct<{
|
|
306
|
+
readonly type: Schema.Literal<"runtime.complete">;
|
|
307
|
+
readonly output: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
308
|
+
}>, Schema.Struct<{
|
|
309
|
+
readonly type: Schema.Literal<"runtime.fail">;
|
|
310
|
+
readonly error: Schema.String;
|
|
311
|
+
}>, Schema.Struct<{
|
|
312
|
+
readonly type: Schema.Literal<"runtime.cancel">;
|
|
313
|
+
readonly threadId: Schema.String;
|
|
314
|
+
readonly tag: Schema.optional<Schema.String>;
|
|
315
|
+
}>, Schema.Struct<{
|
|
316
|
+
readonly type: Schema.String;
|
|
317
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
318
|
+
readonly tag: Schema.optional<Schema.String>;
|
|
319
|
+
}>]>>;
|
|
320
|
+
}>;
|
|
12
321
|
export declare function replayTo(events: readonly EventEnvelope[], registry: FoldRegistry, seq: number): ReplayStep | null;
|
|
13
322
|
export declare function replayAll(events: readonly EventEnvelope[], registry: FoldRegistry): ReplayStep[];
|
package/dist/core/replay.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import { RuntimeEffectSchema } from './effects.js';
|
|
3
|
+
import { EventEnvelopeSchema } from './envelope.js';
|
|
1
4
|
import { foldEvent, foldRun } from './fold.js';
|
|
2
|
-
import { emptyRunState } from './state.js';
|
|
5
|
+
import { emptyRunState, RunStateSchema } from './state.js';
|
|
6
|
+
export const ReplayStepSchema = Schema.Struct({
|
|
7
|
+
seq: Schema.Finite,
|
|
8
|
+
event: EventEnvelopeSchema,
|
|
9
|
+
before: RunStateSchema,
|
|
10
|
+
after: RunStateSchema,
|
|
11
|
+
effects: Schema.Array(RuntimeEffectSchema),
|
|
12
|
+
});
|
|
3
13
|
export function replayTo(events, registry, seq) {
|
|
4
14
|
const target = events.find((event) => event.seq === seq && !event.ephemeral);
|
|
5
15
|
if (!target) {
|
package/dist/core/schema.d.ts
CHANGED
|
@@ -11,25 +11,14 @@ export declare class InvalidInputError extends InvalidInputError_base<{
|
|
|
11
11
|
readonly issues: ReadonlyArray<StandardSchemaV1.Issue>;
|
|
12
12
|
constructor(text: string, issues?: ReadonlyArray<StandardSchemaV1.Issue>);
|
|
13
13
|
}
|
|
14
|
-
export type SchemaInput = StandardSchemaV1<any, any> | Schema.
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
export type InferSchemaOutput<T> = T extends Schema.Schema<infer Out> ? Out : T extends Schema.Top ? Schema.Schema.Type<T> : T extends StandardSchemaV1<any, infer Out> ? Out : T extends {
|
|
18
|
-
_output: infer Out;
|
|
19
|
-
} ? Out : never;
|
|
14
|
+
export type SchemaInput = StandardSchemaV1<any, any> | Schema.ConstraintDecoder<unknown>;
|
|
15
|
+
export type InferSchemaOutput<T> = T extends Schema.Schema<infer Out> ? Out : T extends Schema.ConstraintDecoder<unknown> ? Schema.Schema.Type<T> : T extends StandardSchemaV1<any, infer Out> ? Out : never;
|
|
20
16
|
/** Output of an optional `input` / `shape` schema, or `TFallback` when the schema is omitted. */
|
|
21
17
|
export type InferDefinedSchema<T, TFallback = JsonValue> = [T] extends [undefined] ? TFallback : InferSchemaOutput<NonNullable<T>>;
|
|
22
|
-
type
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
schema?: StandardSchemaV1<JsonValue, TInput> | StandardSchemaV1<unknown, TInput> | StandardSchemaV1<any, TInput> | Schema.Schema<TInput> | {
|
|
29
|
-
_output: TInput;
|
|
30
|
-
};
|
|
31
|
-
} | null | undefined;
|
|
32
|
-
export declare function validateInputEffect<TInput = JsonValue>(schemaOrDef: SchemaCandidate<TInput>, raw: JsonValue): Effect.Effect<TInput, InvalidInputError>;
|
|
33
|
-
export declare function validateInput<TInput = JsonValue>(schemaOrDef: SchemaCandidate<TInput>, raw: JsonValue): Promise<TInput>;
|
|
34
|
-
export declare function validateInputSync<TInput = JsonValue>(schemaOrDef: SchemaCandidate<TInput>, raw: JsonValue): TInput;
|
|
18
|
+
type ValidatedInput<TSchema extends SchemaInput | null | undefined> = TSchema extends SchemaInput ? InferSchemaOutput<TSchema> : JsonValue;
|
|
19
|
+
export declare function validateInputEffect<TSchema extends SchemaInput | null | undefined>(schema: TSchema, raw: JsonValue): Effect.Effect<ValidatedInput<TSchema>, InvalidInputError>;
|
|
20
|
+
export declare function validateInput<TSchema extends SchemaInput>(schema: TSchema, raw: JsonValue): Promise<InferSchemaOutput<TSchema>>;
|
|
21
|
+
export declare function validateInput(schema: null | undefined, raw: JsonValue): Promise<JsonValue>;
|
|
22
|
+
export declare function validateInputSync<TSchema extends SchemaInput>(schema: TSchema, raw: JsonValue): InferSchemaOutput<TSchema>;
|
|
23
|
+
export declare function validateInputSync(schema: null | undefined, raw: JsonValue): JsonValue;
|
|
35
24
|
export {};
|