@ewhauser/world-celld 0.4.0 → 0.5.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 +39 -0
- package/NOTICE +1 -1
- package/README.md +131 -92
- package/celld-queue-worker/README.md +26 -0
- package/celld-queue-worker/worker.ts +3 -0
- package/celld-queue-worker/wrangler.jsonc +26 -0
- package/celld-worker/README.md +33 -23
- package/celld-worker/worker.ts +1 -1
- package/celld-worker/wrangler.jsonc +12 -8
- package/dist/index.d.ts +34 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +290 -132
- package/dist/index.js.map +1 -1
- package/dist/queue-consumer.d.ts +33 -0
- package/dist/queue-consumer.d.ts.map +1 -0
- package/dist/queue-consumer.js +75 -0
- package/dist/queue-consumer.js.map +1 -0
- package/dist/queue-delivery-DzNOtCYA.d.ts +49 -0
- package/dist/queue-delivery-DzNOtCYA.d.ts.map +1 -0
- package/dist/{util-ya3V_FTA.js → queue-protocol-CmJNMH_5.js} +138 -15
- package/dist/queue-protocol-CmJNMH_5.js.map +1 -0
- package/dist/queue-protocol-Ds44uuND.js +104 -0
- package/dist/queue-protocol-Ds44uuND.js.map +1 -0
- package/dist/testing.d.ts +13 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +2715 -2619
- package/dist/testing.js.map +1 -1
- package/dist/worker.d.ts +109 -182
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +3327 -3098
- package/dist/worker.js.map +1 -1
- package/docs/celld-v0.5-upgrade.md +130 -0
- package/package.json +12 -3
- package/dist/util-ya3V_FTA.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateEventParams, CreateEventRequest, Event, GetChunksOptions, Hook, RunCreatedEventRequest, Step, StreamChunksResponse, StreamInfoResponse, Streamer, TerminalWorkflowRunStatus,
|
|
1
|
+
import { CreateEventParams, CreateEventRequest, Event, GetChunksOptions, Hook, RunCreatedEventRequest, Step, StreamChunksResponse, StreamInfoResponse, Streamer, TerminalWorkflowRunStatus, Wait, WorkflowRun, WorkflowRunStatus, World } from "@workflow/world";
|
|
2
2
|
//#region src/retention.d.ts
|
|
3
3
|
type CleanupPhase = 'retained' | 'index' | 'streams' | 'queues' | 'payload' | 'tombstoned';
|
|
4
4
|
interface CleanupRecord {
|
|
@@ -14,7 +14,6 @@ interface CleanupRecord {
|
|
|
14
14
|
terminalStatus?: TerminalWorkflowRunStatus;
|
|
15
15
|
reason?: 'terminal-retention' | 'maximum-age' | 'manual';
|
|
16
16
|
dueAt: Date;
|
|
17
|
-
queueShards: number;
|
|
18
17
|
phase: CleanupPhase;
|
|
19
18
|
/** Optimistic-concurrency token for alarm/RPC work that awaits another cell. */
|
|
20
19
|
generation: number;
|
|
@@ -24,7 +23,8 @@ interface CleanupRecord {
|
|
|
24
23
|
tombstonedAt?: Date;
|
|
25
24
|
deletedPayloadKeys: number;
|
|
26
25
|
deletedStreams: number;
|
|
27
|
-
|
|
26
|
+
/** Queue payload objects removed from object storage during run cleanup. */
|
|
27
|
+
deletedQueuePayloads: number;
|
|
28
28
|
}
|
|
29
29
|
interface RunTombstone {
|
|
30
30
|
version: 1;
|
|
@@ -61,7 +61,6 @@ interface ReleaseHookIndexesResult {
|
|
|
61
61
|
}
|
|
62
62
|
interface ExpireRunIndexesRequest {
|
|
63
63
|
runId: string;
|
|
64
|
-
keys: string[];
|
|
65
64
|
hooks: HookIndexReference[];
|
|
66
65
|
expiredAt: number;
|
|
67
66
|
}
|
|
@@ -85,26 +84,8 @@ interface ExpireStreamResult {
|
|
|
85
84
|
bytes: number;
|
|
86
85
|
done: boolean;
|
|
87
86
|
}
|
|
88
|
-
interface QueueExpiryReceipt {
|
|
89
|
-
expiredAt: number;
|
|
90
|
-
deleted: number;
|
|
91
|
-
}
|
|
92
|
-
type ExpireQueueRunResult = {
|
|
93
|
-
/** Cumulative messages removed for this run in this queue shard. */
|
|
94
|
-
deleted: number;
|
|
95
|
-
} & ({
|
|
96
|
-
done: false;
|
|
97
|
-
} | {
|
|
98
|
-
done: true;
|
|
99
|
-
/** Durable receipt which the cleanup coordinator must acknowledge. */
|
|
100
|
-
receipt: QueueExpiryReceipt;
|
|
101
|
-
});
|
|
102
|
-
interface AcknowledgeQueueExpiryResult {
|
|
103
|
-
acknowledged: boolean;
|
|
104
|
-
}
|
|
105
87
|
interface ScheduleCleanupRequest {
|
|
106
88
|
retentionMs: number;
|
|
107
|
-
queueShards: number;
|
|
108
89
|
}
|
|
109
90
|
//#endregion
|
|
110
91
|
//#region src/apply-event.d.ts
|
|
@@ -306,58 +287,40 @@ interface StreamDOId {
|
|
|
306
287
|
toString(): string;
|
|
307
288
|
}
|
|
308
289
|
//#endregion
|
|
309
|
-
//#region src/queue.d.ts
|
|
310
|
-
type Pathname = 'flow';
|
|
290
|
+
//#region src/queue-protocol.d.ts
|
|
311
291
|
/**
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
292
|
+
* Small broker message carried by celld's native Queue.
|
|
293
|
+
*
|
|
294
|
+
* Run-bearing payload bytes live in object storage so the broker's 128 kB limit does not
|
|
295
|
+
* narrow the Workflow World contract and run retention can delete those bytes
|
|
296
|
+
* without waiting for the Queue's fixed four-day retention window.
|
|
315
297
|
*/
|
|
316
|
-
interface
|
|
298
|
+
interface NativeQueueEnvelope {
|
|
299
|
+
version: 1;
|
|
317
300
|
messageId: string;
|
|
318
|
-
queueName:
|
|
319
|
-
|
|
320
|
-
/** `stringify(message)` — the exact bytes POSTed to the app on delivery. */
|
|
321
|
-
body: string;
|
|
322
|
-
/** Owning workflow run; absent only for health-check messages. */
|
|
301
|
+
queueName: string;
|
|
302
|
+
targetBaseUrl: string;
|
|
323
303
|
runId?: string;
|
|
324
304
|
idempotencyKey?: string;
|
|
305
|
+
payloadKey?: string;
|
|
306
|
+
/** Inline only for the small, run-less health-check envelope. */
|
|
307
|
+
body?: string;
|
|
308
|
+
/** Absolute workflow redelivery deadline; long waits are chained by the consumer. */
|
|
309
|
+
notBefore?: number;
|
|
310
|
+
/** Failed deliveries carried across suspension re-publishes. */
|
|
311
|
+
deliveryFailures?: number;
|
|
312
|
+
suspensionCount?: number;
|
|
313
|
+
}
|
|
314
|
+
interface NativeQueueSendOptions {
|
|
325
315
|
delaySeconds?: number;
|
|
326
|
-
/**
|
|
327
|
-
* Delivery configuration. The cell pins this from its first enqueue (the
|
|
328
|
-
* eve-ambient pattern); a later mismatch is rejected as CONFIG_MISMATCH.
|
|
329
|
-
*/
|
|
330
|
-
config: QueueCellConfig;
|
|
331
316
|
}
|
|
332
|
-
interface
|
|
333
|
-
/** Base URL of the app; deliveries POST to `${baseUrl}/.well-known/workflow/v1/flow`. */
|
|
334
|
-
targetBaseUrl: string;
|
|
335
|
-
queueShards: number;
|
|
336
|
-
}
|
|
337
|
-
type EnqueueOutcome = {
|
|
338
|
-
ok: true;
|
|
317
|
+
interface NativeQueueSendResult {
|
|
339
318
|
messageId: string;
|
|
340
|
-
deduped: boolean;
|
|
341
|
-
} | {
|
|
342
|
-
ok: false;
|
|
343
|
-
code: 'CONFIG_MISMATCH' | 'RUN_EXPIRED';
|
|
344
|
-
message: string;
|
|
345
|
-
};
|
|
346
|
-
/** RPC surface of QueueDO used by the queue producer. */
|
|
347
|
-
interface QueueCellStub {
|
|
348
|
-
enqueue(request: EnqueueRequest): Promise<EnqueueOutcome>;
|
|
349
|
-
expireRun(runId: string, expiredAt: number, options?: {
|
|
350
|
-
limit?: number;
|
|
351
|
-
}): Promise<ExpireQueueRunResult>;
|
|
352
|
-
acknowledgeExpireRun(runId: string, receipt: QueueExpiryReceipt): Promise<AcknowledgeQueueExpiryResult>;
|
|
353
319
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
get(id: {
|
|
359
|
-
toString(): string;
|
|
360
|
-
}): QueueCellStub;
|
|
320
|
+
//#endregion
|
|
321
|
+
//#region src/queue.d.ts
|
|
322
|
+
interface CelldQueueProducer {
|
|
323
|
+
send(envelope: NativeQueueEnvelope, options?: NativeQueueSendOptions): Promise<NativeQueueSendResult>;
|
|
361
324
|
}
|
|
362
325
|
//#endregion
|
|
363
326
|
//#region src/indexes.d.ts
|
|
@@ -370,9 +333,11 @@ interface IndexListOptions {
|
|
|
370
333
|
reverse?: boolean;
|
|
371
334
|
}
|
|
372
335
|
interface IndexListPage {
|
|
336
|
+
/** sourceShard is populated by the merged fleet index for exact follow-up mutation. */
|
|
373
337
|
keys: Array<{
|
|
374
338
|
name: string;
|
|
375
339
|
value: string;
|
|
340
|
+
sourceShard?: string;
|
|
376
341
|
}>;
|
|
377
342
|
list_complete: boolean;
|
|
378
343
|
cursor?: string;
|
|
@@ -414,7 +379,7 @@ interface HookTokenOwner {
|
|
|
414
379
|
interface CelldWorldEnv {
|
|
415
380
|
WORKFLOW_DB: WorkflowRunDONamespace;
|
|
416
381
|
WORKFLOW_INDEX: IndexNamespace;
|
|
417
|
-
WORKFLOW_QUEUE:
|
|
382
|
+
WORKFLOW_QUEUE: CelldQueueProducer;
|
|
418
383
|
WORKFLOW_STREAMS: StreamDONamespace;
|
|
419
384
|
}
|
|
420
385
|
interface CelldWorldConfig {
|
|
@@ -438,13 +403,11 @@ interface CelldWorldConfig {
|
|
|
438
403
|
/** Default: process.env.CELLD_DEPLOYMENT_ID || 'celld-default' */
|
|
439
404
|
deploymentId?: string;
|
|
440
405
|
/**
|
|
441
|
-
* Base URL the app's workflow endpoints are mounted on;
|
|
442
|
-
*
|
|
406
|
+
* Base URL the app's workflow endpoints are mounted on; the native Queue
|
|
407
|
+
* consumer delivers to `${baseUrl}/.well-known/workflow/v1/flow`.
|
|
443
408
|
* Default: process.env.WORKFLOW_BASE_URL || `http://localhost:${PORT ?? 3000}`
|
|
444
409
|
*/
|
|
445
410
|
baseUrl?: string;
|
|
446
|
-
/** Number of queue cells to spread enqueues over. Default: 1 */
|
|
447
|
-
queueShards?: number;
|
|
448
411
|
/**
|
|
449
412
|
* Keep terminal run payloads for this many milliseconds before replacing
|
|
450
413
|
* them with metadata-only tombstones. Zero disables automatic cleanup.
|
|
@@ -471,5 +434,5 @@ type CelldWorld = World & CelldStreamer & {
|
|
|
471
434
|
};
|
|
472
435
|
declare function createCelldWorld(config?: CelldWorldConfig): CelldWorld;
|
|
473
436
|
//#endregion
|
|
474
|
-
export { CelldRetentionAdmin, CelldWorld, type CelldWorldConfig, type CelldWorldEnv, type CleanupPhase, type CleanupRecord, type
|
|
437
|
+
export { type CelldQueueProducer, CelldRetentionAdmin, CelldWorld, type CelldWorldConfig, type CelldWorldEnv, type CleanupPhase, type CleanupRecord, type IndexNamespace, MAX_STREAM_BATCH_BYTES, MAX_STREAM_CHUNK_BYTES, MAX_STREAM_ERROR_BYTES, MAX_STREAM_LONG_POLL_MS, MAX_STREAM_READ_BYTES, MAX_STREAM_READ_CHUNKS, MAX_STREAM_WRITE_CHUNKS, type NativeQueueEnvelope, type NativeQueueSendOptions, type NativeQueueSendResult, type RunTombstone, type StreamDONamespace, type StreamDOStub, type StreamErrorData, type StreamReadRequest, type StreamReadResult, type StreamTerminalState, type StreamWriteResult, type WorkflowRunDONamespace, type WorkflowRunDOStub, createCelldWorld, createCelldWorld as createWorld };
|
|
475
438
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/retention.ts","../src/apply-event.ts","../src/storage.ts","../src/stream-protocol.ts","../src/streamer.ts","../src/queue.ts","../src/indexes.ts","../src/config.ts","../src/index.ts"],"mappings":";;KAOY;UAEK;EACf;EACA;EACA;EACA,WAAW;;EAEX,SAAS;;EAET,cAAc;;EAEd,iBAAiB;EACjB;EACA,OAAO;EACP
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/retention.ts","../src/apply-event.ts","../src/storage.ts","../src/stream-protocol.ts","../src/streamer.ts","../src/queue-protocol.ts","../src/queue.ts","../src/indexes.ts","../src/config.ts","../src/index.ts"],"mappings":";;KAOY;UAEK;EACf;EACA;EACA;EACA,WAAW;;EAEX,SAAS;;EAET,cAAc;;EAEd,iBAAiB;EACjB;EACA,OAAO;EACP,OAAO;;EAEP;EACA;EACA;EACA,gBAAgB;EAChB,eAAe;EACf;EACA;;EAEA;;UAGe;EACf;EACA;;EAEA,SAAS;EACT,cAAc;EACd,iBAAiB;EACjB,WAAW;EACX,cAAc;;EAEd,SAAS;;KAGC;KAEA,eAAe;EACrB;EAAU,OAAO;;EACjB;EAAW;EAAqB;EAAiB,WAAW;;UAEjD;EACf;EACA;;UAae;EACf;EACA,OAAO;;UAGQ;EACf;;UAGe;EACf;EACA,OAAO;EACP;;UAGe;EACf;;UAGe;EACf;;UAGe;;EAEf;EACA;;UAGe;;EAEf;;EAEA;;EAEA;EACA;;UAGe;EACf;;;;UC0Ce;;EAEf;EACA,MAAM,qBAAqB;;EAE3B,SAAS;;;;;EAKT;IAAgB;IAAe;;;EAE/B;;EAEA,UAAU;;KAiFA;UAWK;EACf;EACA,MAAM;EACN;;EAEA;;EAEA;;UAGe;EACf;;EAEA,QAAQ;EACR,MAAM;EACN,OAAO;EACP,OAAO;EACP,OAAO;;EAEP;;EAEA,eAAe;IAAQ;IAAgB;;;EAEvC;IAAe;IAAsB,WAAW;;;EAEhD,cAAc;;EAEd,SAAS;;EAET;EACA;;EAEA;;EAEA;;KAGU,oBAAoB,oBAAoB;;;;;;;UCzOnC;EACf,WAAW,SAAS,oBAAoB,QAAQ;EAChD,sBAAsB;IACpB;IACA;IACA;MACE;IAAU;;EACd,sBAAsB,QADlB;EAEJ,UAAU,QAAQ,eAAe;EACjC,QAAQ,iBAAiB,QAAQ,eAAe;EAChD,SAAS,kBAAkB,QAAQ,eAAe;EAClD,WAAW;IACT;IACA;IACA;MACE,QAAQ;IAAiB,MAAM;IAAS;IAAuB;;EACnE,UAAU;IACR;IACA;IACA;MACE,QAAQ;IAAi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