@ewhauser/world-celld 0.3.0 → 0.3.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/CHANGELOG.md +15 -0
- package/README.md +46 -18
- package/celld-worker/README.md +5 -3
- package/celld-worker/worker.ts +10 -1
- package/celld-worker/wrangler.jsonc +15 -4
- package/dist/index.d.ts +150 -57
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +432 -122
- package/dist/index.js.map +1 -1
- package/dist/testing.d.ts +47 -0
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1622 -479
- package/dist/testing.js.map +1 -1
- package/dist/util-DmO0XkFw.js +545 -0
- package/dist/util-DmO0XkFw.js.map +1 -0
- package/dist/worker.d.ts +210 -106
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +1705 -445
- package/dist/worker.js.map +1 -1
- package/package.json +4 -2
- package/dist/retention-bLY1vcOu.js +0 -164
- package/dist/retention-bLY1vcOu.js.map +0 -1
package/dist/worker.d.ts
CHANGED
|
@@ -12,7 +12,10 @@ interface DONamespaceLike {
|
|
|
12
12
|
interface WorkerEnv {
|
|
13
13
|
WORKFLOW_DB: DONamespaceLike;
|
|
14
14
|
WORKFLOW_STREAMS: DONamespaceLike;
|
|
15
|
-
|
|
15
|
+
WORKFLOW_RUN_CATALOG: DONamespaceLike;
|
|
16
|
+
WORKFLOW_RUN_FENCES: DONamespaceLike;
|
|
17
|
+
WORKFLOW_HOOK_TOKENS: DONamespaceLike;
|
|
18
|
+
WORKFLOW_HOOK_IDS: DONamespaceLike;
|
|
16
19
|
WORKFLOW_QUEUE: DONamespaceLike;
|
|
17
20
|
WORLD_SECRET?: string;
|
|
18
21
|
}
|
|
@@ -30,6 +33,8 @@ interface CleanupRecord {
|
|
|
30
33
|
dueAt: Date;
|
|
31
34
|
queueShards: number;
|
|
32
35
|
phase: CleanupPhase;
|
|
36
|
+
/** Optimistic-concurrency token for alarm/RPC work that awaits another cell. */
|
|
37
|
+
generation: number;
|
|
33
38
|
attempts: number;
|
|
34
39
|
lastError?: string;
|
|
35
40
|
lastAttemptAt?: Date;
|
|
@@ -55,28 +60,30 @@ type RunReadOutcome<T> = {
|
|
|
55
60
|
message: string;
|
|
56
61
|
tombstone: RunTombstone;
|
|
57
62
|
};
|
|
58
|
-
interface HookIndexReference {
|
|
59
|
-
hookId: string;
|
|
60
|
-
token: string;
|
|
61
|
-
}
|
|
62
|
-
interface ExpireRunIndexesRequest {
|
|
63
|
-
runId: string;
|
|
64
|
-
keys: string[];
|
|
65
|
-
hooks: HookIndexReference[];
|
|
66
|
-
expiredAt: number;
|
|
67
|
-
}
|
|
68
63
|
interface ExpireRunIndexesResult {
|
|
69
64
|
deleted: number;
|
|
70
65
|
}
|
|
71
66
|
interface ExpireRunStreamsResult {
|
|
72
67
|
streams: string[];
|
|
73
68
|
}
|
|
69
|
+
interface FinalizeRunStreamsResult {
|
|
70
|
+
/** Cumulative registry entries removed for this run. */
|
|
71
|
+
deleted: number;
|
|
72
|
+
done: boolean;
|
|
73
|
+
}
|
|
74
74
|
interface ExpireStreamResult {
|
|
75
|
+
/** True only when this call installed the stream's expiration fence. */
|
|
75
76
|
deleted: boolean;
|
|
77
|
+
/** Chunk rows removed by this bounded call. */
|
|
76
78
|
chunks: number;
|
|
79
|
+
/** Payload bytes represented by the removed chunk rows. */
|
|
80
|
+
bytes: number;
|
|
81
|
+
done: boolean;
|
|
77
82
|
}
|
|
78
83
|
interface ExpireQueueRunResult {
|
|
84
|
+
/** Cumulative messages removed for this run in this queue shard. */
|
|
79
85
|
deleted: number;
|
|
86
|
+
done: boolean;
|
|
80
87
|
}
|
|
81
88
|
interface ScheduleCleanupRequest {
|
|
82
89
|
retentionMs: number;
|
|
@@ -91,17 +98,19 @@ interface ApplyEventRequest {
|
|
|
91
98
|
/** Workflow 5 event-log position and preload options. */
|
|
92
99
|
params?: CreateEventParams;
|
|
93
100
|
/**
|
|
94
|
-
* Current holder of the hook token per the
|
|
101
|
+
* Current holder of the hook token per the sharded token-ownership index
|
|
95
102
|
* (hook_created only). `null` means the token is unclaimed.
|
|
96
103
|
*/
|
|
97
104
|
tokenHolder?: {
|
|
98
105
|
runId: string;
|
|
99
106
|
hookId: string;
|
|
100
107
|
} | null;
|
|
108
|
+
/** Exact token/ID reservation fenced on ambiguous-delivery resolution. */
|
|
109
|
+
hookClaimId?: string;
|
|
101
110
|
/** Internal world-celld retention policy captured with the event. */
|
|
102
111
|
cleanup?: ScheduleCleanupRequest;
|
|
103
112
|
}
|
|
104
|
-
type ApplyEventErrorCode = 'RUN_NOT_FOUND' | 'STEP_NOT_FOUND' | 'HOOK_NOT_FOUND' | 'WAIT_NOT_FOUND' | 'ENTITY_CONFLICT' | 'RUN_EXPIRED' | 'TOO_EARLY' | 'RUN_NOT_SUPPORTED';
|
|
113
|
+
type ApplyEventErrorCode = 'RUN_NOT_FOUND' | 'STEP_NOT_FOUND' | 'HOOK_NOT_FOUND' | 'WAIT_NOT_FOUND' | 'ENTITY_CONFLICT' | 'HOOK_CLAIM_CANCELLED' | 'RUN_EXPIRED' | 'TOO_EARLY' | 'RUN_NOT_SUPPORTED';
|
|
105
114
|
interface ApplyEventFailure {
|
|
106
115
|
ok: false;
|
|
107
116
|
code: ApplyEventErrorCode;
|
|
@@ -121,7 +130,7 @@ interface ApplyEventSuccess {
|
|
|
121
130
|
wait?: Wait;
|
|
122
131
|
/** True when a lazy step_started atomically created its step. */
|
|
123
132
|
stepCreated?: true;
|
|
124
|
-
/** Hooks whose
|
|
133
|
+
/** Hooks whose token and ID indexes must be released. */
|
|
125
134
|
releasedHooks: Array<{
|
|
126
135
|
hookId: string;
|
|
127
136
|
token: string;
|
|
@@ -131,7 +140,7 @@ interface ApplyEventSuccess {
|
|
|
131
140
|
workflowName: string;
|
|
132
141
|
createdAt: Date;
|
|
133
142
|
};
|
|
134
|
-
/** Set when the
|
|
143
|
+
/** Set when the sharded hook indexes must be (re)written. */
|
|
135
144
|
hookToIndex?: Hook;
|
|
136
145
|
/** All events (ascending), preloaded for run_started responses. */
|
|
137
146
|
events?: Event[];
|
|
@@ -143,6 +152,33 @@ interface ApplyEventSuccess {
|
|
|
143
152
|
}
|
|
144
153
|
type ApplyEventOutcome = ApplyEventSuccess | ApplyEventFailure;
|
|
145
154
|
//#endregion
|
|
155
|
+
//#region src/stream-protocol.d.ts
|
|
156
|
+
type StreamTerminalState = 'open' | 'closed' | 'errored' | 'expired';
|
|
157
|
+
interface StreamErrorData {
|
|
158
|
+
name: string;
|
|
159
|
+
message: string;
|
|
160
|
+
}
|
|
161
|
+
interface StreamWriteResult {
|
|
162
|
+
startIndex: number;
|
|
163
|
+
count: number;
|
|
164
|
+
tailIndex: number;
|
|
165
|
+
}
|
|
166
|
+
interface StreamReadRequest {
|
|
167
|
+
runId: string;
|
|
168
|
+
startIndex: number;
|
|
169
|
+
maxChunks: number;
|
|
170
|
+
maxBytes: number;
|
|
171
|
+
waitMs: number;
|
|
172
|
+
}
|
|
173
|
+
interface StreamReadResult {
|
|
174
|
+
startIndex: number;
|
|
175
|
+
tailIndex: number;
|
|
176
|
+
chunks: Uint8Array[];
|
|
177
|
+
state: StreamTerminalState;
|
|
178
|
+
timedOut: boolean;
|
|
179
|
+
error?: StreamErrorData;
|
|
180
|
+
}
|
|
181
|
+
//#endregion
|
|
146
182
|
//#region src/queue.d.ts
|
|
147
183
|
type Pathname = 'flow';
|
|
148
184
|
/**
|
|
@@ -181,6 +217,35 @@ type EnqueueOutcome = {
|
|
|
181
217
|
message: string;
|
|
182
218
|
};
|
|
183
219
|
//#endregion
|
|
220
|
+
//#region src/indexes.d.ts
|
|
221
|
+
interface IndexListOptions {
|
|
222
|
+
prefix?: string;
|
|
223
|
+
cursor?: string;
|
|
224
|
+
limit?: number;
|
|
225
|
+
reverse?: boolean;
|
|
226
|
+
}
|
|
227
|
+
interface IndexListPage {
|
|
228
|
+
keys: Array<{
|
|
229
|
+
name: string;
|
|
230
|
+
value: string;
|
|
231
|
+
}>;
|
|
232
|
+
list_complete: boolean;
|
|
233
|
+
cursor?: string;
|
|
234
|
+
}
|
|
235
|
+
type RunFenceStatus = 'active' | 'terminal' | 'expired';
|
|
236
|
+
interface RunFenceStub {
|
|
237
|
+
getStatus(): Promise<RunFenceStatus>;
|
|
238
|
+
fenceTerminal(at: number): Promise<RunFenceStatus>;
|
|
239
|
+
fenceExpired(at: number): Promise<RunFenceStatus>;
|
|
240
|
+
}
|
|
241
|
+
interface CellIdLike {
|
|
242
|
+
toString(): string;
|
|
243
|
+
}
|
|
244
|
+
interface CellNamespaceLike<T> {
|
|
245
|
+
idFromName(name: string): CellIdLike;
|
|
246
|
+
get(id: CellIdLike): T;
|
|
247
|
+
}
|
|
248
|
+
//#endregion
|
|
184
249
|
//#region src/config.d.ts
|
|
185
250
|
interface HookTokenOwner {
|
|
186
251
|
runId: string;
|
|
@@ -203,53 +268,55 @@ declare class DurableObject<TEnv = unknown> {
|
|
|
203
268
|
constructor(ctx: DurableObjectState, env: TEnv);
|
|
204
269
|
}
|
|
205
270
|
//#endregion
|
|
206
|
-
//#region src/worker/durable-objects/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
/** Publish a derived index only while its owning run is not expired. */
|
|
224
|
-
putOwned(runId: string, key: string, value: string): Promise<{
|
|
271
|
+
//#region src/worker/durable-objects/hook-index-shared.d.ts
|
|
272
|
+
interface HookIndexEnv {
|
|
273
|
+
WORKFLOW_RUN_FENCES?: CellNamespaceLike<RunFenceStub>;
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/worker/durable-objects/HookIdDO.d.ts
|
|
277
|
+
/** Hook-ID ownership and lookup shard; every hook ID has one transaction domain. */
|
|
278
|
+
declare class HookIdDO extends DurableObject<HookIndexEnv> {
|
|
279
|
+
get(hookId: string): Promise<string | null>;
|
|
280
|
+
reserve(hookId: string, owner: HookTokenOwner, proposedClaimId: string): Promise<{
|
|
281
|
+
claimed: true;
|
|
282
|
+
claimId: string;
|
|
283
|
+
} | {
|
|
284
|
+
claimed: false;
|
|
285
|
+
holder: HookTokenOwner;
|
|
286
|
+
}>;
|
|
287
|
+
publish(hookId: string, serializedHook: string, owner: HookTokenOwner, claimId?: string): Promise<{
|
|
225
288
|
stored: boolean;
|
|
226
289
|
}>;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}): Promise<{
|
|
234
|
-
keys: Array<{
|
|
235
|
-
name: string;
|
|
236
|
-
}>;
|
|
237
|
-
list_complete: boolean;
|
|
238
|
-
cursor?: string;
|
|
290
|
+
releaseClaim(hookId: string, owner: HookTokenOwner, claimId: string): Promise<void>;
|
|
291
|
+
releaseBatch(hooks: Array<{
|
|
292
|
+
hookId: string;
|
|
293
|
+
owner: HookTokenOwner;
|
|
294
|
+
}>, fencedAt: number, runFenced: boolean): Promise<{
|
|
295
|
+
deleted: number;
|
|
239
296
|
}>;
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
297
|
+
}
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/worker/durable-objects/HookTokenDO.d.ts
|
|
300
|
+
/** Token-ownership shard. A token hashes to exactly one shard and transaction domain. */
|
|
301
|
+
declare class HookTokenDO extends DurableObject<HookIndexEnv> {
|
|
302
|
+
get(token: string): Promise<string | null>;
|
|
303
|
+
reserve(token: string, owner: HookTokenOwner, proposedClaimId: string): Promise<{
|
|
304
|
+
claimed: true;
|
|
305
|
+
claimId: string;
|
|
306
|
+
} | {
|
|
307
|
+
claimed: false;
|
|
308
|
+
holder: HookTokenOwner;
|
|
309
|
+
}>;
|
|
310
|
+
finalize(token: string, serializedHook: string, owner: HookTokenOwner, claimId?: string): Promise<{
|
|
311
|
+
stored: boolean;
|
|
312
|
+
}>;
|
|
313
|
+
releaseClaim(token: string, owner: HookTokenOwner, claimId: string): Promise<void>;
|
|
314
|
+
releaseBatch(hooks: Array<{
|
|
315
|
+
token: string;
|
|
316
|
+
owner: HookTokenOwner;
|
|
317
|
+
}>, fencedAt: number, runFenced: boolean): Promise<{
|
|
318
|
+
deleted: number;
|
|
243
319
|
}>;
|
|
244
|
-
finalizeHookIndexes(token: string, hookId: string, serializedHook: string, owner: HookTokenOwner): Promise<void>;
|
|
245
|
-
releaseHookToken(token: string, owner: HookTokenOwner): Promise<void>;
|
|
246
|
-
deleteHookIndexes(token: string, hookId: string, owner: HookTokenOwner): Promise<void>;
|
|
247
|
-
/**
|
|
248
|
-
* Fence a run and remove all of its known derived indexes atomically.
|
|
249
|
-
* Once the fence exists, putOwned() and hook finalization cannot resurrect
|
|
250
|
-
* entries from a delayed request.
|
|
251
|
-
*/
|
|
252
|
-
expireRun(request: ExpireRunIndexesRequest): Promise<ExpireRunIndexesResult>;
|
|
253
320
|
}
|
|
254
321
|
//#endregion
|
|
255
322
|
//#region src/worker/durable-objects/QueueDO.d.ts
|
|
@@ -265,7 +332,8 @@ declare class IndexDO extends DurableObject {
|
|
|
265
332
|
* cfg pinned QueueCellConfig (first-enqueue wins)
|
|
266
333
|
* msg:<messageId> MessageRow
|
|
267
334
|
* due:<paddedMs>:<messageId> schedule index -> messageId
|
|
268
|
-
* inflight:<messageId>
|
|
335
|
+
* inflight-deadline:<paddedMs>:<messageId>
|
|
336
|
+
* ordered crash-recovery index -> messageId
|
|
269
337
|
* key:<idempotencyKey> active dedup claim -> messageId
|
|
270
338
|
* dlq:<paddedMs>:<messageId> DeadLetterRow
|
|
271
339
|
* run:<runId>:<messageId> QueueRunReference for retention cleanup
|
|
@@ -329,6 +397,7 @@ declare class QueueDO extends DurableObject {
|
|
|
329
397
|
}>;
|
|
330
398
|
purgeDeadLetters(): Promise<{
|
|
331
399
|
purged: number;
|
|
400
|
+
hasMore: boolean;
|
|
332
401
|
}>;
|
|
333
402
|
/**
|
|
334
403
|
* Recovery hatch for celld's six-failure alarm abandonment: derive the due
|
|
@@ -338,67 +407,78 @@ declare class QueueDO extends DurableObject {
|
|
|
338
407
|
alarmAt: number | null;
|
|
339
408
|
}>;
|
|
340
409
|
/** Fence a run and purge every live, inflight, and dead-letter message it owns. */
|
|
341
|
-
expireRun(runId: string, expiredAt: number
|
|
410
|
+
expireRun(runId: string, expiredAt: number, options?: {
|
|
411
|
+
limit?: number;
|
|
412
|
+
}): Promise<ExpireQueueRunResult>;
|
|
413
|
+
}
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/worker/durable-objects/RunCatalogDO.d.ts
|
|
416
|
+
/** One of a fixed set of run-catalog shards, routed by the stable run ID hash. */
|
|
417
|
+
declare class RunCatalogDO extends DurableObject {
|
|
418
|
+
upsertRun(runId: string, keys: string[], serializedMetadata: string): Promise<{
|
|
419
|
+
stored: boolean;
|
|
420
|
+
}>;
|
|
421
|
+
list(options?: IndexListOptions): Promise<IndexListPage>;
|
|
422
|
+
expireRun(runId: string, keys: string[], expiredAt: number): Promise<ExpireRunIndexesResult>;
|
|
423
|
+
}
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/worker/durable-objects/RunFenceDO.d.ts
|
|
426
|
+
/** Per-run lifecycle fence used by hook shards without a global lookup cell. */
|
|
427
|
+
declare class RunFenceDO extends DurableObject {
|
|
428
|
+
getStatus(): Promise<RunFenceStatus>;
|
|
429
|
+
fenceTerminal(at: number): Promise<RunFenceStatus>;
|
|
430
|
+
fenceExpired(at: number): Promise<RunFenceStatus>;
|
|
342
431
|
}
|
|
343
432
|
//#endregion
|
|
344
433
|
//#region src/worker/durable-objects/StreamDO.d.ts
|
|
345
434
|
/**
|
|
346
435
|
* Durable Object backing workflow streams.
|
|
347
436
|
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
* each chunk its index; one chunk per storage key.
|
|
352
|
-
* - `run-streams:<runId>`: registry of stream names owned by a run,
|
|
353
|
-
* powering `listStreamsByRunId`.
|
|
437
|
+
* Stream cells persist binary chunks under monotonic offset keys. Public
|
|
438
|
+
* reads are bounded long polls, and writes append a bounded ordered batch in
|
|
439
|
+
* one storage transaction. Per-run registry cells retain their existing role.
|
|
354
440
|
*/
|
|
355
441
|
declare class StreamDO extends DurableObject {
|
|
442
|
+
private meta;
|
|
443
|
+
private metaLoad;
|
|
444
|
+
private mutationTail;
|
|
445
|
+
private changeVersion;
|
|
446
|
+
private readonly waiters;
|
|
356
447
|
private getMeta;
|
|
357
448
|
private assertOwner;
|
|
449
|
+
private assertWritable;
|
|
450
|
+
private runMutation;
|
|
451
|
+
private wakeReaders;
|
|
452
|
+
private waitForChange;
|
|
453
|
+
private readSnapshot;
|
|
454
|
+
/** Append one bounded binary batch with contiguous indexes. */
|
|
455
|
+
writeChunks(runId: string, chunks: Uint8Array[]): Promise<StreamWriteResult>;
|
|
358
456
|
/**
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*/
|
|
362
|
-
writeChunk(runId: string, data: Uint8Array): Promise<number>;
|
|
363
|
-
/**
|
|
364
|
-
* Close the stream (idempotent). Readers observe `done: true` once all
|
|
365
|
-
* previously written chunks have been consumed.
|
|
457
|
+
* Return available binary chunks and terminal metadata in one bounded
|
|
458
|
+
* operation, waiting at most waitMs when the requested offset is idle.
|
|
366
459
|
*/
|
|
460
|
+
readChunks(request: StreamReadRequest, signal?: AbortSignal): Promise<StreamReadResult>;
|
|
461
|
+
/** Close idempotently; the first terminal state wins. */
|
|
367
462
|
closeStream(runId: string): Promise<void>;
|
|
368
|
-
/**
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
getChunks(params: {
|
|
372
|
-
startIndex: number;
|
|
373
|
-
limit: number;
|
|
374
|
-
}): Promise<{
|
|
375
|
-
chunks: Uint8Array[];
|
|
376
|
-
/** Whether the stream is closed. */
|
|
377
|
-
done: boolean;
|
|
378
|
-
/** Index of the last written chunk, -1 when empty. */
|
|
379
|
-
tailIndex: number;
|
|
380
|
-
}>;
|
|
381
|
-
/**
|
|
382
|
-
* Lightweight stream metadata: last chunk index and completion flag.
|
|
383
|
-
*/
|
|
384
|
-
getInfo(): Promise<{
|
|
385
|
-
tailIndex: number;
|
|
386
|
-
done: boolean;
|
|
387
|
-
}>;
|
|
388
|
-
/**
|
|
389
|
-
* Register a stream name against this per-run registry instance.
|
|
390
|
-
*/
|
|
463
|
+
/** Persist a terminal stream failure and wake every pending reader. */
|
|
464
|
+
failStream(runId: string, error: StreamErrorData | string): Promise<void>;
|
|
465
|
+
/** Register a stream name against this per-run registry instance. */
|
|
391
466
|
registerStream(runId: string, name: string): Promise<void>;
|
|
392
|
-
/**
|
|
393
|
-
* List stream names registered against this per-run registry instance.
|
|
394
|
-
*/
|
|
395
467
|
listStreams(): Promise<string[]>;
|
|
396
468
|
/** Fence a run's registry before any stream cells are removed. */
|
|
397
|
-
expireRegistry(runId: string, expiredAt: number
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
|
|
469
|
+
expireRegistry(runId: string, expiredAt: number, options?: {
|
|
470
|
+
limit?: number;
|
|
471
|
+
}): Promise<ExpireRunStreamsResult>;
|
|
472
|
+
/** Remove completed registry entries in a bounded, retry-safe batch. */
|
|
473
|
+
finalizeRegistry(runId: string, streams: string[]): Promise<FinalizeRunStreamsResult>;
|
|
474
|
+
/**
|
|
475
|
+
* Fence the stream and delete one bounded page. Listing size keys avoids
|
|
476
|
+
* loading payloads, and the transaction makes a crash retry resume safely.
|
|
477
|
+
*/
|
|
478
|
+
expireStream(runId: string, expiredAt: number, options?: {
|
|
479
|
+
limit?: number;
|
|
480
|
+
byteLimit?: number;
|
|
481
|
+
}): Promise<ExpireStreamResult>;
|
|
402
482
|
}
|
|
403
483
|
//#endregion
|
|
404
484
|
//#region src/worker/durable-objects/WorkflowRunDO.d.ts
|
|
@@ -414,10 +494,24 @@ declare class StreamDO extends DurableObject {
|
|
|
414
494
|
*/
|
|
415
495
|
declare class WorkflowRunDO extends DurableObject {
|
|
416
496
|
private now;
|
|
417
|
-
private
|
|
497
|
+
private tombstoneFrom;
|
|
498
|
+
private retentionState;
|
|
418
499
|
private read;
|
|
500
|
+
private readKey;
|
|
419
501
|
/** Apply an event and capture all retention metadata in the same transaction. */
|
|
420
502
|
applyEvent(request: ApplyEventRequest): Promise<ApplyEventOutcome>;
|
|
503
|
+
/**
|
|
504
|
+
* Resolve an ambiguous hook-creation RPC in the same serialization domain as
|
|
505
|
+
* applyEvent. If the hook is absent, the exact reservation is durably fenced
|
|
506
|
+
* before the caller releases its token and hook-ID claims.
|
|
507
|
+
*/
|
|
508
|
+
resolveHookTokenClaim(request: {
|
|
509
|
+
hookId: string;
|
|
510
|
+
token: string;
|
|
511
|
+
claimId: string;
|
|
512
|
+
}): Promise<{
|
|
513
|
+
committed: boolean;
|
|
514
|
+
}>;
|
|
421
515
|
getRun(): Promise<RunReadOutcome<WorkflowRun | null>>;
|
|
422
516
|
getStep(stepId: string): Promise<RunReadOutcome<Step | null>>;
|
|
423
517
|
listSteps(params?: {
|
|
@@ -455,10 +549,20 @@ declare class WorkflowRunDO extends DurableObject {
|
|
|
455
549
|
rearmCleanup(): Promise<CleanupRecord | null>;
|
|
456
550
|
alarm(): Promise<void>;
|
|
457
551
|
private namespace;
|
|
552
|
+
private workflowIndex;
|
|
458
553
|
private setCleanupPhase;
|
|
554
|
+
private executeScheduledCleanupPage;
|
|
459
555
|
private executeCleanup;
|
|
556
|
+
private executeTerminalCleanup;
|
|
557
|
+
private deleteTerminalHookPage;
|
|
558
|
+
private deleteTerminalHookMarkerPage;
|
|
559
|
+
private deleteTerminalWaitPage;
|
|
560
|
+
private deleteIndexPage;
|
|
561
|
+
private deleteStreamPage;
|
|
562
|
+
private deleteQueuePage;
|
|
460
563
|
private deletePayloadBatch;
|
|
461
564
|
private recordCleanupFailure;
|
|
565
|
+
private recordTerminalCleanupFailure;
|
|
462
566
|
claimInflight(params: {
|
|
463
567
|
messageId: string;
|
|
464
568
|
staleMs: number;
|
|
@@ -473,5 +577,5 @@ declare const _default: {
|
|
|
473
577
|
fetch(request: Request, env: WorkerEnv): Promise<Response>;
|
|
474
578
|
};
|
|
475
579
|
//#endregion
|
|
476
|
-
export {
|
|
580
|
+
export { HookIdDO, HookTokenDO, QueueDO, RunCatalogDO, RunFenceDO, StreamDO, type WorkerEnv, WorkflowRunDO, createRouter, _default as default };
|
|
477
581
|
//# sourceMappingURL=worker.d.ts.map
|
package/dist/worker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.d.ts","names":[],"sources":["../src/worker/router.ts","../src/retention.ts","../src/apply-event.ts","../src/queue.ts","../src/config.ts","../src/worker/do-base.ts","../src/worker/durable-objects/
|
|
1
|
+
{"version":3,"file":"worker.d.ts","names":[],"sources":["../src/worker/router.ts","../src/retention.ts","../src/apply-event.ts","../src/stream-protocol.ts","../src/queue.ts","../src/indexes.ts","../src/config.ts","../src/worker/do-base.ts","../src/worker/durable-objects/hook-index-shared.ts","../src/worker/durable-objects/HookIdDO.ts","../src/worker/durable-objects/HookTokenDO.ts","../src/worker/durable-objects/QueueDO.ts","../src/worker/durable-objects/RunCatalogDO.ts","../src/worker/durable-objects/RunFenceDO.ts","../src/worker/durable-objects/StreamDO.ts","../src/worker/durable-objects/WorkflowRunDO.ts","../src/worker/worker.ts"],"mappings":";;;UA+CiB;EACf,WAAW;IAAiB;;EAC5B,IAAI;IAAM;;;UAGK;EACf,aAAa;EACb,kBAAkB;EAClB,sBAAsB;EACtB,qBAAqB;EACrB,sBAAsB;EACtB,mBAAmB;EACnB,gBAAgB;EAChB;;iBA6Ic,aAAa,KAAK,aAAS,SAClB,YAAU,QAAQ;;;KCnM/B;UAEK;EACf;EACA;EACA;EACA,WAAW;EACX,aAAa;EACb,gBAAgB;EAChB,OAAO;EACP;EACA,OAAO;;EAEP;EACA;EACA;EACA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