sendwend 0.0.1 → 12.7.3
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 +1 -1
- package/README.md +2065 -22
- package/dist/_virtual/_rolldown/runtime.cjs +22 -0
- package/dist/apns-relay.cjs +91 -0
- package/dist/apns-relay.cjs.map +1 -0
- package/dist/apns-relay.d.cts +26 -0
- package/dist/apns-relay.d.cts.map +1 -0
- package/dist/apns-relay.d.mts +26 -0
- package/dist/apns-relay.d.mts.map +1 -0
- package/dist/apns-relay.mjs +90 -0
- package/dist/apns-relay.mjs.map +1 -0
- package/dist/apns.cjs +215 -0
- package/dist/apns.cjs.map +1 -0
- package/dist/apns.d.cts +110 -0
- package/dist/apns.d.cts.map +1 -0
- package/dist/apns.d.mts +110 -0
- package/dist/apns.d.mts.map +1 -0
- package/dist/apns.mjs +207 -0
- package/dist/apns.mjs.map +1 -0
- package/dist/aws/engine-step.cjs +105 -0
- package/dist/aws/engine-step.cjs.map +1 -0
- package/dist/aws/engine-step.d.cts +42 -0
- package/dist/aws/engine-step.d.cts.map +1 -0
- package/dist/aws/engine-step.d.mts +42 -0
- package/dist/aws/engine-step.d.mts.map +1 -0
- package/dist/aws/engine-step.mjs +103 -0
- package/dist/aws/engine-step.mjs.map +1 -0
- package/dist/aws/function-url.cjs +53 -0
- package/dist/aws/function-url.cjs.map +1 -0
- package/dist/aws/function-url.d.cts +36 -0
- package/dist/aws/function-url.d.cts.map +1 -0
- package/dist/aws/function-url.d.mts +36 -0
- package/dist/aws/function-url.d.mts.map +1 -0
- package/dist/aws/function-url.mjs +50 -0
- package/dist/aws/function-url.mjs.map +1 -0
- package/dist/aws/index.cjs +232 -0
- package/dist/aws/index.cjs.map +1 -0
- package/dist/aws/index.d.cts +73 -0
- package/dist/aws/index.d.cts.map +1 -0
- package/dist/aws/index.d.mts +73 -0
- package/dist/aws/index.d.mts.map +1 -0
- package/dist/aws/index.mjs +218 -0
- package/dist/aws/index.mjs.map +1 -0
- package/dist/aws/instances.cjs +218 -0
- package/dist/aws/instances.cjs.map +1 -0
- package/dist/aws/instances.d.cts +102 -0
- package/dist/aws/instances.d.cts.map +1 -0
- package/dist/aws/instances.d.mts +102 -0
- package/dist/aws/instances.d.mts.map +1 -0
- package/dist/aws/instances.mjs +214 -0
- package/dist/aws/instances.mjs.map +1 -0
- package/dist/aws/lambda-api.cjs +86 -0
- package/dist/aws/lambda-api.cjs.map +1 -0
- package/dist/aws/lambda-api.d.cts +41 -0
- package/dist/aws/lambda-api.d.cts.map +1 -0
- package/dist/aws/lambda-api.d.mts +41 -0
- package/dist/aws/lambda-api.d.mts.map +1 -0
- package/dist/aws/lambda-api.mjs +85 -0
- package/dist/aws/lambda-api.mjs.map +1 -0
- package/dist/client.cjs +216 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +193 -0
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.mts +193 -0
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +212 -0
- package/dist/client.mjs.map +1 -0
- package/dist/cloudflare/bindings.cjs +49 -0
- package/dist/cloudflare/bindings.cjs.map +1 -0
- package/dist/cloudflare/bindings.d.cts +31 -0
- package/dist/cloudflare/bindings.d.cts.map +1 -0
- package/dist/cloudflare/bindings.d.mts +31 -0
- package/dist/cloudflare/bindings.d.mts.map +1 -0
- package/dist/cloudflare/bindings.mjs +46 -0
- package/dist/cloudflare/bindings.mjs.map +1 -0
- package/dist/cloudflare/index.cjs +73 -0
- package/dist/cloudflare/index.d.cts +25 -0
- package/dist/cloudflare/index.d.mts +25 -0
- package/dist/cloudflare/index.mjs +20 -0
- package/dist/cloudflare/runner.cjs +200 -0
- package/dist/cloudflare/runner.cjs.map +1 -0
- package/dist/cloudflare/runner.d.cts +83 -0
- package/dist/cloudflare/runner.d.cts.map +1 -0
- package/dist/cloudflare/runner.d.mts +83 -0
- package/dist/cloudflare/runner.d.mts.map +1 -0
- package/dist/cloudflare/runner.mjs +199 -0
- package/dist/cloudflare/runner.mjs.map +1 -0
- package/dist/cloudflare/worker.cjs +106 -0
- package/dist/cloudflare/worker.cjs.map +1 -0
- package/dist/cloudflare/worker.d.cts +52 -0
- package/dist/cloudflare/worker.d.cts.map +1 -0
- package/dist/cloudflare/worker.d.mts +52 -0
- package/dist/cloudflare/worker.d.mts.map +1 -0
- package/dist/cloudflare/worker.mjs +104 -0
- package/dist/cloudflare/worker.mjs.map +1 -0
- package/dist/cloudflare/workers.d.cjs +0 -0
- package/dist/cloudflare/workers.d.cts +42 -0
- package/dist/cloudflare/workers.d.cts.map +1 -0
- package/dist/cloudflare/workers.d.mts +42 -0
- package/dist/cloudflare/workers.d.mts.map +1 -0
- package/dist/config.cjs +257 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +184 -0
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +184 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +246 -0
- package/dist/config.mjs.map +1 -0
- package/dist/contract.cjs +222 -0
- package/dist/contract.cjs.map +1 -0
- package/dist/contract.d.cts +110 -0
- package/dist/contract.d.cts.map +1 -0
- package/dist/contract.d.mts +110 -0
- package/dist/contract.d.mts.map +1 -0
- package/dist/contract.mjs +216 -0
- package/dist/contract.mjs.map +1 -0
- package/dist/date-time.cjs +22 -0
- package/dist/date-time.cjs.map +1 -0
- package/dist/date-time.d.cts +10 -0
- package/dist/date-time.d.cts.map +1 -0
- package/dist/date-time.d.mts +10 -0
- package/dist/date-time.d.mts.map +1 -0
- package/dist/date-time.mjs +21 -0
- package/dist/date-time.mjs.map +1 -0
- package/dist/dsl/action.cjs +25 -0
- package/dist/dsl/action.cjs.map +1 -0
- package/dist/dsl/action.d.cts +63 -0
- package/dist/dsl/action.d.cts.map +1 -0
- package/dist/dsl/action.d.mts +63 -0
- package/dist/dsl/action.d.mts.map +1 -0
- package/dist/dsl/action.mjs +24 -0
- package/dist/dsl/action.mjs.map +1 -0
- package/dist/dsl/base.cjs +33 -0
- package/dist/dsl/base.cjs.map +1 -0
- package/dist/dsl/base.d.cts +43 -0
- package/dist/dsl/base.d.cts.map +1 -0
- package/dist/dsl/base.d.mts +43 -0
- package/dist/dsl/base.d.mts.map +1 -0
- package/dist/dsl/base.mjs +29 -0
- package/dist/dsl/base.mjs.map +1 -0
- package/dist/dsl/bundle.cjs +287 -0
- package/dist/dsl/bundle.cjs.map +1 -0
- package/dist/dsl/bundle.d.cts +33 -0
- package/dist/dsl/bundle.d.cts.map +1 -0
- package/dist/dsl/bundle.d.mts +33 -0
- package/dist/dsl/bundle.d.mts.map +1 -0
- package/dist/dsl/bundle.mjs +284 -0
- package/dist/dsl/bundle.mjs.map +1 -0
- package/dist/dsl/condition.cjs +200 -0
- package/dist/dsl/condition.cjs.map +1 -0
- package/dist/dsl/condition.d.cts +151 -0
- package/dist/dsl/condition.d.cts.map +1 -0
- package/dist/dsl/condition.d.mts +151 -0
- package/dist/dsl/condition.d.mts.map +1 -0
- package/dist/dsl/condition.mjs +178 -0
- package/dist/dsl/condition.mjs.map +1 -0
- package/dist/dsl/flow.cjs +335 -0
- package/dist/dsl/flow.cjs.map +1 -0
- package/dist/dsl/flow.d.cts +278 -0
- package/dist/dsl/flow.d.cts.map +1 -0
- package/dist/dsl/flow.d.mts +278 -0
- package/dist/dsl/flow.d.mts.map +1 -0
- package/dist/dsl/flow.mjs +331 -0
- package/dist/dsl/flow.mjs.map +1 -0
- package/dist/dsl/index.cjs +37 -0
- package/dist/dsl/index.d.cts +34 -0
- package/dist/dsl/index.d.mts +34 -0
- package/dist/dsl/index.mjs +9 -0
- package/dist/dsl/refs.cjs +101 -0
- package/dist/dsl/refs.cjs.map +1 -0
- package/dist/dsl/refs.d.cts +127 -0
- package/dist/dsl/refs.d.cts.map +1 -0
- package/dist/dsl/refs.d.mts +127 -0
- package/dist/dsl/refs.d.mts.map +1 -0
- package/dist/dsl/refs.mjs +93 -0
- package/dist/dsl/refs.mjs.map +1 -0
- package/dist/dsl/template.cjs +19 -0
- package/dist/dsl/template.cjs.map +1 -0
- package/dist/dsl/template.d.cts +30 -0
- package/dist/dsl/template.d.cts.map +1 -0
- package/dist/dsl/template.d.mts +30 -0
- package/dist/dsl/template.d.mts.map +1 -0
- package/dist/dsl/template.mjs +18 -0
- package/dist/dsl/template.mjs.map +1 -0
- package/dist/dsl/trigger.cjs +53 -0
- package/dist/dsl/trigger.cjs.map +1 -0
- package/dist/dsl/trigger.d.cts +112 -0
- package/dist/dsl/trigger.d.cts.map +1 -0
- package/dist/dsl/trigger.d.mts +112 -0
- package/dist/dsl/trigger.d.mts.map +1 -0
- package/dist/dsl/trigger.mjs +52 -0
- package/dist/dsl/trigger.mjs.map +1 -0
- package/dist/dsl/workflow.cjs +143 -0
- package/dist/dsl/workflow.cjs.map +1 -0
- package/dist/dsl/workflow.d.cts +88 -0
- package/dist/dsl/workflow.d.cts.map +1 -0
- package/dist/dsl/workflow.d.mts +88 -0
- package/dist/dsl/workflow.d.mts.map +1 -0
- package/dist/dsl/workflow.mjs +142 -0
- package/dist/dsl/workflow.mjs.map +1 -0
- package/dist/email-context.cjs +28 -0
- package/dist/email-context.cjs.map +1 -0
- package/dist/email-context.d.cts +9 -0
- package/dist/email-context.d.cts.map +1 -0
- package/dist/email-context.d.mts +9 -0
- package/dist/email-context.d.mts.map +1 -0
- package/dist/email-context.mjs +26 -0
- package/dist/email-context.mjs.map +1 -0
- package/dist/email-sender.cjs +93 -0
- package/dist/email-sender.cjs.map +1 -0
- package/dist/email-sender.d.cts +88 -0
- package/dist/email-sender.d.cts.map +1 -0
- package/dist/email-sender.d.mts +88 -0
- package/dist/email-sender.d.mts.map +1 -0
- package/dist/email-sender.mjs +90 -0
- package/dist/email-sender.mjs.map +1 -0
- package/dist/email.cjs +73 -0
- package/dist/email.cjs.map +1 -0
- package/dist/email.d.cts +59 -0
- package/dist/email.d.cts.map +1 -0
- package/dist/email.d.mts +59 -0
- package/dist/email.d.mts.map +1 -0
- package/dist/email.mjs +68 -0
- package/dist/email.mjs.map +1 -0
- package/dist/engine/actions.cjs +19 -0
- package/dist/engine/actions.cjs.map +1 -0
- package/dist/engine/actions.d.cts +27 -0
- package/dist/engine/actions.d.cts.map +1 -0
- package/dist/engine/actions.d.mts +27 -0
- package/dist/engine/actions.d.mts.map +1 -0
- package/dist/engine/actions.mjs +18 -0
- package/dist/engine/actions.mjs.map +1 -0
- package/dist/engine/bucket.cjs +71 -0
- package/dist/engine/bucket.cjs.map +1 -0
- package/dist/engine/bucket.d.cts +30 -0
- package/dist/engine/bucket.d.cts.map +1 -0
- package/dist/engine/bucket.d.mts +30 -0
- package/dist/engine/bucket.d.mts.map +1 -0
- package/dist/engine/bucket.mjs +68 -0
- package/dist/engine/bucket.mjs.map +1 -0
- package/dist/engine/condition.cjs +199 -0
- package/dist/engine/condition.cjs.map +1 -0
- package/dist/engine/condition.d.cts +76 -0
- package/dist/engine/condition.d.cts.map +1 -0
- package/dist/engine/condition.d.mts +76 -0
- package/dist/engine/condition.d.mts.map +1 -0
- package/dist/engine/condition.mjs +192 -0
- package/dist/engine/condition.mjs.map +1 -0
- package/dist/engine/duration.cjs +33 -0
- package/dist/engine/duration.cjs.map +1 -0
- package/dist/engine/duration.d.cts +3 -0
- package/dist/engine/duration.d.cts.map +1 -0
- package/dist/engine/duration.d.mts +3 -0
- package/dist/engine/duration.d.mts.map +1 -0
- package/dist/engine/duration.mjs +32 -0
- package/dist/engine/duration.mjs.map +1 -0
- package/dist/engine/index.cjs +33 -0
- package/dist/engine/index.d.cts +10 -0
- package/dist/engine/index.d.mts +10 -0
- package/dist/engine/index.mjs +9 -0
- package/dist/engine/interpreter.cjs +613 -0
- package/dist/engine/interpreter.cjs.map +1 -0
- package/dist/engine/interpreter.d.cts +4 -0
- package/dist/engine/interpreter.d.cts.map +1 -0
- package/dist/engine/interpreter.d.mts +4 -0
- package/dist/engine/interpreter.d.mts.map +1 -0
- package/dist/engine/interpreter.mjs +612 -0
- package/dist/engine/interpreter.mjs.map +1 -0
- package/dist/engine/ports.cjs +0 -0
- package/dist/engine/ports.d.cts +373 -0
- package/dist/engine/ports.d.cts.map +1 -0
- package/dist/engine/ports.d.mts +373 -0
- package/dist/engine/ports.d.mts.map +1 -0
- package/dist/engine/ports.mjs +1 -0
- package/dist/engine/recipient.cjs +22 -0
- package/dist/engine/recipient.cjs.map +1 -0
- package/dist/engine/recipient.d.cts +11 -0
- package/dist/engine/recipient.d.cts.map +1 -0
- package/dist/engine/recipient.d.mts +11 -0
- package/dist/engine/recipient.d.mts.map +1 -0
- package/dist/engine/recipient.mjs +21 -0
- package/dist/engine/recipient.mjs.map +1 -0
- package/dist/engine/retry.cjs +106 -0
- package/dist/engine/retry.cjs.map +1 -0
- package/dist/engine/retry.d.cts +73 -0
- package/dist/engine/retry.d.cts.map +1 -0
- package/dist/engine/retry.d.mts +73 -0
- package/dist/engine/retry.d.mts.map +1 -0
- package/dist/engine/retry.mjs +98 -0
- package/dist/engine/retry.mjs.map +1 -0
- package/dist/engine/time-scale.cjs +153 -0
- package/dist/engine/time-scale.cjs.map +1 -0
- package/dist/engine/time-scale.d.cts +41 -0
- package/dist/engine/time-scale.d.cts.map +1 -0
- package/dist/engine/time-scale.d.mts +41 -0
- package/dist/engine/time-scale.d.mts.map +1 -0
- package/dist/engine/time-scale.mjs +150 -0
- package/dist/engine/time-scale.mjs.map +1 -0
- package/dist/engine/time-window.cjs +148 -0
- package/dist/engine/time-window.cjs.map +1 -0
- package/dist/engine/time-window.d.cts +20 -0
- package/dist/engine/time-window.d.cts.map +1 -0
- package/dist/engine/time-window.d.mts +20 -0
- package/dist/engine/time-window.d.mts.map +1 -0
- package/dist/engine/time-window.mjs +146 -0
- package/dist/engine/time-window.mjs.map +1 -0
- package/dist/fcm.cjs +208 -0
- package/dist/fcm.cjs.map +1 -0
- package/dist/fcm.d.cts +89 -0
- package/dist/fcm.d.cts.map +1 -0
- package/dist/fcm.d.mts +89 -0
- package/dist/fcm.d.mts.map +1 -0
- package/dist/fcm.mjs +202 -0
- package/dist/fcm.mjs.map +1 -0
- package/dist/hash.cjs +244 -0
- package/dist/hash.cjs.map +1 -0
- package/dist/hash.d.cts +28 -0
- package/dist/hash.d.cts.map +1 -0
- package/dist/hash.d.mts +28 -0
- package/dist/hash.d.mts.map +1 -0
- package/dist/hash.mjs +238 -0
- package/dist/hash.mjs.map +1 -0
- package/dist/host/auth.cjs +48 -0
- package/dist/host/auth.cjs.map +1 -0
- package/dist/host/auth.d.cts +33 -0
- package/dist/host/auth.d.cts.map +1 -0
- package/dist/host/auth.d.mts +33 -0
- package/dist/host/auth.d.mts.map +1 -0
- package/dist/host/auth.mjs +45 -0
- package/dist/host/auth.mjs.map +1 -0
- package/dist/host/batch.cjs +178 -0
- package/dist/host/batch.cjs.map +1 -0
- package/dist/host/batch.d.cts +92 -0
- package/dist/host/batch.d.cts.map +1 -0
- package/dist/host/batch.d.mts +92 -0
- package/dist/host/batch.d.mts.map +1 -0
- package/dist/host/batch.mjs +169 -0
- package/dist/host/batch.mjs.map +1 -0
- package/dist/host/channels.cjs +256 -0
- package/dist/host/channels.cjs.map +1 -0
- package/dist/host/channels.d.cts +66 -0
- package/dist/host/channels.d.cts.map +1 -0
- package/dist/host/channels.d.mts +66 -0
- package/dist/host/channels.d.mts.map +1 -0
- package/dist/host/channels.mjs +252 -0
- package/dist/host/channels.mjs.map +1 -0
- package/dist/host/execute.cjs +102 -0
- package/dist/host/execute.cjs.map +1 -0
- package/dist/host/execute.d.cts +38 -0
- package/dist/host/execute.d.cts.map +1 -0
- package/dist/host/execute.d.mts +38 -0
- package/dist/host/execute.d.mts.map +1 -0
- package/dist/host/execute.mjs +101 -0
- package/dist/host/execute.mjs.map +1 -0
- package/dist/host/fresh-read.cjs +29 -0
- package/dist/host/fresh-read.cjs.map +1 -0
- package/dist/host/fresh-read.d.cts +16 -0
- package/dist/host/fresh-read.d.cts.map +1 -0
- package/dist/host/fresh-read.d.mts +16 -0
- package/dist/host/fresh-read.d.mts.map +1 -0
- package/dist/host/fresh-read.mjs +28 -0
- package/dist/host/fresh-read.mjs.map +1 -0
- package/dist/host/http.cjs +393 -0
- package/dist/host/http.cjs.map +1 -0
- package/dist/host/http.d.cts +61 -0
- package/dist/host/http.d.cts.map +1 -0
- package/dist/host/http.d.mts +61 -0
- package/dist/host/http.d.mts.map +1 -0
- package/dist/host/http.mjs +389 -0
- package/dist/host/http.mjs.map +1 -0
- package/dist/host/ingest.cjs +1210 -0
- package/dist/host/ingest.cjs.map +1 -0
- package/dist/host/ingest.d.cts +497 -0
- package/dist/host/ingest.d.cts.map +1 -0
- package/dist/host/ingest.d.mts +497 -0
- package/dist/host/ingest.d.mts.map +1 -0
- package/dist/host/ingest.mjs +1172 -0
- package/dist/host/ingest.mjs.map +1 -0
- package/dist/host/journey-host.cjs +223 -0
- package/dist/host/journey-host.cjs.map +1 -0
- package/dist/host/journey-host.d.cts +118 -0
- package/dist/host/journey-host.d.cts.map +1 -0
- package/dist/host/journey-host.d.mts +118 -0
- package/dist/host/journey-host.d.mts.map +1 -0
- package/dist/host/journey-host.mjs +219 -0
- package/dist/host/journey-host.mjs.map +1 -0
- package/dist/host/platform.cjs +20 -0
- package/dist/host/platform.cjs.map +1 -0
- package/dist/host/platform.d.cts +120 -0
- package/dist/host/platform.d.cts.map +1 -0
- package/dist/host/platform.d.mts +120 -0
- package/dist/host/platform.d.mts.map +1 -0
- package/dist/host/platform.mjs +18 -0
- package/dist/host/platform.mjs.map +1 -0
- package/dist/host/senders.cjs +71 -0
- package/dist/host/senders.cjs.map +1 -0
- package/dist/host/senders.d.cts +34 -0
- package/dist/host/senders.d.cts.map +1 -0
- package/dist/host/senders.d.mts +34 -0
- package/dist/host/senders.d.mts.map +1 -0
- package/dist/host/senders.mjs +67 -0
- package/dist/host/senders.mjs.map +1 -0
- package/dist/host/workflow-cache.cjs +47 -0
- package/dist/host/workflow-cache.cjs.map +1 -0
- package/dist/host/workflow-cache.d.cts +21 -0
- package/dist/host/workflow-cache.d.cts.map +1 -0
- package/dist/host/workflow-cache.d.mts +21 -0
- package/dist/host/workflow-cache.d.mts.map +1 -0
- package/dist/host/workflow-cache.mjs +46 -0
- package/dist/host/workflow-cache.mjs.map +1 -0
- package/dist/http2-client.cjs +89 -0
- package/dist/http2-client.cjs.map +1 -0
- package/dist/http2-client.d.cts +45 -0
- package/dist/http2-client.d.cts.map +1 -0
- package/dist/http2-client.d.mts +45 -0
- package/dist/http2-client.d.mts.map +1 -0
- package/dist/http2-client.mjs +87 -0
- package/dist/http2-client.mjs.map +1 -0
- package/dist/index.cjs +130 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +20 -0
- package/dist/inflight.cjs +116 -0
- package/dist/inflight.cjs.map +1 -0
- package/dist/inflight.d.cts +49 -0
- package/dist/inflight.d.cts.map +1 -0
- package/dist/inflight.d.mts +49 -0
- package/dist/inflight.d.mts.map +1 -0
- package/dist/inflight.mjs +113 -0
- package/dist/inflight.mjs.map +1 -0
- package/dist/ir.cjs +429 -0
- package/dist/ir.cjs.map +1 -0
- package/dist/ir.d.cts +593 -0
- package/dist/ir.d.cts.map +1 -0
- package/dist/ir.d.mts +593 -0
- package/dist/ir.d.mts.map +1 -0
- package/dist/ir.mjs +404 -0
- package/dist/ir.mjs.map +1 -0
- package/dist/jwt.cjs +17 -0
- package/dist/jwt.cjs.map +1 -0
- package/dist/jwt.d.cts +7 -0
- package/dist/jwt.d.cts.map +1 -0
- package/dist/jwt.d.mts +7 -0
- package/dist/jwt.d.mts.map +1 -0
- package/dist/jwt.mjs +15 -0
- package/dist/jwt.mjs.map +1 -0
- package/dist/node/index.cjs +231 -0
- package/dist/node/index.cjs.map +1 -0
- package/dist/node/index.d.cts +59 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.d.mts +59 -0
- package/dist/node/index.d.mts.map +1 -0
- package/dist/node/index.mjs +225 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/node/runs.cjs +222 -0
- package/dist/node/runs.cjs.map +1 -0
- package/dist/node/runs.d.cts +93 -0
- package/dist/node/runs.d.cts.map +1 -0
- package/dist/node/runs.d.mts +93 -0
- package/dist/node/runs.d.mts.map +1 -0
- package/dist/node/runs.mjs +221 -0
- package/dist/node/runs.mjs.map +1 -0
- package/dist/node/runtime.cjs +351 -0
- package/dist/node/runtime.cjs.map +1 -0
- package/dist/node/runtime.d.cts +96 -0
- package/dist/node/runtime.d.cts.map +1 -0
- package/dist/node/runtime.d.mts +96 -0
- package/dist/node/runtime.d.mts.map +1 -0
- package/dist/node/runtime.mjs +348 -0
- package/dist/node/runtime.mjs.map +1 -0
- package/dist/plan.cjs +221 -0
- package/dist/plan.cjs.map +1 -0
- package/dist/plan.d.cts +68 -0
- package/dist/plan.d.cts.map +1 -0
- package/dist/plan.d.mts +68 -0
- package/dist/plan.d.mts.map +1 -0
- package/dist/plan.mjs +218 -0
- package/dist/plan.mjs.map +1 -0
- package/dist/postgres-js.cjs +51 -0
- package/dist/postgres-js.cjs.map +1 -0
- package/dist/postgres-js.d.cts +32 -0
- package/dist/postgres-js.d.cts.map +1 -0
- package/dist/postgres-js.d.mts +32 -0
- package/dist/postgres-js.d.mts.map +1 -0
- package/dist/postgres-js.mjs +46 -0
- package/dist/postgres-js.mjs.map +1 -0
- package/dist/provenance.cjs +66 -0
- package/dist/provenance.cjs.map +1 -0
- package/dist/provenance.d.cts +40 -0
- package/dist/provenance.d.cts.map +1 -0
- package/dist/provenance.d.mts +40 -0
- package/dist/provenance.d.mts.map +1 -0
- package/dist/provenance.mjs +64 -0
- package/dist/provenance.mjs.map +1 -0
- package/dist/push.cjs +11 -0
- package/dist/push.cjs.map +1 -0
- package/dist/push.d.cts +14 -0
- package/dist/push.d.cts.map +1 -0
- package/dist/push.d.mts +14 -0
- package/dist/push.d.mts.map +1 -0
- package/dist/push.mjs +10 -0
- package/dist/push.mjs.map +1 -0
- package/dist/react-email.cjs +56 -0
- package/dist/react-email.cjs.map +1 -0
- package/dist/react-email.d.cts +5 -0
- package/dist/react-email.d.cts.map +1 -0
- package/dist/react-email.d.mts +5 -0
- package/dist/react-email.d.mts.map +1 -0
- package/dist/react-email.mjs +55 -0
- package/dist/react-email.mjs.map +1 -0
- package/dist/reporting/classify.cjs +46 -0
- package/dist/reporting/classify.cjs.map +1 -0
- package/dist/reporting/classify.d.cts +65 -0
- package/dist/reporting/classify.d.cts.map +1 -0
- package/dist/reporting/classify.d.mts +65 -0
- package/dist/reporting/classify.d.mts.map +1 -0
- package/dist/reporting/classify.mjs +42 -0
- package/dist/reporting/classify.mjs.map +1 -0
- package/dist/reporting/observer.cjs +137 -0
- package/dist/reporting/observer.cjs.map +1 -0
- package/dist/reporting/observer.d.cts +31 -0
- package/dist/reporting/observer.d.cts.map +1 -0
- package/dist/reporting/observer.d.mts +31 -0
- package/dist/reporting/observer.d.mts.map +1 -0
- package/dist/reporting/observer.mjs +134 -0
- package/dist/reporting/observer.mjs.map +1 -0
- package/dist/reporting/tracking.cjs +185 -0
- package/dist/reporting/tracking.cjs.map +1 -0
- package/dist/reporting/tracking.d.cts +63 -0
- package/dist/reporting/tracking.d.cts.map +1 -0
- package/dist/reporting/tracking.d.mts +63 -0
- package/dist/reporting/tracking.d.mts.map +1 -0
- package/dist/reporting/tracking.mjs +182 -0
- package/dist/reporting/tracking.mjs.map +1 -0
- package/dist/runtime.cjs +18 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +44 -0
- package/dist/runtime.d.cts.map +1 -0
- package/dist/runtime.d.mts +44 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +17 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/store/condition-sql.cjs +145 -0
- package/dist/store/condition-sql.cjs.map +1 -0
- package/dist/store/condition-sql.d.cts +38 -0
- package/dist/store/condition-sql.d.cts.map +1 -0
- package/dist/store/condition-sql.d.mts +38 -0
- package/dist/store/condition-sql.d.mts.map +1 -0
- package/dist/store/condition-sql.mjs +144 -0
- package/dist/store/condition-sql.mjs.map +1 -0
- package/dist/store/erasure.cjs +21 -0
- package/dist/store/erasure.cjs.map +1 -0
- package/dist/store/erasure.d.cts +16 -0
- package/dist/store/erasure.d.cts.map +1 -0
- package/dist/store/erasure.d.mts +16 -0
- package/dist/store/erasure.d.mts.map +1 -0
- package/dist/store/erasure.mjs +20 -0
- package/dist/store/erasure.mjs.map +1 -0
- package/dist/store/facts.cjs +79 -0
- package/dist/store/facts.cjs.map +1 -0
- package/dist/store/facts.d.cts +41 -0
- package/dist/store/facts.d.cts.map +1 -0
- package/dist/store/facts.d.mts +41 -0
- package/dist/store/facts.d.mts.map +1 -0
- package/dist/store/facts.mjs +77 -0
- package/dist/store/facts.mjs.map +1 -0
- package/dist/store/identity.cjs +34 -0
- package/dist/store/identity.cjs.map +1 -0
- package/dist/store/identity.d.cts +13 -0
- package/dist/store/identity.d.cts.map +1 -0
- package/dist/store/identity.d.mts +13 -0
- package/dist/store/identity.d.mts.map +1 -0
- package/dist/store/identity.mjs +30 -0
- package/dist/store/identity.mjs.map +1 -0
- package/dist/store/index.cjs +35 -0
- package/dist/store/index.cjs.map +1 -0
- package/dist/store/index.d.cts +766 -0
- package/dist/store/index.d.cts.map +1 -0
- package/dist/store/index.d.mts +766 -0
- package/dist/store/index.d.mts.map +1 -0
- package/dist/store/index.mjs +22 -0
- package/dist/store/index.mjs.map +1 -0
- package/dist/store/postgres-reporting.cjs +327 -0
- package/dist/store/postgres-reporting.cjs.map +1 -0
- package/dist/store/postgres-reporting.d.cts +95 -0
- package/dist/store/postgres-reporting.d.cts.map +1 -0
- package/dist/store/postgres-reporting.d.mts +95 -0
- package/dist/store/postgres-reporting.d.mts.map +1 -0
- package/dist/store/postgres-reporting.mjs +326 -0
- package/dist/store/postgres-reporting.mjs.map +1 -0
- package/dist/store/postgres.cjs +1173 -0
- package/dist/store/postgres.cjs.map +1 -0
- package/dist/store/postgres.d.cts +199 -0
- package/dist/store/postgres.d.cts.map +1 -0
- package/dist/store/postgres.d.mts +199 -0
- package/dist/store/postgres.d.mts.map +1 -0
- package/dist/store/postgres.mjs +1170 -0
- package/dist/store/postgres.mjs.map +1 -0
- package/dist/store/sql.cjs +24 -0
- package/dist/store/sql.cjs.map +1 -0
- package/dist/store/sql.d.cts +26 -0
- package/dist/store/sql.d.cts.map +1 -0
- package/dist/store/sql.d.mts +26 -0
- package/dist/store/sql.d.mts.map +1 -0
- package/dist/store/sql.mjs +23 -0
- package/dist/store/sql.mjs.map +1 -0
- package/dist/store/tables.cjs +660 -0
- package/dist/store/tables.cjs.map +1 -0
- package/dist/store/tables.d.cts +103 -0
- package/dist/store/tables.d.cts.map +1 -0
- package/dist/store/tables.d.mts +103 -0
- package/dist/store/tables.d.mts.map +1 -0
- package/dist/store/tables.mjs +653 -0
- package/dist/store/tables.mjs.map +1 -0
- package/dist/store/user-lock.cjs +42 -0
- package/dist/store/user-lock.cjs.map +1 -0
- package/dist/store/user-lock.d.cts +30 -0
- package/dist/store/user-lock.d.cts.map +1 -0
- package/dist/store/user-lock.d.mts +30 -0
- package/dist/store/user-lock.d.mts.map +1 -0
- package/dist/store/user-lock.mjs +39 -0
- package/dist/store/user-lock.mjs.map +1 -0
- package/dist/template-rules.cjs +94 -0
- package/dist/template-rules.cjs.map +1 -0
- package/dist/template-rules.d.cts +80 -0
- package/dist/template-rules.d.cts.map +1 -0
- package/dist/template-rules.d.mts +80 -0
- package/dist/template-rules.d.mts.map +1 -0
- package/dist/template-rules.mjs +86 -0
- package/dist/template-rules.mjs.map +1 -0
- package/dist/templates.cjs +375 -0
- package/dist/templates.cjs.map +1 -0
- package/dist/templates.d.cts +358 -0
- package/dist/templates.d.cts.map +1 -0
- package/dist/templates.d.mts +358 -0
- package/dist/templates.d.mts.map +1 -0
- package/dist/templates.mjs +353 -0
- package/dist/templates.mjs.map +1 -0
- package/dist/transports/cloudflare-email.cjs +69 -0
- package/dist/transports/cloudflare-email.cjs.map +1 -0
- package/dist/transports/cloudflare-email.d.cts +63 -0
- package/dist/transports/cloudflare-email.d.cts.map +1 -0
- package/dist/transports/cloudflare-email.d.mts +63 -0
- package/dist/transports/cloudflare-email.d.mts.map +1 -0
- package/dist/transports/cloudflare-email.mjs +67 -0
- package/dist/transports/cloudflare-email.mjs.map +1 -0
- package/dist/transports/ses.cjs +142 -0
- package/dist/transports/ses.cjs.map +1 -0
- package/dist/transports/ses.d.cts +49 -0
- package/dist/transports/ses.d.cts.map +1 -0
- package/dist/transports/ses.d.mts +49 -0
- package/dist/transports/ses.d.mts.map +1 -0
- package/dist/transports/ses.mjs +139 -0
- package/dist/transports/ses.mjs.map +1 -0
- package/dist/transports/sigv4.cjs +86 -0
- package/dist/transports/sigv4.cjs.map +1 -0
- package/dist/transports/sigv4.d.cts +25 -0
- package/dist/transports/sigv4.d.cts.map +1 -0
- package/dist/transports/sigv4.d.mts +25 -0
- package/dist/transports/sigv4.d.mts.map +1 -0
- package/dist/transports/sigv4.mjs +85 -0
- package/dist/transports/sigv4.mjs.map +1 -0
- package/dist/webhooks.cjs +97 -0
- package/dist/webhooks.cjs.map +1 -0
- package/dist/webhooks.d.cts +23 -0
- package/dist/webhooks.d.cts.map +1 -0
- package/dist/webhooks.d.mts +23 -0
- package/dist/webhooks.d.mts.map +1 -0
- package/dist/webhooks.mjs +95 -0
- package/dist/webhooks.mjs.map +1 -0
- package/dist/webpush.cjs +361 -0
- package/dist/webpush.cjs.map +1 -0
- package/dist/webpush.d.cts +135 -0
- package/dist/webpush.d.cts.map +1 -0
- package/dist/webpush.d.mts +135 -0
- package/dist/webpush.d.mts.map +1 -0
- package/dist/webpush.mjs +350 -0
- package/dist/webpush.mjs.map +1 -0
- package/package.json +270 -31
- package/src/cloudflare/workers.d.ts +44 -0
- package/index.cjs +0 -18
- package/index.d.cts +0 -4
- package/index.d.mts +0 -4
- package/index.mjs +0 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { EngineStep, JourneyOutcome } from "../engine/ports.cjs";
|
|
2
|
+
import { JourneyParams, WorkflowBindingLike } from "../host/platform.cjs";
|
|
3
|
+
import { JourneyStore } from "../store/index.cjs";
|
|
4
|
+
import { RunStore } from "./runs.cjs";
|
|
5
|
+
/**
|
|
6
|
+
* The self-hosted runtime: journeys as rows, run a turn at a time.
|
|
7
|
+
*
|
|
8
|
+
* A turn claims one due run, replays the journey from the top with the run's checkpoints in
|
|
9
|
+
* memory, and ends in one of three ways: the journey returned, it threw, or it reached something
|
|
10
|
+
* that has to wait (a sleep, a retry's backoff, a wait for a wake) and was **suspended** — its
|
|
11
|
+
* state written, its lease released, to be claimed again when that is due.
|
|
12
|
+
*
|
|
13
|
+
* This is the model both other hosts run on (Cloudflare Workflows, Lambda durable functions);
|
|
14
|
+
* here the process is the runtime and Postgres its only state.
|
|
15
|
+
*/
|
|
16
|
+
/** A step's retries, as Cloudflare Workflows defaults them. */
|
|
17
|
+
export interface StepRetryPolicy {
|
|
18
|
+
/** Retries after the first attempt. */
|
|
19
|
+
limit: number;
|
|
20
|
+
/** The wait before the first retry; doubled before each one after. */
|
|
21
|
+
delayMs: number;
|
|
22
|
+
/** How long one attempt may run before it counts as failed. */
|
|
23
|
+
timeoutMs: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_STEP_RETRY: StepRetryPolicy;
|
|
26
|
+
/**
|
|
27
|
+
* How long a claim holds before another worker may take the run; a running turn keeps extending
|
|
28
|
+
* it. Leases are told by each process's own clock, so the processes' clocks must agree to well
|
|
29
|
+
* within this (NTP does): one far ahead takes runs that are still being run.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_LEASE_MS = 60000;
|
|
32
|
+
/** What one run of the journey is given: the store it reads and writes, and how to close it. */
|
|
33
|
+
export interface TurnParts {
|
|
34
|
+
store: JourneyStore;
|
|
35
|
+
/** Run the journey once over `step`: `executeJourney` with the host's outlets. */
|
|
36
|
+
execute(step: EngineStep): Promise<JourneyOutcome>;
|
|
37
|
+
close(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export interface NodeRuntimeOptions {
|
|
40
|
+
runs: RunStore;
|
|
41
|
+
/** Everything one turn of `instanceId` needs. Called once per turn. */
|
|
42
|
+
open(run: {
|
|
43
|
+
instanceId: string;
|
|
44
|
+
params: JourneyParams;
|
|
45
|
+
enteredAtMs: number;
|
|
46
|
+
}): TurnParts;
|
|
47
|
+
/** This worker's name on the leases it holds. */
|
|
48
|
+
owner?: string;
|
|
49
|
+
now?: () => number;
|
|
50
|
+
leaseMs?: number;
|
|
51
|
+
retry?: Partial<StepRetryPolicy>;
|
|
52
|
+
/** Told when a run becomes due at once (a create, a wake), so an idle worker need not poll for it. */
|
|
53
|
+
onDue?: () => void;
|
|
54
|
+
}
|
|
55
|
+
/** How a turn ended. */
|
|
56
|
+
export type TurnResult = {
|
|
57
|
+
instanceId: string;
|
|
58
|
+
ended: 'complete';
|
|
59
|
+
outcome: JourneyOutcome;
|
|
60
|
+
} | {
|
|
61
|
+
instanceId: string;
|
|
62
|
+
ended: 'errored';
|
|
63
|
+
error: unknown;
|
|
64
|
+
} | {
|
|
65
|
+
instanceId: string;
|
|
66
|
+
ended: 'suspended';
|
|
67
|
+
wakeAt: number;
|
|
68
|
+
} |
|
|
69
|
+
/** The run was taken from this turn (its lease ran out, or it was terminated): nothing was written. */
|
|
70
|
+
{
|
|
71
|
+
instanceId: string;
|
|
72
|
+
ended: 'abandoned';
|
|
73
|
+
};
|
|
74
|
+
export declare class NodeRuntime {
|
|
75
|
+
private readonly options;
|
|
76
|
+
private readonly runs;
|
|
77
|
+
private readonly owner;
|
|
78
|
+
private readonly now;
|
|
79
|
+
private readonly leaseMs;
|
|
80
|
+
private readonly retry;
|
|
81
|
+
constructor(options: NodeRuntimeOptions);
|
|
82
|
+
/** The runtime port the rest of the host starts, wakes and stops instances through. */
|
|
83
|
+
readonly binding: WorkflowBindingLike;
|
|
84
|
+
private instance;
|
|
85
|
+
/**
|
|
86
|
+
* Claim the earliest due run and take it one turn further. Undefined when nothing is due.
|
|
87
|
+
*/
|
|
88
|
+
turn(): Promise<TurnResult | undefined>;
|
|
89
|
+
/** Every run that is due now, one after another; what each turn came to. */
|
|
90
|
+
drain(limit?: number): Promise<TurnResult[]>;
|
|
91
|
+
/** When the next run is due, if any is waiting on the clock. */
|
|
92
|
+
nextWake(): Promise<number | undefined>;
|
|
93
|
+
/** Remove the runs that ended more than `olderThanMs` ago. */
|
|
94
|
+
prune(olderThanMs: number): Promise<number>;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=runtime.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.cts","names":[],"sources":["../../src/node/runtime.ts"],"mappings":";;;;;;;;;;;;;;;;iBAwBiB;;EAEf;;EAEA;;EAEA;;qBAGW,oBAAoB;;;;;;qBAWpB;;iBAGI;EACf,OAAO;;EAEP,QAAQ,MAAM,aAAa,QAAQ;EACnC,SAAS;;iBAGM;EACf,MAAM;;EAEN,KAAK;IAAO;IAAoB,QAAQ;IAAe;MAAwB;;EAE/E;EACA;EACA;EACA,QAAQ,QAAQ;;EAEhB;;;YAIU;EACN;EAAoB;EAAmB,SAAS;;EAChD;EAAoB;EAAkB;;EACtC;EAAoB;EAAoB;;;;EAExC;EAAoB;;qBAyOb;mBAOkB;mBANZ;mBACA;mBACA;mBACA;mBACA;EAEjB,YAA6B,SAAS;;WAU7B,SAAS;UAoBV;;;;EAuBF,QAAQ,QAAQ;;EA6DhB,MAAM,iBAAmC,QAAQ;;EAWvD,YAAY;;EAKZ,MAAM,sBAAsB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { EngineStep, JourneyOutcome } from "../engine/ports.mjs";
|
|
2
|
+
import { JourneyParams, WorkflowBindingLike } from "../host/platform.mjs";
|
|
3
|
+
import { JourneyStore } from "../store/index.mjs";
|
|
4
|
+
import { RunStore } from "./runs.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* The self-hosted runtime: journeys as rows, run a turn at a time.
|
|
7
|
+
*
|
|
8
|
+
* A turn claims one due run, replays the journey from the top with the run's checkpoints in
|
|
9
|
+
* memory, and ends in one of three ways: the journey returned, it threw, or it reached something
|
|
10
|
+
* that has to wait (a sleep, a retry's backoff, a wait for a wake) and was **suspended** — its
|
|
11
|
+
* state written, its lease released, to be claimed again when that is due.
|
|
12
|
+
*
|
|
13
|
+
* This is the model both other hosts run on (Cloudflare Workflows, Lambda durable functions);
|
|
14
|
+
* here the process is the runtime and Postgres its only state.
|
|
15
|
+
*/
|
|
16
|
+
/** A step's retries, as Cloudflare Workflows defaults them. */
|
|
17
|
+
export interface StepRetryPolicy {
|
|
18
|
+
/** Retries after the first attempt. */
|
|
19
|
+
limit: number;
|
|
20
|
+
/** The wait before the first retry; doubled before each one after. */
|
|
21
|
+
delayMs: number;
|
|
22
|
+
/** How long one attempt may run before it counts as failed. */
|
|
23
|
+
timeoutMs: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_STEP_RETRY: StepRetryPolicy;
|
|
26
|
+
/**
|
|
27
|
+
* How long a claim holds before another worker may take the run; a running turn keeps extending
|
|
28
|
+
* it. Leases are told by each process's own clock, so the processes' clocks must agree to well
|
|
29
|
+
* within this (NTP does): one far ahead takes runs that are still being run.
|
|
30
|
+
*/
|
|
31
|
+
export declare const DEFAULT_LEASE_MS = 60000;
|
|
32
|
+
/** What one run of the journey is given: the store it reads and writes, and how to close it. */
|
|
33
|
+
export interface TurnParts {
|
|
34
|
+
store: JourneyStore;
|
|
35
|
+
/** Run the journey once over `step`: `executeJourney` with the host's outlets. */
|
|
36
|
+
execute(step: EngineStep): Promise<JourneyOutcome>;
|
|
37
|
+
close(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export interface NodeRuntimeOptions {
|
|
40
|
+
runs: RunStore;
|
|
41
|
+
/** Everything one turn of `instanceId` needs. Called once per turn. */
|
|
42
|
+
open(run: {
|
|
43
|
+
instanceId: string;
|
|
44
|
+
params: JourneyParams;
|
|
45
|
+
enteredAtMs: number;
|
|
46
|
+
}): TurnParts;
|
|
47
|
+
/** This worker's name on the leases it holds. */
|
|
48
|
+
owner?: string;
|
|
49
|
+
now?: () => number;
|
|
50
|
+
leaseMs?: number;
|
|
51
|
+
retry?: Partial<StepRetryPolicy>;
|
|
52
|
+
/** Told when a run becomes due at once (a create, a wake), so an idle worker need not poll for it. */
|
|
53
|
+
onDue?: () => void;
|
|
54
|
+
}
|
|
55
|
+
/** How a turn ended. */
|
|
56
|
+
export type TurnResult = {
|
|
57
|
+
instanceId: string;
|
|
58
|
+
ended: 'complete';
|
|
59
|
+
outcome: JourneyOutcome;
|
|
60
|
+
} | {
|
|
61
|
+
instanceId: string;
|
|
62
|
+
ended: 'errored';
|
|
63
|
+
error: unknown;
|
|
64
|
+
} | {
|
|
65
|
+
instanceId: string;
|
|
66
|
+
ended: 'suspended';
|
|
67
|
+
wakeAt: number;
|
|
68
|
+
} |
|
|
69
|
+
/** The run was taken from this turn (its lease ran out, or it was terminated): nothing was written. */
|
|
70
|
+
{
|
|
71
|
+
instanceId: string;
|
|
72
|
+
ended: 'abandoned';
|
|
73
|
+
};
|
|
74
|
+
export declare class NodeRuntime {
|
|
75
|
+
private readonly options;
|
|
76
|
+
private readonly runs;
|
|
77
|
+
private readonly owner;
|
|
78
|
+
private readonly now;
|
|
79
|
+
private readonly leaseMs;
|
|
80
|
+
private readonly retry;
|
|
81
|
+
constructor(options: NodeRuntimeOptions);
|
|
82
|
+
/** The runtime port the rest of the host starts, wakes and stops instances through. */
|
|
83
|
+
readonly binding: WorkflowBindingLike;
|
|
84
|
+
private instance;
|
|
85
|
+
/**
|
|
86
|
+
* Claim the earliest due run and take it one turn further. Undefined when nothing is due.
|
|
87
|
+
*/
|
|
88
|
+
turn(): Promise<TurnResult | undefined>;
|
|
89
|
+
/** Every run that is due now, one after another; what each turn came to. */
|
|
90
|
+
drain(limit?: number): Promise<TurnResult[]>;
|
|
91
|
+
/** When the next run is due, if any is waiting on the clock. */
|
|
92
|
+
nextWake(): Promise<number | undefined>;
|
|
93
|
+
/** Remove the runs that ended more than `olderThanMs` ago. */
|
|
94
|
+
prune(olderThanMs: number): Promise<number>;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../../src/node/runtime.ts"],"mappings":";;;;;;;;;;;;;;;;iBAwBiB;;EAEf;;EAEA;;EAEA;;qBAGW,oBAAoB;;;;;;qBAWpB;;iBAGI;EACf,OAAO;;EAEP,QAAQ,MAAM,aAAa,QAAQ;EACnC,SAAS;;iBAGM;EACf,MAAM;;EAEN,KAAK;IAAO;IAAoB,QAAQ;IAAe;MAAwB;;EAE/E;EACA;EACA;EACA,QAAQ,QAAQ;;EAEhB;;;YAIU;EACN;EAAoB;EAAmB,SAAS;;EAChD;EAAoB;EAAkB;;EACtC;EAAoB;EAAoB;;;;EAExC;EAAoB;;qBAyOb;mBAOkB;mBANZ;mBACA;mBACA;mBACA;mBACA;EAEjB,YAA6B,SAAS;;WAU7B,SAAS;UAoBV;;;;EAuBF,QAAQ,QAAQ;;EA6DhB,MAAM,iBAAmC,QAAQ;;EAWvD,YAAY;;EAKZ,MAAM,sBAAsB"}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { isRetryable } from "../engine/retry.mjs";
|
|
2
|
+
import { instanceOwner } from "../store/identity.mjs";
|
|
3
|
+
import { InstanceNotFoundError } from "../host/platform.mjs";
|
|
4
|
+
import "../store/index.mjs";
|
|
5
|
+
// src/node/runtime.ts
|
|
6
|
+
const DEFAULT_STEP_RETRY = {
|
|
7
|
+
limit: 5,
|
|
8
|
+
delayMs: 1e4,
|
|
9
|
+
timeoutMs: 6e5
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* How long a claim holds before another worker may take the run; a running turn keeps extending
|
|
13
|
+
* it. Leases are told by each process's own clock, so the processes' clocks must agree to well
|
|
14
|
+
* within this (NTP does): one far ahead takes runs that are still being run.
|
|
15
|
+
*/
|
|
16
|
+
const DEFAULT_LEASE_MS = 6e4;
|
|
17
|
+
/** A promise nothing settles: where a suspended turn's journey stays parked. */
|
|
18
|
+
const never = () => new Promise(() => {});
|
|
19
|
+
const messageOf = (error) => error instanceof Error ? `${error.name}: ${error.message}` : String(error);
|
|
20
|
+
/**
|
|
21
|
+
* One turn's `EngineStep`. A call with a checkpoint answers from it; the first call without one
|
|
22
|
+
* does the work. A call that has to wait does not throw through the interpreter — a `catch`
|
|
23
|
+
* there would swallow it and the journey would run on past its own sleep. It reports the
|
|
24
|
+
* suspension to the driver and returns a promise nothing settles, so the journey simply stops
|
|
25
|
+
* where it stands.
|
|
26
|
+
*/
|
|
27
|
+
var TurnStep = class {
|
|
28
|
+
run;
|
|
29
|
+
records;
|
|
30
|
+
runs;
|
|
31
|
+
store;
|
|
32
|
+
userId;
|
|
33
|
+
now;
|
|
34
|
+
retry;
|
|
35
|
+
stop;
|
|
36
|
+
seen = /* @__PURE__ */ new Map();
|
|
37
|
+
/**
|
|
38
|
+
* Checkpoints not written yet: the engine's bookkeeping steps, a sleep's instant, a retry's
|
|
39
|
+
* backoff. They go with the next checkpoint that cannot wait, or with the statement that ends
|
|
40
|
+
* the turn — always together with what follows them, so a replay never finds a later step
|
|
41
|
+
* recorded and an earlier one missing.
|
|
42
|
+
*/
|
|
43
|
+
held = /* @__PURE__ */ new Map();
|
|
44
|
+
inFlight = /* @__PURE__ */ new Set();
|
|
45
|
+
/** The wake counter as the latest `subscribe` read it: what the next wait compares against. */
|
|
46
|
+
baseline = 0;
|
|
47
|
+
stopped = false;
|
|
48
|
+
/** The run is no longer this turn's: a write was refused, or the runtime's store failed. */
|
|
49
|
+
lost = false;
|
|
50
|
+
/** The store's failure, when that is why: the driver throws it, and the run is replayed. */
|
|
51
|
+
fault;
|
|
52
|
+
constructor(run, records, runs, store, userId, now, retry, stop) {
|
|
53
|
+
this.run = run;
|
|
54
|
+
this.records = records;
|
|
55
|
+
this.runs = runs;
|
|
56
|
+
this.store = store;
|
|
57
|
+
this.userId = userId;
|
|
58
|
+
this.now = now;
|
|
59
|
+
this.retry = retry;
|
|
60
|
+
this.stop = stop;
|
|
61
|
+
}
|
|
62
|
+
/** The step bodies still running: the driver lets them finish before it releases the run. */
|
|
63
|
+
settled() {
|
|
64
|
+
return Promise.allSettled(this.inFlight);
|
|
65
|
+
}
|
|
66
|
+
/** A name used twice in one run is two steps: the key carries which occurrence this is. */
|
|
67
|
+
key(name) {
|
|
68
|
+
const n = (this.seen.get(name) ?? 0) + 1;
|
|
69
|
+
this.seen.set(name, n);
|
|
70
|
+
return n === 1 ? name : `${name}#${n}`;
|
|
71
|
+
}
|
|
72
|
+
halt(how) {
|
|
73
|
+
if (!this.stopped) {
|
|
74
|
+
this.stopped = true;
|
|
75
|
+
this.stop(how);
|
|
76
|
+
}
|
|
77
|
+
return never();
|
|
78
|
+
}
|
|
79
|
+
abandon() {
|
|
80
|
+
this.lost = true;
|
|
81
|
+
return this.halt("abandoned");
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The runtime's own store failed (the connection, a failover). That is not the journey
|
|
85
|
+
* failing: thrown to the interpreter it would end the run as errored, for a database that is
|
|
86
|
+
* back a second later. The turn is dropped instead and the run replayed from its checkpoints.
|
|
87
|
+
*/
|
|
88
|
+
fail(error) {
|
|
89
|
+
this.fault ??= { error };
|
|
90
|
+
return this.abandon();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Write a checkpoint; a write the fence refuses ends the turn, with nothing more written. A
|
|
94
|
+
* turn that was only suspended still holds its run: a step finishing beside the one that
|
|
95
|
+
* suspended it is recorded.
|
|
96
|
+
*/
|
|
97
|
+
async save(key, record, later = false) {
|
|
98
|
+
if (this.lost) return false;
|
|
99
|
+
this.held.set(key, record);
|
|
100
|
+
this.records.set(key, record);
|
|
101
|
+
if (later) return true;
|
|
102
|
+
const writes = Array.from(this.held);
|
|
103
|
+
let kept;
|
|
104
|
+
try {
|
|
105
|
+
kept = await this.runs.checkpoint(this.run, writes, this.now());
|
|
106
|
+
} catch (error) {
|
|
107
|
+
this.fail(error);
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
if (kept) for (const [written] of writes) this.held.delete(written);
|
|
111
|
+
else this.abandon();
|
|
112
|
+
return kept;
|
|
113
|
+
}
|
|
114
|
+
/** The checkpoints still held, for the statement that ends the turn. */
|
|
115
|
+
take() {
|
|
116
|
+
return Array.from(this.held);
|
|
117
|
+
}
|
|
118
|
+
async do(name, fn, options) {
|
|
119
|
+
const key = this.key(name);
|
|
120
|
+
const record = this.records.get(key);
|
|
121
|
+
if (record?.done === true) return record.result;
|
|
122
|
+
if (this.stopped) return never();
|
|
123
|
+
const failed = record?.attempts ?? 0;
|
|
124
|
+
const retryAt = record?.result;
|
|
125
|
+
if (failed > 0 && retryAt !== void 0 && this.now() < retryAt) return this.halt({
|
|
126
|
+
status: "sleeping",
|
|
127
|
+
wakeAt: retryAt
|
|
128
|
+
});
|
|
129
|
+
const attempt = this.attempt(fn);
|
|
130
|
+
this.inFlight.add(attempt);
|
|
131
|
+
let result;
|
|
132
|
+
try {
|
|
133
|
+
result = await attempt;
|
|
134
|
+
} catch (error) {
|
|
135
|
+
this.inFlight.delete(attempt);
|
|
136
|
+
if (!isRetryable(error) || failed >= this.retry.limit) throw error;
|
|
137
|
+
const wakeAt = this.now() + this.retry.delayMs * 2 ** failed;
|
|
138
|
+
if (await this.save(key, {
|
|
139
|
+
kind: "do",
|
|
140
|
+
done: false,
|
|
141
|
+
result: wakeAt,
|
|
142
|
+
attempts: failed + 1
|
|
143
|
+
}, true)) console.warn(`[workflow] step ${name} of ${this.run.instanceId} failed (attempt ${failed + 1}), retrying: ${messageOf(error)}`);
|
|
144
|
+
return this.halt({
|
|
145
|
+
status: "sleeping",
|
|
146
|
+
wakeAt
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
this.inFlight.delete(attempt);
|
|
150
|
+
return await this.save(key, {
|
|
151
|
+
kind: "do",
|
|
152
|
+
done: true,
|
|
153
|
+
result,
|
|
154
|
+
attempts: failed + 1
|
|
155
|
+
}, options?.idempotent === true) ? result : never();
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* One attempt, given up on after the step timeout. Nothing can stop the body itself: a call
|
|
159
|
+
* that answers after its step was given up on has still happened, and the retry repeats it
|
|
160
|
+
* (steps are at least once).
|
|
161
|
+
*/
|
|
162
|
+
attempt(fn) {
|
|
163
|
+
let timer;
|
|
164
|
+
const timeout = new Promise((_resolve, reject) => {
|
|
165
|
+
timer = setTimeout(() => {
|
|
166
|
+
reject(/* @__PURE__ */ new Error(`step timed out after ${this.retry.timeoutMs} ms`));
|
|
167
|
+
}, this.retry.timeoutMs);
|
|
168
|
+
});
|
|
169
|
+
return Promise.race([fn(), timeout]).finally(() => {
|
|
170
|
+
clearTimeout(timer);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
async sleep(name, ms) {
|
|
174
|
+
const key = this.key(name);
|
|
175
|
+
let until = this.records.get(key)?.result;
|
|
176
|
+
if (until === void 0) {
|
|
177
|
+
if (this.stopped) return never();
|
|
178
|
+
until = this.now() + ms;
|
|
179
|
+
if (!await this.save(key, {
|
|
180
|
+
kind: "sleep",
|
|
181
|
+
done: true,
|
|
182
|
+
result: until,
|
|
183
|
+
attempts: 0
|
|
184
|
+
}, true)) return never();
|
|
185
|
+
}
|
|
186
|
+
if (this.now() >= until) return;
|
|
187
|
+
return this.halt({
|
|
188
|
+
status: "sleeping",
|
|
189
|
+
wakeAt: until
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
async subscribe(name, events) {
|
|
193
|
+
this.baseline = await this.do(name, async () => {
|
|
194
|
+
const signals = await this.runs.signals(this.run.instanceId);
|
|
195
|
+
const owner = await instanceOwner(this.store, this.run.instanceId, this.userId);
|
|
196
|
+
await this.store.subscribe(this.run.instanceId, owner, events, this.now());
|
|
197
|
+
return signals;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
unsubscribe(name) {
|
|
201
|
+
return this.do(name, () => this.store.unsubscribe(this.run.instanceId));
|
|
202
|
+
}
|
|
203
|
+
async waitForWake(name, { deadlineMs }) {
|
|
204
|
+
const key = this.key(name);
|
|
205
|
+
const record = this.records.get(key);
|
|
206
|
+
if (record?.done === true) return record.result;
|
|
207
|
+
if (this.stopped) return never();
|
|
208
|
+
const answer = async (verdict) => await this.save(key, {
|
|
209
|
+
kind: "wait",
|
|
210
|
+
done: true,
|
|
211
|
+
result: verdict,
|
|
212
|
+
attempts: 0
|
|
213
|
+
}) ? verdict : never();
|
|
214
|
+
let signals;
|
|
215
|
+
try {
|
|
216
|
+
signals = await this.runs.signals(this.run.instanceId);
|
|
217
|
+
} catch (error) {
|
|
218
|
+
return this.fail(error);
|
|
219
|
+
}
|
|
220
|
+
if (signals > this.baseline) return answer("event");
|
|
221
|
+
if (this.now() >= deadlineMs) return answer("timeout");
|
|
222
|
+
return this.halt({
|
|
223
|
+
status: "waiting",
|
|
224
|
+
wakeAt: deadlineMs,
|
|
225
|
+
ifSignals: this.baseline
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
var NodeRuntime = class {
|
|
230
|
+
options;
|
|
231
|
+
runs;
|
|
232
|
+
owner;
|
|
233
|
+
now;
|
|
234
|
+
leaseMs;
|
|
235
|
+
retry;
|
|
236
|
+
constructor(options) {
|
|
237
|
+
this.options = options;
|
|
238
|
+
this.runs = options.runs;
|
|
239
|
+
this.owner = options.owner ?? `node-${crypto.randomUUID()}`;
|
|
240
|
+
this.now = options.now ?? (() => Date.now());
|
|
241
|
+
this.leaseMs = options.leaseMs ?? 6e4;
|
|
242
|
+
this.retry = {
|
|
243
|
+
...DEFAULT_STEP_RETRY,
|
|
244
|
+
...options.retry
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/** The runtime port the rest of the host starts, wakes and stops instances through. */
|
|
248
|
+
binding = {
|
|
249
|
+
create: async ({ id, params }) => {
|
|
250
|
+
const journey = params;
|
|
251
|
+
if (!await this.runs.create(id, journey, journey.trigger.ts ?? this.now(), this.now())) throw new Error(`instance ${id} already exists`);
|
|
252
|
+
this.options.onDue?.();
|
|
253
|
+
return this.instance(id);
|
|
254
|
+
},
|
|
255
|
+
get: async (id) => {
|
|
256
|
+
if (await this.runs.status(id) === void 0) throw new InstanceNotFoundError(id);
|
|
257
|
+
return this.instance(id);
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
instance(id) {
|
|
261
|
+
return {
|
|
262
|
+
id,
|
|
263
|
+
sendEvent: async () => {
|
|
264
|
+
if (await this.runs.signal(id, this.now())) this.options.onDue?.();
|
|
265
|
+
},
|
|
266
|
+
status: async () => {
|
|
267
|
+
const status = await this.runs.status(id);
|
|
268
|
+
if (status === void 0) throw new InstanceNotFoundError(id);
|
|
269
|
+
return { status: status === "queued" || status === "sleeping" || status === "waiting" ? "running" : status };
|
|
270
|
+
},
|
|
271
|
+
terminate: async () => {
|
|
272
|
+
await this.runs.terminate(id, this.now());
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Claim the earliest due run and take it one turn further. Undefined when nothing is due.
|
|
278
|
+
*/
|
|
279
|
+
async turn() {
|
|
280
|
+
const run = await this.runs.claim(this.owner, this.now(), this.leaseMs);
|
|
281
|
+
if (run === void 0) return void 0;
|
|
282
|
+
const { instanceId } = run;
|
|
283
|
+
const beat = setInterval(() => {
|
|
284
|
+
this.runs.extend(run, this.now() + this.leaseMs).catch(() => {});
|
|
285
|
+
}, Math.max(50, this.leaseMs / 3));
|
|
286
|
+
const parts = this.options.open(run);
|
|
287
|
+
try {
|
|
288
|
+
let stop;
|
|
289
|
+
const stopped = new Promise((resolve) => {
|
|
290
|
+
stop = resolve;
|
|
291
|
+
});
|
|
292
|
+
const step = new TurnStep(run, run.steps, this.runs, parts.store, run.params.userId, this.now, this.retry, stop);
|
|
293
|
+
const end = await Promise.race([parts.execute(step).then((outcome) => ({ outcome }), (error) => ({ error })), stopped.then((how) => ({ how }))]);
|
|
294
|
+
if ("how" in end) {
|
|
295
|
+
await step.settled();
|
|
296
|
+
if (step.fault !== void 0) throw step.fault.error;
|
|
297
|
+
if (end.how === "abandoned" || step.lost) return {
|
|
298
|
+
instanceId,
|
|
299
|
+
ended: "abandoned"
|
|
300
|
+
};
|
|
301
|
+
await this.runs.suspend(run, end.how, this.now(), step.take());
|
|
302
|
+
return {
|
|
303
|
+
instanceId,
|
|
304
|
+
ended: "suspended",
|
|
305
|
+
wakeAt: end.how.wakeAt
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
if ("error" in end) {
|
|
309
|
+
await this.runs.finish(run, "errored", this.now(), messageOf(end.error), step.take());
|
|
310
|
+
return {
|
|
311
|
+
instanceId,
|
|
312
|
+
ended: "errored",
|
|
313
|
+
error: end.error
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
await this.runs.finish(run, "complete", this.now(), void 0, step.take());
|
|
317
|
+
return {
|
|
318
|
+
instanceId,
|
|
319
|
+
ended: "complete",
|
|
320
|
+
outcome: end.outcome
|
|
321
|
+
};
|
|
322
|
+
} finally {
|
|
323
|
+
clearInterval(beat);
|
|
324
|
+
await parts.close();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/** Every run that is due now, one after another; what each turn came to. */
|
|
328
|
+
async drain(limit = Number.POSITIVE_INFINITY) {
|
|
329
|
+
const results = [];
|
|
330
|
+
while (results.length < limit) {
|
|
331
|
+
const result = await this.turn();
|
|
332
|
+
if (result === void 0) break;
|
|
333
|
+
results.push(result);
|
|
334
|
+
}
|
|
335
|
+
return results;
|
|
336
|
+
}
|
|
337
|
+
/** When the next run is due, if any is waiting on the clock. */
|
|
338
|
+
nextWake() {
|
|
339
|
+
return this.runs.nextWake();
|
|
340
|
+
}
|
|
341
|
+
/** Remove the runs that ended more than `olderThanMs` ago. */
|
|
342
|
+
prune(olderThanMs) {
|
|
343
|
+
return this.runs.prune(this.now() - olderThanMs);
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
export { DEFAULT_LEASE_MS, DEFAULT_STEP_RETRY, NodeRuntime };
|
|
347
|
+
|
|
348
|
+
//# sourceMappingURL=runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../../src/node/runtime.ts"],"sourcesContent":["import type { EngineStep, JourneyOutcome, StepOptions } from '../engine/ports';\nimport { isRetryable } from '../engine/retry';\nimport {\n InstanceNotFoundError,\n type JourneyParams,\n type WorkflowBindingLike,\n type WorkflowInstanceLike,\n} from '../host/platform';\nimport { type JourneyStore, instanceOwner } from '../store/index';\nimport type { ClaimedRun, RunStore, StepRecord, StepWrites, Suspension } from './runs';\n\n/**\n * The self-hosted runtime: journeys as rows, run a turn at a time.\n *\n * A turn claims one due run, replays the journey from the top with the run's checkpoints in\n * memory, and ends in one of three ways: the journey returned, it threw, or it reached something\n * that has to wait (a sleep, a retry's backoff, a wait for a wake) and was **suspended** — its\n * state written, its lease released, to be claimed again when that is due.\n *\n * This is the model both other hosts run on (Cloudflare Workflows, Lambda durable functions);\n * here the process is the runtime and Postgres its only state.\n */\n\n/** A step's retries, as Cloudflare Workflows defaults them. */\nexport interface StepRetryPolicy {\n /** Retries after the first attempt. */\n limit: number;\n /** The wait before the first retry; doubled before each one after. */\n delayMs: number;\n /** How long one attempt may run before it counts as failed. */\n timeoutMs: number;\n}\n\nexport const DEFAULT_STEP_RETRY: StepRetryPolicy = {\n limit: 5,\n delayMs: 10_000,\n timeoutMs: 10 * 60_000,\n};\n\n/**\n * How long a claim holds before another worker may take the run; a running turn keeps extending\n * it. Leases are told by each process's own clock, so the processes' clocks must agree to well\n * within this (NTP does): one far ahead takes runs that are still being run.\n */\nexport const DEFAULT_LEASE_MS = 60_000;\n\n/** What one run of the journey is given: the store it reads and writes, and how to close it. */\nexport interface TurnParts {\n store: JourneyStore;\n /** Run the journey once over `step`: `executeJourney` with the host's outlets. */\n execute(step: EngineStep): Promise<JourneyOutcome>;\n close(): Promise<void>;\n}\n\nexport interface NodeRuntimeOptions {\n runs: RunStore;\n /** Everything one turn of `instanceId` needs. Called once per turn. */\n open(run: { instanceId: string; params: JourneyParams; enteredAtMs: number }): TurnParts;\n /** This worker's name on the leases it holds. */\n owner?: string;\n now?: () => number;\n leaseMs?: number;\n retry?: Partial<StepRetryPolicy>;\n /** Told when a run becomes due at once (a create, a wake), so an idle worker need not poll for it. */\n onDue?: () => void;\n}\n\n/** How a turn ended. */\nexport type TurnResult =\n | { instanceId: string; ended: 'complete'; outcome: JourneyOutcome }\n | { instanceId: string; ended: 'errored'; error: unknown }\n | { instanceId: string; ended: 'suspended'; wakeAt: number }\n /** The run was taken from this turn (its lease ran out, or it was terminated): nothing was written. */\n | { instanceId: string; ended: 'abandoned' };\n\n/** A promise nothing settles: where a suspended turn's journey stays parked. */\nconst never = <T>(): Promise<T> => new Promise<T>(() => {});\n\nconst messageOf = (error: unknown): string =>\n error instanceof Error ? `${error.name}: ${error.message}` : String(error);\n\n/**\n * One turn's `EngineStep`. A call with a checkpoint answers from it; the first call without one\n * does the work. A call that has to wait does not throw through the interpreter — a `catch`\n * there would swallow it and the journey would run on past its own sleep. It reports the\n * suspension to the driver and returns a promise nothing settles, so the journey simply stops\n * where it stands.\n */\nclass TurnStep implements EngineStep {\n private readonly seen = new Map<string, number>();\n /**\n * Checkpoints not written yet: the engine's bookkeeping steps, a sleep's instant, a retry's\n * backoff. They go with the next checkpoint that cannot wait, or with the statement that ends\n * the turn — always together with what follows them, so a replay never finds a later step\n * recorded and an earlier one missing.\n */\n private readonly held = new Map<string, StepRecord>();\n private readonly inFlight = new Set<Promise<unknown>>();\n /** The wake counter as the latest `subscribe` read it: what the next wait compares against. */\n private baseline = 0;\n private stopped = false;\n /** The run is no longer this turn's: a write was refused, or the runtime's store failed. */\n lost = false;\n /** The store's failure, when that is why: the driver throws it, and the run is replayed. */\n fault: { error: unknown } | undefined;\n\n constructor(\n private readonly run: ClaimedRun,\n private readonly records: Map<string, StepRecord>,\n private readonly runs: RunStore,\n private readonly store: JourneyStore,\n private readonly userId: string,\n private readonly now: () => number,\n private readonly retry: StepRetryPolicy,\n private readonly stop: (how: Suspension | 'abandoned') => void\n ) {}\n\n /** The step bodies still running: the driver lets them finish before it releases the run. */\n settled(): Promise<unknown> {\n return Promise.allSettled(this.inFlight);\n }\n\n /** A name used twice in one run is two steps: the key carries which occurrence this is. */\n private key(name: string): string {\n const n = (this.seen.get(name) ?? 0) + 1;\n this.seen.set(name, n);\n return n === 1 ? name : `${name}#${n}`;\n }\n\n private halt<T>(how: Suspension | 'abandoned'): Promise<T> {\n if (!this.stopped) {\n this.stopped = true;\n this.stop(how);\n }\n return never<T>();\n }\n\n private abandon<T>(): Promise<T> {\n this.lost = true;\n return this.halt('abandoned');\n }\n\n /**\n * The runtime's own store failed (the connection, a failover). That is not the journey\n * failing: thrown to the interpreter it would end the run as errored, for a database that is\n * back a second later. The turn is dropped instead and the run replayed from its checkpoints.\n */\n private fail<T>(error: unknown): Promise<T> {\n this.fault ??= { error };\n return this.abandon();\n }\n\n /**\n * Write a checkpoint; a write the fence refuses ends the turn, with nothing more written. A\n * turn that was only suspended still holds its run: a step finishing beside the one that\n * suspended it is recorded.\n */\n private async save(key: string, record: StepRecord, later = false): Promise<boolean> {\n if (this.lost) return false;\n this.held.set(key, record);\n this.records.set(key, record);\n if (later) return true;\n const writes = Array.from(this.held);\n let kept: boolean;\n try {\n kept = await this.runs.checkpoint(this.run, writes, this.now());\n } catch (error) {\n void this.fail(error);\n return false;\n }\n // Only what was sent: a step finishing meanwhile holds its own\n if (kept) for (const [written] of writes) this.held.delete(written);\n else void this.abandon();\n return kept;\n }\n\n /** The checkpoints still held, for the statement that ends the turn. */\n take(): StepWrites {\n return Array.from(this.held);\n }\n\n async do<T>(name: string, fn: () => Promise<T>, options?: StepOptions): Promise<T> {\n const key = this.key(name);\n const record = this.records.get(key);\n if (record?.done === true) return record.result as T;\n if (this.stopped) return never<T>();\n\n const failed = record?.attempts ?? 0;\n // Woken before its backoff was over (a wake meant for a later wait): not yet\n const retryAt = record?.result as number | undefined;\n if (failed > 0 && retryAt !== undefined && this.now() < retryAt) {\n return this.halt({ status: 'sleeping', wakeAt: retryAt });\n }\n\n const attempt = this.attempt(fn);\n this.inFlight.add(attempt);\n let result: T;\n try {\n result = await attempt;\n } catch (error) {\n this.inFlight.delete(attempt);\n // The same on every attempt (a template refusing its props, a provider's 4xx), or out of\n // retries: the journey gets the error, as on the other runtimes\n if (!isRetryable(error) || failed >= this.retry.limit) throw error;\n const wakeAt = this.now() + this.retry.delayMs * 2 ** failed;\n // Held: the suspension that follows writes it\n const kept = await this.save(\n key,\n { kind: 'do', done: false, result: wakeAt, attempts: failed + 1 },\n true\n );\n if (kept) {\n console.warn(\n `[workflow] step ${name} of ${this.run.instanceId} failed (attempt ${failed + 1}), retrying: ${messageOf(error)}`\n );\n }\n return this.halt({ status: 'sleeping', wakeAt });\n }\n this.inFlight.delete(attempt);\n const kept = await this.save(\n key,\n { kind: 'do', done: true, result, attempts: failed + 1 },\n options?.idempotent === true\n );\n return kept ? result : never<T>();\n }\n\n /**\n * One attempt, given up on after the step timeout. Nothing can stop the body itself: a call\n * that answers after its step was given up on has still happened, and the retry repeats it\n * (steps are at least once).\n */\n private attempt<T>(fn: () => Promise<T>): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const timeout = new Promise<never>((_resolve, reject) => {\n timer = setTimeout(() => {\n reject(new Error(`step timed out after ${this.retry.timeoutMs} ms`));\n }, this.retry.timeoutMs);\n });\n return Promise.race([fn(), timeout]).finally(() => {\n clearTimeout(timer);\n });\n }\n\n async sleep(name: string, ms: number): Promise<void> {\n const key = this.key(name);\n let until = this.records.get(key)?.result as number | undefined;\n if (until === undefined) {\n if (this.stopped) return never();\n // The instant is fixed the first time the sleep is reached: a replay sleeps to the same one\n until = this.now() + ms;\n // Held: the suspension that follows writes it (a sleep of no length has nothing to lose)\n if (\n !(await this.save(key, { kind: 'sleep', done: true, result: until, attempts: 0 }, true))\n ) {\n return never();\n }\n }\n if (this.now() >= until) return;\n return this.halt({ status: 'sleeping', wakeAt: until });\n }\n\n async subscribe(name: string, events: readonly string[]): Promise<void> {\n // The counter is read before the registration is written and kept with the step: a wake\n // that lands any time after this — before the wait is even reached — has moved it\n this.baseline = await this.do(name, async () => {\n const signals = await this.runs.signals(this.run.instanceId);\n // The instance may have changed hands (a visitor who signed in): its wakes follow the owner\n const owner = await instanceOwner(this.store, this.run.instanceId, this.userId);\n await this.store.subscribe(this.run.instanceId, owner, events, this.now());\n return signals;\n });\n }\n\n unsubscribe(name: string): Promise<void> {\n return this.do(name, () => this.store.unsubscribe(this.run.instanceId));\n }\n\n async waitForWake(\n name: string,\n { deadlineMs }: { timeoutMs: number; deadlineMs: number }\n ): Promise<'event' | 'timeout'> {\n const key = this.key(name);\n const record = this.records.get(key);\n if (record?.done === true) return record.result as 'event' | 'timeout';\n if (this.stopped) return never();\n\n const answer = async (verdict: 'event' | 'timeout') =>\n (await this.save(key, { kind: 'wait', done: true, result: verdict, attempts: 0 }))\n ? verdict\n : never<'event' | 'timeout'>();\n let signals: number;\n try {\n signals = await this.runs.signals(this.run.instanceId);\n } catch (error) {\n return this.fail(error);\n }\n // A wake first: one that arrived at the deadline is still a wake\n if (signals > this.baseline) return answer('event');\n if (this.now() >= deadlineMs) return answer('timeout');\n // Parked only if the counter is still where the subscribe found it; otherwise the run is\n // queued again at once and the replay answers 'event' above\n return this.halt({ status: 'waiting', wakeAt: deadlineMs, ifSignals: this.baseline });\n }\n}\n\nexport class NodeRuntime {\n private readonly runs: RunStore;\n private readonly owner: string;\n private readonly now: () => number;\n private readonly leaseMs: number;\n private readonly retry: StepRetryPolicy;\n\n constructor(private readonly options: NodeRuntimeOptions) {\n this.runs = options.runs;\n this.owner = options.owner ?? `node-${crypto.randomUUID()}`;\n // Read through `Date` at each call, not captured: a test that fakes the clock later is followed\n this.now = options.now ?? (() => Date.now());\n this.leaseMs = options.leaseMs ?? DEFAULT_LEASE_MS;\n this.retry = { ...DEFAULT_STEP_RETRY, ...options.retry };\n }\n\n /** The runtime port the rest of the host starts, wakes and stops instances through. */\n readonly binding: WorkflowBindingLike = {\n create: async ({ id, params }) => {\n const journey = params as JourneyParams;\n // The trigger's time is the entry anchor, as Cloudflare's event timestamp is for its runner\n const created = await this.runs.create(\n id,\n journey,\n journey.trigger.ts ?? this.now(),\n this.now()\n );\n if (!created) throw new Error(`instance ${id} already exists`);\n this.options.onDue?.();\n return this.instance(id);\n },\n get: async (id) => {\n if ((await this.runs.status(id)) === undefined) throw new InstanceNotFoundError(id);\n return this.instance(id);\n },\n };\n\n private instance(id: string): WorkflowInstanceLike {\n return {\n id,\n sendEvent: async () => {\n // A run that is over takes no wake: the host reads its status and drops the subscription\n if (await this.runs.signal(id, this.now())) this.options.onDue?.();\n },\n status: async () => {\n const status = await this.runs.status(id);\n if (status === undefined) throw new InstanceNotFoundError(id);\n // The states between turns are all \"it is running\", as far as the host is concerned\n const live = status === 'queued' || status === 'sleeping' || status === 'waiting';\n return { status: live ? 'running' : status };\n },\n terminate: async () => {\n await this.runs.terminate(id, this.now());\n },\n };\n }\n\n /**\n * Claim the earliest due run and take it one turn further. Undefined when nothing is due.\n */\n async turn(): Promise<TurnResult | undefined> {\n const run = await this.runs.claim(this.owner, this.now(), this.leaseMs);\n if (run === undefined) return undefined;\n const { instanceId } = run;\n\n // Held for as long as the turn runs: a slow action is not a dead worker\n const beat = setInterval(\n () => {\n void this.runs.extend(run, this.now() + this.leaseMs).catch(() => {});\n },\n // Three chances a lease, however short the lease\n Math.max(50, this.leaseMs / 3)\n );\n const parts = this.options.open(run);\n try {\n let stop!: (how: Suspension | 'abandoned') => void;\n const stopped = new Promise<Suspension | 'abandoned'>((resolve) => {\n stop = resolve;\n });\n const step = new TurnStep(\n run,\n run.steps,\n this.runs,\n parts.store,\n run.params.userId,\n this.now,\n this.retry,\n stop\n );\n const end = await Promise.race([\n parts.execute(step).then(\n (outcome) => ({ outcome }),\n (error: unknown) => ({ error })\n ),\n stopped.then((how) => ({ how })),\n ]);\n\n if ('how' in end) {\n // Steps running beside the one that stopped the turn (a push to several devices) get\n // to their own checkpoints before the run is let go\n await step.settled();\n // The store failed under the turn: the caller hears of it, the lease runs out, and the\n // run is taken again\n if (step.fault !== undefined) throw step.fault.error;\n if (end.how === 'abandoned' || step.lost) return { instanceId, ended: 'abandoned' };\n await this.runs.suspend(run, end.how, this.now(), step.take());\n return { instanceId, ended: 'suspended', wakeAt: end.how.wakeAt };\n }\n if ('error' in end) {\n await this.runs.finish(run, 'errored', this.now(), messageOf(end.error), step.take());\n return { instanceId, ended: 'errored', error: end.error };\n }\n await this.runs.finish(run, 'complete', this.now(), undefined, step.take());\n return { instanceId, ended: 'complete', outcome: end.outcome };\n } finally {\n clearInterval(beat);\n await parts.close();\n }\n }\n\n /** Every run that is due now, one after another; what each turn came to. */\n async drain(limit = Number.POSITIVE_INFINITY): Promise<TurnResult[]> {\n const results: TurnResult[] = [];\n while (results.length < limit) {\n const result = await this.turn();\n if (result === undefined) break;\n results.push(result);\n }\n return results;\n }\n\n /** When the next run is due, if any is waiting on the clock. */\n nextWake(): Promise<number | undefined> {\n return this.runs.nextWake();\n }\n\n /** Remove the runs that ended more than `olderThanMs` ago. */\n prune(olderThanMs: number): Promise<number> {\n return this.runs.prune(this.now() - olderThanMs);\n }\n}\n"],"mappings":";;;;;AAiCA,MAAa,qBAAsC;CACjD,OAAO;CACP,SAAS;CACT,WAAW;AACb;;;;;;AAOA,MAAa,mBAAmB;;AAgChC,MAAM,cAA6B,IAAI,cAAiB,CAAC,CAAC;AAE1D,MAAM,aAAa,UACjB,iBAAiB,QAAQ,GAAG,MAAM,KAAK,IAAI,MAAM,YAAY,OAAO,KAAK;;;;;;;;AAS3E,IAAM,WAAN,MAAqC;CAmBhB;CACA;CACA;CACA;CACA;C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