@lostgradient/weft 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +493 -0
- package/dist/alerting/alert-manager.d.ts +42 -0
- package/dist/alerting/alert-manager.js +167 -0
- package/dist/alerting/index.d.ts +2 -0
- package/dist/alerting/index.js +1 -0
- package/dist/alerting/sliding-window.d.ts +26 -0
- package/dist/alerting/sliding-window.js +97 -0
- package/dist/alerting/types.d.ts +157 -0
- package/dist/alerting/types.js +0 -0
- package/dist/cli/api-arguments.d.ts +2 -0
- package/dist/cli/api-arguments.js +48 -0
- package/dist/cli/api.d.ts +13 -0
- package/dist/cli/api.js +191 -0
- package/dist/cli/codegen-arguments.d.ts +10 -0
- package/dist/cli/codegen-arguments.js +50 -0
- package/dist/cli/codegen-emit-keywords.d.ts +28 -0
- package/dist/cli/codegen-emit-keywords.js +48 -0
- package/dist/cli/codegen-emit.d.ts +50 -0
- package/dist/cli/codegen-emit.js +280 -0
- package/dist/cli/codegen.d.ts +38 -0
- package/dist/cli/codegen.js +268 -0
- package/dist/cli/command-suggestions.d.ts +9 -0
- package/dist/cli/command-suggestions.js +27 -0
- package/dist/cli/completions.d.ts +17 -0
- package/dist/cli/completions.js +112 -0
- package/dist/cli/conformance.d.ts +9 -0
- package/dist/cli/conformance.js +226 -0
- package/dist/cli/doctor.d.ts +6 -0
- package/dist/cli/doctor.js +9 -0
- package/dist/cli/generated/operation-client.generated.d.ts +605 -0
- package/dist/cli/generated/operation-client.generated.js +60 -0
- package/dist/cli/help-text.d.ts +13 -0
- package/dist/cli/help-text.js +269 -0
- package/dist/cli/index.d.ts +23 -0
- package/dist/cli/index.js +34 -0
- package/dist/cli/json-rpc-client.d.ts +15 -0
- package/dist/cli/json-rpc-client.js +37 -0
- package/dist/cli/noun-verb-arguments.d.ts +15 -0
- package/dist/cli/noun-verb-arguments.js +190 -0
- package/dist/cli/operation-catalog-snapshot.d.ts +38 -0
- package/dist/cli/operation-catalog-snapshot.js +48 -0
- package/dist/cli/operation-client-runtime.d.ts +47 -0
- package/dist/cli/operation-client-runtime.js +33 -0
- package/dist/cli/output.d.ts +66 -0
- package/dist/cli/output.js +83 -0
- package/dist/cli/parse-arguments.d.ts +3 -0
- package/dist/cli/parse-arguments.js +214 -0
- package/dist/cli/parse-schedule-arguments.d.ts +9 -0
- package/dist/cli/parse-schedule-arguments.js +132 -0
- package/dist/cli/schedule.d.ts +3 -0
- package/dist/cli/schedule.js +128 -0
- package/dist/cli/serve-registrations.d.ts +15 -0
- package/dist/cli/serve-registrations.js +23 -0
- package/dist/cli/server-client.d.ts +45 -0
- package/dist/cli/server-client.js +33 -0
- package/dist/cli/server-commands.d.ts +19 -0
- package/dist/cli/server-commands.js +151 -0
- package/dist/cli/storage-backend-arguments.d.ts +15 -0
- package/dist/cli/storage-backend-arguments.js +16 -0
- package/dist/cli/storage-factory.d.ts +8 -0
- package/dist/cli/storage-factory.js +18 -0
- package/dist/cli/subcommand-detection.d.ts +2 -0
- package/dist/cli/subcommand-detection.js +38 -0
- package/dist/cli/tail.d.ts +50 -0
- package/dist/cli/tail.js +161 -0
- package/dist/cli/timeline.d.ts +9 -0
- package/dist/cli/timeline.js +78 -0
- package/dist/cli/types.d.ts +224 -0
- package/dist/cli/types.js +0 -0
- package/dist/cli/utilities.d.ts +9 -0
- package/dist/cli/utilities.js +120 -0
- package/dist/cli/validate.d.ts +6 -0
- package/dist/cli/validate.js +70 -0
- package/dist/cli/version-check.d.ts +7 -0
- package/dist/cli/version-check.js +16 -0
- package/dist/cli/version.d.ts +7 -0
- package/dist/cli/version.js +4 -0
- package/dist/cli/workflow-commands.d.ts +15 -0
- package/dist/cli/workflow-commands.js +195 -0
- package/dist/cli-main.d.ts +2 -0
- package/dist/cli-main.js +402 -0
- package/dist/client/event-stream-transport.d.ts +73 -0
- package/dist/client/event-stream-transport.js +59 -0
- package/dist/client/event-stream.d.ts +90 -0
- package/dist/client/event-stream.js +221 -0
- package/dist/client/event-tail.d.ts +50 -0
- package/dist/client/event-tail.js +0 -0
- package/dist/client/handle-delegation.d.ts +73 -0
- package/dist/client/handle-delegation.js +66 -0
- package/dist/client/http-client-requests.d.ts +65 -0
- package/dist/client/http-client-requests.js +178 -0
- package/dist/client/http-client.d.ts +130 -0
- package/dist/client/http-client.js +217 -0
- package/dist/client/http-handle.d.ts +27 -0
- package/dist/client/http-handle.js +43 -0
- package/dist/client/http-operations.d.ts +29 -0
- package/dist/client/http-operations.js +36 -0
- package/dist/client/http-request.d.ts +101 -0
- package/dist/client/http-request.js +73 -0
- package/dist/client/http-schedule-handle.d.ts +5 -0
- package/dist/client/http-schedule-handle.js +5 -0
- package/dist/client/in-process-operations.d.ts +30 -0
- package/dist/client/in-process-operations.js +17 -0
- package/dist/client/index.d.ts +15 -0
- package/dist/client/index.js +2 -0
- package/dist/client/interface.d.ts +333 -0
- package/dist/client/interface.js +0 -0
- package/dist/client/local-event-tail.d.ts +30 -0
- package/dist/client/local-event-tail.js +131 -0
- package/dist/client/local.d.ts +115 -0
- package/dist/client/local.js +178 -0
- package/dist/client/open-event-subscription.d.ts +33 -0
- package/dist/client/open-event-subscription.js +5 -0
- package/dist/client/schedule-list-search-params.d.ts +3 -0
- package/dist/client/schedule-list-search-params.js +18 -0
- package/dist/client/search-params.d.ts +3 -0
- package/dist/client/search-params.js +54 -0
- package/dist/client/start-body.d.ts +9 -0
- package/dist/client/start-body.js +23 -0
- package/dist/client/workflow-name-typing.d.ts +33 -0
- package/dist/client/workflow-name-typing.js +0 -0
- package/dist/connection.d.ts +121 -0
- package/dist/connection.js +161 -0
- package/dist/core/activity-registry.d.ts +135 -0
- package/dist/core/activity-registry.js +174 -0
- package/dist/core/activity.d.ts +2 -0
- package/dist/core/activity.js +1 -0
- package/dist/core/aggregate-validation.d.ts +85 -0
- package/dist/core/aggregate-validation.js +48 -0
- package/dist/core/atomic-state-events.d.ts +214 -0
- package/dist/core/atomic-state-events.js +39 -0
- package/dist/core/atomic-state.d.ts +79 -0
- package/dist/core/atomic-state.js +231 -0
- package/dist/core/bulk-workflow-filter.d.ts +23 -0
- package/dist/core/bulk-workflow-filter.js +38 -0
- package/dist/core/checkpoint/comparison.d.ts +2 -0
- package/dist/core/checkpoint/comparison.js +137 -0
- package/dist/core/checkpoint/index.d.ts +4 -0
- package/dist/core/checkpoint/index.js +3 -0
- package/dist/core/checkpoint/interfaces.d.ts +11 -0
- package/dist/core/checkpoint/interfaces.js +0 -0
- package/dist/core/checkpoint/lifecycle.d.ts +49 -0
- package/dist/core/checkpoint/lifecycle.js +36 -0
- package/dist/core/checkpoint/serialization.d.ts +31 -0
- package/dist/core/checkpoint/serialization.js +155 -0
- package/dist/core/checkpoint/validation.d.ts +4 -0
- package/dist/core/checkpoint/validation.js +26 -0
- package/dist/core/checkpoint.d.ts +1 -0
- package/dist/core/checkpoint.js +1 -0
- package/dist/core/codec/api.d.ts +32 -0
- package/dist/core/codec/api.js +9 -0
- package/dist/core/codec/extension-codec.d.ts +7 -0
- package/dist/core/codec/extension-codec.js +145 -0
- package/dist/core/codec/index.d.ts +3 -0
- package/dist/core/codec/index.js +2 -0
- package/dist/core/codec/validation.d.ts +28 -0
- package/dist/core/codec/validation.js +139 -0
- package/dist/core/codec-helpers.d.ts +8 -0
- package/dist/core/codec-helpers.js +19 -0
- package/dist/core/codec.d.ts +1 -0
- package/dist/core/codec.js +1 -0
- package/dist/core/compression.d.ts +127 -0
- package/dist/core/compression.js +88 -0
- package/dist/core/concurrency-lock-record.d.ts +122 -0
- package/dist/core/concurrency-lock-record.js +53 -0
- package/dist/core/concurrency.d.ts +221 -0
- package/dist/core/concurrency.js +93 -0
- package/dist/core/constraint.d.ts +144 -0
- package/dist/core/constraint.js +3 -0
- package/dist/core/context/attributes.d.ts +7 -0
- package/dist/core/context/attributes.js +29 -0
- package/dist/core/context/child-workflow-pipe.d.ts +18 -0
- package/dist/core/context/child-workflow-pipe.js +111 -0
- package/dist/core/context/durable-operations.d.ts +29 -0
- package/dist/core/context/durable-operations.js +166 -0
- package/dist/core/context/index.d.ts +114 -0
- package/dist/core/context/index.js +224 -0
- package/dist/core/context/internals.d.ts +30 -0
- package/dist/core/context/internals.js +36 -0
- package/dist/core/context/operation-request.d.ts +160 -0
- package/dist/core/context/operation-request.js +0 -0
- package/dist/core/context/parallel-cache-entry.d.ts +91 -0
- package/dist/core/context/parallel-cache-entry.js +92 -0
- package/dist/core/context/parallel-operations.d.ts +9 -0
- package/dist/core/context/parallel-operations.js +202 -0
- package/dist/core/context/run-operation.d.ts +21 -0
- package/dist/core/context/run-operation.js +231 -0
- package/dist/core/context/saga.d.ts +4 -0
- package/dist/core/context/saga.js +65 -0
- package/dist/core/context/session-state.d.ts +22 -0
- package/dist/core/context/session-state.js +154 -0
- package/dist/core/context/speculate-operations.d.ts +4 -0
- package/dist/core/context/speculate-operations.js +14 -0
- package/dist/core/context/speculative-child.d.ts +6 -0
- package/dist/core/context/speculative-child.js +67 -0
- package/dist/core/context/state-namespace.d.ts +27 -0
- package/dist/core/context/state-namespace.js +138 -0
- package/dist/core/context/types.d.ts +181 -0
- package/dist/core/context/types.js +0 -0
- package/dist/core/context/updates.d.ts +46 -0
- package/dist/core/context/updates.js +21 -0
- package/dist/core/context/validation.d.ts +2 -0
- package/dist/core/context/validation.js +12 -0
- package/dist/core/context.d.ts +1 -0
- package/dist/core/context.js +1 -0
- package/dist/core/debug-output.d.ts +3 -0
- package/dist/core/debug-output.js +112 -0
- package/dist/core/effect-log/index.d.ts +194 -0
- package/dist/core/effect-log/index.js +104 -0
- package/dist/core/engine/activity-reconciliation.d.ts +108 -0
- package/dist/core/engine/activity-reconciliation.js +182 -0
- package/dist/core/engine/aggregate.d.ts +47 -0
- package/dist/core/engine/aggregate.js +132 -0
- package/dist/core/engine/anonymous-signal-sequence.d.ts +4 -0
- package/dist/core/engine/anonymous-signal-sequence.js +101 -0
- package/dist/core/engine/async-activity-completion.d.ts +141 -0
- package/dist/core/engine/async-activity-completion.js +131 -0
- package/dist/core/engine/attributes-tags.d.ts +31 -0
- package/dist/core/engine/attributes-tags.js +178 -0
- package/dist/core/engine/broadcast.d.ts +8 -0
- package/dist/core/engine/broadcast.js +26 -0
- package/dist/core/engine/bulk-operations-purge.d.ts +11 -0
- package/dist/core/engine/bulk-operations-purge.js +246 -0
- package/dist/core/engine/bulk-operations-shared.d.ts +28 -0
- package/dist/core/engine/bulk-operations-shared.js +198 -0
- package/dist/core/engine/bulk-operations.d.ts +21 -0
- package/dist/core/engine/bulk-operations.js +128 -0
- package/dist/core/engine/callback-creators-bundles.d.ts +25 -0
- package/dist/core/engine/callback-creators-bundles.js +154 -0
- package/dist/core/engine/callback-creators-core.d.ts +39 -0
- package/dist/core/engine/callback-creators-core.js +136 -0
- package/dist/core/engine/callback-creators-router-registry.d.ts +4 -0
- package/dist/core/engine/callback-creators-router-registry.js +9 -0
- package/dist/core/engine/callback-creators-router.d.ts +3 -0
- package/dist/core/engine/callback-creators-router.js +68 -0
- package/dist/core/engine/callback-creators-schedule.d.ts +13 -0
- package/dist/core/engine/callback-creators-schedule.js +65 -0
- package/dist/core/engine/callback-creators.d.ts +9 -0
- package/dist/core/engine/callback-creators.js +87 -0
- package/dist/core/engine/cancel-handlers.d.ts +6 -0
- package/dist/core/engine/cancel-handlers.js +32 -0
- package/dist/core/engine/checkpoint-commit-snapshots.d.ts +4 -0
- package/dist/core/engine/checkpoint-commit-snapshots.js +16 -0
- package/dist/core/engine/checkpoint-io.d.ts +34 -0
- package/dist/core/engine/checkpoint-io.js +183 -0
- package/dist/core/engine/checkpoint-reads.d.ts +22 -0
- package/dist/core/engine/checkpoint-reads.js +98 -0
- package/dist/core/engine/child-workflow.d.ts +20 -0
- package/dist/core/engine/child-workflow.js +72 -0
- package/dist/core/engine/completed-review-storage.d.ts +14 -0
- package/dist/core/engine/completed-review-storage.js +61 -0
- package/dist/core/engine/constraints.d.ts +24 -0
- package/dist/core/engine/constraints.js +57 -0
- package/dist/core/engine/construction.d.ts +60 -0
- package/dist/core/engine/construction.js +213 -0
- package/dist/core/engine/disposal.d.ts +9 -0
- package/dist/core/engine/disposal.js +58 -0
- package/dist/core/engine/engine-create-types.d.ts +70 -0
- package/dist/core/engine/engine-create-types.js +0 -0
- package/dist/core/engine/engine-internal-types.d.ts +59 -0
- package/dist/core/engine/engine-internal-types.js +0 -0
- package/dist/core/engine/engine-leak-warnings.d.ts +26 -0
- package/dist/core/engine/engine-leak-warnings.js +42 -0
- package/dist/core/engine/engine-runtime-helpers.d.ts +8 -0
- package/dist/core/engine/engine-runtime-helpers.js +52 -0
- package/dist/core/engine/engine-state-namespace.d.ts +20 -0
- package/dist/core/engine/engine-state-namespace.js +0 -0
- package/dist/core/engine/errors.d.ts +215 -0
- package/dist/core/engine/errors.js +90 -0
- package/dist/core/engine/event-log-compaction.d.ts +102 -0
- package/dist/core/engine/event-log-compaction.js +76 -0
- package/dist/core/engine/guards.d.ts +17 -0
- package/dist/core/engine/guards.js +43 -0
- package/dist/core/engine/handle-iteration.d.ts +2 -0
- package/dist/core/engine/handle-iteration.js +59 -0
- package/dist/core/engine/handle-result.d.ts +8 -0
- package/dist/core/engine/handle-result.js +74 -0
- package/dist/core/engine/handles.d.ts +137 -0
- package/dist/core/engine/handles.js +173 -0
- package/dist/core/engine/index.d.ts +311 -0
- package/dist/core/engine/index.js +595 -0
- package/dist/core/engine/inline-launch-queue.d.ts +17 -0
- package/dist/core/engine/inline-launch-queue.js +93 -0
- package/dist/core/engine/inline-parking.d.ts +26 -0
- package/dist/core/engine/inline-parking.js +86 -0
- package/dist/core/engine/internals.d.ts +167 -0
- package/dist/core/engine/internals.js +11 -0
- package/dist/core/engine/lifecycle/fork-helpers.d.ts +9 -0
- package/dist/core/engine/lifecycle/fork-helpers.js +66 -0
- package/dist/core/engine/lifecycle/persist.d.ts +22 -0
- package/dist/core/engine/lifecycle/persist.js +80 -0
- package/dist/core/engine/lifecycle/resume.d.ts +4 -0
- package/dist/core/engine/lifecycle/resume.js +136 -0
- package/dist/core/engine/lifecycle/shared.d.ts +79 -0
- package/dist/core/engine/lifecycle/shared.js +49 -0
- package/dist/core/engine/lifecycle/start-batch.d.ts +7 -0
- package/dist/core/engine/lifecycle/start-batch.js +70 -0
- package/dist/core/engine/lifecycle/start-exec.d.ts +5 -0
- package/dist/core/engine/lifecycle/start-exec.js +39 -0
- package/dist/core/engine/lifecycle/start.d.ts +13 -0
- package/dist/core/engine/lifecycle/start.js +163 -0
- package/dist/core/engine/lifecycle/transition.d.ts +8 -0
- package/dist/core/engine/lifecycle/transition.js +183 -0
- package/dist/core/engine/lifecycle.d.ts +8 -0
- package/dist/core/engine/lifecycle.js +40 -0
- package/dist/core/engine/list-candidate-resolution.d.ts +15 -0
- package/dist/core/engine/list-candidate-resolution.js +88 -0
- package/dist/core/engine/listing.d.ts +17 -0
- package/dist/core/engine/listing.js +186 -0
- package/dist/core/engine/operations-activity.d.ts +40 -0
- package/dist/core/engine/operations-activity.js +194 -0
- package/dist/core/engine/operations-coordination.d.ts +39 -0
- package/dist/core/engine/operations-coordination.js +162 -0
- package/dist/core/engine/operations-data.d.ts +23 -0
- package/dist/core/engine/operations-data.js +38 -0
- package/dist/core/engine/operations-router.d.ts +75 -0
- package/dist/core/engine/operations-router.js +90 -0
- package/dist/core/engine/operations-speculate.d.ts +16 -0
- package/dist/core/engine/operations-speculate.js +40 -0
- package/dist/core/engine/operations-state.d.ts +16 -0
- package/dist/core/engine/operations-state.js +27 -0
- package/dist/core/engine/operations-stream.d.ts +20 -0
- package/dist/core/engine/operations-stream.js +54 -0
- package/dist/core/engine/operations-time.d.ts +28 -0
- package/dist/core/engine/operations-time.js +167 -0
- package/dist/core/engine/parallel-dispatch.d.ts +92 -0
- package/dist/core/engine/parallel-dispatch.js +45 -0
- package/dist/core/engine/pending-updates.d.ts +18 -0
- package/dist/core/engine/pending-updates.js +109 -0
- package/dist/core/engine/persisted-data-version.d.ts +24 -0
- package/dist/core/engine/persisted-data-version.js +25 -0
- package/dist/core/engine/queries.d.ts +3 -0
- package/dist/core/engine/queries.js +17 -0
- package/dist/core/engine/registration.d.ts +6 -0
- package/dist/core/engine/registration.js +107 -0
- package/dist/core/engine/retention.d.ts +15 -0
- package/dist/core/engine/retention.js +76 -0
- package/dist/core/engine/review-list-entries.d.ts +6 -0
- package/dist/core/engine/review-list-entries.js +117 -0
- package/dist/core/engine/reviews.d.ts +34 -0
- package/dist/core/engine/reviews.js +242 -0
- package/dist/core/engine/schedule-occurrence.d.ts +35 -0
- package/dist/core/engine/schedule-occurrence.js +26 -0
- package/dist/core/engine/schedule-timer.d.ts +4 -0
- package/dist/core/engine/schedule-timer.js +77 -0
- package/dist/core/engine/schedules.d.ts +34 -0
- package/dist/core/engine/schedules.js +204 -0
- package/dist/core/engine/signals.d.ts +40 -0
- package/dist/core/engine/signals.js +185 -0
- package/dist/core/engine/speculative-execution-state.d.ts +8 -0
- package/dist/core/engine/speculative-execution-state.js +26 -0
- package/dist/core/engine/state-utilities.d.ts +62 -0
- package/dist/core/engine/state-utilities.js +306 -0
- package/dist/core/engine/storage-io.d.ts +21 -0
- package/dist/core/engine/storage-io.js +82 -0
- package/dist/core/engine/strategy-helpers.d.ts +27 -0
- package/dist/core/engine/strategy-helpers.js +47 -0
- package/dist/core/engine/stream-chunk-loading.d.ts +5 -0
- package/dist/core/engine/stream-chunk-loading.js +22 -0
- package/dist/core/engine/sub-operation.d.ts +24 -0
- package/dist/core/engine/sub-operation.js +78 -0
- package/dist/core/engine/termination/cleanup.d.ts +67 -0
- package/dist/core/engine/termination/cleanup.js +167 -0
- package/dist/core/engine/termination/complete.d.ts +13 -0
- package/dist/core/engine/termination/complete.js +249 -0
- package/dist/core/engine/termination.d.ts +7 -0
- package/dist/core/engine/termination.js +23 -0
- package/dist/core/engine/updates.d.ts +56 -0
- package/dist/core/engine/updates.js +230 -0
- package/dist/core/engine/validation/schedule.d.ts +38 -0
- package/dist/core/engine/validation/schedule.js +258 -0
- package/dist/core/engine/validation.d.ts +40 -0
- package/dist/core/engine/validation.js +144 -0
- package/dist/core/engine/workflow-feed.d.ts +82 -0
- package/dist/core/engine/workflow-feed.js +96 -0
- package/dist/core/engine/workflow-indexes.d.ts +103 -0
- package/dist/core/engine/workflow-indexes.js +93 -0
- package/dist/core/engine/workflow-state-stream.d.ts +9 -0
- package/dist/core/engine/workflow-state-stream.js +126 -0
- package/dist/core/engine/workflow-visibility-queries.d.ts +40 -0
- package/dist/core/engine/workflow-visibility-queries.js +56 -0
- package/dist/core/engine-helpers.d.ts +56 -0
- package/dist/core/engine-helpers.js +52 -0
- package/dist/core/engine.d.ts +1 -0
- package/dist/core/engine.js +1 -0
- package/dist/core/event-log-shared.d.ts +65 -0
- package/dist/core/event-log-shared.js +31 -0
- package/dist/core/event-log-verify.d.ts +51 -0
- package/dist/core/event-log-verify.js +64 -0
- package/dist/core/event-log.d.ts +112 -0
- package/dist/core/event-log.js +81 -0
- package/dist/core/events/activity-events.d.ts +104 -0
- package/dist/core/events/activity-events.js +63 -0
- package/dist/core/events/attribute-events.d.ts +22 -0
- package/dist/core/events/attribute-events.js +10 -0
- package/dist/core/events/event-map.d.ts +80 -0
- package/dist/core/events/event-map.js +0 -0
- package/dist/core/events/index.d.ts +7 -0
- package/dist/core/events/index.js +7 -0
- package/dist/core/events/signal-events.d.ts +45 -0
- package/dist/core/events/signal-events.js +23 -0
- package/dist/core/events/system-events.d.ts +149 -0
- package/dist/core/events/system-events.js +92 -0
- package/dist/core/events/update-events.d.ts +53 -0
- package/dist/core/events/update-events.js +31 -0
- package/dist/core/events/workflow-events.d.ts +198 -0
- package/dist/core/events/workflow-events.js +91 -0
- package/dist/core/events.d.ts +1 -0
- package/dist/core/events.js +1 -0
- package/dist/core/execution-strategy.d.ts +107 -0
- package/dist/core/execution-strategy.js +0 -0
- package/dist/core/failure-categories.d.ts +18 -0
- package/dist/core/failure-categories.js +70 -0
- package/dist/core/fault-code.d.ts +92 -0
- package/dist/core/fault-code.js +21 -0
- package/dist/core/inline-execution-strategy.d.ts +76 -0
- package/dist/core/inline-execution-strategy.js +264 -0
- package/dist/core/interceptor/activity-composition.d.ts +20 -0
- package/dist/core/interceptor/activity-composition.js +17 -0
- package/dist/core/interceptor/index.d.ts +25 -0
- package/dist/core/interceptor/index.js +8 -0
- package/dist/core/interceptor/interception-contexts.d.ts +200 -0
- package/dist/core/interceptor/interception-contexts.js +0 -0
- package/dist/core/interceptor/interceptor-interfaces.d.ts +149 -0
- package/dist/core/interceptor/interceptor-interfaces.js +9 -0
- package/dist/core/interceptor/split.d.ts +11 -0
- package/dist/core/interceptor/split.js +14 -0
- package/dist/core/interceptor/workflow-composition.d.ts +21 -0
- package/dist/core/interceptor/workflow-composition.js +116 -0
- package/dist/core/interceptor.d.ts +1 -0
- package/dist/core/interceptor.js +1 -0
- package/dist/core/json.d.ts +56 -0
- package/dist/core/json.js +77 -0
- package/dist/core/list-filter-validation.d.ts +78 -0
- package/dist/core/list-filter-validation.js +75 -0
- package/dist/core/payload-size.d.ts +78 -0
- package/dist/core/payload-size.js +27 -0
- package/dist/core/persisted-data-incompatible-error.d.ts +48 -0
- package/dist/core/persisted-data-incompatible-error.js +12 -0
- package/dist/core/registry-snapshot.d.ts +69 -0
- package/dist/core/registry-snapshot.js +70 -0
- package/dist/core/review/events.d.ts +73 -0
- package/dist/core/review/events.js +31 -0
- package/dist/core/review/index.d.ts +265 -0
- package/dist/core/review/index.js +96 -0
- package/dist/core/runtime-workflow-engine.d.ts +16 -0
- package/dist/core/runtime-workflow-engine.js +6 -0
- package/dist/core/schedule/cron-formatter.d.ts +10 -0
- package/dist/core/schedule/cron-formatter.js +103 -0
- package/dist/core/schedule/cron-occurrence.d.ts +3 -0
- package/dist/core/schedule/cron-occurrence.js +129 -0
- package/dist/core/schedule/cron-parser.d.ts +2 -0
- package/dist/core/schedule/cron-parser.js +93 -0
- package/dist/core/schedule/cron-types.d.ts +35 -0
- package/dist/core/schedule/cron-types.js +0 -0
- package/dist/core/schedule/index.d.ts +3 -0
- package/dist/core/schedule/index.js +2 -0
- package/dist/core/schedule/interval-occurrence.d.ts +31 -0
- package/dist/core/schedule/interval-occurrence.js +26 -0
- package/dist/core/schedule.d.ts +1 -0
- package/dist/core/schedule.js +1 -0
- package/dist/core/scheduler/duration.d.ts +44 -0
- package/dist/core/scheduler/duration.js +48 -0
- package/dist/core/scheduler/index.d.ts +4 -0
- package/dist/core/scheduler/index.js +3 -0
- package/dist/core/scheduler/scheduler-class.d.ts +52 -0
- package/dist/core/scheduler/scheduler-class.js +167 -0
- package/dist/core/scheduler/timer-batch.d.ts +10 -0
- package/dist/core/scheduler/timer-batch.js +42 -0
- package/dist/core/scheduler/timer-sources.d.ts +17 -0
- package/dist/core/scheduler/timer-sources.js +61 -0
- package/dist/core/scheduler.d.ts +1 -0
- package/dist/core/scheduler.js +1 -0
- package/dist/core/search-attributes.d.ts +67 -0
- package/dist/core/search-attributes.js +196 -0
- package/dist/core/session-state.d.ts +18 -0
- package/dist/core/session-state.js +71 -0
- package/dist/core/signal-id.d.ts +2 -0
- package/dist/core/signal-id.js +10 -0
- package/dist/core/start-workflow-validation.d.ts +14 -0
- package/dist/core/start-workflow-validation.js +63 -0
- package/dist/core/step-context.d.ts +97 -0
- package/dist/core/step-context.js +113 -0
- package/dist/core/timeouts.d.ts +98 -0
- package/dist/core/timeouts.js +38 -0
- package/dist/core/types/activity.d.ts +316 -0
- package/dist/core/types/activity.js +15 -0
- package/dist/core/types/archive-adapter.d.ts +49 -0
- package/dist/core/types/archive-adapter.js +0 -0
- package/dist/core/types/bulk.d.ts +312 -0
- package/dist/core/types/bulk.js +1 -0
- package/dist/core/types/checkpoint.d.ts +237 -0
- package/dist/core/types/checkpoint.js +12 -0
- package/dist/core/types/clone-plain.d.ts +17 -0
- package/dist/core/types/clone-plain.js +25 -0
- package/dist/core/types/constants.d.ts +54 -0
- package/dist/core/types/constants.js +1 -0
- package/dist/core/types/deep-freeze.d.ts +31 -0
- package/dist/core/types/deep-freeze.js +31 -0
- package/dist/core/types/definition-schema-to-json.d.ts +41 -0
- package/dist/core/types/definition-schema-to-json.js +56 -0
- package/dist/core/types/definition-schema.d.ts +341 -0
- package/dist/core/types/definition-schema.js +45 -0
- package/dist/core/types/history-policy.d.ts +92 -0
- package/dist/core/types/history-policy.js +1 -0
- package/dist/core/types/identity.d.ts +55 -0
- package/dist/core/types/identity.js +0 -0
- package/dist/core/types/message-handles.d.ts +229 -0
- package/dist/core/types/message-handles.js +36 -0
- package/dist/core/types/name-grammar.d.ts +30 -0
- package/dist/core/types/name-grammar.js +9 -0
- package/dist/core/types/options.d.ts +360 -0
- package/dist/core/types/options.js +0 -0
- package/dist/core/types/payload-size-policy.d.ts +47 -0
- package/dist/core/types/payload-size-policy.js +0 -0
- package/dist/core/types/registry-type-helpers.d.ts +1 -0
- package/dist/core/types/registry-type-helpers.js +0 -0
- package/dist/core/types/retry-retention.d.ts +163 -0
- package/dist/core/types/retry-retention.js +6 -0
- package/dist/core/types/reviews.d.ts +170 -0
- package/dist/core/types/reviews.js +0 -0
- package/dist/core/types/schedules.d.ts +176 -0
- package/dist/core/types/schedules.js +3 -0
- package/dist/core/types/search-attributes.d.ts +127 -0
- package/dist/core/types/search-attributes.js +8 -0
- package/dist/core/types/serializer.d.ts +30 -0
- package/dist/core/types/serializer.js +0 -0
- package/dist/core/types/standard-schema-validate.d.ts +113 -0
- package/dist/core/types/standard-schema-validate.js +60 -0
- package/dist/core/types/state.d.ts +261 -0
- package/dist/core/types/state.js +0 -0
- package/dist/core/types/workflow-builder-helpers.d.ts +310 -0
- package/dist/core/types/workflow-builder-helpers.js +0 -0
- package/dist/core/types/workflow-builder-runtime.d.ts +97 -0
- package/dist/core/types/workflow-builder-runtime.js +137 -0
- package/dist/core/types/workflow-builder.d.ts +343 -0
- package/dist/core/types/workflow-builder.js +0 -0
- package/dist/core/types/workflow-context.d.ts +168 -0
- package/dist/core/types/workflow-context.js +0 -0
- package/dist/core/types/workflow-definition.d.ts +61 -0
- package/dist/core/types/workflow-definition.js +0 -0
- package/dist/core/types/workflow-function.d.ts +330 -0
- package/dist/core/types/workflow-function.js +9 -0
- package/dist/core/types/workflow-registries.d.ts +203 -0
- package/dist/core/types/workflow-registries.js +0 -0
- package/dist/core/types/workflow-registry.d.ts +31 -0
- package/dist/core/types/workflow-registry.js +0 -0
- package/dist/core/types.d.ts +26 -0
- package/dist/core/types.js +26 -0
- package/dist/core/updates.d.ts +183 -0
- package/dist/core/updates.js +141 -0
- package/dist/core/versioning.d.ts +153 -0
- package/dist/core/versioning.js +94 -0
- package/dist/core/weft-error.d.ts +82 -0
- package/dist/core/weft-error.js +43 -0
- package/dist/core/worker-checkpoint-resume-state.d.ts +11 -0
- package/dist/core/worker-checkpoint-resume-state.js +40 -0
- package/dist/core/worker-execution-dispatcher.d.ts +42 -0
- package/dist/core/worker-execution-dispatcher.js +95 -0
- package/dist/core/worker-execution-ownership.d.ts +20 -0
- package/dist/core/worker-execution-ownership.js +91 -0
- package/dist/core/worker-execution-strategy-options.d.ts +7 -0
- package/dist/core/worker-execution-strategy-options.js +0 -0
- package/dist/core/worker-execution-strategy.d.ts +29 -0
- package/dist/core/worker-execution-strategy.js +356 -0
- package/dist/core/worker-listener-registry.d.ts +11 -0
- package/dist/core/worker-listener-registry.js +35 -0
- package/dist/core/worker-message-helpers.d.ts +5 -0
- package/dist/core/worker-message-helpers.js +14 -0
- package/dist/core/worker-protocol-guard.d.ts +20 -0
- package/dist/core/worker-protocol-guard.js +69 -0
- package/dist/core/worker-protocol.d.ts +27 -0
- package/dist/core/worker-protocol.js +346 -0
- package/dist/core/worker-turn-watchdog.d.ts +14 -0
- package/dist/core/worker-turn-watchdog.js +40 -0
- package/dist/core/workflow-identifiers.d.ts +1 -0
- package/dist/core/workflow-identifiers.js +19 -0
- package/dist/core/workflow-tags.d.ts +9 -0
- package/dist/core/workflow-tags.js +37 -0
- package/dist/core/workflow-version-tuple.d.ts +67 -0
- package/dist/core/workflow-version-tuple.js +77 -0
- package/dist/diagnostics/doctor.d.ts +30 -0
- package/dist/diagnostics/doctor.js +173 -0
- package/dist/diagnostics/format.d.ts +77 -0
- package/dist/diagnostics/format.js +115 -0
- package/dist/diagnostics/index.d.ts +15 -0
- package/dist/diagnostics/index.js +10 -0
- package/dist/diagnostics/memory-profiler.d.ts +136 -0
- package/dist/diagnostics/memory-profiler.js +93 -0
- package/dist/diagnostics/recommendations.d.ts +37 -0
- package/dist/diagnostics/recommendations.js +116 -0
- package/dist/diagnostics/types.d.ts +178 -0
- package/dist/diagnostics/types.js +9 -0
- package/dist/diagnostics/validate.d.ts +79 -0
- package/dist/diagnostics/validate.js +88 -0
- package/dist/diagnostics/version-check.d.ts +34 -0
- package/dist/diagnostics/version-check.js +61 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +182 -0
- package/dist/json-schema.d.ts +55 -0
- package/dist/json-schema.js +4 -0
- package/dist/mcp/access.d.ts +21 -0
- package/dist/mcp/access.js +22 -0
- package/dist/mcp/cli.d.ts +2 -0
- package/dist/mcp/cli.js +72 -0
- package/dist/mcp/dispatcher.d.ts +13 -0
- package/dist/mcp/dispatcher.js +198 -0
- package/dist/mcp/http.d.ts +64 -0
- package/dist/mcp/http.js +272 -0
- package/dist/mcp/index.d.ts +17 -0
- package/dist/mcp/index.js +26 -0
- package/dist/mcp/list-filter.d.ts +10 -0
- package/dist/mcp/list-filter.js +116 -0
- package/dist/mcp/protocol.d.ts +89 -0
- package/dist/mcp/protocol.js +64 -0
- package/dist/mcp/resources.d.ts +40 -0
- package/dist/mcp/resources.js +141 -0
- package/dist/mcp/session.d.ts +138 -0
- package/dist/mcp/session.js +204 -0
- package/dist/mcp/stdio.d.ts +89 -0
- package/dist/mcp/stdio.js +204 -0
- package/dist/mcp/tools.d.ts +27 -0
- package/dist/mcp/tools.js +262 -0
- package/dist/observability/activity-interceptor.d.ts +3 -0
- package/dist/observability/activity-interceptor.js +34 -0
- package/dist/observability/index.d.ts +60 -0
- package/dist/observability/index.js +4 -0
- package/dist/observability/metrics-catalog.d.ts +128 -0
- package/dist/observability/metrics-catalog.js +110 -0
- package/dist/observability/metrics-snapshot.d.ts +106 -0
- package/dist/observability/metrics-snapshot.js +0 -0
- package/dist/observability/metrics.d.ts +156 -0
- package/dist/observability/metrics.js +152 -0
- package/dist/observability/no-op-telemetry.d.ts +168 -0
- package/dist/observability/no-op-telemetry.js +96 -0
- package/dist/observability/propagation.d.ts +121 -0
- package/dist/observability/propagation.js +41 -0
- package/dist/observability/span-helpers.d.ts +50 -0
- package/dist/observability/span-helpers.js +83 -0
- package/dist/observability/types.d.ts +92 -0
- package/dist/observability/types.js +0 -0
- package/dist/observability/workflow-interceptor.d.ts +3 -0
- package/dist/observability/workflow-interceptor.js +106 -0
- package/dist/observability/workflow-lifecycle.d.ts +8 -0
- package/dist/observability/workflow-lifecycle.js +103 -0
- package/dist/runtime/portable.d.ts +119 -0
- package/dist/runtime/portable.js +90 -0
- package/dist/server/api-catalog.d.ts +85 -0
- package/dist/server/api-catalog.js +47 -0
- package/dist/server/asyncapi-channels.d.ts +40 -0
- package/dist/server/asyncapi-channels.js +264 -0
- package/dist/server/asyncapi.d.ts +25 -0
- package/dist/server/asyncapi.js +110 -0
- package/dist/server/attribute-filters.d.ts +37 -0
- package/dist/server/attribute-filters.js +39 -0
- package/dist/server/authentication/api-key.d.ts +3 -0
- package/dist/server/authentication/api-key.js +80 -0
- package/dist/server/authentication/audit.d.ts +116 -0
- package/dist/server/authentication/audit.js +25 -0
- package/dist/server/authentication/crypto.d.ts +7 -0
- package/dist/server/authentication/crypto.js +99 -0
- package/dist/server/authentication/index.d.ts +68 -0
- package/dist/server/authentication/index.js +144 -0
- package/dist/server/authentication/rate-limiter.d.ts +126 -0
- package/dist/server/authentication/rate-limiter.js +61 -0
- package/dist/server/authentication/redaction.d.ts +72 -0
- package/dist/server/authentication/redaction.js +30 -0
- package/dist/server/authentication/rotating-api-key-store.d.ts +107 -0
- package/dist/server/authentication/rotating-api-key-store.js +43 -0
- package/dist/server/authentication/types.d.ts +290 -0
- package/dist/server/authentication/types.js +13 -0
- package/dist/server/authentication.d.ts +1 -0
- package/dist/server/authentication.js +1 -0
- package/dist/server/authorization-scope.d.ts +43 -0
- package/dist/server/authorization-scope.js +53 -0
- package/dist/server/authorization.d.ts +55 -0
- package/dist/server/authorization.js +87 -0
- package/dist/server/deadline-tracker.d.ts +47 -0
- package/dist/server/deadline-tracker.js +106 -0
- package/dist/server/discovery-filter.d.ts +13 -0
- package/dist/server/discovery-filter.js +5 -0
- package/dist/server/discovery-info.d.ts +69 -0
- package/dist/server/discovery-info.js +12 -0
- package/dist/server/engine-event-feed-backend.d.ts +31 -0
- package/dist/server/engine-event-feed-backend.js +36 -0
- package/dist/server/fault-to-http.d.ts +14 -0
- package/dist/server/fault-to-http.js +29 -0
- package/dist/server/fault-to-json-rpc.d.ts +23 -0
- package/dist/server/fault-to-json-rpc.js +60 -0
- package/dist/server/handler/binding-dispatch.d.ts +11 -0
- package/dist/server/handler/binding-dispatch.js +13 -0
- package/dist/server/handler/index.d.ts +31 -0
- package/dist/server/handler/index.js +78 -0
- package/dist/server/handler/response-helpers.d.ts +5 -0
- package/dist/server/handler/response-helpers.js +28 -0
- package/dist/server/handler/route-dispatch.d.ts +144 -0
- package/dist/server/handler/route-dispatch.js +192 -0
- package/dist/server/handler/route-matching.d.ts +55 -0
- package/dist/server/handler/route-matching.js +45 -0
- package/dist/server/handler.d.ts +1 -0
- package/dist/server/handler.js +56 -0
- package/dist/server/index.d.ts +346 -0
- package/dist/server/index.js +64 -0
- package/dist/server/interactive-operations.d.ts +18 -0
- package/dist/server/interactive-operations.js +28 -0
- package/dist/server/json-rpc-dispatch.d.ts +49 -0
- package/dist/server/json-rpc-dispatch.js +92 -0
- package/dist/server/json-rpc-framing.d.ts +42 -0
- package/dist/server/json-rpc-framing.js +15 -0
- package/dist/server/json-rpc-http.d.ts +33 -0
- package/dist/server/json-rpc-http.js +112 -0
- package/dist/server/json-rpc-parse.d.ts +69 -0
- package/dist/server/json-rpc-parse.js +139 -0
- package/dist/server/json-rpc-protocol.d.ts +76 -0
- package/dist/server/json-rpc-protocol.js +27 -0
- package/dist/server/json-rpc-transport-helpers.d.ts +17 -0
- package/dist/server/json-rpc-transport-helpers.js +26 -0
- package/dist/server/json-rpc-websocket-runtime.d.ts +37 -0
- package/dist/server/json-rpc-websocket-runtime.js +51 -0
- package/dist/server/json-rpc-websocket-validation.d.ts +38 -0
- package/dist/server/json-rpc-websocket-validation.js +96 -0
- package/dist/server/json-rpc-websocket.d.ts +60 -0
- package/dist/server/json-rpc-websocket.js +268 -0
- package/dist/server/json-schema-utilities.d.ts +4 -0
- package/dist/server/json-schema-utilities.js +16 -0
- package/dist/server/mcp-discovery.d.ts +57 -0
- package/dist/server/mcp-discovery.js +50 -0
- package/dist/server/openapi-canonical-json.d.ts +10 -0
- package/dist/server/openapi-canonical-json.js +13 -0
- package/dist/server/openapi-error-responses.d.ts +15 -0
- package/dist/server/openapi-error-responses.js +36 -0
- package/dist/server/openapi-schemas.d.ts +17 -0
- package/dist/server/openapi-schemas.js +69 -0
- package/dist/server/openapi.d.ts +48 -0
- package/dist/server/openapi.js +290 -0
- package/dist/server/openrpc-document-schema.d.ts +112 -0
- package/dist/server/openrpc-document-schema.js +65 -0
- package/dist/server/openrpc-errors.d.ts +73 -0
- package/dist/server/openrpc-errors.js +57 -0
- package/dist/server/openrpc.d.ts +53 -0
- package/dist/server/openrpc.js +179 -0
- package/dist/server/operation-catalog/activity-adapter.d.ts +11 -0
- package/dist/server/operation-catalog/activity-adapter.js +9 -0
- package/dist/server/operation-catalog/dispatch-allowlist.d.ts +4 -0
- package/dist/server/operation-catalog/dispatch-allowlist.js +4 -0
- package/dist/server/operation-catalog/dispatch-preparation.d.ts +39 -0
- package/dist/server/operation-catalog/dispatch-preparation.js +52 -0
- package/dist/server/operation-catalog/index.d.ts +22 -0
- package/dist/server/operation-catalog/index.js +17 -0
- package/dist/server/operation-catalog/pipeline-helpers.d.ts +66 -0
- package/dist/server/operation-catalog/pipeline-helpers.js +179 -0
- package/dist/server/operation-catalog/pipeline-stages.d.ts +23 -0
- package/dist/server/operation-catalog/pipeline-stages.js +189 -0
- package/dist/server/operation-catalog/pipeline.d.ts +7 -0
- package/dist/server/operation-catalog/pipeline.js +32 -0
- package/dist/server/operation-catalog/raise-fault.d.ts +32 -0
- package/dist/server/operation-catalog/raise-fault.js +18 -0
- package/dist/server/operation-catalog/registry.d.ts +6 -0
- package/dist/server/operation-catalog/registry.js +93 -0
- package/dist/server/operation-catalog/stream-pipeline.d.ts +25 -0
- package/dist/server/operation-catalog/stream-pipeline.js +122 -0
- package/dist/server/operation-catalog/types.d.ts +246 -0
- package/dist/server/operation-catalog/types.js +9 -0
- package/dist/server/operation-catalog/workflow-adapter.d.ts +55 -0
- package/dist/server/operation-catalog/workflow-adapter.js +85 -0
- package/dist/server/operation-catalog.d.ts +1 -0
- package/dist/server/operation-catalog.js +1 -0
- package/dist/server/operation-fault.d.ts +153 -0
- package/dist/server/operation-fault.js +50 -0
- package/dist/server/operation-registry.d.ts +100 -0
- package/dist/server/operation-registry.js +56 -0
- package/dist/server/operations/add-workflow-tags.d.ts +15 -0
- package/dist/server/operations/add-workflow-tags.js +13 -0
- package/dist/server/operations/aggregate-workflows.d.ts +81 -0
- package/dist/server/operations/aggregate-workflows.js +110 -0
- package/dist/server/operations/async-activity.d.ts +44 -0
- package/dist/server/operations/async-activity.js +134 -0
- package/dist/server/operations/bulk-cancel-workflows.d.ts +7 -0
- package/dist/server/operations/bulk-cancel-workflows.js +64 -0
- package/dist/server/operations/bulk-delete-workflows.d.ts +7 -0
- package/dist/server/operations/bulk-delete-workflows.js +71 -0
- package/dist/server/operations/bulk-filter-helpers.d.ts +62 -0
- package/dist/server/operations/bulk-filter-helpers.js +334 -0
- package/dist/server/operations/bulk-mutate-workflow-tags.d.ts +94 -0
- package/dist/server/operations/bulk-mutate-workflow-tags.js +100 -0
- package/dist/server/operations/bulk-operation-helpers.d.ts +27 -0
- package/dist/server/operations/bulk-operation-helpers.js +29 -0
- package/dist/server/operations/bulk-signal-workflows.d.ts +87 -0
- package/dist/server/operations/bulk-signal-workflows.js +80 -0
- package/dist/server/operations/cancel-schedule.d.ts +13 -0
- package/dist/server/operations/cancel-schedule.js +43 -0
- package/dist/server/operations/cancel-workflow.d.ts +13 -0
- package/dist/server/operations/cancel-workflow.js +34 -0
- package/dist/server/operations/create-schedule.d.ts +29 -0
- package/dist/server/operations/create-schedule.js +116 -0
- package/dist/server/operations/failure-category-filter.d.ts +2 -0
- package/dist/server/operations/failure-category-filter.js +19 -0
- package/dist/server/operations/fork-workflow.d.ts +29 -0
- package/dist/server/operations/fork-workflow.js +88 -0
- package/dist/server/operations/get-checkpoint-at.d.ts +15 -0
- package/dist/server/operations/get-checkpoint-at.js +74 -0
- package/dist/server/operations/get-registry.d.ts +26 -0
- package/dist/server/operations/get-registry.js +56 -0
- package/dist/server/operations/get-retention-overview.d.ts +9 -0
- package/dist/server/operations/get-retention-overview.js +39 -0
- package/dist/server/operations/get-review.d.ts +15 -0
- package/dist/server/operations/get-review.js +57 -0
- package/dist/server/operations/get-schedule.d.ts +20 -0
- package/dist/server/operations/get-schedule.js +48 -0
- package/dist/server/operations/get-stream-chunks.d.ts +19 -0
- package/dist/server/operations/get-stream-chunks.js +71 -0
- package/dist/server/operations/get-system-metrics.d.ts +42 -0
- package/dist/server/operations/get-system-metrics.js +43 -0
- package/dist/server/operations/get-task-diagnostics.d.ts +184 -0
- package/dist/server/operations/get-task-diagnostics.js +340 -0
- package/dist/server/operations/get-update-result.d.ts +18 -0
- package/dist/server/operations/get-update-result.js +55 -0
- package/dist/server/operations/get-workflow-attributes.d.ts +13 -0
- package/dist/server/operations/get-workflow-attributes.js +51 -0
- package/dist/server/operations/get-workflow-events.d.ts +15 -0
- package/dist/server/operations/get-workflow-events.js +51 -0
- package/dist/server/operations/get-workflow-result.d.ts +14 -0
- package/dist/server/operations/get-workflow-result.js +93 -0
- package/dist/server/operations/get-workflow-timeline.d.ts +13 -0
- package/dist/server/operations/get-workflow-timeline.js +51 -0
- package/dist/server/operations/get-workflow.d.ts +36 -0
- package/dist/server/operations/get-workflow.js +49 -0
- package/dist/server/operations/list-checkpoints.d.ts +13 -0
- package/dist/server/operations/list-checkpoints.js +43 -0
- package/dist/server/operations/list-filter-query-extractor.d.ts +23 -0
- package/dist/server/operations/list-filter-query-extractor.js +87 -0
- package/dist/server/operations/list-reviews.d.ts +19 -0
- package/dist/server/operations/list-reviews.js +77 -0
- package/dist/server/operations/list-schedules.d.ts +28 -0
- package/dist/server/operations/list-schedules.js +108 -0
- package/dist/server/operations/list-task-queues.d.ts +71 -0
- package/dist/server/operations/list-task-queues.js +105 -0
- package/dist/server/operations/list-workers.d.ts +56 -0
- package/dist/server/operations/list-workers.js +92 -0
- package/dist/server/operations/list-workflows.d.ts +79 -0
- package/dist/server/operations/list-workflows.js +136 -0
- package/dist/server/operations/operation-helpers.d.ts +21 -0
- package/dist/server/operations/operation-helpers.js +22 -0
- package/dist/server/operations/pause-schedule.d.ts +13 -0
- package/dist/server/operations/pause-schedule.js +43 -0
- package/dist/server/operations/purge-workflows.d.ts +41 -0
- package/dist/server/operations/purge-workflows.js +57 -0
- package/dist/server/operations/query-workflow.d.ts +19 -0
- package/dist/server/operations/query-workflow.js +99 -0
- package/dist/server/operations/recover-all.d.ts +13 -0
- package/dist/server/operations/recover-all.js +65 -0
- package/dist/server/operations/remove-workflow-tags.d.ts +15 -0
- package/dist/server/operations/remove-workflow-tags.js +13 -0
- package/dist/server/operations/replay-workflow.d.ts +28 -0
- package/dist/server/operations/replay-workflow.js +69 -0
- package/dist/server/operations/resume-schedule.d.ts +13 -0
- package/dist/server/operations/resume-schedule.js +43 -0
- package/dist/server/operations/resume-workflow.d.ts +17 -0
- package/dist/server/operations/resume-workflow.js +40 -0
- package/dist/server/operations/schedule-faults.d.ts +14 -0
- package/dist/server/operations/schedule-faults.js +41 -0
- package/dist/server/operations/set-workflow-attributes.d.ts +19 -0
- package/dist/server/operations/set-workflow-attributes.js +67 -0
- package/dist/server/operations/signal-workflow.d.ts +23 -0
- package/dist/server/operations/signal-workflow.js +58 -0
- package/dist/server/operations/single-workflow-control-operation.d.ts +32 -0
- package/dist/server/operations/single-workflow-control-operation.js +44 -0
- package/dist/server/operations/single-workflow-tag-mutation.d.ts +27 -0
- package/dist/server/operations/single-workflow-tag-mutation.js +108 -0
- package/dist/server/operations/sse-stream.d.ts +13 -0
- package/dist/server/operations/sse-stream.js +42 -0
- package/dist/server/operations/start-workflow.d.ts +33 -0
- package/dist/server/operations/start-workflow.js +181 -0
- package/dist/server/operations/storage.d.ts +112 -0
- package/dist/server/operations/storage.js +358 -0
- package/dist/server/operations/stream-workflow-sse.d.ts +17 -0
- package/dist/server/operations/stream-workflow-sse.js +94 -0
- package/dist/server/operations/submit-review-decision.d.ts +25 -0
- package/dist/server/operations/submit-review-decision.js +113 -0
- package/dist/server/operations/timeout-workflow.d.ts +11 -0
- package/dist/server/operations/timeout-workflow.js +34 -0
- package/dist/server/operations/update-schedule.d.ts +15 -0
- package/dist/server/operations/update-schedule.js +60 -0
- package/dist/server/operations/update-workflow.d.ts +27 -0
- package/dist/server/operations/update-workflow.js +109 -0
- package/dist/server/operations/worker-drain.d.ts +69 -0
- package/dist/server/operations/worker-drain.js +214 -0
- package/dist/server/operations/workflow-events-subscription.d.ts +47 -0
- package/dist/server/operations/workflow-events-subscription.js +51 -0
- package/dist/server/principal.d.ts +176 -0
- package/dist/server/principal.js +59 -0
- package/dist/server/rest-binding.d.ts +158 -0
- package/dist/server/rest-binding.js +35 -0
- package/dist/server/rest-bindings.d.ts +76 -0
- package/dist/server/rest-bindings.js +376 -0
- package/dist/server/route-model.d.ts +268 -0
- package/dist/server/route-model.js +166 -0
- package/dist/server/runtime/authentication-bridge.d.ts +22 -0
- package/dist/server/runtime/authentication-bridge.js +194 -0
- package/dist/server/runtime/context.d.ts +73 -0
- package/dist/server/runtime/context.js +0 -0
- package/dist/server/runtime/cors.d.ts +149 -0
- package/dist/server/runtime/cors.js +123 -0
- package/dist/server/runtime/event-broadcasting.d.ts +71 -0
- package/dist/server/runtime/event-broadcasting.js +205 -0
- package/dist/server/runtime/request-gate.d.ts +54 -0
- package/dist/server/runtime/request-gate.js +71 -0
- package/dist/server/runtime/shutdown.d.ts +10 -0
- package/dist/server/runtime/shutdown.js +18 -0
- package/dist/server/runtime/stop-server.d.ts +3 -0
- package/dist/server/runtime/stop-server.js +19 -0
- package/dist/server/runtime/task-dispatch.d.ts +8 -0
- package/dist/server/runtime/task-dispatch.js +157 -0
- package/dist/server/runtime/task-metrics.d.ts +12 -0
- package/dist/server/runtime/task-metrics.js +36 -0
- package/dist/server/runtime/task-polling.d.ts +9 -0
- package/dist/server/runtime/task-polling.js +132 -0
- package/dist/server/runtime/task-reconciliation.d.ts +17 -0
- package/dist/server/runtime/task-reconciliation.js +163 -0
- package/dist/server/runtime/websocket-stream.d.ts +15 -0
- package/dist/server/runtime/websocket-stream.js +79 -0
- package/dist/server/runtime/websocket-upgrade.d.ts +8 -0
- package/dist/server/runtime/websocket-upgrade.js +76 -0
- package/dist/server/runtime/websocket-worker.d.ts +7 -0
- package/dist/server/runtime/websocket-worker.js +224 -0
- package/dist/server/runtime-helpers.d.ts +18 -0
- package/dist/server/runtime-helpers.js +23 -0
- package/dist/server/sequence-cursor.d.ts +5 -0
- package/dist/server/sequence-cursor.js +19 -0
- package/dist/server/serve-internals.d.ts +83 -0
- package/dist/server/serve-internals.js +203 -0
- package/dist/server/stdio-session.d.ts +51 -0
- package/dist/server/stdio-session.js +245 -0
- package/dist/server/task-queue-summary.d.ts +27 -0
- package/dist/server/task-queue-summary.js +34 -0
- package/dist/server/task-queue-types.d.ts +95 -0
- package/dist/server/task-queue-types.js +0 -0
- package/dist/server/task-queue.d.ts +90 -0
- package/dist/server/task-queue.js +247 -0
- package/dist/server/task-resolved-record.d.ts +12 -0
- package/dist/server/task-resolved-record.js +35 -0
- package/dist/server/task-state.d.ts +152 -0
- package/dist/server/task-state.js +178 -0
- package/dist/server/workflow-event-feed.d.ts +166 -0
- package/dist/server/workflow-event-feed.js +193 -0
- package/dist/service-worker/index.d.ts +123 -0
- package/dist/service-worker/index.js +56 -0
- package/dist/service-worker/scheduler.d.ts +37 -0
- package/dist/service-worker/scheduler.js +117 -0
- package/dist/service-worker/setup.d.ts +127 -0
- package/dist/service-worker/setup.js +129 -0
- package/dist/service-worker/shared.d.ts +94 -0
- package/dist/service-worker/shared.js +15 -0
- package/dist/storage/auto.d.ts +45 -0
- package/dist/storage/auto.js +2 -0
- package/dist/storage/bun-sql.d.ts +64 -0
- package/dist/storage/bun-sql.js +575 -0
- package/dist/storage/byte-encoding.d.ts +6 -0
- package/dist/storage/byte-encoding.js +16 -0
- package/dist/storage/capabilities.d.ts +187 -0
- package/dist/storage/capabilities.js +19 -0
- package/dist/storage/compressed-storage.d.ts +45 -0
- package/dist/storage/compressed-storage.js +2 -0
- package/dist/storage/default-scope.d.ts +17 -0
- package/dist/storage/default-scope.js +1 -0
- package/dist/storage/delete-range.d.ts +109 -0
- package/dist/storage/delete-range.js +64 -0
- package/dist/storage/derived-operations.d.ts +53 -0
- package/dist/storage/derived-operations.js +31 -0
- package/dist/storage/http.d.ts +67 -0
- package/dist/storage/http.js +2 -0
- package/dist/storage/index.d.ts +292 -0
- package/dist/storage/index.js +51 -0
- package/dist/storage/indexeddb.d.ts +49 -0
- package/dist/storage/indexeddb.js +1 -0
- package/dist/storage/interface.d.ts +340 -0
- package/dist/storage/interface.js +2 -0
- package/dist/storage/key-prefixes.d.ts +19 -0
- package/dist/storage/key-prefixes.js +35 -0
- package/dist/storage/lmdb.d.ts +40 -0
- package/dist/storage/lmdb.js +2 -0
- package/dist/storage/memory.d.ts +46 -0
- package/dist/storage/memory.js +2 -0
- package/dist/storage/node-sqlite.d.ts +85 -0
- package/dist/storage/node-sqlite.js +323 -0
- package/dist/storage/read-only-query.d.ts +2 -0
- package/dist/storage/read-only-query.js +19 -0
- package/dist/storage/resolve.d.ts +180 -0
- package/dist/storage/resolve.js +2 -0
- package/dist/storage/scoped-storage.d.ts +68 -0
- package/dist/storage/scoped-storage.js +2 -0
- package/dist/storage/sqlite-key-value-queries.d.ts +40 -0
- package/dist/storage/sqlite-key-value-queries.js +64 -0
- package/dist/storage/sqlite.d.ts +31 -0
- package/dist/storage/sqlite.js +0 -0
- package/dist/storage/text-value-import.d.ts +87 -0
- package/dist/storage/text-value-import.js +50 -0
- package/dist/storage/text-value-store.d.ts +171 -0
- package/dist/storage/text-value-store.js +55 -0
- package/dist/storage/turso.d.ts +60 -0
- package/dist/storage/turso.js +5 -0
- package/dist/storage/typed-storage.d.ts +258 -0
- package/dist/storage/typed-storage.js +2 -0
- package/dist/storage/web-extension.d.ts +55 -0
- package/dist/storage/web-extension.js +1 -0
- package/dist/testing/chaos.d.ts +157 -0
- package/dist/testing/chaos.js +69 -0
- package/dist/testing/event-loop.d.ts +4 -0
- package/dist/testing/event-loop.js +21 -0
- package/dist/testing/index.d.ts +126 -0
- package/dist/testing/index.js +61 -0
- package/dist/testing/mocks.d.ts +145 -0
- package/dist/testing/mocks.js +136 -0
- package/dist/testing/subprocess-engine.d.ts +100 -0
- package/dist/testing/subprocess-engine.js +291 -0
- package/dist/testing/test-engine.d.ts +145 -0
- package/dist/testing/test-engine.js +147 -0
- package/dist/testing/time-control.d.ts +59 -0
- package/dist/testing/time-control.js +68 -0
- package/dist/version.d.ts +12 -0
- package/dist/version.js +1 -0
- package/dist/worker/activity-table.d.ts +33 -0
- package/dist/worker/activity-table.js +20 -0
- package/dist/worker/execute-with-interceptors.d.ts +28 -0
- package/dist/worker/execute-with-interceptors.js +21 -0
- package/dist/worker/heartbeat.d.ts +34 -0
- package/dist/worker/heartbeat.js +31 -0
- package/dist/worker/index.d.ts +57 -0
- package/dist/worker/index.js +334 -0
- package/dist/worker/long-poll.d.ts +54 -0
- package/dist/worker/long-poll.js +134 -0
- package/dist/worker/options.d.ts +66 -0
- package/dist/worker/options.js +19 -0
- package/dist/worker/protocol-internals.d.ts +82 -0
- package/dist/worker/protocol-internals.js +56 -0
- package/dist/worker/protocol-messages.d.ts +264 -0
- package/dist/worker/protocol-messages.js +0 -0
- package/dist/worker/protocol-schemas.d.ts +559 -0
- package/dist/worker/protocol-schemas.js +180 -0
- package/dist/worker/protocol-version.d.ts +71 -0
- package/dist/worker/protocol-version.js +1 -0
- package/dist/worker/protocol.d.ts +72 -0
- package/dist/worker/protocol.js +2 -0
- package/dist/worker/registry/fair-share.d.ts +59 -0
- package/dist/worker/registry/fair-share.js +15 -0
- package/dist/worker/registry/routing.d.ts +17 -0
- package/dist/worker/registry/routing.js +16 -0
- package/dist/worker/registry/summary.d.ts +87 -0
- package/dist/worker/registry/summary.js +81 -0
- package/dist/worker/registry/types.d.ts +123 -0
- package/dist/worker/registry/types.js +0 -0
- package/dist/worker/registry.d.ts +94 -0
- package/dist/worker/registry.js +305 -0
- package/dist/worker/remote-activity-context.d.ts +15 -0
- package/dist/worker/remote-activity-context.js +0 -0
- package/dist/worker/task-result-outbox.d.ts +40 -0
- package/dist/worker/task-result-outbox.js +42 -0
- package/dist/worker/worker-protocol-incompatible-error.d.ts +52 -0
- package/dist/worker/worker-protocol-incompatible-error.js +15 -0
- package/dist/worker/workflow-activity-binding.d.ts +96 -0
- package/dist/worker/workflow-activity-binding.js +22 -0
- package/dist/workers/activity-runner.d.ts +87 -0
- package/dist/workers/activity-runner.js +29 -0
- package/dist/workers/activity-worker-dispatcher.d.ts +85 -0
- package/dist/workers/activity-worker-dispatcher.js +68 -0
- package/dist/workers/activity-worker-entry.d.ts +99 -0
- package/dist/workers/activity-worker-entry.js +59 -0
- package/dist/workers/pool.d.ts +83 -0
- package/dist/workers/pool.js +174 -0
- package/dist/workers/workflow-runner.d.ts +79 -0
- package/dist/workers/workflow-runner.js +245 -0
- package/dist/workers/workflow-worker-entry.d.ts +24 -0
- package/dist/workers/workflow-worker-entry.js +70 -0
- package/package.json +297 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage consistency/feature capability types and the runtime gate that acts
|
|
3
|
+
* on them. Split out from `interface.ts` to keep that module focused. The
|
|
4
|
+
* `Storage` interface lives in `interface.ts` and imports these types; this
|
|
5
|
+
* module imports `Storage` type-only, so there is no runtime import cycle.
|
|
6
|
+
*
|
|
7
|
+
* @module storage/capabilities
|
|
8
|
+
*/
|
|
9
|
+
import type { Storage } from './interface.ts';
|
|
10
|
+
/**
|
|
11
|
+
* Honest, self-reported consistency and feature profile for a {@link Storage}
|
|
12
|
+
* backend, returned by {@link Storage.capabilities}. Values describe the
|
|
13
|
+
* guarantees a backend actually provides, not what callers wish it provided.
|
|
14
|
+
*
|
|
15
|
+
* **Three kinds of capability, treated differently:**
|
|
16
|
+
* - **Runtime-gated:** `conditionalBatch` is the only capability the engine
|
|
17
|
+
* enforces at runtime (see {@link requireStorageCapability}). A backend may
|
|
18
|
+
* legitimately omit compare-and-swap, so its absence fails fast with a clear
|
|
19
|
+
* diagnostic at the first feature that needs it.
|
|
20
|
+
* - **Trusted correctness contracts:** `atomicBatch`, `readAfterWrite`, and
|
|
21
|
+
* `scanConsistency` are read by the engine but NOT verified at runtime. If a
|
|
22
|
+
* backend reports `atomicBatch: true` but applies batches non-atomically, the
|
|
23
|
+
* failure mode is checkpoint corruption, not a missing feature — honesty is
|
|
24
|
+
* the adapter author's responsibility.
|
|
25
|
+
* - **Operational hint:** `boundedRangeDelete` is a strength-of-implementation
|
|
26
|
+
* claim about the adapter's bounded-delete methods — `deletePrefix()` and, when
|
|
27
|
+
* present, `deleteRange()` — being single bounded range ops rather than a
|
|
28
|
+
* scan-and-delete fallback. It affects performance, not correctness, and nothing
|
|
29
|
+
* gates on it. In every built-in adapter the two methods share the same native
|
|
30
|
+
* path (both native, or both fall back), so one boolean describes both honestly;
|
|
31
|
+
* a custom adapter whose two methods differ in strength should report `false`
|
|
32
|
+
* rather than overclaim.
|
|
33
|
+
*
|
|
34
|
+
* **Why the engine needs these.** Checkpoint commit relies on `atomicBatch`
|
|
35
|
+
* (all-or-nothing); resume relies on `readAfterWrite` (the just-written
|
|
36
|
+
* checkpoint must be observable on the next read); visibility/index scans rely
|
|
37
|
+
* on `scanConsistency` (a scan must not observe torn writes); compare-and-swap
|
|
38
|
+
* state and quota reservation rely on `conditionalBatch`.
|
|
39
|
+
*
|
|
40
|
+
* **Consistency-level scope.** All levels are scoped to a single `Storage`
|
|
41
|
+
* instance. The engine uses one storage instance shared across concurrent
|
|
42
|
+
* workflows, so `linearizable` is the value it relies on for built-in
|
|
43
|
+
* single-process backends.
|
|
44
|
+
*
|
|
45
|
+
* **Opaque-value invariant.** Storage adapters and decorators MUST treat stored
|
|
46
|
+
* values as opaque bytes and MUST NOT inspect or depend on value contents;
|
|
47
|
+
* values MAY later be encrypted or compressed. The engine ranges only over
|
|
48
|
+
* keys, never value bytes. A value-transforming decorator (e.g.
|
|
49
|
+
* `CompressedStorage`) MUST therefore downgrade `conditionalBatch` to `false`,
|
|
50
|
+
* because a caller-supplied `expectedValue` cannot byte-match the transformed
|
|
51
|
+
* stored value.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* import { MemoryStorage } from '@lostgradient/weft';
|
|
56
|
+
* import type { StorageCapabilities } from '@lostgradient/weft/storage/interface';
|
|
57
|
+
*
|
|
58
|
+
* await using storage = new MemoryStorage();
|
|
59
|
+
* const caps: StorageCapabilities = storage.capabilities();
|
|
60
|
+
* console.log(caps.conditionalBatch); // true
|
|
61
|
+
* console.log(caps.readAfterWrite); // 'linearizable'
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export type StorageCapabilities = {
|
|
65
|
+
/**
|
|
66
|
+
* Persistence scope for data written through this storage instance.
|
|
67
|
+
* - `ephemeral`: data is process- or session-local and is lost when the
|
|
68
|
+
* runtime exits or the storage area is cleared (`MemoryStorage`, in-memory
|
|
69
|
+
* SQLite/libSQL, browser-extension session storage).
|
|
70
|
+
* - `local`: data is durably persisted by a local runtime or origin-backed
|
|
71
|
+
* store suitable for same-process recovery checks.
|
|
72
|
+
* - `remote`: data is owned by a remote service or synchronized storage area
|
|
73
|
+
* whose durability and freshness depend on that service.
|
|
74
|
+
*/
|
|
75
|
+
persistence?: 'ephemeral' | 'local' | 'remote';
|
|
76
|
+
/**
|
|
77
|
+
* Visibility of a completed write to a later read, scoped to one `Storage`
|
|
78
|
+
* instance.
|
|
79
|
+
* - `linearizable`: a completed `put`/`batch` is observable by **any**
|
|
80
|
+
* subsequent read through this instance, including reads issued by other
|
|
81
|
+
* concurrent callers sharing the instance (single-process backends
|
|
82
|
+
* serialize all callers).
|
|
83
|
+
* - `session`: only the **same caller's own** ordered operation chain is
|
|
84
|
+
* guaranteed to read its writes; a concurrent caller sharing the instance,
|
|
85
|
+
* or a separate instance/replica, may lag.
|
|
86
|
+
* - `eventual`: even a same-instance read may not observe a just-completed
|
|
87
|
+
* write.
|
|
88
|
+
*/
|
|
89
|
+
readAfterWrite: 'linearizable' | 'session' | 'eventual';
|
|
90
|
+
/**
|
|
91
|
+
* Consistency of a single `scan()` iteration relative to concurrent writes.
|
|
92
|
+
* - `snapshot`: the scan observes one point-in-time view; concurrent writes
|
|
93
|
+
* never appear partially within the iteration.
|
|
94
|
+
* - `best-effort`: the scan may interleave with concurrent writes.
|
|
95
|
+
*/
|
|
96
|
+
scanConsistency: 'snapshot' | 'best-effort';
|
|
97
|
+
/**
|
|
98
|
+
* `batch()` applies all operations atomically (all-or-nothing). Trusted
|
|
99
|
+
* correctness contract — a `true` value the engine relies on for checkpoint
|
|
100
|
+
* commit and does not verify at runtime.
|
|
101
|
+
*/
|
|
102
|
+
atomicBatch: boolean;
|
|
103
|
+
/** `conditionalBatch()` compare-and-swap preconditions are supported. */
|
|
104
|
+
conditionalBatch: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The adapter's bounded-delete methods — `deletePrefix()` and, when present,
|
|
107
|
+
* `deleteRange()` — are implemented natively against the backend's own range
|
|
108
|
+
* machinery rather than as a generic client-side scan-then-`batch()` loop:
|
|
109
|
+
* a single range-scoped SQL `DELETE`, an `IDBKeyRange` delete, or an
|
|
110
|
+
* in-memory range-bounded delete. Adapters that use a two-phase approach
|
|
111
|
+
* (scan keys into an array, then delete in a batch) report `false` even if
|
|
112
|
+
* the delete phase runs in a single transaction — the two-phase pattern IS
|
|
113
|
+
* the scan-and-delete fallback. Adapters that only fall back to the derived
|
|
114
|
+
* `storageDeletePrefixCore`/`storageDeleteRangeCore` helpers also report
|
|
115
|
+
* `false` even though those methods work. This is a strength-of-implementation
|
|
116
|
+
* claim about the adapter's own methods, not a guarantee about a remote
|
|
117
|
+
* backend behind it; an adapter whose two methods differ in strength reports
|
|
118
|
+
* `false`.
|
|
119
|
+
*/
|
|
120
|
+
boundedRangeDelete: boolean;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* The boolean capabilities the engine enforces at runtime via
|
|
124
|
+
* {@link requireStorageCapability}. Today this is only `conditionalBatch` —
|
|
125
|
+
* see the "three kinds of capability" note on {@link StorageCapabilities}. A
|
|
126
|
+
* future capability that needs gating is added here deliberately, keeping the
|
|
127
|
+
* type in lockstep with what is actually enforced rather than implying every
|
|
128
|
+
* boolean capability is gateable.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* import { MemoryStorage } from '@lostgradient/weft';
|
|
133
|
+
* import { requireStorageCapability } from '@lostgradient/weft/storage/interface';
|
|
134
|
+
* import type { GatedStorageCapabilityKey } from '@lostgradient/weft/storage/interface';
|
|
135
|
+
*
|
|
136
|
+
* await using storage = new MemoryStorage();
|
|
137
|
+
* // The third argument's type is GatedStorageCapabilityKey — only the
|
|
138
|
+
* // runtime-gated 'conditionalBatch' is accepted.
|
|
139
|
+
* const capability: GatedStorageCapabilityKey = 'conditionalBatch';
|
|
140
|
+
* requireStorageCapability(storage, capability, 'MyFeature compare-and-swap');
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export type GatedStorageCapabilityKey = 'conditionalBatch';
|
|
144
|
+
/**
|
|
145
|
+
* Fail fast when a feature requires a runtime-gated storage capability the
|
|
146
|
+
* backend does not provide. Reads the honest {@link StorageCapabilities} report
|
|
147
|
+
* (not mere method presence), so a value-transforming decorator that downgrades
|
|
148
|
+
* a capability is respected. Call this at the first use of a feature — not at
|
|
149
|
+
* engine startup — so the diagnostic points at the operation that needs the
|
|
150
|
+
* guarantee.
|
|
151
|
+
*
|
|
152
|
+
* Only {@link GatedStorageCapabilityKey} capabilities are accepted: the
|
|
153
|
+
* non-gated `atomicBatch`/`readAfterWrite`/`scanConsistency` are trusted
|
|
154
|
+
* contracts the engine does not enforce, and `boundedRangeDelete` is an
|
|
155
|
+
* operational hint, so gating on any of them would be meaningless.
|
|
156
|
+
*
|
|
157
|
+
* @throws {Error} When `storage.capabilities()[capability]` is `false`.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* import { MemoryStorage } from '@lostgradient/weft';
|
|
162
|
+
* import { requireStorageCapability } from '@lostgradient/weft/storage/interface';
|
|
163
|
+
*
|
|
164
|
+
* await using storage = new MemoryStorage();
|
|
165
|
+
* requireStorageCapability(storage, 'conditionalBatch', 'AtomicState compare-and-swap');
|
|
166
|
+
* // Memory supports conditionalBatch, so this returns without throwing.
|
|
167
|
+
* ```
|
|
168
|
+
*/
|
|
169
|
+
export declare function requireStorageCapability(storage: Storage, capability: GatedStorageCapabilityKey, featureName: string): void;
|
|
170
|
+
/**
|
|
171
|
+
* Fail fast when a storage backend is not conservative enough for boot-time
|
|
172
|
+
* durable recovery. This is intentionally stricter than the engine's per-feature
|
|
173
|
+
* gates: it rejects ephemeral, remote, eventual, best-effort, non-atomic, and
|
|
174
|
+
* non-CAS storage before an application starts in durable mode.
|
|
175
|
+
*
|
|
176
|
+
* @throws {Error} When the backend's capability row is not suitable for recovery.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```ts
|
|
180
|
+
* import { assertDurableStorageForRecovery } from '@lostgradient/weft';
|
|
181
|
+
* import { SQLiteStorage } from '@lostgradient/weft/storage/sqlite';
|
|
182
|
+
*
|
|
183
|
+
* await using storage = new SQLiteStorage('./weft.db');
|
|
184
|
+
* assertDurableStorageForRecovery(storage);
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
export declare function assertDurableStorageForRecovery(storage: Storage): void;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function requireStorageCapability(storage, capability, featureName) {
|
|
2
|
+
if (!storage.capabilities()[capability])
|
|
3
|
+
throw Error(`Feature "${featureName}" requires storage capability "${capability}", but this storage backend does not provide it.`);
|
|
4
|
+
}
|
|
5
|
+
export function assertDurableStorageForRecovery(storage) {
|
|
6
|
+
const capabilities = storage.capabilities(), failures = [];
|
|
7
|
+
if (capabilities.persistence !== "local")
|
|
8
|
+
failures.push(`persistence must be "local" (got "${capabilities.persistence}")`);
|
|
9
|
+
if (capabilities.readAfterWrite !== "linearizable")
|
|
10
|
+
failures.push(`readAfterWrite must be "linearizable" (got "${capabilities.readAfterWrite}")`);
|
|
11
|
+
if (capabilities.scanConsistency !== "snapshot")
|
|
12
|
+
failures.push(`scanConsistency must be "snapshot" (got "${capabilities.scanConsistency}")`);
|
|
13
|
+
if (!capabilities.atomicBatch)
|
|
14
|
+
failures.push("atomicBatch must be true");
|
|
15
|
+
if (!capabilities.conditionalBatch)
|
|
16
|
+
failures.push("conditionalBatch must be true");
|
|
17
|
+
if (failures.length > 0)
|
|
18
|
+
throw Error(`Storage is not durable enough for recovery: ${failures.join("; ")}.`);
|
|
19
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage decorator that transparently compresses and decompresses payloads.
|
|
3
|
+
* Wraps any {@link Storage} implementation and applies compression above a
|
|
4
|
+
* configurable size threshold.
|
|
5
|
+
*
|
|
6
|
+
* @module storage/compressed-storage
|
|
7
|
+
*/
|
|
8
|
+
import type { CompressionOptions } from '../core/compression.ts';
|
|
9
|
+
import { type BatchOperation, type ScanOptions, type Storage, type StorageCapabilities } from './interface.ts';
|
|
10
|
+
/**
|
|
11
|
+
* {@link Storage} decorator that transparently compresses payloads above a
|
|
12
|
+
* configurable size threshold before writing and decompresses on read.
|
|
13
|
+
*
|
|
14
|
+
* Wraps any `Storage` implementation — pass a {@link BunSQLiteStorage},
|
|
15
|
+
* {@link MemoryStorage}, or any other backend as the first argument. The same
|
|
16
|
+
* compression algorithm and threshold apply to every stored key.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { CompressedStorage } from '@lostgradient/weft/storage/compressed';
|
|
21
|
+
* import { workflow, Engine, MemoryStorage } from '@lostgradient/weft';
|
|
22
|
+
*
|
|
23
|
+
* await using inner = new MemoryStorage();
|
|
24
|
+
* await using storage = new CompressedStorage(inner, {
|
|
25
|
+
* algorithm: 'gzip',
|
|
26
|
+
* threshold: 1024,
|
|
27
|
+
* });
|
|
28
|
+
* await using engine = new Engine({ storage });
|
|
29
|
+
*
|
|
30
|
+
* engine.register(workflow({ name: 'noop' }).execute(async function* () { return 'done'; }));
|
|
31
|
+
* const handle = await engine.start('noop', null);
|
|
32
|
+
* console.log(await handle.result()); // 'done'
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare class CompressedStorage implements Storage {
|
|
36
|
+
#private;
|
|
37
|
+
constructor(inner: Storage, options?: CompressionOptions);
|
|
38
|
+
capabilities(): StorageCapabilities;
|
|
39
|
+
get(key: string): Promise<Uint8Array | null>;
|
|
40
|
+
put(key: string, value: Uint8Array): Promise<void>;
|
|
41
|
+
delete(key: string): Promise<void>;
|
|
42
|
+
scan(prefix: string, options?: ScanOptions): AsyncIterable<[string, Uint8Array]>;
|
|
43
|
+
batch(operations: BatchOperation[]): Promise<void>;
|
|
44
|
+
[Symbol.dispose](): void;
|
|
45
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var A=Object.defineProperty;var S=(j)=>j;function y(j,J){this[j]=S.bind(null,J)}var p=(j,J)=>{for(var W in J)A(j,W,{get:J[W],enumerable:!0,configurable:!0,set:y.bind(J,W)})};var Y=(j,J)=>()=>(j&&(J=j(j=0)),J);function x(){return typeof(K&&"bun"in K?K.bun:globalThis.Bun)<"u"}function I(){if(K&&"process"in K)return K.process;return globalThis.process}function d(j){if(x())return Bun.sleep(j);return new Promise((J)=>setTimeout(J,j))}function z(j){let J=v;for(let W=0;W<j.length;W++)J^=BigInt(j[W]),J=J*O&_;return J.toString(16).padStart(16,"0")}function n(j){return z(j)}function i(j){return z(b.encode(j))}function w(j){let W=I()?.getBuiltinModule;if(typeof W!=="function")return;return W(j)}function s(j){if(x())return Bun.file(j).size;let J=w("node:fs");if(!J)throw Error("fileSize() requires Bun or Node 22.5+ (process.getBuiltinModule). Not available in browser or edge runtimes.");try{return J.statSync(j).size}catch(W){if(typeof W==="object"&&W!==null&&"code"in W&&W.code==="ENOENT")return 0;throw W}}function C(){let j=w("node:zlib");if(!j)throw Error("gzip/gunzip require Bun or Node 22.5+ (process.getBuiltinModule). "+"Not available in browser or edge runtimes \u2014 use CompressionStream directly.");return j}function P(j){if(x())return new Uint8Array(Bun.gzipSync(new Uint8Array(j)));return new Uint8Array(C().gzipSync(j))}function G(j){if(x())return new Uint8Array(Bun.gunzipSync(new Uint8Array(j)));return new Uint8Array(C().gunzipSync(j))}function N(){return w("node:zlib")}var K,v=0xcbf29ce484222325n,O=0x00000100000001b3n,_=0xffffffffffffffffn,b;var f=Y(()=>{b=new TextEncoder});function L(){let j=N();if(!j)throw Error("Brotli compression requires Bun or Node 22.5+ with process.getBuiltinModule support. Use gzip compression for browser/edge runtimes.");return j}function T(j){return new Uint8Array(L().brotliCompressSync(j))}function h(j){return new Uint8Array(L().brotliDecompressSync(j))}function D(j){return c(j)}function c(j){switch(j){case"gzip":return{algorithm:"gzip",compress(J){return P(J)}};case"brotli":return{algorithm:"brotli",compress(J){return T(J)}};case"none":return{algorithm:"none",compress(J){return J}}}}async function U(j,J,W){if(j.length<W||J.algorithm==="none"){let $=new Uint8Array(j.length+X);return $[0]=V,$[1]=F,$.set(j,X),$}let q=await J.compress(j);if(q.length+X>=j.length+X){let $=new Uint8Array(j.length+X);return $[0]=V,$[1]=F,$.set(j,X),$}let B=J.algorithm==="gzip"?Z:g,Q=new Uint8Array(q.length+X);return Q[0]=V,Q[1]=B,Q.set(q,X),Q}async function k(j){if(j.length<X)throw Error("Compression payload missing 2-byte header.");if(j[0]!==V)throw Error("Compression payload missing magic byte 0xC1.");let J=j[1],W=j.slice(X);switch(J){case F:return W;case Z:return G(W);case g:return h(W);default:throw Error(`Compression payload uses unsupported algorithm byte 0x${J.toString(16).padStart(2,"0")}.`)}}function H(j){return{threshold:j?.threshold??E,algorithm:j?.algorithm??R}}var V=193,F=0,Z=1,g=2,X=2,E=4096,R="gzip";var M=Y(()=>{f()});var m;var u=Y(()=>{M();m=class m{#j;#J;#W;constructor(j,J){this.#j=j;let W=H(J);if(this.#J=D(W.algorithm),this.#W=W.threshold,j.query){let q=j.query.bind(j);Object.defineProperty(this,"query",{value:q,enumerable:!0,configurable:!0})}}capabilities(){let j=this.#j.capabilities();return{...j.persistence===void 0?{}:{persistence:j.persistence},readAfterWrite:j.readAfterWrite,scanConsistency:j.scanConsistency,atomicBatch:j.atomicBatch,conditionalBatch:!1,boundedRangeDelete:!1}}async get(j){let J=await this.#j.get(j);if(!J)return null;return k(J)}async put(j,J){let W=await U(J,this.#J,this.#W);return this.#j.put(j,W)}async delete(j){return this.#j.delete(j)}async*scan(j,J){for await(let[W,q]of this.#j.scan(j,J))yield[W,await k(q)]}async batch(j){let J=await Promise.all(j.map(async(W)=>{if(W.type==="put")return{type:"put",key:W.key,value:await U(W.value,this.#J,this.#W)};return W}));return this.#j.batch(J)}[Symbol.dispose](){this.#j[Symbol.dispose]()}}});u();export{m as CompressedStorage};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constant scope for workflow-type-shared durable state (single source of truth;
|
|
3
|
+
* never inline the literal). Keys live under `state:workflow-scope:` — distinct
|
|
4
|
+
* from the legacy `state:workflow:<tenantId>:` layout so a historical tenant id
|
|
5
|
+
* cannot alias in, making a future re-partition a key rename, not a data
|
|
6
|
+
* migration. See `KEYS.stateWorkflow` in `./interface.ts`.
|
|
7
|
+
*
|
|
8
|
+
* Internal leaf module (no imports) so both `./interface.ts` and
|
|
9
|
+
* `../core/atomic-state.ts` can depend on it without an import cycle.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { DEFAULT_SCOPE } from '@lostgradient/weft/storage/interface';
|
|
14
|
+
* console.log(DEFAULT_SCOPE); // 'default'
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_SCOPE = "default";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_SCOPE = "default";
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded range delete: the `deleteRange` contract, its option types, the
|
|
3
|
+
* validating normalizer, and the public dispatcher. Split out from
|
|
4
|
+
* `interface.ts` to keep that module focused; this imports the `Storage` type
|
|
5
|
+
* (type-only) from there and the derived fallback (value) from
|
|
6
|
+
* `derived-operations.ts`, so there is no runtime import cycle.
|
|
7
|
+
*
|
|
8
|
+
* @module storage/delete-range
|
|
9
|
+
*/
|
|
10
|
+
import { type Storage } from './interface.ts';
|
|
11
|
+
/**
|
|
12
|
+
* Bounds for a bounded range delete ({@link Storage.deleteRange}).
|
|
13
|
+
*
|
|
14
|
+
* A deliberate subset of `ScanOptions`: `reverse` is intentionally absent so a
|
|
15
|
+
* delete can never run high-to-low. At least one of `gt`/`gte`/`lt`/`lte` must
|
|
16
|
+
* be present — see {@link normalizeDeleteRangeOptions}, which rejects an
|
|
17
|
+
* unbounded request so the operation can never silently degrade into a
|
|
18
|
+
* whole-prefix wipe (use {@link Storage.deletePrefix} for that).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import type { DeleteRangeOptions } from '@lostgradient/weft';
|
|
23
|
+
*
|
|
24
|
+
* // Delete events strictly below a sequence watermark.
|
|
25
|
+
* const options: DeleteRangeOptions = { lt: 'ev:wf:0000000003' };
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export type DeleteRangeOptions = {
|
|
29
|
+
gt?: string;
|
|
30
|
+
gte?: string;
|
|
31
|
+
lt?: string;
|
|
32
|
+
lte?: string;
|
|
33
|
+
limit?: number;
|
|
34
|
+
};
|
|
35
|
+
declare const normalizedDeleteRangeBrand: unique symbol;
|
|
36
|
+
/**
|
|
37
|
+
* A {@link DeleteRangeOptions} that has passed {@link normalizeDeleteRangeOptions}.
|
|
38
|
+
*
|
|
39
|
+
* The brand lives strictly below the public boundary: every public surface
|
|
40
|
+
* accepts raw `DeleteRangeOptions`, but internal SQL builders that would emit a
|
|
41
|
+
* destructive statement require this type, so an unvalidated or unbounded object
|
|
42
|
+
* cannot reach them — that is a compile error, not a runtime check. The only way
|
|
43
|
+
* to obtain a value of this type is to call {@link normalizeDeleteRangeOptions}.
|
|
44
|
+
*/
|
|
45
|
+
export type NormalizedDeleteRangeOptions = DeleteRangeOptions & {
|
|
46
|
+
readonly [normalizedDeleteRangeBrand]: true;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Validate and canonicalize {@link DeleteRangeOptions} into a branded
|
|
50
|
+
* {@link NormalizedDeleteRangeOptions}.
|
|
51
|
+
*
|
|
52
|
+
* This is the only door to the branded type, and the single source of truth for
|
|
53
|
+
* the `deleteRange` contract:
|
|
54
|
+
* - At least one of `gt`/`gte`/`lt`/`lte` must be present; an unbounded request
|
|
55
|
+
* throws rather than degrading into a whole-prefix delete.
|
|
56
|
+
* - Each bound, when present, must be a string.
|
|
57
|
+
* - `limit`, when present, must be a finite non-negative integer (a negative
|
|
58
|
+
* `LIMIT` silently means "no limit" in SQLite — catastrophic for a delete).
|
|
59
|
+
* - Only `gt`/`gte`/`lt`/`lte`/`limit` are copied; `reverse` and any other
|
|
60
|
+
* field on a wider object are dropped, so a delete can never run high-to-low.
|
|
61
|
+
*
|
|
62
|
+
* Idempotent: re-normalizing an already-normalized value returns an equivalent
|
|
63
|
+
* one, so passing the dispatcher's result into a native adapter method is safe.
|
|
64
|
+
*
|
|
65
|
+
* @throws {Error} When no bound is present, a bound is not a string, or `limit`
|
|
66
|
+
* is not a finite non-negative integer.
|
|
67
|
+
*
|
|
68
|
+
* Internal helper: not exported from any package subpath. Callers reach it
|
|
69
|
+
* transitively through {@link storageDeleteRange} (which is public). No `@example`
|
|
70
|
+
* here for that reason — it has no public import path, like the derived `*Core`
|
|
71
|
+
* helpers in `./derived-operations.ts`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function normalizeDeleteRangeOptions(options: DeleteRangeOptions): NormalizedDeleteRangeOptions;
|
|
74
|
+
/**
|
|
75
|
+
* Delete the keys under `prefix` that fall within the given bounds, using the
|
|
76
|
+
* adapter's native `deleteRange` when available or a batched scan-and-delete
|
|
77
|
+
* fallback otherwise. Returns the number of keys deleted.
|
|
78
|
+
*
|
|
79
|
+
* Options are validated and canonicalized once here (see
|
|
80
|
+
* {@link normalizeDeleteRangeOptions}): an unbounded request throws rather than
|
|
81
|
+
* wiping the whole prefix, and `reverse` can never take effect. When `limit` is
|
|
82
|
+
* set, the lowest (ascending) keys in range are deleted first.
|
|
83
|
+
*
|
|
84
|
+
* @throws {Error} When `options` has no bound, a non-string bound, or an invalid `limit`.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* import { MemoryStorage, storageDeleteRange } from '@lostgradient/weft';
|
|
89
|
+
*
|
|
90
|
+
* await using storage = new MemoryStorage();
|
|
91
|
+
* await storage.put('ev:wf:0000000001', new Uint8Array([1]));
|
|
92
|
+
* await storage.put('ev:wf:0000000002', new Uint8Array([2]));
|
|
93
|
+
* await storage.put('ev:wf:0000000003', new Uint8Array([3]));
|
|
94
|
+
* // Delete events strictly below sequence 3.
|
|
95
|
+
* const deleted = await storageDeleteRange(storage, 'ev:wf:', { lt: 'ev:wf:0000000003' });
|
|
96
|
+
* console.log(deleted); // 2
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare function storageDeleteRange(storage: Storage, prefix: string, options: DeleteRangeOptions): Promise<number>;
|
|
100
|
+
/** One side of a resolved lexicographic delete range. `open` means exclusive. */
|
|
101
|
+
export type DeleteRangeBound = {
|
|
102
|
+
key: string;
|
|
103
|
+
open: boolean;
|
|
104
|
+
};
|
|
105
|
+
export declare function resolveDeleteRangeBounds(prefix: string, options: NormalizedDeleteRangeOptions): {
|
|
106
|
+
lower: DeleteRangeBound;
|
|
107
|
+
upper: DeleteRangeBound;
|
|
108
|
+
} | null;
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { storageDeleteRangeCore } from "./derived-operations.js";
|
|
2
|
+
import { resolvePrefixRangeEnd } from "./interface.js";
|
|
3
|
+
function normalizeDeleteRangeLimit(limit) {
|
|
4
|
+
if (limit === void 0)
|
|
5
|
+
return;
|
|
6
|
+
if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 0)
|
|
7
|
+
throw Error("deleteRange limit must be a finite non-negative integer");
|
|
8
|
+
return limit === 0 ? 0 : limit;
|
|
9
|
+
}
|
|
10
|
+
export function normalizeDeleteRangeOptions(options) {
|
|
11
|
+
const normalized = {};
|
|
12
|
+
let hasBound = !1;
|
|
13
|
+
for (const bound of ["gt", "gte", "lt", "lte"]) {
|
|
14
|
+
const value = options[bound];
|
|
15
|
+
if (value === void 0)
|
|
16
|
+
continue;
|
|
17
|
+
if (typeof value !== "string")
|
|
18
|
+
throw Error("deleteRange bounds must be strings");
|
|
19
|
+
normalized[bound] = value;
|
|
20
|
+
hasBound = !0;
|
|
21
|
+
}
|
|
22
|
+
if (!hasBound)
|
|
23
|
+
throw Error("deleteRange requires at least one of gt/gte/lt/lte; use deletePrefix to delete a whole prefix");
|
|
24
|
+
const limit = normalizeDeleteRangeLimit(options.limit);
|
|
25
|
+
if (limit !== void 0)
|
|
26
|
+
normalized.limit = limit;
|
|
27
|
+
return normalized;
|
|
28
|
+
}
|
|
29
|
+
export async function storageDeleteRange(storage, prefix, options) {
|
|
30
|
+
const normalized = normalizeDeleteRangeOptions(options);
|
|
31
|
+
if (storage.deleteRange)
|
|
32
|
+
return storage.deleteRange(prefix, normalized);
|
|
33
|
+
return storageDeleteRangeCore(storage, prefix, normalized);
|
|
34
|
+
}
|
|
35
|
+
function resolveLowerBound(prefix, options) {
|
|
36
|
+
const bound = { key: prefix, open: !1 };
|
|
37
|
+
if (options.gte !== void 0 && options.gte > bound.key) {
|
|
38
|
+
bound.key = options.gte;
|
|
39
|
+
bound.open = !1;
|
|
40
|
+
}
|
|
41
|
+
if (options.gt !== void 0 && options.gt >= bound.key) {
|
|
42
|
+
bound.key = options.gt;
|
|
43
|
+
bound.open = !0;
|
|
44
|
+
}
|
|
45
|
+
return bound;
|
|
46
|
+
}
|
|
47
|
+
function resolveUpperBound(prefix, options) {
|
|
48
|
+
const bound = { key: resolvePrefixRangeEnd(prefix), open: !0 };
|
|
49
|
+
if (options.lt !== void 0 && options.lt <= bound.key) {
|
|
50
|
+
bound.key = options.lt;
|
|
51
|
+
bound.open = !0;
|
|
52
|
+
}
|
|
53
|
+
if (options.lte !== void 0 && options.lte < bound.key) {
|
|
54
|
+
bound.key = options.lte;
|
|
55
|
+
bound.open = !1;
|
|
56
|
+
}
|
|
57
|
+
return bound;
|
|
58
|
+
}
|
|
59
|
+
export function resolveDeleteRangeBounds(prefix, options) {
|
|
60
|
+
const lower = resolveLowerBound(prefix, options), upper = resolveUpperBound(prefix, options);
|
|
61
|
+
if (lower.key > upper.key || lower.key === upper.key && (lower.open || upper.open))
|
|
62
|
+
return null;
|
|
63
|
+
return { lower, upper };
|
|
64
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { NormalizedDeleteRangeOptions } from './delete-range.ts';
|
|
2
|
+
import { type ScanOptions, type Storage } from './interface.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Non-dispatching implementations of the derived storage operations.
|
|
5
|
+
*
|
|
6
|
+
* These helpers compute `has`/`keys`/`count`/`deletePrefix` purely from the
|
|
7
|
+
* required `get`/`scan`/`batch` primitives. Unlike the public `storageHas`,
|
|
8
|
+
* `storageKeys`, `storageCount`, and `storageDeletePrefix` dispatchers in
|
|
9
|
+
* `./interface.ts`, they **never** consult the adapter's optional fast-path
|
|
10
|
+
* methods. That distinction matters in two places:
|
|
11
|
+
*
|
|
12
|
+
* 1. The public dispatchers call these as their fallback branch (when the
|
|
13
|
+
* adapter omits the optional method), so the derived logic lives here once.
|
|
14
|
+
* 2. Adapters that *do* expose the optional methods (e.g. {@link HTTPStorage},
|
|
15
|
+
* {@link WebExtensionStorage}) implement them by delegating here. They cannot
|
|
16
|
+
* delegate to the public dispatchers, which would re-dispatch back into the
|
|
17
|
+
* adapter method and recurse forever.
|
|
18
|
+
*
|
|
19
|
+
* This module is internal: it is not listed as a package subpath export and must
|
|
20
|
+
* not be re-exported from public entry points.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Core `has` derivation: a key exists when `get` returns a non-null value.
|
|
24
|
+
*/
|
|
25
|
+
export declare function storageHasCore(storage: Storage, key: string): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Core `keys` derivation: project `scan` entries down to their keys, preserving
|
|
28
|
+
* the adapter's `scan` ordering, `limit`, and `reverse` semantics.
|
|
29
|
+
*/
|
|
30
|
+
export declare function storageKeysCore(storage: Storage, prefix: string, options?: ScanOptions): AsyncIterable<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Core `count` derivation: count the keys matching a prefix.
|
|
33
|
+
*/
|
|
34
|
+
export declare function storageCountCore(storage: Storage, prefix: string): Promise<number>;
|
|
35
|
+
/**
|
|
36
|
+
* Core `deletePrefix` derivation: collect the matching keys and remove them in a
|
|
37
|
+
* single batch. Returns the number of keys deleted.
|
|
38
|
+
*/
|
|
39
|
+
export declare function storageDeletePrefixCore(storage: Storage, prefix: string): Promise<number>;
|
|
40
|
+
/**
|
|
41
|
+
* Core `deleteRange` derivation: scan the keys under `prefix` that match the
|
|
42
|
+
* (already-normalized) bounds and remove them in a single batch. Returns the
|
|
43
|
+
* number of keys deleted.
|
|
44
|
+
*
|
|
45
|
+
* The bounds are honored by `scan` via `matchesScanOptions`; `limit` caps the
|
|
46
|
+
* delete to the lowest (ascending) keys in range. Like
|
|
47
|
+
* {@link storageDeletePrefixCore}, this is best-effort over the keys observed by
|
|
48
|
+
* the scan: a key inserted after the scan begins is not deleted. Takes a
|
|
49
|
+
* {@link NormalizedDeleteRangeOptions} because the only caller, the public
|
|
50
|
+
* `storageDeleteRange` dispatcher, validates first — keeping this module's
|
|
51
|
+
* type-only dependency on `interface.ts` intact (no runtime import cycle).
|
|
52
|
+
*/
|
|
53
|
+
export declare function storageDeleteRangeCore(storage: Storage, prefix: string, options: NormalizedDeleteRangeOptions): Promise<number>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export async function storageHasCore(storage, key) {
|
|
2
|
+
return await storage.get(key) !== null;
|
|
3
|
+
}
|
|
4
|
+
export async function* storageKeysCore(storage, prefix, options) {
|
|
5
|
+
for await (const [key] of storage.scan(prefix, options))
|
|
6
|
+
yield key;
|
|
7
|
+
}
|
|
8
|
+
export async function storageCountCore(storage, prefix) {
|
|
9
|
+
let count = 0;
|
|
10
|
+
for await (const _key of storageKeysCore(storage, prefix))
|
|
11
|
+
count++;
|
|
12
|
+
return count;
|
|
13
|
+
}
|
|
14
|
+
export async function storageDeletePrefixCore(storage, prefix) {
|
|
15
|
+
const operations = [];
|
|
16
|
+
for await (const key of storageKeysCore(storage, prefix))
|
|
17
|
+
operations.push({ type: "delete", key });
|
|
18
|
+
if (operations.length === 0)
|
|
19
|
+
return 0;
|
|
20
|
+
await storage.batch(operations);
|
|
21
|
+
return operations.length;
|
|
22
|
+
}
|
|
23
|
+
export async function storageDeleteRangeCore(storage, prefix, options) {
|
|
24
|
+
const operations = [];
|
|
25
|
+
for await (const key of storageKeysCore(storage, prefix, options))
|
|
26
|
+
operations.push({ type: "delete", key });
|
|
27
|
+
if (operations.length === 0)
|
|
28
|
+
return 0;
|
|
29
|
+
await storage.batch(operations);
|
|
30
|
+
return operations.length;
|
|
31
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type DeleteRangeOptions } from './delete-range.ts';
|
|
2
|
+
import { type BatchOperation, type ConditionalBatchCondition, type ScanOptions, type Storage, type StorageCapabilities } from './interface.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Options for connecting {@link HTTPStorage} to a remote Weft storage API.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { HTTPStorage, type HTTPStorageOptions } from '@lostgradient/weft/storage/http';
|
|
9
|
+
*
|
|
10
|
+
* const token = 'example-token';
|
|
11
|
+
* const options: HTTPStorageOptions = {
|
|
12
|
+
* baseUrl: 'https://weft.example.com',
|
|
13
|
+
* headers: { authorization: `Bearer ${token}` },
|
|
14
|
+
* };
|
|
15
|
+
* const storage = new HTTPStorage(options);
|
|
16
|
+
* void storage;
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export type HTTPStorageOptions = {
|
|
20
|
+
baseUrl: string | URL;
|
|
21
|
+
headers?: Record<string, string>;
|
|
22
|
+
/**
|
|
23
|
+
* Whether the remote server's storage backend supports compare-and-swap.
|
|
24
|
+
* The client cannot detect this — it depends on the server's backend — so the
|
|
25
|
+
* honest default is `false`: a feature gated on `conditionalBatch` fails fast
|
|
26
|
+
* locally instead of issuing a request the server answers with `501`. Set
|
|
27
|
+
* `true` only when you have verified the remote backend implements it.
|
|
28
|
+
*
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
remoteConditionalBatch?: boolean;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Remote {@link Storage} adapter backed by Weft's storage REST endpoints.
|
|
35
|
+
*
|
|
36
|
+
* Single-value reads and writes use `application/octet-stream`; scans stream
|
|
37
|
+
* newline-delimited JSON entries with base64-encoded values.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import { HTTPStorage } from '@lostgradient/weft/storage/http';
|
|
42
|
+
*
|
|
43
|
+
* const token = 'example-token';
|
|
44
|
+
* await using storage = new HTTPStorage({
|
|
45
|
+
* baseUrl: 'https://weft.example.com',
|
|
46
|
+
* headers: { authorization: `Bearer ${token}` },
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare class HTTPStorage implements Storage {
|
|
51
|
+
#private;
|
|
52
|
+
constructor(options: HTTPStorageOptions);
|
|
53
|
+
capabilities(): StorageCapabilities;
|
|
54
|
+
get(key: string): Promise<Uint8Array | null>;
|
|
55
|
+
put(key: string, value: Uint8Array): Promise<void>;
|
|
56
|
+
delete(key: string): Promise<void>;
|
|
57
|
+
scan(prefix: string, options?: ScanOptions): AsyncIterable<[string, Uint8Array]>;
|
|
58
|
+
batch(operations: BatchOperation[]): Promise<void>;
|
|
59
|
+
conditionalBatch(conditions: ConditionalBatchCondition[], operations: BatchOperation[]): Promise<boolean>;
|
|
60
|
+
has(key: string): Promise<boolean>;
|
|
61
|
+
keys(prefix: string, options?: ScanOptions): AsyncIterable<string>;
|
|
62
|
+
count(prefix: string): Promise<number>;
|
|
63
|
+
deletePrefix(prefix: string): Promise<number>;
|
|
64
|
+
deleteRange(prefix: string, options: DeleteRangeOptions): Promise<number>;
|
|
65
|
+
scoped(prefix: string): Storage;
|
|
66
|
+
[Symbol.dispose](): void;
|
|
67
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var k=Object.defineProperty;var u=(J)=>J;function w(J,Y){this[J]=u.bind(null,Y)}var n=(J,Y)=>{for(var Z in Y)k(J,Z,{get:Y[Z],enumerable:!0,configurable:!0,set:w.bind(Y,Z)})};function U(J){let Y=[];for(let Z=0;Z<J.length;Z+=512)Y.push(String.fromCharCode(...J.subarray(Z,Z+512)));return btoa(Y.join(""))}function T(J){let Y=atob(J),Z=new Uint8Array(Y.length);for(let G=0;G<Y.length;G+=1)Z[G]=Y.charCodeAt(G);return Z}function N(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}async function M(J,Y){return await J.get(Y)!==null}async function*Q(J,Y,Z){for await(let[G]of J.scan(Y,Z))yield G}async function V(J,Y){let Z=0;for await(let G of Q(J,Y))Z++;return Z}async function E(J,Y){let Z=[];for await(let G of Q(J,Y))Z.push({type:"delete",key:G});if(Z.length===0)return 0;return await J.batch(Z),Z.length}async function H(J,Y,Z){let G=[];for await(let X of Q(J,Y,Z))G.push({type:"delete",key:X});if(G.length===0)return 0;return await J.batch(G),G.length}function q(J,Y,Z){if(!J.capabilities()[Y])throw Error(`Feature "${Z}" requires storage capability "${Y}", but this storage backend does not provide it.`)}var R="default";function O(J){return J.length>0?J.slice(0,-1)+String.fromCharCode(J.charCodeAt(J.length-1)+1):"ÿ"}function _J(J,Y={}){if(Y.gt!==void 0&&J<=Y.gt)return!1;if(Y.gte!==void 0&&J<Y.gte)return!1;if(Y.lt!==void 0&&J>=Y.lt)return!1;if(Y.lte!==void 0&&J>Y.lte)return!1;return!0}function FJ(J,Y){if(J===null||Y===null)return J===Y;if(J.byteLength!==Y.byteLength)return!1;for(let Z=0;Z<J.byteLength;Z++)if(J[Z]!==Y[Z])return!1;return!0}async function P(J,Y){if(J.has)return J.has(Y);return M(J,Y)}function h(J,Y,Z){if(J.keys)return J.keys(Y,Z);return Q(J,Y,Z)}async function C(J,Y){if(J.count)return J.count(Y);return V(J,Y)}async function v(J,Y){if(J.deletePrefix)return J.deletePrefix(Y);return E(J,Y)}async function K(J,Y,Z){if(q(J,"conditionalBatch","storageConditionalBatch"),!J.conditionalBatch)throw Error("This storage backend reports conditionalBatch capability but does not implement the conditionalBatch() method.");return J.conditionalBatch(Y,Z)}function $(J){return encodeURIComponent(J)}function QJ(J){try{return decodeURIComponent(J)}catch{return null}}var _=(J)=>String(J).padStart(16,"0"),WJ={workflow:(J)=>`wf:${$(J)}`,checkpoint:(J)=>`wf:${$(J)}:ckpt`,checkpointHistory:(J,Y)=>`wf:${$(J)}:ckpt:${String(Y).padStart(10,"0")}`,timelinePrefix:(J)=>`wf:${$(J)}:timeline:`,timeline:(J,Y)=>`wf:${$(J)}:timeline:${String(Y).padStart(10,"0")}`,schedule:(J)=>`schedule:${$(J)}`,scheduleTick:(J,Y)=>`schedule-due:${String(J).padStart(16,"0")}:${$(Y)}`,scheduleRun:(J)=>`schedule-run:${$(J)}`,operation:(J,Y,Z)=>`op:${J}:${_(Y)}:${Z}`,operationInflight:(J)=>`op:inflight:${J}`,operationQueued:(J)=>`op:queued:${J}`,operationResolved:(J)=>`op:resolved:${J}`,bulkOperationAuditPrefix:()=>"audit:bulk:",bulkOperationAudit:(J,Y,Z)=>`audit:bulk:${_(J)}:${$(Y)}:${$(Z)}`,operationResolvedByTimePrefix:()=>"op:resolved-by-time:",operationResolvedByTime:(J,Y)=>`op:resolved-by-time:${_(J)}:${$(Y)}`,asyncActivity:(J,Y)=>`async-act:v1:${$(J)}:${$(Y)}`,activityReconciliationPrefix:(J)=>`actrec:v1:${$(J)}:`,activityReconciliation:(J,Y,Z)=>`actrec:v1:${$(J)}:${$(Y)}:${Z}`,eventPrefix:(J)=>`ev:${$(J)}:`,event:(J,Y)=>`ev:${$(J)}:${String(Y).padStart(10,"0")}`,eventHead:(J)=>`ev:${$(J)}:head`,eventWatermark:(J)=>`ev:${$(J)}:watermark`,signal:(J,Y,Z)=>`sig:${$(J)}:${Y}:${$(Z)}`,signalSequence:(J)=>`sigseq:v1:${$(J)}`,signalAcceptedResponsePrefix:(J)=>`sigres:v1:${$(J)}:`,signalAcceptedResponse:(J,Y,Z)=>`sigres:v1:${$(J)}:${$(Y)}:${$(Z)}`,deadline:(J,Y)=>`wf-deadline:${_(J)}:${$(Y)}`,terminalCleanup:(J,Y)=>`wf-cleanup:${_(J)}:${$(Y)}`,delayedStart:(J,Y)=>`wf-delayed:${_(J)}:${$(Y)}`,terminalWorkflowPrefix:()=>"wf-terminal:",terminalWorkflow:(J,Y)=>`wf-terminal:${_(J)}:${$(Y)}`,attribute:(J)=>`attr:${$(J)}`,attributeIndex:(J,Y,Z)=>`idx:${J}:${Y}:${$(Z)}`,tagIndex:(J,Y)=>`tag:${$(J)}:${$(Y)}`,updatePrefix:(J)=>`upd:${$(J)}:`,update:(J,Y)=>`upd:${$(J)}:${Y}`,updateResponse:(J)=>`upr:${J}`,updateIdempotency:(J,Y)=>`upk:${$(J)}:${Y}`,budget:(J,Y,Z)=>`budget:${J}:${Y}:${Z}`,review:(J,Y)=>`review:${$(J)}:${Y}`,workflowHeaders:(J)=>`wf-headers:${$(J)}`,terminalCleanupNeeded:(J)=>`wf-cleanup-needed:${$(J)}`,offload:(J,Y)=>`offload:${$(J)}:${Y}`,archive:(J,Y)=>`archive:${$(J)}:${Y}`,stateExecution:(J,Y)=>`state:execution:${$(J)}:${$(Y)}`,stateWorkflow:(J,Y)=>`state:workflow-scope:${R}:${$(J)}:${$(Y)}`,streamChunkPrefix:(J,Y)=>`blob:${$(J)}:${Y}:chunk:`,streamChunk:(J,Y,Z)=>`blob:${$(J)}:${Y}:chunk:${String(Z).padStart(10,"0")}`,streamMetadata:(J,Y)=>`blob:${$(J)}:${Y}:meta`,budgetCharged:(J)=>`budget-charged:${J}`,toolEffect:(J,Y,Z)=>`tool-effect:${$(J)}:${Y}:${Z}`,workflowVisibilityStatus:(J,Y)=>`wf-idx-status:${$(J)}:${$(Y)}`,workflowVisibilityType:(J,Y)=>`wf-idx-type:${$(J)}:${$(Y)}`,workflowVisibilityCreated:(J,Y)=>`wf-idx-created:${_(J)}:${$(Y)}`,workflowVisibilityUpdated:(J,Y)=>`wf-idx-updated:${_(J)}:${$(Y)}`,workflowVisibilityDeadline:(J,Y)=>`wf-idx-deadline:${_(J)}:${$(Y)}`,workflowVisibilityManifest:(J)=>`wf-idx-manifest:${$(J)}`,workflowVisibilityMetaVersion:()=>"wf-idx-meta:version",workflowVisibilityMetaBuiltAt:()=>"wf-idx-meta:built-at",workflowVisibilityMetaCursor:()=>"wf-idx-meta:cursor"};function m(J){if(J===void 0)return;if(typeof J!=="number"||!Number.isInteger(J)||J<0)throw Error("deleteRange limit must be a finite non-negative integer");return J===0?0:J}function j(J){let Y={},Z=!1;for(let X of["gt","gte","lt","lte"]){let F=J[X];if(F===void 0)continue;if(typeof F!=="string")throw Error("deleteRange bounds must be strings");Y[X]=F,Z=!0}if(!Z)throw Error("deleteRange requires at least one of gt/gte/lt/lte; use deletePrefix to delete a whole prefix");let G=m(J.limit);if(G!==void 0)Y.limit=G;return Y}async function b(J,Y,Z){let G=j(Z);if(J.deleteRange)return J.deleteRange(Y,G);return H(J,Y,G)}function c(J,Y){let Z={key:J,open:!1};if(Y.gte!==void 0&&Y.gte>Z.key)Z.key=Y.gte,Z.open=!1;if(Y.gt!==void 0&&Y.gt>=Z.key)Z.key=Y.gt,Z.open=!0;return Z}function y(J,Y){let Z={key:O(J),open:!0};if(Y.lt!==void 0&&Y.lt<=Z.key)Z.key=Y.lt,Z.open=!0;if(Y.lte!==void 0&&Y.lte<Z.key)Z.key=Y.lte,Z.open=!1;return Z}function HJ(J,Y){let Z=c(J,Y),G=y(J,Y);if(Z.key>G.key||Z.key===G.key&&(Z.open||G.open))return null;return{lower:Z,upper:G}}function B(J){return J.replaceAll(/:+$/g,"")}function g(J,Y){let Z=B(J),G=B(Y);if(Z.length===0)return G;if(G.length===0)return Z;return`${Z}:${G}`}class A{#Y;#Z;constructor(J,Y){this.#Y=J,this.#Z=B(Y)}#J(J){if(this.#Z.length===0)return J;return J.length===0?`${this.#Z}:`:`${this.#Z}:${J}`}#$(J){if(this.#Z.length===0)return J;return J.slice(this.#Z.length+1)}#G(J={}){let Y={};if(J.limit!==void 0)Y.limit=J.limit;if(J.reverse!==void 0)Y.reverse=J.reverse;if(J.gt!==void 0)Y.gt=this.#J(J.gt);if(J.gte!==void 0)Y.gte=this.#J(J.gte);if(J.lt!==void 0)Y.lt=this.#J(J.lt);if(J.lte!==void 0)Y.lte=this.#J(J.lte);return Y}#_(J){let Y={};if(J.limit!==void 0)Y.limit=J.limit;if(J.gt!==void 0)Y.gt=this.#J(J.gt);if(J.gte!==void 0)Y.gte=this.#J(J.gte);if(J.lt!==void 0)Y.lt=this.#J(J.lt);if(J.lte!==void 0)Y.lte=this.#J(J.lte);return Y}capabilities(){return this.#Y.capabilities()}scoped(J){return new A(this.#Y,g(this.#Z,J))}async get(J){return this.#Y.get(this.#J(J))}async put(J,Y){await this.#Y.put(this.#J(J),Y)}async delete(J){await this.#Y.delete(this.#J(J))}async*scan(J,Y){for await(let[Z,G]of this.#Y.scan(this.#J(J),this.#G(Y)))yield[this.#$(Z),G]}async batch(J){await this.#Y.batch(J.map((Y)=>{if(Y.type==="put")return{type:"put",key:this.#J(Y.key),value:Y.value};return{type:"delete",key:this.#J(Y.key)}}))}async conditionalBatch(J,Y){return K(this.#Y,J.map((Z)=>({key:this.#J(Z.key),expectedValue:Z.expectedValue})),Y.map((Z)=>{if(Z.type==="put")return{type:"put",key:this.#J(Z.key),value:Z.value};return{type:"delete",key:this.#J(Z.key)}}))}async has(J){return P(this.#Y,this.#J(J))}async deletePrefix(J){return v(this.#Y,this.#J(J))}async deleteRange(J,Y){let Z=this.#_(j(Y));return b(this.#Y,this.#J(J),Z)}async*keys(J,Y){for await(let Z of h(this.#Y,this.#J(J),this.#G(Y)))yield this.#$(Z)}async count(J){return C(this.#Y,this.#J(J))}[Symbol.dispose](){this.#Y[Symbol.dispose]()}}function S(J,Y){return new A(J,Y)}var f=67108864;function I(J){if(J.type==="put")return{type:"put",key:J.key,value:U(J.value)};return{type:"delete",key:J.key}}function l(J){return{key:J.key,expectedValue:J.expectedValue===null?null:U(J.expectedValue)}}function d(J){if(!N(J)||typeof J.key!=="string"||typeof J.value!=="string")throw Error("HTTPStorage scan response contained an invalid NDJSON entry.");return{key:J.key,value:J.value}}function p(J){if(!N(J)||typeof J.applied!=="boolean")throw Error('HTTPStorage conditional batch response must include a boolean "applied" field.');return J.applied}function W(J,Y,Z){if(Z!==void 0)J.searchParams.set(Y,String(Z))}function s(J){if(J.trim().length===0)return null;let Y=d(JSON.parse(J));return[Y.key,T(Y.value)]}function a(J){if(J>f)throw Error("HTTPStorage scan response exceeded the maximum allowed size.")}async function*i(J){if(J.body===null)return;let Y=J.body.getReader(),Z=new TextDecoder,G="",X=0,F=!1;try{while(!0){let{done:L,value:D}=await Y.read();if(L){F=!0;break}X+=D.byteLength,a(X),G+=Z.decode(D,{stream:!0});let z=G.split(`
|
|
2
|
+
`);G=z.pop()??"";for(let x of z)yield x}if(G+=Z.decode(),G.length>0)yield G}finally{try{if(!F)await Y.cancel()}catch{}Y.releaseLock()}}class r{#Y;#Z;#J;constructor(J){this.#Y=J.baseUrl instanceof URL?J.baseUrl:new URL(J.baseUrl),this.#Z={...J.headers},this.#J=J.remoteConditionalBatch??!1}capabilities(){return{persistence:"remote",readAfterWrite:"eventual",scanConsistency:"best-effort",atomicBatch:!0,conditionalBatch:this.#J,boundedRangeDelete:!1}}#$(J){let Y=this.#Y.href.endsWith("/")?this.#Y.href:`${this.#Y.href}/`;return new URL(J.replace(/^\/+/,""),Y)}#G(J){return this.#$(`/v1/storage/${encodeURIComponent(J)}`)}#_(J,Y){let Z=this.#$("/v1/storage");return Z.searchParams.set("prefix",J),W(Z,"limit",Y.limit),W(Z,"reverse",Y.reverse),W(Z,"gt",Y.gt),W(Z,"gte",Y.gte),W(Z,"lt",Y.lt),W(Z,"lte",Y.lte),Z}async#X(J,Y={},Z=[]){let G=new Headers(this.#Z);for(let[F,L]of new Headers(Y.headers).entries())G.set(F,L);let X=await fetch(J,{...Y,headers:G});if(!X.ok&&!Z.includes(X.status))throw Error(`HTTPStorage request failed: ${Y.method??"GET"} ${J.pathname} returned ${String(X.status)}.`);return X}async get(J){let Y=await this.#X(this.#G(J),{method:"GET"},[404]);if(Y.status===404)return null;return new Uint8Array(await Y.arrayBuffer())}async put(J,Y){await this.#X(this.#G(J),{method:"PUT",headers:{"content-type":"application/octet-stream"},body:new Blob([Y])})}async delete(J){await this.#X(this.#G(J),{method:"DELETE"})}async*scan(J,Y={}){let Z=await this.#X(this.#_(J,Y),{method:"GET",headers:{accept:"application/x-ndjson"}});for await(let G of i(Z)){let X=s(G);if(X!==null)yield X}}async batch(J){await this.#X(this.#$("/v1/storage/-/batch"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({operations:J.map(I)})})}async conditionalBatch(J,Y){let Z=await this.#X(this.#$("/v1/storage/-/conditional-batch"),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({conditions:J.map(l),operations:Y.map(I)})});return p(await Z.json())}has(J){return M(this,J)}async*keys(J,Y){yield*Q(this,J,Y)}count(J){return V(this,J)}deletePrefix(J){return E(this,J)}deleteRange(J,Y){return H(this,J,j(Y))}scoped(J){return S(this,J)}[Symbol.dispose](){}}export{r as HTTPStorage};
|