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,120 @@
|
|
|
1
|
+
import { ExecutionStart } from "../store/index.mjs";
|
|
2
|
+
import { EmailBindingLike } from "../transports/cloudflare-email.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* The runtime port: what the host needs from the platform it runs on, whichever one that is.
|
|
5
|
+
* Cloudflare's Workflow binding satisfies it (`cloudflareJourneyBinding`), the AWS adapter's
|
|
6
|
+
* `AwsInstances` implements it over durable executions.
|
|
7
|
+
*/
|
|
8
|
+
export interface WorkflowInstanceLike {
|
|
9
|
+
id: string;
|
|
10
|
+
sendEvent(event: {
|
|
11
|
+
type: string;
|
|
12
|
+
payload?: unknown;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
/** Stop the instance for good (Cloudflare Workflows' `terminate`). */
|
|
15
|
+
terminate?(): Promise<void>;
|
|
16
|
+
/** Where it stands (`complete`, `errored`, `terminated`, `running`, …). */
|
|
17
|
+
status?(): Promise<{
|
|
18
|
+
status: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/** How the host starts, wakes and stops instances. */
|
|
22
|
+
export interface WorkflowBindingLike {
|
|
23
|
+
create(options: {
|
|
24
|
+
id: string;
|
|
25
|
+
params: unknown;
|
|
26
|
+
}): Promise<WorkflowInstanceLike>;
|
|
27
|
+
/** The instance, or an `InstanceNotFoundError` when the runtime does not know the id. */
|
|
28
|
+
get(id: string): Promise<WorkflowInstanceLike>;
|
|
29
|
+
/**
|
|
30
|
+
* For a runtime whose start is a submit that can be lost in flight (AWS): the start to record
|
|
31
|
+
* with the entry, in one transaction. A failed `create` then keeps the entry — its recorded
|
|
32
|
+
* start is retried by the next ingest for the pair (`resume`) or by maintenance, never rolled
|
|
33
|
+
* back and re-entered as a second execution.
|
|
34
|
+
*/
|
|
35
|
+
plan?(options: {
|
|
36
|
+
id: string;
|
|
37
|
+
params: JourneyParams;
|
|
38
|
+
ts: number;
|
|
39
|
+
/** The code version whose routes named `params.contentHash` (absent after a forced deploy). */
|
|
40
|
+
version?: string | undefined;
|
|
41
|
+
}): Promise<ExecutionStart>;
|
|
42
|
+
/** Retry the recorded, unconfirmed start of the (workflow, user) entry still running, if any. */
|
|
43
|
+
resume?(entry: {
|
|
44
|
+
workflow: string;
|
|
45
|
+
userId: string;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Maintenance the sweep runs first: old unconfirmed starts retried (or given up on), and
|
|
49
|
+
* executions the platform ended on its own (timeout, stop, crash) reconciled into the ledger.
|
|
50
|
+
*/
|
|
51
|
+
maintain?(): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The runtime does not know the instance: the only lookup failure that lets the host drop the
|
|
55
|
+
* instance's wakes, or count it as stopped. Every `WorkflowBindingLike.get` answers it this way.
|
|
56
|
+
*/
|
|
57
|
+
export declare class InstanceNotFoundError extends Error {
|
|
58
|
+
readonly instanceId: string;
|
|
59
|
+
readonly name = "InstanceNotFoundError";
|
|
60
|
+
constructor(instanceId: string, options?: ErrorOptions);
|
|
61
|
+
}
|
|
62
|
+
/** The event type the host uses to wake waiting instances (sendEvent's `type`). */
|
|
63
|
+
export declare const WAKE_EVENT_TYPE = "wake";
|
|
64
|
+
/** Journey instance parameters, passed by the host when it creates one. */
|
|
65
|
+
export interface JourneyParams {
|
|
66
|
+
workflowId: string;
|
|
67
|
+
/** The IR version pinned at entry. */
|
|
68
|
+
contentHash: string;
|
|
69
|
+
userId: string;
|
|
70
|
+
/** `ts`: when the trigger happened, which can be long before a delayed delivery created this. */
|
|
71
|
+
trigger: {
|
|
72
|
+
event: string;
|
|
73
|
+
payload: Record<string, unknown>;
|
|
74
|
+
ts?: number;
|
|
75
|
+
};
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
}
|
|
78
|
+
/** Every binding, variable and secret the journey host reads (names match the wrangler config). */
|
|
79
|
+
export interface JourneyEnv {
|
|
80
|
+
/** The runtime port: creating instances, waking and stopping them. */
|
|
81
|
+
JOURNEY: WorkflowBindingLike;
|
|
82
|
+
/** Optional message-delivery webhook (defaults to the console logging sender). */
|
|
83
|
+
MESSAGE_WEBHOOK_URL?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Bearer token required on every mutating HTTP endpoint (`Authorization:
|
|
86
|
+
* Bearer <token>`). Unset = open — acceptable only for local dev; /deploy in
|
|
87
|
+
* particular rewrites the whole routing table, so production must set this.
|
|
88
|
+
*/
|
|
89
|
+
API_TOKEN?: string;
|
|
90
|
+
/**
|
|
91
|
+
* The host's public origin. With a store that keeps reporting (Postgres), journey emails'
|
|
92
|
+
* links and open pixel point at its `/t/...` routes; without it emails go out untracked.
|
|
93
|
+
*/
|
|
94
|
+
WORKFLOW_ORIGIN?: string;
|
|
95
|
+
/** Which `workflow.config.ts` entry applies (`development`, `production`, …); production when unset. */
|
|
96
|
+
ENVIRONMENT?: string;
|
|
97
|
+
/** Cloudflare Email Sending, when the config has `emails`. */
|
|
98
|
+
EMAIL?: EmailBindingLike;
|
|
99
|
+
/** The APNs auth key (`.p8`, base64) named by the config's `apns.keyId`. */
|
|
100
|
+
APNS_PRIVATE_KEY_BASE64?: string;
|
|
101
|
+
/** The Firebase service account (base64 JSON) the config's `fcm` sends with. */
|
|
102
|
+
GOOGLE_APPLICATION_CREDENTIALS_BASE64?: string;
|
|
103
|
+
/** The VAPID key pair web pushes are signed with (`generateVapidKeys`); the config's `webPush` turns the channel on. */
|
|
104
|
+
VAPID_PUBLIC_KEY?: string;
|
|
105
|
+
VAPID_PRIVATE_KEY?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Cloudflare's version metadata binding (wrangler `"version_metadata": { "binding":
|
|
108
|
+
* "CF_VERSION_METADATA" }`). With it, and a store that records the live version (Postgres),
|
|
109
|
+
* journeyWorker makes the bundle compiled into each new version live by itself: `wrangler
|
|
110
|
+
* deploy` is the whole deploy.
|
|
111
|
+
*/
|
|
112
|
+
CF_VERSION_METADATA?: {
|
|
113
|
+
id: string;
|
|
114
|
+
tag?: string;
|
|
115
|
+
timestamp: string;
|
|
116
|
+
};
|
|
117
|
+
/** Development only: the HTTP/2 relay `wrangler dev` sends APNs requests through (see `sendwend/apns-relay`). */
|
|
118
|
+
APNS_RELAY_ORIGIN?: string;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=platform.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.mts","names":[],"sources":["../../src/host/platform.ts"],"mappings":";;;;;;;iBASiB;EACf;EACA,UAAU;IAAS;IAAc;MAAsB;;EAEvD,cAAc;;EAEd,WAAW;IAAU;;;;iBAIN;EACf,OAAO;IAAW;IAAY;MAAoB,QAAQ;;EAE1D,IAAI,aAAa,QAAQ;;;;;;;EAOzB,MAAM;IACJ;IACA,QAAQ;IACR;;IAEA;MACE,QAAQ;;EAEZ,QAAQ;IAAS;IAAkB;MAAmB;;;;;EAKtD,aAAa;;;;;;qBAOF,8BAA8B;WAG9B;WAFO;EAClB,YACW,oBACT,UAAU;;;qBAOD;;iBAGI;EACf;;EAEA;EACA;;EAEA;IAAW;IAAe,SAAS;IAAyB;;GAC3D;;;iBAIc;;EAEf,SAAS;;EAET;;;;;;EAMA;;;;;EAKA;;EAEA;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;EACA;;;;;;;EAOA;IAAwB;IAAY;IAAc;;;EAElD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/host/platform.ts
|
|
2
|
+
/**
|
|
3
|
+
* The runtime does not know the instance: the only lookup failure that lets the host drop the
|
|
4
|
+
* instance's wakes, or count it as stopped. Every `WorkflowBindingLike.get` answers it this way.
|
|
5
|
+
*/
|
|
6
|
+
var InstanceNotFoundError = class extends Error {
|
|
7
|
+
instanceId;
|
|
8
|
+
name = "InstanceNotFoundError";
|
|
9
|
+
constructor(instanceId, options) {
|
|
10
|
+
super(`no such instance: ${instanceId}`, options);
|
|
11
|
+
this.instanceId = instanceId;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
/** The event type the host uses to wake waiting instances (sendEvent's `type`). */
|
|
15
|
+
const WAKE_EVENT_TYPE = "wake";
|
|
16
|
+
export { InstanceNotFoundError, WAKE_EVENT_TYPE };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=platform.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.mjs","names":[],"sources":["../../src/host/platform.ts"],"sourcesContent":["import type { ExecutionStart } from '../store/index';\nimport type { EmailBindingLike } from '../transports/cloudflare-email';\n\n/**\n * The runtime port: what the host needs from the platform it runs on, whichever one that is.\n * Cloudflare's Workflow binding satisfies it (`cloudflareJourneyBinding`), the AWS adapter's\n * `AwsInstances` implements it over durable executions.\n */\n\nexport interface WorkflowInstanceLike {\n id: string;\n sendEvent(event: { type: string; payload?: unknown }): Promise<void>;\n /** Stop the instance for good (Cloudflare Workflows' `terminate`). */\n terminate?(): Promise<void>;\n /** Where it stands (`complete`, `errored`, `terminated`, `running`, …). */\n status?(): Promise<{ status: string }>;\n}\n\n/** How the host starts, wakes and stops instances. */\nexport interface WorkflowBindingLike {\n create(options: { id: string; params: unknown }): Promise<WorkflowInstanceLike>;\n /** The instance, or an `InstanceNotFoundError` when the runtime does not know the id. */\n get(id: string): Promise<WorkflowInstanceLike>;\n /**\n * For a runtime whose start is a submit that can be lost in flight (AWS): the start to record\n * with the entry, in one transaction. A failed `create` then keeps the entry — its recorded\n * start is retried by the next ingest for the pair (`resume`) or by maintenance, never rolled\n * back and re-entered as a second execution.\n */\n plan?(options: {\n id: string;\n params: JourneyParams;\n ts: number;\n /** The code version whose routes named `params.contentHash` (absent after a forced deploy). */\n version?: string | undefined;\n }): Promise<ExecutionStart>;\n /** Retry the recorded, unconfirmed start of the (workflow, user) entry still running, if any. */\n resume?(entry: { workflow: string; userId: string }): Promise<void>;\n /**\n * Maintenance the sweep runs first: old unconfirmed starts retried (or given up on), and\n * executions the platform ended on its own (timeout, stop, crash) reconciled into the ledger.\n */\n maintain?(): Promise<void>;\n}\n\n/**\n * The runtime does not know the instance: the only lookup failure that lets the host drop the\n * instance's wakes, or count it as stopped. Every `WorkflowBindingLike.get` answers it this way.\n */\nexport class InstanceNotFoundError extends Error {\n override readonly name = 'InstanceNotFoundError';\n constructor(\n readonly instanceId: string,\n options?: ErrorOptions\n ) {\n super(`no such instance: ${instanceId}`, options);\n }\n}\n\n/** The event type the host uses to wake waiting instances (sendEvent's `type`). */\nexport const WAKE_EVENT_TYPE = 'wake';\n\n/** Journey instance parameters, passed by the host when it creates one. */\nexport interface JourneyParams {\n workflowId: string;\n /** The IR version pinned at entry. */\n contentHash: string;\n userId: string;\n /** `ts`: when the trigger happened, which can be long before a delayed delivery created this. */\n trigger: { event: string; payload: Record<string, unknown>; ts?: number };\n [key: string]: unknown;\n}\n\n/** Every binding, variable and secret the journey host reads (names match the wrangler config). */\nexport interface JourneyEnv {\n /** The runtime port: creating instances, waking and stopping them. */\n JOURNEY: WorkflowBindingLike;\n /** Optional message-delivery webhook (defaults to the console logging sender). */\n MESSAGE_WEBHOOK_URL?: string;\n /**\n * Bearer token required on every mutating HTTP endpoint (`Authorization:\n * Bearer <token>`). Unset = open — acceptable only for local dev; /deploy in\n * particular rewrites the whole routing table, so production must set this.\n */\n API_TOKEN?: string;\n /**\n * The host's public origin. With a store that keeps reporting (Postgres), journey emails'\n * links and open pixel point at its `/t/...` routes; without it emails go out untracked.\n */\n WORKFLOW_ORIGIN?: string;\n /** Which `workflow.config.ts` entry applies (`development`, `production`, …); production when unset. */\n ENVIRONMENT?: string;\n /** Cloudflare Email Sending, when the config has `emails`. */\n EMAIL?: EmailBindingLike;\n /** The APNs auth key (`.p8`, base64) named by the config's `apns.keyId`. */\n APNS_PRIVATE_KEY_BASE64?: string;\n /** The Firebase service account (base64 JSON) the config's `fcm` sends with. */\n GOOGLE_APPLICATION_CREDENTIALS_BASE64?: string;\n /** The VAPID key pair web pushes are signed with (`generateVapidKeys`); the config's `webPush` turns the channel on. */\n VAPID_PUBLIC_KEY?: string;\n VAPID_PRIVATE_KEY?: string;\n /**\n * Cloudflare's version metadata binding (wrangler `\"version_metadata\": { \"binding\":\n * \"CF_VERSION_METADATA\" }`). With it, and a store that records the live version (Postgres),\n * journeyWorker makes the bundle compiled into each new version live by itself: `wrangler\n * deploy` is the whole deploy.\n */\n CF_VERSION_METADATA?: { id: string; tag?: string; timestamp: string };\n /** Development only: the HTTP/2 relay `wrangler dev` sends APNs requests through (see `sendwend/apns-relay`). */\n APNS_RELAY_ORIGIN?: string;\n}\n"],"mappings":";;;;;AAiDA,IAAa,wBAAb,cAA2C,MAAM;CAGpC;CAFO,OAAO;CACzB,YACW,YACT,SACA;EACA,MAAM,qBAAqB,cAAc,OAAO;EAHvC,KAAA,aAAA;CAIX;AACF;;AAGA,MAAa,kBAAkB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_engine_retry = require("../engine/retry.cjs");
|
|
3
|
+
// src/host/senders.ts
|
|
4
|
+
/** Development sender: structured logs, for eyeballing the pipeline. */
|
|
5
|
+
var LogMessageSender = class {
|
|
6
|
+
async send(message) {
|
|
7
|
+
const { tracking: _tracking, ...logged } = message;
|
|
8
|
+
console.log(`[send] ${JSON.stringify(logged)}`);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Webhook sender: POST to an external delivery service (a Resend/SES gateway,
|
|
13
|
+
* say). The idempotency key travels with it, so the receiver de-duplicates
|
|
14
|
+
* retries and replays on idempotencyKey. A 4xx other than 408 / 429 is the
|
|
15
|
+
* receiver refusing this message: a `PermanentError`, so the step does not
|
|
16
|
+
* retry into it; timeouts, rate limits and 5xx are retried.
|
|
17
|
+
*/
|
|
18
|
+
var WebhookMessageSender = class {
|
|
19
|
+
url;
|
|
20
|
+
fetchImpl;
|
|
21
|
+
constructor(url, fetchImpl = fetch) {
|
|
22
|
+
this.url = url;
|
|
23
|
+
this.fetchImpl = fetchImpl;
|
|
24
|
+
}
|
|
25
|
+
async send(message) {
|
|
26
|
+
const response = await this.fetchImpl(this.url, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: {
|
|
29
|
+
"content-type": "application/json",
|
|
30
|
+
"idempotency-key": message.idempotencyKey
|
|
31
|
+
},
|
|
32
|
+
body: JSON.stringify(message)
|
|
33
|
+
});
|
|
34
|
+
if (response.ok) return;
|
|
35
|
+
if (require_engine_retry.isRetryableStatus(response.status)) throw new Error(`message webhook failed: ${response.status}`);
|
|
36
|
+
throw new require_engine_retry.PermanentError(`message webhook refused the message: ${response.status}`, { reason: `Refused${response.status}` });
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* One sender per channel: the runner has a single outlet, this fans it out.
|
|
41
|
+
* A channel without a sender fails the send for good (`PermanentError`): the
|
|
42
|
+
* configuration is the same on every attempt.
|
|
43
|
+
*/
|
|
44
|
+
function routeByChannel(senders) {
|
|
45
|
+
return { async send(message) {
|
|
46
|
+
const sender = senders[message.channel];
|
|
47
|
+
if (sender === void 0) throw new require_engine_retry.PermanentError(`no sender configured for channel '${message.channel}'`, { reason: "not_configured" });
|
|
48
|
+
return sender.send(message);
|
|
49
|
+
} };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* One push outlet per platform, chosen by the device each copy goes to (the
|
|
53
|
+
* engine sends one message per device, and the host's directory says which
|
|
54
|
+
* platform a token belongs to): `ios` straight to APNs, `android` through FCM,
|
|
55
|
+
* say. A platform with no sender fails the step for good (`PermanentError`)
|
|
56
|
+
* rather than guessing or retrying the same configuration.
|
|
57
|
+
*/
|
|
58
|
+
function routeByPlatform(senders) {
|
|
59
|
+
return { async send(message) {
|
|
60
|
+
const platform = message.device?.platform;
|
|
61
|
+
if (platform === void 0) throw new require_engine_retry.PermanentError(`push for user '${message.userId}' carries no device`, { reason: "no_device" });
|
|
62
|
+
if (!Object.hasOwn(senders, platform)) throw new require_engine_retry.PermanentError(`no push sender configured for platform '${platform}'`, { reason: "not_configured" });
|
|
63
|
+
return senders[platform].send(message);
|
|
64
|
+
} };
|
|
65
|
+
}
|
|
66
|
+
exports.LogMessageSender = LogMessageSender;
|
|
67
|
+
exports.WebhookMessageSender = WebhookMessageSender;
|
|
68
|
+
exports.routeByChannel = routeByChannel;
|
|
69
|
+
exports.routeByPlatform = routeByPlatform;
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=senders.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"senders.cjs","names":["isRetryableStatus","PermanentError"],"sources":["../../src/host/senders.ts"],"sourcesContent":["import type { MessageSender, OutboundMessage } from '../engine';\nimport { PermanentError, isRetryableStatus } from '../engine/retry';\n\n/** Development sender: structured logs, for eyeballing the pipeline. */\nexport class LogMessageSender implements MessageSender {\n async send(message: OutboundMessage): Promise<void> {\n const { tracking: _tracking, ...logged } = message;\n console.log(`[send] ${JSON.stringify(logged)}`);\n }\n}\n\n/**\n * Webhook sender: POST to an external delivery service (a Resend/SES gateway,\n * say). The idempotency key travels with it, so the receiver de-duplicates\n * retries and replays on idempotencyKey. A 4xx other than 408 / 429 is the\n * receiver refusing this message: a `PermanentError`, so the step does not\n * retry into it; timeouts, rate limits and 5xx are retried.\n */\nexport class WebhookMessageSender implements MessageSender {\n constructor(\n private readonly url: string,\n private readonly fetchImpl: typeof fetch = fetch\n ) {}\n\n async send(message: OutboundMessage): Promise<void> {\n const response = await this.fetchImpl(this.url, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n 'idempotency-key': message.idempotencyKey,\n },\n body: JSON.stringify(message),\n });\n if (response.ok) return;\n if (isRetryableStatus(response.status)) {\n throw new Error(`message webhook failed: ${response.status}`);\n }\n throw new PermanentError(`message webhook refused the message: ${response.status}`, {\n reason: `Refused${response.status}`,\n });\n }\n}\n\n/**\n * One sender per channel: the runner has a single outlet, this fans it out.\n * A channel without a sender fails the send for good (`PermanentError`): the\n * configuration is the same on every attempt.\n */\nexport function routeByChannel(\n senders: Partial<Record<OutboundMessage['channel'], MessageSender>>\n): MessageSender {\n return {\n async send(message) {\n const sender = senders[message.channel];\n if (sender === undefined) {\n throw new PermanentError(`no sender configured for channel '${message.channel}'`, {\n reason: 'not_configured',\n });\n }\n return sender.send(message);\n },\n };\n}\n\n/**\n * One push outlet per platform, chosen by the device each copy goes to (the\n * engine sends one message per device, and the host's directory says which\n * platform a token belongs to): `ios` straight to APNs, `android` through FCM,\n * say. A platform with no sender fails the step for good (`PermanentError`)\n * rather than guessing or retrying the same configuration.\n */\nexport function routeByPlatform(senders: Record<string, MessageSender>): MessageSender {\n return {\n async send(message) {\n const platform = message.device?.platform;\n if (platform === undefined) {\n throw new PermanentError(`push for user '${message.userId}' carries no device`, {\n reason: 'no_device',\n });\n }\n if (!Object.hasOwn(senders, platform)) {\n throw new PermanentError(`no push sender configured for platform '${platform}'`, {\n reason: 'not_configured',\n });\n }\n return senders[platform].send(message);\n },\n };\n}\n"],"mappings":";;;;AAIA,IAAa,mBAAb,MAAuD;CACrD,MAAM,KAAK,SAAyC;EAClD,MAAM,EAAE,UAAU,WAAW,GAAG,WAAW;EAC3C,QAAQ,IAAI,UAAU,KAAK,UAAU,MAAM,GAAG;CAChD;AACF;;;;;;;;AASA,IAAa,uBAAb,MAA2D;CAEtC;CACA;CAFnB,YACmB,KACA,YAA0B,OAC3C;EAFiB,KAAA,MAAA;EACA,KAAA,YAAA;CAChB;CAEH,MAAM,KAAK,SAAyC;EAClD,MAAM,WAAW,MAAM,KAAK,UAAU,KAAK,KAAK;GAC9C,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,mBAAmB,QAAQ;GAC7B;GACA,MAAM,KAAK,UAAU,OAAO;EAC9B,CAAC;EACD,IAAI,SAAS,IAAI;EACjB,IAAIA,qBAAAA,kBAAkB,SAAS,MAAM,GACnC,MAAM,IAAI,MAAM,2BAA2B,SAAS,QAAQ;EAE9D,MAAM,IAAIC,qBAAAA,eAAe,wCAAwC,SAAS,UAAU,EAClF,QAAQ,UAAU,SAAS,SAC7B,CAAC;CACH;AACF;;;;;;AAOA,SAAgB,eACd,SACe;CACf,OAAO,EACL,MAAM,KAAK,SAAS;EAClB,MAAM,SAAS,QAAQ,QAAQ;EAC/B,IAAI,WAAW,KAAA,GACb,MAAM,IAAIA,qBAAAA,eAAe,qCAAqC,QAAQ,QAAQ,IAAI,EAChF,QAAQ,iBACV,CAAC;EAEH,OAAO,OAAO,KAAK,OAAO;CAC5B,EACF;AACF;;;;;;;;AASA,SAAgB,gBAAgB,SAAuD;CACrF,OAAO,EACL,MAAM,KAAK,SAAS;EAClB,MAAM,WAAW,QAAQ,QAAQ;EACjC,IAAI,aAAa,KAAA,GACf,MAAM,IAAIA,qBAAAA,eAAe,kBAAkB,QAAQ,OAAO,sBAAsB,EAC9E,QAAQ,YACV,CAAC;EAEH,IAAI,CAAC,OAAO,OAAO,SAAS,QAAQ,GAClC,MAAM,IAAIA,qBAAAA,eAAe,2CAA2C,SAAS,IAAI,EAC/E,QAAQ,iBACV,CAAC;EAEH,OAAO,QAAQ,SAAS,CAAC,KAAK,OAAO;CACvC,EACF;AACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MessageSender, OutboundMessage } from "../engine/ports.cjs";
|
|
2
|
+
import "../engine/index.cjs";
|
|
3
|
+
/** Development sender: structured logs, for eyeballing the pipeline. */
|
|
4
|
+
export declare class LogMessageSender implements MessageSender {
|
|
5
|
+
send(message: OutboundMessage): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Webhook sender: POST to an external delivery service (a Resend/SES gateway,
|
|
9
|
+
* say). The idempotency key travels with it, so the receiver de-duplicates
|
|
10
|
+
* retries and replays on idempotencyKey. A 4xx other than 408 / 429 is the
|
|
11
|
+
* receiver refusing this message: a `PermanentError`, so the step does not
|
|
12
|
+
* retry into it; timeouts, rate limits and 5xx are retried.
|
|
13
|
+
*/
|
|
14
|
+
export declare class WebhookMessageSender implements MessageSender {
|
|
15
|
+
private readonly url;
|
|
16
|
+
private readonly fetchImpl;
|
|
17
|
+
constructor(url: string, fetchImpl?: typeof fetch);
|
|
18
|
+
send(message: OutboundMessage): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One sender per channel: the runner has a single outlet, this fans it out.
|
|
22
|
+
* A channel without a sender fails the send for good (`PermanentError`): the
|
|
23
|
+
* configuration is the same on every attempt.
|
|
24
|
+
*/
|
|
25
|
+
export declare function routeByChannel(senders: Partial<Record<OutboundMessage['channel'], MessageSender>>): MessageSender;
|
|
26
|
+
/**
|
|
27
|
+
* One push outlet per platform, chosen by the device each copy goes to (the
|
|
28
|
+
* engine sends one message per device, and the host's directory says which
|
|
29
|
+
* platform a token belongs to): `ios` straight to APNs, `android` through FCM,
|
|
30
|
+
* say. A platform with no sender fails the step for good (`PermanentError`)
|
|
31
|
+
* rather than guessing or retrying the same configuration.
|
|
32
|
+
*/
|
|
33
|
+
export declare function routeByPlatform(senders: Record<string, MessageSender>): MessageSender;
|
|
34
|
+
//# sourceMappingURL=senders.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"senders.d.cts","names":[],"sources":["../../src/host/senders.ts"],"mappings":";;;qBAIa,4BAA4B;EACjC,KAAK,SAAS,kBAAkB;;;;;;;;;qBAa3B,gCAAgC;mBAExB;mBACA;EAFnB,YACmB,aACA,mBAAkB;EAG/B,KAAK,SAAS,kBAAkB;;;;;;;wBAwBxB,eACd,SAAS,QAAQ,OAAO,4BAA4B,kBACnD;;;;;;;;wBAqBa,gBAAgB,SAAS,eAAe,iBAAiB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { MessageSender, OutboundMessage } from "../engine/ports.mjs";
|
|
2
|
+
import "../engine/index.mjs";
|
|
3
|
+
/** Development sender: structured logs, for eyeballing the pipeline. */
|
|
4
|
+
export declare class LogMessageSender implements MessageSender {
|
|
5
|
+
send(message: OutboundMessage): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Webhook sender: POST to an external delivery service (a Resend/SES gateway,
|
|
9
|
+
* say). The idempotency key travels with it, so the receiver de-duplicates
|
|
10
|
+
* retries and replays on idempotencyKey. A 4xx other than 408 / 429 is the
|
|
11
|
+
* receiver refusing this message: a `PermanentError`, so the step does not
|
|
12
|
+
* retry into it; timeouts, rate limits and 5xx are retried.
|
|
13
|
+
*/
|
|
14
|
+
export declare class WebhookMessageSender implements MessageSender {
|
|
15
|
+
private readonly url;
|
|
16
|
+
private readonly fetchImpl;
|
|
17
|
+
constructor(url: string, fetchImpl?: typeof fetch);
|
|
18
|
+
send(message: OutboundMessage): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* One sender per channel: the runner has a single outlet, this fans it out.
|
|
22
|
+
* A channel without a sender fails the send for good (`PermanentError`): the
|
|
23
|
+
* configuration is the same on every attempt.
|
|
24
|
+
*/
|
|
25
|
+
export declare function routeByChannel(senders: Partial<Record<OutboundMessage['channel'], MessageSender>>): MessageSender;
|
|
26
|
+
/**
|
|
27
|
+
* One push outlet per platform, chosen by the device each copy goes to (the
|
|
28
|
+
* engine sends one message per device, and the host's directory says which
|
|
29
|
+
* platform a token belongs to): `ios` straight to APNs, `android` through FCM,
|
|
30
|
+
* say. A platform with no sender fails the step for good (`PermanentError`)
|
|
31
|
+
* rather than guessing or retrying the same configuration.
|
|
32
|
+
*/
|
|
33
|
+
export declare function routeByPlatform(senders: Record<string, MessageSender>): MessageSender;
|
|
34
|
+
//# sourceMappingURL=senders.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"senders.d.mts","names":[],"sources":["../../src/host/senders.ts"],"mappings":";;;qBAIa,4BAA4B;EACjC,KAAK,SAAS,kBAAkB;;;;;;;;;qBAa3B,gCAAgC;mBAExB;mBACA;EAFnB,YACmB,aACA,mBAAkB;EAG/B,KAAK,SAAS,kBAAkB;;;;;;;wBAwBxB,eACd,SAAS,QAAQ,OAAO,4BAA4B,kBACnD;;;;;;;;wBAqBa,gBAAgB,SAAS,eAAe,iBAAiB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { PermanentError, isRetryableStatus } from "../engine/retry.mjs";
|
|
2
|
+
// src/host/senders.ts
|
|
3
|
+
/** Development sender: structured logs, for eyeballing the pipeline. */
|
|
4
|
+
var LogMessageSender = class {
|
|
5
|
+
async send(message) {
|
|
6
|
+
const { tracking: _tracking, ...logged } = message;
|
|
7
|
+
console.log(`[send] ${JSON.stringify(logged)}`);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Webhook sender: POST to an external delivery service (a Resend/SES gateway,
|
|
12
|
+
* say). The idempotency key travels with it, so the receiver de-duplicates
|
|
13
|
+
* retries and replays on idempotencyKey. A 4xx other than 408 / 429 is the
|
|
14
|
+
* receiver refusing this message: a `PermanentError`, so the step does not
|
|
15
|
+
* retry into it; timeouts, rate limits and 5xx are retried.
|
|
16
|
+
*/
|
|
17
|
+
var WebhookMessageSender = class {
|
|
18
|
+
url;
|
|
19
|
+
fetchImpl;
|
|
20
|
+
constructor(url, fetchImpl = fetch) {
|
|
21
|
+
this.url = url;
|
|
22
|
+
this.fetchImpl = fetchImpl;
|
|
23
|
+
}
|
|
24
|
+
async send(message) {
|
|
25
|
+
const response = await this.fetchImpl(this.url, {
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: {
|
|
28
|
+
"content-type": "application/json",
|
|
29
|
+
"idempotency-key": message.idempotencyKey
|
|
30
|
+
},
|
|
31
|
+
body: JSON.stringify(message)
|
|
32
|
+
});
|
|
33
|
+
if (response.ok) return;
|
|
34
|
+
if (isRetryableStatus(response.status)) throw new Error(`message webhook failed: ${response.status}`);
|
|
35
|
+
throw new PermanentError(`message webhook refused the message: ${response.status}`, { reason: `Refused${response.status}` });
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* One sender per channel: the runner has a single outlet, this fans it out.
|
|
40
|
+
* A channel without a sender fails the send for good (`PermanentError`): the
|
|
41
|
+
* configuration is the same on every attempt.
|
|
42
|
+
*/
|
|
43
|
+
function routeByChannel(senders) {
|
|
44
|
+
return { async send(message) {
|
|
45
|
+
const sender = senders[message.channel];
|
|
46
|
+
if (sender === void 0) throw new PermanentError(`no sender configured for channel '${message.channel}'`, { reason: "not_configured" });
|
|
47
|
+
return sender.send(message);
|
|
48
|
+
} };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* One push outlet per platform, chosen by the device each copy goes to (the
|
|
52
|
+
* engine sends one message per device, and the host's directory says which
|
|
53
|
+
* platform a token belongs to): `ios` straight to APNs, `android` through FCM,
|
|
54
|
+
* say. A platform with no sender fails the step for good (`PermanentError`)
|
|
55
|
+
* rather than guessing or retrying the same configuration.
|
|
56
|
+
*/
|
|
57
|
+
function routeByPlatform(senders) {
|
|
58
|
+
return { async send(message) {
|
|
59
|
+
const platform = message.device?.platform;
|
|
60
|
+
if (platform === void 0) throw new PermanentError(`push for user '${message.userId}' carries no device`, { reason: "no_device" });
|
|
61
|
+
if (!Object.hasOwn(senders, platform)) throw new PermanentError(`no push sender configured for platform '${platform}'`, { reason: "not_configured" });
|
|
62
|
+
return senders[platform].send(message);
|
|
63
|
+
} };
|
|
64
|
+
}
|
|
65
|
+
export { LogMessageSender, WebhookMessageSender, routeByChannel, routeByPlatform };
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=senders.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"senders.mjs","names":[],"sources":["../../src/host/senders.ts"],"sourcesContent":["import type { MessageSender, OutboundMessage } from '../engine';\nimport { PermanentError, isRetryableStatus } from '../engine/retry';\n\n/** Development sender: structured logs, for eyeballing the pipeline. */\nexport class LogMessageSender implements MessageSender {\n async send(message: OutboundMessage): Promise<void> {\n const { tracking: _tracking, ...logged } = message;\n console.log(`[send] ${JSON.stringify(logged)}`);\n }\n}\n\n/**\n * Webhook sender: POST to an external delivery service (a Resend/SES gateway,\n * say). The idempotency key travels with it, so the receiver de-duplicates\n * retries and replays on idempotencyKey. A 4xx other than 408 / 429 is the\n * receiver refusing this message: a `PermanentError`, so the step does not\n * retry into it; timeouts, rate limits and 5xx are retried.\n */\nexport class WebhookMessageSender implements MessageSender {\n constructor(\n private readonly url: string,\n private readonly fetchImpl: typeof fetch = fetch\n ) {}\n\n async send(message: OutboundMessage): Promise<void> {\n const response = await this.fetchImpl(this.url, {\n method: 'POST',\n headers: {\n 'content-type': 'application/json',\n 'idempotency-key': message.idempotencyKey,\n },\n body: JSON.stringify(message),\n });\n if (response.ok) return;\n if (isRetryableStatus(response.status)) {\n throw new Error(`message webhook failed: ${response.status}`);\n }\n throw new PermanentError(`message webhook refused the message: ${response.status}`, {\n reason: `Refused${response.status}`,\n });\n }\n}\n\n/**\n * One sender per channel: the runner has a single outlet, this fans it out.\n * A channel without a sender fails the send for good (`PermanentError`): the\n * configuration is the same on every attempt.\n */\nexport function routeByChannel(\n senders: Partial<Record<OutboundMessage['channel'], MessageSender>>\n): MessageSender {\n return {\n async send(message) {\n const sender = senders[message.channel];\n if (sender === undefined) {\n throw new PermanentError(`no sender configured for channel '${message.channel}'`, {\n reason: 'not_configured',\n });\n }\n return sender.send(message);\n },\n };\n}\n\n/**\n * One push outlet per platform, chosen by the device each copy goes to (the\n * engine sends one message per device, and the host's directory says which\n * platform a token belongs to): `ios` straight to APNs, `android` through FCM,\n * say. A platform with no sender fails the step for good (`PermanentError`)\n * rather than guessing or retrying the same configuration.\n */\nexport function routeByPlatform(senders: Record<string, MessageSender>): MessageSender {\n return {\n async send(message) {\n const platform = message.device?.platform;\n if (platform === undefined) {\n throw new PermanentError(`push for user '${message.userId}' carries no device`, {\n reason: 'no_device',\n });\n }\n if (!Object.hasOwn(senders, platform)) {\n throw new PermanentError(`no push sender configured for platform '${platform}'`, {\n reason: 'not_configured',\n });\n }\n return senders[platform].send(message);\n },\n };\n}\n"],"mappings":";;;AAIA,IAAa,mBAAb,MAAuD;CACrD,MAAM,KAAK,SAAyC;EAClD,MAAM,EAAE,UAAU,WAAW,GAAG,WAAW;EAC3C,QAAQ,IAAI,UAAU,KAAK,UAAU,MAAM,GAAG;CAChD;AACF;;;;;;;;AASA,IAAa,uBAAb,MAA2D;CAEtC;CACA;CAFnB,YACmB,KACA,YAA0B,OAC3C;EAFiB,KAAA,MAAA;EACA,KAAA,YAAA;CAChB;CAEH,MAAM,KAAK,SAAyC;EAClD,MAAM,WAAW,MAAM,KAAK,UAAU,KAAK,KAAK;GAC9C,QAAQ;GACR,SAAS;IACP,gBAAgB;IAChB,mBAAmB,QAAQ;GAC7B;GACA,MAAM,KAAK,UAAU,OAAO;EAC9B,CAAC;EACD,IAAI,SAAS,IAAI;EACjB,IAAI,kBAAkB,SAAS,MAAM,GACnC,MAAM,IAAI,MAAM,2BAA2B,SAAS,QAAQ;EAE9D,MAAM,IAAI,eAAe,wCAAwC,SAAS,UAAU,EAClF,QAAQ,UAAU,SAAS,SAC7B,CAAC;CACH;AACF;;;;;;AAOA,SAAgB,eACd,SACe;CACf,OAAO,EACL,MAAM,KAAK,SAAS;EAClB,MAAM,SAAS,QAAQ,QAAQ;EAC/B,IAAI,WAAW,KAAA,GACb,MAAM,IAAI,eAAe,qCAAqC,QAAQ,QAAQ,IAAI,EAChF,QAAQ,iBACV,CAAC;EAEH,OAAO,OAAO,KAAK,OAAO;CAC5B,EACF;AACF;;;;;;;;AASA,SAAgB,gBAAgB,SAAuD;CACrF,OAAO,EACL,MAAM,KAAK,SAAS;EAClB,MAAM,WAAW,QAAQ,QAAQ;EACjC,IAAI,aAAa,KAAA,GACf,MAAM,IAAI,eAAe,kBAAkB,QAAQ,OAAO,sBAAsB,EAC9E,QAAQ,YACV,CAAC;EAEH,IAAI,CAAC,OAAO,OAAO,SAAS,QAAQ,GAClC,MAAM,IAAI,eAAe,2CAA2C,SAAS,IAAI,EAC/E,QAAQ,iBACV,CAAC;EAEH,OAAO,QAAQ,SAAS,CAAC,KAAK,OAAO;CACvC,EACF;AACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
// src/host/workflow-cache.ts
|
|
3
|
+
/**
|
|
4
|
+
* The workflow bodies a process has read, by content hash. A hash names one body for good, so
|
|
5
|
+
* what is kept never goes stale and nothing is ever taken back: a run reads its workflow from
|
|
6
|
+
* here instead of from the store, on every turn after the process's first for that version.
|
|
7
|
+
*
|
|
8
|
+
* One per host (a Worker isolate, a Lambda container, a Node process). Bounded, the least
|
|
9
|
+
* recently used body going first: versions pile up over a long life, and only the ones with
|
|
10
|
+
* journeys still running are asked for.
|
|
11
|
+
*/
|
|
12
|
+
var WorkflowCache = class {
|
|
13
|
+
limit;
|
|
14
|
+
kept = /* @__PURE__ */ new Map();
|
|
15
|
+
constructor(limit = 100) {
|
|
16
|
+
this.limit = limit;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The body under `contentHash`, from memory or through `load`. Undefined when the store has
|
|
20
|
+
* none — which is not remembered, so a body written later is found.
|
|
21
|
+
*/
|
|
22
|
+
async get(contentHash, load) {
|
|
23
|
+
const kept = this.kept.get(contentHash);
|
|
24
|
+
if (kept !== void 0) {
|
|
25
|
+
this.kept.delete(contentHash);
|
|
26
|
+
this.kept.set(contentHash, kept);
|
|
27
|
+
return kept;
|
|
28
|
+
}
|
|
29
|
+
const loaded = await load();
|
|
30
|
+
if (loaded === void 0) return void 0;
|
|
31
|
+
this.kept.set(contentHash, freeze(loaded));
|
|
32
|
+
if (this.kept.size > this.limit) {
|
|
33
|
+
const oldest = this.kept.keys().next().value;
|
|
34
|
+
if (oldest !== void 0) this.kept.delete(oldest);
|
|
35
|
+
}
|
|
36
|
+
return loaded;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function freeze(value) {
|
|
40
|
+
if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
|
|
41
|
+
Object.freeze(value);
|
|
42
|
+
for (const inner of Object.values(value)) freeze(inner);
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
exports.WorkflowCache = WorkflowCache;
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=workflow-cache.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-cache.cjs","names":[],"sources":["../../src/host/workflow-cache.ts"],"sourcesContent":["import type { WorkflowIR } from '../ir';\n\n/**\n * The workflow bodies a process has read, by content hash. A hash names one body for good, so\n * what is kept never goes stale and nothing is ever taken back: a run reads its workflow from\n * here instead of from the store, on every turn after the process's first for that version.\n *\n * One per host (a Worker isolate, a Lambda container, a Node process). Bounded, the least\n * recently used body going first: versions pile up over a long life, and only the ones with\n * journeys still running are asked for.\n */\nexport class WorkflowCache {\n private readonly kept = new Map<string, WorkflowIR>();\n\n constructor(private readonly limit = 100) {}\n\n /**\n * The body under `contentHash`, from memory or through `load`. Undefined when the store has\n * none — which is not remembered, so a body written later is found.\n */\n async get(\n contentHash: string,\n load: () => Promise<WorkflowIR | undefined>\n ): Promise<WorkflowIR | undefined> {\n const kept = this.kept.get(contentHash);\n if (kept !== undefined) {\n // Moved to the end: a Map keeps insertion order, so the front is the least recently used\n this.kept.delete(contentHash);\n this.kept.set(contentHash, kept);\n return kept;\n }\n const loaded = await load();\n if (loaded === undefined) return undefined;\n // Shared by every run of this version from here on: nobody may change it\n this.kept.set(contentHash, freeze(loaded));\n if (this.kept.size > this.limit) {\n const oldest = this.kept.keys().next().value;\n if (oldest !== undefined) this.kept.delete(oldest);\n }\n return loaded;\n }\n}\n\nfunction freeze<T>(value: T): T {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) return value;\n Object.freeze(value);\n for (const inner of Object.values(value)) freeze(inner);\n return value;\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAa,gBAAb,MAA2B;CAGI;CAFZ,uBAAO,IAAI,IAAwB;CAEpD,YAA6B,QAAQ,KAAK;EAAb,KAAA,QAAA;CAAc;;;;;CAM3C,MAAM,IACJ,aACA,MACiC;EACjC,MAAM,OAAO,KAAK,KAAK,IAAI,WAAW;EACtC,IAAI,SAAS,KAAA,GAAW;GAEtB,KAAK,KAAK,OAAO,WAAW;GAC5B,KAAK,KAAK,IAAI,aAAa,IAAI;GAC/B,OAAO;EACT;EACA,MAAM,SAAS,MAAM,KAAK;EAC1B,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;EAEjC,KAAK,KAAK,IAAI,aAAa,OAAO,MAAM,CAAC;EACzC,IAAI,KAAK,KAAK,OAAO,KAAK,OAAO;GAC/B,MAAM,SAAS,KAAK,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;GACvC,IAAI,WAAW,KAAA,GAAW,KAAK,KAAK,OAAO,MAAM;EACnD;EACA,OAAO;CACT;AACF;AAEA,SAAS,OAAU,OAAa;CAC9B,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GAAG,OAAO;CAClF,OAAO,OAAO,KAAK;CACnB,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,OAAO,KAAK;CACtD,OAAO;AACT"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WorkflowIR } from "../ir.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* The workflow bodies a process has read, by content hash. A hash names one body for good, so
|
|
4
|
+
* what is kept never goes stale and nothing is ever taken back: a run reads its workflow from
|
|
5
|
+
* here instead of from the store, on every turn after the process's first for that version.
|
|
6
|
+
*
|
|
7
|
+
* One per host (a Worker isolate, a Lambda container, a Node process). Bounded, the least
|
|
8
|
+
* recently used body going first: versions pile up over a long life, and only the ones with
|
|
9
|
+
* journeys still running are asked for.
|
|
10
|
+
*/
|
|
11
|
+
export declare class WorkflowCache {
|
|
12
|
+
private readonly limit;
|
|
13
|
+
private readonly kept;
|
|
14
|
+
constructor(limit?: number);
|
|
15
|
+
/**
|
|
16
|
+
* The body under `contentHash`, from memory or through `load`. Undefined when the store has
|
|
17
|
+
* none — which is not remembered, so a body written later is found.
|
|
18
|
+
*/
|
|
19
|
+
get(contentHash: string, load: () => Promise<WorkflowIR | undefined>): Promise<WorkflowIR | undefined>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=workflow-cache.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-cache.d.cts","names":[],"sources":["../../src/host/workflow-cache.ts"],"mappings":";;;;;;;;;;qBAWa;mBAGkB;mBAFZ;EAEjB,YAA6B;;;;;EAMvB,IACJ,qBACA,YAAY,QAAQ,0BACnB,QAAQ"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { WorkflowIR } from "../ir.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* The workflow bodies a process has read, by content hash. A hash names one body for good, so
|
|
4
|
+
* what is kept never goes stale and nothing is ever taken back: a run reads its workflow from
|
|
5
|
+
* here instead of from the store, on every turn after the process's first for that version.
|
|
6
|
+
*
|
|
7
|
+
* One per host (a Worker isolate, a Lambda container, a Node process). Bounded, the least
|
|
8
|
+
* recently used body going first: versions pile up over a long life, and only the ones with
|
|
9
|
+
* journeys still running are asked for.
|
|
10
|
+
*/
|
|
11
|
+
export declare class WorkflowCache {
|
|
12
|
+
private readonly limit;
|
|
13
|
+
private readonly kept;
|
|
14
|
+
constructor(limit?: number);
|
|
15
|
+
/**
|
|
16
|
+
* The body under `contentHash`, from memory or through `load`. Undefined when the store has
|
|
17
|
+
* none — which is not remembered, so a body written later is found.
|
|
18
|
+
*/
|
|
19
|
+
get(contentHash: string, load: () => Promise<WorkflowIR | undefined>): Promise<WorkflowIR | undefined>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=workflow-cache.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-cache.d.mts","names":[],"sources":["../../src/host/workflow-cache.ts"],"mappings":";;;;;;;;;;qBAWa;mBAGkB;mBAFZ;EAEjB,YAA6B;;;;;EAMvB,IACJ,qBACA,YAAY,QAAQ,0BACnB,QAAQ"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// src/host/workflow-cache.ts
|
|
2
|
+
/**
|
|
3
|
+
* The workflow bodies a process has read, by content hash. A hash names one body for good, so
|
|
4
|
+
* what is kept never goes stale and nothing is ever taken back: a run reads its workflow from
|
|
5
|
+
* here instead of from the store, on every turn after the process's first for that version.
|
|
6
|
+
*
|
|
7
|
+
* One per host (a Worker isolate, a Lambda container, a Node process). Bounded, the least
|
|
8
|
+
* recently used body going first: versions pile up over a long life, and only the ones with
|
|
9
|
+
* journeys still running are asked for.
|
|
10
|
+
*/
|
|
11
|
+
var WorkflowCache = class {
|
|
12
|
+
limit;
|
|
13
|
+
kept = /* @__PURE__ */ new Map();
|
|
14
|
+
constructor(limit = 100) {
|
|
15
|
+
this.limit = limit;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The body under `contentHash`, from memory or through `load`. Undefined when the store has
|
|
19
|
+
* none — which is not remembered, so a body written later is found.
|
|
20
|
+
*/
|
|
21
|
+
async get(contentHash, load) {
|
|
22
|
+
const kept = this.kept.get(contentHash);
|
|
23
|
+
if (kept !== void 0) {
|
|
24
|
+
this.kept.delete(contentHash);
|
|
25
|
+
this.kept.set(contentHash, kept);
|
|
26
|
+
return kept;
|
|
27
|
+
}
|
|
28
|
+
const loaded = await load();
|
|
29
|
+
if (loaded === void 0) return void 0;
|
|
30
|
+
this.kept.set(contentHash, freeze(loaded));
|
|
31
|
+
if (this.kept.size > this.limit) {
|
|
32
|
+
const oldest = this.kept.keys().next().value;
|
|
33
|
+
if (oldest !== void 0) this.kept.delete(oldest);
|
|
34
|
+
}
|
|
35
|
+
return loaded;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function freeze(value) {
|
|
39
|
+
if (typeof value !== "object" || value === null || Object.isFrozen(value)) return value;
|
|
40
|
+
Object.freeze(value);
|
|
41
|
+
for (const inner of Object.values(value)) freeze(inner);
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
export { WorkflowCache };
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=workflow-cache.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow-cache.mjs","names":[],"sources":["../../src/host/workflow-cache.ts"],"sourcesContent":["import type { WorkflowIR } from '../ir';\n\n/**\n * The workflow bodies a process has read, by content hash. A hash names one body for good, so\n * what is kept never goes stale and nothing is ever taken back: a run reads its workflow from\n * here instead of from the store, on every turn after the process's first for that version.\n *\n * One per host (a Worker isolate, a Lambda container, a Node process). Bounded, the least\n * recently used body going first: versions pile up over a long life, and only the ones with\n * journeys still running are asked for.\n */\nexport class WorkflowCache {\n private readonly kept = new Map<string, WorkflowIR>();\n\n constructor(private readonly limit = 100) {}\n\n /**\n * The body under `contentHash`, from memory or through `load`. Undefined when the store has\n * none — which is not remembered, so a body written later is found.\n */\n async get(\n contentHash: string,\n load: () => Promise<WorkflowIR | undefined>\n ): Promise<WorkflowIR | undefined> {\n const kept = this.kept.get(contentHash);\n if (kept !== undefined) {\n // Moved to the end: a Map keeps insertion order, so the front is the least recently used\n this.kept.delete(contentHash);\n this.kept.set(contentHash, kept);\n return kept;\n }\n const loaded = await load();\n if (loaded === undefined) return undefined;\n // Shared by every run of this version from here on: nobody may change it\n this.kept.set(contentHash, freeze(loaded));\n if (this.kept.size > this.limit) {\n const oldest = this.kept.keys().next().value;\n if (oldest !== undefined) this.kept.delete(oldest);\n }\n return loaded;\n }\n}\n\nfunction freeze<T>(value: T): T {\n if (typeof value !== 'object' || value === null || Object.isFrozen(value)) return value;\n Object.freeze(value);\n for (const inner of Object.values(value)) freeze(inner);\n return value;\n}\n"],"mappings":";;;;;;;;;;AAWA,IAAa,gBAAb,MAA2B;CAGI;CAFZ,uBAAO,IAAI,IAAwB;CAEpD,YAA6B,QAAQ,KAAK;EAAb,KAAA,QAAA;CAAc;;;;;CAM3C,MAAM,IACJ,aACA,MACiC;EACjC,MAAM,OAAO,KAAK,KAAK,IAAI,WAAW;EACtC,IAAI,SAAS,KAAA,GAAW;GAEtB,KAAK,KAAK,OAAO,WAAW;GAC5B,KAAK,KAAK,IAAI,aAAa,IAAI;GAC/B,OAAO;EACT;EACA,MAAM,SAAS,MAAM,KAAK;EAC1B,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;EAEjC,KAAK,KAAK,IAAI,aAAa,OAAO,MAAM,CAAC;EACzC,IAAI,KAAK,KAAK,OAAO,KAAK,OAAO;GAC/B,MAAM,SAAS,KAAK,KAAK,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC;GACvC,IAAI,WAAW,KAAA,GAAW,KAAK,KAAK,OAAO,MAAM;EACnD;EACA,OAAO;CACT;AACF;AAEA,SAAS,OAAU,OAAa;CAC9B,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,SAAS,KAAK,GAAG,OAAO;CAClF,OAAO,OAAO,KAAK;CACnB,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,OAAO,KAAK;CACtD,OAAO;AACT"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let node_http2 = require("node:http2");
|
|
3
|
+
// src/http2-client.ts
|
|
4
|
+
function http2Sessions() {
|
|
5
|
+
const sessions = /* @__PURE__ */ new Map();
|
|
6
|
+
return {
|
|
7
|
+
session(origin) {
|
|
8
|
+
const existing = sessions.get(origin);
|
|
9
|
+
if (existing !== void 0 && !existing.closed && !existing.destroyed) return existing;
|
|
10
|
+
const created = (0, node_http2.connect)(origin);
|
|
11
|
+
const forget = () => {
|
|
12
|
+
if (sessions.get(origin) === created) sessions.delete(origin);
|
|
13
|
+
};
|
|
14
|
+
created.on("error", forget);
|
|
15
|
+
created.on("close", forget);
|
|
16
|
+
created.on("goaway", forget);
|
|
17
|
+
sessions.set(origin, created);
|
|
18
|
+
return created;
|
|
19
|
+
},
|
|
20
|
+
discard(origin, session) {
|
|
21
|
+
session.destroy();
|
|
22
|
+
if (sessions.get(origin) === session) sessions.delete(origin);
|
|
23
|
+
},
|
|
24
|
+
close() {
|
|
25
|
+
for (const open of sessions.values()) open.close();
|
|
26
|
+
sessions.clear();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* `fetch` over HTTP/2, for the senders that take one (`ApnsPushSender({ fetch })`). Only what a
|
|
32
|
+
* JSON API call needs: a method, string headers, a string or byte body, the status, headers and
|
|
33
|
+
* body back.
|
|
34
|
+
*/
|
|
35
|
+
function http2Fetch(pool = http2Sessions(), options = {}) {
|
|
36
|
+
const timeoutMs = options.timeoutMs ?? 1e4;
|
|
37
|
+
return async (input, init) => {
|
|
38
|
+
const request = new Request(input, init);
|
|
39
|
+
const url = new URL(request.url);
|
|
40
|
+
const body = request.body === null ? void 0 : Buffer.from(await request.arrayBuffer());
|
|
41
|
+
const headers = {
|
|
42
|
+
":method": request.method,
|
|
43
|
+
":path": `${url.pathname}${url.search}`
|
|
44
|
+
};
|
|
45
|
+
request.headers.forEach((value, name) => {
|
|
46
|
+
headers[name] = value;
|
|
47
|
+
});
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
let session;
|
|
50
|
+
let stream;
|
|
51
|
+
try {
|
|
52
|
+
session = pool.session(url.origin);
|
|
53
|
+
stream = session.request(headers);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
let status = 502;
|
|
59
|
+
const responseHeaders = new Headers();
|
|
60
|
+
const chunks = [];
|
|
61
|
+
stream.on("response", (received) => {
|
|
62
|
+
status = received[":status"] ?? 502;
|
|
63
|
+
for (const [name, value] of Object.entries(received)) {
|
|
64
|
+
if (name.startsWith(":") || value === void 0) continue;
|
|
65
|
+
responseHeaders.set(name, Array.isArray(value) ? value.join(", ") : value);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
stream.on("data", (chunk) => chunks.push(chunk));
|
|
69
|
+
stream.on("end", () => {
|
|
70
|
+
const bytes = Buffer.concat(chunks);
|
|
71
|
+
resolve(new Response(status === 204 || status === 304 || bytes.length === 0 ? null : bytes, {
|
|
72
|
+
status,
|
|
73
|
+
headers: responseHeaders
|
|
74
|
+
}));
|
|
75
|
+
});
|
|
76
|
+
stream.on("error", reject);
|
|
77
|
+
stream.setTimeout(timeoutMs, () => {
|
|
78
|
+
stream.close();
|
|
79
|
+
pool.discard(url.origin, session);
|
|
80
|
+
reject(/* @__PURE__ */ new Error(`HTTP/2 request to ${url.origin} timed out after ${timeoutMs} ms`));
|
|
81
|
+
});
|
|
82
|
+
stream.end(body);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
exports.http2Fetch = http2Fetch;
|
|
87
|
+
exports.http2Sessions = http2Sessions;
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=http2-client.cjs.map
|