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,373 @@
|
|
|
1
|
+
import { ChannelIR, ConditionIR, ScalarIR } from "../ir.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Engine ports: the only shape of the outside world the interpreter depends on.
|
|
4
|
+
*
|
|
5
|
+
* Design constraints (AWS-proof, see the engine design notes):
|
|
6
|
+
* - A wake-up is only a hint — "**at least one wake-up, re-evaluate after
|
|
7
|
+
* waking**". No event buffering or de-duplication is promised (Cloudflare
|
|
8
|
+
* buffers, AWS callback tokens do not — the port takes the intersection).
|
|
9
|
+
* The truth of a condition is always re-read by the caller once awake.
|
|
10
|
+
* - subscribe / waitForWake / unsubscribe are split so the caller can register
|
|
11
|
+
* interest *before* its first condition check — an event landing between the
|
|
12
|
+
* check and the registration would otherwise be missed until the timeout.
|
|
13
|
+
* - Every source of non-determinism (randomness, current time, external IO)
|
|
14
|
+
* must happen inside step.do, so its result is persisted and replay lines up.
|
|
15
|
+
*/
|
|
16
|
+
/** What the interpreter knows about a step that a runtime may use. */
|
|
17
|
+
export interface StepOptions {
|
|
18
|
+
/**
|
|
19
|
+
* The step is the engine's own bookkeeping: run again it does the same thing over, and what
|
|
20
|
+
* it returns does not decide where the journey goes. A runtime that writes its own
|
|
21
|
+
* checkpoints may hold this one back and write it with the next step's (one that is not
|
|
22
|
+
* marked), saving the round trip — if the process dies in between, the step simply runs
|
|
23
|
+
* again. Never set for anything whose result picks a branch, reads the clock for the journey,
|
|
24
|
+
* or reaches outside the engine's store: those are durable before the next step begins.
|
|
25
|
+
*/
|
|
26
|
+
idempotent?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface EngineStep {
|
|
29
|
+
/** Durable step: fn's return value is checkpointed; on replay the result is reused without re-running. */
|
|
30
|
+
do<T>(name: string, fn: () => Promise<T>, options?: StepOptions): Promise<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Durable sleep: suspended time is not billed. The only sleep primitive — a wait until an
|
|
33
|
+
* absolute instant is the interpreter checkpointing the remaining time, then sleeping it.
|
|
34
|
+
*/
|
|
35
|
+
sleep(name: string, ms: number): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Durable: register interest in the named events (Cloudflare: write the
|
|
38
|
+
* subscription table; AWS: create a callback and store its id). Must
|
|
39
|
+
* complete before the caller's condition check for that attempt.
|
|
40
|
+
*
|
|
41
|
+
* Contract: one subscribe arms **at least one** wake-up — adapters whose
|
|
42
|
+
* wake handle is one-shot (AWS durable-function callbacks are consumed on
|
|
43
|
+
* delivery) satisfy it with exactly one. Callers therefore re-subscribe on
|
|
44
|
+
* every wait attempt; adapters where registrations persist (Cloudflare rows)
|
|
45
|
+
* make the repeat call idempotent.
|
|
46
|
+
*
|
|
47
|
+
* `deadlineMs` is when the wait this arms gives up: an adapter whose wake handle carries its
|
|
48
|
+
* own timeout (an AWS callback) sets it here, where the handle is created. Others ignore it.
|
|
49
|
+
*/
|
|
50
|
+
subscribe(name: string, events: readonly string[], options?: {
|
|
51
|
+
deadlineMs?: number;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
/** Durable: drop every registration this instance holds. */
|
|
54
|
+
unsubscribe(name: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Wait for a wake-up or a timeout. A registration from `subscribe` must
|
|
57
|
+
* already exist — this call only parks the instance.
|
|
58
|
+
*
|
|
59
|
+
* Both numbers are checkpointed by the interpreter, so they are replay-stable: `timeoutMs`
|
|
60
|
+
* is how long this attempt may park (the remaining time when it was computed), `deadlineMs`
|
|
61
|
+
* the absolute instant the whole wait gives up. An adapter that learns of a timeout only by
|
|
62
|
+
* a thrown error (Cloudflare) decides against `deadlineMs` — the clock at the replay that
|
|
63
|
+
* first runs that decision is what matters, not when the park began; one whose wake handle
|
|
64
|
+
* carries its own timeout (AWS) set it from `deadlineMs` at subscribe and ignores both here.
|
|
65
|
+
*/
|
|
66
|
+
waitForWake(name: string, wait: {
|
|
67
|
+
timeoutMs: number;
|
|
68
|
+
deadlineMs: number;
|
|
69
|
+
}): Promise<'event' | 'timeout'>;
|
|
70
|
+
}
|
|
71
|
+
/** One device a push can go to: the provider token (APNs device token, FCM registration token) and the platform that picks the provider. */
|
|
72
|
+
export interface PushDevice {
|
|
73
|
+
token: string;
|
|
74
|
+
platform: string;
|
|
75
|
+
}
|
|
76
|
+
/** Facts from a single user's point of view: the read interface condition evaluation uses (the store-backed and in-memory sources share one evaluator). */
|
|
77
|
+
export interface FactSource {
|
|
78
|
+
/**
|
|
79
|
+
* How many times an event occurred. `sinceMs` bounds the window (within /
|
|
80
|
+
* anchoring); `where` is a payload-only condition tree — count only events
|
|
81
|
+
* whose payload matches (evaluate with matchesWhere from engine/condition).
|
|
82
|
+
* `atLeast` is the threshold the caller compares against: an implementation
|
|
83
|
+
* may stop counting there and return any number ≥ it, or ignore it and count
|
|
84
|
+
* them all.
|
|
85
|
+
*/
|
|
86
|
+
countEvents(event: string, opts?: {
|
|
87
|
+
sinceMs?: number;
|
|
88
|
+
untilMs?: number;
|
|
89
|
+
where?: ConditionIR;
|
|
90
|
+
atLeast?: number;
|
|
91
|
+
}): Promise<number>;
|
|
92
|
+
getProperty(path: string): Promise<ScalarIR | undefined>;
|
|
93
|
+
/** Resolve a segment definition by id (stored with the bundle at deploy time). */
|
|
94
|
+
getSegmentCondition(name: string): Promise<ConditionIR | undefined>;
|
|
95
|
+
/** The user's push devices, most recently registered first (empty when the user registered none). */
|
|
96
|
+
listDevices(): Promise<PushDevice[]>;
|
|
97
|
+
/**
|
|
98
|
+
* The user opted out of the channel (an email unsubscribe, a push opt-out in the app): nothing
|
|
99
|
+
* is sent there. With a `topic`, an opt-out of that topic on the channel counts too; without
|
|
100
|
+
* one, only the channel-wide opt-out.
|
|
101
|
+
*/
|
|
102
|
+
isSuppressed?(channel: ChannelIR, topic?: string): Promise<boolean>;
|
|
103
|
+
}
|
|
104
|
+
export interface OutboundMessage {
|
|
105
|
+
/** Where the copy comes from: the workflow, its instance and the message node. */
|
|
106
|
+
workflow: string;
|
|
107
|
+
instanceId: string;
|
|
108
|
+
nodeId: string;
|
|
109
|
+
channel: ChannelIR;
|
|
110
|
+
template: string;
|
|
111
|
+
/** Already resolved: user_property references have been replaced by actual values. */
|
|
112
|
+
props: Record<string, ScalarIR | undefined>;
|
|
113
|
+
userId: string;
|
|
114
|
+
/**
|
|
115
|
+
* The channel's recipient address, resolved by the engine — so senders never
|
|
116
|
+
* read the database: a profile property for most channels, the device token
|
|
117
|
+
* for push (one message per device).
|
|
118
|
+
*/
|
|
119
|
+
recipient?: string | undefined;
|
|
120
|
+
/** Push only: the device this copy goes to — its platform picks the provider. */
|
|
121
|
+
device?: PushDevice | undefined;
|
|
122
|
+
/** Email and push: the template's subscription topic, null for a transactional message (absent for other channels). */
|
|
123
|
+
topic?: string | null | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* `${instanceId}:${nodeId}` (plus `:${token}` for a push copy) — one per copy, stable across
|
|
126
|
+
* replays and retries. The engine skips a copy the observer reports settled
|
|
127
|
+
* (`messageSettled`) or claimed by an earlier run (`messageClaimed`: handed to the transport,
|
|
128
|
+
* outcome unknown — see `redelivery`). The providers do not de-duplicate on it: APNs (collapse
|
|
129
|
+
* id) and Web Push (`Topic`) collapse a repeat on the device, SES and Cloudflare Email Service
|
|
130
|
+
* (binding and REST API alike) accept no idempotency key at all. It is also the copy's
|
|
131
|
+
* identity for tracking: a push carries it in its payload, so the app can report the tap.
|
|
132
|
+
*/
|
|
133
|
+
idempotencyKey: string;
|
|
134
|
+
/**
|
|
135
|
+
* What a replayed send step does with a copy an earlier run claimed but never settled (the
|
|
136
|
+
* transport may or may not have taken it): `'skip'` (the default, and absent) treats it as
|
|
137
|
+
* delivered and skips it — at-most-once; `'resend'` sends it again — at-least-once. Set from
|
|
138
|
+
* the template's `redelivery` option.
|
|
139
|
+
*/
|
|
140
|
+
redelivery?: 'skip' | 'resend' | undefined;
|
|
141
|
+
/** What the host's observer asked the sender to add for measuring this copy (see `MessageTracking`). */
|
|
142
|
+
tracking?: MessageTracking | undefined;
|
|
143
|
+
}
|
|
144
|
+
/** What following a tracked email link does: redirect to it, or confirm an unsubscribe. */
|
|
145
|
+
export type LinkPurpose = 'link' | 'unsubscribe';
|
|
146
|
+
/**
|
|
147
|
+
* Measuring a copy, as the built-in senders apply it: an email's links are routed through
|
|
148
|
+
* `link` and `pixel` is appended as a 1×1 image; a push carries `data` in its payload.
|
|
149
|
+
* Each is optional, and a sender ignores what its channel has no use for.
|
|
150
|
+
*/
|
|
151
|
+
export interface MessageTracking {
|
|
152
|
+
/**
|
|
153
|
+
* The copy's id in the reporting tables: what its tracking URLs name, and what an email's
|
|
154
|
+
* preferences link carries (`email.preferencesUrl`), so the app's page can read the recipient's
|
|
155
|
+
* subscriptions by it. The email sender hands it to the renderer.
|
|
156
|
+
*/
|
|
157
|
+
messageId?: string;
|
|
158
|
+
/**
|
|
159
|
+
* The original `http(s)` URL in, the URL that records the click and redirects out — or, for the
|
|
160
|
+
* email's unsubscribe link, asks the recipient to confirm.
|
|
161
|
+
*/
|
|
162
|
+
link?: (url: string, purpose: LinkPurpose) => string;
|
|
163
|
+
/** Loaded when the email is opened. */
|
|
164
|
+
pixel?: string;
|
|
165
|
+
/**
|
|
166
|
+
* This copy's one-click unsubscribe endpoint (RFC 8058): a POST there, with no confirmation
|
|
167
|
+
* and no session, unsubscribes the recipient. The email sender puts it in the
|
|
168
|
+
* `List-Unsubscribe` header, so a mail client's own unsubscribe button works.
|
|
169
|
+
*/
|
|
170
|
+
unsubscribe?: string;
|
|
171
|
+
/** Extra string keys in the push payload. */
|
|
172
|
+
data?: Record<string, string>;
|
|
173
|
+
/**
|
|
174
|
+
* Called by the sender once the links are rewritten and before the transport takes the copy:
|
|
175
|
+
* what the tracking URLs resolve to is stored before anyone can click one. A throw stops the
|
|
176
|
+
* send, and the step retries it.
|
|
177
|
+
*/
|
|
178
|
+
commit?: () => Promise<void>;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* How a copy ended at the transport. A sender returns nothing when the transport accepted it;
|
|
182
|
+
* `{ delivered: false }` when it settled the copy without delivering — a dead push token, which
|
|
183
|
+
* is not retried. A transient failure throws instead, and the step retries.
|
|
184
|
+
*/
|
|
185
|
+
export interface SendResult {
|
|
186
|
+
delivered: false;
|
|
187
|
+
reason: string;
|
|
188
|
+
}
|
|
189
|
+
export interface MessageSender {
|
|
190
|
+
send(message: OutboundMessage): Promise<void | SendResult>;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* What the host learns about each journey as it runs, for reporting: where every instance
|
|
194
|
+
* stands, every copy it sends and how the transport took it, and how it ended. Storage is the
|
|
195
|
+
* host's — the engine only reports. Every method is optional and must be idempotent: a step
|
|
196
|
+
* that fails after its report ran is retried and reports again (keyed by the instance and node,
|
|
197
|
+
* or the copy's idempotency key).
|
|
198
|
+
*
|
|
199
|
+
* Three of them decide whether a copy reaches the transport (`messageSettled`, `messageClaimed`,
|
|
200
|
+
* `messageReleased`): an observer that implements none of them leaves the engine with the step
|
|
201
|
+
* alone, and a step replayed after a lost checkpoint sends again. Implement all three or none.
|
|
202
|
+
*/
|
|
203
|
+
export interface JourneyObserver {
|
|
204
|
+
/** The instance entered, before its entry guards: `at` is the trigger's time, the entry anchor. */
|
|
205
|
+
started?(event: {
|
|
206
|
+
workflow: string;
|
|
207
|
+
instanceId: string;
|
|
208
|
+
userId: string;
|
|
209
|
+
at: number;
|
|
210
|
+
}): Promise<void>;
|
|
211
|
+
/** The instance reached a node: it sits there until the next one (a delay, a wait), or passes through. */
|
|
212
|
+
nodeReached?(event: {
|
|
213
|
+
workflow: string;
|
|
214
|
+
instanceId: string;
|
|
215
|
+
userId: string;
|
|
216
|
+
nodeId: string;
|
|
217
|
+
at: number;
|
|
218
|
+
}): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Whether this copy (its idempotency key) was already settled — sent, or settled undelivered —
|
|
221
|
+
* by an earlier run of the same step. The send and its report sit inside one durable step, so
|
|
222
|
+
* an instance that crashes after both but before the step's checkpoint replays the step; a
|
|
223
|
+
* settled copy is then skipped instead of reaching the transport a second time. The window
|
|
224
|
+
* between the transport taking the copy and the settle is `messageClaimed`'s.
|
|
225
|
+
*/
|
|
226
|
+
messageSettled?(message: OutboundMessage): Promise<boolean>;
|
|
227
|
+
/** A copy is about to go out; the tracking returned travels with it to the sender. */
|
|
228
|
+
messagePrepared?(message: OutboundMessage): Promise<MessageTracking | undefined>;
|
|
229
|
+
/**
|
|
230
|
+
* The copy is being handed to the transport: record the claim, committed before the send, and
|
|
231
|
+
* answer whether this run made it (true) or an earlier run of the same step already held it
|
|
232
|
+
* (false). A claim without a settle means the earlier run died between the transport and its
|
|
233
|
+
* report, and the copy may have gone out: the engine does not send it again unless the
|
|
234
|
+
* template says `redelivery: 'resend'` (see `OutboundMessage.redelivery`). Must be atomic —
|
|
235
|
+
* two runs of the step cannot both be told true.
|
|
236
|
+
*/
|
|
237
|
+
messageClaimed?(message: OutboundMessage): Promise<boolean>;
|
|
238
|
+
/**
|
|
239
|
+
* The transport threw, so the copy did not go out: release the claim, and the step's retry
|
|
240
|
+
* sends it. Called only after `messageClaimed` answered true in the same run.
|
|
241
|
+
*/
|
|
242
|
+
messageReleased?(message: OutboundMessage): Promise<void>;
|
|
243
|
+
/** The transport took the copy (`delivered: true`), or settled it undelivered; a thrown send is not reported. */
|
|
244
|
+
messageSent?(message: OutboundMessage, result: {
|
|
245
|
+
delivered: true;
|
|
246
|
+
} | SendResult): Promise<void>;
|
|
247
|
+
/** The instance ended: its outcome (`goal` is a conversion), or `failed` when an error ended it. */
|
|
248
|
+
finished?(event: {
|
|
249
|
+
workflow: string;
|
|
250
|
+
instanceId: string;
|
|
251
|
+
userId: string;
|
|
252
|
+
status: JourneyOutcome['status'] | 'failed';
|
|
253
|
+
at: number;
|
|
254
|
+
/** When it converted, if it did — set whatever the status (see JourneyOutcome). */
|
|
255
|
+
convertedAt?: number;
|
|
256
|
+
}): Promise<void>;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Message preparation: checks a message's resolved props against its template
|
|
260
|
+
* before any sender sees it (and, for a push, before the first device), and
|
|
261
|
+
* returns the props to send — the parsed value. Throwing stops the send; the
|
|
262
|
+
* interpreter adds the instance and node to the error. The Cloudflare host
|
|
263
|
+
* assembles one from the template registries (`registryValidator`).
|
|
264
|
+
*/
|
|
265
|
+
export interface MessageValidator {
|
|
266
|
+
validate(message: {
|
|
267
|
+
channel: ChannelIR;
|
|
268
|
+
template: string;
|
|
269
|
+
props: Record<string, ScalarIR | undefined>;
|
|
270
|
+
}): Record<string, ScalarIR | undefined>;
|
|
271
|
+
/**
|
|
272
|
+
* What the registered template says about itself now: its subscription `topic` (null:
|
|
273
|
+
* transactional) and whether it opts into resending. Undefined for a template or a channel the
|
|
274
|
+
* registry does not hold. The node carries both as they were when its workflow was compiled,
|
|
275
|
+
* but a journey sends the template as it is today, and the opt-out a send checks has to be the
|
|
276
|
+
* one the copy is rendered with and recorded under. Without this the node's own values stand.
|
|
277
|
+
*/
|
|
278
|
+
describe?(message: {
|
|
279
|
+
channel: ChannelIR;
|
|
280
|
+
template: string;
|
|
281
|
+
}): MessagePolicy | undefined;
|
|
282
|
+
}
|
|
283
|
+
/** A message's opt-out topic and redelivery policy, as its template declares them. */
|
|
284
|
+
export interface MessagePolicy {
|
|
285
|
+
/** The subscription topic; null for a transactional message; absent for a channel without topics. */
|
|
286
|
+
topic?: string | null;
|
|
287
|
+
redelivery?: 'resend';
|
|
288
|
+
}
|
|
289
|
+
/** send_event's outlet: feeds back into ingest (the event edge between workflows). */
|
|
290
|
+
export interface EventSink {
|
|
291
|
+
/**
|
|
292
|
+
* `id` identifies the occurrence, and sending the same one twice must record
|
|
293
|
+
* it once. The interpreter passes `${instanceId}:${nodeId}` — the same
|
|
294
|
+
* identity senders and actions de-duplicate on — because the emit is wrapped
|
|
295
|
+
* in a step, and a step body is retried after a failure that may have
|
|
296
|
+
* happened *after* the event was already written.
|
|
297
|
+
*/
|
|
298
|
+
emit(event: string, payload: Record<string, ScalarIR | undefined>, id: string): Promise<void>;
|
|
299
|
+
}
|
|
300
|
+
/** One action node's resolved call, ready for the registry. */
|
|
301
|
+
export interface ActionInvocation {
|
|
302
|
+
/** Registry name; the code itself lives in the deployed bundle (dual-plane model, see dsl/action.ts). */
|
|
303
|
+
action: string;
|
|
304
|
+
/** Already resolved: user_property references have been replaced by actual values (same contract as message props). */
|
|
305
|
+
args: Record<string, ScalarIR | undefined>;
|
|
306
|
+
userId: string;
|
|
307
|
+
/** `${instanceId}:${nodeId}` — handlers with external side effects de-duplicate on it, like senders do. */
|
|
308
|
+
idempotencyKey: string;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Custom-action outlet. The interpreter already wraps the call in step.do, so
|
|
312
|
+
* an implementation may just look up and run the handler — a throw is retried
|
|
313
|
+
* by the runtime, a success is checkpointed.
|
|
314
|
+
*/
|
|
315
|
+
export interface ActionInvoker {
|
|
316
|
+
invoke(invocation: ActionInvocation): Promise<void>;
|
|
317
|
+
}
|
|
318
|
+
export interface JourneyContext {
|
|
319
|
+
userId: string;
|
|
320
|
+
/** Instance identity: feeds the idempotency key and the logs. */
|
|
321
|
+
instanceId: string;
|
|
322
|
+
/**
|
|
323
|
+
* When the user entered the workflow (ms epoch) — the baseline for the
|
|
324
|
+
* goal's attribution window (`goal.within`). Must be replay-stable: the
|
|
325
|
+
* adapter derives it from the trigger event's timestamp, never from
|
|
326
|
+
* Date.now() at run time.
|
|
327
|
+
*/
|
|
328
|
+
enteredAtMs: number;
|
|
329
|
+
/**
|
|
330
|
+
* The event that started the instance and when it happened, for an instance an event
|
|
331
|
+
* started: the goal does not count that occurrence as its own conversion.
|
|
332
|
+
*/
|
|
333
|
+
trigger?: {
|
|
334
|
+
event: string;
|
|
335
|
+
ts: number;
|
|
336
|
+
} | undefined;
|
|
337
|
+
/**
|
|
338
|
+
* The payload of the event that started the instance, as it entered: what `trigger_payload`
|
|
339
|
+
* references and predicates read. Must be replay-stable — the adapter hands over the
|
|
340
|
+
* instance's own params, never a fresh read of the event log.
|
|
341
|
+
*/
|
|
342
|
+
triggerPayload?: Record<string, unknown> | undefined;
|
|
343
|
+
/** Who the instance belongs to now, for one that can change hands; `userId` otherwise. */
|
|
344
|
+
currentUserId?: (() => Promise<string>) | undefined;
|
|
345
|
+
step: EngineStep;
|
|
346
|
+
facts: FactSource;
|
|
347
|
+
messages: MessageSender;
|
|
348
|
+
events: EventSink;
|
|
349
|
+
/** Optional: only journeys whose IR contains action nodes need one; running such a node without it is a runtime error. */
|
|
350
|
+
actions?: ActionInvoker | undefined;
|
|
351
|
+
/** Template props validation before every send; without one, props go out as resolved. */
|
|
352
|
+
validator?: MessageValidator | undefined;
|
|
353
|
+
/** Reporting hooks (positions and copies); without one, nothing is reported. */
|
|
354
|
+
observer?: JourneyObserver | undefined;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* How an instance ended, and — apart from that — whether and when it converted: `goal` ends it
|
|
358
|
+
* at the conversion, while with `exitOnMatch: false` a converted instance ends like any other
|
|
359
|
+
* and only `convertedAt` tells.
|
|
360
|
+
*/
|
|
361
|
+
export type JourneyOutcome = ({
|
|
362
|
+
status: 'completed';
|
|
363
|
+
} | {
|
|
364
|
+
status: 'exited';
|
|
365
|
+
reason?: string;
|
|
366
|
+
} | {
|
|
367
|
+
status: 'goal';
|
|
368
|
+
} | {
|
|
369
|
+
status: 'exit_when';
|
|
370
|
+
}) & {
|
|
371
|
+
convertedAt?: number;
|
|
372
|
+
};
|
|
373
|
+
//# sourceMappingURL=ports.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports.d.mts","names":[],"sources":["../../src/engine/ports.ts"],"mappings":";;;;;;;;;;;;;;;;iBAkBiB;;;;;;;;;EASf;;iBAGe;;EAEf,GAAG,GAAG,cAAc,UAAU,QAAQ,IAAI,UAAU,cAAc,QAAQ;;;;;EAM1E,MAAM,cAAc,aAAa;;;;;;;;;;;;;;;EAgBjC,UACE,cACA,2BACA;IAAY;MACX;;EAGH,YAAY,eAAe;;;;;;;;;;;;EAa3B,YACE,cACA;IAAQ;IAAmB;MAC1B;;;iBAIY;EACf;EACA;;;iBAIe;;;;;;;;;EASf,YACE,eACA;IAAS;IAAkB;IAAkB,QAAQ;IAAa;MACjE;EACH,YAAY,eAAe,QAAQ;;EAEnC,oBAAoB,eAAe,QAAQ;;EAE3C,eAAe,QAAQ;;;;;;EAMvB,cAAc,SAAS,WAAW,iBAAiB;;iBAGpC;;EAEf;EACA;EACA;EACA,SAAS;EACT;;EAEA,OAAO,eAAe;EACtB;;;;;;EAMA;;EAEA,SAAS;;EAET;;;;;;;;;;EAUA;;;;;;;EAOA;;EAEA,WAAW;;;YAID;;;;;;iBAOK;;;;;;EAMf;;;;;EAKA,QAAQ,aAAa,SAAS;;EAE9B;;;;;;EAMA;;EAEA,OAAO;;;;;;EAMP,eAAe;;;;;;;iBAQA;EACf;EACA;;iBAGe;EACf,KAAK,SAAS,kBAAkB,eAAe;;;;;;;;;;;;;iBAchC;;EAEf,SAAS;IACP;IACA;IACA;IACA;MACE;;EAEJ,aAAa;IACX;IACA;IACA;IACA;IACA;MACE;;;;;;;;EAQJ,gBAAgB,SAAS,kBAAkB;;EAE3C,iBAAiB,SAAS,kBAAkB,QAAQ;;;;;;;;;EASpD,gBAAgB,SAAS,kBAAkB;;;;;EAK3C,iBAAiB,SAAS,kBAAkB;;EAE5C,aAAa,SAAS,iBAAiB;IAAU;MAAoB,aAAa;;EAElF,UAAU;IACR;IACA;IACA;IACA,QAAQ;IACR;;IAEA;MACE;;;;;;;;;iBAUW;EACf,SAAS;IACP,SAAS;IACT;IACA,OAAO,eAAe;MACpB,eAAe;;;;;;;;EAQnB,UAAU;IAAW,SAAS;IAAW;MAAqB;;;iBAI/C;;EAEf;EACA;;;iBAIe;;;;;;;;EAQf,KAAK,eAAe,SAAS,eAAe,uBAAuB,aAAa;;;iBAIjE;;EAEf;;EAEA,MAAM,eAAe;EACrB;;EAEA;;;;;;;iBAQe;EACf,OAAO,YAAY,mBAAmB;;iBAGvB;EACf;;EAEA;;;;;;;EAOA;;;;;EAKA;IAAY;IAAe;;;;;;;EAM3B,iBAAiB;;EAEjB,uBAAuB;EACvB,MAAM;EACN,OAAO;EACP,UAAU;EACV,QAAQ;;EAER,UAAU;;EAEV,YAAY;;EAEZ,WAAW;;;;;;;YAQD;EACN;;EACA;EAAkB;;EAClB;;EACA;;EACA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
// src/engine/recipient.ts
|
|
3
|
+
/**
|
|
4
|
+
* Channel → the user property holding its recipient address. The engine
|
|
5
|
+
* resolves it before sending, which keeps senders stateless. Push is absent on
|
|
6
|
+
* purpose: its recipients are devices, kept in the store. Slack and Discord post to a team
|
|
7
|
+
* channel through the template's webhook, so they have no per-user address either.
|
|
8
|
+
* TODO: let the app override this table (today it is a convention, with
|
|
9
|
+
* UserPropertyBase guaranteeing `email` exists).
|
|
10
|
+
*/
|
|
11
|
+
const RECIPIENT_PROPERTY = {
|
|
12
|
+
email: "email",
|
|
13
|
+
sms: "phone",
|
|
14
|
+
push: void 0,
|
|
15
|
+
slack: void 0,
|
|
16
|
+
discord: void 0,
|
|
17
|
+
survey: "email",
|
|
18
|
+
in_app: void 0
|
|
19
|
+
};
|
|
20
|
+
exports.RECIPIENT_PROPERTY = RECIPIENT_PROPERTY;
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=recipient.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipient.cjs","names":[],"sources":["../../src/engine/recipient.ts"],"sourcesContent":["import type { ChannelIR } from '../ir';\n\n/**\n * Channel → the user property holding its recipient address. The engine\n * resolves it before sending, which keeps senders stateless. Push is absent on\n * purpose: its recipients are devices, kept in the store. Slack and Discord post to a team\n * channel through the template's webhook, so they have no per-user address either.\n * TODO: let the app override this table (today it is a convention, with\n * UserPropertyBase guaranteeing `email` exists).\n */\nexport const RECIPIENT_PROPERTY: Record<ChannelIR, string | undefined> = {\n email: 'email',\n sms: 'phone',\n push: undefined,\n slack: undefined,\n discord: undefined,\n survey: 'email',\n in_app: undefined,\n};\n"],"mappings":";;;;;;;;;;AAUA,MAAa,qBAA4D;CACvE,OAAO;CACP,KAAK;CACL,MAAM,KAAA;CACN,OAAO,KAAA;CACP,SAAS,KAAA;CACT,QAAQ;CACR,QAAQ,KAAA;AACV"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChannelIR } from "../ir.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Channel → the user property holding its recipient address. The engine
|
|
4
|
+
* resolves it before sending, which keeps senders stateless. Push is absent on
|
|
5
|
+
* purpose: its recipients are devices, kept in the store. Slack and Discord post to a team
|
|
6
|
+
* channel through the template's webhook, so they have no per-user address either.
|
|
7
|
+
* TODO: let the app override this table (today it is a convention, with
|
|
8
|
+
* UserPropertyBase guaranteeing `email` exists).
|
|
9
|
+
*/
|
|
10
|
+
export declare const RECIPIENT_PROPERTY: Record<ChannelIR, string | undefined>;
|
|
11
|
+
//# sourceMappingURL=recipient.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipient.d.cts","names":[],"sources":["../../src/engine/recipient.ts"],"mappings":";;;;;;;;;qBAUa,oBAAoB,OAAO"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChannelIR } from "../ir.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Channel → the user property holding its recipient address. The engine
|
|
4
|
+
* resolves it before sending, which keeps senders stateless. Push is absent on
|
|
5
|
+
* purpose: its recipients are devices, kept in the store. Slack and Discord post to a team
|
|
6
|
+
* channel through the template's webhook, so they have no per-user address either.
|
|
7
|
+
* TODO: let the app override this table (today it is a convention, with
|
|
8
|
+
* UserPropertyBase guaranteeing `email` exists).
|
|
9
|
+
*/
|
|
10
|
+
export declare const RECIPIENT_PROPERTY: Record<ChannelIR, string | undefined>;
|
|
11
|
+
//# sourceMappingURL=recipient.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipient.d.mts","names":[],"sources":["../../src/engine/recipient.ts"],"mappings":";;;;;;;;;qBAUa,oBAAoB,OAAO"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/engine/recipient.ts
|
|
2
|
+
/**
|
|
3
|
+
* Channel → the user property holding its recipient address. The engine
|
|
4
|
+
* resolves it before sending, which keeps senders stateless. Push is absent on
|
|
5
|
+
* purpose: its recipients are devices, kept in the store. Slack and Discord post to a team
|
|
6
|
+
* channel through the template's webhook, so they have no per-user address either.
|
|
7
|
+
* TODO: let the app override this table (today it is a convention, with
|
|
8
|
+
* UserPropertyBase guaranteeing `email` exists).
|
|
9
|
+
*/
|
|
10
|
+
const RECIPIENT_PROPERTY = {
|
|
11
|
+
email: "email",
|
|
12
|
+
sms: "phone",
|
|
13
|
+
push: void 0,
|
|
14
|
+
slack: void 0,
|
|
15
|
+
discord: void 0,
|
|
16
|
+
survey: "email",
|
|
17
|
+
in_app: void 0
|
|
18
|
+
};
|
|
19
|
+
export { RECIPIENT_PROPERTY };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=recipient.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipient.mjs","names":[],"sources":["../../src/engine/recipient.ts"],"sourcesContent":["import type { ChannelIR } from '../ir';\n\n/**\n * Channel → the user property holding its recipient address. The engine\n * resolves it before sending, which keeps senders stateless. Push is absent on\n * purpose: its recipients are devices, kept in the store. Slack and Discord post to a team\n * channel through the template's webhook, so they have no per-user address either.\n * TODO: let the app override this table (today it is a convention, with\n * UserPropertyBase guaranteeing `email` exists).\n */\nexport const RECIPIENT_PROPERTY: Record<ChannelIR, string | undefined> = {\n email: 'email',\n sms: 'phone',\n push: undefined,\n slack: undefined,\n discord: undefined,\n survey: 'email',\n in_app: undefined,\n};\n"],"mappings":";;;;;;;;;AAUA,MAAa,qBAA4D;CACvE,OAAO;CACP,KAAK;CACL,MAAM,KAAA;CACN,OAAO,KAAA;CACP,SAAS,KAAA;CACT,QAAQ;CACR,QAAQ,KAAA;AACV"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
// src/engine/retry.ts
|
|
3
|
+
/**
|
|
4
|
+
* Which step failures a retry would only repeat. A durable step retries what it throws; an
|
|
5
|
+
* error that is the same on every attempt — a template refusing its props, the contract
|
|
6
|
+
* refusing an emitted event, a provider rejecting the request itself — ends the step at once
|
|
7
|
+
* instead of burning the retry budget and delaying the journey. Every runtime adapter asks this
|
|
8
|
+
* one rule.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* A failure a retry would only repeat: a missing or malformed configuration, a provider refusing
|
|
12
|
+
* the request itself, an input the runtime cannot act on. Thrown inside a durable step, it ends
|
|
13
|
+
* the step at once (`isRetryable` is false) instead of burning the retry budget.
|
|
14
|
+
*
|
|
15
|
+
* Thrown by a message sender, it is a refusal of that one copy: `deliver` settles the copy as
|
|
16
|
+
* undelivered under `reason` — the provider's own code where it gave one (`BadTopic`,
|
|
17
|
+
* `THIRD_PARTY_AUTH_ERROR`, `PayloadTooLarge`) — and the journey goes on.
|
|
18
|
+
*/
|
|
19
|
+
var PermanentError = class extends Error {
|
|
20
|
+
name = "PermanentError";
|
|
21
|
+
retryable = false;
|
|
22
|
+
/** Short and stable, for the delivery report: a code, not a sentence. */
|
|
23
|
+
reason;
|
|
24
|
+
constructor(message, options) {
|
|
25
|
+
super(message, options);
|
|
26
|
+
if (options?.reason !== void 0 && options.reason !== "") this.reason = options.reason;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The reason a refused copy settles under: the error's own `reason` when it carries one (told by
|
|
31
|
+
* the property, so a transport of the host's own can name it without importing a class), else
|
|
32
|
+
* `refused`.
|
|
33
|
+
*/
|
|
34
|
+
function refusalReason(error) {
|
|
35
|
+
const reason = error?.reason;
|
|
36
|
+
return typeof reason === "string" && reason !== "" ? reason : "refused";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A send the provider never answered: the request went out (or may have) and no response came
|
|
40
|
+
* back — the connection dropped, the fetch timed out. Whether the provider took the message is
|
|
41
|
+
* not known, and a provider that cannot de-duplicate (SES, Cloudflare Email, FCM, a Slack or
|
|
42
|
+
* Discord webhook) would deliver a second attempt as a second message. So this is not the
|
|
43
|
+
* "refused for sure" a thrown send otherwise means: `deliver` keeps the copy's claim and, unless
|
|
44
|
+
* its template is `redelivery: 'resend'`, settles it as undelivered (`no_answer`) rather than
|
|
45
|
+
* sending again.
|
|
46
|
+
*
|
|
47
|
+
* Told by the `unanswered` property, not `instanceof`, so a transport of the host's own can
|
|
48
|
+
* raise one without importing this class.
|
|
49
|
+
*/
|
|
50
|
+
var UnansweredSendError = class extends Error {
|
|
51
|
+
name = "UnansweredSendError";
|
|
52
|
+
unanswered = true;
|
|
53
|
+
constructor(message, options) {
|
|
54
|
+
super(message, options);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
function isUnanswered(error) {
|
|
58
|
+
return error instanceof Error && error.unanswered === true;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The one request of a send that hands the message to the provider, and nothing else: whatever
|
|
62
|
+
* it throws becomes an `UnansweredSendError`. Everything a sender does before it (rendering,
|
|
63
|
+
* signing, fetching a token) stays outside, where a throw still means the message did not go.
|
|
64
|
+
*/
|
|
65
|
+
async function awaitAnswer(what, request) {
|
|
66
|
+
try {
|
|
67
|
+
return await request();
|
|
68
|
+
} catch (cause) {
|
|
69
|
+
throw new UnansweredSendError(`${what}: no answer (${cause instanceof Error ? cause.message : String(cause)})`, { cause });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** Errors the engine raises that are deterministic by construction. */
|
|
73
|
+
const DETERMINISTIC = /* @__PURE__ */ new Set(["TemplateValidationError", "ContractValidationError"]);
|
|
74
|
+
/**
|
|
75
|
+
* False for an error a retry cannot fix: one of the engine's deterministic refusals, or any
|
|
76
|
+
* error that says so with `retryable: false` (the transports' 4xx answers).
|
|
77
|
+
*/
|
|
78
|
+
function isRetryable(error) {
|
|
79
|
+
if (!(error instanceof Error)) return true;
|
|
80
|
+
if (DETERMINISTIC.has(error.name)) return false;
|
|
81
|
+
return error.retryable !== false;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A send refused for good, the copy `deliver` settles instead of failing the step: an error that
|
|
85
|
+
* says `retryable: false` — a provider's answer, a channel that is not configured. Not the
|
|
86
|
+
* engine's own refusals, which are told by name: a template refusing its props or its content is
|
|
87
|
+
* the workflow, not the recipient, and an erased user ends the journey; both still fail the step.
|
|
88
|
+
*/
|
|
89
|
+
function isRefusedSend(error) {
|
|
90
|
+
if (!(error instanceof Error) || isRetryable(error)) return false;
|
|
91
|
+
return !DETERMINISTIC.has(error.name) && error.name !== "UserErasedError";
|
|
92
|
+
}
|
|
93
|
+
/** An HTTP answer a retry can change: a timeout, throttling, or the provider's own fault. */
|
|
94
|
+
function isRetryableStatus(status) {
|
|
95
|
+
return status === 408 || status === 429 || status >= 500;
|
|
96
|
+
}
|
|
97
|
+
exports.PermanentError = PermanentError;
|
|
98
|
+
exports.UnansweredSendError = UnansweredSendError;
|
|
99
|
+
exports.awaitAnswer = awaitAnswer;
|
|
100
|
+
exports.isRefusedSend = isRefusedSend;
|
|
101
|
+
exports.isRetryable = isRetryable;
|
|
102
|
+
exports.isRetryableStatus = isRetryableStatus;
|
|
103
|
+
exports.isUnanswered = isUnanswered;
|
|
104
|
+
exports.refusalReason = refusalReason;
|
|
105
|
+
|
|
106
|
+
//# sourceMappingURL=retry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.cjs","names":[],"sources":["../../src/engine/retry.ts"],"sourcesContent":["/**\n * Which step failures a retry would only repeat. A durable step retries what it throws; an\n * error that is the same on every attempt — a template refusing its props, the contract\n * refusing an emitted event, a provider rejecting the request itself — ends the step at once\n * instead of burning the retry budget and delaying the journey. Every runtime adapter asks this\n * one rule.\n */\n\n/**\n * A failure a retry would only repeat: a missing or malformed configuration, a provider refusing\n * the request itself, an input the runtime cannot act on. Thrown inside a durable step, it ends\n * the step at once (`isRetryable` is false) instead of burning the retry budget.\n *\n * Thrown by a message sender, it is a refusal of that one copy: `deliver` settles the copy as\n * undelivered under `reason` — the provider's own code where it gave one (`BadTopic`,\n * `THIRD_PARTY_AUTH_ERROR`, `PayloadTooLarge`) — and the journey goes on.\n */\nexport class PermanentError extends Error {\n override readonly name: string = 'PermanentError';\n readonly retryable = false;\n /** Short and stable, for the delivery report: a code, not a sentence. */\n readonly reason?: string;\n constructor(message: string, options?: { cause?: unknown; reason?: string }) {\n super(message, options);\n if (options?.reason !== undefined && options.reason !== '') this.reason = options.reason;\n }\n}\n\n/**\n * The reason a refused copy settles under: the error's own `reason` when it carries one (told by\n * the property, so a transport of the host's own can name it without importing a class), else\n * `refused`.\n */\nexport function refusalReason(error: unknown): string {\n const reason = (error as { reason?: unknown } | null)?.reason;\n return typeof reason === 'string' && reason !== '' ? reason : 'refused';\n}\n\n/**\n * A send the provider never answered: the request went out (or may have) and no response came\n * back — the connection dropped, the fetch timed out. Whether the provider took the message is\n * not known, and a provider that cannot de-duplicate (SES, Cloudflare Email, FCM, a Slack or\n * Discord webhook) would deliver a second attempt as a second message. So this is not the\n * \"refused for sure\" a thrown send otherwise means: `deliver` keeps the copy's claim and, unless\n * its template is `redelivery: 'resend'`, settles it as undelivered (`no_answer`) rather than\n * sending again.\n *\n * Told by the `unanswered` property, not `instanceof`, so a transport of the host's own can\n * raise one without importing this class.\n */\nexport class UnansweredSendError extends Error {\n override readonly name: string = 'UnansweredSendError';\n readonly unanswered = true;\n constructor(message: string, options?: { cause?: unknown }) {\n super(message, options);\n }\n}\n\nexport function isUnanswered(error: unknown): boolean {\n return error instanceof Error && (error as { unanswered?: unknown }).unanswered === true;\n}\n\n/**\n * The one request of a send that hands the message to the provider, and nothing else: whatever\n * it throws becomes an `UnansweredSendError`. Everything a sender does before it (rendering,\n * signing, fetching a token) stays outside, where a throw still means the message did not go.\n */\nexport async function awaitAnswer<T>(what: string, request: () => Promise<T>): Promise<T> {\n try {\n return await request();\n } catch (cause) {\n const said = cause instanceof Error ? cause.message : String(cause);\n throw new UnansweredSendError(`${what}: no answer (${said})`, { cause });\n }\n}\n\n/** Errors the engine raises that are deterministic by construction. */\nconst DETERMINISTIC = new Set(['TemplateValidationError', 'ContractValidationError']);\n\n/**\n * False for an error a retry cannot fix: one of the engine's deterministic refusals, or any\n * error that says so with `retryable: false` (the transports' 4xx answers).\n */\nexport function isRetryable(error: unknown): boolean {\n if (!(error instanceof Error)) return true;\n if (DETERMINISTIC.has(error.name)) return false;\n return (error as { retryable?: unknown }).retryable !== false;\n}\n\n/**\n * A send refused for good, the copy `deliver` settles instead of failing the step: an error that\n * says `retryable: false` — a provider's answer, a channel that is not configured. Not the\n * engine's own refusals, which are told by name: a template refusing its props or its content is\n * the workflow, not the recipient, and an erased user ends the journey; both still fail the step.\n */\nexport function isRefusedSend(error: unknown): boolean {\n if (!(error instanceof Error) || isRetryable(error)) return false;\n return !DETERMINISTIC.has(error.name) && error.name !== 'UserErasedError';\n}\n\n/** An HTTP answer a retry can change: a timeout, throttling, or the provider's own fault. */\nexport function isRetryableStatus(status: number): boolean {\n return status === 408 || status === 429 || status >= 500;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,IAAa,iBAAb,cAAoC,MAAM;CACtB,OAAe;CACxB,YAAY;;CAEZ;CACT,YAAY,SAAiB,SAAgD;EAC3E,MAAM,SAAS,OAAO;EACtB,IAAI,SAAS,WAAW,KAAA,KAAa,QAAQ,WAAW,IAAI,KAAK,SAAS,QAAQ;CACpF;AACF;;;;;;AAOA,SAAgB,cAAc,OAAwB;CACpD,MAAM,SAAU,OAAuC;CACvD,OAAO,OAAO,WAAW,YAAY,WAAW,KAAK,SAAS;AAChE;;;;;;;;;;;;;AAcA,IAAa,sBAAb,cAAyC,MAAM;CAC3B,OAAe;CACxB,aAAa;CACtB,YAAY,SAAiB,SAA+B;EAC1D,MAAM,SAAS,OAAO;CACxB;AACF;AAEA,SAAgB,aAAa,OAAyB;CACpD,OAAO,iBAAiB,SAAU,MAAmC,eAAe;AACtF;;;;;;AAOA,eAAsB,YAAe,MAAc,SAAuC;CACxF,IAAI;EACF,OAAO,MAAM,QAAQ;CACvB,SAAS,OAAO;EAEd,MAAM,IAAI,oBAAoB,GAAG,KAAK,eADzB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EACR,IAAI,EAAE,MAAM,CAAC;CACzE;AACF;;AAGA,MAAM,gCAAgB,IAAI,IAAI,CAAC,2BAA2B,yBAAyB,CAAC;;;;;AAMpF,SAAgB,YAAY,OAAyB;CACnD,IAAI,EAAE,iBAAiB,QAAQ,OAAO;CACtC,IAAI,cAAc,IAAI,MAAM,IAAI,GAAG,OAAO;CAC1C,OAAQ,MAAkC,cAAc;AAC1D;;;;;;;AAQA,SAAgB,cAAc,OAAyB;CACrD,IAAI,EAAE,iBAAiB,UAAU,YAAY,KAAK,GAAG,OAAO;CAC5D,OAAO,CAAC,cAAc,IAAI,MAAM,IAAI,KAAK,MAAM,SAAS;AAC1D;;AAGA,SAAgB,kBAAkB,QAAyB;CACzD,OAAO,WAAW,OAAO,WAAW,OAAO,UAAU;AACvD"}
|