@yieldstar/core 0.4.6 → 0.6.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/dist/base/durable-value.d.ts +71 -0
- package/dist/base/durable-value.d.ts.map +1 -0
- package/dist/base/durable-value.test.d.ts +2 -0
- package/dist/base/durable-value.test.d.ts.map +1 -0
- package/dist/base/effect.d.ts +136 -0
- package/dist/base/effect.d.ts.map +1 -0
- package/dist/base/errors.d.ts +23 -0
- package/dist/base/errors.d.ts.map +1 -0
- package/dist/base/errors.test.d.ts +2 -0
- package/dist/base/errors.test.d.ts.map +1 -0
- package/dist/base/event.d.ts +6 -1
- package/dist/base/event.d.ts.map +1 -1
- package/dist/base/execution.d.ts +244 -0
- package/dist/base/execution.d.ts.map +1 -0
- package/dist/base/heap.d.ts +15 -3
- package/dist/base/heap.d.ts.map +1 -1
- package/dist/base/invoker.d.ts +47 -2
- package/dist/base/invoker.d.ts.map +1 -1
- package/dist/base/runtime.d.ts +27 -4
- package/dist/base/runtime.d.ts.map +1 -1
- package/dist/base/step.d.ts +26 -5
- package/dist/base/step.d.ts.map +1 -1
- package/dist/base/store.d.ts +431 -0
- package/dist/base/store.d.ts.map +1 -0
- package/dist/base/store.test.d.ts +2 -0
- package/dist/base/store.test.d.ts.map +1 -0
- package/dist/base/workflow.d.ts +17 -0
- package/dist/base/workflow.d.ts.map +1 -1
- package/dist/index.d.ts +24 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1986 -111
- package/dist/lib/effect-state.d.ts +78 -0
- package/dist/lib/effect-state.d.ts.map +1 -0
- package/dist/lib/execution-dispatcher.d.ts +102 -0
- package/dist/lib/execution-dispatcher.d.ts.map +1 -0
- package/dist/lib/execution-state.d.ts +248 -0
- package/dist/lib/execution-state.d.ts.map +1 -0
- package/dist/lib/execution-state.test.d.ts +2 -0
- package/dist/lib/execution-state.test.d.ts.map +1 -0
- package/dist/lib/wait-for-outcome.d.ts +15 -0
- package/dist/lib/wait-for-outcome.d.ts.map +1 -0
- package/dist/lib/workflow-runner.d.ts +14 -7
- package/dist/lib/workflow-runner.d.ts.map +1 -1
- package/dist/utils/map.d.ts +1 -1
- package/dist/utils/map.d.ts.map +1 -1
- package/package.json +13 -3
- package/src/base/durable-value.test.ts +285 -0
- package/src/base/durable-value.ts +442 -0
- package/src/base/effect.ts +165 -0
- package/src/base/errors.test.ts +210 -0
- package/src/base/errors.ts +72 -0
- package/src/base/event.ts +6 -1
- package/src/base/execution.ts +303 -0
- package/src/base/heap.ts +17 -3
- package/src/base/invoker.ts +60 -2
- package/src/base/runtime.ts +28 -7
- package/src/base/step.ts +37 -7
- package/src/base/store.test.ts +176 -0
- package/src/base/store.ts +1123 -0
- package/src/base/workflow.ts +17 -0
- package/src/index.ts +174 -3
- package/src/lib/effect-state.ts +254 -0
- package/src/lib/execution-dispatcher.ts +393 -0
- package/src/lib/execution-state.test.ts +249 -0
- package/src/lib/execution-state.ts +650 -0
- package/src/lib/wait-for-outcome.ts +40 -0
- package/src/lib/workflow-runner.ts +78 -34
- package/src/utils/map.test.ts +1 -1
- package/src/utils/map.ts +8 -2
- package/dist/base/map.d.ts +0 -21
- package/dist/base/map.d.ts.map +0 -1
- package/dist/base/map.test.d.ts +0 -2
- package/dist/base/map.test.d.ts.map +0 -1
- package/dist/base/schedule.d.ts +0 -71
- package/dist/base/schedule.d.ts.map +0 -1
- package/dist/base/types.d.ts +0 -24
- package/dist/base/types.d.ts.map +0 -1
- package/src/base/scheduler.ts +0 -8
- package/tsconfig.tsbuildinfo +0 -1
package/dist/base/runtime.d.ts
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
|
|
1
|
+
import type { EffectClient } from "./effect";
|
|
2
|
+
import type { ExecutionClient } from "./execution";
|
|
3
|
+
import type { HeapClient } from "./heap";
|
|
4
|
+
import type { StoreClient } from "./store";
|
|
5
|
+
export interface RuntimeOptions {
|
|
6
|
+
/** Every client of the runtime reads time from this clock. Defaults to `Date.now`. */
|
|
7
|
+
clock?: () => number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A runtime is defined by the guarantees its clients keep, not by how many
|
|
11
|
+
* databases it uses:
|
|
12
|
+
*
|
|
13
|
+
* - Where one write must accompany another, such as the wakes for a store
|
|
14
|
+
* commit, the second is durable once the first commits and is applied
|
|
15
|
+
* eventually (in one transaction or through an outbox).
|
|
16
|
+
* - A store or effect waiter is deleted atomically with its step's result.
|
|
17
|
+
* - An effect's settlement and the wakes of its waiters are one atomic write.
|
|
18
|
+
* - Every client reads time from the runtime's clock.
|
|
19
|
+
*/
|
|
20
|
+
export declare abstract class Runtime {
|
|
21
|
+
/** The clock every client, and every step's wake time, reads. */
|
|
22
|
+
abstract readonly clock: () => number;
|
|
23
|
+
abstract readonly executions: ExecutionClient;
|
|
24
|
+
abstract readonly effects: EffectClient;
|
|
25
|
+
abstract readonly heap: HeapClient;
|
|
26
|
+
abstract readonly stores: StoreClient;
|
|
27
|
+
}
|
|
5
28
|
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/base/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/base/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,MAAM,WAAW,cAAc;IAC7B,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,MAAM,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,8BAAsB,OAAO;IAC3B,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,MAAM,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;IAC9C,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IACxC,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CACvC"}
|
package/dist/base/step.d.ts
CHANGED
|
@@ -15,11 +15,14 @@ export declare class StepInvalid extends StepResponse {
|
|
|
15
15
|
static type: string;
|
|
16
16
|
readonly type = "step-invalid";
|
|
17
17
|
}
|
|
18
|
+
export type StepSchemaVerdict = "accepted" | "rejected";
|
|
18
19
|
export declare class StepResult extends StepResponse {
|
|
19
20
|
static type: string;
|
|
20
21
|
readonly type = "step-result";
|
|
21
22
|
result: any;
|
|
22
|
-
|
|
23
|
+
/** Whether the step's schema accepted its value on the first run. */
|
|
24
|
+
schema?: StepSchemaVerdict;
|
|
25
|
+
constructor(result: any, schema?: StepSchemaVerdict);
|
|
23
26
|
}
|
|
24
27
|
export declare class WorkflowResult<T extends any> extends StepResponse {
|
|
25
28
|
static type: string;
|
|
@@ -30,8 +33,25 @@ export declare class WorkflowResult<T extends any> extends StepResponse {
|
|
|
30
33
|
export declare class WorkflowDelay extends StepResponse {
|
|
31
34
|
static type: string;
|
|
32
35
|
readonly type = "workflow-delay";
|
|
33
|
-
|
|
34
|
-
|
|
36
|
+
/** The absolute time the step's pause ends, read from the runtime clock. */
|
|
37
|
+
wakeAt: number;
|
|
38
|
+
constructor(wakeAt: number);
|
|
39
|
+
}
|
|
40
|
+
export declare class StepStoreWait extends StepResponse {
|
|
41
|
+
static type: string;
|
|
42
|
+
readonly type = "store-wait";
|
|
43
|
+
constructor();
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* An effect step whose outcome is uncertain. The driver records it as an
|
|
47
|
+
* unfinished step after watching the effect, so the next delivery begins the
|
|
48
|
+
* effect again; `wakeAt` is when that delivery is due.
|
|
49
|
+
*/
|
|
50
|
+
export declare class StepEffectWait extends StepResponse {
|
|
51
|
+
static type: string;
|
|
52
|
+
readonly type = "effect-wait";
|
|
53
|
+
wakeAt: number;
|
|
54
|
+
constructor(wakeAt: number);
|
|
35
55
|
}
|
|
36
56
|
export declare class WorkflowRestart extends StepResponse {
|
|
37
57
|
static type: string;
|
|
@@ -54,7 +74,8 @@ export declare class StepError extends StepResponse {
|
|
|
54
74
|
export declare class StepDelay extends StepResponse {
|
|
55
75
|
static type: string;
|
|
56
76
|
readonly type = "step-delay";
|
|
57
|
-
|
|
58
|
-
|
|
77
|
+
/** The absolute time the step's pause ends, read from the runtime clock. */
|
|
78
|
+
wakeAt: number;
|
|
79
|
+
constructor(wakeAt: number);
|
|
59
80
|
}
|
|
60
81
|
//# sourceMappingURL=step.d.ts.map
|
package/dist/base/step.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../src/base/step.ts"],"names":[],"mappings":"AAAA,8BAAsB,YAAY;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,qBAAa,OAAQ,SAAQ,YAAY;IACvC,MAAM,CAAC,IAAI,SAAc;IACzB,QAAQ,CAAC,IAAI,cAAc;IAC3B,GAAG,EAAE,MAAM,CAAC;gBACA,GAAG,EAAE,MAAM;CAIxB;AAED,qBAAa,cAAe,SAAQ,YAAY;IAC9C,MAAM,CAAC,IAAI,SAAiB;IAC5B,QAAQ,CAAC,IAAI,iBAAiB;CAC/B;AAED,qBAAa,WAAY,SAAQ,YAAY;IAC3C,MAAM,CAAC,IAAI,SAAkB;IAC7B,QAAQ,CAAC,IAAI,kBAAkB;CAChC;AAED,qBAAa,UAAW,SAAQ,YAAY;IAC1C,MAAM,CAAC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ACH,MAAM,EAAE,MAAM;CAI3B;AAED,qBAAa,aAAc,SAAQ,YAAY;IAC7C,MAAM,CAAC,IAAI,SAAgB;IAC3B,QAAQ,CAAC,IAAI,gBAAgB;;CAI9B;AAED;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,YAAY;IAC9C,MAAM,CAAC,IAAI,SAAiB;IAC5B,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,MAAM,EAAE,MAAM,CAAC;gBACH,MAAM,EAAE,MAAM;CAI3B;AAED,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,MAAM,CAAC,IAAI,SAAsB;IACjC,QAAQ,CAAC,IAAI,sBAAsB;;CAIpC;AAED,qBAAa,SAAU,SAAQ,YAAY;IACzC,MAAM,CAAC,IAAI,SAAgB;IAC3B,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,GAAG,EAAE,GAAG,CAAC;IACT,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,QAAQ,GAAG,OAAO,CAAC;gBAElC,GAAG,EAAE,GAAG,EACR,IAAI,CAAC,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,eAAe,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;KACtC;CAUJ;AAED,qBAAa,SAAU,SAAQ,YAAY;IACzC,MAAM,CAAC,IAAI,SAAgB;IAC3B,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;gBACH,MAAM,EAAE,MAAM;CAI3B"}
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
+
import { type Durable, type IfDurable } from "./durable-value";
|
|
3
|
+
export type Draft<T> = T extends object ? {
|
|
4
|
+
-readonly [K in keyof T]: Draft<T[K]>;
|
|
5
|
+
} : T;
|
|
6
|
+
export type StoreVersion = number;
|
|
7
|
+
export type StorePath = readonly (string | number)[];
|
|
8
|
+
export type StoreDefinition<Schema extends StandardSchemaV1 = StandardSchemaV1> = {
|
|
9
|
+
name: string;
|
|
10
|
+
schema: Schema;
|
|
11
|
+
/**
|
|
12
|
+
* The state a store starts with. Every operation on a missing store
|
|
13
|
+
* creates it from this state, so it is evaluated only when the store with
|
|
14
|
+
* this `id` does not exist.
|
|
15
|
+
*/
|
|
16
|
+
initial: (id: string) => StoreState<Schema>;
|
|
17
|
+
};
|
|
18
|
+
export type StoreState<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>;
|
|
19
|
+
export type StoreKey = {
|
|
20
|
+
storeName: string;
|
|
21
|
+
storeId: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Identifies the durable workflow step performing a store operation.
|
|
25
|
+
* When provided to `updateStore`/`takeFromStore`, the store client records
|
|
26
|
+
* the committed result in an applied-steps ledger keyed by
|
|
27
|
+
* (storeName, storeId, executionId, stepKey), written atomically with the
|
|
28
|
+
* state change. A retried call with the same StoreStepId returns the recorded
|
|
29
|
+
* result without re-running the updater/selector/claim, making the operation
|
|
30
|
+
* exactly-once even if the caller crashes before persisting its own record
|
|
31
|
+
* of the result (e.g. the workflow heap write).
|
|
32
|
+
*/
|
|
33
|
+
export type StoreStepId = {
|
|
34
|
+
executionId: string;
|
|
35
|
+
stepKey: string;
|
|
36
|
+
};
|
|
37
|
+
export type StoreSnapshot<T> = {
|
|
38
|
+
state: T;
|
|
39
|
+
instanceId: string;
|
|
40
|
+
version: StoreVersion;
|
|
41
|
+
};
|
|
42
|
+
export type StoreUpdateResult<T> = {
|
|
43
|
+
state: T;
|
|
44
|
+
previousVersion: StoreVersion;
|
|
45
|
+
version: StoreVersion;
|
|
46
|
+
};
|
|
47
|
+
export type StoreUpdateFromResult<T> = ({
|
|
48
|
+
updated: true;
|
|
49
|
+
} & StoreUpdateResult<T>) | {
|
|
50
|
+
updated: false;
|
|
51
|
+
expectedInstanceId: string;
|
|
52
|
+
actualInstanceId: string;
|
|
53
|
+
expectedVersion: StoreVersion;
|
|
54
|
+
actualVersion: StoreVersion;
|
|
55
|
+
};
|
|
56
|
+
export type StoreDeleteFromResult = {
|
|
57
|
+
deleted: true;
|
|
58
|
+
} | {
|
|
59
|
+
deleted: false;
|
|
60
|
+
reason: "conflict";
|
|
61
|
+
expectedInstanceId: string;
|
|
62
|
+
actualInstanceId: string;
|
|
63
|
+
expectedVersion: StoreVersion;
|
|
64
|
+
actualVersion: StoreVersion;
|
|
65
|
+
};
|
|
66
|
+
export type StoreSelector<T, R> = (state: Readonly<T>) => R;
|
|
67
|
+
export type StoreTakeResult<R> = {
|
|
68
|
+
matched: true;
|
|
69
|
+
selected: NonNullable<R>;
|
|
70
|
+
instanceId: string;
|
|
71
|
+
version: StoreVersion;
|
|
72
|
+
} | {
|
|
73
|
+
matched: false;
|
|
74
|
+
instanceId: string;
|
|
75
|
+
version: StoreVersion;
|
|
76
|
+
readPaths: StorePath[];
|
|
77
|
+
};
|
|
78
|
+
export type StoreWaiter = {
|
|
79
|
+
workflowId: string;
|
|
80
|
+
executionId: string;
|
|
81
|
+
stepKey: string;
|
|
82
|
+
storeName: string;
|
|
83
|
+
storeId: string;
|
|
84
|
+
instanceId: string;
|
|
85
|
+
sinceVersion: StoreVersion;
|
|
86
|
+
readPaths: StorePath[];
|
|
87
|
+
};
|
|
88
|
+
export type StoreMutationCommitResult = {
|
|
89
|
+
status: "committed";
|
|
90
|
+
} | {
|
|
91
|
+
status: "already-applied";
|
|
92
|
+
result: unknown;
|
|
93
|
+
} | {
|
|
94
|
+
status: "conflict";
|
|
95
|
+
snapshot: StoreSnapshot<unknown>;
|
|
96
|
+
} | {
|
|
97
|
+
status: "missing";
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* A snapshot read from a store, or, when `created` is true, the initial state
|
|
101
|
+
* of a store that did not exist when it was read. A created snapshot's
|
|
102
|
+
* `instanceId` is new and its `version` is 0.
|
|
103
|
+
*/
|
|
104
|
+
export type StoreReadSnapshot<T> = StoreSnapshot<T> & {
|
|
105
|
+
created: boolean;
|
|
106
|
+
};
|
|
107
|
+
export type StoreMutation = {
|
|
108
|
+
definition: StoreDefinition;
|
|
109
|
+
id: string;
|
|
110
|
+
/**
|
|
111
|
+
* The snapshot the mutation was computed from. When `created` is true the
|
|
112
|
+
* commit first inserts it as the store's initial state, and conflicts if
|
|
113
|
+
* the store exists by then.
|
|
114
|
+
*/
|
|
115
|
+
expected: StoreReadSnapshot<unknown>;
|
|
116
|
+
nextState: unknown;
|
|
117
|
+
changedPaths: StorePath[];
|
|
118
|
+
stepId?: StoreStepId;
|
|
119
|
+
result: unknown;
|
|
120
|
+
};
|
|
121
|
+
export type StoreDeletion = {
|
|
122
|
+
definition: StoreDefinition;
|
|
123
|
+
id: string;
|
|
124
|
+
expected: StoreSnapshot<unknown>;
|
|
125
|
+
stepId?: StoreStepId;
|
|
126
|
+
result: StoreDeleteFromResult;
|
|
127
|
+
};
|
|
128
|
+
export type RuntimeStore<T> = {
|
|
129
|
+
get(): Promise<StoreSnapshot<T>>;
|
|
130
|
+
update(updater: (draft: Draft<T>) => void | T): Promise<StoreUpdateResult<T>>;
|
|
131
|
+
updateFrom(snapshot: StoreSnapshot<T>, updater: (draft: Draft<T>) => void | T): Promise<StoreUpdateFromResult<T>>;
|
|
132
|
+
deleteFrom(snapshot: StoreSnapshot<T>): Promise<StoreDeleteFromResult>;
|
|
133
|
+
};
|
|
134
|
+
/** A store state failed its schema. Workflow code can catch it. */
|
|
135
|
+
export declare class StoreValidationError extends Error {
|
|
136
|
+
constructor(message: string);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* A schema whose output, the store state, is a durable value. The state is
|
|
140
|
+
* still validated by the codec at runtime.
|
|
141
|
+
*/
|
|
142
|
+
export type DurableStoreSchema<Schema extends StandardSchemaV1> = IfDurable<StoreState<Schema>, StandardSchemaV1<StandardSchemaV1.InferInput<Schema>, Durable<StoreState<Schema>>>>;
|
|
143
|
+
/**
|
|
144
|
+
* `State` is inferred from the schema alone, so `initial` is checked against
|
|
145
|
+
* it and keeps literal types such as `status: "idle"`.
|
|
146
|
+
*/
|
|
147
|
+
export declare function defineStore<Schema extends StandardSchemaV1<any, State>, State = StoreState<Schema>>(name: string, schema: Schema & StandardSchemaV1<any, State> & DurableStoreSchema<Schema>, options: {
|
|
148
|
+
initial: (id: string) => NoInfer<Durable<State>>;
|
|
149
|
+
}): StoreDefinition<Schema>;
|
|
150
|
+
export declare abstract class StoreClient {
|
|
151
|
+
store<Schema extends StandardSchemaV1>(definition: StoreDefinition<Schema>, id: string): RuntimeStore<StoreState<Schema>>;
|
|
152
|
+
/**
|
|
153
|
+
* Every operation that takes a `definition` and `id`, except `deleteStore`,
|
|
154
|
+
* first creates a missing store from `definition.initial(id)`, in the same
|
|
155
|
+
* atomic write as the operation. `initial` is evaluated only when the store
|
|
156
|
+
* is missing, and concurrent operations on a missing store record exactly
|
|
157
|
+
* one initial state. A creation is version 0 of a new instance.
|
|
158
|
+
*/
|
|
159
|
+
abstract getStore<Schema extends StandardSchemaV1>(params: {
|
|
160
|
+
definition: StoreDefinition<Schema>;
|
|
161
|
+
id: string;
|
|
162
|
+
}): Promise<StoreSnapshot<StoreState<Schema>>>;
|
|
163
|
+
/**
|
|
164
|
+
* Updates a store's state atomically.
|
|
165
|
+
* Updaters must be synchronous, deterministic, and side-effect-free. CAS-backed
|
|
166
|
+
* clients may run an updater again when another writer wins the version race.
|
|
167
|
+
* A rejected promise does not prove that the mutation was rolled back: a
|
|
168
|
+
* connector may commit state and then fail while delivering its durable wake
|
|
169
|
+
* intents. Retrying is exactly-once only when the same `stepId` is supplied.
|
|
170
|
+
* Callers without a `stepId` must read and reconcile instead of blindly retrying.
|
|
171
|
+
*
|
|
172
|
+
* When `stepId` is provided the update is exactly-once per
|
|
173
|
+
* (executionId, stepKey): the committed StoreUpdateResult is recorded in
|
|
174
|
+
* the applied-steps ledger inside the same transaction as the state change,
|
|
175
|
+
* and a repeated call with the same stepId returns the recorded result
|
|
176
|
+
* verbatim without running the updater or bumping the version.
|
|
177
|
+
*/
|
|
178
|
+
abstract updateStore<Schema extends StandardSchemaV1>(params: {
|
|
179
|
+
definition: StoreDefinition<Schema>;
|
|
180
|
+
id: string;
|
|
181
|
+
updater: (draft: Draft<StoreState<Schema>>) => void | StoreState<Schema>;
|
|
182
|
+
stepId?: StoreStepId;
|
|
183
|
+
}): Promise<StoreUpdateResult<StoreState<Schema>>>;
|
|
184
|
+
/**
|
|
185
|
+
* Updates a store only if it has not changed since `snapshot` was read.
|
|
186
|
+
* A conflict does not change the store, though a racing writer may cause a
|
|
187
|
+
* pure updater to have been evaluated before the conflict is observed. When `stepId`
|
|
188
|
+
* identifies an update that already committed, its recorded result wins
|
|
189
|
+
* over the version check so replay remains exactly-once.
|
|
190
|
+
*/
|
|
191
|
+
abstract updateStoreFrom<Schema extends StandardSchemaV1>(params: {
|
|
192
|
+
definition: StoreDefinition<Schema>;
|
|
193
|
+
id: string;
|
|
194
|
+
snapshot: StoreSnapshot<StoreState<Schema>>;
|
|
195
|
+
updater: (draft: Draft<StoreState<Schema>>) => void | StoreState<Schema>;
|
|
196
|
+
stepId?: StoreStepId;
|
|
197
|
+
}): Promise<StoreUpdateFromResult<StoreState<Schema>>>;
|
|
198
|
+
/**
|
|
199
|
+
* Atomically selects and claims from a store. The selector and claim run
|
|
200
|
+
* locally against a snapshot, then commit with a single conditional version
|
|
201
|
+
* bump. A conflict re-runs both functions against the new snapshot. If the selector does not match, nothing is
|
|
202
|
+
* committed and the store's current version plus the selector's tracked
|
|
203
|
+
* read paths are returned so the caller can register a waiter with the
|
|
204
|
+
* correct sinceVersion (closing the lost-wakeup gap by construction).
|
|
205
|
+
*
|
|
206
|
+
* `claim` must be synchronous – implementations must reject (throw) if it
|
|
207
|
+
* returns a Promise.
|
|
208
|
+
*
|
|
209
|
+
* When `stepId` is provided, a MATCHED (committed) take is recorded in the
|
|
210
|
+
* applied-steps ledger inside the same transaction as the claim commit, and
|
|
211
|
+
* a repeated call with the same stepId returns the recorded outcome without
|
|
212
|
+
* re-running the selector or claim. Unmatched outcomes are NOT recorded:
|
|
213
|
+
* an unmatched take commits nothing and registers a waiter, so it must
|
|
214
|
+
* remain free to re-evaluate the selector on every wake.
|
|
215
|
+
*/
|
|
216
|
+
abstract takeFromStore<Schema extends StandardSchemaV1, R>(params: {
|
|
217
|
+
definition: StoreDefinition<Schema>;
|
|
218
|
+
id: string;
|
|
219
|
+
selector: StoreSelector<StoreState<Schema>, R>;
|
|
220
|
+
claim: (draft: Draft<StoreState<Schema>>, selected: NonNullable<R>) => void;
|
|
221
|
+
stepId?: StoreStepId;
|
|
222
|
+
}): Promise<StoreTakeResult<R>>;
|
|
223
|
+
/**
|
|
224
|
+
* Registers a versioned read observation. Registration must be linearizable
|
|
225
|
+
* with mutations: a stale observation is woken immediately, while a current
|
|
226
|
+
* observation is woken by a later intersecting mutation. A wake requests a
|
|
227
|
+
* delivery of `waiter.executionId`; it carries no copy of the event. Once a
|
|
228
|
+
* mutation is durable, the wakes it requires are durable too. The waiter
|
|
229
|
+
* stays registered until the heap records its step's result.
|
|
230
|
+
*/
|
|
231
|
+
abstract registerWaiter(waiter: StoreWaiter): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Enumerates the ids of every store created under a given definition name.
|
|
234
|
+
* Needed by external consumers (e.g. Notation's state backend) that treat a
|
|
235
|
+
* store name as a collection of instances and must list them. Order is
|
|
236
|
+
* ascending by id so callers get a deterministic sequence.
|
|
237
|
+
*/
|
|
238
|
+
abstract listStores(definition: StoreDefinition): Promise<string[]>;
|
|
239
|
+
/**
|
|
240
|
+
* Removes a physical store instance and its waiters. Applied-step receipts
|
|
241
|
+
* remain authoritative for the logical store key across recreation. A no-op
|
|
242
|
+
* if the store does not exist; it never creates one.
|
|
243
|
+
*/
|
|
244
|
+
abstract deleteStore(params: {
|
|
245
|
+
definition: StoreDefinition;
|
|
246
|
+
id: string;
|
|
247
|
+
}): Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Deletes a store only if its instance ID and version still match the
|
|
250
|
+
* snapshot. A missing store is created first, so the result is a conflict
|
|
251
|
+
* with the new instance. With a `stepId`, a committed deletion is recorded
|
|
252
|
+
* and a repeated call returns the recorded result.
|
|
253
|
+
*/
|
|
254
|
+
abstract deleteStoreFrom(params: {
|
|
255
|
+
definition: StoreDefinition;
|
|
256
|
+
id: string;
|
|
257
|
+
snapshot: StoreSnapshot<unknown>;
|
|
258
|
+
stepId?: StoreStepId;
|
|
259
|
+
}): Promise<StoreDeleteFromResult>;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Implements store transformations as read/compute/compare-and-swap loops.
|
|
263
|
+
* Storage connectors only implement the atomic mutation protocol and never
|
|
264
|
+
* execute application callbacks, including `initial`, while holding a storage
|
|
265
|
+
* transaction.
|
|
266
|
+
*/
|
|
267
|
+
export declare abstract class CasStoreClient extends StoreClient {
|
|
268
|
+
/** Reads a store's current snapshot, or `undefined` if it does not exist. */
|
|
269
|
+
protected abstract readStore(params: {
|
|
270
|
+
definition: StoreDefinition;
|
|
271
|
+
id: string;
|
|
272
|
+
}): Promise<StoreSnapshot<unknown> | undefined>;
|
|
273
|
+
/**
|
|
274
|
+
* Atomically inserts `snapshot` as a store's initial state unless the store
|
|
275
|
+
* exists, and returns the store's snapshot after the write: `snapshot` if it
|
|
276
|
+
* was inserted, otherwise the existing store's.
|
|
277
|
+
*/
|
|
278
|
+
protected abstract insertStore(params: {
|
|
279
|
+
definition: StoreDefinition;
|
|
280
|
+
id: string;
|
|
281
|
+
snapshot: StoreSnapshot<unknown>;
|
|
282
|
+
}): Promise<StoreSnapshot<unknown>>;
|
|
283
|
+
protected abstract getAppliedStoreStep(params: {
|
|
284
|
+
definition: StoreDefinition;
|
|
285
|
+
id: string;
|
|
286
|
+
stepId: StoreStepId;
|
|
287
|
+
}): Promise<{
|
|
288
|
+
result: unknown;
|
|
289
|
+
} | undefined>;
|
|
290
|
+
/**
|
|
291
|
+
* Atomically compares `expected`, writes the next state at
|
|
292
|
+
* `expected.version + 1`, records the optional step result, and records the
|
|
293
|
+
* wake obligations created by `changedPaths`. When `expected.created` is
|
|
294
|
+
* true the store must still be missing, and the commit inserts it under
|
|
295
|
+
* `expected.instanceId`; otherwise a missing store returns `missing`. A
|
|
296
|
+
* recorded step result wins over both checks. A transactional outbox is
|
|
297
|
+
* recommended but is not part of the protocol.
|
|
298
|
+
*/
|
|
299
|
+
protected abstract commitStoreMutation(mutation: StoreMutation): Promise<StoreMutationCommitResult>;
|
|
300
|
+
/**
|
|
301
|
+
* Atomically compares `expected`, deletes the store and its waiters, and
|
|
302
|
+
* records the optional step result. A recorded step result wins over the
|
|
303
|
+
* comparison, and a missing store returns `missing`.
|
|
304
|
+
*/
|
|
305
|
+
protected abstract commitStoreDeletion(deletion: StoreDeletion): Promise<StoreMutationCommitResult>;
|
|
306
|
+
/** Names the instance a store is created as. Connectors may override it. */
|
|
307
|
+
protected createInstanceId(): string;
|
|
308
|
+
getStore<Schema extends StandardSchemaV1>(params: {
|
|
309
|
+
definition: StoreDefinition<Schema>;
|
|
310
|
+
id: string;
|
|
311
|
+
}): Promise<StoreSnapshot<StoreState<Schema>>>;
|
|
312
|
+
updateStore<Schema extends StandardSchemaV1>(params: {
|
|
313
|
+
definition: StoreDefinition<Schema>;
|
|
314
|
+
id: string;
|
|
315
|
+
updater: (draft: Draft<StoreState<Schema>>) => void | StoreState<Schema>;
|
|
316
|
+
stepId?: StoreStepId;
|
|
317
|
+
}): Promise<StoreUpdateResult<StoreState<Schema>>>;
|
|
318
|
+
updateStoreFrom<Schema extends StandardSchemaV1>(params: {
|
|
319
|
+
definition: StoreDefinition<Schema>;
|
|
320
|
+
id: string;
|
|
321
|
+
snapshot: StoreSnapshot<StoreState<Schema>>;
|
|
322
|
+
updater: (draft: Draft<StoreState<Schema>>) => void | StoreState<Schema>;
|
|
323
|
+
stepId?: StoreStepId;
|
|
324
|
+
}): Promise<StoreUpdateFromResult<StoreState<Schema>>>;
|
|
325
|
+
deleteStoreFrom(params: {
|
|
326
|
+
definition: StoreDefinition;
|
|
327
|
+
id: string;
|
|
328
|
+
snapshot: StoreSnapshot<unknown>;
|
|
329
|
+
stepId?: StoreStepId;
|
|
330
|
+
}): Promise<StoreDeleteFromResult>;
|
|
331
|
+
takeFromStore<Schema extends StandardSchemaV1, R>(params: {
|
|
332
|
+
definition: StoreDefinition<Schema>;
|
|
333
|
+
id: string;
|
|
334
|
+
selector: StoreSelector<StoreState<Schema>, R>;
|
|
335
|
+
claim: (draft: Draft<StoreState<Schema>>, selected: NonNullable<R>) => void;
|
|
336
|
+
stepId?: StoreStepId;
|
|
337
|
+
}): Promise<StoreTakeResult<R>>;
|
|
338
|
+
/**
|
|
339
|
+
* Reads a store, or evaluates and validates `definition.initial` when it is
|
|
340
|
+
* missing. Nothing is written: a created snapshot is committed by the
|
|
341
|
+
* operation computed from it.
|
|
342
|
+
*/
|
|
343
|
+
private readOrInitialize;
|
|
344
|
+
private getOrInsertStore;
|
|
345
|
+
private getAppliedResult;
|
|
346
|
+
}
|
|
347
|
+
export declare function isStoreSelectorMatch<R>(result: R): result is Exclude<R, undefined | null | false>;
|
|
348
|
+
export declare function assertSynchronousClaim(claimResult: unknown): void;
|
|
349
|
+
export declare function assertSynchronousUpdater(updaterResult: unknown): void;
|
|
350
|
+
/**
|
|
351
|
+
* Validates a state against its store's schema, then checks that the schema's
|
|
352
|
+
* output is a durable value. Throws `StoreValidationError` when the schema
|
|
353
|
+
* rejects the state, and `WorkflowValueError` (`INVALID_STEP_VALUE`) when the
|
|
354
|
+
* output is not durable, so callers that validate before committing leave the
|
|
355
|
+
* store unchanged. `stepKey` names the step in that error.
|
|
356
|
+
*/
|
|
357
|
+
export declare function validateStoreState<Schema extends StandardSchemaV1>(definition: StoreDefinition<Schema>, state: unknown, stepKey?: string): Promise<StoreState<Schema>>;
|
|
358
|
+
/** Encodes a store state or step result for storage. Throws if it is not durable. */
|
|
359
|
+
export declare function encodeStoreValue(value: unknown): string;
|
|
360
|
+
export declare function decodeStoreValue(canonical: string): unknown;
|
|
361
|
+
/**
|
|
362
|
+
* Copies a state as the durable value codec would read it back. Values the
|
|
363
|
+
* codec rejects, which validation keeps out of committed state, are copied
|
|
364
|
+
* with `structuredClone`.
|
|
365
|
+
*/
|
|
366
|
+
export declare function cloneStoreState<T>(state: T): T;
|
|
367
|
+
/**
|
|
368
|
+
* Diffs two store states and returns the set of changed paths.
|
|
369
|
+
*
|
|
370
|
+
* This is O(total state size). `trackStoreUpdater` records ordinary mutation
|
|
371
|
+
* paths in O(changes); the diff handles cases a recording proxy cannot observe:
|
|
372
|
+
* - the updater RETURNED a replacement state instead of mutating the draft
|
|
373
|
+
* - schema validation returned a transformed copy of the draft
|
|
374
|
+
*
|
|
375
|
+
* NOTE: array splices (insert/remove in the middle) report all shifted
|
|
376
|
+
* indices as changed, which can over-wake waiters. This is safe – wakes are
|
|
377
|
+
* spurious at worst, since replay re-evaluates the selector.
|
|
378
|
+
*/
|
|
379
|
+
export declare function diffStorePaths(previous: unknown, next: unknown): StorePath[];
|
|
380
|
+
/**
|
|
381
|
+
* Unwraps a tracking proxy (`trackStoreSelector` or `trackStoreUpdater`)
|
|
382
|
+
* one level, back to the object it wraps. When a selector runs over a
|
|
383
|
+
* write-recording draft, the selected value unwraps to the RECORDING proxy,
|
|
384
|
+
* so claim mutations applied through it land on the draft AND are recorded
|
|
385
|
+
* as write paths. Derived values (fresh arrays/objects built inside the
|
|
386
|
+
* selector) are returned as-is.
|
|
387
|
+
*/
|
|
388
|
+
export declare function unwrapTrackedValue<V>(value: V): V;
|
|
389
|
+
export declare function trackStoreSelector<T, R>(state: T, selector: StoreSelector<T, R>): {
|
|
390
|
+
result: R;
|
|
391
|
+
readPaths: StorePath[];
|
|
392
|
+
};
|
|
393
|
+
export type TrackedStoreUpdater<T> = {
|
|
394
|
+
/** Write-recording proxy over the raw draft. Hand this to the updater. */
|
|
395
|
+
draft: T;
|
|
396
|
+
/** The collapsed set of paths written so far (O(changes), not O(state)). */
|
|
397
|
+
writePaths(): StorePath[];
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* Wraps a draft in a write-recording Proxy so changed paths can be derived
|
|
401
|
+
* from the updater's own mutations in O(changes) instead of deep-diffing the
|
|
402
|
+
* whole previous/next state (O(state size) – see `diffStorePaths`).
|
|
403
|
+
*
|
|
404
|
+
* - Every `set` and `deleteProperty` through the proxy records its full
|
|
405
|
+
* path. Mutating array methods are trapped naturally via the index/length
|
|
406
|
+
* sets they perform: a push onto `messages` records ["messages", 3] (and
|
|
407
|
+
* ["messages", "length"]), preserving prefix-match wake semantics – a
|
|
408
|
+
* waiter on ["messages"] still wakes via prefix intersection.
|
|
409
|
+
* - Reads return proxied children so nested mutations are captured, but the
|
|
410
|
+
* mutation itself lands on the underlying raw draft (Reflect.set on the
|
|
411
|
+
* target), because the mutated draft becomes the next state.
|
|
412
|
+
* - Values assigned through the proxy are unwrapped (top-level) so the raw
|
|
413
|
+
* draft never stores a proxy wrapper for the common `draft.a = draft.b`
|
|
414
|
+
* case. Deeper wrappers (a proxy nested inside a fresh object) are
|
|
415
|
+
* laundered at commit time: `cloneStoreState` always produces fresh plain
|
|
416
|
+
* objects (structuredClone rejects proxies and falls back to JSON), and
|
|
417
|
+
* the SQLite client serializes state through JSON.stringify.
|
|
418
|
+
* - Ambiguous traps (`defineProperty`) record conservatively. Changed paths
|
|
419
|
+
* only affect wake precision, never state correctness: an extra path is a
|
|
420
|
+
* spurious wake (safe – replay re-evaluates the selector), while a missed
|
|
421
|
+
* path would lose a wakeup. When in doubt, over-report.
|
|
422
|
+
*
|
|
423
|
+
* IMPORTANT: this only observes MUTATIONS of the draft. If the updater
|
|
424
|
+
* RETURNS a replacement state instead of mutating (the
|
|
425
|
+
* `updated === undefined ? draft : updated` contract), no writes go through
|
|
426
|
+
* the proxy – callers must detect that case and fall back to
|
|
427
|
+
* `diffStorePaths(previousState, replacement)`.
|
|
428
|
+
*/
|
|
429
|
+
export declare function trackStoreUpdater<T>(target: T): TrackedStoreUpdater<T>;
|
|
430
|
+
export declare function storePathsIntersect(readPaths: StorePath[], writePaths: StorePath[]): boolean;
|
|
431
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/base/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAqB,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGlF,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACnC;IAAE,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GACzC,CAAC,CAAC;AAEN,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAClC,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAErD,MAAM,MAAM,eAAe,CAAC,MAAM,SAAS,gBAAgB,GAAG,gBAAgB,IAC5E;IACE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,UAAU,CAAC,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEJ,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,gBAAgB,IACpD,gBAAgB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAEvC,MAAM,MAAM,QAAQ,GAAG;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG;IAC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E,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,CAwB5E;AAID;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAQjD;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EACrC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAC5B;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,SAAS,EAAE,SAAS,EAAE,CAAA;CAAE,CA2CvC;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI;IACnC,0EAA0E;IAC1E,KAAK,EAAE,CAAC,CAAC;IACT,4EAA4E;IAC5E,UAAU,IAAI,SAAS,EAAE,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CA4DtE;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,SAAS,EAAE,EACtB,UAAU,EAAE,SAAS,EAAE,GACtB,OAAO,CAOT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.test.d.ts","sourceRoot":"","sources":["../../src/base/store.test.ts"],"names":[],"mappings":""}
|
package/dist/base/workflow.d.ts
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import type { Logger } from "pino";
|
|
2
2
|
import type { EventParams, WorkflowEvent, EventContext } from "./event";
|
|
3
|
+
import type { EffectClient } from "./effect";
|
|
4
|
+
import type { ExecutionClient, ExecutionLease } from "./execution";
|
|
3
5
|
import { HeapClient } from "./heap";
|
|
6
|
+
import { StoreClient } from "./store";
|
|
4
7
|
import { StepResponse, WorkflowResult } from "./step";
|
|
5
8
|
export type WorkflowGeneratorParams<Params extends EventParams, Context extends EventContext> = {
|
|
6
9
|
event: WorkflowEvent<Params, Context>;
|
|
10
|
+
/** Every heap step write is fenced by this lease. */
|
|
11
|
+
lease: ExecutionLease;
|
|
12
|
+
/**
|
|
13
|
+
* Aborted when the delivery must stop. The driver checks it before each
|
|
14
|
+
* step function and each fenced write.
|
|
15
|
+
*/
|
|
16
|
+
signal: AbortSignal;
|
|
7
17
|
heapClient: HeapClient;
|
|
18
|
+
storeClient: StoreClient;
|
|
19
|
+
/** `step.start` admits its target through this client. */
|
|
20
|
+
executionClient: ExecutionClient;
|
|
21
|
+
/** `step.effect` records and settles its effects through this client. */
|
|
22
|
+
effectClient: EffectClient;
|
|
23
|
+
/** The runtime clock. Delay and retry wake times are read from it. */
|
|
24
|
+
clock: () => number;
|
|
8
25
|
logger: Logger;
|
|
9
26
|
};
|
|
10
27
|
export type WorkflowGenerator<Params extends EventParams, Result, Context extends EventContext> = (genParams: WorkflowGeneratorParams<Params, Context>) => AsyncGenerator<StepResponse, WorkflowResult<Result>, StepResponse>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/base/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAEtD,MAAM,MAAM,uBAAuB,CACjC,MAAM,SAAS,WAAW,EAC1B,OAAO,SAAS,YAAY,IAC1B;IACF,KAAK,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAC3B,MAAM,SAAS,WAAW,EA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,SAAS,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAClE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
export type { HeapClient, HeapRecord } from "./base/heap";
|
|
2
|
-
export type { WorkflowInvoker } from "./base/invoker";
|
|
3
|
-
export
|
|
4
|
-
export type {
|
|
2
|
+
export type { DeliveryOptions, WorkflowInvoker } from "./base/invoker";
|
|
3
|
+
export { WorkerExitedError } from "./base/invoker";
|
|
4
|
+
export type { RuntimeOptions } from "./base/runtime";
|
|
5
|
+
export { Runtime } from "./base/runtime";
|
|
6
|
+
export type { ExecutionAcknowledgeResult, ExecutionAdmissionErrorCode, ExecutionAdmissionRequest, ExecutionAdmissionResult, ExecutionClient, ExecutionLease, ExecutionOutcome, ExecutionParent, ExecutionRecord, ExecutionReleaseResult, ExecutionRenewResult, ExecutionStartRequest, ExecutionStartResult, ExecutionStatus, ExecutionWakeResult, LeaseLost, WorkflowRunOutcome, WorkflowStartErrorCode, } from "./base/execution";
|
|
7
|
+
export { ExecutionAdmissionError, InfrastructureError, LeaseLostError, StepConflictError, WorkflowStartError, isLeaseLost, isTerminalExecutionStatus, } from "./base/execution";
|
|
8
|
+
export type { EffectBeginRequest, EffectBeginResult, EffectClient, EffectConflictReport, EffectDeliveryErrorCode, EffectRecord, EffectSettleRequest, EffectSettleResult, EffectWatchRequest, WorkflowEffectErrorCode, } from "./base/effect";
|
|
9
|
+
export { EffectClientInvariantError, EffectDeliveryError, WorkflowEffectError, } from "./base/effect";
|
|
10
|
+
export type { EffectConflictState, EffectState, PreparedEffectBegin, PreparedEffectSettle, } from "./lib/effect-state";
|
|
11
|
+
export { createEffectState, effectNotFound, matchEffectBegin, prepareEffectBegin, prepareEffectSettle, prepareEffectWatch, settleEffect, toEffectRecord, validateEffectRequest, } from "./lib/effect-state";
|
|
12
|
+
export type { Durable, DurableDecoding, DurableObject, DurableValue, DurableValueCodec, DurableValueEncoding, IfDurable, } from "./base/durable-value";
|
|
13
|
+
export { DurableValueError, decodeParsedValue, durableValueCodec, encodeThrownValue, } from "./base/durable-value";
|
|
14
|
+
export type { ErrorClass, WorkflowValueErrorCode } from "./base/errors";
|
|
15
|
+
export { WORKFLOW_RESULT_STEP_KEY, WorkflowValueError, registerErrorClass, } from "./base/errors";
|
|
16
|
+
export type { ExecutionState, PreparedExecutionStart, StartRequestState, } from "./lib/execution-state";
|
|
17
|
+
export { DEFAULT_LEASE_DURATION, REDELIVERY_DELAY_BASE, REDELIVERY_DELAY_MAX, ExecutionEventEncodingError, acknowledgeExecution, claimExecution, createExecutionState, createStartedExecution, decodeExecutionEvent, decodeExecutionOutcome, encodeExecutionEvent, encodeExecutionOutcome, executionIdConflict, executionNotFound, executionStatusAt, isExecutionClaimable, isLeaseCurrent, matchStartRequest, nextClaimAt, prepareExecutionAdmission, prepareExecutionStart, redeliveryDelay, releaseExecutionLease, renewExecutionLease, requestExecutionWake, toExecutionRecord, unacknowledgedDeliveryCountAt, } from "./lib/execution-state";
|
|
18
|
+
export type { DispatcherOptions } from "./lib/execution-dispatcher";
|
|
19
|
+
export { DEFAULT_ABORT_GRACE_PERIOD, DEFAULT_DISPATCHER_CONCURRENCY, ExecutionDispatcher, } from "./lib/execution-dispatcher";
|
|
20
|
+
export { waitForExecutionOutcome } from "./lib/wait-for-outcome";
|
|
21
|
+
export type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
22
|
+
export type { Draft, RuntimeStore, StoreDefinition, StoreDeleteFromResult, StoreKey, StorePath, StoreSelector, StoreSnapshot, StoreState, DurableStoreSchema, StoreStepId, StoreTakeResult, StoreUpdateFromResult, StoreUpdateResult, StoreVersion, StoreWaiter, StoreMutation, StoreMutationCommitResult, StoreDeletion, StoreReadSnapshot, TrackedStoreUpdater, } from "./base/store";
|
|
23
|
+
export { StoreClient, CasStoreClient, StoreValidationError, assertSynchronousClaim, assertSynchronousUpdater, cloneStoreState, decodeStoreValue, defineStore, encodeStoreValue, diffStorePaths, isStoreSelectorMatch, storePathsIntersect, trackStoreSelector, trackStoreUpdater, unwrapTrackedValue, validateStoreState, } from "./base/store";
|
|
5
24
|
export type { EventParams, EventContext, ExecutionEvent, MiddlewareEvent, TriggerEvent, WorkflowEvent, } from "./base/event";
|
|
6
25
|
export type { MiddlewareNext, MiddlewareFunction } from "./base/middleware";
|
|
7
26
|
export type { WorkflowGenerator, WorkflowGeneratorReturnType, WorkflowRouter, EventOfWorkflow, EventParamsOf, } from "./base/workflow";
|
|
8
|
-
export { StepCacheCheck, StepDelay, StepError, StepInvalid, StepKey, StepResponse, StepResult, WorkflowDelay, WorkflowRestart, WorkflowResult, } from "./base/step";
|
|
27
|
+
export { StepCacheCheck, StepDelay, StepEffectWait, StepError, StepInvalid, StepKey, StepResponse, StepResult, StepStoreWait, WorkflowDelay, WorkflowRestart, WorkflowResult, } from "./base/step";
|
|
28
|
+
export type { StepSchemaVerdict } from "./base/step";
|
|
9
29
|
export { WorkflowRunner } from "./lib/workflow-runner";
|
|
10
30
|
export { ReadOnlyMap, FreezableMap } from "./utils/map";
|
|
11
31
|
export { errorWithOriginalStack } from "./utils/error";
|