@adonis-agora/durable 0.1.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/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/assets/dashboard.html +446 -0
- package/dist/commands/main.d.ts +15 -0
- package/dist/commands/main.d.ts.map +1 -0
- package/dist/commands/main.js +15 -0
- package/dist/commands/main.js.map +1 -0
- package/dist/commands/retry.d.ts +16 -0
- package/dist/commands/retry.d.ts.map +1 -0
- package/dist/commands/retry.js +34 -0
- package/dist/commands/retry.js.map +1 -0
- package/dist/commands/runs.d.ts +17 -0
- package/dist/commands/runs.d.ts.map +1 -0
- package/dist/commands/runs.js +40 -0
- package/dist/commands/runs.js.map +1 -0
- package/dist/commands/work.d.ts +18 -0
- package/dist/commands/work.d.ts.map +1 -0
- package/dist/commands/work.js +58 -0
- package/dist/commands/work.js.map +1 -0
- package/dist/configure.d.ts +15 -0
- package/dist/configure.d.ts.map +1 -0
- package/dist/configure.js +26 -0
- package/dist/configure.js.map +1 -0
- package/dist/providers/dashboard_provider.d.ts +27 -0
- package/dist/providers/dashboard_provider.d.ts.map +1 -0
- package/dist/providers/dashboard_provider.js +94 -0
- package/dist/providers/dashboard_provider.js.map +1 -0
- package/dist/providers/durable_provider.d.ts +36 -0
- package/dist/providers/durable_provider.d.ts.map +1 -0
- package/dist/providers/durable_provider.js +113 -0
- package/dist/providers/durable_provider.js.map +1 -0
- package/dist/src/admission-redis/index.d.ts +2 -0
- package/dist/src/admission-redis/index.d.ts.map +1 -0
- package/dist/src/admission-redis/index.js +2 -0
- package/dist/src/admission-redis/index.js.map +1 -0
- package/dist/src/admission-redis/redis-admission-backend.d.ts +83 -0
- package/dist/src/admission-redis/redis-admission-backend.d.ts.map +1 -0
- package/dist/src/admission-redis/redis-admission-backend.js +200 -0
- package/dist/src/admission-redis/redis-admission-backend.js.map +1 -0
- package/dist/src/admission.d.ts +49 -0
- package/dist/src/admission.d.ts.map +1 -0
- package/dist/src/admission.js +30 -0
- package/dist/src/admission.js.map +1 -0
- package/dist/src/backoff.d.ts +5 -0
- package/dist/src/backoff.d.ts.map +1 -0
- package/dist/src/backoff.js +11 -0
- package/dist/src/backoff.js.map +1 -0
- package/dist/src/checkpoints.d.ts +42 -0
- package/dist/src/checkpoints.d.ts.map +1 -0
- package/dist/src/checkpoints.js +57 -0
- package/dist/src/checkpoints.js.map +1 -0
- package/dist/src/codec-state-store.d.ts +60 -0
- package/dist/src/codec-state-store.d.ts.map +1 -0
- package/dist/src/codec-state-store.js +129 -0
- package/dist/src/codec-state-store.js.map +1 -0
- package/dist/src/commands/index.d.ts +3 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +3 -0
- package/dist/src/commands/index.js.map +1 -0
- package/dist/src/commands/runs.d.ts +24 -0
- package/dist/src/commands/runs.d.ts.map +1 -0
- package/dist/src/commands/runs.js +39 -0
- package/dist/src/commands/runs.js.map +1 -0
- package/dist/src/commands/worker.d.ts +61 -0
- package/dist/src/commands/worker.d.ts.map +1 -0
- package/dist/src/commands/worker.js +74 -0
- package/dist/src/commands/worker.js.map +1 -0
- package/dist/src/completion.d.ts +15 -0
- package/dist/src/completion.d.ts.map +1 -0
- package/dist/src/completion.js +10 -0
- package/dist/src/completion.js.map +1 -0
- package/dist/src/dashboard/define_config.d.ts +48 -0
- package/dist/src/dashboard/define_config.d.ts.map +1 -0
- package/dist/src/dashboard/define_config.js +57 -0
- package/dist/src/dashboard/define_config.js.map +1 -0
- package/dist/src/dashboard/handlers.d.ts +47 -0
- package/dist/src/dashboard/handlers.d.ts.map +1 -0
- package/dist/src/dashboard/handlers.js +163 -0
- package/dist/src/dashboard/handlers.js.map +1 -0
- package/dist/src/dashboard/html.d.ts +7 -0
- package/dist/src/dashboard/html.d.ts.map +1 -0
- package/dist/src/dashboard/html.js +24 -0
- package/dist/src/dashboard/html.js.map +1 -0
- package/dist/src/dashboard/index.d.ts +8 -0
- package/dist/src/dashboard/index.d.ts.map +1 -0
- package/dist/src/dashboard/index.js +6 -0
- package/dist/src/dashboard/index.js.map +1 -0
- package/dist/src/define_config.d.ts +72 -0
- package/dist/src/define_config.d.ts.map +1 -0
- package/dist/src/define_config.js +8 -0
- package/dist/src/define_config.js.map +1 -0
- package/dist/src/diagnostics-bridge.d.ts +22 -0
- package/dist/src/diagnostics-bridge.d.ts.map +1 -0
- package/dist/src/diagnostics-bridge.js +25 -0
- package/dist/src/diagnostics-bridge.js.map +1 -0
- package/dist/src/duration.d.ts +6 -0
- package/dist/src/duration.d.ts.map +1 -0
- package/dist/src/duration.js +39 -0
- package/dist/src/duration.js.map +1 -0
- package/dist/src/engine.d.ts +583 -0
- package/dist/src/engine.d.ts.map +1 -0
- package/dist/src/engine.js +1894 -0
- package/dist/src/engine.js.map +1 -0
- package/dist/src/entities.d.ts +44 -0
- package/dist/src/entities.d.ts.map +1 -0
- package/dist/src/entities.js +64 -0
- package/dist/src/entities.js.map +1 -0
- package/dist/src/errors.d.ts +68 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +102 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/event-accumulators.d.ts +39 -0
- package/dist/src/event-accumulators.d.ts.map +1 -0
- package/dist/src/event-accumulators.js +70 -0
- package/dist/src/event-accumulators.js.map +1 -0
- package/dist/src/events.d.ts +9 -0
- package/dist/src/events.d.ts.map +1 -0
- package/dist/src/events.js +35 -0
- package/dist/src/events.js.map +1 -0
- package/dist/src/index.d.ts +36 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +37 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/interfaces.d.ts +909 -0
- package/dist/src/interfaces.d.ts.map +1 -0
- package/dist/src/interfaces.js +2 -0
- package/dist/src/interfaces.js.map +1 -0
- package/dist/src/metrics.d.ts +44 -0
- package/dist/src/metrics.d.ts.map +1 -0
- package/dist/src/metrics.js +78 -0
- package/dist/src/metrics.js.map +1 -0
- package/dist/src/otel/durable-metrics.d.ts +42 -0
- package/dist/src/otel/durable-metrics.d.ts.map +1 -0
- package/dist/src/otel/durable-metrics.js +75 -0
- package/dist/src/otel/durable-metrics.js.map +1 -0
- package/dist/src/otel/durable-otel.d.ts +20 -0
- package/dist/src/otel/durable-otel.d.ts.map +1 -0
- package/dist/src/otel/durable-otel.js +74 -0
- package/dist/src/otel/durable-otel.js.map +1 -0
- package/dist/src/otel/index.d.ts +4 -0
- package/dist/src/otel/index.d.ts.map +1 -0
- package/dist/src/otel/index.js +4 -0
- package/dist/src/otel/index.js.map +1 -0
- package/dist/src/otel/traceparent.d.ts +17 -0
- package/dist/src/otel/traceparent.d.ts.map +1 -0
- package/dist/src/otel/traceparent.js +21 -0
- package/dist/src/otel/traceparent.js.map +1 -0
- package/dist/src/pollers.d.ts +33 -0
- package/dist/src/pollers.d.ts.map +1 -0
- package/dist/src/pollers.js +76 -0
- package/dist/src/pollers.js.map +1 -0
- package/dist/src/protocol.d.ts +17 -0
- package/dist/src/protocol.d.ts.map +1 -0
- package/dist/src/protocol.js +47 -0
- package/dist/src/protocol.js.map +1 -0
- package/dist/src/queue.d.ts +113 -0
- package/dist/src/queue.d.ts.map +1 -0
- package/dist/src/queue.js +128 -0
- package/dist/src/queue.js.map +1 -0
- package/dist/src/remote-step-factory.d.ts +15 -0
- package/dist/src/remote-step-factory.d.ts.map +1 -0
- package/dist/src/remote-step-factory.js +12 -0
- package/dist/src/remote-step-factory.js.map +1 -0
- package/dist/src/remote-workflow-executor.d.ts +24 -0
- package/dist/src/remote-workflow-executor.d.ts.map +1 -0
- package/dist/src/remote-workflow-executor.js +70 -0
- package/dist/src/remote-workflow-executor.js.map +1 -0
- package/dist/src/scheduler.d.ts +67 -0
- package/dist/src/scheduler.d.ts.map +1 -0
- package/dist/src/scheduler.js +111 -0
- package/dist/src/scheduler.js.map +1 -0
- package/dist/src/search-attributes.d.ts +48 -0
- package/dist/src/search-attributes.d.ts.map +1 -0
- package/dist/src/search-attributes.js +98 -0
- package/dist/src/search-attributes.js.map +1 -0
- package/dist/src/singleton-gate.d.ts +44 -0
- package/dist/src/singleton-gate.d.ts.map +1 -0
- package/dist/src/singleton-gate.js +90 -0
- package/dist/src/singleton-gate.js.map +1 -0
- package/dist/src/step-logger.d.ts +9 -0
- package/dist/src/step-logger.d.ts.map +1 -0
- package/dist/src/step-logger.js +89 -0
- package/dist/src/step-logger.js.map +1 -0
- package/dist/src/stores/factory.d.ts +42 -0
- package/dist/src/stores/factory.d.ts.map +1 -0
- package/dist/src/stores/factory.js +29 -0
- package/dist/src/stores/factory.js.map +1 -0
- package/dist/src/stores/lucid-helpers.d.ts +11 -0
- package/dist/src/stores/lucid-helpers.d.ts.map +1 -0
- package/dist/src/stores/lucid-helpers.js +38 -0
- package/dist/src/stores/lucid-helpers.js.map +1 -0
- package/dist/src/stores/lucid-mappers.d.ts +58 -0
- package/dist/src/stores/lucid-mappers.d.ts.map +1 -0
- package/dist/src/stores/lucid-mappers.js +174 -0
- package/dist/src/stores/lucid-mappers.js.map +1 -0
- package/dist/src/stores/lucid-schema.d.ts +28 -0
- package/dist/src/stores/lucid-schema.d.ts.map +1 -0
- package/dist/src/stores/lucid-schema.js +115 -0
- package/dist/src/stores/lucid-schema.js.map +1 -0
- package/dist/src/stores/lucid.d.ts +69 -0
- package/dist/src/stores/lucid.d.ts.map +1 -0
- package/dist/src/stores/lucid.js +342 -0
- package/dist/src/stores/lucid.js.map +1 -0
- package/dist/src/telescope/dashboard.d.ts +15 -0
- package/dist/src/telescope/dashboard.d.ts.map +1 -0
- package/dist/src/telescope/dashboard.js +113 -0
- package/dist/src/telescope/dashboard.js.map +1 -0
- package/dist/src/telescope/data-providers.d.ts +20 -0
- package/dist/src/telescope/data-providers.d.ts.map +1 -0
- package/dist/src/telescope/data-providers.js +322 -0
- package/dist/src/telescope/data-providers.js.map +1 -0
- package/dist/src/telescope/extension.d.ts +22 -0
- package/dist/src/telescope/extension.d.ts.map +1 -0
- package/dist/src/telescope/extension.js +38 -0
- package/dist/src/telescope/extension.js.map +1 -0
- package/dist/src/telescope/index.d.ts +5 -0
- package/dist/src/telescope/index.d.ts.map +1 -0
- package/dist/src/telescope/index.js +4 -0
- package/dist/src/telescope/index.js.map +1 -0
- package/dist/src/telescope/telescope-sdk.d.ts +123 -0
- package/dist/src/telescope/telescope-sdk.d.ts.map +1 -0
- package/dist/src/telescope/telescope-sdk.js +12 -0
- package/dist/src/telescope/telescope-sdk.js.map +1 -0
- package/dist/src/test-helpers.d.ts +11 -0
- package/dist/src/test-helpers.d.ts.map +1 -0
- package/dist/src/test-helpers.js +12 -0
- package/dist/src/test-helpers.js.map +1 -0
- package/dist/src/testing/in-memory-state-store.d.ts +64 -0
- package/dist/src/testing/in-memory-state-store.d.ts.map +1 -0
- package/dist/src/testing/in-memory-state-store.js +259 -0
- package/dist/src/testing/in-memory-state-store.js.map +1 -0
- package/dist/src/testing/in-memory-transport.d.ts +25 -0
- package/dist/src/testing/in-memory-transport.d.ts.map +1 -0
- package/dist/src/testing/in-memory-transport.js +49 -0
- package/dist/src/testing/in-memory-transport.js.map +1 -0
- package/dist/src/testing-kit/admission-backend-conformance.d.ts +18 -0
- package/dist/src/testing-kit/admission-backend-conformance.d.ts.map +1 -0
- package/dist/src/testing-kit/admission-backend-conformance.js +81 -0
- package/dist/src/testing-kit/admission-backend-conformance.js.map +1 -0
- package/dist/src/testing-kit/assertions.d.ts +10 -0
- package/dist/src/testing-kit/assertions.d.ts.map +1 -0
- package/dist/src/testing-kit/assertions.js +41 -0
- package/dist/src/testing-kit/assertions.js.map +1 -0
- package/dist/src/testing-kit/harness.d.ts +28 -0
- package/dist/src/testing-kit/harness.d.ts.map +1 -0
- package/dist/src/testing-kit/harness.js +42 -0
- package/dist/src/testing-kit/harness.js.map +1 -0
- package/dist/src/testing-kit/index.d.ts +8 -0
- package/dist/src/testing-kit/index.d.ts.map +1 -0
- package/dist/src/testing-kit/index.js +8 -0
- package/dist/src/testing-kit/index.js.map +1 -0
- package/dist/src/testing-kit/replay.d.ts +22 -0
- package/dist/src/testing-kit/replay.d.ts.map +1 -0
- package/dist/src/testing-kit/replay.js +38 -0
- package/dist/src/testing-kit/replay.js.map +1 -0
- package/dist/src/testing-kit/state-store-conformance.d.ts +51 -0
- package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -0
- package/dist/src/testing-kit/state-store-conformance.js +430 -0
- package/dist/src/testing-kit/state-store-conformance.js.map +1 -0
- package/dist/src/testing-kit/steps.d.ts +5 -0
- package/dist/src/testing-kit/steps.d.ts.map +1 -0
- package/dist/src/testing-kit/steps.js +15 -0
- package/dist/src/testing-kit/steps.js.map +1 -0
- package/dist/src/testing-kit/transport-conformance.d.ts +16 -0
- package/dist/src/testing-kit/transport-conformance.d.ts.map +1 -0
- package/dist/src/testing-kit/transport-conformance.js +64 -0
- package/dist/src/testing-kit/transport-conformance.js.map +1 -0
- package/dist/src/tokens.d.ts +18 -0
- package/dist/src/tokens.d.ts.map +1 -0
- package/dist/src/tokens.js +18 -0
- package/dist/src/tokens.js.map +1 -0
- package/dist/src/transport-pool.d.ts +30 -0
- package/dist/src/transport-pool.d.ts.map +1 -0
- package/dist/src/transport-pool.js +82 -0
- package/dist/src/transport-pool.js.map +1 -0
- package/dist/src/transports/db-helpers.d.ts +10 -0
- package/dist/src/transports/db-helpers.d.ts.map +1 -0
- package/dist/src/transports/db-helpers.js +33 -0
- package/dist/src/transports/db-helpers.js.map +1 -0
- package/dist/src/transports/db-schema.d.ts +28 -0
- package/dist/src/transports/db-schema.d.ts.map +1 -0
- package/dist/src/transports/db-schema.js +98 -0
- package/dist/src/transports/db-schema.js.map +1 -0
- package/dist/src/transports/db.d.ts +81 -0
- package/dist/src/transports/db.d.ts.map +1 -0
- package/dist/src/transports/db.js +340 -0
- package/dist/src/transports/db.js.map +1 -0
- package/dist/src/transports/factory.d.ts +79 -0
- package/dist/src/transports/factory.d.ts.map +1 -0
- package/dist/src/transports/factory.js +57 -0
- package/dist/src/transports/factory.js.map +1 -0
- package/dist/src/transports/queue-mock-adapter.d.ts +39 -0
- package/dist/src/transports/queue-mock-adapter.d.ts.map +1 -0
- package/dist/src/transports/queue-mock-adapter.js +86 -0
- package/dist/src/transports/queue-mock-adapter.js.map +1 -0
- package/dist/src/transports/queue.d.ts +84 -0
- package/dist/src/transports/queue.d.ts.map +1 -0
- package/dist/src/transports/queue.js +210 -0
- package/dist/src/transports/queue.js.map +1 -0
- package/dist/src/workflow-ctx.d.ts +64 -0
- package/dist/src/workflow-ctx.d.ts.map +1 -0
- package/dist/src/workflow-ctx.js +457 -0
- package/dist/src/workflow-ctx.js.map +1 -0
- package/dist/src/workflow-ref.d.ts +34 -0
- package/dist/src/workflow-ref.d.ts.map +1 -0
- package/dist/src/workflow-ref.js +28 -0
- package/dist/src/workflow-ref.js.map +1 -0
- package/dist/stubs/config/durable.stub +49 -0
- package/dist/stubs/config/durable_dashboard.stub +17 -0
- package/dist/stubs/database/migrations/create_durable_tables.stub +87 -0
- package/dist/stubs/database/migrations/create_durable_transport_tables.stub +75 -0
- package/dist/stubs/main.d.ts +3 -0
- package/dist/stubs/main.d.ts.map +1 -0
- package/dist/stubs/main.js +4 -0
- package/dist/stubs/main.js.map +1 -0
- package/package.json +154 -0
|
@@ -0,0 +1,583 @@
|
|
|
1
|
+
import { type AdmissionBackend } from './admission.js';
|
|
2
|
+
import { type EntityConfig } from './entities.js';
|
|
3
|
+
import { type EventBatchConfig } from './event-accumulators.js';
|
|
4
|
+
import type { ControlPlane, EngineListener, GroupHealth, NamedTransport, RunDispatcher, RunQuery, RunResult, SearchAttributes, StateStore, StepCheckpoint, StepError, StepInterceptor, Transport, UpdateResult, UpdateValidator, WorkflowCtx, WorkflowExecutor, WorkflowRun } from './interfaces.js';
|
|
5
|
+
import type { QueueConfig } from './queue.js';
|
|
6
|
+
import { type WorkflowClass, type WorkflowInputOf, type WorkflowRef } from './workflow-ref.js';
|
|
7
|
+
type WorkflowFn = (ctx: WorkflowCtx, input: unknown) => Promise<unknown>;
|
|
8
|
+
/** Options for {@link WorkflowEngine.start}. */
|
|
9
|
+
export interface StartOptions {
|
|
10
|
+
/** Run-scoped tags, merged with the workflow's static `@Workflow({ tags })` onto the run. */
|
|
11
|
+
tags?: string[] | undefined;
|
|
12
|
+
/** Typed, queryable run data stamped on the run (e.g. `{ amount: 200, tier: 'pro' }`). */
|
|
13
|
+
searchAttributes?: SearchAttributes | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Dispatch priority for a remote run — stamped on the run and carried onto every {@link WorkflowTask}
|
|
16
|
+
* the engine dispatches to advance it. Higher wins; absent = unprioritised. See {@link WorkflowRun.priority}.
|
|
17
|
+
*/
|
|
18
|
+
priority?: number | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Serialize runs of a workflow that share a key — a durable, FIFO mutex (e.g. one pipeline per base).
|
|
22
|
+
* Excess runs are admitted in creation order, `limit` at a time; the rest wait (suspended) and retry
|
|
23
|
+
* admission on a timer until a slot frees. Race-free on a consistent store (admission order is the
|
|
24
|
+
* same `(createdAt, id)` view for every instance).
|
|
25
|
+
*/
|
|
26
|
+
export interface SingletonConfig {
|
|
27
|
+
/** Derive the serialization key from the workflow input. */
|
|
28
|
+
key: (input: unknown) => string;
|
|
29
|
+
/** Max concurrent runs sharing the key. Default 1 (a mutex). */
|
|
30
|
+
limit?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Max GATED (waiting-for-admission) runs allowed to queue behind the `limit` in-flight ones. When
|
|
33
|
+
* set, `start` rejects with {@link SingletonQueueFullError} once in-flight + gated reaches
|
|
34
|
+
* `limit + maxQueueDepth` — back-pressure against an unbounded same-key backlog. Omit for the
|
|
35
|
+
* default unbounded queue. Counts `pending`/`running`/`suspended` runs sharing the key.
|
|
36
|
+
*/
|
|
37
|
+
maxQueueDepth?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface WorkflowEngineDeps {
|
|
40
|
+
store: StateStore;
|
|
41
|
+
/** A single task transport. Shorthand for a one-entry `transports` pool (id `default`). */
|
|
42
|
+
transport?: Transport | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* An ordered pool of named transports. The engine dispatches on the first and fails over to the
|
|
45
|
+
* next on a dispatch error; a step pins one via `ctx.call(step, input, { transport: id })`. Use
|
|
46
|
+
* this instead of `transport` for failover / multi-broker setups.
|
|
47
|
+
*/
|
|
48
|
+
transports?: NamedTransport[] | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Cross-instance broadcast pub/sub for lifecycle events + cancellation (see {@link ControlPlane}).
|
|
51
|
+
* Separate from the task `transport`; omit for a single-instance / local-only setup. A transport
|
|
52
|
+
* that can also broadcast may be passed here as well.
|
|
53
|
+
*/
|
|
54
|
+
controlPlane?: ControlPlane | undefined;
|
|
55
|
+
/** Epoch-ms clock; injectable for tests. Defaults to `Date.now`. */
|
|
56
|
+
clock?: (() => number) | undefined;
|
|
57
|
+
/** Unique id for this engine instance, used for recovery leases. Defaults to a random id. */
|
|
58
|
+
instanceId?: string | undefined;
|
|
59
|
+
/** Recovery lease duration in ms — how long this instance owns a run it picked up. Default 30s. */
|
|
60
|
+
leaseMs?: number | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Flow-control admission backend for `ctx.call(step, input, { queue })`. Defaults to an in-process
|
|
63
|
+
* {@link InMemoryAdmissionBackend} (per-instance caps). Inject a store/Redis-backed backend to make
|
|
64
|
+
* the concurrency/rate/ordering caps GLOBAL across engine replicas.
|
|
65
|
+
*/
|
|
66
|
+
admission?: AdmissionBackend | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Cap how many times crash-recovery may pick up the same still-`running` run before giving up and
|
|
69
|
+
* moving it to the `dead` dead-letter state (a poison pill that crashes the process every boot).
|
|
70
|
+
* Omit for unlimited (the default — recovery always retries).
|
|
71
|
+
*/
|
|
72
|
+
maxRecoveryAttempts?: number | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* Build the public callback URL for a `ctx.webhook()` token (e.g.
|
|
75
|
+
* ``(t) => `https://api.example.com/durable/webhooks/${t}` ``). Populates
|
|
76
|
+
* {@link DurableWebhook.url}. Omit if you build URLs yourself from the token.
|
|
77
|
+
*/
|
|
78
|
+
webhookUrl?: ((token: string) => string) | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Provide the current W3C `traceparent` to stamp on each dispatched {@link RemoteTask}, so a
|
|
81
|
+
* worker (including the Python SDK) continues the distributed trace. Keep core OTel-free: supply
|
|
82
|
+
* `otelTraceparent` from `@dudousxd/nestjs-durable-otel`, or your own context reader. Omit to send none.
|
|
83
|
+
*/
|
|
84
|
+
traceparent?: (() => string | undefined) | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Provide an opaque context carrier (tenant / user / correlation ids) to attach to each dispatched
|
|
87
|
+
* {@link RemoteTask} as its `context`, so a worker (including the Python SDK) re-exposes it to the
|
|
88
|
+
* step handler — cross-process propagation alongside the {@link traceparent}. Keep core dependency-free:
|
|
89
|
+
* supply this from `@dudousxd/nestjs-context` or your own request-scoped reader. The engine never
|
|
90
|
+
* inspects the returned object's shape. Omit to send none.
|
|
91
|
+
*
|
|
92
|
+
* Re-evaluated at each (re)dispatch — including a retry or a resume that the engine drives AFTER a
|
|
93
|
+
* crash/scale-down, which runs OUTSIDE the originating request scope. On such a path this provider
|
|
94
|
+
* may return empty or stale values (the request-scoped tenant/user is gone). Treat the carrier as
|
|
95
|
+
* best-effort correlation/propagation metadata only — do NOT treat it as an authorization boundary.
|
|
96
|
+
*/
|
|
97
|
+
context?: (() => Record<string, unknown> | undefined) | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* Re-hydrate the originating context around a LOCAL step body, so a `@DurableStep` reader sees the
|
|
100
|
+
* tenant / user / correlation ids that were live when the run was started — even on a path the
|
|
101
|
+
* engine drives outside the originating request scope (a resume after crash/scale-down, a timer).
|
|
102
|
+
* Given the carrier produced by {@link context} (may be empty/undefined) and the step body `fn`, it
|
|
103
|
+
* runs `fn` with that context ambiently established (e.g. inside `@dudousxd/nestjs-context`'s ALS)
|
|
104
|
+
* and returns its result. Keep core dependency-free: supply this from the nestjs wiring (which owns
|
|
105
|
+
* nestjs-context) or your own ALS bridge. The handler signature is unchanged — re-hydration is
|
|
106
|
+
* ambient. Default: passthrough (`(_, fn) => fn()`), so behavior is byte-identical when unset.
|
|
107
|
+
*/
|
|
108
|
+
rehydrate?: (<T>(carrier: Record<string, unknown> | undefined, fn: () => T) => T) | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* Attempts for each saga compensation when the run fails (a transient undo — e.g. a refund API
|
|
111
|
+
* hiccup — gets another try). Default 1 (no retry). Compensations must be idempotent.
|
|
112
|
+
*/
|
|
113
|
+
compensationRetries?: number | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* Persist a `running` checkpoint when a local step's body begins, so an in-flight step shows up
|
|
116
|
+
* in the dashboard (and a fresh page load / REST query) the moment it starts — not only once it
|
|
117
|
+
* completes. The `step.started` lifecycle event is emitted either way (the live SSE view always
|
|
118
|
+
* sees the start); this flag only controls the extra checkpoint write. Default `true`. Set
|
|
119
|
+
* `false` on hot paths with many short local steps to halve their checkpoint writes — you keep
|
|
120
|
+
* the live event but lose reload-survivable in-flight visibility.
|
|
121
|
+
*/
|
|
122
|
+
trackStepStart?: boolean | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Where a freshly-`start`ed run executes (see {@link RunDispatcher}). Defaults to in-process: the
|
|
125
|
+
* run executes on this instance asynchronously (a microtask), so `start` returns without blocking.
|
|
126
|
+
* Pass a no-op dispatcher on a caller that must NOT run workflows (e.g. an API/dashboard pod), and
|
|
127
|
+
* run `runPending` on a worker pod to pick those up; or a broker-backed one for a worker pool.
|
|
128
|
+
*/
|
|
129
|
+
runDispatcher?: RunDispatcher | undefined;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The orchestrator. Owns workflow state and replays runs deterministically: each step's
|
|
133
|
+
* result is checkpointed, so on resume a completed step returns its saved output instead of
|
|
134
|
+
* re-executing. Remote steps are dispatched over the Transport; their results checkpoint the
|
|
135
|
+
* same way local steps do.
|
|
136
|
+
*/
|
|
137
|
+
export declare class WorkflowEngine {
|
|
138
|
+
private readonly store;
|
|
139
|
+
/** Ordered transport pool (dispatch + failover). Empty = no remote steps. */
|
|
140
|
+
private readonly pool;
|
|
141
|
+
private readonly controlPlane?;
|
|
142
|
+
private readonly clock;
|
|
143
|
+
private readonly instanceId;
|
|
144
|
+
private readonly leaseMs;
|
|
145
|
+
private readonly maxRecoveryAttempts?;
|
|
146
|
+
private readonly webhookUrl?;
|
|
147
|
+
private readonly traceparent?;
|
|
148
|
+
private readonly context?;
|
|
149
|
+
/** Establish the originating context ambiently around a local step body (see {@link WorkflowEngineDeps.rehydrate}). Default passthrough. */
|
|
150
|
+
private readonly rehydrate;
|
|
151
|
+
private readonly compensationRetries;
|
|
152
|
+
/** Persist a `running` checkpoint at the start of a local step body (see {@link WorkflowEngineDeps.trackStepStart}). */
|
|
153
|
+
private readonly trackStepStart;
|
|
154
|
+
/** Where a freshly-started run executes — in-process by default (see {@link RunDispatcher}). */
|
|
155
|
+
private readonly runDispatcher;
|
|
156
|
+
/** Per-key serialization for singleton workflows (admission, back-pressure, notify-on-release). */
|
|
157
|
+
private readonly singletons;
|
|
158
|
+
/** Every registered workflow, keyed by `name@version` — so old versions stay runnable. */
|
|
159
|
+
private readonly workflows;
|
|
160
|
+
/** The newest registered version per workflow name — used to `start` new runs. */
|
|
161
|
+
private readonly latest;
|
|
162
|
+
/** Event name → workflow names started when that event is published (see `onEvent`). */
|
|
163
|
+
private readonly eventTriggers;
|
|
164
|
+
/** Durable-entity subsystem (registers the `__entity` runner; see `registerEntity`). */
|
|
165
|
+
private readonly entities;
|
|
166
|
+
/** Event debounce/batch accumulators (register the `__evt_*` runners; see `accumulators.route`). */
|
|
167
|
+
private readonly accumulators;
|
|
168
|
+
/** In-flight remote steps awaiting a worker result, keyed by stepId. */
|
|
169
|
+
private readonly pending;
|
|
170
|
+
/** Per-step "reset the liveness timer" callbacks, called when a heartbeat arrives. */
|
|
171
|
+
private readonly heartbeatResets;
|
|
172
|
+
private readonly listeners;
|
|
173
|
+
/** Step interceptors (onion middleware around real local-step execution), first = outermost. */
|
|
174
|
+
private readonly interceptors;
|
|
175
|
+
/** Callbacks notified (on any instance) when a run is cancelled — for cooperative cancellation. */
|
|
176
|
+
private readonly cancelListeners;
|
|
177
|
+
/** Callbacks notified when a run is enqueued elsewhere — for low-latency cross-pod dispatch. */
|
|
178
|
+
private readonly enqueuedListeners;
|
|
179
|
+
/** Notified when a run is dead-lettered (moved to `dead`) — a hook for a DLQ handler. */
|
|
180
|
+
private readonly deadListeners;
|
|
181
|
+
/** Validators gating `engine.update`, keyed by `<workflow>:<updateName>`. */
|
|
182
|
+
private readonly updateValidators;
|
|
183
|
+
/** Runs being cancelled WITH saga compensation — see `cancel({ compensate: true })`. */
|
|
184
|
+
private readonly cancelRequested;
|
|
185
|
+
/** Flow-control admission backend for remote steps (see {@link registerQueue}). */
|
|
186
|
+
private readonly admission;
|
|
187
|
+
/** Runs on THIS instance blocked on admission, by queue — woken early on a freed-slot signal. */
|
|
188
|
+
private readonly queueWaiters;
|
|
189
|
+
/** Which queue a dispatched step took a slot from, by stepId — so the result can release it. */
|
|
190
|
+
private readonly stepQueue;
|
|
191
|
+
/** Executions currently in flight, so a graceful shutdown can wait for them to settle. */
|
|
192
|
+
private readonly inflight;
|
|
193
|
+
private draining;
|
|
194
|
+
constructor(deps: WorkflowEngineDeps);
|
|
195
|
+
/**
|
|
196
|
+
* Register a **durable entity** (a virtual object): a keyed actor whose `handlers` run **serialized
|
|
197
|
+
* per key** over **durable state**, exactly once. Drive it with `signalEntity` (fire) /
|
|
198
|
+
* `ctx.callEntity` (call + await result) and read its state with `getEntityState`. See {@link Entities}.
|
|
199
|
+
*/
|
|
200
|
+
registerEntity<S>(name: string, config: EntityConfig<S>): void;
|
|
201
|
+
/** Send an operation to an entity (fire-and-forget). Ordered + exactly-once per key. */
|
|
202
|
+
signalEntity(name: string, key: string, op: string, arg?: unknown): Promise<void>;
|
|
203
|
+
/** Read an entity's current durable state (published after each op), or undefined if it has none yet. */
|
|
204
|
+
getEntityState<S = unknown>(name: string, key: string): Promise<S | undefined>;
|
|
205
|
+
/**
|
|
206
|
+
* Be notified when a run is enqueued on ANOTHER instance (via the control plane), so a worker can
|
|
207
|
+
* pick it up at once — e.g. `engine.onEnqueued((runId) => engine.runOne(runId))`. Returns an
|
|
208
|
+
* unsubscribe function. Only wire this on instances that should execute runs (workers).
|
|
209
|
+
*/
|
|
210
|
+
onEnqueued(listener: (runId: string) => void): () => void;
|
|
211
|
+
/** Fire cooperative-cancellation listeners for `runId` (a worker bridge aborts in-flight work). */
|
|
212
|
+
private notifyCancelled;
|
|
213
|
+
/**
|
|
214
|
+
* Register a workflow version. Register multiple versions of the same name to keep in-flight
|
|
215
|
+
* runs working across a breaking change: old runs resume on the version they started on, new
|
|
216
|
+
* runs start on the newest registered version.
|
|
217
|
+
*/
|
|
218
|
+
register(name: string, version: string, fn: WorkflowFn, opts?: {
|
|
219
|
+
tags?: string[] | undefined;
|
|
220
|
+
singleton?: SingletonConfig | undefined;
|
|
221
|
+
executionTimeout?: string | number | undefined;
|
|
222
|
+
validateInput?: ((input: unknown) => void | Promise<void>) | undefined;
|
|
223
|
+
onEvent?: string[] | undefined;
|
|
224
|
+
eventBatch?: EventBatchConfig | undefined;
|
|
225
|
+
}): void;
|
|
226
|
+
/**
|
|
227
|
+
* Register a workflow whose body runs in another SDK (e.g. Python). The engine owns the run exactly
|
|
228
|
+
* as for a TS workflow — it persists checkpoints, recovers, runs timers — but advances it by handing
|
|
229
|
+
* the run's history to `executor` (which dispatches a {@link WorkflowTask} to the worker) and applying
|
|
230
|
+
* the {@link WorkflowDecision} the worker's replay returns. The worker never touches the store.
|
|
231
|
+
*/
|
|
232
|
+
registerRemote(name: string, version: string, opts: {
|
|
233
|
+
group: string;
|
|
234
|
+
executor: WorkflowExecutor;
|
|
235
|
+
tags?: string[];
|
|
236
|
+
singleton?: SingletonConfig;
|
|
237
|
+
executionTimeout?: string | number;
|
|
238
|
+
validateInput?: (input: unknown) => void | Promise<void>;
|
|
239
|
+
}): void;
|
|
240
|
+
/**
|
|
241
|
+
* Register a flow-control queue referenced by `ctx.call(step, input, { queue })`. Caps concurrent
|
|
242
|
+
* in-flight steps and/or the admission rate; blocked calls re-suspend and retry, so the limit is
|
|
243
|
+
* durable. Per engine instance (see {@link QueueConfig}). Registering the same name replaces it.
|
|
244
|
+
*/
|
|
245
|
+
registerQueue(config: QueueConfig): void;
|
|
246
|
+
/** Subscribe to lifecycle events. Returns an unsubscribe function. */
|
|
247
|
+
subscribe(listener: EngineListener): () => void;
|
|
248
|
+
/**
|
|
249
|
+
* Register a {@link StepInterceptor} — onion middleware run around the real execution of every
|
|
250
|
+
* local `ctx.step` (timing, logging, tracing, error enrichment, context propagation). First
|
|
251
|
+
* registered is outermost; interceptors fire only when a step executes, never on replay. Returns
|
|
252
|
+
* an unsubscribe function.
|
|
253
|
+
*/
|
|
254
|
+
use(interceptor: StepInterceptor): () => void;
|
|
255
|
+
/**
|
|
256
|
+
* Fold the registered interceptors around a local step body (identity when there are none), then
|
|
257
|
+
* run the whole thing inside the re-hydrated originating context. The carrier is read at execution
|
|
258
|
+
* time from {@link context} — the SAME reader stamped on dispatched remote tasks — so a local step
|
|
259
|
+
* sees the live tenant / user / trace ids ambiently (via the {@link rehydrate} bridge). Default
|
|
260
|
+
* `rehydrate` is a passthrough, so this is byte-identical to a bare body call when unwired.
|
|
261
|
+
*/
|
|
262
|
+
private interceptStep;
|
|
263
|
+
/**
|
|
264
|
+
* Be notified when a run is cancelled — on ANY instance, via the transport control plane. A
|
|
265
|
+
* worker bridge can use this for cooperative cancellation: abort the in-flight work for `runId`
|
|
266
|
+
* instead of finishing it just to have the result discarded. Returns an unsubscribe function.
|
|
267
|
+
*/
|
|
268
|
+
onCancel(listener: (runId: string) => void): () => void;
|
|
269
|
+
/**
|
|
270
|
+
* Be notified when a run is **dead-lettered** — moved to `dead` after exceeding
|
|
271
|
+
* `maxRecoveryAttempts`. The listener receives the dead run (status `dead`, with its error), so a
|
|
272
|
+
* DLQ handler can do something other than just leaving it parked: alert, push to a real queue, or
|
|
273
|
+
* start a dead-letter workflow (e.g. `engine.onDead((run) => engine.start('pipeline-dlq', run, ...))`).
|
|
274
|
+
* Returns an unsubscribe function.
|
|
275
|
+
*/
|
|
276
|
+
onDead(listener: (run: WorkflowRun) => void): () => void;
|
|
277
|
+
private notifyDead;
|
|
278
|
+
/** Emit a locally-produced lifecycle event: deliver to subscribers AND broadcast it on the
|
|
279
|
+
* control plane so other instances (e.g. a dashboard pod) can live-tail this run. */
|
|
280
|
+
private emit;
|
|
281
|
+
/** Deliver an event to local subscribers only (no re-broadcast) — used for both locally-produced
|
|
282
|
+
* events and ones received from the control plane, so an event shows up once on every instance. */
|
|
283
|
+
private deliver;
|
|
284
|
+
start<C extends WorkflowClass>(workflow: C, input: WorkflowInputOf<C>, runId: string, opts?: StartOptions): Promise<RunResult>;
|
|
285
|
+
start<TInput>(workflow: string, input: TInput, runId: string, opts?: StartOptions): Promise<RunResult>;
|
|
286
|
+
/** Read a run's current persisted state (or null if unknown). A thin pass-through to the store. */
|
|
287
|
+
getRun(runId: string): Promise<WorkflowRun | null>;
|
|
288
|
+
/**
|
|
289
|
+
* List persisted runs matching `query` (newest activity first, per the store's own ordering). The
|
|
290
|
+
* engine's read API for inspection surfaces (the dashboard, the `durable:runs` CLI) so they query
|
|
291
|
+
* through the engine rather than reaching for its private store.
|
|
292
|
+
*/
|
|
293
|
+
listRuns(query: RunQuery): Promise<WorkflowRun[]>;
|
|
294
|
+
/** List a run's step checkpoints (its timeline). Part of the engine's read API; see {@link listRuns}. */
|
|
295
|
+
listCheckpoints(runId: string): Promise<StepCheckpoint[]>;
|
|
296
|
+
/**
|
|
297
|
+
* Hard-delete a run and its whole child subtree from the store, returning the number of runs
|
|
298
|
+
* removed (0 if `runId` is unknown). Children are collected BEFORE this run's checkpoints are
|
|
299
|
+
* deleted (the parent→children edge is read from them). Use for retention/cleanup; this is a
|
|
300
|
+
* destructive store operation, not a cancellation — a running run should be {@link cancel}led first.
|
|
301
|
+
*/
|
|
302
|
+
deleteRun(runId: string): Promise<number>;
|
|
303
|
+
resume(runId: string): Promise<RunResult>;
|
|
304
|
+
/** Track an in-flight execution so {@link drain} can wait for it. */
|
|
305
|
+
private track;
|
|
306
|
+
/**
|
|
307
|
+
* Graceful shutdown: stop picking up new runs (recovery/timer become no-ops) and wait for
|
|
308
|
+
* in-flight executions to settle, up to `timeoutMs`. Call from your app's shutdown hook so a
|
|
309
|
+
* deploy hands off cleanly instead of leaving runs to the lease timeout.
|
|
310
|
+
*/
|
|
311
|
+
drain(timeoutMs?: number): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Cancel in-flight runs that have outlived their workflow's `executionTimeout`. Call it from the
|
|
314
|
+
* timer poller alongside {@link resumeDueTimers}. A timed-out run is moved to `cancelled` with an
|
|
315
|
+
* `execution_timeout` error (terminal, so a late step result can't resurrect it).
|
|
316
|
+
*/
|
|
317
|
+
sweepTimeouts(now?: number): Promise<void>;
|
|
318
|
+
/**
|
|
319
|
+
* Resume every run left incomplete by a crash or deploy. Called on boot. Completed steps
|
|
320
|
+
* replay from their checkpoints, so only the work that had not finished runs again.
|
|
321
|
+
*/
|
|
322
|
+
recoverIncomplete(nowMs?: number): Promise<RunResult[]>;
|
|
323
|
+
/**
|
|
324
|
+
* Per-recovery bookkeeping (called once the lease is held): count the attempt, or — past
|
|
325
|
+
* `maxRecoveryAttempts` — move a poison pill to the `dead` dead-letter state. Returns a terminal
|
|
326
|
+
* result to skip the resume, or `undefined` to proceed.
|
|
327
|
+
*/
|
|
328
|
+
private countRecovery;
|
|
329
|
+
/**
|
|
330
|
+
* Resume every suspended run whose durable timer is due. Call periodically (a poller) and on
|
|
331
|
+
* boot. A run still not due re-suspends cheaply without running new work.
|
|
332
|
+
*/
|
|
333
|
+
resumeDueTimers(nowMs?: number): Promise<RunResult[]>;
|
|
334
|
+
/**
|
|
335
|
+
* Lease and execute one run by id — the worker side of dispatch. Acquires the recovery lease (so
|
|
336
|
+
* exactly one instance runs it), then resumes the body. Returns the result, or null if another
|
|
337
|
+
* instance holds the lease or the engine is draining. The default in-process dispatcher calls this;
|
|
338
|
+
* a broker-backed worker calls it per consumed run id.
|
|
339
|
+
*/
|
|
340
|
+
runOne(runId: string): Promise<RunResult | null>;
|
|
341
|
+
/**
|
|
342
|
+
* Re-enqueue a run for a worker to (re-)execute — the dispatch-model **retry**. Sets it back to
|
|
343
|
+
* `pending`, clears any stale lease, and dispatches; a worker resumes it (replaying its checkpoints,
|
|
344
|
+
* re-attempting the failed step). Returns the enqueued state immediately — never runs the body
|
|
345
|
+
* inline — or null if the run is unknown. The dashboard "retry" goes through here so it can't block
|
|
346
|
+
* the HTTP request on workflow execution.
|
|
347
|
+
*/
|
|
348
|
+
requeue(runId: string): Promise<RunResult | null>;
|
|
349
|
+
/**
|
|
350
|
+
* **Fix-and-replay**: re-run a run (typically a `dead`/`failed` one) with a corrected `input`, as a
|
|
351
|
+
* fresh run with clean history. It's a NEW run — `newRunId` defaults to `<runId>~retry~<uuid>` — so
|
|
352
|
+
* the original stays inspectable. Returns the new run's id, or null if `runId` is unknown.
|
|
353
|
+
*/
|
|
354
|
+
retryWithInput(runId: string, input: unknown, newRunId?: string): Promise<{
|
|
355
|
+
runId: string;
|
|
356
|
+
} | null>;
|
|
357
|
+
/**
|
|
358
|
+
* Pick up and execute every `pending` run — the poll-based side of dispatch for a worker pod with
|
|
359
|
+
* no broker. Runs enqueued by other pods (or by a caller using a no-op dispatcher) sit `pending`
|
|
360
|
+
* in the store until polled; leasing ensures exactly one pod runs each. Call periodically alongside
|
|
361
|
+
* {@link resumeDueTimers}.
|
|
362
|
+
*/
|
|
363
|
+
runPending(nowMs?: number): Promise<RunResult[]>;
|
|
364
|
+
/**
|
|
365
|
+
* Resolve once `runId` reaches a settled state — terminal (completed/failed/cancelled/dead) or
|
|
366
|
+
* suspended (handed off to a timer/signal/event). The async counterpart to dispatch: pair it with
|
|
367
|
+
* `start` when a call site needs the outcome — `await start(...); const r = await waitForRun(id)`.
|
|
368
|
+
*/
|
|
369
|
+
waitForRun(runId: string, opts?: {
|
|
370
|
+
timeoutMs?: number;
|
|
371
|
+
}): Promise<RunResult>;
|
|
372
|
+
/**
|
|
373
|
+
* Resume each run only if this instance can acquire its recovery lease — so when several
|
|
374
|
+
* replicas recover or poll at once, each run is picked up by exactly one of them.
|
|
375
|
+
*/
|
|
376
|
+
private resumeLeased;
|
|
377
|
+
/**
|
|
378
|
+
* Deliver an external signal to the run waiting on `token` and resume it with `payload`.
|
|
379
|
+
* Returns the run result, or null if no run is waiting for that token.
|
|
380
|
+
*/
|
|
381
|
+
/**
|
|
382
|
+
* Publish a named event. It does two things, and returns how many runs it touched (the sum):
|
|
383
|
+
* 1. **Resumes** every in-flight run waiting on it via `ctx.waitForEvent(name, { match })` whose
|
|
384
|
+
* match the payload satisfies (fan-out, vs `signal`'s point-to-point token).
|
|
385
|
+
* 2. **Starts** a fresh run of every workflow registered with `onEvent: [name]`, passing the
|
|
386
|
+
* payload as input. Idempotent by `evt:<id>:<workflow>` — pass `opts.id` to dedupe redeliveries
|
|
387
|
+
* of the same logical event (default: a fresh uuid, so each publish triggers once).
|
|
388
|
+
*/
|
|
389
|
+
publishEvent(name: string, payload: unknown, opts?: {
|
|
390
|
+
id?: string;
|
|
391
|
+
}): Promise<number>;
|
|
392
|
+
signal(token: string, payload: unknown): Promise<RunResult | null>;
|
|
393
|
+
/**
|
|
394
|
+
* Ensure a run exists for `runId`, then deliver a signal to it — atomically race-free thanks to
|
|
395
|
+
* signal buffering: if the run is new (or busy / not yet waiting), the signal is buffered and
|
|
396
|
+
* consumed when it reaches `waitForSignal(token)`. The canonical **durable-entity / accumulator**
|
|
397
|
+
* pattern: one long-lived run per key (the `runId`) that loops on `waitForSignal`, fed events by
|
|
398
|
+
* many `signalWithStart` calls. `start` is idempotent by `runId`, so concurrent callers converge on
|
|
399
|
+
* one run. (Use a per-run `token`, e.g. derived from `runId`, so the signal targets this entity.)
|
|
400
|
+
*/
|
|
401
|
+
signalWithStart(workflow: WorkflowRef, input: unknown, runId: string, signal: {
|
|
402
|
+
token: string;
|
|
403
|
+
payload?: unknown;
|
|
404
|
+
}, opts?: StartOptions): Promise<{
|
|
405
|
+
runId: string;
|
|
406
|
+
}>;
|
|
407
|
+
/**
|
|
408
|
+
* Report the result of a `ctx.task(name, …)` back to its run (async completion). The external
|
|
409
|
+
* worker that the task dispatched to calls this when done; the run resumes with `result`. Returns
|
|
410
|
+
* null if no run is waiting on the task (e.g. a duplicate/late delivery) — a safe no-op.
|
|
411
|
+
*/
|
|
412
|
+
completeTask(runId: string, name: string, result: unknown): Promise<RunResult | null>;
|
|
413
|
+
/** Report that a `ctx.task` failed — the run resumes and throws a FatalError at the task. */
|
|
414
|
+
failTask(runId: string, name: string, error: string): Promise<RunResult | null>;
|
|
415
|
+
/**
|
|
416
|
+
* Notify a parent that's waiting on `runId` as a child of its terminal outcome (the `ctx.child`
|
|
417
|
+
* rendezvous). A no-op when no parent is waiting, so `execute()` can call it on every run without
|
|
418
|
+
* knowing about the child feature.
|
|
419
|
+
*/
|
|
420
|
+
private notifyParent;
|
|
421
|
+
/**
|
|
422
|
+
* Cancel a run (e.g. from the dashboard). Returns null if the run does not exist. Pass
|
|
423
|
+
* `{ compensate: true }` to undo the saga first: the suspended run is resumed so its completed
|
|
424
|
+
* steps' compensations run in reverse (visible as `compensate:<step>` events), then it's marked
|
|
425
|
+
* cancelled. Without it, cancellation is immediate (no undo).
|
|
426
|
+
*/
|
|
427
|
+
cancel(runId: string, opts?: {
|
|
428
|
+
compensate?: boolean;
|
|
429
|
+
}): Promise<RunResult | null>;
|
|
430
|
+
/**
|
|
431
|
+
* Bulk-cancel every run matching a filter — e.g. cancel all `order` runs tagged `vip`, or every run
|
|
432
|
+
* whose `tier` search attribute is `free`. The filter is a {@link RunQuery} (workflow / status / tag
|
|
433
|
+
* / search-attribute predicates), so it reuses the same matching the dashboard list uses. Each match
|
|
434
|
+
* is run through {@link cancel}, so the same plumbing applies per run: child cascade, the optional
|
|
435
|
+
* saga `compensate`, local cancel listeners, and the control-plane broadcast that tells the owning
|
|
436
|
+
* worker to abort. Returns one {@link RunResult} per matched run (already-finished matches report
|
|
437
|
+
* their terminal status — `cancel` is a no-op on them, never clobbering a completed/dead run).
|
|
438
|
+
*/
|
|
439
|
+
cancelWhere(filter: Omit<RunQuery, 'limit' | 'offset'>, opts?: {
|
|
440
|
+
compensate?: boolean;
|
|
441
|
+
}): Promise<RunResult[]>;
|
|
442
|
+
/**
|
|
443
|
+
* Cascade cancellation to a run's children — both awaited (`ctx.child`, found via its live
|
|
444
|
+
* `child:<id>` waiter) and fire-and-forget (`ctx.startChild`, found via its `spawn:<id>`
|
|
445
|
+
* checkpoint). Recursive, so a whole subtree is cancelled; the terminal guard in `cancel` stops it
|
|
446
|
+
* at finished / already-cancelled runs (no loops, no re-cancel).
|
|
447
|
+
*/
|
|
448
|
+
private cancelChildren;
|
|
449
|
+
/**
|
|
450
|
+
* The ids of the runs a run spawned — both awaited (`ctx.child`) and fire-and-forget
|
|
451
|
+
* (`ctx.startChild`, found via its `spawn:<id>` checkpoint). The canonical parent→children edge,
|
|
452
|
+
* used for both cancellation cascades and the dashboard run-tree.
|
|
453
|
+
*
|
|
454
|
+
* An awaited child is discovered two ways, because the live `child:<id>` waiter only exists WHILE
|
|
455
|
+
* the parent is suspended on it: the waiter resolves and is consumed the moment the child settles,
|
|
456
|
+
* so a completed parent (or a completed awaited child) would otherwise drop out of the tree. The
|
|
457
|
+
* `signal:child:<id>` checkpoint (the placeholder written when the parent first awaits the child,
|
|
458
|
+
* overwritten as completed/failed when it settles) persists across completion, so we read both and
|
|
459
|
+
* dedupe — the edge stays stable for a finished run, not just a live one.
|
|
460
|
+
*/
|
|
461
|
+
getRunChildren(parentRunId: string): Promise<string[]>;
|
|
462
|
+
/** The worker groups this engine dispatches to: every registered remote workflow's group, plus any
|
|
463
|
+
* `extra` the caller declares. Local-step groups (a group consumed by in-process `@DurableStep`
|
|
464
|
+
* workers, e.g. `pipeline`) aren't derivable from registrations — pass them via `extra` so a group
|
|
465
|
+
* with backlog and ZERO workers is still reported (the alert case has no heartbeat to discover). */
|
|
466
|
+
knownGroups(extra?: string[]): string[];
|
|
467
|
+
/** Per-group worker health (queue backlog + live worker heartbeats). Covers {@link knownGroups}
|
|
468
|
+
* (so a registered group with backlog and ZERO workers still reports — the alert case) UNION the
|
|
469
|
+
* groups discovered from live heartbeats (so a local-step group like `pipeline`, not derivable
|
|
470
|
+
* from registrations, shows once its workers beat). Empty when no transport can introspect health
|
|
471
|
+
* (only the BullMQ transport implements `groupHealth`). */
|
|
472
|
+
workerHealth(extra?: string[]): Promise<GroupHealth[]>;
|
|
473
|
+
/**
|
|
474
|
+
* Persist a streamed local-step lifecycle event from a remote workflow worker (see
|
|
475
|
+
* {@link WorkflowStepEvent}). A Python `@workflow` runs its `ctx.step`s inline over one turn that
|
|
476
|
+
* can last minutes; the worker streams each step's start/finish so the engine checkpoints it LIVE —
|
|
477
|
+
* a step shows `running` the moment its body begins, then resolves to `completed`/`failed` with its
|
|
478
|
+
* real wall-clock window and sub-process events — instead of every step appearing at once when the
|
|
479
|
+
* turn ends. The turn's final `recordStep` command re-persists the same (runId, seq) checkpoint
|
|
480
|
+
* idempotently, so this is purely additive observability and never changes the run's outcome.
|
|
481
|
+
*/
|
|
482
|
+
private persistStepEvent;
|
|
483
|
+
/**
|
|
484
|
+
* Announce a local step's body has begun and (when `trackStepStart`) checkpoint it as `running`,
|
|
485
|
+
* so it's visible in flight rather than appearing only on completion. The checkpoint is a
|
|
486
|
+
* placeholder overwritten by {@link completeStep}/{@link failStep}; it never short-circuits replay
|
|
487
|
+
* (only `completed` does), so a crash mid-body just re-runs the step. The `step.started` event
|
|
488
|
+
* fires regardless — the live SSE view sees the start even with persistence off.
|
|
489
|
+
*/
|
|
490
|
+
private startStep;
|
|
491
|
+
/** Checkpoint a finished step and announce it — the two things that must always happen together. */
|
|
492
|
+
private completeStep;
|
|
493
|
+
/** Checkpoint a step that failed terminally, so the failure point is visible (not just the run). */
|
|
494
|
+
private failStep;
|
|
495
|
+
private execute;
|
|
496
|
+
/**
|
|
497
|
+
* Advance a remote (cross-SDK) workflow one turn: hand its history to the executor (which dispatches
|
|
498
|
+
* a workflow task to the worker and awaits its replay) and apply the decision. Mirrors
|
|
499
|
+
* {@link runExecution}'s settle/suspend; the lease is held by {@link execute}. The result that lands
|
|
500
|
+
* us back here (a remote step finished, a timer fired) goes through `resume` like any TS workflow.
|
|
501
|
+
*/
|
|
502
|
+
/**
|
|
503
|
+
* Apply a terminal/suspended transition once: persist the new run status, emit the matching
|
|
504
|
+
* lifecycle event, and (on completion/failure) wake a waiting parent. Both the TS and remote
|
|
505
|
+
* executors funnel their completed/failed/suspended outcomes through here so a status update can
|
|
506
|
+
* never drift from its event or `notifyParent` call. Does NOT touch the run lock — each executor
|
|
507
|
+
* keeps its own lease handling (the TS executor's `finally`, the remote path's caller).
|
|
508
|
+
*/
|
|
509
|
+
private settleRun;
|
|
510
|
+
private runRemoteExecution;
|
|
511
|
+
/** The run's resolved durable ops as replay inputs: completed/failed steps + elapsed timers. */
|
|
512
|
+
private remoteHistory;
|
|
513
|
+
/** Apply a turn's commands: persist recorded local steps, dispatch remote calls, schedule timers.
|
|
514
|
+
* Returns the earliest timer deadline to suspend on (or undefined — suspended on a result). */
|
|
515
|
+
private applyCommands;
|
|
516
|
+
/** The run body, lease held + renewed by {@link execute}. */
|
|
517
|
+
private runExecution;
|
|
518
|
+
/**
|
|
519
|
+
* Run one saga compensation, retried up to `compensationRetries`, emitting a `compensate:<step>`
|
|
520
|
+
* step event for its outcome so a stranded undo is visible. Never throws — a permanently-failing
|
|
521
|
+
* compensation is skipped so it can't mask the original failure.
|
|
522
|
+
*/
|
|
523
|
+
private runCompensation;
|
|
524
|
+
/** The seam handed to {@link createWorkflowCtx}: the authoring API reaches durability + lifecycle
|
|
525
|
+
* (checkpointing, dispatch, child start) through this, so the ctx primitives live in their own
|
|
526
|
+
* module and the engine stays the orchestrator. */
|
|
527
|
+
private ctxHostFor;
|
|
528
|
+
/**
|
|
529
|
+
* Resume a run paused at a {@link WorkflowCtx.breakpoint} (e.g. the dashboard "continue" button).
|
|
530
|
+
* Finds the run's pending breakpoint checkpoint and signals it. Returns null if the run isn't
|
|
531
|
+
* paused at a breakpoint.
|
|
532
|
+
*/
|
|
533
|
+
continue(runId: string): Promise<RunResult | null>;
|
|
534
|
+
/**
|
|
535
|
+
* Read the latest value a run published for `key` via {@link WorkflowCtx.setEvent} — a
|
|
536
|
+
* side-effect-free query of a live (or finished) run's state. Returns `undefined` if the run
|
|
537
|
+
* never published that key. The suspend-model counterpart of a Temporal query.
|
|
538
|
+
*/
|
|
539
|
+
getEvent<TValue = unknown>(runId: string, key: string): Promise<TValue | undefined>;
|
|
540
|
+
/**
|
|
541
|
+
* Register a validator gating `engine.update(runId, name, …)` for runs of `workflow`. The
|
|
542
|
+
* validator runs BEFORE the update is delivered, so a rejection leaves the run untouched. One
|
|
543
|
+
* validator per (workflow, update name); registering again replaces it.
|
|
544
|
+
*/
|
|
545
|
+
registerUpdateValidator<TArg>(workflow: string, name: string, validate: UpdateValidator<TArg>): void;
|
|
546
|
+
/**
|
|
547
|
+
* Deliver a validated update to the run waiting at `ctx.onUpdate(name)`. Runs the registered
|
|
548
|
+
* validator (if any) first: on rejection returns `{ accepted: false, reason }` without disturbing
|
|
549
|
+
* the run; otherwise delivers `arg` and resumes, returning `{ accepted: true, run }` (`run` is null
|
|
550
|
+
* if nothing was waiting — a too-early or duplicate update).
|
|
551
|
+
*/
|
|
552
|
+
update(runId: string, name: string, arg: unknown): Promise<UpdateResult>;
|
|
553
|
+
private callRemote;
|
|
554
|
+
/**
|
|
555
|
+
* Complete a durable remote step from its worker result and resume the run — runs on whichever
|
|
556
|
+
* instance receives the result (the dispatching one may be gone), so the run is crash/scale-safe.
|
|
557
|
+
* A no-op if the checkpoint isn't `pending` (a duplicate or late delivery).
|
|
558
|
+
*/
|
|
559
|
+
private completeRemoteResult;
|
|
560
|
+
/**
|
|
561
|
+
* A slot freed on `queue` (a fleet-wide signal): resume this instance's runs blocked on it so they
|
|
562
|
+
* re-contend now instead of at their retry tick. Snapshot-and-clear — a run still blocked after the
|
|
563
|
+
* retry re-registers itself, and one that's gone (cancelled/admitted) is dropped. Best-effort.
|
|
564
|
+
*/
|
|
565
|
+
private wakeQueueWaiters;
|
|
566
|
+
/** Release the flow-control slot a dispatched step held (if any), by its stepId. */
|
|
567
|
+
private releaseQueueSlot;
|
|
568
|
+
/** In-memory await path for a remote step with a liveness `timeoutMs` (re-dispatch on timeout). */
|
|
569
|
+
private callRemoteInMemory;
|
|
570
|
+
/**
|
|
571
|
+
* Await a remote result, but reject with `RemoteStepTimeout` if neither the result nor a heartbeat
|
|
572
|
+
* arrives within `timeoutMs`. Each heartbeat (delivered via `transport.onHeartbeat`) rearms the
|
|
573
|
+
* window, so a worker that keeps beating stays alive past `timeoutMs`.
|
|
574
|
+
*/
|
|
575
|
+
private awaitWithHeartbeat;
|
|
576
|
+
}
|
|
577
|
+
/** Raised inside the workflow when a remote worker reports a step failure. */
|
|
578
|
+
export declare class RemoteStepError extends Error {
|
|
579
|
+
readonly stepError?: StepError | undefined;
|
|
580
|
+
constructor(stepError?: StepError);
|
|
581
|
+
}
|
|
582
|
+
export {};
|
|
583
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAA4B,MAAM,gBAAgB,CAAC;AAKjF,OAAO,EAAY,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAS5D,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,yBA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