@lostgradient/weft 0.2.1 → 0.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 +123 -43
- package/dist/cli/conformance.js +7 -1
- package/dist/cli/generated/operation-client.generated.d.ts +55 -13
- package/dist/cli/generated/operation-client.generated.js +3 -0
- package/dist/cli/help-text.d.ts +1 -1
- package/dist/cli/help-text.js +1 -0
- package/dist/cli/operation-catalog-snapshot.d.ts +8 -0
- package/dist/cli/operation-catalog-snapshot.js +11 -0
- package/dist/cli/parse-schedule-arguments.js +3 -1
- package/dist/cli/schedule.js +2 -1
- package/dist/cli/types.d.ts +1 -0
- package/dist/cli-main.js +80 -79
- package/dist/client/handle-delegation.d.ts +7 -2
- package/dist/client/handle-delegation.js +9 -1
- package/dist/client/http-client-requests.d.ts +4 -1
- package/dist/client/http-client-requests.js +10 -0
- package/dist/client/http-client.d.ts +10 -4
- package/dist/client/http-client.js +18 -1
- package/dist/client/http-request.d.ts +11 -1
- package/dist/client/http-request.js +17 -7
- package/dist/client/index.d.ts +1 -1
- package/dist/client/interface.d.ts +100 -4
- package/dist/client/local.d.ts +7 -1
- package/dist/client/local.js +17 -2
- package/dist/client/start-body.d.ts +9 -2
- package/dist/client/start-body.js +13 -4
- package/dist/core/byte-arrays.d.ts +5 -0
- package/dist/core/byte-arrays.js +5 -0
- package/dist/core/checkpoint/lifecycle.d.ts +3 -0
- package/dist/core/checkpoint/lifecycle.js +9 -4
- package/dist/core/checkpoint/serialization.js +12 -5
- package/dist/core/codec/extension-codec.d.ts +16 -0
- package/dist/core/codec/extension-codec.js +104 -8
- package/dist/core/codec/index.d.ts +1 -0
- package/dist/core/codec/index.js +1 -0
- package/dist/core/codec/serializer-registry.d.ts +122 -0
- package/dist/core/codec/serializer-registry.js +51 -0
- package/dist/core/context/activity-retry-state.d.ts +38 -0
- package/dist/core/context/activity-retry-state.js +89 -0
- package/dist/core/context/activity-schedule-to-close.d.ts +159 -0
- package/dist/core/context/activity-schedule-to-close.js +69 -0
- package/dist/core/context/child-workflow-pipe.d.ts +5 -5
- package/dist/core/context/child-workflow-pipe.js +15 -2
- package/dist/core/context/context-presence.d.ts +19 -0
- package/dist/core/context/context-presence.js +13 -0
- package/dist/core/context/durable-operations.d.ts +25 -0
- package/dist/core/context/durable-operations.js +64 -0
- package/dist/core/context/index.d.ts +18 -5
- package/dist/core/context/index.js +17 -12
- package/dist/core/context/internals.d.ts +29 -0
- package/dist/core/context/internals.js +6 -1
- package/dist/core/context/operation-request.d.ts +35 -0
- package/dist/core/context/parallel-cache-entry.d.ts +14 -5
- package/dist/core/context/run-operation.d.ts +21 -3
- package/dist/core/context/run-operation.js +56 -93
- package/dist/core/context/session-state.js +7 -8
- package/dist/core/context/speculative-child.js +2 -0
- package/dist/core/context/types.d.ts +15 -0
- package/dist/core/context/version-patching.d.ts +8 -0
- package/dist/core/context/version-patching.js +40 -0
- package/dist/core/context/workflow-logger.d.ts +98 -0
- package/dist/core/context/workflow-logger.js +68 -0
- package/dist/core/engine/activity-heartbeat-tracking.d.ts +64 -0
- package/dist/core/engine/activity-heartbeat-tracking.js +42 -0
- package/dist/core/engine/activity-per-attempt-timeout.d.ts +41 -0
- package/dist/core/engine/activity-per-attempt-timeout.js +36 -0
- package/dist/core/engine/activity-reconciliation.d.ts +1 -0
- package/dist/core/engine/activity-reconciliation.js +12 -1
- package/dist/core/engine/activity-resolution.d.ts +23 -0
- package/dist/core/engine/activity-resolution.js +37 -0
- package/dist/core/engine/aggregate.js +66 -30
- package/dist/core/engine/async-activity-completion.d.ts +23 -6
- package/dist/core/engine/async-activity-completion.js +53 -12
- package/dist/core/engine/attributes-tags.js +9 -4
- package/dist/core/engine/bulk-operations-purge.d.ts +26 -0
- package/dist/core/engine/bulk-operations-purge.js +38 -3
- package/dist/core/engine/bulk-operations-shared.d.ts +2 -0
- package/dist/core/engine/bulk-operations-shared.js +8 -2
- package/dist/core/engine/bulk-operations.d.ts +4 -1
- package/dist/core/engine/bulk-operations.js +235 -24
- package/dist/core/engine/callback-creators-bundles.d.ts +9 -0
- package/dist/core/engine/callback-creators-bundles.js +30 -2
- package/dist/core/engine/callback-creators-core.js +6 -4
- package/dist/core/engine/callback-creators-router.js +10 -0
- package/dist/core/engine/callback-creators-schedule.d.ts +2 -2
- package/dist/core/engine/callback-creators-schedule.js +12 -8
- package/dist/core/engine/candidate-read-batching.d.ts +6 -0
- package/dist/core/engine/candidate-read-batching.js +1 -0
- package/dist/core/engine/checkpoint-io.js +61 -25
- package/dist/core/engine/checkpoint-reads.js +3 -2
- package/dist/core/engine/checkpoint-replay.d.ts +20 -0
- package/dist/core/engine/checkpoint-replay.js +242 -0
- package/dist/core/engine/checkpoint-side-effects.d.ts +23 -0
- package/dist/core/engine/checkpoint-side-effects.js +35 -0
- package/dist/core/engine/child-workflow-cancellation.d.ts +10 -0
- package/dist/core/engine/child-workflow-cancellation.js +40 -0
- package/dist/core/engine/child-workflow.js +27 -4
- package/dist/core/engine/condition-waiters.d.ts +14 -0
- package/dist/core/engine/condition-waiters.js +5 -0
- package/dist/core/engine/construction.d.ts +3 -1
- package/dist/core/engine/construction.js +30 -8
- package/dist/core/engine/coordination-branch-executors.d.ts +70 -0
- package/dist/core/engine/coordination-branch-executors.js +107 -0
- package/dist/core/engine/deferred-consume-envelope.d.ts +59 -0
- package/dist/core/engine/deferred-consume-envelope.js +14 -0
- package/dist/core/engine/disposal.js +25 -0
- package/dist/core/engine/engine-create-types.d.ts +14 -18
- package/dist/core/engine/engine-internal-types.d.ts +38 -3
- package/dist/core/engine/engine-leak-warnings.d.ts +6 -0
- package/dist/core/engine/engine-leak-warnings.js +4 -0
- package/dist/core/engine/engine-runtime-helpers.d.ts +17 -0
- package/dist/core/engine/engine-runtime-helpers.js +26 -5
- package/dist/core/engine/errors.d.ts +121 -0
- package/dist/core/engine/errors.js +45 -1
- package/dist/core/engine/event-log-compaction.d.ts +8 -0
- package/dist/core/engine/event-log-compaction.js +20 -2
- package/dist/core/engine/fenced-write.d.ts +65 -0
- package/dist/core/engine/fenced-write.js +71 -0
- package/dist/core/engine/finalizer-state.d.ts +28 -0
- package/dist/core/engine/finalizer-state.js +16 -0
- package/dist/core/engine/handle-result.js +1 -1
- package/dist/core/engine/handles.d.ts +97 -40
- package/dist/core/engine/handles.js +25 -27
- package/dist/core/engine/index.d.ts +125 -15
- package/dist/core/engine/index.js +207 -11
- package/dist/core/engine/inline-launch-queue.d.ts +14 -0
- package/dist/core/engine/inline-launch-queue.js +32 -7
- package/dist/core/engine/inline-parking.js +3 -2
- package/dist/core/engine/internals.d.ts +125 -13
- package/dist/core/engine/lease-codec.d.ts +35 -0
- package/dist/core/engine/lease-codec.js +32 -0
- package/dist/core/engine/lease-deposition.d.ts +66 -0
- package/dist/core/engine/lease-deposition.js +10 -0
- package/dist/core/engine/lease-errors.d.ts +99 -0
- package/dist/core/engine/lease-errors.js +30 -0
- package/dist/core/engine/lease-manager.d.ts +114 -0
- package/dist/core/engine/lease-manager.js +135 -0
- package/dist/core/engine/lifecycle/fork-helpers.js +1 -7
- package/dist/core/engine/lifecycle/persist.js +15 -52
- package/dist/core/engine/lifecycle/recovered-services.d.ts +8 -6
- package/dist/core/engine/lifecycle/recovered-services.js +18 -3
- package/dist/core/engine/lifecycle/resume.js +39 -11
- package/dist/core/engine/lifecycle/shared.d.ts +8 -1
- package/dist/core/engine/lifecycle/start-batch.d.ts +1 -1
- package/dist/core/engine/lifecycle/start-batch.js +2 -1
- package/dist/core/engine/lifecycle/start-commit.d.ts +56 -0
- package/dist/core/engine/lifecycle/start-commit.js +69 -0
- package/dist/core/engine/lifecycle/start-exec.d.ts +30 -2
- package/dist/core/engine/lifecycle/start-exec.js +38 -0
- package/dist/core/engine/lifecycle/start-or-signal-create.d.ts +58 -0
- package/dist/core/engine/lifecycle/start-or-signal-create.js +95 -0
- package/dist/core/engine/lifecycle/start-or-signal-resolution.d.ts +79 -0
- package/dist/core/engine/lifecycle/start-or-signal-resolution.js +60 -0
- package/dist/core/engine/lifecycle/start-or-signal.d.ts +46 -0
- package/dist/core/engine/lifecycle/start-or-signal.js +71 -0
- package/dist/core/engine/lifecycle/start-terminal-conflict-purge.d.ts +39 -0
- package/dist/core/engine/lifecycle/start-terminal-conflict-purge.js +28 -0
- package/dist/core/engine/lifecycle/start.d.ts +6 -6
- package/dist/core/engine/lifecycle/start.js +47 -45
- package/dist/core/engine/lifecycle/transition.js +17 -5
- package/dist/core/engine/lifecycle.d.ts +3 -2
- package/dist/core/engine/lifecycle.js +9 -2
- package/dist/core/engine/list-candidate-resolution.js +2 -2
- package/dist/core/engine/listing.js +10 -6
- package/dist/core/engine/operations-activity.d.ts +4 -11
- package/dist/core/engine/operations-activity.js +22 -49
- package/dist/core/engine/operations-coordination.d.ts +10 -0
- package/dist/core/engine/operations-coordination.js +43 -8
- package/dist/core/engine/operations-router.d.ts +6 -0
- package/dist/core/engine/operations-router.js +2 -0
- package/dist/core/engine/operations-speculate.js +6 -2
- package/dist/core/engine/operations-stream.js +12 -2
- package/dist/core/engine/operations-time.d.ts +4 -2
- package/dist/core/engine/operations-time.js +14 -2
- package/dist/core/engine/operations-wait-condition.d.ts +23 -0
- package/dist/core/engine/operations-wait-condition.js +62 -0
- package/dist/core/engine/ownership-options.d.ts +23 -0
- package/dist/core/engine/ownership-options.js +26 -0
- package/dist/core/engine/payload-size-policy.d.ts +3 -0
- package/dist/core/engine/payload-size-policy.js +4 -0
- package/dist/core/engine/pending-updates.d.ts +17 -0
- package/dist/core/engine/pending-updates.js +33 -11
- package/dist/core/engine/persisted-data-version.d.ts +5 -9
- package/dist/core/engine/persisted-data-version.js +4 -5
- package/dist/core/engine/queries.js +1 -1
- package/dist/core/engine/registration.d.ts +1 -0
- package/dist/core/engine/registration.js +18 -3
- package/dist/core/engine/schedule-handle.d.ts +45 -0
- package/dist/core/engine/schedule-handle.js +26 -0
- package/dist/core/engine/schedule-jitter.d.ts +5 -0
- package/dist/core/engine/schedule-jitter.js +10 -0
- package/dist/core/engine/schedule-run.d.ts +17 -0
- package/dist/core/engine/schedule-run.js +38 -0
- package/dist/core/engine/schedule-timer.js +81 -17
- package/dist/core/engine/schedules.d.ts +8 -5
- package/dist/core/engine/schedules.js +44 -19
- package/dist/core/engine/search-attribute-records.d.ts +4 -0
- package/dist/core/engine/search-attribute-records.js +17 -0
- package/dist/core/engine/second-instance-detector.d.ts +96 -0
- package/dist/core/engine/second-instance-detector.js +108 -0
- package/dist/core/engine/signals.d.ts +38 -0
- package/dist/core/engine/signals.js +55 -19
- package/dist/core/engine/state-utilities.d.ts +49 -2
- package/dist/core/engine/state-utilities.js +114 -3
- package/dist/core/engine/storage-io.d.ts +16 -2
- package/dist/core/engine/storage-io.js +26 -5
- package/dist/core/engine/stream-chunk-loading.d.ts +2 -0
- package/dist/core/engine/stream-chunk-loading.js +24 -1
- package/dist/core/engine/sub-operation.js +22 -3
- package/dist/core/engine/termination/cleanup.d.ts +28 -1
- package/dist/core/engine/termination/cleanup.js +44 -2
- package/dist/core/engine/termination/complete.js +48 -9
- package/dist/core/engine/termination/finalizer-activity.d.ts +53 -0
- package/dist/core/engine/termination/finalizer-activity.js +30 -0
- package/dist/core/engine/termination/finalizer-claim.d.ts +110 -0
- package/dist/core/engine/termination/finalizer-claim.js +80 -0
- package/dist/core/engine/termination/finalizer.d.ts +48 -0
- package/dist/core/engine/termination/finalizer.js +159 -0
- package/dist/core/engine/termination/suspend.d.ts +70 -0
- package/dist/core/engine/termination/suspend.js +41 -0
- package/dist/core/engine/termination.d.ts +5 -2
- package/dist/core/engine/termination.js +6 -0
- package/dist/core/engine/updates.js +5 -25
- package/dist/core/engine/validation/schedule.d.ts +2 -1
- package/dist/core/engine/validation/schedule.js +51 -2
- package/dist/core/engine/validation.js +54 -3
- package/dist/core/engine/waiting-update-response.d.ts +8 -0
- package/dist/core/engine/waiting-update-response.js +22 -0
- package/dist/core/engine/workflow-concurrency.d.ts +10 -0
- package/dist/core/engine/workflow-concurrency.js +136 -0
- package/dist/core/engine/workflow-feed.d.ts +9 -8
- package/dist/core/engine/workflow-feed.js +4 -1
- package/dist/core/engine/workflow-indexes.d.ts +9 -0
- package/dist/core/engine/workflow-indexes.js +10 -0
- package/dist/core/engine/workflow-state-stream.js +33 -13
- package/dist/core/engine/workflow-visibility-queries.d.ts +2 -2
- package/dist/core/engine-helpers.js +1 -0
- package/dist/core/events/activity-events.d.ts +43 -12
- package/dist/core/events/activity-events.js +28 -0
- package/dist/core/events/attribute-events.d.ts +2 -3
- package/dist/core/events/event-map.d.ts +19 -12
- package/dist/core/events/index.d.ts +1 -0
- package/dist/core/events/index.js +1 -0
- package/dist/core/events/schedule-events.d.ts +71 -0
- package/dist/core/events/schedule-events.js +29 -0
- package/dist/core/events/signal-events.d.ts +4 -6
- package/dist/core/events/system-events.d.ts +29 -19
- package/dist/core/events/system-events.js +26 -0
- package/dist/core/events/update-events.d.ts +6 -8
- package/dist/core/events/workflow-events.d.ts +108 -20
- package/dist/core/events/workflow-events.js +35 -0
- package/dist/core/failure-categories.js +5 -17
- package/dist/core/fault-code.d.ts +9 -3
- package/dist/core/fault-code.js +1 -0
- package/dist/core/inline-execution-strategy.context-options.d.ts +69 -0
- package/dist/core/inline-execution-strategy.context-options.js +56 -0
- package/dist/core/inline-execution-strategy.d.ts +31 -36
- package/dist/core/inline-execution-strategy.js +16 -27
- package/dist/core/list-filter-validation.d.ts +1 -1
- package/dist/core/list-filter-validation.js +2 -1
- package/dist/core/payload-size.d.ts +1 -1
- package/dist/core/persisted-data-incompatible-error.d.ts +9 -7
- package/dist/core/review/events.d.ts +6 -8
- package/dist/core/scheduler/scheduler-class.d.ts +10 -1
- package/dist/core/scheduler/scheduler-class.js +38 -11
- package/dist/core/scheduler/timer-batch.js +9 -1
- package/dist/core/scheduler/timer-sources.d.ts +1 -0
- package/dist/core/scheduler/timer-sources.js +11 -5
- package/dist/core/session-state.d.ts +0 -1
- package/dist/core/session-state.js +2 -2
- package/dist/core/start-workflow-validation.d.ts +56 -0
- package/dist/core/start-workflow-validation.js +30 -1
- package/dist/core/step-context.d.ts +10 -6
- package/dist/core/step-context.js +7 -15
- package/dist/core/types/activity-verification.d.ts +67 -0
- package/dist/core/types/activity-verification.js +0 -0
- package/dist/core/types/activity.d.ts +86 -64
- package/dist/core/types/bulk.d.ts +50 -9
- package/dist/core/types/checkpoint.d.ts +44 -8
- package/dist/core/types/identity.d.ts +8 -1
- package/dist/core/types/launch-metadata.d.ts +33 -0
- package/dist/core/types/launch-metadata.js +0 -0
- package/dist/core/types/list-options.d.ts +146 -0
- package/dist/core/types/list-options.js +0 -0
- package/dist/core/types/message-handles.d.ts +25 -0
- package/dist/core/types/options.d.ts +165 -215
- package/dist/core/types/reviews.d.ts +2 -1
- package/dist/core/types/schedules.d.ts +39 -3
- package/dist/core/types/services-resolution.d.ts +47 -0
- package/dist/core/types/services-resolution.js +0 -0
- package/dist/core/types/state.d.ts +11 -11
- package/dist/core/types/workflow-builder-runtime.d.ts +12 -3
- package/dist/core/types/workflow-builder-runtime.js +11 -2
- package/dist/core/types/workflow-builder.d.ts +47 -15
- package/dist/core/types/workflow-concurrency.d.ts +39 -0
- package/dist/core/types/workflow-concurrency.js +0 -0
- package/dist/core/types/workflow-context.d.ts +157 -14
- package/dist/core/types/workflow-definition.d.ts +53 -10
- package/dist/core/types/workflow-function.d.ts +101 -9
- package/dist/core/types/workflow-log.d.ts +98 -0
- package/dist/core/types/workflow-log.js +0 -0
- package/dist/core/types/workflow-registries.d.ts +14 -3
- package/dist/core/types/workflow-registry.d.ts +3 -0
- package/dist/core/types/workflow-snapshot.d.ts +29 -0
- package/dist/core/types/workflow-snapshot.js +0 -0
- package/dist/core/types.d.ts +7 -0
- package/dist/core/types.js +7 -0
- package/dist/core/versioning.d.ts +9 -39
- package/dist/core/versioning.js +2 -12
- package/dist/core/weft-error.d.ts +44 -1
- package/dist/core/weft-error.js +19 -1
- package/dist/core/worker-execution-strategy-options.d.ts +26 -0
- package/dist/core/worker-execution-strategy.js +40 -36
- package/dist/core/worker-inbound-message.d.ts +38 -0
- package/dist/core/worker-inbound-message.js +37 -0
- package/dist/core/worker-log-abuse-counter.d.ts +175 -0
- package/dist/core/worker-log-abuse-counter.js +107 -0
- package/dist/core/worker-message-helpers.d.ts +47 -0
- package/dist/core/worker-message-helpers.js +26 -0
- package/dist/core/worker-protocol-guard.js +1 -1
- package/dist/core/worker-protocol-log.d.ts +56 -0
- package/dist/core/worker-protocol-log.js +18 -0
- package/dist/core/worker-protocol.d.ts +23 -0
- package/dist/core/worker-protocol.js +12 -2
- package/dist/core/workflow-version-tuple.d.ts +3 -9
- package/dist/core/workflow-version-tuple.js +2 -3
- package/dist/diagnostics/doctor.js +6 -3
- package/dist/diagnostics/format.js +3 -8
- package/dist/diagnostics/types.d.ts +5 -5
- package/dist/diagnostics/validate.d.ts +0 -1
- package/dist/diagnostics/version-check.d.ts +1 -1
- package/dist/diagnostics/version-check.js +10 -13
- package/dist/index.d.ts +13 -11
- package/dist/index.js +39 -4
- package/dist/json-schema.js +3 -3
- package/dist/mcp/cli.js +35 -35
- package/dist/mcp/dispatcher.js +1 -1
- package/dist/mcp/http.js +16 -6
- package/dist/mcp/list-filter.js +2 -1
- package/dist/mcp/protocol.d.ts +2 -0
- package/dist/mcp/protocol.js +1 -1
- package/dist/mcp/session.d.ts +16 -0
- package/dist/mcp/session.js +60 -6
- package/dist/mcp/tools.js +73 -6
- package/dist/observability/index.js +2 -2
- package/dist/server/asyncapi-channels.js +5 -2
- package/dist/server/attribute-filters.d.ts +8 -3
- package/dist/server/attribute-filters.js +6 -1
- package/dist/server/authentication/api-key.d.ts +2 -1
- package/dist/server/authentication/api-key.js +5 -2
- package/dist/server/authentication/constant-time-api-key.d.ts +15 -0
- package/dist/server/authentication/constant-time-api-key.js +24 -0
- package/dist/server/authentication/index.d.ts +1 -1
- package/dist/server/authentication/index.js +7 -4
- package/dist/server/authentication/rotating-api-key-store.d.ts +5 -3
- package/dist/server/authentication/rotating-api-key-store.js +19 -11
- package/dist/server/engine-event-feed-backend.d.ts +4 -5
- package/dist/server/fault-to-http.js +8 -1
- package/dist/server/fault-to-json-rpc.js +1 -0
- package/dist/server/fleet-event-feed.d.ts +31 -0
- package/dist/server/fleet-event-feed.js +157 -0
- package/dist/server/handler/index.js +1 -1
- package/dist/server/handler/response-helpers.js +2 -1
- package/dist/server/handler/route-dispatch.d.ts +6 -3
- package/dist/server/handler/route-dispatch.js +2 -2
- package/dist/server/handler.js +31 -31
- package/dist/server/index.d.ts +32 -2
- package/dist/server/index.js +35 -35
- package/dist/server/interactive-operations.js +1 -0
- package/dist/server/json-rpc-transport-helpers.d.ts +1 -0
- package/dist/server/json-rpc-transport-helpers.js +2 -1
- package/dist/server/json-rpc-websocket-runtime.d.ts +11 -2
- package/dist/server/json-rpc-websocket-runtime.js +1 -0
- package/dist/server/json-rpc-websocket-subscriptions.d.ts +10 -0
- package/dist/server/json-rpc-websocket-subscriptions.js +29 -0
- package/dist/server/json-rpc-websocket-types.d.ts +22 -0
- package/dist/server/json-rpc-websocket-types.js +0 -0
- package/dist/server/json-rpc-websocket-validation.js +20 -4
- package/dist/server/json-rpc-websocket.d.ts +2 -43
- package/dist/server/json-rpc-websocket.js +57 -74
- package/dist/server/openapi.d.ts +2 -1
- package/dist/server/openapi.js +1 -3
- package/dist/server/openrpc-document-schema.d.ts +78 -0
- package/dist/server/openrpc-document-schema.js +27 -1
- package/dist/server/openrpc-errors.d.ts +3 -0
- package/dist/server/openrpc-errors.js +2 -1
- package/dist/server/openrpc.js +32 -0
- package/dist/server/operation-catalog/index.d.ts +1 -1
- package/dist/server/operation-catalog/pipeline-helpers.js +1 -0
- package/dist/server/operation-catalog/pipeline-stages.js +26 -12
- package/dist/server/operation-catalog/pipeline.js +8 -1
- package/dist/server/operation-catalog/registry.js +13 -0
- package/dist/server/operation-catalog/types.d.ts +20 -9
- package/dist/server/operation-fault.d.ts +10 -0
- package/dist/server/operation-fault.js +2 -0
- package/dist/server/operation-registry.d.ts +12 -11
- package/dist/server/operation-registry.js +12 -3
- package/dist/server/operations/aggregate-workflows.d.ts +15 -15
- package/dist/server/operations/async-activity.d.ts +2 -2
- package/dist/server/operations/async-activity.js +12 -7
- package/dist/server/operations/bulk-cancel-workflows.d.ts +1 -1
- package/dist/server/operations/bulk-cancel-workflows.js +2 -2
- package/dist/server/operations/bulk-delete-workflows.d.ts +1 -1
- package/dist/server/operations/bulk-delete-workflows.js +2 -2
- package/dist/server/operations/bulk-filter-helpers.d.ts +8 -6
- package/dist/server/operations/bulk-filter-helpers.js +54 -24
- package/dist/server/operations/bulk-mutate-workflow-tags.d.ts +11 -9
- package/dist/server/operations/bulk-mutate-workflow-tags.js +2 -2
- package/dist/server/operations/bulk-operation-helpers.d.ts +2 -2
- package/dist/server/operations/bulk-retry-failed-workflows.d.ts +7 -0
- package/dist/server/operations/bulk-retry-failed-workflows.js +64 -0
- package/dist/server/operations/bulk-signal-workflows.d.ts +11 -9
- package/dist/server/operations/bulk-signal-workflows.js +2 -2
- package/dist/server/operations/cancel-schedule.d.ts +1 -1
- package/dist/server/operations/create-schedule.d.ts +3 -1
- package/dist/server/operations/create-schedule.js +29 -11
- package/dist/server/operations/fleet-events-subscription.d.ts +54 -0
- package/dist/server/operations/fleet-events-subscription.js +99 -0
- package/dist/server/operations/fork-workflow.d.ts +1 -1
- package/dist/server/operations/fork-workflow.js +3 -2
- package/dist/server/operations/get-checkpoint-at.d.ts +1 -1
- package/dist/server/operations/get-registry.d.ts +1 -1
- package/dist/server/operations/get-retention-overview.d.ts +1 -1
- package/dist/server/operations/get-review.d.ts +1 -1
- package/dist/server/operations/get-schedule.d.ts +1 -1
- package/dist/server/operations/get-stream-chunks.d.ts +1 -1
- package/dist/server/operations/get-system-metrics.d.ts +2 -2
- package/dist/server/operations/get-task-diagnostics.d.ts +45 -6
- package/dist/server/operations/get-task-diagnostics.js +101 -7
- package/dist/server/operations/get-update-result.d.ts +1 -1
- package/dist/server/operations/get-workflow-attributes.d.ts +1 -1
- package/dist/server/operations/get-workflow-events.d.ts +1 -1
- package/dist/server/operations/get-workflow-result.d.ts +1 -1
- package/dist/server/operations/get-workflow-timeline.d.ts +1 -1
- package/dist/server/operations/get-workflow.d.ts +1 -1
- package/dist/server/operations/list-checkpoints.d.ts +1 -1
- package/dist/server/operations/list-reviews.d.ts +1 -1
- package/dist/server/operations/list-schedules.d.ts +1 -1
- package/dist/server/operations/list-task-queues.d.ts +2 -2
- package/dist/server/operations/list-workers.d.ts +2 -2
- package/dist/server/operations/list-workflows.d.ts +1 -1
- package/dist/server/operations/operation-helpers.d.ts +16 -1
- package/dist/server/operations/operation-helpers.js +15 -3
- package/dist/server/operations/pause-schedule.d.ts +1 -1
- package/dist/server/operations/purge-workflows.d.ts +5 -5
- package/dist/server/operations/purge-workflows.js +2 -2
- package/dist/server/operations/query-workflow.d.ts +1 -1
- package/dist/server/operations/query-workflow.js +3 -2
- package/dist/server/operations/recover-all.d.ts +1 -1
- package/dist/server/operations/replay-workflow.d.ts +1 -1
- package/dist/server/operations/resume-schedule.d.ts +1 -1
- package/dist/server/operations/resume-workflow.js +2 -2
- package/dist/server/operations/set-workflow-attributes.d.ts +1 -1
- package/dist/server/operations/set-workflow-attributes.js +6 -3
- package/dist/server/operations/signal-workflow.js +8 -3
- package/dist/server/operations/single-workflow-tag-mutation.js +13 -3
- package/dist/server/operations/start-or-signal-workflow.d.ts +44 -0
- package/dist/server/operations/start-or-signal-workflow.js +130 -0
- package/dist/server/operations/start-workflow-options.d.ts +38 -0
- package/dist/server/operations/start-workflow-options.js +63 -0
- package/dist/server/operations/start-workflow-rest-input.d.ts +14 -0
- package/dist/server/operations/start-workflow-rest-input.js +31 -0
- package/dist/server/operations/start-workflow.d.ts +1 -1
- package/dist/server/operations/start-workflow.js +15 -92
- package/dist/server/operations/storage.d.ts +6 -6
- package/dist/server/operations/storage.js +24 -14
- package/dist/server/operations/stream-workflow-sse.d.ts +1 -1
- package/dist/server/operations/submit-review-decision.d.ts +1 -1
- package/dist/server/operations/submit-review-decision.js +6 -3
- package/dist/server/operations/suspend-workflow.d.ts +13 -0
- package/dist/server/operations/suspend-workflow.js +36 -0
- package/dist/server/operations/update-schedule.d.ts +1 -1
- package/dist/server/operations/update-schedule.js +7 -4
- package/dist/server/operations/update-workflow.d.ts +1 -1
- package/dist/server/operations/update-workflow.js +7 -3
- package/dist/server/operations/worker-drain.d.ts +8 -8
- package/dist/server/operations/worker-drain.js +11 -8
- package/dist/server/operations/workflow-events-subscription.d.ts +7 -8
- package/dist/server/operations/workflow-events-subscription.js +43 -8
- package/dist/server/rest-binding.d.ts +21 -8
- package/dist/server/rest-bindings.js +24 -0
- package/dist/server/rest-body.d.ts +10 -0
- package/dist/server/rest-body.js +80 -0
- package/dist/server/runtime/authentication-bridge.d.ts +1 -0
- package/dist/server/runtime/authentication-bridge.js +33 -6
- package/dist/server/runtime/client-visible-events.d.ts +3 -0
- package/dist/server/runtime/client-visible-events.js +65 -0
- package/dist/server/runtime/context.d.ts +7 -0
- package/dist/server/runtime/event-broadcasting.d.ts +6 -0
- package/dist/server/runtime/event-broadcasting.js +72 -38
- package/dist/server/runtime/retry.d.ts +1 -0
- package/dist/server/runtime/retry.js +14 -0
- package/dist/server/runtime/shutdown.d.ts +7 -6
- package/dist/server/runtime/shutdown.js +6 -1
- package/dist/server/runtime/task-dispatch.js +5 -3
- package/dist/server/runtime/task-polling.d.ts +16 -2
- package/dist/server/runtime/task-polling.js +80 -24
- package/dist/server/runtime/task-reconciliation.js +9 -1
- package/dist/server/runtime/task-result-resolution.d.ts +15 -0
- package/dist/server/runtime/task-result-resolution.js +81 -0
- package/dist/server/runtime/websocket-stream.d.ts +20 -1
- package/dist/server/runtime/websocket-stream.js +173 -7
- package/dist/server/runtime/websocket-upgrade.js +22 -3
- package/dist/server/runtime/websocket-worker.d.ts +1 -1
- package/dist/server/runtime/websocket-worker.js +46 -30
- package/dist/server/serve-internals.d.ts +11 -1
- package/dist/server/serve-internals.js +20 -2
- package/dist/server/task-state.d.ts +38 -0
- package/dist/server/task-state.js +28 -0
- package/dist/server/workflow-event-feed.d.ts +36 -115
- package/dist/server/workflow-event-feed.js +92 -27
- package/dist/service-worker/index.js +31 -31
- package/dist/storage/auto.js +1 -1
- package/dist/storage/bun-sql.js +24 -0
- package/dist/storage/capabilities.d.ts +10 -2
- package/dist/storage/capabilities.js +2 -2
- package/dist/storage/compressed-storage.js +1 -1
- package/dist/storage/default-scope.d.ts +7 -4
- package/dist/storage/http.js +2 -2
- package/dist/storage/index.d.ts +81 -4
- package/dist/storage/indexeddb.js +1 -1
- package/dist/storage/interface.d.ts +189 -0
- package/dist/storage/interface.js +1 -1
- package/dist/storage/key-prefixes.d.ts +1 -1
- package/dist/storage/key-prefixes.js +12 -0
- package/dist/storage/lmdb.d.ts +4 -3
- package/dist/storage/lmdb.js +1 -1
- package/dist/storage/memory.js +1 -1
- package/dist/storage/neon-batch.d.ts +30 -0
- package/dist/storage/neon-batch.js +30 -0
- package/dist/storage/neon-value-mapping.d.ts +74 -0
- package/dist/storage/neon-value-mapping.js +23 -0
- package/dist/storage/neon.d.ts +124 -0
- package/dist/storage/neon.js +15 -0
- package/dist/storage/node-sqlite-loader.d.ts +71 -0
- package/dist/storage/node-sqlite-loader.js +41 -0
- package/dist/storage/node-sqlite.d.ts +1 -19
- package/dist/storage/node-sqlite.js +61 -32
- package/dist/storage/postgres-key-value-queries.d.ts +104 -0
- package/dist/storage/postgres-key-value-queries.js +101 -0
- package/dist/storage/resolve.d.ts +2 -165
- package/dist/storage/resolve.js +1 -1
- package/dist/storage/scoped-storage.js +1 -1
- package/dist/storage/storage-configuration.d.ts +209 -0
- package/dist/storage/storage-configuration.js +0 -0
- package/dist/storage/testing.d.ts +168 -0
- package/dist/storage/testing.js +2 -0
- package/dist/storage/text-value-store.d.ts +9 -9
- package/dist/storage/turso.d.ts +8 -0
- package/dist/storage/turso.js +2 -2
- package/dist/storage/typed-storage.js +1 -1
- package/dist/storage/web-extension.js +1 -1
- package/dist/testing/index.js +35 -35
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/worker/index.js +9 -5
- package/dist/worker/long-poll.js +4 -0
- package/dist/worker/protocol-messages.d.ts +20 -0
- package/dist/worker/protocol-schemas.d.ts +32 -0
- package/dist/worker/protocol-schemas.js +8 -4
- package/dist/worker/protocol-task-result.d.ts +28 -0
- package/dist/worker/protocol-task-result.js +76 -0
- package/dist/worker/protocol.d.ts +4 -15
- package/dist/worker/protocol.js +1 -1
- package/dist/worker/registry/fair-share.d.ts +29 -0
- package/dist/worker/registry/fair-share.js +30 -0
- package/dist/worker/registry/routing.d.ts +18 -0
- package/dist/worker/registry/routing.js +14 -0
- package/dist/worker/registry/types.d.ts +7 -0
- package/dist/worker/registry.d.ts +16 -1
- package/dist/worker/registry.js +24 -36
- package/dist/workers/worker-replay-state.d.ts +32 -0
- package/dist/workers/worker-replay-state.js +35 -0
- package/dist/workers/worker-state-namespace.d.ts +21 -0
- package/dist/workers/worker-state-namespace.js +13 -0
- package/dist/workers/workflow-runner.d.ts +19 -15
- package/dist/workers/workflow-runner.js +72 -60
- package/dist/workers/workflow-worker-entry.js +5 -2
- package/package.json +21 -4
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
KEYS,
|
|
3
|
+
requireStorageCapability
|
|
4
|
+
} from "../../storage/interface.js";
|
|
2
5
|
import {
|
|
3
6
|
ActivityRegistry
|
|
4
7
|
} from "../activity-registry.js";
|
|
5
8
|
import { AtomicState } from "../atomic-state.js";
|
|
9
|
+
import { deserializeCheckpoint } from "../checkpoint.js";
|
|
6
10
|
import { createHandleCacheFinalizer } from "../engine-helpers.js";
|
|
7
11
|
import { ReviewCoordinator } from "../review/index.js";
|
|
8
12
|
import { Scheduler } from "../scheduler.js";
|
|
@@ -23,6 +27,7 @@ import {
|
|
|
23
27
|
cancelAll as cancelAllWorkflows,
|
|
24
28
|
deleteAll as deleteAllWorkflows,
|
|
25
29
|
purge as purgeWorkflows,
|
|
30
|
+
retryFailedAll as retryFailedAllWorkflows,
|
|
26
31
|
signalAll as signalAllWorkflows,
|
|
27
32
|
tagAll as tagAllWorkflows,
|
|
28
33
|
untagAll as untagAllWorkflows
|
|
@@ -63,24 +68,32 @@ import {
|
|
|
63
68
|
import {
|
|
64
69
|
createCleanupIntervalTick,
|
|
65
70
|
createQueuedInlineWorkflowStartHandler,
|
|
71
|
+
createSecondInstanceDetectorResolver,
|
|
72
|
+
drainQueuedInlineWorkflowStartsForEngine,
|
|
66
73
|
isActivityDefinition
|
|
67
74
|
} from "./engine-runtime-helpers.js";
|
|
68
|
-
import { EngineCreateNameMismatchError } from "./errors.js";
|
|
75
|
+
import { EngineCreateNameMismatchError, EngineDisposedError } from "./errors.js";
|
|
76
|
+
import { assertLeaseHeldForEngineWork, commitFencedEngineWrite } from "./fenced-write.js";
|
|
77
|
+
import { recordFinalizerState } from "./finalizer-state.js";
|
|
69
78
|
import {
|
|
70
79
|
createWorkflowHandleWithResultPromise as createWorkflowHandleWithResultPromiseFromInternals,
|
|
71
80
|
getWorkflowResultPromise as getWorkflowResultPromiseFromInternals
|
|
72
81
|
} from "./handle-result.js";
|
|
73
|
-
import { HANDLE_RESULT_PROMISE,
|
|
82
|
+
import { HANDLE_RESULT_PROMISE, WorkflowHandle } from "./handles.js";
|
|
74
83
|
import { hasQueuedInlineWorkflowStart } from "./inline-launch-queue.js";
|
|
75
84
|
import {
|
|
76
85
|
handleStrategyMessage as handleStrategyMessageFromInternals,
|
|
77
86
|
resumeParkedInlineWorkflow as resumeParkedInlineWorkflowFromInternals
|
|
78
87
|
} from "./inline-parking.js";
|
|
79
88
|
import { getInternals, initializeInternals } from "./internals.js";
|
|
89
|
+
import { ENGINE_LEASE_LOST_WARNING_NAME, handleDeposition } from "./lease-deposition.js";
|
|
90
|
+
import { createLeaseManager } from "./lease-manager.js";
|
|
80
91
|
import {
|
|
81
92
|
fork as forkFromLifecycle,
|
|
82
93
|
recoverAll as recoverAllFromLifecycle,
|
|
83
94
|
resume as resumeFromLifecycle,
|
|
95
|
+
startOrSignal as startOrSignalFromLifecycle,
|
|
96
|
+
startWithIdempotency as startWithIdempotencyFromLifecycle,
|
|
84
97
|
startWorkflow as startWorkflowFromLifecycle
|
|
85
98
|
} from "./lifecycle.js";
|
|
86
99
|
import {
|
|
@@ -114,15 +127,21 @@ import {
|
|
|
114
127
|
listReviews as listReviewsFromInternals,
|
|
115
128
|
submitReview as submitReviewFromInternals
|
|
116
129
|
} from "./reviews.js";
|
|
130
|
+
import { ScheduleHandle } from "./schedule-handle.js";
|
|
117
131
|
import {
|
|
118
132
|
cancelSchedule as cancelScheduleFromInternals,
|
|
119
133
|
listSchedules as listSchedulesFromInternals,
|
|
120
134
|
pauseSchedule as pauseScheduleFromInternals,
|
|
135
|
+
recoverOrphanedScheduleTimers,
|
|
121
136
|
resumeSchedule as resumeScheduleFromInternals,
|
|
122
137
|
schedule as scheduleFromInternals,
|
|
123
138
|
toScheduleSummary,
|
|
124
139
|
updateSchedule as updateScheduleFromInternals
|
|
125
140
|
} from "./schedules.js";
|
|
141
|
+
import {
|
|
142
|
+
createSecondInstanceDetectionTick,
|
|
143
|
+
createSecondInstanceDetector
|
|
144
|
+
} from "./second-instance-detector.js";
|
|
126
145
|
import { signal as signalWorkflow } from "./signals.js";
|
|
127
146
|
import { loadScheduleState, loadWorkflowState } from "./storage-io.js";
|
|
128
147
|
import {
|
|
@@ -134,6 +153,7 @@ import {
|
|
|
134
153
|
cancelWorkflow as cancelWorkflowFromTermination,
|
|
135
154
|
cleanupWaiters as cleanupWaitersFromTermination,
|
|
136
155
|
finalizePendingTimelineEntry,
|
|
156
|
+
suspendWorkflow as suspendWorkflowFromTermination,
|
|
137
157
|
timeoutWorkflow as timeoutWorkflowFromTermination
|
|
138
158
|
} from "./termination.js";
|
|
139
159
|
import {
|
|
@@ -159,13 +179,24 @@ export {
|
|
|
159
179
|
BulkOperationConfirmationError,
|
|
160
180
|
EngineCreateNameMismatchError,
|
|
161
181
|
EngineDisposedError,
|
|
182
|
+
IdempotencyKeyPurgedError,
|
|
162
183
|
PersistedDataIncompatibleError,
|
|
184
|
+
StartOrSignalConflictError,
|
|
163
185
|
WorkflowAlreadyExistsError,
|
|
186
|
+
WorkflowConcurrencyLimitExceededError,
|
|
164
187
|
WorkflowNotFoundError,
|
|
165
188
|
WorkflowNotRegisteredError,
|
|
189
|
+
WorkflowSuspendNotSupportedError,
|
|
190
|
+
WorkflowTeardownPendingError,
|
|
166
191
|
WorkflowTypeNotRegisteredForRecoveryError
|
|
167
192
|
} from "./errors.js";
|
|
168
|
-
export { HANDLE_RESULT_PROMISE,
|
|
193
|
+
export { HANDLE_RESULT_PROMISE, WorkflowHandle } from "./handles.js";
|
|
194
|
+
export {
|
|
195
|
+
EngineLeaseAcquisitionTimeoutError,
|
|
196
|
+
EngineLeaseCorruptedError,
|
|
197
|
+
EngineLeaseNotHeldError
|
|
198
|
+
} from "./lease-errors.js";
|
|
199
|
+
export { ScheduleHandle } from "./schedule-handle.js";
|
|
169
200
|
export {
|
|
170
201
|
clearEngineLeakWarningTokenForTesting,
|
|
171
202
|
getEngineLeakCollectionCountForTesting,
|
|
@@ -175,13 +206,15 @@ export {
|
|
|
175
206
|
shouldEmitEngineLeakWarningForTesting
|
|
176
207
|
} from "./engine-leak-warnings.js";
|
|
177
208
|
export { assertCompatiblePersistedDataVersion };
|
|
178
|
-
export const ENGINE_PARKED_WORKFLOW_COUNT_FOR_TESTING = Symbol("engineParkedWorkflowCountForTesting"), ENGINE_SIGNAL_WAITER_COUNT_FOR_TESTING = Symbol("engineSignalWaiterCountForTesting");
|
|
209
|
+
export const ENGINE_PARKED_WORKFLOW_COUNT_FOR_TESTING = Symbol("engineParkedWorkflowCountForTesting"), ENGINE_SIGNAL_WAITER_COUNT_FOR_TESTING = Symbol("engineSignalWaiterCountForTesting"), ENGINE_SLEEP_RESOLVER_COUNT_FOR_TESTING = Symbol("engineSleepResolverCountForTesting");
|
|
210
|
+
|
|
211
|
+
export { ENGINE_LEASE_LOST_WARNING_NAME };
|
|
179
212
|
|
|
180
213
|
export class Engine extends EventTarget {
|
|
181
214
|
static async create(options) {
|
|
182
215
|
const engine = new Engine(options);
|
|
183
216
|
try {
|
|
184
|
-
await assertCompatiblePersistedDataVersion(getInternals(engine).storage
|
|
217
|
+
await assertCompatiblePersistedDataVersion(getInternals(engine).storage);
|
|
185
218
|
for (const [name, definition] of definitionEntries(options.activities)) {
|
|
186
219
|
if (name !== definition.name)
|
|
187
220
|
throw new EngineCreateNameMismatchError("activity", name, definition.name);
|
|
@@ -192,6 +225,7 @@ export class Engine extends EventTarget {
|
|
|
192
225
|
throw new EngineCreateNameMismatchError("workflow", name, definition.name);
|
|
193
226
|
engine.register(definition);
|
|
194
227
|
}
|
|
228
|
+
await engine.#acquireLeaseIfConfigured();
|
|
195
229
|
if (options.recover !== !1)
|
|
196
230
|
await engine.recoverAll(options.acknowledgeUnknownWorkflowTypes !== void 0 ? { acknowledgeUnknownWorkflowTypes: options.acknowledgeUnknownWorkflowTypes } : {});
|
|
197
231
|
} catch (error) {
|
|
@@ -215,7 +249,9 @@ export class Engine extends EventTarget {
|
|
|
215
249
|
getComposedWorkflowInterceptor: () => getComposedWorkflowInterceptor(getInternals(this)),
|
|
216
250
|
resolveWorkflowType: this.#resolveWorkflowTypeTarget.bind(this),
|
|
217
251
|
registerCancelHandler: (workflowId, handler) => registerCancelHandler(getInternals(this), workflowId, handler),
|
|
218
|
-
|
|
252
|
+
recordFinalizerState: (workflowId, value) => recordFinalizerState(getInternals(this), workflowId, value),
|
|
253
|
+
getWorkflowServices: (workflowId) => getInternals(this).workflowServices.get(workflowId),
|
|
254
|
+
getLogSink: () => resolvedOptions.onLog ?? void 0
|
|
219
255
|
});
|
|
220
256
|
getInternals(this).storage = storage;
|
|
221
257
|
getInternals(this).abortController = new AbortController;
|
|
@@ -224,6 +260,7 @@ export class Engine extends EventTarget {
|
|
|
224
260
|
getInternals(this).resultResolvers = new Map;
|
|
225
261
|
getInternals(this).signalWaiters = new Map;
|
|
226
262
|
getInternals(this).signalWaitersByWorkflow = new Map;
|
|
263
|
+
getInternals(this).conditionWaiters = new Map;
|
|
227
264
|
getInternals(this).updateWaiters = new Map;
|
|
228
265
|
getInternals(this).updateWaitersByWorkflow = new Map;
|
|
229
266
|
getInternals(this).sleepResolvers = new Map;
|
|
@@ -250,7 +287,8 @@ export class Engine extends EventTarget {
|
|
|
250
287
|
getInternals(this).scheduler = new Scheduler({
|
|
251
288
|
storage,
|
|
252
289
|
onTimerFired: (entry) => handleTimerFiredFromInternals(getInternals(this), entry, this.#createTimeOperationCallbacks()),
|
|
253
|
-
getNow
|
|
290
|
+
getNow,
|
|
291
|
+
commitTimerCleanup: (operations) => commitFencedEngineWrite(getInternals(this), operations, [], () => Error("Timer cleanup lost its fenced CAS race"))
|
|
254
292
|
});
|
|
255
293
|
getInternals(this).strategy = strategyBundle.strategy;
|
|
256
294
|
getInternals(this).inlineStrategy = strategyBundle.inlineStrategy;
|
|
@@ -263,8 +301,10 @@ export class Engine extends EventTarget {
|
|
|
263
301
|
if (queuedInlineWorkflowStartChannel !== null)
|
|
264
302
|
queuedInlineWorkflowStartChannel.port1.onmessage = createQueuedInlineWorkflowStartHandler(weakEngine, queuedInlineWorkflowStartChannel);
|
|
265
303
|
getInternals(this).heartbeatDetails = new Map;
|
|
304
|
+
getInternals(this).lastHeartbeatDetailsByStep = new Map;
|
|
266
305
|
getInternals(this).workflowServices = new Map;
|
|
267
306
|
getInternals(this).pendingAsyncActivities = new Map;
|
|
307
|
+
getInternals(this).pendingAsyncActivityResolutions = new Map;
|
|
268
308
|
getInternals(this).pendingStarts = new Set;
|
|
269
309
|
getInternals(this).pendingScheduleCreations = new Set;
|
|
270
310
|
getInternals(this).workflowsNeedingTerminalCleanup = new Set;
|
|
@@ -275,14 +315,17 @@ export class Engine extends EventTarget {
|
|
|
275
315
|
getInternals(this).workflowReviewIds = new Map;
|
|
276
316
|
getInternals(this).parkedInlineWorkflows = new Set;
|
|
277
317
|
getInternals(this).terminalizingWorkflows = new Set;
|
|
318
|
+
getInternals(this).deliveredPendingUpdateIds = new Map;
|
|
278
319
|
getInternals(this).cancelHandlersByWorkflow = new Map;
|
|
279
320
|
getInternals(this).reviewTimerIds = new Map;
|
|
280
321
|
getInternals(this).pendingWebhooks = new Set;
|
|
281
322
|
getInternals(this).pendingTimelineEntries = new Map;
|
|
323
|
+
getInternals(this).pendingAtomicWorkflowCommitSideEffects = new Map;
|
|
282
324
|
getInternals(this).cleanupIntervalDisposalTracker = null;
|
|
283
325
|
const cleanupIntervalDisposalTracker = {
|
|
284
326
|
disposed: !1,
|
|
285
327
|
cleanupInterval: null,
|
|
328
|
+
secondInstanceDetectionInterval: null,
|
|
286
329
|
testToken: consumeNextEngineLeakWarningTokenForTesting()
|
|
287
330
|
}, cleanupInterval = setInterval(createCleanupIntervalTick(weakEngine, cleanupIntervalDisposalTracker), 60000);
|
|
288
331
|
cleanupIntervalDisposalTracker.cleanupInterval = cleanupInterval;
|
|
@@ -292,13 +335,109 @@ export class Engine extends EventTarget {
|
|
|
292
335
|
getInternals(this).retentionSweepInterval = null;
|
|
293
336
|
getInternals(this).retentionSweepInFlight = null;
|
|
294
337
|
getInternals(this).nextRetentionSweepAt = null;
|
|
338
|
+
getInternals(this).secondInstanceDetectionInterval = null;
|
|
339
|
+
getInternals(this).secondInstanceDetector = null;
|
|
340
|
+
getInternals(this).leaseManager = null;
|
|
341
|
+
getInternals(this).inFlightLeaseAcquire = null;
|
|
342
|
+
getInternals(this).deposed = !1;
|
|
343
|
+
getInternals(this).tearDownAfterDeposition = () => {
|
|
344
|
+
this.#disposeAfterDeposition();
|
|
345
|
+
};
|
|
295
346
|
getInternals(this).eventLogHeads = new Map;
|
|
296
347
|
getInternals(this).workflowFeedListeners = new Map;
|
|
297
348
|
getInternals(this).workflowVersionTuples = new Map;
|
|
349
|
+
getInternals(this).workflowVisibilityWatermark = void 0;
|
|
350
|
+
getInternals(this).workflowVisibilityWatermarkExpiresAt = void 0;
|
|
298
351
|
getInternals(this).activityWorkerDispatcher = createActivityWorkerDispatcher(options?.activityExecution);
|
|
299
352
|
getInternals(this).strategy.onMessage(this.#handleStrategyMessage.bind(this));
|
|
300
353
|
getInternals(this).alertManager = createAlertManagerForEngine(this, options?.alerts, getNow);
|
|
301
354
|
this.#ensureRetentionSweepInterval();
|
|
355
|
+
this.#startSecondInstanceDetection();
|
|
356
|
+
}
|
|
357
|
+
addEventListener(type, listener, options) {
|
|
358
|
+
super.addEventListener(type, listener, options);
|
|
359
|
+
}
|
|
360
|
+
removeEventListener(type, listener, options) {
|
|
361
|
+
super.removeEventListener(type, listener, options);
|
|
362
|
+
}
|
|
363
|
+
async#acquireLeaseIfConfigured() {
|
|
364
|
+
const internals = getInternals(this);
|
|
365
|
+
if (internals.options.ownershipMode !== "lease")
|
|
366
|
+
return;
|
|
367
|
+
if (internals.disposed)
|
|
368
|
+
throw new EngineDisposedError;
|
|
369
|
+
if (internals.inFlightLeaseAcquire !== null) {
|
|
370
|
+
await internals.inFlightLeaseAcquire;
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (internals.leaseManager !== null)
|
|
374
|
+
return;
|
|
375
|
+
requireStorageCapability(internals.storage, "conditionalBatch", "ownership: 'lease'");
|
|
376
|
+
const manager = createLeaseManager({
|
|
377
|
+
storage: internals.storage,
|
|
378
|
+
holderId: crypto.randomUUID(),
|
|
379
|
+
getNow: internals.options.getNow,
|
|
380
|
+
ttlMs: internals.options.leaseTtlMs,
|
|
381
|
+
renewIntervalMs: internals.options.leaseRenewIntervalMs,
|
|
382
|
+
waitTimeoutMs: internals.options.leaseWaitTimeoutMs,
|
|
383
|
+
onLeaseLost: (reason) => {
|
|
384
|
+
if (reason === "deposed") {
|
|
385
|
+
handleDeposition(internals);
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
process.emitWarning("engine ownership lease renewal could not be confirmed (transient storage error); another instance may take over if this persists. Weft supports one engine process " + "per store \u2014 keep infrastructure-level single-instance enforcement in place.", ENGINE_LEASE_LOST_WARNING_NAME);
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
internals.leaseManager = manager;
|
|
392
|
+
const acquisition = (async () => {
|
|
393
|
+
try {
|
|
394
|
+
await manager.acquire();
|
|
395
|
+
} catch (error) {
|
|
396
|
+
if (internals.leaseManager === manager)
|
|
397
|
+
internals.leaseManager = null;
|
|
398
|
+
throw error;
|
|
399
|
+
}
|
|
400
|
+
if (internals.disposed) {
|
|
401
|
+
await manager.release();
|
|
402
|
+
if (internals.leaseManager === manager)
|
|
403
|
+
internals.leaseManager = null;
|
|
404
|
+
throw new EngineDisposedError;
|
|
405
|
+
}
|
|
406
|
+
manager.startRenewal();
|
|
407
|
+
})();
|
|
408
|
+
internals.inFlightLeaseAcquire = acquisition;
|
|
409
|
+
try {
|
|
410
|
+
await acquisition;
|
|
411
|
+
} finally {
|
|
412
|
+
if (internals.inFlightLeaseAcquire === acquisition)
|
|
413
|
+
internals.inFlightLeaseAcquire = null;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
#disposeAfterDeposition() {
|
|
417
|
+
const internals = getInternals(this);
|
|
418
|
+
if (internals.disposed)
|
|
419
|
+
return;
|
|
420
|
+
const leaseManager = internals.leaseManager;
|
|
421
|
+
disposeEngine(internals);
|
|
422
|
+
leaseManager?.release().catch(() => {});
|
|
423
|
+
}
|
|
424
|
+
#startSecondInstanceDetection() {
|
|
425
|
+
const internals = getInternals(this);
|
|
426
|
+
if (!internals.options.secondInstanceDetectionEnabled)
|
|
427
|
+
return;
|
|
428
|
+
const detector = createSecondInstanceDetector({
|
|
429
|
+
storage: internals.storage,
|
|
430
|
+
instanceId: crypto.randomUUID(),
|
|
431
|
+
getNow: internals.options.getNow,
|
|
432
|
+
intervalMs: internals.options.secondInstanceHeartbeatIntervalMs
|
|
433
|
+
});
|
|
434
|
+
internals.secondInstanceDetector = detector;
|
|
435
|
+
const tracker = internals.cleanupIntervalDisposalTracker;
|
|
436
|
+
if (tracker === null)
|
|
437
|
+
return;
|
|
438
|
+
const weakEngine = new WeakRef(this), detectionInterval = setInterval(createSecondInstanceDetectionTick(createSecondInstanceDetectorResolver(weakEngine), tracker), internals.options.secondInstanceHeartbeatIntervalMs);
|
|
439
|
+
internals.secondInstanceDetectionInterval = detectionInterval;
|
|
440
|
+
tracker.secondInstanceDetectionInterval = detectionInterval;
|
|
302
441
|
}
|
|
303
442
|
#hasConfiguredRetention() {
|
|
304
443
|
return hasConfiguredRetention(getInternals(this));
|
|
@@ -400,8 +539,21 @@ export class Engine extends EventTarget {
|
|
|
400
539
|
return getInternals(this).activityRegistry.listDefinitions();
|
|
401
540
|
}
|
|
402
541
|
async start(type, input, options) {
|
|
542
|
+
assertLeaseHeldForEngineWork(getInternals(this));
|
|
543
|
+
if (options?.idempotencyKey !== void 0)
|
|
544
|
+
return startWithIdempotencyFromLifecycle(getInternals(this), type, input, options, this.#createLifecycleCallbacks());
|
|
403
545
|
return startWorkflowFromLifecycle(getInternals(this), type, input, options, void 0, this.#createLifecycleCallbacks());
|
|
404
546
|
}
|
|
547
|
+
async startOrSignal(type, input, signal, options) {
|
|
548
|
+
assertLeaseHeldForEngineWork(getInternals(this));
|
|
549
|
+
return startOrSignalFromLifecycle(getInternals(this), type, input, signal, options, this.#createStartOrSignalCallbacks());
|
|
550
|
+
}
|
|
551
|
+
#createStartOrSignalCallbacks() {
|
|
552
|
+
return {
|
|
553
|
+
...this.#createLifecycleCallbacks(),
|
|
554
|
+
signalExistingWorkflow: (workflowId, signalName, payload, signalId) => this.signal(workflowId, signalName, payload, { signalId })
|
|
555
|
+
};
|
|
556
|
+
}
|
|
405
557
|
getHandle(workflowId) {
|
|
406
558
|
const entry = getInternals(this).handleCache.get(workflowId);
|
|
407
559
|
if (entry) {
|
|
@@ -426,6 +578,9 @@ export class Engine extends EventTarget {
|
|
|
426
578
|
async cancelAll(filter, options) {
|
|
427
579
|
return cancelAllWorkflows(getInternals(this), filter, options);
|
|
428
580
|
}
|
|
581
|
+
async retryFailedAll(filter, options) {
|
|
582
|
+
return retryFailedAllWorkflows(getInternals(this), filter, options);
|
|
583
|
+
}
|
|
429
584
|
async signalAll(filter, name, payloadOrOptions, options) {
|
|
430
585
|
if (options === void 0)
|
|
431
586
|
return signalAllWorkflows(getInternals(this), filter, name, payloadOrOptions);
|
|
@@ -446,7 +601,8 @@ export class Engine extends EventTarget {
|
|
|
446
601
|
return scheduleFromInternals(getInternals(this), workflowType, definition.input, definitionSpec, {
|
|
447
602
|
...definition.id !== void 0 && { id: definition.id },
|
|
448
603
|
...definition.overlapPolicy !== void 0 && { overlap: definition.overlapPolicy },
|
|
449
|
-
...definition.backfill !== void 0 && { backfill: definition.backfill }
|
|
604
|
+
...definition.backfill !== void 0 && { backfill: definition.backfill },
|
|
605
|
+
...definition.jitter !== void 0 && { jitter: definition.jitter }
|
|
450
606
|
});
|
|
451
607
|
}
|
|
452
608
|
if (spec === void 0)
|
|
@@ -481,6 +637,9 @@ export class Engine extends EventTarget {
|
|
|
481
637
|
[ENGINE_SIGNAL_WAITER_COUNT_FOR_TESTING]() {
|
|
482
638
|
return getInternals(this).signalWaiters.size;
|
|
483
639
|
}
|
|
640
|
+
[ENGINE_SLEEP_RESOLVER_COUNT_FOR_TESTING]() {
|
|
641
|
+
return getInternals(this).sleepResolvers.size;
|
|
642
|
+
}
|
|
484
643
|
async signal(workflowId, nameOrDefinition, payload, options) {
|
|
485
644
|
return signalWorkflow(getInternals(this), workflowId, messageName(nameOrDefinition), payload, {
|
|
486
645
|
loadWorkflowState: (id) => loadWorkflowState(getInternals(this), id),
|
|
@@ -503,24 +662,39 @@ export class Engine extends EventTarget {
|
|
|
503
662
|
return getOffloadFromInternals(getInternals(this), workflowId, key);
|
|
504
663
|
}
|
|
505
664
|
async fork(sourceWorkflowId, options) {
|
|
665
|
+
assertLeaseHeldForEngineWork(getInternals(this));
|
|
506
666
|
return forkFromLifecycle(getInternals(this), sourceWorkflowId, options, this.#createLifecycleCallbacks());
|
|
507
667
|
}
|
|
508
668
|
async resume(workflowId) {
|
|
669
|
+
assertLeaseHeldForEngineWork(getInternals(this));
|
|
509
670
|
return resumeFromLifecycle(getInternals(this), workflowId, this.#createLifecycleCallbacks());
|
|
510
671
|
}
|
|
511
672
|
async recoverAll(options) {
|
|
673
|
+
await this.#acquireLeaseIfConfigured();
|
|
674
|
+
if (getInternals(this).disposed)
|
|
675
|
+
throw new EngineDisposedError;
|
|
512
676
|
await recoverPendingAsyncActivities(getInternals(this));
|
|
677
|
+
await recoverOrphanedScheduleTimers(getInternals(this));
|
|
513
678
|
return recoverAllFromLifecycle(getInternals(this), this.#createLifecycleCallbacks(), options);
|
|
514
679
|
}
|
|
515
680
|
async completeAsyncActivity(token, result) {
|
|
516
|
-
await completeAsyncActivityFromInternals(getInternals(this), token, result,
|
|
681
|
+
await completeAsyncActivityFromInternals(getInternals(this), token, result, {
|
|
682
|
+
feedOperationResult: (workflowId, outcome) => feedOperationResult(getInternals(this), workflowId, outcome),
|
|
683
|
+
finalizeTimeline: (workflowId, status, output) => finalizePendingTimelineEntry(getInternals(this), workflowId, status, output)
|
|
684
|
+
});
|
|
517
685
|
}
|
|
518
686
|
async failAsyncActivity(token, error) {
|
|
519
|
-
await failAsyncActivityFromInternals(getInternals(this), token, error,
|
|
687
|
+
await failAsyncActivityFromInternals(getInternals(this), token, error, {
|
|
688
|
+
feedOperationResult: (workflowId, outcome, originalReason) => feedOperationResult(getInternals(this), workflowId, outcome, originalReason),
|
|
689
|
+
finalizeTimeline: (workflowId, status, output) => finalizePendingTimelineEntry(getInternals(this), workflowId, status, output)
|
|
690
|
+
});
|
|
520
691
|
}
|
|
521
692
|
async cancel(workflowId) {
|
|
522
693
|
await cancelWorkflowFromTermination(getInternals(this), workflowId, this.#createTerminationCallbacks());
|
|
523
694
|
}
|
|
695
|
+
async suspend(workflowId) {
|
|
696
|
+
await suspendWorkflowFromTermination(getInternals(this), workflowId, this.#createTerminationCallbacks());
|
|
697
|
+
}
|
|
524
698
|
async timeout(workflowId) {
|
|
525
699
|
await timeoutWorkflowFromTermination(getInternals(this), workflowId, this.#createTerminationCallbacks());
|
|
526
700
|
}
|
|
@@ -530,6 +704,15 @@ export class Engine extends EventTarget {
|
|
|
530
704
|
return { ...state, status: "pending" };
|
|
531
705
|
return state;
|
|
532
706
|
}
|
|
707
|
+
async getCurrentCheckpointStep(workflowId) {
|
|
708
|
+
const inMemory = getInternals(this).checkpoints.get(workflowId);
|
|
709
|
+
if (inMemory !== void 0)
|
|
710
|
+
return inMemory.step;
|
|
711
|
+
const bytes = await getInternals(this).storage.get(KEYS.checkpoint(workflowId));
|
|
712
|
+
if (bytes === null)
|
|
713
|
+
return null;
|
|
714
|
+
return deserializeCheckpoint(bytes).step;
|
|
715
|
+
}
|
|
533
716
|
async getAttributes(workflowId) {
|
|
534
717
|
return getWorkflowAttributes(getInternals(this), workflowId);
|
|
535
718
|
}
|
|
@@ -584,9 +767,22 @@ export class Engine extends EventTarget {
|
|
|
584
767
|
return submitCoordinatedUpdateFromInternals(getInternals(this), workflowId, name, payload, options, this.#createUpdateCallbacks());
|
|
585
768
|
}
|
|
586
769
|
[Symbol.dispose]() {
|
|
770
|
+
const leaseManager = getInternals(this).leaseManager;
|
|
587
771
|
disposeEngine(getInternals(this));
|
|
772
|
+
leaseManager?.release();
|
|
588
773
|
}
|
|
589
774
|
async[Symbol.asyncDispose]() {
|
|
775
|
+
if (!getInternals(this).disposed) {
|
|
776
|
+
const leaseManager = getInternals(this).leaseManager;
|
|
777
|
+
try {
|
|
778
|
+
await drainQueuedInlineWorkflowStartsForEngine(this);
|
|
779
|
+
} finally {
|
|
780
|
+
disposeEngine(getInternals(this));
|
|
781
|
+
await getInternals(this).inFlightLeaseAcquire?.catch(() => {});
|
|
782
|
+
await leaseManager?.release();
|
|
783
|
+
}
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
590
786
|
this[Symbol.dispose]();
|
|
591
787
|
}
|
|
592
788
|
get storage() {
|
|
@@ -9,6 +9,20 @@ export declare function queueInlineWorkflowExecutionStart(internals: EngineInter
|
|
|
9
9
|
export declare function flushQueuedInlineWorkflowStarts(internals: EngineInternals, callbacks: InlineLaunchQueueCallbacks): Promise<void>;
|
|
10
10
|
/** Used by scheduler-driven direct backfill flushes. Clears the scheduled flag first. */
|
|
11
11
|
export declare function flushQueuedInlineWorkflowStartsDirectly(internals: EngineInternals, callbacks: InlineLaunchQueueCallbacks): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Drain every pending inline launch before engine teardown. Called from
|
|
14
|
+
* `[Symbol.asyncDispose]` *before* `disposeEngine` aborts the signal, so the
|
|
15
|
+
* flush actually executes the queued starts (the abort check in
|
|
16
|
+
* {@link flushQueuedInlineWorkflowStarts} would otherwise discard them). This
|
|
17
|
+
* turns a deferred-launch macrotask into work that completes before
|
|
18
|
+
* `asyncDispose` returns, so a disposed engine leaves no dangling pending
|
|
19
|
+
* launch — the fix for the test-runner macrotask-starvation footgun.
|
|
20
|
+
*
|
|
21
|
+
* A queued start that was already aborted (signal set before this is reached)
|
|
22
|
+
* is left for the synchronous `disposeQueuedInlineWorkflowStarts` path, which
|
|
23
|
+
* discards it and settles its `defer: false` awaiter.
|
|
24
|
+
*/
|
|
25
|
+
export declare function drainQueuedInlineWorkflowStarts(internals: EngineInternals, callbacks: InlineLaunchQueueCallbacks): Promise<void>;
|
|
12
26
|
export declare function dropQueuedInlineWorkflowStart(internals: EngineInternals, workflowId: string): boolean;
|
|
13
27
|
export declare function disposeQueuedInlineWorkflowStarts(internals: EngineInternals): void;
|
|
14
28
|
export declare function hasQueuedInlineWorkflowStart(internals: EngineInternals, workflowId: string): boolean;
|
|
@@ -17,9 +17,18 @@ export function queueInlineWorkflowExecutionStart(internals, start, callbacks) {
|
|
|
17
17
|
callbacks.swallowPromiseRejection(flushQueuedInlineWorkflowStarts(internals, callbacks));
|
|
18
18
|
}, 0);
|
|
19
19
|
}
|
|
20
|
+
function settleDiscardedInlineStarts(internals, discarded) {
|
|
21
|
+
for (const start of discarded) {
|
|
22
|
+
internals.queuedInlineWorkflowStartIds.delete(start.workflowId);
|
|
23
|
+
internals.queuedOrLaunchingInlineWorkflowStartIds.delete(start.workflowId);
|
|
24
|
+
start.onStarted?.();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
20
27
|
export async function flushQueuedInlineWorkflowStarts(internals, callbacks) {
|
|
21
28
|
if (internals.abortController.signal.aborted) {
|
|
29
|
+
const discarded = internals.queuedInlineWorkflowStarts;
|
|
22
30
|
internals.queuedInlineWorkflowStarts = [];
|
|
31
|
+
settleDiscardedInlineStarts(internals, discarded);
|
|
23
32
|
return;
|
|
24
33
|
}
|
|
25
34
|
if (internals.queuedInlineWorkflowStarts.length === 0)
|
|
@@ -27,12 +36,21 @@ export async function flushQueuedInlineWorkflowStarts(internals, callbacks) {
|
|
|
27
36
|
const pendingStarts = internals.queuedInlineWorkflowStarts;
|
|
28
37
|
internals.queuedInlineWorkflowStarts = [];
|
|
29
38
|
for (const start of pendingStarts)
|
|
30
|
-
await startQueuedInlineWorkflowExecution(internals, start, callbacks);
|
|
39
|
+
await callbacks.swallowPromiseRejection(startQueuedInlineWorkflowExecution(internals, start, callbacks));
|
|
31
40
|
}
|
|
32
41
|
export async function flushQueuedInlineWorkflowStartsDirectly(internals, callbacks) {
|
|
33
42
|
internals.queuedInlineWorkflowStartFlushScheduled = !1;
|
|
34
43
|
await flushQueuedInlineWorkflowStarts(internals, callbacks);
|
|
35
44
|
}
|
|
45
|
+
export async function drainQueuedInlineWorkflowStarts(internals, callbacks) {
|
|
46
|
+
internals.queuedInlineWorkflowStartFlushScheduled = !1;
|
|
47
|
+
let passes = 0;
|
|
48
|
+
const maxPasses = 1000;
|
|
49
|
+
while (internals.queuedInlineWorkflowStarts.length > 0 && !internals.abortController.signal.aborted && passes < maxPasses) {
|
|
50
|
+
passes += 1;
|
|
51
|
+
await callbacks.swallowPromiseRejection(flushQueuedInlineWorkflowStarts(internals, callbacks));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
36
54
|
async function startQueuedInlineWorkflowExecution(internals, start, callbacks) {
|
|
37
55
|
try {
|
|
38
56
|
const state = await loadWorkflowState(internals, start.workflowId);
|
|
@@ -45,22 +63,29 @@ async function startQueuedInlineWorkflowExecution(internals, start, callbacks) {
|
|
|
45
63
|
} finally {
|
|
46
64
|
internals.queuedInlineWorkflowStartIds.delete(start.workflowId);
|
|
47
65
|
internals.queuedOrLaunchingInlineWorkflowStartIds.delete(start.workflowId);
|
|
66
|
+
start.onStarted?.();
|
|
48
67
|
}
|
|
49
68
|
}
|
|
50
69
|
export function dropQueuedInlineWorkflowStart(internals, workflowId) {
|
|
51
70
|
if (internals.queuedInlineWorkflowStarts.length === 0)
|
|
52
71
|
return !1;
|
|
53
|
-
const initialLength = internals.queuedInlineWorkflowStarts.length;
|
|
54
|
-
internals.queuedInlineWorkflowStarts = internals.queuedInlineWorkflowStarts.filter((start) =>
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
const initialLength = internals.queuedInlineWorkflowStarts.length, dropped = [];
|
|
73
|
+
internals.queuedInlineWorkflowStarts = internals.queuedInlineWorkflowStarts.filter((start) => {
|
|
74
|
+
if (start.workflowId === workflowId) {
|
|
75
|
+
dropped.push(start);
|
|
76
|
+
return !1;
|
|
77
|
+
}
|
|
78
|
+
return !0;
|
|
79
|
+
});
|
|
80
|
+
if (internals.queuedInlineWorkflowStarts.length !== initialLength)
|
|
81
|
+
settleDiscardedInlineStarts(internals, dropped);
|
|
59
82
|
return internals.queuedInlineWorkflowStarts.length !== initialLength;
|
|
60
83
|
}
|
|
61
84
|
export function disposeQueuedInlineWorkflowStarts(internals) {
|
|
62
85
|
internals.queuedInlineWorkflowStartFlushScheduled = !1;
|
|
86
|
+
const discarded = internals.queuedInlineWorkflowStarts;
|
|
63
87
|
internals.queuedInlineWorkflowStarts = [];
|
|
88
|
+
settleDiscardedInlineStarts(internals, discarded);
|
|
64
89
|
internals.queuedInlineWorkflowStartIds.clear();
|
|
65
90
|
internals.queuedOrLaunchingInlineWorkflowStartIds.clear();
|
|
66
91
|
const channel = internals.queuedInlineWorkflowStartChannel;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { hasExposedAccessors, hasUpdateHandlers } from "../context/context-presence.js";
|
|
1
2
|
import {
|
|
2
3
|
resumeWorkflowFromStorage as resumeWorkflowFromStorageFromLifecycle
|
|
3
4
|
} from "./lifecycle.js";
|
|
@@ -9,7 +10,7 @@ export async function parkInlineWorkflowAfterCheckpoint(internals, workflowId, o
|
|
|
9
10
|
if (operation.type !== "wait-signal" || internals.inlineStrategy === null)
|
|
10
11
|
return !1;
|
|
11
12
|
const inlineStrategy = internals.inlineStrategy, context = inlineStrategy.getContext(workflowId);
|
|
12
|
-
if (context
|
|
13
|
+
if (context && (hasUpdateHandlers(context) || hasExposedAccessors(context)))
|
|
13
14
|
return !1;
|
|
14
15
|
if (await callbacks.hasBufferedSignal(workflowId, operation.signalName))
|
|
15
16
|
return !1;
|
|
@@ -17,7 +18,7 @@ export async function parkInlineWorkflowAfterCheckpoint(internals, workflowId, o
|
|
|
17
18
|
const latestState = await callbacks.loadWorkflowState(workflowId);
|
|
18
19
|
if (internals.terminalizingWorkflows.has(workflowId) || !latestState || latestState.status !== "running")
|
|
19
20
|
return !1;
|
|
20
|
-
inlineStrategy.parkWorkflow(workflowId);
|
|
21
|
+
inlineStrategy.parkWorkflow(workflowId, { retainContext: !0 });
|
|
21
22
|
internals.parkedInlineWorkflows.add(workflowId);
|
|
22
23
|
return !0;
|
|
23
24
|
}))
|