@workflow/core 5.2.3 → 5.4.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/README.md +27 -0
- package/dist/capabilities.d.ts +2 -0
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +7 -1
- package/dist/classify-error.d.ts.map +1 -1
- package/dist/classify-error.js +3 -2
- package/dist/create-hook.d.ts +15 -0
- package/dist/create-hook.d.ts.map +1 -1
- package/dist/create-hook.js +1 -1
- package/dist/events-consumer.d.ts +98 -6
- package/dist/events-consumer.d.ts.map +1 -1
- package/dist/events-consumer.js +198 -13
- package/dist/flushable-stream.js +11 -2
- package/dist/global.d.ts +6 -0
- package/dist/global.d.ts.map +1 -1
- package/dist/global.js +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +65 -35
- package/dist/private.d.ts +41 -2
- package/dist/private.d.ts.map +1 -1
- package/dist/private.js +39 -4
- package/dist/replay-payload-cache.d.ts +13 -2
- package/dist/replay-payload-cache.d.ts.map +1 -1
- package/dist/replay-payload-cache.js +20 -10
- package/dist/runtime/after-terminal-write.d.ts +33 -0
- package/dist/runtime/after-terminal-write.d.ts.map +1 -0
- package/dist/runtime/after-terminal-write.js +23 -0
- package/dist/runtime/child-run-completion-notify.d.ts +36 -0
- package/dist/runtime/child-run-completion-notify.d.ts.map +1 -0
- package/dist/runtime/child-run-completion-notify.js +97 -0
- package/dist/runtime/child-run-completion.d.ts +45 -0
- package/dist/runtime/child-run-completion.d.ts.map +1 -0
- package/dist/runtime/child-run-completion.js +192 -0
- package/dist/runtime/constants.d.ts +161 -176
- package/dist/runtime/constants.d.ts.map +1 -1
- package/dist/runtime/constants.js +194 -273
- package/dist/runtime/delivery.d.ts +270 -0
- package/dist/runtime/delivery.d.ts.map +1 -0
- package/dist/runtime/delivery.js +325 -0
- package/dist/runtime/deployment-guard.d.ts +8 -1
- package/dist/runtime/deployment-guard.d.ts.map +1 -1
- package/dist/runtime/deployment-guard.js +12 -6
- package/dist/runtime/get-port-lazy.d.ts.map +1 -1
- package/dist/runtime/get-port-lazy.js +77 -14
- package/dist/runtime/helpers.d.ts +50 -4
- package/dist/runtime/helpers.d.ts.map +1 -1
- package/dist/runtime/helpers.js +88 -10
- package/dist/runtime/hook-creation.d.ts +45 -0
- package/dist/runtime/hook-creation.d.ts.map +1 -0
- package/dist/runtime/hook-creation.js +98 -0
- package/dist/runtime/hook-wake.d.ts +16 -14
- package/dist/runtime/hook-wake.d.ts.map +1 -1
- package/dist/runtime/hook-wake.js +31 -18
- package/dist/runtime/invocations.d.ts.map +1 -1
- package/dist/runtime/invocations.js +9 -3
- package/dist/runtime/out-of-band-observation.d.ts +28 -17
- package/dist/runtime/out-of-band-observation.d.ts.map +1 -1
- package/dist/runtime/out-of-band-observation.js +12 -3
- package/dist/runtime/quickjs-delivery-shared.d.ts +126 -0
- package/dist/runtime/quickjs-delivery-shared.d.ts.map +1 -0
- package/dist/runtime/quickjs-delivery-shared.js +176 -0
- package/dist/runtime/quickjs-log-view.d.ts +17 -0
- package/dist/runtime/quickjs-log-view.d.ts.map +1 -1
- package/dist/runtime/quickjs-log-view.js +31 -1
- package/dist/runtime/quickjs-pending-ops.d.ts +181 -0
- package/dist/runtime/quickjs-pending-ops.d.ts.map +1 -0
- package/dist/runtime/quickjs-pending-ops.js +633 -0
- package/dist/runtime/quickjs-runtime.d.ts +30 -5
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
- package/dist/runtime/quickjs-runtime.js +546 -169
- package/dist/runtime/quickjs-serde.d.ts.map +1 -1
- package/dist/runtime/quickjs-serde.js +96 -5
- package/dist/runtime/replay-budget.d.ts +8 -1
- package/dist/runtime/replay-budget.d.ts.map +1 -1
- package/dist/runtime/replay-budget.js +12 -8
- package/dist/runtime/resume-hook.d.ts +15 -10
- package/dist/runtime/resume-hook.d.ts.map +1 -1
- package/dist/runtime/resume-hook.js +211 -65
- package/dist/runtime/run-spec-routing.d.ts +52 -0
- package/dist/runtime/run-spec-routing.d.ts.map +1 -0
- package/dist/runtime/run-spec-routing.js +78 -0
- package/dist/runtime/run-spec-version.d.ts +8 -4
- package/dist/runtime/run-spec-version.d.ts.map +1 -1
- package/dist/runtime/run-spec-version.js +11 -7
- package/dist/runtime/run.d.ts +29 -3
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +116 -11
- package/dist/runtime/runs.d.ts +58 -2
- package/dist/runtime/runs.d.ts.map +1 -1
- package/dist/runtime/runs.js +228 -30
- package/dist/runtime/spec8/constants.d.ts +177 -0
- package/dist/runtime/spec8/constants.d.ts.map +1 -0
- package/dist/runtime/spec8/constants.js +232 -0
- package/dist/runtime/spec8/count-step-started-events.d.ts.map +1 -0
- package/dist/runtime/spec8/count-step-started-events.js +72 -0
- package/dist/runtime/spec8/delivery.d.ts +6 -0
- package/dist/runtime/spec8/delivery.d.ts.map +1 -0
- package/dist/runtime/spec8/delivery.js +4250 -0
- package/dist/runtime/spec8/inline-steps-in-flight.d.ts +58 -0
- package/dist/runtime/spec8/inline-steps-in-flight.d.ts.map +1 -0
- package/dist/runtime/spec8/inline-steps-in-flight.js +104 -0
- package/dist/runtime/spec8/open-hook-wait-state.d.ts.map +1 -0
- package/dist/runtime/spec8/open-hook-wait-state.js +93 -0
- package/dist/runtime/{quickjs-entrypoint.d.ts → spec8/quickjs-entrypoint.d.ts} +0 -20
- package/dist/runtime/spec8/quickjs-entrypoint.d.ts.map +1 -0
- package/dist/runtime/spec8/quickjs-entrypoint.js +1779 -0
- package/dist/runtime/{step-executor.d.ts → spec8/step-executor.d.ts} +11 -7
- package/dist/runtime/spec8/step-executor.d.ts.map +1 -0
- package/dist/runtime/spec8/step-executor.js +1134 -0
- package/dist/runtime/{step-ownership.d.ts → spec8/step-ownership.d.ts} +1 -1
- package/dist/runtime/spec8/step-ownership.d.ts.map +1 -0
- package/dist/runtime/spec8/step-ownership.js +114 -0
- package/dist/runtime/spec8/step-single-flight.d.ts +34 -0
- package/dist/runtime/spec8/step-single-flight.d.ts.map +1 -0
- package/dist/runtime/spec8/step-single-flight.js +36 -0
- package/dist/runtime/{suspension-handler.d.ts → spec8/suspension-handler.d.ts} +68 -24
- package/dist/runtime/spec8/suspension-handler.d.ts.map +1 -0
- package/dist/runtime/spec8/suspension-handler.js +1291 -0
- package/dist/runtime/spec9/consume-after-commit.d.ts +33 -0
- package/dist/runtime/spec9/consume-after-commit.d.ts.map +1 -0
- package/dist/runtime/spec9/consume-after-commit.js +13 -0
- package/dist/runtime/spec9/consumed-position.d.ts +38 -0
- package/dist/runtime/spec9/consumed-position.d.ts.map +1 -0
- package/dist/runtime/spec9/consumed-position.js +48 -0
- package/dist/runtime/spec9/creator-rules.d.ts +220 -0
- package/dist/runtime/spec9/creator-rules.d.ts.map +1 -0
- package/dist/runtime/spec9/creator-rules.js +357 -0
- package/dist/runtime/spec9/deadline.d.ts +18 -0
- package/dist/runtime/spec9/deadline.d.ts.map +1 -0
- package/dist/runtime/spec9/deadline.js +27 -0
- package/dist/runtime/spec9/delivery.d.ts +17 -0
- package/dist/runtime/spec9/delivery.d.ts.map +1 -0
- package/dist/runtime/spec9/delivery.js +3837 -0
- package/dist/runtime/spec9/fence-refusals.d.ts +20 -0
- package/dist/runtime/spec9/fence-refusals.d.ts.map +1 -0
- package/dist/runtime/spec9/fence-refusals.js +55 -0
- package/dist/runtime/spec9/in-band-writer.d.ts +275 -0
- package/dist/runtime/spec9/in-band-writer.d.ts.map +1 -0
- package/dist/runtime/spec9/in-band-writer.js +831 -0
- package/dist/runtime/spec9/live-feed.d.ts +151 -0
- package/dist/runtime/spec9/live-feed.d.ts.map +1 -0
- package/dist/runtime/spec9/live-feed.js +311 -0
- package/dist/runtime/spec9/log-state.d.ts +137 -0
- package/dist/runtime/spec9/log-state.d.ts.map +1 -0
- package/dist/runtime/spec9/log-state.js +176 -0
- package/dist/runtime/spec9/quickjs-entrypoint.d.ts +185 -0
- package/dist/runtime/spec9/quickjs-entrypoint.d.ts.map +1 -0
- package/dist/runtime/spec9/quickjs-entrypoint.js +2332 -0
- package/dist/runtime/spec9/read-deadline.d.ts +46 -0
- package/dist/runtime/spec9/read-deadline.d.ts.map +1 -0
- package/dist/runtime/spec9/read-deadline.js +88 -0
- package/dist/runtime/spec9/run-ahead.d.ts +65 -0
- package/dist/runtime/spec9/run-ahead.d.ts.map +1 -0
- package/dist/runtime/spec9/run-ahead.js +102 -0
- package/dist/runtime/spec9/step-delivery.d.ts +111 -0
- package/dist/runtime/spec9/step-delivery.d.ts.map +1 -0
- package/dist/runtime/spec9/step-delivery.js +149 -0
- package/dist/runtime/spec9/step-executor.d.ts +217 -0
- package/dist/runtime/spec9/step-executor.d.ts.map +1 -0
- package/dist/runtime/spec9/step-executor.js +782 -0
- package/dist/runtime/spec9/step-handler.d.ts +92 -0
- package/dist/runtime/spec9/step-handler.d.ts.map +1 -0
- package/dist/runtime/spec9/step-handler.js +375 -0
- package/dist/runtime/spec9/step-message.d.ts +42 -0
- package/dist/runtime/spec9/step-message.d.ts.map +1 -0
- package/dist/runtime/spec9/step-message.js +81 -0
- package/dist/runtime/spec9/step-retention.d.ts +44 -0
- package/dist/runtime/spec9/step-retention.d.ts.map +1 -0
- package/dist/runtime/spec9/step-retention.js +51 -0
- package/dist/runtime/spec9/step-single-flight.d.ts +19 -0
- package/dist/runtime/spec9/step-single-flight.d.ts.map +1 -0
- package/dist/runtime/spec9/step-single-flight.js +24 -0
- package/dist/runtime/spec9/step-wait-creation.d.ts +162 -0
- package/dist/runtime/spec9/step-wait-creation.d.ts.map +1 -0
- package/dist/runtime/spec9/step-wait-creation.js +450 -0
- package/dist/runtime/spec9/suspension-handler.d.ts +125 -0
- package/dist/runtime/spec9/suspension-handler.d.ts.map +1 -0
- package/dist/runtime/spec9/suspension-handler.js +327 -0
- package/dist/runtime/spec9/wait-timer.d.ts +143 -0
- package/dist/runtime/spec9/wait-timer.d.ts.map +1 -0
- package/dist/runtime/spec9/wait-timer.js +173 -0
- package/dist/runtime/start-hook-binding.d.ts +50 -0
- package/dist/runtime/start-hook-binding.d.ts.map +1 -0
- package/dist/runtime/start-hook-binding.js +85 -0
- package/dist/runtime/start-hook-delivery.d.ts +47 -0
- package/dist/runtime/start-hook-delivery.d.ts.map +1 -0
- package/dist/runtime/start-hook-delivery.js +94 -0
- package/dist/runtime/start-hook-holder.d.ts +50 -0
- package/dist/runtime/start-hook-holder.d.ts.map +1 -0
- package/dist/runtime/start-hook-holder.js +149 -0
- package/dist/runtime/start.d.ts +76 -4
- package/dist/runtime/start.d.ts.map +1 -1
- package/dist/runtime/start.js +451 -62
- package/dist/runtime/step-latency.d.ts +3 -3
- package/dist/runtime/step-latency.js +1 -1
- package/dist/runtime/step-single-flight.d.ts +4 -8
- package/dist/runtime/step-single-flight.d.ts.map +1 -1
- package/dist/runtime/step-single-flight.js +23 -36
- package/dist/runtime/step-streams.d.ts +6 -0
- package/dist/runtime/step-streams.d.ts.map +1 -0
- package/dist/runtime/step-streams.js +40 -0
- package/dist/runtime/suspension-hooks.d.ts +84 -0
- package/dist/runtime/suspension-hooks.d.ts.map +1 -0
- package/dist/runtime/suspension-hooks.js +310 -0
- package/dist/runtime/wait-continuation.d.ts +27 -0
- package/dist/runtime/wait-continuation.d.ts.map +1 -1
- package/dist/runtime/wait-continuation.js +27 -2
- package/dist/runtime/world-compatibility.d.ts +22 -3
- package/dist/runtime/world-compatibility.d.ts.map +1 -1
- package/dist/runtime/world-compatibility.js +37 -2
- package/dist/runtime/world.d.ts.map +1 -1
- package/dist/runtime/world.js +2 -1
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +118 -4154
- package/dist/serialization/abort-stream.d.ts +11 -0
- package/dist/serialization/abort-stream.d.ts.map +1 -0
- package/dist/serialization/abort-stream.js +86 -0
- package/dist/serialization/reducers/common-vm.d.ts.map +1 -1
- package/dist/serialization/reducers/common-vm.js +39 -2
- package/dist/serialization/reducers/common.d.ts.map +1 -1
- package/dist/serialization/reducers/common.js +26 -3
- package/dist/serialization/types.d.ts +10 -1
- package/dist/serialization/types.d.ts.map +1 -1
- package/dist/serialization/types.js +1 -1
- package/dist/serialization.d.ts +21 -5
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +136 -79
- package/dist/set-attributes.d.ts.map +1 -1
- package/dist/set-attributes.js +9 -14
- package/dist/step/context-storage.d.ts +2 -0
- package/dist/step/context-storage.d.ts.map +1 -1
- package/dist/step/context-storage.js +1 -1
- package/dist/step.d.ts.map +1 -1
- package/dist/step.js +23 -16
- package/dist/telemetry/semantic-conventions.d.ts +218 -3
- package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
- package/dist/telemetry/semantic-conventions.js +161 -2
- package/dist/test-support/append-only-world.d.ts +437 -0
- package/dist/test-support/append-only-world.d.ts.map +1 -0
- package/dist/test-support/append-only-world.js +816 -0
- package/dist/test-support/fence-snapshot.d.ts +11 -0
- package/dist/test-support/fence-snapshot.d.ts.map +1 -0
- package/dist/test-support/fence-snapshot.js +12 -0
- package/dist/test-support/load-events.d.ts +8 -0
- package/dist/test-support/load-events.d.ts.map +1 -0
- package/dist/test-support/load-events.js +27 -0
- package/dist/test-support/orchestrator-harness.d.ts +502 -0
- package/dist/test-support/orchestrator-harness.d.ts.map +1 -0
- package/dist/test-support/orchestrator-harness.js +116 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +2 -2
- package/dist/workflow/abort-controller.d.ts.map +1 -1
- package/dist/workflow/abort-controller.js +7 -5
- package/dist/workflow/hook.d.ts +5 -0
- package/dist/workflow/hook.d.ts.map +1 -1
- package/dist/workflow/hook.js +83 -19
- package/dist/workflow.d.ts +45 -16
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +111 -50
- package/docs/api-reference/create-hook.mdx +8 -0
- package/docs/api-reference/create-webhook.mdx +1 -1
- package/docs/api-reference/fetch.mdx +2 -0
- package/docs/foundations/errors-and-retries.mdx +6 -0
- package/docs/foundations/hooks.mdx +3 -1
- package/docs/foundations/idempotency.mdx +190 -60
- package/docs/foundations/starting-workflows.mdx +3 -7
- package/docs/how-it-works/event-sourcing.mdx +6 -0
- package/package.json +5 -5
- package/dist/runtime/count-step-started-events.d.ts.map +0 -1
- package/dist/runtime/count-step-started-events.js +0 -72
- package/dist/runtime/open-hook-wait-state.d.ts.map +0 -1
- package/dist/runtime/open-hook-wait-state.js +0 -93
- package/dist/runtime/quickjs-entrypoint.d.ts.map +0 -1
- package/dist/runtime/quickjs-entrypoint.js +0 -2314
- package/dist/runtime/step-executor.d.ts.map +0 -1
- package/dist/runtime/step-executor.js +0 -1156
- package/dist/runtime/step-ownership.d.ts.map +0 -1
- package/dist/runtime/step-ownership.js +0 -114
- package/dist/runtime/suspension-handler.d.ts.map +0 -1
- package/dist/runtime/suspension-handler.js +0 -1562
- /package/dist/runtime/{count-step-started-events.d.ts → spec8/count-step-started-events.d.ts} +0 -0
- /package/dist/runtime/{open-hook-wait-state.d.ts → spec8/open-hook-wait-state.d.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EventLogSnapshot } from '@workflow/world';
|
|
2
|
+
/**
|
|
3
|
+
* The `events.list` snapshot for a hand-rolled mock World that accepts every
|
|
4
|
+
* in-band write: `seq` is the listed log's length, and `seqInBand` is the
|
|
5
|
+
* same number, since such a mock never compares it. Every World returns a
|
|
6
|
+
* snapshot (`WorldCapabilities.inBandFence`), and the runtime refuses to write
|
|
7
|
+
* in-band from a load without one, so a mock that lists events must too. Use
|
|
8
|
+
* `AppendOnlyWorld` for a test that exercises the fence itself.
|
|
9
|
+
*/
|
|
10
|
+
export declare function acceptingFenceSnapshot(events: readonly unknown[]): EventLogSnapshot;
|
|
11
|
+
//# sourceMappingURL=fence-snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fence-snapshot.d.ts","sourceRoot":"","sources":["../../src/test-support/fence-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,OAAO,EAAE,GACzB,gBAAgB,CAElB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `events.list` snapshot for a hand-rolled mock World that accepts every
|
|
3
|
+
* in-band write: `seq` is the listed log's length, and `seqInBand` is the
|
|
4
|
+
* same number, since such a mock never compares it. Every World returns a
|
|
5
|
+
* snapshot (`WorldCapabilities.inBandFence`), and the runtime refuses to write
|
|
6
|
+
* in-band from a load without one, so a mock that lists events must too. Use
|
|
7
|
+
* `AppendOnlyWorld` for a test that exercises the fence itself.
|
|
8
|
+
*/
|
|
9
|
+
export function acceptingFenceSnapshot(events) {
|
|
10
|
+
return { seq: events.length, seqInBand: events.length };
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmVuY2Utc25hcHNob3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdC1zdXBwb3J0L2ZlbmNlLXNuYXBzaG90LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBOzs7Ozs7O0dBT0c7QUFDSCxNQUFNLFVBQVUsc0JBQXNCLENBQ3BDLE1BQTBCO0lBRTFCLE9BQU8sRUFBRSxHQUFHLEVBQUUsTUFBTSxDQUFDLE1BQU0sRUFBRSxTQUFTLEVBQUUsTUFBTSxDQUFDLE1BQU0sRUFBRSxDQUFDO0FBQzFELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IEV2ZW50TG9nU25hcHNob3QgfSBmcm9tICdAd29ya2Zsb3cvd29ybGQnO1xuXG4vKipcbiAqIFRoZSBgZXZlbnRzLmxpc3RgIHNuYXBzaG90IGZvciBhIGhhbmQtcm9sbGVkIG1vY2sgV29ybGQgdGhhdCBhY2NlcHRzIGV2ZXJ5XG4gKiBpbi1iYW5kIHdyaXRlOiBgc2VxYCBpcyB0aGUgbGlzdGVkIGxvZydzIGxlbmd0aCwgYW5kIGBzZXFJbkJhbmRgIGlzIHRoZVxuICogc2FtZSBudW1iZXIsIHNpbmNlIHN1Y2ggYSBtb2NrIG5ldmVyIGNvbXBhcmVzIGl0LiBFdmVyeSBXb3JsZCByZXR1cm5zIGFcbiAqIHNuYXBzaG90IChgV29ybGRDYXBhYmlsaXRpZXMuaW5CYW5kRmVuY2VgKSwgYW5kIHRoZSBydW50aW1lIHJlZnVzZXMgdG8gd3JpdGVcbiAqIGluLWJhbmQgZnJvbSBhIGxvYWQgd2l0aG91dCBvbmUsIHNvIGEgbW9jayB0aGF0IGxpc3RzIGV2ZW50cyBtdXN0IHRvby4gVXNlXG4gKiBgQXBwZW5kT25seVdvcmxkYCBmb3IgYSB0ZXN0IHRoYXQgZXhlcmNpc2VzIHRoZSBmZW5jZSBpdHNlbGYuXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBhY2NlcHRpbmdGZW5jZVNuYXBzaG90KFxuICBldmVudHM6IHJlYWRvbmx5IHVua25vd25bXVxuKTogRXZlbnRMb2dTbmFwc2hvdCB7XG4gIHJldHVybiB7IHNlcTogZXZlbnRzLmxlbmd0aCwgc2VxSW5CYW5kOiBldmVudHMubGVuZ3RoIH07XG59XG4iXX0=
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { World } from '@workflow/world';
|
|
2
|
+
import type { LoadedEventLog } from '../runtime/helpers.js';
|
|
3
|
+
/**
|
|
4
|
+
* A full log load against an explicit World, keeping the first page's
|
|
5
|
+
* snapshot, for tests that do not install a global World.
|
|
6
|
+
*/
|
|
7
|
+
export declare function loadWorkflowRunEventsFrom(world: Pick<World, 'events'>, runId: string): Promise<LoadedEventLog>;
|
|
8
|
+
//# sourceMappingURL=load-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-events.d.ts","sourceRoot":"","sources":["../../src/test-support/load-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,EAC5B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,cAAc,CAAC,CAmBzB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { REPLAY_RESOLVE_DATA } from '../runtime/helpers.js';
|
|
2
|
+
/**
|
|
3
|
+
* A full log load against an explicit World, keeping the first page's
|
|
4
|
+
* snapshot, for tests that do not install a global World.
|
|
5
|
+
*/
|
|
6
|
+
export async function loadWorkflowRunEventsFrom(world, runId) {
|
|
7
|
+
const events = [];
|
|
8
|
+
let cursor = null;
|
|
9
|
+
let snapshot;
|
|
10
|
+
let first = true;
|
|
11
|
+
let hasMore = true;
|
|
12
|
+
while (hasMore) {
|
|
13
|
+
const page = await world.events.list({
|
|
14
|
+
runId,
|
|
15
|
+
pagination: { sortOrder: 'asc', cursor: cursor ?? undefined },
|
|
16
|
+
resolveData: REPLAY_RESOLVE_DATA,
|
|
17
|
+
});
|
|
18
|
+
if (first)
|
|
19
|
+
snapshot = page.snapshot;
|
|
20
|
+
first = false;
|
|
21
|
+
events.push(...page.data);
|
|
22
|
+
cursor = page.cursor ?? cursor;
|
|
23
|
+
hasMore = page.hasMore;
|
|
24
|
+
}
|
|
25
|
+
return { events, cursor, snapshot };
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hZC1ldmVudHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdGVzdC1zdXBwb3J0L2xvYWQtZXZlbnRzL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ICB9KTtcbiAgICBpZiAoZmlyc3QpIHNuYXBzaG90ID0gcGFnZS5zbmFwc2hvdDtcbiAgICBmaXJzdCA9IGZhbHNlO1xuICAgIGV2ZW50cy5wdXNoKC4uLnBhZ2UuZGF0YSk7XG4gICAgY3Vyc29yID0gcGFnZS5jdXJzb3IgPz8gY3Vyc29yO1xuICAgIGhhc01vcmUgPSBwYWdlLmhhc01vcmU7XG4gIH1cbiAgcmV0dXJuIHsgZXZlbnRzLCBjdXJzb3IsIHNuYXBzaG90IH07XG59XG4iXX0=
|
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import type { Event } from '@workflow/world';
|
|
2
|
+
import { AppendOnlyWorld, type HeldMessage } from './append-only-world.js';
|
|
3
|
+
/** The orchestrator queue of a workflow named `workflow`. */
|
|
4
|
+
export declare const ORCHESTRATOR_QUEUE = "__wkf_workflow_workflow";
|
|
5
|
+
/** Registers `name` as the workflow of a test's workflow code. */
|
|
6
|
+
export declare function registerWorkflow(name?: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Seeds a run of `code` on a fresh {@link AppendOnlyWorld}, installs it as the
|
|
9
|
+
* World, registers the queue handler, and enqueues the run's start message
|
|
10
|
+
* (not delivered).
|
|
11
|
+
*/
|
|
12
|
+
export declare function setupOrchestratorRun(code: string, args: unknown[], options?: ConstructorParameters<typeof AppendOnlyWorld>[0], engine?: 'node' | 'quickjs'): Promise<{
|
|
13
|
+
world: AppendOnlyWorld;
|
|
14
|
+
runId: string;
|
|
15
|
+
start: HeldMessage;
|
|
16
|
+
}>;
|
|
17
|
+
export declare const eventsOf: (world: AppendOnlyWorld, type: string) => (({
|
|
18
|
+
eventType: "run_created";
|
|
19
|
+
eventData: {
|
|
20
|
+
deploymentId: string;
|
|
21
|
+
workflowName: string;
|
|
22
|
+
input: unknown;
|
|
23
|
+
executionContext?: Record<string, any> | undefined;
|
|
24
|
+
attributes?: Record<string, string> | undefined;
|
|
25
|
+
allowReservedAttributes?: true | undefined;
|
|
26
|
+
dynamicWorkflowCode?: unknown;
|
|
27
|
+
dynamicWorkflowCodeRef?: string | undefined;
|
|
28
|
+
encryptionPublicKey?: string | undefined;
|
|
29
|
+
startHook?: {
|
|
30
|
+
token: string;
|
|
31
|
+
hookId?: string | undefined;
|
|
32
|
+
tokenRetentionUntil?: Date | undefined;
|
|
33
|
+
metadata?: unknown;
|
|
34
|
+
} | undefined;
|
|
35
|
+
};
|
|
36
|
+
correlationId?: string | undefined;
|
|
37
|
+
specVersion?: number | undefined;
|
|
38
|
+
} | {
|
|
39
|
+
eventType: "run_started";
|
|
40
|
+
correlationId?: string | undefined;
|
|
41
|
+
specVersion?: number | undefined;
|
|
42
|
+
eventData?: {
|
|
43
|
+
input?: unknown;
|
|
44
|
+
deploymentId?: string | undefined;
|
|
45
|
+
workflowName?: string | undefined;
|
|
46
|
+
executionContext?: Record<string, any> | undefined;
|
|
47
|
+
attributes?: Record<string, string> | undefined;
|
|
48
|
+
allowReservedAttributes?: true | undefined;
|
|
49
|
+
encryptionPublicKey?: string | undefined;
|
|
50
|
+
dynamicWorkflowCode?: unknown;
|
|
51
|
+
dynamicWorkflowCodeRef?: string | undefined;
|
|
52
|
+
startHook?: {
|
|
53
|
+
token: string;
|
|
54
|
+
hookId?: string | undefined;
|
|
55
|
+
tokenRetentionUntil?: Date | undefined;
|
|
56
|
+
metadata?: unknown;
|
|
57
|
+
} | undefined;
|
|
58
|
+
} | undefined;
|
|
59
|
+
} | {
|
|
60
|
+
eventType: "run_completed";
|
|
61
|
+
eventData: {
|
|
62
|
+
output?: unknown;
|
|
63
|
+
};
|
|
64
|
+
correlationId?: string | undefined;
|
|
65
|
+
specVersion?: number | undefined;
|
|
66
|
+
} | {
|
|
67
|
+
eventType: "run_failed";
|
|
68
|
+
eventData: {
|
|
69
|
+
error: unknown;
|
|
70
|
+
errorCode?: string | undefined;
|
|
71
|
+
};
|
|
72
|
+
correlationId?: string | undefined;
|
|
73
|
+
specVersion?: number | undefined;
|
|
74
|
+
} | {
|
|
75
|
+
eventType: "run_cancelled";
|
|
76
|
+
correlationId?: string | undefined;
|
|
77
|
+
specVersion?: number | undefined;
|
|
78
|
+
eventData?: {
|
|
79
|
+
cancelReason?: string | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
} | {
|
|
82
|
+
eventType: "attr_set";
|
|
83
|
+
eventData: {
|
|
84
|
+
changes: {
|
|
85
|
+
key: string;
|
|
86
|
+
value: string | null;
|
|
87
|
+
}[];
|
|
88
|
+
writer: {
|
|
89
|
+
type: "workflow";
|
|
90
|
+
} | {
|
|
91
|
+
type: "step";
|
|
92
|
+
stepId: string;
|
|
93
|
+
attempt: number;
|
|
94
|
+
};
|
|
95
|
+
allowReservedAttributes?: true | undefined;
|
|
96
|
+
};
|
|
97
|
+
specVersion?: number | undefined;
|
|
98
|
+
correlationId?: string | undefined;
|
|
99
|
+
} | {
|
|
100
|
+
eventType: "step_created";
|
|
101
|
+
correlationId: string;
|
|
102
|
+
eventData: {
|
|
103
|
+
stepName: string;
|
|
104
|
+
input: unknown;
|
|
105
|
+
workflowName?: string | undefined;
|
|
106
|
+
inline?: boolean | undefined;
|
|
107
|
+
creatorMessageId?: string | undefined;
|
|
108
|
+
};
|
|
109
|
+
specVersion?: number | undefined;
|
|
110
|
+
} | {
|
|
111
|
+
eventType: "step_completed";
|
|
112
|
+
correlationId: string;
|
|
113
|
+
eventData: {
|
|
114
|
+
result: unknown;
|
|
115
|
+
ttfs?: number | undefined;
|
|
116
|
+
stso?: number | undefined;
|
|
117
|
+
stepCount?: number | undefined;
|
|
118
|
+
eventCount?: number | undefined;
|
|
119
|
+
rsfs?: number | undefined;
|
|
120
|
+
finalSchedulingReplay?: number | undefined;
|
|
121
|
+
optimizations?: string[] | undefined;
|
|
122
|
+
stepName?: string | undefined;
|
|
123
|
+
workflowName?: string | undefined;
|
|
124
|
+
};
|
|
125
|
+
specVersion?: number | undefined;
|
|
126
|
+
} | {
|
|
127
|
+
eventType: "step_failed";
|
|
128
|
+
correlationId: string;
|
|
129
|
+
eventData: {
|
|
130
|
+
error: unknown;
|
|
131
|
+
ttfs?: number | undefined;
|
|
132
|
+
stso?: number | undefined;
|
|
133
|
+
stepCount?: number | undefined;
|
|
134
|
+
eventCount?: number | undefined;
|
|
135
|
+
rsfs?: number | undefined;
|
|
136
|
+
finalSchedulingReplay?: number | undefined;
|
|
137
|
+
optimizations?: string[] | undefined;
|
|
138
|
+
stepName?: string | undefined;
|
|
139
|
+
attempt?: number | undefined;
|
|
140
|
+
};
|
|
141
|
+
specVersion?: number | undefined;
|
|
142
|
+
} | {
|
|
143
|
+
eventType: "step_retrying";
|
|
144
|
+
correlationId: string;
|
|
145
|
+
eventData: {
|
|
146
|
+
error: unknown;
|
|
147
|
+
stepName?: string | undefined;
|
|
148
|
+
retryAfter?: Date | undefined;
|
|
149
|
+
attempt?: number | undefined;
|
|
150
|
+
creatorMessageId?: string | undefined;
|
|
151
|
+
};
|
|
152
|
+
specVersion?: number | undefined;
|
|
153
|
+
} | {
|
|
154
|
+
eventType: "step_started";
|
|
155
|
+
correlationId: string;
|
|
156
|
+
specVersion?: number | undefined;
|
|
157
|
+
eventData?: {
|
|
158
|
+
stepName?: string | undefined;
|
|
159
|
+
attempt?: number | undefined;
|
|
160
|
+
workflowName?: string | undefined;
|
|
161
|
+
input?: unknown;
|
|
162
|
+
inline?: boolean | undefined;
|
|
163
|
+
ownerMessageId?: string | undefined;
|
|
164
|
+
} | undefined;
|
|
165
|
+
} | {
|
|
166
|
+
eventType: "hook_created";
|
|
167
|
+
correlationId: string;
|
|
168
|
+
eventData: {
|
|
169
|
+
token: string;
|
|
170
|
+
tokenRetentionUntil?: Date | undefined;
|
|
171
|
+
metadata?: unknown;
|
|
172
|
+
isWebhook?: boolean | undefined;
|
|
173
|
+
isSystem?: boolean | undefined;
|
|
174
|
+
force?: boolean | undefined;
|
|
175
|
+
forceClaimedFrom?: {
|
|
176
|
+
runId: string;
|
|
177
|
+
hookId: string;
|
|
178
|
+
workflowName?: string | undefined;
|
|
179
|
+
deploymentId?: string | undefined;
|
|
180
|
+
runSpecVersion?: number | undefined;
|
|
181
|
+
} | undefined;
|
|
182
|
+
};
|
|
183
|
+
specVersion?: number | undefined;
|
|
184
|
+
} | {
|
|
185
|
+
eventType: "hook_received";
|
|
186
|
+
correlationId: string;
|
|
187
|
+
eventData: {
|
|
188
|
+
payload: unknown;
|
|
189
|
+
token?: string | undefined;
|
|
190
|
+
};
|
|
191
|
+
specVersion?: number | undefined;
|
|
192
|
+
} | {
|
|
193
|
+
eventType: "hook_disposed";
|
|
194
|
+
correlationId: string;
|
|
195
|
+
specVersion?: number | undefined;
|
|
196
|
+
eventData?: {
|
|
197
|
+
token?: string | undefined;
|
|
198
|
+
forceClaimedBy?: {
|
|
199
|
+
runId: string;
|
|
200
|
+
hookId: string;
|
|
201
|
+
} | undefined;
|
|
202
|
+
} | undefined;
|
|
203
|
+
} | {
|
|
204
|
+
eventType: "hook_conflict";
|
|
205
|
+
correlationId: string;
|
|
206
|
+
eventData: {
|
|
207
|
+
token: string;
|
|
208
|
+
conflictingRunId?: string | undefined;
|
|
209
|
+
forceRefusedReason?: "victim-spec-version" | undefined;
|
|
210
|
+
};
|
|
211
|
+
specVersion?: number | undefined;
|
|
212
|
+
} | {
|
|
213
|
+
eventType: "wait_created";
|
|
214
|
+
correlationId: string;
|
|
215
|
+
eventData: {
|
|
216
|
+
resumeAt: Date;
|
|
217
|
+
creatorMessageId?: string | undefined;
|
|
218
|
+
};
|
|
219
|
+
specVersion?: number | undefined;
|
|
220
|
+
} | {
|
|
221
|
+
eventType: "wait_completed";
|
|
222
|
+
correlationId: string;
|
|
223
|
+
specVersion?: number | undefined;
|
|
224
|
+
eventData?: {
|
|
225
|
+
resumeAt?: Date | undefined;
|
|
226
|
+
} | undefined;
|
|
227
|
+
} | {
|
|
228
|
+
eventType: "noop";
|
|
229
|
+
correlationId?: string | undefined;
|
|
230
|
+
specVersion?: number | undefined;
|
|
231
|
+
eventData?: {
|
|
232
|
+
[x: string]: unknown;
|
|
233
|
+
sealed?: boolean | undefined;
|
|
234
|
+
} | undefined;
|
|
235
|
+
}) & {
|
|
236
|
+
runId: string;
|
|
237
|
+
eventId: string;
|
|
238
|
+
createdAt: Date;
|
|
239
|
+
occurredAt?: Date | undefined;
|
|
240
|
+
specVersion?: number | undefined;
|
|
241
|
+
resumeId?: string | undefined;
|
|
242
|
+
})[];
|
|
243
|
+
export declare const dataOf: (event: Event | undefined) => Record<string, unknown> | undefined;
|
|
244
|
+
/**
|
|
245
|
+
* Each step's creation: a background step's `step_created`, or an inline
|
|
246
|
+
* step's creation-bearing first `step_started` (`inline: true`).
|
|
247
|
+
*/
|
|
248
|
+
export declare const creationsOf: (world: AppendOnlyWorld) => (({
|
|
249
|
+
eventType: "run_created";
|
|
250
|
+
eventData: {
|
|
251
|
+
deploymentId: string;
|
|
252
|
+
workflowName: string;
|
|
253
|
+
input: unknown;
|
|
254
|
+
executionContext?: Record<string, any> | undefined;
|
|
255
|
+
attributes?: Record<string, string> | undefined;
|
|
256
|
+
allowReservedAttributes?: true | undefined;
|
|
257
|
+
dynamicWorkflowCode?: unknown;
|
|
258
|
+
dynamicWorkflowCodeRef?: string | undefined;
|
|
259
|
+
encryptionPublicKey?: string | undefined;
|
|
260
|
+
startHook?: {
|
|
261
|
+
token: string;
|
|
262
|
+
hookId?: string | undefined;
|
|
263
|
+
tokenRetentionUntil?: Date | undefined;
|
|
264
|
+
metadata?: unknown;
|
|
265
|
+
} | undefined;
|
|
266
|
+
};
|
|
267
|
+
correlationId?: string | undefined;
|
|
268
|
+
specVersion?: number | undefined;
|
|
269
|
+
} | {
|
|
270
|
+
eventType: "run_started";
|
|
271
|
+
correlationId?: string | undefined;
|
|
272
|
+
specVersion?: number | undefined;
|
|
273
|
+
eventData?: {
|
|
274
|
+
input?: unknown;
|
|
275
|
+
deploymentId?: string | undefined;
|
|
276
|
+
workflowName?: string | undefined;
|
|
277
|
+
executionContext?: Record<string, any> | undefined;
|
|
278
|
+
attributes?: Record<string, string> | undefined;
|
|
279
|
+
allowReservedAttributes?: true | undefined;
|
|
280
|
+
encryptionPublicKey?: string | undefined;
|
|
281
|
+
dynamicWorkflowCode?: unknown;
|
|
282
|
+
dynamicWorkflowCodeRef?: string | undefined;
|
|
283
|
+
startHook?: {
|
|
284
|
+
token: string;
|
|
285
|
+
hookId?: string | undefined;
|
|
286
|
+
tokenRetentionUntil?: Date | undefined;
|
|
287
|
+
metadata?: unknown;
|
|
288
|
+
} | undefined;
|
|
289
|
+
} | undefined;
|
|
290
|
+
} | {
|
|
291
|
+
eventType: "run_completed";
|
|
292
|
+
eventData: {
|
|
293
|
+
output?: unknown;
|
|
294
|
+
};
|
|
295
|
+
correlationId?: string | undefined;
|
|
296
|
+
specVersion?: number | undefined;
|
|
297
|
+
} | {
|
|
298
|
+
eventType: "run_failed";
|
|
299
|
+
eventData: {
|
|
300
|
+
error: unknown;
|
|
301
|
+
errorCode?: string | undefined;
|
|
302
|
+
};
|
|
303
|
+
correlationId?: string | undefined;
|
|
304
|
+
specVersion?: number | undefined;
|
|
305
|
+
} | {
|
|
306
|
+
eventType: "run_cancelled";
|
|
307
|
+
correlationId?: string | undefined;
|
|
308
|
+
specVersion?: number | undefined;
|
|
309
|
+
eventData?: {
|
|
310
|
+
cancelReason?: string | undefined;
|
|
311
|
+
} | undefined;
|
|
312
|
+
} | {
|
|
313
|
+
eventType: "attr_set";
|
|
314
|
+
eventData: {
|
|
315
|
+
changes: {
|
|
316
|
+
key: string;
|
|
317
|
+
value: string | null;
|
|
318
|
+
}[];
|
|
319
|
+
writer: {
|
|
320
|
+
type: "workflow";
|
|
321
|
+
} | {
|
|
322
|
+
type: "step";
|
|
323
|
+
stepId: string;
|
|
324
|
+
attempt: number;
|
|
325
|
+
};
|
|
326
|
+
allowReservedAttributes?: true | undefined;
|
|
327
|
+
};
|
|
328
|
+
specVersion?: number | undefined;
|
|
329
|
+
correlationId?: string | undefined;
|
|
330
|
+
} | {
|
|
331
|
+
eventType: "step_created";
|
|
332
|
+
correlationId: string;
|
|
333
|
+
eventData: {
|
|
334
|
+
stepName: string;
|
|
335
|
+
input: unknown;
|
|
336
|
+
workflowName?: string | undefined;
|
|
337
|
+
inline?: boolean | undefined;
|
|
338
|
+
creatorMessageId?: string | undefined;
|
|
339
|
+
};
|
|
340
|
+
specVersion?: number | undefined;
|
|
341
|
+
} | {
|
|
342
|
+
eventType: "step_completed";
|
|
343
|
+
correlationId: string;
|
|
344
|
+
eventData: {
|
|
345
|
+
result: unknown;
|
|
346
|
+
ttfs?: number | undefined;
|
|
347
|
+
stso?: number | undefined;
|
|
348
|
+
stepCount?: number | undefined;
|
|
349
|
+
eventCount?: number | undefined;
|
|
350
|
+
rsfs?: number | undefined;
|
|
351
|
+
finalSchedulingReplay?: number | undefined;
|
|
352
|
+
optimizations?: string[] | undefined;
|
|
353
|
+
stepName?: string | undefined;
|
|
354
|
+
workflowName?: string | undefined;
|
|
355
|
+
};
|
|
356
|
+
specVersion?: number | undefined;
|
|
357
|
+
} | {
|
|
358
|
+
eventType: "step_failed";
|
|
359
|
+
correlationId: string;
|
|
360
|
+
eventData: {
|
|
361
|
+
error: unknown;
|
|
362
|
+
ttfs?: number | undefined;
|
|
363
|
+
stso?: number | undefined;
|
|
364
|
+
stepCount?: number | undefined;
|
|
365
|
+
eventCount?: number | undefined;
|
|
366
|
+
rsfs?: number | undefined;
|
|
367
|
+
finalSchedulingReplay?: number | undefined;
|
|
368
|
+
optimizations?: string[] | undefined;
|
|
369
|
+
stepName?: string | undefined;
|
|
370
|
+
attempt?: number | undefined;
|
|
371
|
+
};
|
|
372
|
+
specVersion?: number | undefined;
|
|
373
|
+
} | {
|
|
374
|
+
eventType: "step_retrying";
|
|
375
|
+
correlationId: string;
|
|
376
|
+
eventData: {
|
|
377
|
+
error: unknown;
|
|
378
|
+
stepName?: string | undefined;
|
|
379
|
+
retryAfter?: Date | undefined;
|
|
380
|
+
attempt?: number | undefined;
|
|
381
|
+
creatorMessageId?: string | undefined;
|
|
382
|
+
};
|
|
383
|
+
specVersion?: number | undefined;
|
|
384
|
+
} | {
|
|
385
|
+
eventType: "step_started";
|
|
386
|
+
correlationId: string;
|
|
387
|
+
specVersion?: number | undefined;
|
|
388
|
+
eventData?: {
|
|
389
|
+
stepName?: string | undefined;
|
|
390
|
+
attempt?: number | undefined;
|
|
391
|
+
workflowName?: string | undefined;
|
|
392
|
+
input?: unknown;
|
|
393
|
+
inline?: boolean | undefined;
|
|
394
|
+
ownerMessageId?: string | undefined;
|
|
395
|
+
} | undefined;
|
|
396
|
+
} | {
|
|
397
|
+
eventType: "hook_created";
|
|
398
|
+
correlationId: string;
|
|
399
|
+
eventData: {
|
|
400
|
+
token: string;
|
|
401
|
+
tokenRetentionUntil?: Date | undefined;
|
|
402
|
+
metadata?: unknown;
|
|
403
|
+
isWebhook?: boolean | undefined;
|
|
404
|
+
isSystem?: boolean | undefined;
|
|
405
|
+
force?: boolean | undefined;
|
|
406
|
+
forceClaimedFrom?: {
|
|
407
|
+
runId: string;
|
|
408
|
+
hookId: string;
|
|
409
|
+
workflowName?: string | undefined;
|
|
410
|
+
deploymentId?: string | undefined;
|
|
411
|
+
runSpecVersion?: number | undefined;
|
|
412
|
+
} | undefined;
|
|
413
|
+
};
|
|
414
|
+
specVersion?: number | undefined;
|
|
415
|
+
} | {
|
|
416
|
+
eventType: "hook_received";
|
|
417
|
+
correlationId: string;
|
|
418
|
+
eventData: {
|
|
419
|
+
payload: unknown;
|
|
420
|
+
token?: string | undefined;
|
|
421
|
+
};
|
|
422
|
+
specVersion?: number | undefined;
|
|
423
|
+
} | {
|
|
424
|
+
eventType: "hook_disposed";
|
|
425
|
+
correlationId: string;
|
|
426
|
+
specVersion?: number | undefined;
|
|
427
|
+
eventData?: {
|
|
428
|
+
token?: string | undefined;
|
|
429
|
+
forceClaimedBy?: {
|
|
430
|
+
runId: string;
|
|
431
|
+
hookId: string;
|
|
432
|
+
} | undefined;
|
|
433
|
+
} | undefined;
|
|
434
|
+
} | {
|
|
435
|
+
eventType: "hook_conflict";
|
|
436
|
+
correlationId: string;
|
|
437
|
+
eventData: {
|
|
438
|
+
token: string;
|
|
439
|
+
conflictingRunId?: string | undefined;
|
|
440
|
+
forceRefusedReason?: "victim-spec-version" | undefined;
|
|
441
|
+
};
|
|
442
|
+
specVersion?: number | undefined;
|
|
443
|
+
} | {
|
|
444
|
+
eventType: "wait_created";
|
|
445
|
+
correlationId: string;
|
|
446
|
+
eventData: {
|
|
447
|
+
resumeAt: Date;
|
|
448
|
+
creatorMessageId?: string | undefined;
|
|
449
|
+
};
|
|
450
|
+
specVersion?: number | undefined;
|
|
451
|
+
} | {
|
|
452
|
+
eventType: "wait_completed";
|
|
453
|
+
correlationId: string;
|
|
454
|
+
specVersion?: number | undefined;
|
|
455
|
+
eventData?: {
|
|
456
|
+
resumeAt?: Date | undefined;
|
|
457
|
+
} | undefined;
|
|
458
|
+
} | {
|
|
459
|
+
eventType: "noop";
|
|
460
|
+
correlationId?: string | undefined;
|
|
461
|
+
specVersion?: number | undefined;
|
|
462
|
+
eventData?: {
|
|
463
|
+
[x: string]: unknown;
|
|
464
|
+
sealed?: boolean | undefined;
|
|
465
|
+
} | undefined;
|
|
466
|
+
}) & {
|
|
467
|
+
runId: string;
|
|
468
|
+
eventId: string;
|
|
469
|
+
createdAt: Date;
|
|
470
|
+
occurredAt?: Date | undefined;
|
|
471
|
+
specVersion?: number | undefined;
|
|
472
|
+
resumeId?: string | undefined;
|
|
473
|
+
})[];
|
|
474
|
+
/** The hydrated return value of the run's `run_completed`, if any. */
|
|
475
|
+
export declare function runResult(world: AppendOnlyWorld): Promise<unknown>;
|
|
476
|
+
/** Queue calls that are step messages. */
|
|
477
|
+
export declare const stepMessagesOf: (world: AppendOnlyWorld) => import("./append-only-world.js").RecordedQueueCall[];
|
|
478
|
+
/** Queue calls that are orchestrator messages (wakes and timers). */
|
|
479
|
+
export declare const orchestratorMessagesOf: (world: AppendOnlyWorld) => import("./append-only-world.js").RecordedQueueCall[];
|
|
480
|
+
/**
|
|
481
|
+
* Asserts that a delivery stood down by acknowledging its message: it
|
|
482
|
+
* returned nothing, the World no longer holds the message, and, after
|
|
483
|
+
* `orchestratorCallsBefore` (the count of orchestrator queue calls before it
|
|
484
|
+
* ran), it sent `wakes` plain orchestrator wakes (no timer, no message-only
|
|
485
|
+
* state) besides the step messages and timers its own writes owed.
|
|
486
|
+
*/
|
|
487
|
+
export declare function expectAcknowledged(world: AppendOnlyWorld, result: unknown, message: {
|
|
488
|
+
messageId: string;
|
|
489
|
+
}, orchestratorCallsBefore?: number, wakes?: number): void;
|
|
490
|
+
/**
|
|
491
|
+
* Asserts that a delivery the in-band fence refused stood down the way every
|
|
492
|
+
* refused delivery does: it asked for a counted redelivery of its own
|
|
493
|
+
* message (`{ timeoutSeconds }`), the World holds that message with the next
|
|
494
|
+
* delivery count, and, after `orchestratorCallsBefore` (the count of
|
|
495
|
+
* orchestrator queue calls before it ran), it sent no plain orchestrator
|
|
496
|
+
* wake. Returns the held redelivery.
|
|
497
|
+
*/
|
|
498
|
+
export declare function expectRefusalRedelivery(world: AppendOnlyWorld, result: unknown, message: {
|
|
499
|
+
messageId: string;
|
|
500
|
+
deliveryCount: number;
|
|
501
|
+
}, orchestratorCallsBefore?: number): HeldMessage;
|
|
502
|
+
//# sourceMappingURL=orchestrator-harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator-harness.d.ts","sourceRoot":"","sources":["../../src/test-support/orchestrator-harness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,iBAAiB,CAAC;AAQ1D,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE3E,6DAA6D;AAC7D,eAAO,MAAM,kBAAkB,4BAA4B,CAAC;AAE5D,kEAAkE;AAClE,wBAAgB,gBAAgB,CAAC,IAAI,SAAa,GAAG,MAAM,CAE1D;AAED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