@workflow/core 5.0.0-beta.9 → 5.0.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 +41 -0
- package/dist/attribute-changes.d.ts +4 -5
- package/dist/attribute-changes.d.ts.map +1 -1
- package/dist/attribute-changes.js +12 -4
- package/dist/capabilities.d.ts +35 -2
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +74 -5
- package/dist/capture-stack.d.ts +1 -1
- package/dist/capture-stack.js +2 -2
- package/dist/class-serialization.d.ts +32 -0
- package/dist/class-serialization.d.ts.map +1 -1
- package/dist/class-serialization.js +37 -1
- package/dist/classify-error.d.ts +15 -0
- package/dist/classify-error.d.ts.map +1 -1
- package/dist/classify-error.js +72 -4
- package/dist/context-violation-error.d.ts +5 -5
- package/dist/context-violation-error.d.ts.map +1 -1
- package/dist/context-violation-error.js +8 -6
- package/dist/create-hook.d.ts +109 -7
- package/dist/create-hook.d.ts.map +1 -1
- package/dist/create-hook.js +1 -1
- package/dist/define-hook.js +2 -2
- package/dist/describe-error.d.ts +7 -7
- package/dist/describe-error.d.ts.map +1 -1
- package/dist/describe-error.js +46 -7
- package/dist/encryption.d.ts +32 -4
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +85 -10
- package/dist/events-consumer.d.ts +300 -0
- package/dist/events-consumer.d.ts.map +1 -1
- package/dist/events-consumer.js +672 -42
- package/dist/flushable-stream.d.ts +97 -1
- package/dist/flushable-stream.d.ts.map +1 -1
- package/dist/flushable-stream.js +286 -10
- package/dist/global.d.ts +38 -2
- package/dist/global.d.ts.map +1 -1
- package/dist/global.js +21 -6
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/log-format.d.ts +6 -2
- package/dist/log-format.d.ts.map +1 -1
- package/dist/log-format.js +60 -15
- package/dist/logger.d.ts +1 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +10 -6
- package/dist/private.d.ts +258 -9
- package/dist/private.d.ts.map +1 -1
- package/dist/private.js +640 -7
- package/dist/replay-divergence.d.ts +25 -0
- package/dist/replay-divergence.d.ts.map +1 -0
- package/dist/replay-divergence.js +61 -0
- package/dist/replay-payload-cache.d.ts +64 -0
- package/dist/replay-payload-cache.d.ts.map +1 -0
- package/dist/replay-payload-cache.js +158 -0
- package/dist/runtime/compute-instance.d.ts +13 -0
- package/dist/runtime/compute-instance.d.ts.map +1 -0
- package/dist/runtime/compute-instance.js +14 -0
- package/dist/runtime/constants.d.ts +298 -5
- package/dist/runtime/constants.d.ts.map +1 -1
- package/dist/runtime/constants.js +500 -17
- package/dist/runtime/count-step-started-events.d.ts +52 -0
- package/dist/runtime/count-step-started-events.d.ts.map +1 -0
- package/dist/runtime/count-step-started-events.js +72 -0
- package/dist/runtime/deployment-guard.d.ts +100 -0
- package/dist/runtime/deployment-guard.d.ts.map +1 -0
- package/dist/runtime/deployment-guard.js +159 -0
- package/dist/runtime/dynamic-workflow.d.ts +148 -0
- package/dist/runtime/dynamic-workflow.d.ts.map +1 -0
- package/dist/runtime/dynamic-workflow.js +290 -0
- package/dist/runtime/get-port-lazy.d.ts +15 -0
- package/dist/runtime/get-port-lazy.d.ts.map +1 -1
- package/dist/runtime/get-port-lazy.js +75 -6
- package/dist/runtime/get-world-lazy.d.ts +5 -14
- package/dist/runtime/get-world-lazy.d.ts.map +1 -1
- package/dist/runtime/get-world-lazy.js +19 -29
- package/dist/runtime/helpers.d.ts +445 -29
- package/dist/runtime/helpers.d.ts.map +1 -1
- package/dist/runtime/helpers.js +717 -62
- package/dist/runtime/hook-wake.d.ts +122 -0
- package/dist/runtime/hook-wake.d.ts.map +1 -0
- package/dist/runtime/hook-wake.js +225 -0
- package/dist/runtime/invocations.d.ts +35 -0
- package/dist/runtime/invocations.d.ts.map +1 -0
- package/dist/runtime/invocations.js +172 -0
- package/dist/runtime/lifecycle-hooks.d.ts +93 -0
- package/dist/runtime/lifecycle-hooks.d.ts.map +1 -0
- package/dist/runtime/lifecycle-hooks.js +178 -0
- package/dist/runtime/open-hook-wait-state.d.ts +55 -0
- package/dist/runtime/open-hook-wait-state.d.ts.map +1 -0
- package/dist/runtime/open-hook-wait-state.js +93 -0
- package/dist/runtime/quickjs-assets.generated.d.ts +14 -0
- package/dist/runtime/quickjs-assets.generated.d.ts.map +1 -0
- package/dist/runtime/quickjs-assets.generated.js +30 -0
- package/dist/runtime/quickjs-entrypoint.d.ts +158 -0
- package/dist/runtime/quickjs-entrypoint.d.ts.map +1 -0
- package/dist/runtime/quickjs-entrypoint.js +1939 -0
- package/dist/runtime/quickjs-log-view.d.ts +129 -0
- package/dist/runtime/quickjs-log-view.d.ts.map +1 -0
- package/dist/runtime/quickjs-log-view.js +229 -0
- package/dist/runtime/quickjs-runtime.d.ts +247 -0
- package/dist/runtime/quickjs-runtime.d.ts.map +1 -0
- package/dist/runtime/quickjs-runtime.js +2599 -0
- package/dist/runtime/quickjs-serde.d.ts +107 -0
- package/dist/runtime/quickjs-serde.d.ts.map +1 -0
- package/dist/runtime/quickjs-serde.js +2234 -0
- package/dist/runtime/replay-budget.d.ts +17 -18
- package/dist/runtime/replay-budget.d.ts.map +1 -1
- package/dist/runtime/replay-budget.js +33 -81
- package/dist/runtime/replay-recovery-reporter.d.ts +36 -0
- package/dist/runtime/replay-recovery-reporter.d.ts.map +1 -0
- package/dist/runtime/replay-recovery-reporter.js +64 -0
- package/dist/runtime/resume-hook.d.ts +93 -8
- package/dist/runtime/resume-hook.d.ts.map +1 -1
- package/dist/runtime/resume-hook.js +709 -110
- package/dist/runtime/resume-latency.d.ts +150 -0
- package/dist/runtime/resume-latency.d.ts.map +1 -0
- package/dist/runtime/resume-latency.js +155 -0
- package/dist/runtime/run-id-time.d.ts +19 -0
- package/dist/runtime/run-id-time.d.ts.map +1 -0
- package/dist/runtime/run-id-time.js +42 -0
- package/dist/runtime/run-spec-version.d.ts +16 -0
- package/dist/runtime/run-spec-version.d.ts.map +1 -0
- package/dist/runtime/run-spec-version.js +19 -0
- package/dist/runtime/run.d.ts +72 -7
- package/dist/runtime/run.d.ts.map +1 -1
- package/dist/runtime/run.js +295 -58
- package/dist/runtime/runs.d.ts +54 -3
- package/dist/runtime/runs.d.ts.map +1 -1
- package/dist/runtime/runs.js +148 -21
- package/dist/runtime/start.d.ts +164 -3
- package/dist/runtime/start.d.ts.map +1 -1
- package/dist/runtime/start.js +700 -78
- package/dist/runtime/step-executor.d.ts +186 -5
- package/dist/runtime/step-executor.d.ts.map +1 -1
- package/dist/runtime/step-executor.js +756 -123
- package/dist/runtime/step-latency.d.ts +221 -0
- package/dist/runtime/step-latency.d.ts.map +1 -0
- package/dist/runtime/step-latency.js +215 -0
- package/dist/runtime/step-ownership.d.ts +72 -0
- package/dist/runtime/step-ownership.d.ts.map +1 -0
- package/dist/runtime/step-ownership.js +114 -0
- package/dist/runtime/step-single-flight.d.ts +12 -0
- package/dist/runtime/step-single-flight.d.ts.map +1 -0
- package/dist/runtime/step-single-flight.js +71 -0
- package/dist/runtime/suspension-handler.d.ts +279 -10
- package/dist/runtime/suspension-handler.d.ts.map +1 -1
- package/dist/runtime/suspension-handler.js +1442 -169
- package/dist/runtime/unserializable-step.d.ts +34 -0
- package/dist/runtime/unserializable-step.d.ts.map +1 -0
- package/dist/runtime/unserializable-step.js +52 -0
- package/dist/runtime/vm-mode.d.ts +44 -0
- package/dist/runtime/vm-mode.d.ts.map +1 -0
- package/dist/runtime/vm-mode.js +62 -0
- package/dist/runtime/vm-serde-bundle.generated.d.ts +14 -0
- package/dist/runtime/vm-serde-bundle.generated.d.ts.map +1 -0
- package/dist/runtime/vm-serde-bundle.generated.js +16 -0
- package/dist/runtime/wait-continuation.d.ts +106 -0
- package/dist/runtime/wait-continuation.d.ts.map +1 -0
- package/dist/runtime/wait-continuation.js +136 -0
- package/dist/runtime/wait-until.d.ts +18 -0
- package/dist/runtime/wait-until.d.ts.map +1 -0
- package/dist/runtime/wait-until.js +42 -0
- package/dist/runtime/world-compatibility.d.ts +32 -0
- package/dist/runtime/world-compatibility.d.ts.map +1 -0
- package/dist/runtime/world-compatibility.js +44 -0
- package/dist/runtime/world-init.d.ts +17 -42
- package/dist/runtime/world-init.d.ts.map +1 -1
- package/dist/runtime/world-init.js +18 -43
- package/dist/runtime/world.d.ts +14 -2
- package/dist/runtime/world.d.ts.map +1 -1
- package/dist/runtime/world.js +75 -19
- package/dist/runtime.d.ts +11 -7
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +4111 -446
- package/dist/schemas.d.ts +1 -1
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +1 -1
- package/dist/sealed-box.d.ts +167 -0
- package/dist/sealed-box.d.ts.map +1 -0
- package/dist/sealed-box.js +571 -0
- package/dist/serialization/client.d.ts +3 -3
- package/dist/serialization/client.d.ts.map +1 -1
- package/dist/serialization/client.js +8 -4
- package/dist/serialization/codec-devalue-vm.d.ts +16 -0
- package/dist/serialization/codec-devalue-vm.d.ts.map +1 -0
- package/dist/serialization/codec-devalue-vm.js +148 -0
- package/dist/serialization/codec-devalue.d.ts +1 -1
- package/dist/serialization/codec-devalue.d.ts.map +1 -1
- package/dist/serialization/codec-devalue.js +24 -6
- package/dist/serialization/codec.d.ts +37 -2
- package/dist/serialization/codec.d.ts.map +1 -1
- package/dist/serialization/codec.js +2 -2
- package/dist/serialization/compression.d.ts +105 -0
- package/dist/serialization/compression.d.ts.map +1 -0
- package/dist/serialization/compression.js +261 -0
- package/dist/serialization/encryption.d.ts +119 -17
- package/dist/serialization/encryption.d.ts.map +1 -1
- package/dist/serialization/encryption.js +152 -17
- package/dist/serialization/errors.d.ts +13 -0
- package/dist/serialization/errors.d.ts.map +1 -1
- package/dist/serialization/errors.js +20 -2
- package/dist/serialization/format.d.ts +6 -6
- package/dist/serialization/format.js +7 -7
- package/dist/serialization/hardened.d.ts +156 -0
- package/dist/serialization/hardened.d.ts.map +1 -0
- package/dist/serialization/hardened.js +538 -0
- package/dist/serialization/index.d.ts +10 -8
- package/dist/serialization/index.d.ts.map +1 -1
- package/dist/serialization/index.js +10 -8
- package/dist/serialization/reducers/class-vm.d.ts +20 -0
- package/dist/serialization/reducers/class-vm.d.ts.map +1 -0
- package/dist/serialization/reducers/class-vm.js +77 -0
- package/dist/serialization/reducers/class.d.ts.map +1 -1
- package/dist/serialization/reducers/class.js +11 -6
- package/dist/serialization/reducers/common-vm.d.ts +15 -0
- package/dist/serialization/reducers/common-vm.d.ts.map +1 -0
- package/dist/serialization/reducers/common-vm.js +661 -0
- package/dist/serialization/reducers/common.d.ts +1 -1
- package/dist/serialization/reducers/common.d.ts.map +1 -1
- package/dist/serialization/reducers/common.js +227 -66
- package/dist/serialization/reducers/step-function-vm.d.ts +44 -0
- package/dist/serialization/reducers/step-function-vm.d.ts.map +1 -0
- package/dist/serialization/reducers/step-function-vm.js +97 -0
- package/dist/serialization/reducers/step-function.d.ts.map +1 -1
- package/dist/serialization/reducers/step-function.js +25 -9
- package/dist/serialization/step.d.ts +4 -4
- package/dist/serialization/step.d.ts.map +1 -1
- package/dist/serialization/step.js +9 -5
- package/dist/serialization/types.d.ts +75 -1
- package/dist/serialization/types.d.ts.map +1 -1
- package/dist/serialization/types.js +15 -1
- package/dist/serialization/workflow-vm.d.ts +29 -0
- package/dist/serialization/workflow-vm.d.ts.map +1 -0
- package/dist/serialization/workflow-vm.js +74 -0
- package/dist/serialization-format.d.ts +64 -8
- package/dist/serialization-format.d.ts.map +1 -1
- package/dist/serialization-format.js +239 -73
- package/dist/serialization.d.ts +319 -34
- package/dist/serialization.d.ts.map +1 -1
- package/dist/serialization.js +1961 -321
- package/dist/set-attributes.d.ts +7 -7
- package/dist/set-attributes.d.ts.map +1 -1
- package/dist/set-attributes.js +42 -21
- package/dist/source-map.d.ts +25 -0
- package/dist/source-map.d.ts.map +1 -1
- package/dist/source-map.js +113 -7
- package/dist/step/context-storage.d.ts +50 -3
- package/dist/step/context-storage.d.ts.map +1 -1
- package/dist/step/context-storage.js +7 -5
- package/dist/step/writable-stream.d.ts +3 -3
- package/dist/step/writable-stream.d.ts.map +1 -1
- package/dist/step/writable-stream.js +53 -19
- package/dist/step.d.ts.map +1 -1
- package/dist/step.js +142 -28
- package/dist/symbols.d.ts +35 -1
- package/dist/symbols.d.ts.map +1 -1
- package/dist/symbols.js +36 -2
- package/dist/telemetry/semantic-conventions.d.ts +481 -2
- package/dist/telemetry/semantic-conventions.d.ts.map +1 -1
- package/dist/telemetry/semantic-conventions.js +349 -3
- package/dist/telemetry.d.ts +91 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +244 -17
- package/dist/test-support/orchestrator-context.d.ts +25 -0
- package/dist/test-support/orchestrator-context.d.ts.map +1 -0
- package/dist/test-support/orchestrator-context.js +107 -0
- package/dist/types.d.ts +23 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +76 -1
- package/dist/util.d.ts +0 -5
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +1 -15
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +2 -2
- package/dist/vm/index.d.ts.map +1 -1
- package/dist/vm/index.js +84 -14
- package/dist/vm/script-cache.d.ts +26 -0
- package/dist/vm/script-cache.d.ts.map +1 -0
- package/dist/vm/script-cache.js +131 -0
- package/dist/vm/uint8array-base64.js +1 -1
- package/dist/workflow/abort-controller.d.ts +2 -2
- package/dist/workflow/abort-controller.d.ts.map +1 -1
- package/dist/workflow/abort-controller.js +75 -21
- package/dist/workflow/attribute-dispatcher.d.ts +6 -0
- package/dist/workflow/attribute-dispatcher.d.ts.map +1 -0
- package/dist/workflow/attribute-dispatcher.js +65 -0
- package/dist/workflow/create-hook.d.ts.map +1 -1
- package/dist/workflow/create-hook.js +24 -3
- package/dist/workflow/get-workflow-metadata.js +2 -2
- package/dist/workflow/hook.d.ts.map +1 -1
- package/dist/workflow/hook.js +403 -53
- package/dist/workflow/index.d.ts +1 -1
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +2 -2
- package/dist/workflow/set-attributes.d.ts +19 -21
- package/dist/workflow/set-attributes.d.ts.map +1 -1
- package/dist/workflow/set-attributes.js +23 -25
- package/dist/workflow/sleep.d.ts.map +1 -1
- package/dist/workflow/sleep.js +42 -13
- package/dist/workflow/world-init-stub.d.ts +3 -3
- package/dist/workflow/world-init-stub.js +4 -4
- package/dist/workflow.d.ts +89 -3
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +920 -568
- package/docs/api-reference/create-hook.mdx +166 -10
- package/docs/api-reference/create-webhook.mdx +16 -15
- package/docs/api-reference/define-hook.mdx +37 -33
- package/docs/api-reference/fatal-error.mdx +30 -8
- package/docs/api-reference/fetch.mdx +14 -10
- package/docs/api-reference/get-step-metadata.mdx +2 -2
- package/docs/api-reference/get-workflow-metadata.mdx +3 -3
- package/docs/api-reference/get-writable.mdx +7 -7
- package/docs/api-reference/index.mdx +3 -3
- package/docs/api-reference/retryable-error.mdx +1 -1
- package/docs/api-reference/set-attributes.mdx +63 -0
- package/docs/api-reference/sleep.mdx +4 -4
- package/docs/foundations/cancellation.mdx +31 -32
- package/docs/foundations/errors-and-retries.mdx +54 -11
- package/docs/foundations/hooks.mdx +98 -35
- package/docs/foundations/idempotency.mdx +267 -12
- package/docs/foundations/index.mdx +1 -26
- package/docs/foundations/serialization.mdx +22 -22
- package/docs/foundations/starting-workflows.mdx +104 -30
- package/docs/foundations/streaming.mdx +108 -60
- package/docs/foundations/versioning.mdx +4 -4
- package/docs/foundations/workflows-and-steps.mdx +9 -9
- package/docs/how-it-works/cancellation.mdx +63 -63
- package/docs/how-it-works/code-transform.mdx +82 -66
- package/docs/how-it-works/encryption.mdx +30 -26
- package/docs/how-it-works/event-sourcing.mdx +132 -35
- package/docs/how-it-works/framework-integrations.mdx +96 -337
- package/docs/how-it-works/understanding-directives.mdx +22 -22
- package/package.json +29 -15
- package/dist/runtime/step-handler.d.ts +0 -2
- package/dist/runtime/step-handler.d.ts.map +0 -1
- package/dist/runtime/step-handler.js +0 -779
- package/docs/api-reference/experimental-set-attributes.mdx +0 -63
package/dist/runtime/start.d.ts
CHANGED
|
@@ -1,5 +1,67 @@
|
|
|
1
|
-
import type { World } from '@workflow/world';
|
|
1
|
+
import type { RunRetention, World } from '@workflow/world';
|
|
2
|
+
import { type DynamicStartOptions } from './dynamic-workflow.js';
|
|
3
|
+
import { type HealthCheckResult } from './helpers.js';
|
|
2
4
|
import { Run } from './run.js';
|
|
5
|
+
/**
|
|
6
|
+
* Where a run's stamped spec version came from, recorded on the `start()`
|
|
7
|
+
* span so "why is this run on spec N?" is answerable without reading code.
|
|
8
|
+
*/
|
|
9
|
+
export type SpecVersionSource = 'same-deployment' | 'explicit' | 'probe' | 'probe-unversioned' | 'probe-malformed' | 'probe-miss' | 'no-probe-channel';
|
|
10
|
+
/**
|
|
11
|
+
* The spec version to stamp on a run that another deployment will execute.
|
|
12
|
+
*
|
|
13
|
+
* A run's spec version is a promise about the runtime that reads and writes
|
|
14
|
+
* its event log, and for a cross-deployment start that is the target, not
|
|
15
|
+
* this caller. The capability probe runs inside the target and reports the
|
|
16
|
+
* version the target itself mints (which already honours the target's own
|
|
17
|
+
* `WORKFLOW_SEALED_LOG` switch), so that is the answer, capped at what this
|
|
18
|
+
* caller's World mints: the caller writes `run_created` and the arguments,
|
|
19
|
+
* and must never stamp a version it could not have written itself.
|
|
20
|
+
*
|
|
21
|
+
* When the target does not report a usable version:
|
|
22
|
+
*
|
|
23
|
+
* - a plain-text reply predates the versioned JSON health response, which
|
|
24
|
+
* arrived with spec 3 (CBOR queue transport), so it is stamped as
|
|
25
|
+
* event-sourced: such a target cannot read a CBOR `runInput`.
|
|
26
|
+
* - a JSON reply without a usable `specVersion` still proves the target is
|
|
27
|
+
* at spec 3 or later, so it is stamped with CBOR queue transport rather
|
|
28
|
+
* than losing it (and resilient start with it) to a malformed field.
|
|
29
|
+
* - a probe that times out, or no probe channel at all, is a guess.
|
|
30
|
+
* `SPEC_VERSION_SUPPORTS_SLOT_IDENTITY` is the lowest version a v5 runtime
|
|
31
|
+
* can execute on the Vercel World (it requires slot event ids), so it is
|
|
32
|
+
* the only floor that keeps same-major targets working. It is NOT safe for
|
|
33
|
+
* an older-major target such as `stable` (spec 3): that target rejects the
|
|
34
|
+
* run when it picks it up. No single floor serves both, which is why the
|
|
35
|
+
* probe budget is generous; the miss is logged and recorded on the span.
|
|
36
|
+
*
|
|
37
|
+
* Once executors attest their version on `run_started` and the backend
|
|
38
|
+
* raises a run to it (vercel/workflow#4366, vercel/workflow-server#1044), a
|
|
39
|
+
* v5 target heals an under-stamped run, and this miss floor may drop, but
|
|
40
|
+
* only once the raise is enabled on the whole server fleet AND every v5
|
|
41
|
+
* target a caller can reach attests its version (a published beta that does
|
|
42
|
+
* not would be stamped below slot identity and fail). Even then a floor
|
|
43
|
+
* below `SPEC_VERSION_SUPPORTS_ATTRIBUTES` would refuse `attributes` on every
|
|
44
|
+
* miss. Tracked in vercel/workflow#4401.
|
|
45
|
+
*
|
|
46
|
+
* Exported for tests.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveCrossDeploymentSpecVersion(probe: Pick<HealthCheckResult, 'healthy' | 'specVersion' | 'format'> | undefined, callerSpecVersion: number): {
|
|
49
|
+
specVersion: number;
|
|
50
|
+
source: SpecVersionSource;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Reset the `deploymentId: 'latest'` no-op warn-once guard. Test-only,
|
|
54
|
+
* exported so unit tests can exercise the warn path across `start()` calls.
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
export declare function _resetLatestNoOpWarnForTests(): void;
|
|
59
|
+
/**
|
|
60
|
+
* Reset the cross-deployment probe-miss warn-once guard. Test-only.
|
|
61
|
+
*
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export declare function _resetProbeMissWarnForTests(): void;
|
|
3
65
|
export interface StartOptionsBase {
|
|
4
66
|
/**
|
|
5
67
|
* The world to use for the workflow run creation,
|
|
@@ -7,9 +69,102 @@ export interface StartOptionsBase {
|
|
|
7
69
|
*/
|
|
8
70
|
world?: World;
|
|
9
71
|
/**
|
|
10
|
-
* The spec version to use for the workflow run. Defaults to the
|
|
72
|
+
* The spec version to use for the workflow run. Defaults to the spec
|
|
73
|
+
* version of the deployment that will execute the run: the configured
|
|
74
|
+
* World's for a same-deployment start, and for a cross-deployment start
|
|
75
|
+
* (`deploymentId` naming another deployment) the version the target
|
|
76
|
+
* reports on its capability probe, capped at the configured World's.
|
|
11
77
|
*/
|
|
12
78
|
specVersion?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Optional region identifier for the new run. Currently consumed only
|
|
81
|
+
* by `@workflow/world-vercel`, which embeds the region into the tagged
|
|
82
|
+
* run ID and routes the initial workflow message to the matching
|
|
83
|
+
* regional queue. When omitted, the world falls back to its own
|
|
84
|
+
* default (for `world-vercel`: the `VERCEL_REGION` environment
|
|
85
|
+
* variable, then the server-side default region `iad1`; a concrete,
|
|
86
|
+
* routable region is always chosen).
|
|
87
|
+
*
|
|
88
|
+
* Worlds without a regional dimension ignore this field.
|
|
89
|
+
*/
|
|
90
|
+
region?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Plaintext attributes to seed on the run as it is created.
|
|
93
|
+
*
|
|
94
|
+
* Available for native-attributes runs (spec version 4 and later).
|
|
95
|
+
*/
|
|
96
|
+
attributes?: Record<string, string>;
|
|
97
|
+
/**
|
|
98
|
+
* Permit reserved `$`-prefixed keys in `attributes`. The `$` namespace
|
|
99
|
+
* is reserved for framework/library code built on top of the workflow
|
|
100
|
+
* SDK (telemetry, agent metadata, platform-emitted tags, etc.); user
|
|
101
|
+
* code MUST NOT write keys in it, and validation rejects them so
|
|
102
|
+
* accidental collisions with tooling-owned keys can't slip through.
|
|
103
|
+
*
|
|
104
|
+
* Only flip this to `true` if your caller is itself a framework or
|
|
105
|
+
* library that owns a `$`-prefixed sub-namespace and knows the
|
|
106
|
+
* conventions of any other tools writing into it. Same semantics as
|
|
107
|
+
* the `setAttributes` option of the same name.
|
|
108
|
+
*/
|
|
109
|
+
allowReservedAttributes?: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Set a preference for data retention after run completion.
|
|
112
|
+
*
|
|
113
|
+
* **Experimental.** Both the unit and the set of accepted values are expected
|
|
114
|
+
* to change.
|
|
115
|
+
*
|
|
116
|
+
* Worlds control the retention of user data (event payloads and stream
|
|
117
|
+
* chunks), the event log, and any analytics data. Options are:
|
|
118
|
+
* - `'default'`: same as omission, the World will decide. On Vercel, this
|
|
119
|
+
* is based on your team's plan.
|
|
120
|
+
* - `0`: data is deleted as soon as your run completes or fails. On
|
|
121
|
+
* Vercel, user data is deleted, but metadata may persist for your plan's
|
|
122
|
+
* default retention period.
|
|
123
|
+
*
|
|
124
|
+
* The value is a duration, with zero being the only valid option currently.
|
|
125
|
+
*
|
|
126
|
+
* **Known limitation at `0`.** The purge races your own read of the run's
|
|
127
|
+
* result and generally wins, so `await run.returnValue` on a
|
|
128
|
+
* `experimental_retention: 0` run usually throws `RunExpiredError` rather
|
|
129
|
+
* than resolving. If you need the result, return it through a channel you
|
|
130
|
+
* control, e.g. a step that writes it to external storage.
|
|
131
|
+
*
|
|
132
|
+
* Recorded on the run as the reserved `$retention` attribute, so it
|
|
133
|
+
* requires a World implementing spec version 4 or later. `'default'` is
|
|
134
|
+
* not written at all, keeping it exactly equivalent to omitting the
|
|
135
|
+
* option. Retention is enforced by the World: the first-party Worlds
|
|
136
|
+
* (Vercel, Local, Postgres) implement it, and a World that does not
|
|
137
|
+
* recognize the value keeps the data.
|
|
138
|
+
*/
|
|
139
|
+
experimental_retention?: RunRetention;
|
|
140
|
+
/**
|
|
141
|
+
* The ID of an existing run this run is being replayed from, if any.
|
|
142
|
+
*
|
|
143
|
+
* Recorded on the new run's `executionContext` as `replayedFromRunId` so
|
|
144
|
+
* tooling (e.g. the dashboard runs list) can show that a run originated as
|
|
145
|
+
* a replay and link back to its source. Set automatically by
|
|
146
|
+
* {@link recreateRunFromExisting}; there's usually no reason to pass it
|
|
147
|
+
* directly.
|
|
148
|
+
*
|
|
149
|
+
* Must be a run ID: `wrun_` followed by a 26-char ULID. It's a foreign key
|
|
150
|
+
* to the source run, so `start()` validates the exact shape and rejects
|
|
151
|
+
* anything else rather than persist a lineage link that points at garbage.
|
|
152
|
+
*/
|
|
153
|
+
replayedFromRunId?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Queue namespace of the target deployment. Scopes the workflow queue
|
|
156
|
+
* topic to `__{namespace}_wkf_workflow_*` (e.g. `'eve'`) instead of the
|
|
157
|
+
* default `__wkf_workflow_*`, and is also used for the cross-deployment
|
|
158
|
+
* capability probe. Falls back to `WORKFLOW_QUEUE_NAMESPACE` in the
|
|
159
|
+
* calling process.
|
|
160
|
+
*
|
|
161
|
+
* Within a deployment the env fallback is correct. Cross-context callers
|
|
162
|
+
* (e.g. the observability dashboard replaying a run) must pass the
|
|
163
|
+
* TARGET deployment's namespace explicitly: the env fallback resolves in
|
|
164
|
+
* the caller's process, and a run enqueued to a topic the target has no
|
|
165
|
+
* consumer for is never picked up.
|
|
166
|
+
*/
|
|
167
|
+
namespace?: string;
|
|
13
168
|
}
|
|
14
169
|
export interface StartOptionsWithDeploymentId extends StartOptionsBase {
|
|
15
170
|
/**
|
|
@@ -20,7 +175,10 @@ export interface StartOptionsWithDeploymentId extends StartOptionsBase {
|
|
|
20
175
|
*
|
|
21
176
|
* Set to `'latest'` to automatically resolve the most recent deployment
|
|
22
177
|
* for the current environment (same production target or git branch).
|
|
23
|
-
* This is
|
|
178
|
+
* This is only meaningful in worlds with atomic, immutable deployments
|
|
179
|
+
* (currently Vercel). In other worlds (local dev, Postgres) there is no
|
|
180
|
+
* notion of multiple deployments to resolve between, so `'latest'` has no
|
|
181
|
+
* effect: a warning is logged and the run targets the current deployment.
|
|
24
182
|
*
|
|
25
183
|
* **Note:** When `deploymentId` is provided, the argument and return types become `unknown`
|
|
26
184
|
* since there is no guarantee the types will be consistent across deployments.
|
|
@@ -34,6 +192,7 @@ export interface StartOptionsWithoutDeploymentId extends StartOptionsBase {
|
|
|
34
192
|
* Options for starting a workflow run.
|
|
35
193
|
*/
|
|
36
194
|
export type StartOptions = StartOptionsWithDeploymentId | StartOptionsWithoutDeploymentId;
|
|
195
|
+
export type { DynamicStartOptions, DynamicWorkflowOptions, DynamicWorkflowStepReference, } from './dynamic-workflow.js';
|
|
37
196
|
/**
|
|
38
197
|
* Represents an imported workflow function.
|
|
39
198
|
*/
|
|
@@ -56,4 +215,6 @@ export declare function start<TArgs extends unknown[], TResult>(workflow: Workfl
|
|
|
56
215
|
export declare function start<TResult>(workflow: WorkflowFunction<[], TResult> | WorkflowMetadata, options: StartOptionsWithDeploymentId): Promise<Run<unknown>>;
|
|
57
216
|
export declare function start<TArgs extends unknown[], TResult>(workflow: WorkflowFunction<TArgs, TResult> | WorkflowMetadata, args: TArgs, options?: StartOptionsWithoutDeploymentId): Promise<Run<TResult>>;
|
|
58
217
|
export declare function start<TResult>(workflow: WorkflowFunction<[], TResult> | WorkflowMetadata, options?: StartOptionsWithoutDeploymentId): Promise<Run<TResult>>;
|
|
218
|
+
export declare function start(source: string, args: unknown[], options: DynamicStartOptions): Promise<Run<unknown>>;
|
|
219
|
+
export declare function start(source: string, options: DynamicStartOptions): Promise<Run<unknown>>;
|
|
59
220
|
//# sourceMappingURL=start.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/runtime/start.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/runtime/start.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAEZ,KAAK,EACN,MAAM,iBAAiB,CAAC;AAyCzB,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAEL,KAAK,iBAA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