@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,20 +1,18 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import {
|
|
3
|
+
IdempotencyKeyPurgedError,
|
|
3
4
|
WorkflowAlreadyExistsError,
|
|
4
5
|
WorkflowNotRegisteredError
|
|
5
6
|
} from "../../core/engine/errors.js";
|
|
6
7
|
import { runtimeWorkflowEngine } from "../../core/runtime-workflow-engine.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
assertExclusiveStartWorkflowOptions,
|
|
10
|
-
coerceStartWorkflowDuration,
|
|
11
|
-
coerceStartWorkflowId,
|
|
12
|
-
coerceStartWorkflowTags,
|
|
13
|
-
coerceStartWorkflowTimestamp,
|
|
14
|
-
StartWorkflowValidationError
|
|
15
|
-
} from "../../core/start-workflow-validation.js";
|
|
8
|
+
import { StartWorkflowValidationError } from "../../core/start-workflow-validation.js";
|
|
16
9
|
import { defineOperation } from "../operation-registry.js";
|
|
17
10
|
import { invalidParamsFault, shapeRestFault } from "./operation-helpers.js";
|
|
11
|
+
import { buildSharedStartWorkflowOptions } from "./start-workflow-options.js";
|
|
12
|
+
import {
|
|
13
|
+
extractSharedStartWorkflowRestFields,
|
|
14
|
+
parseStartWorkflowRequestRecord
|
|
15
|
+
} from "./start-workflow-rest-input.js";
|
|
18
16
|
const startWorkflowInput = z.object({
|
|
19
17
|
type: z.unknown().describe("Workflow type name. Runtime validation requires a non-empty string."),
|
|
20
18
|
input: z.unknown().optional(),
|
|
@@ -34,7 +32,7 @@ function validateStartWorkflowInput(input, lookupSearchAttributeSchema) {
|
|
|
34
32
|
const type = input.type;
|
|
35
33
|
let options;
|
|
36
34
|
try {
|
|
37
|
-
options =
|
|
35
|
+
options = buildSharedStartWorkflowOptions(input, lookupSearchAttributeSchema(type));
|
|
38
36
|
} catch (error) {
|
|
39
37
|
const message = error instanceof Error ? error.message : String(error);
|
|
40
38
|
throw invalidParamsFault(message);
|
|
@@ -44,12 +42,12 @@ function validateStartWorkflowInput(input, lookupSearchAttributeSchema) {
|
|
|
44
42
|
function resolveStartWorkflowAccess(error) {
|
|
45
43
|
const message = error instanceof Error ? error.message : String(error);
|
|
46
44
|
if (error instanceof WorkflowNotRegisteredError)
|
|
47
|
-
throw invalidParamsFault(message);
|
|
48
|
-
if (error instanceof WorkflowAlreadyExistsError)
|
|
45
|
+
throw invalidParamsFault(message, error.code);
|
|
46
|
+
if (error instanceof WorkflowAlreadyExistsError || error instanceof IdempotencyKeyPurgedError)
|
|
49
47
|
throw {
|
|
50
48
|
code: "Conflict",
|
|
51
49
|
message,
|
|
52
|
-
data: { reason: message }
|
|
50
|
+
data: { reason: message, weftCode: error.code }
|
|
53
51
|
};
|
|
54
52
|
if (error instanceof StartWorkflowValidationError)
|
|
55
53
|
throw invalidParamsFault(message);
|
|
@@ -63,7 +61,7 @@ export const startWorkflowOperation = defineOperation({
|
|
|
63
61
|
name: "weft.workflows.start",
|
|
64
62
|
mcpExposable: !1,
|
|
65
63
|
summary: "Start a new workflow",
|
|
66
|
-
description: "Start a new workflow execution of a registered type. Requires `type` (the registered workflow type name) and accepts an optional `input` payload plus start options: `id` (client-supplied workflow id), `executionTimeout`, `startAt`/`startAfter` (mutually exclusive scheduling), `tags`, and `searchAttributes`. Returns the workflow `id`. Faults with InvalidParams for an unregistered type or malformed options, and Conflict when a workflow with the same id already exists.",
|
|
64
|
+
description: "Start a new workflow execution of a registered type. Requires `type` (the registered workflow type name) and accepts an optional `input` payload plus start options: `id` (client-supplied workflow id), `executionTimeout`, `startAt`/`startAfter` (mutually exclusive scheduling), `tags`, `idempotencyKey` (at-most-once dedup: a repeated key returns the existing run instead of starting a second), and `searchAttributes`. Returns the workflow `id`. Faults with InvalidParams for an unregistered type or malformed options, and Conflict when a workflow with the same id already exists or the supplied `idempotencyKey` has been spent (its run was purged or swept by retention).",
|
|
67
65
|
destructive: !1,
|
|
68
66
|
tags: ["Workflows"],
|
|
69
67
|
inputSchema: startWorkflowInput,
|
|
@@ -82,63 +80,7 @@ export const startWorkflowOperation = defineOperation({
|
|
|
82
80
|
resolveStartWorkflowAccess(error);
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
|
-
})
|
|
86
|
-
function buildStartWorkflowOptions(input, searchAttributeSchema) {
|
|
87
|
-
const options = {};
|
|
88
|
-
if (input.id !== void 0)
|
|
89
|
-
options.id = coerceStartWorkflowId(input.id, 'Field "id"');
|
|
90
|
-
if (input.executionTimeout !== void 0)
|
|
91
|
-
options.executionTimeout = coerceStartWorkflowDuration(input.executionTimeout, 'Field "executionTimeout"');
|
|
92
|
-
if (input.startAt !== void 0)
|
|
93
|
-
options.startAt = coerceStartWorkflowTimestamp(input.startAt, 'Field "startAt"');
|
|
94
|
-
if (input.startAfter !== void 0)
|
|
95
|
-
options.startAfter = coerceStartWorkflowDuration(input.startAfter, 'Field "startAfter"');
|
|
96
|
-
if (input.tags !== void 0)
|
|
97
|
-
options.tags = coerceStartWorkflowTags(input.tags, 'Field "tags"');
|
|
98
|
-
if (input.idempotencyKey !== void 0)
|
|
99
|
-
throw new StartWorkflowValidationError("idempotencyKey is not supported over HttpClient because the start workflow HTTP protocol does not implement start idempotency");
|
|
100
|
-
if (input.searchAttributes !== void 0)
|
|
101
|
-
options.searchAttributes = coerceStartWorkflowSearchAttributes(input.searchAttributes, 'Field "searchAttributes"', searchAttributeSchema);
|
|
102
|
-
assertExclusiveStartWorkflowOptions(options.startAt, options.startAfter);
|
|
103
|
-
return options;
|
|
104
|
-
}
|
|
105
|
-
function coerceStartWorkflowSearchAttributes(value, fieldName, schema) {
|
|
106
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
107
|
-
throw new StartWorkflowValidationError(`${fieldName} must be an object`);
|
|
108
|
-
const attributes = Object.create(null);
|
|
109
|
-
for (const [key, attributeValue] of Object.entries(value)) {
|
|
110
|
-
const coercedValue = coerceStartWorkflowSearchAttributeValue(key, attributeValue, fieldName, schema);
|
|
111
|
-
attributes[key] = coercedValue;
|
|
112
|
-
}
|
|
113
|
-
return attributes;
|
|
114
|
-
}
|
|
115
|
-
function coerceStartWorkflowSearchAttributeValue(key, value, fieldName, schema) {
|
|
116
|
-
if (!isSearchAttributeValue(value))
|
|
117
|
-
throw new StartWorkflowValidationError(`${fieldName}.${key} must be a string, number, boolean, Date, or string array`);
|
|
118
|
-
if (schema === void 0)
|
|
119
|
-
return value;
|
|
120
|
-
const definition = schema[key];
|
|
121
|
-
if (definition === void 0)
|
|
122
|
-
throw new StartWorkflowValidationError(`Unknown search attribute "${key}". Registered attributes: ${Object.keys(schema).join(", ")}`);
|
|
123
|
-
const normalizedValue = definition.type === "string" && definition.format === "date-time" && typeof value === "string" ? coerceDateTimeSearchAttribute(key, value, fieldName) : value;
|
|
124
|
-
try {
|
|
125
|
-
validateAttributeType(key, normalizedValue, definition);
|
|
126
|
-
} catch (error) {
|
|
127
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
128
|
-
throw new StartWorkflowValidationError(message);
|
|
129
|
-
}
|
|
130
|
-
return normalizedValue;
|
|
131
|
-
}
|
|
132
|
-
function coerceDateTimeSearchAttribute(key, value, fieldName) {
|
|
133
|
-
const date = new Date(value);
|
|
134
|
-
if (Number.isNaN(date.getTime()))
|
|
135
|
-
throw new StartWorkflowValidationError(`${fieldName}.${key} must be a valid date-time string`);
|
|
136
|
-
return date;
|
|
137
|
-
}
|
|
138
|
-
function isSearchAttributeValue(value) {
|
|
139
|
-
return typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value instanceof Date || Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
140
|
-
}
|
|
141
|
-
export const startWorkflowRestBinding = {
|
|
83
|
+
}), startWorkflowRestBinding = {
|
|
142
84
|
method: "POST",
|
|
143
85
|
path: "/v1/workflows",
|
|
144
86
|
pathParamNames: [],
|
|
@@ -154,27 +96,8 @@ export const startWorkflowRestBinding = {
|
|
|
154
96
|
idempotencyKey: { kind: "body-field", bodyField: "idempotencyKey" },
|
|
155
97
|
searchAttributes: { kind: "body-field", bodyField: "searchAttributes" }
|
|
156
98
|
},
|
|
157
|
-
extractInput: async (request) => {
|
|
158
|
-
|
|
159
|
-
try {
|
|
160
|
-
body = await request.json();
|
|
161
|
-
} catch {
|
|
162
|
-
throw invalidParamsFault("Invalid JSON body");
|
|
163
|
-
}
|
|
164
|
-
if (typeof body !== "object" || body === null)
|
|
165
|
-
throw invalidParamsFault("Request body must be a JSON object");
|
|
166
|
-
const record = body;
|
|
167
|
-
return {
|
|
168
|
-
type: record.type,
|
|
169
|
-
input: record.input,
|
|
170
|
-
id: record.id,
|
|
171
|
-
executionTimeout: record.executionTimeout,
|
|
172
|
-
startAt: record.startAt,
|
|
173
|
-
startAfter: record.startAfter,
|
|
174
|
-
tags: record.tags,
|
|
175
|
-
idempotencyKey: record.idempotencyKey,
|
|
176
|
-
searchAttributes: record.searchAttributes
|
|
177
|
-
};
|
|
99
|
+
extractInput: async (request, _pathParams, context) => {
|
|
100
|
+
return extractSharedStartWorkflowRestFields(await parseStartWorkflowRequestRecord(request, context));
|
|
178
101
|
},
|
|
179
102
|
success: { kind: "json", status: 201 },
|
|
180
103
|
shapeFault: shapeRestFault
|
|
@@ -60,14 +60,14 @@ export type StorageConditionalBatchInput = z.infer<typeof storageConditionalBatc
|
|
|
60
60
|
export type StorageConditionalBatchOutput = z.infer<typeof storageConditionalBatchOutput>;
|
|
61
61
|
export declare const storageGetOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
62
62
|
key: string;
|
|
63
|
-
}, Uint8Array<ArrayBufferLike> | null>;
|
|
63
|
+
}, Uint8Array<ArrayBufferLike> | null, unknown>;
|
|
64
64
|
export declare const storagePutOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
65
65
|
key: string;
|
|
66
66
|
value: Uint8Array<ArrayBuffer>;
|
|
67
|
-
}, null>;
|
|
67
|
+
}, null, unknown>;
|
|
68
68
|
export declare const storageDeleteOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
69
69
|
key: string;
|
|
70
|
-
}, null>;
|
|
70
|
+
}, null, unknown>;
|
|
71
71
|
export declare const storageScanOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
72
72
|
prefix: string;
|
|
73
73
|
limit?: number | undefined;
|
|
@@ -76,7 +76,7 @@ export declare const storageScanOperation: import("../operation-catalog.ts").Ope
|
|
|
76
76
|
gte?: string | undefined;
|
|
77
77
|
lt?: string | undefined;
|
|
78
78
|
lte?: string | undefined;
|
|
79
|
-
}, StorageScanOutput>;
|
|
79
|
+
}, StorageScanOutput, unknown>;
|
|
80
80
|
export declare const storageBatchOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
81
81
|
operations: ({
|
|
82
82
|
type: "put";
|
|
@@ -86,7 +86,7 @@ export declare const storageBatchOperation: import("../operation-catalog.ts").Op
|
|
|
86
86
|
type: "delete";
|
|
87
87
|
key: string;
|
|
88
88
|
})[];
|
|
89
|
-
}, null>;
|
|
89
|
+
}, null, unknown>;
|
|
90
90
|
export declare const storageConditionalBatchOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
91
91
|
conditions: {
|
|
92
92
|
key: string;
|
|
@@ -102,7 +102,7 @@ export declare const storageConditionalBatchOperation: import("../operation-cata
|
|
|
102
102
|
})[];
|
|
103
103
|
}, {
|
|
104
104
|
applied: boolean;
|
|
105
|
-
}>;
|
|
105
|
+
}, unknown>;
|
|
106
106
|
export declare const storageGetRestBinding: UnknownRestBinding;
|
|
107
107
|
export declare const storagePutRestBinding: UnknownRestBinding;
|
|
108
108
|
export declare const storageDeleteRestBinding: UnknownRestBinding;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { copyBytesToArrayBuffer } from "../../core/byte-arrays.js";
|
|
2
3
|
import { decodeBase64ToBytes, encodeBytesToBase64 } from "../../storage/byte-encoding.js";
|
|
3
4
|
import {
|
|
5
|
+
MAX_BATCH_OPERATIONS,
|
|
6
|
+
MAX_SCAN_LIMIT,
|
|
7
|
+
storageBatch,
|
|
4
8
|
storageConditionalBatch
|
|
5
9
|
} from "../../storage/interface.js";
|
|
6
10
|
import { raiseFault } from "../operation-catalog.js";
|
|
7
11
|
import { defineOperation } from "../operation-registry.js";
|
|
8
12
|
import { isAuthenticated } from "../principal.js";
|
|
9
|
-
import {
|
|
13
|
+
import { readRestBodyBounded, readRestJsonBody } from "../rest-body.js";
|
|
14
|
+
import { invalidParamsFault, isOperationFault, shapeRestFault } from "./operation-helpers.js";
|
|
10
15
|
const storageReadAccess = {
|
|
11
16
|
kind: "scoped",
|
|
12
17
|
scopes: { kind: "anyOf", scopes: ["storage:read", "storage:admin"] }
|
|
@@ -26,7 +31,7 @@ const storageReadAccess = {
|
|
|
26
31
|
jsonRpcWebSocket: !1
|
|
27
32
|
}, binaryValueSchema = z.instanceof(Uint8Array).meta({ type: "string", format: "binary" }), storageGetInput = z.object({ key: z.string().min(1) }), storagePutInput = z.object({ key: z.string().min(1), value: binaryValueSchema }), storageDeleteInput = z.object({ key: z.string().min(1) }), storageScanInput = z.object({
|
|
28
33
|
prefix: z.string(),
|
|
29
|
-
limit: z.number().int().positive().optional(),
|
|
34
|
+
limit: z.number().int().positive().max(MAX_SCAN_LIMIT).optional(),
|
|
30
35
|
reverse: z.boolean().optional(),
|
|
31
36
|
gt: z.string().optional(),
|
|
32
37
|
gte: z.string().optional(),
|
|
@@ -38,9 +43,11 @@ const storageReadAccess = {
|
|
|
38
43
|
]), storageConditionInput = z.object({
|
|
39
44
|
key: z.string().min(1),
|
|
40
45
|
expectedValue: z.string().nullable()
|
|
41
|
-
}), storageBatchInput = z.object({
|
|
42
|
-
|
|
43
|
-
|
|
46
|
+
}), storageBatchInput = z.object({
|
|
47
|
+
operations: z.array(storageBatchOperationInput).max(MAX_BATCH_OPERATIONS)
|
|
48
|
+
}), storageConditionalBatchInput = z.object({
|
|
49
|
+
conditions: z.array(storageConditionInput).max(MAX_BATCH_OPERATIONS),
|
|
50
|
+
operations: z.array(storageBatchOperationInput).max(MAX_BATCH_OPERATIONS)
|
|
44
51
|
}), emptyOutput = z.null(), storageGetOutput = binaryValueSchema.nullable(), storageScanOutput = z.custom((value) => typeof value === "object" && value !== null && (Symbol.asyncIterator in value) && typeof value[Symbol.asyncIterator] === "function", "Storage scan output must be an async iterable."), storageConditionalBatchOutput = z.object({ applied: z.boolean() });
|
|
45
52
|
function resolveAuthorizedStorage(engine, principal, operation) {
|
|
46
53
|
if (!isAuthenticated(principal))
|
|
@@ -89,10 +96,12 @@ function decodeCondition(condition) {
|
|
|
89
96
|
expectedValue: condition.expectedValue === null ? null : decodeStorageBytes(condition.expectedValue, "Storage conditional batch expectedValue must be base64.")
|
|
90
97
|
};
|
|
91
98
|
}
|
|
92
|
-
async function readJsonRequestBody(request) {
|
|
99
|
+
async function readJsonRequestBody(request, context) {
|
|
93
100
|
try {
|
|
94
|
-
return await request
|
|
95
|
-
} catch {
|
|
101
|
+
return await readRestJsonBody(request, context);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (isOperationFault(error))
|
|
104
|
+
throw error;
|
|
96
105
|
throw invalidParamsFault("Request body must be valid JSON.");
|
|
97
106
|
}
|
|
98
107
|
}
|
|
@@ -137,7 +146,7 @@ function createNoContentResponse() {
|
|
|
137
146
|
function createBinaryResponse(value) {
|
|
138
147
|
if (value === null)
|
|
139
148
|
return new Response(null, { status: 404 });
|
|
140
|
-
return new Response(value, {
|
|
149
|
+
return new Response(copyBytesToArrayBuffer(value), {
|
|
141
150
|
status: 200,
|
|
142
151
|
headers: { "Content-Type": "application/octet-stream" }
|
|
143
152
|
});
|
|
@@ -246,7 +255,8 @@ export const storageGetOperation = defineOperation({
|
|
|
246
255
|
transports: httpOnlyStorageTransports,
|
|
247
256
|
unknownKeyPolicy: { http: "strip", jsonRpc: "reject" },
|
|
248
257
|
invoke: async ({ input, engine, principal }) => {
|
|
249
|
-
|
|
258
|
+
const storage = resolveAuthorizedStorage(engine, principal, storageBatchOperation);
|
|
259
|
+
await storageBatch(storage, input.operations.map(decodeBatchOperation));
|
|
250
260
|
return null;
|
|
251
261
|
}
|
|
252
262
|
}), storageConditionalBatchOperation = defineOperation({
|
|
@@ -293,9 +303,9 @@ export const storageGetOperation = defineOperation({
|
|
|
293
303
|
key: { kind: "path", pathParam: "key" },
|
|
294
304
|
value: { kind: "body", mediaType: "application/octet-stream" }
|
|
295
305
|
},
|
|
296
|
-
extractInput: async (request, pathParams) => ({
|
|
306
|
+
extractInput: async (request, pathParams, context) => ({
|
|
297
307
|
key: storageKeyFromPath(pathParams),
|
|
298
|
-
value:
|
|
308
|
+
value: await readRestBodyBounded(request, context)
|
|
299
309
|
}),
|
|
300
310
|
success: { kind: "empty", status: 204 },
|
|
301
311
|
shapeSuccess: createNoContentResponse,
|
|
@@ -338,7 +348,7 @@ export const storageGetOperation = defineOperation({
|
|
|
338
348
|
inputSources: {
|
|
339
349
|
operations: { kind: "body-field", bodyField: "operations" }
|
|
340
350
|
},
|
|
341
|
-
extractInput: async (request) => readJsonRequestBody(request),
|
|
351
|
+
extractInput: async (request, _pathParams, context) => readJsonRequestBody(request, context),
|
|
342
352
|
success: { kind: "empty", status: 204 },
|
|
343
353
|
shapeSuccess: createNoContentResponse,
|
|
344
354
|
shapeFault: shapeRestFault
|
|
@@ -351,7 +361,7 @@ export const storageGetOperation = defineOperation({
|
|
|
351
361
|
conditions: { kind: "body-field", bodyField: "conditions" },
|
|
352
362
|
operations: { kind: "body-field", bodyField: "operations" }
|
|
353
363
|
},
|
|
354
|
-
extractInput: async (request) => readJsonRequestBody(request),
|
|
364
|
+
extractInput: async (request, _pathParams, context) => readJsonRequestBody(request, context),
|
|
355
365
|
success: { kind: "json", status: 200 },
|
|
356
366
|
shapeSuccess: (output) => Response.json(output),
|
|
357
367
|
shapeFault: shapeRestFault
|
|
@@ -12,6 +12,6 @@ export type StreamWorkflowSseOutput = {
|
|
|
12
12
|
export declare const streamWorkflowSseOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
13
13
|
workflowId: string;
|
|
14
14
|
after?: unknown;
|
|
15
|
-
}, StreamWorkflowSseOutput>;
|
|
15
|
+
}, StreamWorkflowSseOutput, unknown>;
|
|
16
16
|
export declare const streamWorkflowSseRestBinding: UnknownRestBinding;
|
|
17
17
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineOperation } from "../operation-registry.js";
|
|
3
|
-
import {
|
|
3
|
+
import { readRestJsonBody } from "../rest-body.js";
|
|
4
|
+
import { isOperationFault, shapeRestFault } from "./operation-helpers.js";
|
|
4
5
|
const VALID_DECISIONS = [
|
|
5
6
|
"approved",
|
|
6
7
|
"rejected",
|
|
@@ -95,8 +96,10 @@ export const submitReviewDecisionRestBinding = {
|
|
|
95
96
|
feedback: { kind: "body-field", bodyField: "feedback" },
|
|
96
97
|
workflowId: { kind: "body-field", bodyField: "workflowId" }
|
|
97
98
|
},
|
|
98
|
-
extractInput: async (request, pathParams) => {
|
|
99
|
-
const body = await request
|
|
99
|
+
extractInput: async (request, pathParams, context) => {
|
|
100
|
+
const body = await readRestJsonBody(request, context).catch((error) => {
|
|
101
|
+
if (isOperationFault(error))
|
|
102
|
+
throw error;
|
|
100
103
|
throw Error("Invalid JSON body");
|
|
101
104
|
}), record = typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
|
|
102
105
|
return {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { UnknownRestBinding } from '../rest-bindings.ts';
|
|
3
|
+
declare const suspendWorkflowInput: z.ZodObject<{
|
|
4
|
+
workflowId: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
declare const suspendWorkflowOutput: z.ZodUndefined;
|
|
7
|
+
export type SuspendWorkflowInput = z.infer<typeof suspendWorkflowInput>;
|
|
8
|
+
export type SuspendWorkflowOutput = z.infer<typeof suspendWorkflowOutput>;
|
|
9
|
+
export declare const suspendWorkflowOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
10
|
+
workflowId: string;
|
|
11
|
+
}, undefined>;
|
|
12
|
+
export declare const suspendWorkflowRestBinding: UnknownRestBinding;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { WorkflowSuspendNotSupportedError } from "../../core/engine/errors.js";
|
|
3
|
+
import { shapeRestFault } from "./operation-helpers.js";
|
|
4
|
+
import {
|
|
5
|
+
createSingleWorkflowControlOperation,
|
|
6
|
+
extractWorkflowIdFromPath
|
|
7
|
+
} from "./single-workflow-control-operation.js";
|
|
8
|
+
const suspendWorkflowInput = z.object({
|
|
9
|
+
workflowId: z.string().min(1)
|
|
10
|
+
}), suspendWorkflowOutput = z.undefined();
|
|
11
|
+
export const suspendWorkflowOperation = createSingleWorkflowControlOperation({
|
|
12
|
+
name: "weft.workflows.suspend",
|
|
13
|
+
summary: "Suspend a running workflow",
|
|
14
|
+
description: "Request suspension of a running workflow by `id` without terminating it. The workflow transitions to the non-terminal `suspended` status, keeps its durable checkpoint, and is later resumable via `resume`. Unlike cancellation, suspension does not run cancel handlers and does not settle the result. Suspending a workflow that is not running is a no-op. Faults with Unprocessable when the engine runs in worker execution mode (which cannot pause a run without cancelling it).",
|
|
15
|
+
destructive: !1,
|
|
16
|
+
tags: ["Workflows"],
|
|
17
|
+
inputSchema: suspendWorkflowInput,
|
|
18
|
+
outputSchema: suspendWorkflowOutput,
|
|
19
|
+
producibleFaults: ["Unprocessable"],
|
|
20
|
+
invoke: async ({ input, engine }) => {
|
|
21
|
+
await engine.suspend(input.workflowId);
|
|
22
|
+
return;
|
|
23
|
+
},
|
|
24
|
+
mapErrorToFault: ({ error, message }) => error instanceof WorkflowSuspendNotSupportedError ? { code: "Unprocessable", message, data: { reason: message } } : void 0
|
|
25
|
+
}), suspendWorkflowRestBinding = {
|
|
26
|
+
method: "POST",
|
|
27
|
+
path: "/v1/workflows/:id/suspend",
|
|
28
|
+
pathParamNames: ["id"],
|
|
29
|
+
operationName: "weft.workflows.suspend",
|
|
30
|
+
inputSources: {
|
|
31
|
+
workflowId: { kind: "path", pathParam: "id" }
|
|
32
|
+
},
|
|
33
|
+
extractInput: async (_request, pathParams) => extractWorkflowIdFromPath(pathParams),
|
|
34
|
+
success: { kind: "empty", status: 204 },
|
|
35
|
+
shapeFault: shapeRestFault
|
|
36
|
+
};
|
|
@@ -10,6 +10,6 @@ export declare const updateScheduleOperation: import("../operation-catalog.ts").
|
|
|
10
10
|
scheduleId: string;
|
|
11
11
|
cronExpression?: unknown;
|
|
12
12
|
every?: unknown;
|
|
13
|
-
}, null>;
|
|
13
|
+
}, null, unknown>;
|
|
14
14
|
export declare const updateScheduleRestBinding: UnknownRestBinding;
|
|
15
15
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { defineOperation } from "../operation-registry.js";
|
|
3
|
-
import {
|
|
3
|
+
import { readRestJsonBody } from "../rest-body.js";
|
|
4
|
+
import { invalidParamsFault, isOperationFault, shapeRestFault } from "./operation-helpers.js";
|
|
4
5
|
import { mapScheduleErrorToFault, validateScheduleInputCadence } from "./schedule-faults.js";
|
|
5
6
|
const updateScheduleInput = z.object({
|
|
6
7
|
scheduleId: z.string().min(1),
|
|
@@ -39,11 +40,13 @@ export const updateScheduleOperation = defineOperation({
|
|
|
39
40
|
cronExpression: { kind: "body-field", bodyField: "cronExpression" },
|
|
40
41
|
every: { kind: "body-field", bodyField: "every" }
|
|
41
42
|
},
|
|
42
|
-
extractInput: async (request, pathParams) => {
|
|
43
|
+
extractInput: async (request, pathParams, context) => {
|
|
43
44
|
let body;
|
|
44
45
|
try {
|
|
45
|
-
body = await request
|
|
46
|
-
} catch {
|
|
46
|
+
body = await readRestJsonBody(request, context);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
if (isOperationFault(error))
|
|
49
|
+
throw error;
|
|
47
50
|
throw invalidParamsFault("Invalid JSON body");
|
|
48
51
|
}
|
|
49
52
|
if (typeof body !== "object" || body === null)
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
WorkflowTerminalError
|
|
6
6
|
} from "../../core/updates.js";
|
|
7
7
|
import { defineOperation } from "../operation-registry.js";
|
|
8
|
+
import { readRestJsonBody } from "../rest-body.js";
|
|
8
9
|
import { isOperationFault, shapeRestFault } from "./operation-helpers.js";
|
|
9
10
|
const DEFAULT_UPDATE_TIMEOUT_MS = 30000, updateWorkflowInput = z.object({
|
|
10
11
|
workflowId: z.string().min(1),
|
|
@@ -85,17 +86,20 @@ export const updateWorkflowOperation = defineOperation({
|
|
|
85
86
|
timeout: { kind: "body-field", bodyField: "timeout" },
|
|
86
87
|
idempotencyKey: { kind: "body-field", bodyField: "idempotencyKey" }
|
|
87
88
|
},
|
|
88
|
-
extractInput: async (request, pathParams) => {
|
|
89
|
+
extractInput: async (request, pathParams, context) => {
|
|
89
90
|
let payload, timeout, idempotencyKey;
|
|
90
91
|
try {
|
|
91
|
-
const body = await request
|
|
92
|
+
const body = await readRestJsonBody(request, context);
|
|
92
93
|
if (typeof body === "object" && body !== null) {
|
|
93
94
|
const record = body;
|
|
94
95
|
payload = record.payload;
|
|
95
96
|
timeout = record.timeout;
|
|
96
97
|
idempotencyKey = record.idempotencyKey;
|
|
97
98
|
}
|
|
98
|
-
} catch {
|
|
99
|
+
} catch (error) {
|
|
100
|
+
if (isOperationFault(error))
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
99
103
|
return {
|
|
100
104
|
workflowId: pathParams.id ?? "",
|
|
101
105
|
updateName: pathParams.name ?? "",
|
|
@@ -37,31 +37,31 @@ type WorkerDrainOperationOptions = {
|
|
|
37
37
|
export declare function createDrainWorkerOperation(options?: WorkerDrainOperationOptions): import("../operation-catalog.ts").OperationDefinition<{
|
|
38
38
|
workerId: string;
|
|
39
39
|
reason?: string | undefined;
|
|
40
|
-
}, WorkerDrainMutationResult>;
|
|
40
|
+
}, WorkerDrainMutationResult, unknown>;
|
|
41
41
|
export declare function createClearWorkerDrainOperation(options?: WorkerDrainOperationOptions): import("../operation-catalog.ts").OperationDefinition<{
|
|
42
42
|
workerId: string;
|
|
43
|
-
}, WorkerDrainMutationResult>;
|
|
43
|
+
}, WorkerDrainMutationResult, unknown>;
|
|
44
44
|
export declare function createDrainDeploymentOperation(options?: WorkerDrainOperationOptions): import("../operation-catalog.ts").OperationDefinition<{
|
|
45
45
|
deploymentName: string;
|
|
46
46
|
reason?: string | undefined;
|
|
47
|
-
}, WorkerDrainMutationResult>;
|
|
47
|
+
}, WorkerDrainMutationResult, unknown>;
|
|
48
48
|
export declare function createClearDeploymentDrainOperation(options?: WorkerDrainOperationOptions): import("../operation-catalog.ts").OperationDefinition<{
|
|
49
49
|
deploymentName: string;
|
|
50
|
-
}, WorkerDrainMutationResult>;
|
|
50
|
+
}, WorkerDrainMutationResult, unknown>;
|
|
51
51
|
export declare const drainWorkerOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
52
52
|
workerId: string;
|
|
53
53
|
reason?: string | undefined;
|
|
54
|
-
}, WorkerDrainMutationResult>;
|
|
54
|
+
}, WorkerDrainMutationResult, unknown>;
|
|
55
55
|
export declare const clearWorkerDrainOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
56
56
|
workerId: string;
|
|
57
|
-
}, WorkerDrainMutationResult>;
|
|
57
|
+
}, WorkerDrainMutationResult, unknown>;
|
|
58
58
|
export declare const drainDeploymentOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
59
59
|
deploymentName: string;
|
|
60
60
|
reason?: string | undefined;
|
|
61
|
-
}, WorkerDrainMutationResult>;
|
|
61
|
+
}, WorkerDrainMutationResult, unknown>;
|
|
62
62
|
export declare const clearDeploymentDrainOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
63
63
|
deploymentName: string;
|
|
64
|
-
}, WorkerDrainMutationResult>;
|
|
64
|
+
}, WorkerDrainMutationResult, unknown>;
|
|
65
65
|
export declare function createDrainWorkerRestBinding(): UnknownRestBinding;
|
|
66
66
|
export declare function createClearWorkerDrainRestBinding(): UnknownRestBinding;
|
|
67
67
|
export declare function createDrainDeploymentRestBinding(): UnknownRestBinding;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { shapeOperationFaultAsJson } from "../operation-fault.js";
|
|
3
3
|
import { defineOperation } from "../operation-registry.js";
|
|
4
|
-
import {
|
|
4
|
+
import { readRestTextBody } from "../rest-body.js";
|
|
5
|
+
import { invalidParamsFault, isOperationFault } from "./operation-helpers.js";
|
|
5
6
|
const drainReasonSchema = z.string().min(1).max(256).optional(), workerDrainInput = z.object({
|
|
6
7
|
workerId: z.string().min(1),
|
|
7
8
|
reason: drainReasonSchema
|
|
@@ -153,9 +154,9 @@ function createWorkerDrainRestBinding(method, operationName) {
|
|
|
153
154
|
workerId: { kind: "path", pathParam: "workerId" },
|
|
154
155
|
...method === "POST" ? { reason: { kind: "body-field", bodyField: "reason" } } : {}
|
|
155
156
|
},
|
|
156
|
-
extractInput: async (request, pathParams) => ({
|
|
157
|
+
extractInput: async (request, pathParams, context) => ({
|
|
157
158
|
workerId: pathParams.workerId ?? "",
|
|
158
|
-
...method === "POST" ? await readDrainBody(request) : {}
|
|
159
|
+
...method === "POST" ? await readDrainBody(request, context) : {}
|
|
159
160
|
}),
|
|
160
161
|
success: { kind: "json", status: 200 },
|
|
161
162
|
shapeSuccess: shapeDrainSuccess,
|
|
@@ -172,9 +173,9 @@ function createDeploymentDrainRestBinding(method, operationName) {
|
|
|
172
173
|
deploymentName: { kind: "path", pathParam: "deploymentName" },
|
|
173
174
|
...method === "POST" ? { reason: { kind: "body-field", bodyField: "reason" } } : {}
|
|
174
175
|
},
|
|
175
|
-
extractInput: async (request, pathParams) => ({
|
|
176
|
+
extractInput: async (request, pathParams, context) => ({
|
|
176
177
|
deploymentName: pathParams.deploymentName ?? "",
|
|
177
|
-
...method === "POST" ? await readDrainBody(request) : {}
|
|
178
|
+
...method === "POST" ? await readDrainBody(request, context) : {}
|
|
178
179
|
}),
|
|
179
180
|
success: { kind: "json", status: 200 },
|
|
180
181
|
shapeSuccess: shapeDrainSuccess,
|
|
@@ -187,14 +188,16 @@ function shapeDrainSuccess(output) {
|
|
|
187
188
|
headers: { "Content-Type": "application/json" }
|
|
188
189
|
});
|
|
189
190
|
}
|
|
190
|
-
async function readDrainBody(request) {
|
|
191
|
-
const text = await request
|
|
191
|
+
async function readDrainBody(request, context) {
|
|
192
|
+
const text = await readRestTextBody(request, context);
|
|
192
193
|
if (text.trim().length === 0)
|
|
193
194
|
return {};
|
|
194
195
|
let parsed;
|
|
195
196
|
try {
|
|
196
197
|
parsed = JSON.parse(text);
|
|
197
|
-
} catch {
|
|
198
|
+
} catch (error) {
|
|
199
|
+
if (isOperationFault(error))
|
|
200
|
+
throw error;
|
|
198
201
|
throw invalidParamsFault("Drain request body must be valid JSON");
|
|
199
202
|
}
|
|
200
203
|
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type EventEnvelope } from '../workflow-event-feed.ts';
|
|
2
3
|
declare const workflowEventsSubscriptionInput: z.ZodObject<{
|
|
3
4
|
workflowId: z.ZodString;
|
|
4
5
|
selector: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
@@ -28,13 +29,11 @@ export type WorkflowEventsSubscriptionEnvelope = z.infer<typeof workflowEventsSu
|
|
|
28
29
|
* subscriptions. This is documented as a known v1 constraint; per-event
|
|
29
30
|
* filtering is a planned future refinement.
|
|
30
31
|
*
|
|
31
|
-
* Access is
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* without auth must add an authentication layer before exposing this
|
|
37
|
-
* endpoint to untrusted networks.
|
|
32
|
+
* Access is selector-specific: event envelopes require `events:read`, while
|
|
33
|
+
* token-stream envelopes require `streams:read`. Anonymous callers and
|
|
34
|
+
* authenticated callers without the matching scope are denied. Operators
|
|
35
|
+
* running `serve({ engine })` without auth must add an authentication layer
|
|
36
|
+
* before exposing this endpoint to untrusted networks.
|
|
38
37
|
*/
|
|
39
38
|
export declare const workflowEventsSubscriptionOperation: import("../operation-catalog.ts").OperationDefinition<{
|
|
40
39
|
workflowId: string;
|
|
@@ -43,5 +42,5 @@ export declare const workflowEventsSubscriptionOperation: import("../operation-c
|
|
|
43
42
|
}, {
|
|
44
43
|
subscriptionId: string;
|
|
45
44
|
cursor: string;
|
|
46
|
-
}>;
|
|
45
|
+
}, EventEnvelope>;
|
|
47
46
|
export {};
|