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
package/dist/config.cjs
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let zod_mini = require("zod/mini");
|
|
4
|
+
require("./dsl/index.cjs");
|
|
5
|
+
const require_dsl_bundle = require("./dsl/bundle.cjs");
|
|
6
|
+
const require_dsl_flow = require("./dsl/flow.cjs");
|
|
7
|
+
const require_template_rules = require("./template-rules.cjs");
|
|
8
|
+
const require_templates = require("./templates.cjs");
|
|
9
|
+
zod_mini = require_runtime.__toESM(zod_mini, 1);
|
|
10
|
+
// src/config.ts
|
|
11
|
+
function defineConfig(definition) {
|
|
12
|
+
return {
|
|
13
|
+
kind: "journey-config",
|
|
14
|
+
...definition
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function isConfig(value) {
|
|
18
|
+
return typeof value === "object" && value !== null && value.kind === "journey-config";
|
|
19
|
+
}
|
|
20
|
+
/** The APNs environment for `mode`: the configured one, else production only for production. */
|
|
21
|
+
function apnsEnvironment(config, mode) {
|
|
22
|
+
return config.environment?.[mode] ?? (mode === "production" ? "production" : "sandbox");
|
|
23
|
+
}
|
|
24
|
+
/** A message node the config's registries cannot serve, or whose literal props its template refuses. */
|
|
25
|
+
var ConfigCompileError = class extends Error {
|
|
26
|
+
name = "ConfigCompileError";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Compile the config: the bundle `compileBundle` would produce, with the
|
|
30
|
+
* template manifest generated from the registry (every registered template,
|
|
31
|
+
* by id, not a hand-kept list). The registry is checked first, used or not:
|
|
32
|
+
* every entry is a template of its channel with an id, an id is registered
|
|
33
|
+
* once per channel, and every email template's metadata is valid, as is the
|
|
34
|
+
* config's `email` (which replaced `emails`: a config still carrying it fails),
|
|
35
|
+
* and every email and push template's `topic` is one the contract declares (a
|
|
36
|
+
* template with a topic under a config whose contract declares none fails too).
|
|
37
|
+
* Then every message node is checked against it — an
|
|
38
|
+
* unregistered or cross-channel template fails with the workflow, node and
|
|
39
|
+
* channel named, and so does a literal prop the template's schema refuses (a
|
|
40
|
+
* missing required prop, an undeclared one, a wrong literal) — and every
|
|
41
|
+
* definition a workflow sends must be the very object registered under its id,
|
|
42
|
+
* not merely one with the same id. User-property references cannot be parsed
|
|
43
|
+
* here (their values exist only at send time) — they are checked by name only,
|
|
44
|
+
* and parsed before sending.
|
|
45
|
+
*/
|
|
46
|
+
function compileConfig(config) {
|
|
47
|
+
const index = registryIndex(config);
|
|
48
|
+
const bundle = require_dsl_bundle.compileBundle({
|
|
49
|
+
workflows: config.workflows,
|
|
50
|
+
...config.segments === void 0 ? {} : { segments: config.segments },
|
|
51
|
+
...config.actions === void 0 ? {} : { actions: config.actions },
|
|
52
|
+
templates: TEMPLATE_CHANNELS.flatMap((channel) => [...index[channel].values()]),
|
|
53
|
+
subscriptions: { topics: config.contract?.topics ?? [] }
|
|
54
|
+
});
|
|
55
|
+
bundle.workflows.forEach((workflow, i) => {
|
|
56
|
+
checkTriggerRefs(workflow, config);
|
|
57
|
+
checkMessages(workflow, workflow.flow, index, config);
|
|
58
|
+
checkUses(workflow, config.workflows[i], index, config);
|
|
59
|
+
});
|
|
60
|
+
return bundle;
|
|
61
|
+
}
|
|
62
|
+
const TEMPLATE_CHANNELS = [
|
|
63
|
+
"email",
|
|
64
|
+
"push",
|
|
65
|
+
"discord",
|
|
66
|
+
"slack"
|
|
67
|
+
];
|
|
68
|
+
/**
|
|
69
|
+
* The config's template registries, indexed by channel and id, after the checks `compileConfig`
|
|
70
|
+
* documents (every entry a template of its channel, ids registered once, valid email metadata and
|
|
71
|
+
* `email` config, topics the contract declares). Fails with `ConfigCompileError`.
|
|
72
|
+
*/
|
|
73
|
+
function registryIndex(config) {
|
|
74
|
+
try {
|
|
75
|
+
const email = require_templates.indexTemplates("email", config.templates?.email);
|
|
76
|
+
const push = require_templates.indexTemplates("push", config.templates?.push);
|
|
77
|
+
require_template_rules.assertEmailConfig(config, email.values());
|
|
78
|
+
for (const template of push.values()) require_template_rules.assertTemplateTopic(template, `push template '${template.id}'`, "push", true);
|
|
79
|
+
const declared = config.contract?.topics ?? [];
|
|
80
|
+
assertTopicsDeclared("email", email.values(), declared);
|
|
81
|
+
assertTopicsDeclared("push", push.values(), declared);
|
|
82
|
+
return {
|
|
83
|
+
email,
|
|
84
|
+
push,
|
|
85
|
+
discord: require_templates.indexTemplates("discord", config.templates?.discord),
|
|
86
|
+
slack: require_templates.indexTemplates("slack", config.templates?.slack)
|
|
87
|
+
};
|
|
88
|
+
} catch (error) {
|
|
89
|
+
throw new ConfigCompileError(error.message);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Every topic template names a topic the contract declares: the engine checks opt-outs by topic,
|
|
94
|
+
* so one the producer cannot set (`JourneyClient.setSubscriptions`) would be a topic nobody
|
|
95
|
+
* can opt out of through the app.
|
|
96
|
+
*/
|
|
97
|
+
function assertTopicsDeclared(channel, templates, declared) {
|
|
98
|
+
const known = new Set(declared);
|
|
99
|
+
for (const template of templates) {
|
|
100
|
+
if (template.topic === null || known.has(template.topic)) continue;
|
|
101
|
+
const list = declared.length === 0 ? "the contract declares no topics (defineContract({ subscriptions: { topics: [...] } }))" : `the contract declares ${declared.map((topic) => `'${topic}'`).join(", ")}`;
|
|
102
|
+
throw new TypeError(`${channel} template '${template.id}': topic '${template.topic}' is not declared — ${list}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** The channel's templates by id; undefined for a channel templates cannot be declared for. */
|
|
106
|
+
function indexOf(index, channel) {
|
|
107
|
+
return TEMPLATE_CHANNELS.includes(channel) ? index[channel] : void 0;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* The definitions a workflow sends against the registered ones: same id is not enough — a
|
|
111
|
+
* workflow typed by one definition and a registry holding another under that id would render
|
|
112
|
+
* with a schema the call was never checked against.
|
|
113
|
+
*/
|
|
114
|
+
function checkUses(workflow, builder, index, config) {
|
|
115
|
+
for (const { template, loc } of require_dsl_flow.templateUses(builder)) {
|
|
116
|
+
const channel = require_templates.CHANNEL_OF[template.kind];
|
|
117
|
+
const registered = index[channel].get(template.id);
|
|
118
|
+
if (registered === template) continue;
|
|
119
|
+
const at = loc === void 0 ? "" : ` (${loc.file}:${loc.line})`;
|
|
120
|
+
const where = `workflow '${workflow.id}'${at}: ${channel} template '${template.id}'`;
|
|
121
|
+
if (registered === void 0) throw new ConfigCompileError(`${where} is not registered`);
|
|
122
|
+
throw new ConfigCompileError(`${where} is not the definition registered under that id (templates.${channel}.${Object.entries(config.templates?.[channel] ?? {}).find(([, entry]) => entry === registered)?.[0]}) — two definitions share the id`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** A field that may be left out: optional, or with a default the schema fills in. */
|
|
126
|
+
function canBeOmitted(schema) {
|
|
127
|
+
const type = schema._zod.def.type;
|
|
128
|
+
return type === "optional" || type === "default" || type === "prefault";
|
|
129
|
+
}
|
|
130
|
+
function checkMessages(workflow, nodes, index, config) {
|
|
131
|
+
for (const node of nodes) switch (node.type) {
|
|
132
|
+
case "message":
|
|
133
|
+
checkMessage(workflow, node, index, config);
|
|
134
|
+
break;
|
|
135
|
+
case "send_event":
|
|
136
|
+
checkEmit(workflow, node, config);
|
|
137
|
+
break;
|
|
138
|
+
case "branch":
|
|
139
|
+
for (const c of node.cases) checkMessages(workflow, c.flow, index, config);
|
|
140
|
+
if (node.otherwise) checkMessages(workflow, node.otherwise, index, config);
|
|
141
|
+
break;
|
|
142
|
+
case "cohort":
|
|
143
|
+
for (const arm of node.arms) checkMessages(workflow, arm.flow, index, config);
|
|
144
|
+
break;
|
|
145
|
+
case "wait_until": if (Array.isArray(node.onTimeout)) checkMessages(workflow, node.onTimeout, index, config);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Whether the registry can send this message node: the template is registered on the node's
|
|
150
|
+
* channel and takes the node's props (see `compileConfig`). Throws `ConfigCompileError` naming
|
|
151
|
+
* the workflow, node and what is wrong. Run at compile over the bundle being built, and again
|
|
152
|
+
* before a deploy over the IRs journeys are still running (`checkInFlight`), against the registry
|
|
153
|
+
* that would then serve them.
|
|
154
|
+
*/
|
|
155
|
+
function checkMessage(workflow, node, index, config) {
|
|
156
|
+
const where = `workflow '${workflow.id}' node ${node.id}`;
|
|
157
|
+
const registry = indexOf(index, node.channel);
|
|
158
|
+
if (registry === void 0) return;
|
|
159
|
+
const entry = registry.get(node.template);
|
|
160
|
+
if (entry === void 0) {
|
|
161
|
+
const other = TEMPLATE_CHANNELS.find((channel) => channel !== node.channel && index[channel].has(node.template));
|
|
162
|
+
const hint = other === void 0 ? "" : ` (it is registered as a ${other} template)`;
|
|
163
|
+
throw new ConfigCompileError(`${where}: ${node.channel} template '${node.template}' is not registered${hint}`);
|
|
164
|
+
}
|
|
165
|
+
const shape = entry.props._zod.def.shape;
|
|
166
|
+
const problems = [];
|
|
167
|
+
for (const [field, value] of Object.entries(node.props)) {
|
|
168
|
+
if (!Object.hasOwn(shape, field)) {
|
|
169
|
+
problems.push(`'${field}' is not a prop of the template`);
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (typeof value === "object" && value.type === "trigger_payload") continue;
|
|
173
|
+
if (typeof value === "object" && "type" in value) {
|
|
174
|
+
const profile = config.contract?.schemas.profile._zod.def;
|
|
175
|
+
if (profile !== void 0 && value.path !== "userId" && !Object.hasOwn(profile.shape, value.path)) problems.push(`'${field}' reads u.${value.path}, which the contract's profile does not declare`);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (!zod_mini.safeParse(shape[field], value).success) problems.push(`'${field}' = ${JSON.stringify(value)} is refused by the schema`);
|
|
179
|
+
}
|
|
180
|
+
for (const [field, schema] of Object.entries(shape)) if (!canBeOmitted(schema) && !Object.hasOwn(node.props, field)) problems.push(`required prop '${field}' is missing`);
|
|
181
|
+
if (problems.length > 0) throw new ConfigCompileError(`${where}: ${node.channel} '${node.template}': ${problems.join("; ")}`);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Every field a workflow reads from its trigger's payload is one the contract declares for that
|
|
185
|
+
* event, nested fields included. The DSL's types already say so for a workflow compiled now;
|
|
186
|
+
* this is the same check on IR, so it also runs before a deploy over the IRs journeys are still
|
|
187
|
+
* running (`checkInFlight`) — a field dropped from the contract would read as missing for the
|
|
188
|
+
* journeys that entered after, with nothing failing. Throws `ConfigCompileError`.
|
|
189
|
+
*/
|
|
190
|
+
function checkTriggerRefs(workflow, config) {
|
|
191
|
+
const contract = config.contract;
|
|
192
|
+
if (contract === void 0) return;
|
|
193
|
+
for (const use of require_dsl_bundle.triggerRefUses(workflow)) {
|
|
194
|
+
const where = `workflow '${workflow.id}' ${use.where}`;
|
|
195
|
+
if (!contract.isEvent(use.event)) throw new ConfigCompileError(`${where}: reads the payload of '${String(use.event)}', which is not in the contract`);
|
|
196
|
+
if (!declaresPath(contract.schemas.events[use.event], use.path.split("."))) throw new ConfigCompileError(`${where}: reads '${use.path}' from the payload of '${use.event}', which the contract does not declare for the event`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/** Whether an object schema declares the field at `keys`, looking through optional and nullable wrappers. */
|
|
200
|
+
function declaresPath(schema, keys) {
|
|
201
|
+
if (keys.length === 0) return true;
|
|
202
|
+
const [key, ...rest] = keys;
|
|
203
|
+
let def = schema._zod.def;
|
|
204
|
+
while ("innerType" in def) def = def.innerType._zod.def;
|
|
205
|
+
if (def.type !== "object") return true;
|
|
206
|
+
const shape = def.shape;
|
|
207
|
+
return Object.hasOwn(shape, key) && declaresPath(shape[key], rest);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Whether an object schema refuses keys it does not declare: `z.strictObject`
|
|
211
|
+
* sets its catchall to `never`; `z.object` strips unknown keys and
|
|
212
|
+
* `z.looseObject` passes them through, and neither refuses.
|
|
213
|
+
*/
|
|
214
|
+
function refusesUnknownKeys(schema) {
|
|
215
|
+
return schema._zod.def.catchall?._zod.def.type === "never";
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* An emitted event against the contract, as far as compile time can see: the
|
|
219
|
+
* event is declared, literal payload values parse against their field, no
|
|
220
|
+
* required field is missing, and — when the event's schema is strict — no
|
|
221
|
+
* literal field is undeclared (the Worker would refuse the whole event at
|
|
222
|
+
* emit time, failing the journey where the compile could have failed the
|
|
223
|
+
* build). Values read from the profile are checked when the event is emitted,
|
|
224
|
+
* by the same contract. Run at compile, and again before a deploy over the IRs journeys are
|
|
225
|
+
* still running (`checkInFlight`), against the contract that would then take their events.
|
|
226
|
+
*/
|
|
227
|
+
function checkEmit(workflow, node, config) {
|
|
228
|
+
const contract = config.contract;
|
|
229
|
+
if (contract === void 0) return;
|
|
230
|
+
const where = `workflow '${workflow.id}' node ${node.id}`;
|
|
231
|
+
if (!contract.isEvent(node.event)) throw new ConfigCompileError(`${where}: emits '${String(node.event)}', which is not in the contract`);
|
|
232
|
+
const schema = contract.schemas.events[node.event];
|
|
233
|
+
const shape = schema._zod.def.shape;
|
|
234
|
+
const strict = refusesUnknownKeys(schema);
|
|
235
|
+
const problems = [];
|
|
236
|
+
for (const [field, value] of Object.entries(node.payload)) {
|
|
237
|
+
if (typeof value === "object" && "type" in value) continue;
|
|
238
|
+
if (!Object.hasOwn(shape, field)) {
|
|
239
|
+
if (strict) problems.push(`'${field}' is not a field the contract declares for the event`);
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if (!zod_mini.safeParse(shape[field], value).success) problems.push(`'${field}' = ${JSON.stringify(value)} is refused by the contract`);
|
|
243
|
+
}
|
|
244
|
+
for (const [field, fieldSchema] of Object.entries(shape)) if (!canBeOmitted(fieldSchema) && !Object.hasOwn(node.payload, field)) problems.push(`required field '${field}' is missing`);
|
|
245
|
+
if (problems.length > 0) throw new ConfigCompileError(`${where}: event '${node.event}': ${problems.join("; ")}`);
|
|
246
|
+
}
|
|
247
|
+
exports.ConfigCompileError = ConfigCompileError;
|
|
248
|
+
exports.apnsEnvironment = apnsEnvironment;
|
|
249
|
+
exports.checkEmit = checkEmit;
|
|
250
|
+
exports.checkMessage = checkMessage;
|
|
251
|
+
exports.checkTriggerRefs = checkTriggerRefs;
|
|
252
|
+
exports.compileConfig = compileConfig;
|
|
253
|
+
exports.defineConfig = defineConfig;
|
|
254
|
+
exports.isConfig = isConfig;
|
|
255
|
+
exports.registryIndex = registryIndex;
|
|
256
|
+
|
|
257
|
+
//# sourceMappingURL=config.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.cjs","names":["compileBundle","indexTemplates","assertEmailConfig","assertTemplateTopic","templateUses","CHANNEL_OF","z","triggerRefUses"],"sources":["../src/config.ts"],"sourcesContent":["import * as z from 'zod/mini';\nimport type * as core from 'zod/v4/core';\nimport type { Contract, Topic } from './contract';\nimport { type ActionRef, type SegmentRef, type WorkflowBuilder, compileBundle } from './dsl';\nimport { triggerRefUses } from './dsl/bundle';\nimport { templateUses } from './dsl/flow';\nimport type { BundleIR, ChannelIR, NodeIR, WorkflowIR } from './ir';\nimport type { JourneyMode, JourneyRuntimeConfig } from './runtime';\nimport { type EmailConfig, assertEmailConfig, assertTemplateTopic } from './template-rules';\nimport {\n type AnyTemplate,\n CHANNEL_OF,\n type EmailTemplate,\n type PushTemplate,\n type TemplateChannel,\n type TemplateRegistry,\n indexTemplates,\n} from './templates';\n\n/**\n * `workflow.config.ts` — the project's journey configuration, typed, flat and\n * committed with the code: what it deploys (workflows, segments, actions),\n * the template registries behind them, the contract every inbound event is\n * checked against, what the email templates share, and how the engine runs per\n * environment (time scale, APNs, FCM). The compiler (`compileConfig`), the\n * Worker (`journeyWorker({ config })`) and the Workflow Studio all read this\n * one object, so everything is registered exactly once:\n *\n * export default defineConfig({\n * title: 'Acme',\n * contract,\n * workflows, // [onboarding, notificationTest]\n * templates, // { email, push }: the definitions the workflows send\n * email: { unsubscribeUrl: 'https://acme.test/unsubscribe' },\n * runtime: { development: { timeScale: 600, logMessages: true } },\n * apns: { topic: 'io.acme.app', keyId: 'ABC123DEFG', teamId: 'TEAM123456' },\n * });\n *\n * Secrets are the one thing that stay out: a `.p8`, a service account, the\n * ingest bearer. The host reads them from its environment under fixed names\n * (see `JourneyEnv`), so the config says *which* key without carrying it. The\n * config is a source object (schemas, components, functions); only its\n * compiled bundle and preview-safe template data may cross to a browser.\n */\n\n/** Token-based APNs, the `.p8` auth key; the key itself is `APNS_PRIVATE_KEY_BASE64` in the environment. */\nexport interface ApnsConfig {\n /** The app's bundle id (`apns-topic`). */\n topic: string;\n /** The key's 10-character id. */\n keyId: string;\n /** The Apple Developer team id. */\n teamId: string;\n /**\n * Which APNs host each mode's device tokens belong to: `sandbox` for builds\n * signed with `aps-environment: development` (Xcode, the simulator),\n * `production` for App Store and TestFlight builds. Unlisted modes default\n * to `production` for the production mode and `sandbox` for every other.\n */\n environment?: Partial<Record<JourneyMode, 'sandbox' | 'production'>>;\n}\n\n/**\n * Standard Web Push for browsers (VAPID); the key pair is `VAPID_PUBLIC_KEY` /\n * `VAPID_PRIVATE_KEY` in the environment, and the site subscribes with the same public key.\n */\nexport interface WebPushConfig {\n /** Who push services may contact about this sender: `mailto:` or an `https:` URL. */\n subject: string;\n /**\n * The contract event a notification tap the browser reports (`opened_url`) is also recorded\n * as, with `{ message_id }`: the app reports its own taps as an event, and a service worker has\n * no session to do so — without this, browser opens reach the reports but not the conditions\n * (a `performed(e.push_opened)` segment). One event per copy, however often it is tapped.\n */\n openedEvent?: string;\n /**\n * Push service hosts accepted besides the browsers' own (FCM, Mozilla, WNS, Apple — see\n * `PUSH_SERVICE_HOSTS` in `sendwend/webpush`): an exact host, or `*.example.com` for\n * its subdomains. A subscription whose endpoint is on no listed host is refused at\n * registration and never sent to, since the endpoint is the client's word and the host\n * would be the one making the request.\n */\n pushServices?: readonly string[];\n}\n\n/** FCM HTTP v1 for Android; the service account is `GOOGLE_APPLICATION_CREDENTIALS_BASE64` in the environment. */\nexport interface FcmConfig {\n /** Android notification channel the pushes land in (`android.notification.channel_id`). */\n androidChannelId?: string;\n}\n\n/**\n * The engine's tables live in a Postgres schema of their own, so their short names (`event`,\n * `profile`, `message`, …) never meet the app's. `sendwend-studio generate` writes them as one drizzle\n * file on this schema; the host migrates it with its own tooling.\n */\nexport interface DatabaseConfig {\n /** The Postgres schema; `workflow` by default. */\n schema?: string;\n}\n\nexport interface JourneyConfigDefinition<C extends Contract | undefined = Contract | undefined> {\n /**\n * The product's name: the Studio's browser tab, and the title of the pages recipients see (the\n * one-click unsubscribe confirmation), so it names the product, not the tool.\n */\n title?: string;\n /** The shared `defineContract(...)` the Worker validates ingest against. */\n contract?: C;\n workflows: readonly WorkflowBuilder[];\n segments?: readonly SegmentRef[];\n actions?: readonly ActionRef[];\n /**\n * The template definitions, per channel; each is identified by its own `id`. With a\n * `contract`, an email or push template's `topic` must be one it declares — in the editor\n * here, and at compile for anything the types did not see.\n */\n templates?: TemplateRegistry<Topic<C>>;\n /** What every email template shares: the default unsubscribe link, how opens and clicks are judged. */\n email?: EmailConfig;\n /** How the engine behaves per mode (`development`, `production`, …): time scale, message logging. */\n runtime?: JourneyRuntimeConfig;\n apns?: ApnsConfig;\n fcm?: FcmConfig;\n webPush?: WebPushConfig;\n /** The schema the store keeps the engine's tables in. */\n database?: DatabaseConfig;\n}\n\nexport interface JourneyConfig extends JourneyConfigDefinition {\n readonly kind: 'journey-config';\n}\n\nexport function defineConfig<C extends Contract | undefined = undefined>(\n definition: JourneyConfigDefinition<C>\n): JourneyConfig {\n return { kind: 'journey-config', ...(definition as JourneyConfigDefinition) };\n}\n\nexport function isConfig(value: unknown): value is JourneyConfig {\n return (\n typeof value === 'object' &&\n value !== null &&\n (value as { kind?: unknown }).kind === 'journey-config'\n );\n}\n\n/** The APNs environment for `mode`: the configured one, else production only for production. */\nexport function apnsEnvironment(config: ApnsConfig, mode: JourneyMode): 'sandbox' | 'production' {\n return config.environment?.[mode] ?? (mode === 'production' ? 'production' : 'sandbox');\n}\n\n/** A message node the config's registries cannot serve, or whose literal props its template refuses. */\nexport class ConfigCompileError extends Error {\n override readonly name = 'ConfigCompileError';\n}\n\n/**\n * Compile the config: the bundle `compileBundle` would produce, with the\n * template manifest generated from the registry (every registered template,\n * by id, not a hand-kept list). The registry is checked first, used or not:\n * every entry is a template of its channel with an id, an id is registered\n * once per channel, and every email template's metadata is valid, as is the\n * config's `email` (which replaced `emails`: a config still carrying it fails),\n * and every email and push template's `topic` is one the contract declares (a\n * template with a topic under a config whose contract declares none fails too).\n * Then every message node is checked against it — an\n * unregistered or cross-channel template fails with the workflow, node and\n * channel named, and so does a literal prop the template's schema refuses (a\n * missing required prop, an undeclared one, a wrong literal) — and every\n * definition a workflow sends must be the very object registered under its id,\n * not merely one with the same id. User-property references cannot be parsed\n * here (their values exist only at send time) — they are checked by name only,\n * and parsed before sending.\n */\nexport function compileConfig(config: JourneyConfig): BundleIR {\n const index = registryIndex(config);\n const bundle = compileBundle({\n workflows: config.workflows,\n ...(config.segments === undefined ? {} : { segments: config.segments }),\n ...(config.actions === undefined ? {} : { actions: config.actions }),\n templates: TEMPLATE_CHANNELS.flatMap((channel) => [...index[channel].values()]),\n subscriptions: { topics: config.contract?.topics ?? [] },\n });\n bundle.workflows.forEach((workflow, i) => {\n checkTriggerRefs(workflow, config);\n checkMessages(workflow, workflow.flow, index, config);\n checkUses(workflow, config.workflows[i], index, config);\n });\n return bundle;\n}\n\nconst TEMPLATE_CHANNELS = ['email', 'push', 'discord', 'slack'] as const;\n\n/**\n * The config's template registries, indexed by channel and id, after the checks `compileConfig`\n * documents (every entry a template of its channel, ids registered once, valid email metadata and\n * `email` config, topics the contract declares). Fails with `ConfigCompileError`.\n */\nexport function registryIndex(config: JourneyConfig): RegistryIndex {\n try {\n const email = indexTemplates('email', config.templates?.email);\n const push = indexTemplates('push', config.templates?.push);\n assertEmailConfig(config, email.values());\n for (const template of push.values()) {\n assertTemplateTopic(template, `push template '${template.id}'`, 'push', true);\n }\n const declared = config.contract?.topics ?? [];\n assertTopicsDeclared('email', email.values(), declared);\n assertTopicsDeclared('push', push.values(), declared);\n return {\n email,\n push,\n discord: indexTemplates('discord', config.templates?.discord),\n slack: indexTemplates('slack', config.templates?.slack),\n };\n } catch (error) {\n throw new ConfigCompileError((error as Error).message);\n }\n}\n\n/**\n * Every topic template names a topic the contract declares: the engine checks opt-outs by topic,\n * so one the producer cannot set (`JourneyClient.setSubscriptions`) would be a topic nobody\n * can opt out of through the app.\n */\nfunction assertTopicsDeclared(\n channel: 'email' | 'push',\n templates: Iterable<EmailTemplate | PushTemplate>,\n declared: readonly string[]\n) {\n const known = new Set(declared);\n for (const template of templates) {\n if (template.topic === null || known.has(template.topic)) continue;\n const list =\n declared.length === 0\n ? 'the contract declares no topics (defineContract({ subscriptions: { topics: [...] } }))'\n : `the contract declares ${declared.map((topic) => `'${topic}'`).join(', ')}`;\n throw new TypeError(\n `${channel} template '${template.id}': topic '${template.topic}' is not declared — ${list}`\n );\n }\n}\n\n/** The registry by id, per channel. */\nexport type RegistryIndex = Record<TemplateChannel, ReadonlyMap<string, AnyTemplate>>;\n\n/** The channel's templates by id; undefined for a channel templates cannot be declared for. */\nfunction indexOf(\n index: RegistryIndex,\n channel: ChannelIR\n): ReadonlyMap<string, AnyTemplate> | undefined {\n return (TEMPLATE_CHANNELS as readonly ChannelIR[]).includes(channel)\n ? index[channel as TemplateChannel]\n : undefined;\n}\n\n/**\n * The definitions a workflow sends against the registered ones: same id is not enough — a\n * workflow typed by one definition and a registry holding another under that id would render\n * with a schema the call was never checked against.\n */\nfunction checkUses(\n workflow: WorkflowIR,\n builder: WorkflowBuilder,\n index: RegistryIndex,\n config: JourneyConfig\n): void {\n for (const { template, loc } of templateUses(builder)) {\n const channel = CHANNEL_OF[template.kind];\n const registered = index[channel].get(template.id);\n if (registered === template) continue;\n const at = loc === undefined ? '' : ` (${loc.file}:${loc.line})`;\n const where = `workflow '${workflow.id}'${at}: ${channel} template '${template.id}'`;\n if (registered === undefined) throw new ConfigCompileError(`${where} is not registered`);\n const name = Object.entries(config.templates?.[channel] ?? {}).find(\n ([, entry]) => entry === registered\n )?.[0];\n throw new ConfigCompileError(\n `${where} is not the definition registered under that id (templates.${channel}.${name}) — two definitions share the id`\n );\n }\n}\n\n/** A field that may be left out: optional, or with a default the schema fills in. */\nfunction canBeOmitted(schema: core.$ZodType): boolean {\n const type = schema._zod.def.type;\n return type === 'optional' || type === 'default' || type === 'prefault';\n}\n\nfunction checkMessages(\n workflow: WorkflowIR,\n nodes: readonly NodeIR[],\n index: RegistryIndex,\n config: JourneyConfig\n): void {\n for (const node of nodes) {\n switch (node.type) {\n case 'message':\n checkMessage(workflow, node, index, config);\n break;\n case 'send_event':\n checkEmit(workflow, node, config);\n break;\n case 'branch':\n for (const c of node.cases) checkMessages(workflow, c.flow, index, config);\n if (node.otherwise) checkMessages(workflow, node.otherwise, index, config);\n break;\n case 'cohort':\n for (const arm of node.arms) checkMessages(workflow, arm.flow, index, config);\n break;\n case 'wait_until':\n if (Array.isArray(node.onTimeout)) checkMessages(workflow, node.onTimeout, index, config);\n break;\n default:\n break;\n }\n }\n}\n\n/**\n * Whether the registry can send this message node: the template is registered on the node's\n * channel and takes the node's props (see `compileConfig`). Throws `ConfigCompileError` naming\n * the workflow, node and what is wrong. Run at compile over the bundle being built, and again\n * before a deploy over the IRs journeys are still running (`checkInFlight`), against the registry\n * that would then serve them.\n */\nexport function checkMessage(\n workflow: WorkflowIR,\n node: Extract<NodeIR, { type: 'message' }>,\n index: RegistryIndex,\n config: JourneyConfig\n): void {\n const where = `workflow '${workflow.id}' node ${node.id}`;\n const registry = indexOf(index, node.channel);\n // Channels without template definitions (sms, …) are rendered by app-supplied senders\n if (registry === undefined) return;\n const entry = registry.get(node.template);\n if (entry === undefined) {\n const other = TEMPLATE_CHANNELS.find(\n (channel) => channel !== node.channel && index[channel].has(node.template)\n );\n const hint = other === undefined ? '' : ` (it is registered as a ${other} template)`;\n throw new ConfigCompileError(\n `${where}: ${node.channel} template '${node.template}' is not registered${hint}`\n );\n }\n const shape = (entry.props._zod.def as core.$ZodObjectDef).shape;\n const problems: string[] = [];\n for (const [field, value] of Object.entries(node.props)) {\n if (!Object.hasOwn(shape, field)) {\n problems.push(`'${field}' is not a prop of the template`);\n continue;\n }\n // A trigger payload ref's field is checked against the event's schema (checkTriggerRefs)\n if (typeof value === 'object' && value.type === 'trigger_payload') continue;\n if (typeof value === 'object' && 'type' in value) {\n // A user ref's value exists only at send time (parsed then); here its name can be checked\n const profile = config.contract?.schemas.profile._zod.def;\n if (\n profile !== undefined &&\n value.path !== 'userId' &&\n !Object.hasOwn(profile.shape, value.path)\n ) {\n problems.push(\n `'${field}' reads u.${value.path}, which the contract's profile does not declare`\n );\n }\n continue;\n }\n const result = z.safeParse(shape[field], value);\n if (!result.success)\n problems.push(`'${field}' = ${JSON.stringify(value)} is refused by the schema`);\n }\n for (const [field, schema] of Object.entries(shape)) {\n const optional = canBeOmitted(schema);\n if (!optional && !Object.hasOwn(node.props, field))\n problems.push(`required prop '${field}' is missing`);\n }\n if (problems.length > 0) {\n throw new ConfigCompileError(\n `${where}: ${node.channel} '${node.template}': ${problems.join('; ')}`\n );\n }\n}\n\n/**\n * Every field a workflow reads from its trigger's payload is one the contract declares for that\n * event, nested fields included. The DSL's types already say so for a workflow compiled now;\n * this is the same check on IR, so it also runs before a deploy over the IRs journeys are still\n * running (`checkInFlight`) — a field dropped from the contract would read as missing for the\n * journeys that entered after, with nothing failing. Throws `ConfigCompileError`.\n */\nexport function checkTriggerRefs(workflow: WorkflowIR, config: JourneyConfig): void {\n const contract = config.contract;\n if (contract === undefined) return;\n for (const use of triggerRefUses(workflow)) {\n const where = `workflow '${workflow.id}' ${use.where}`;\n if (!contract.isEvent(use.event)) {\n throw new ConfigCompileError(\n `${where}: reads the payload of '${String(use.event)}', which is not in the contract`\n );\n }\n if (!declaresPath(contract.schemas.events[use.event], use.path.split('.'))) {\n throw new ConfigCompileError(\n `${where}: reads '${use.path}' from the payload of '${use.event}', which the contract does not declare for the event`\n );\n }\n }\n}\n\n/** Whether an object schema declares the field at `keys`, looking through optional and nullable wrappers. */\nfunction declaresPath(schema: core.$ZodType, keys: readonly string[]): boolean {\n if (keys.length === 0) return true;\n const [key, ...rest] = keys as [string, ...string[]];\n let def = schema._zod.def;\n while ('innerType' in def) def = (def.innerType as core.$ZodType)._zod.def;\n // Past a field that is not an object (a record, a union, unknown) nothing more can be said\n if (def.type !== 'object') return true;\n const shape = (def as core.$ZodObjectDef).shape;\n return Object.hasOwn(shape, key) && declaresPath(shape[key], rest);\n}\n\n/**\n * Whether an object schema refuses keys it does not declare: `z.strictObject`\n * sets its catchall to `never`; `z.object` strips unknown keys and\n * `z.looseObject` passes them through, and neither refuses.\n */\nfunction refusesUnknownKeys(schema: core.$ZodType): boolean {\n return (schema._zod.def as core.$ZodObjectDef).catchall?._zod.def.type === 'never';\n}\n\n/**\n * An emitted event against the contract, as far as compile time can see: the\n * event is declared, literal payload values parse against their field, no\n * required field is missing, and — when the event's schema is strict — no\n * literal field is undeclared (the Worker would refuse the whole event at\n * emit time, failing the journey where the compile could have failed the\n * build). Values read from the profile are checked when the event is emitted,\n * by the same contract. Run at compile, and again before a deploy over the IRs journeys are\n * still running (`checkInFlight`), against the contract that would then take their events.\n */\nexport function checkEmit(\n workflow: WorkflowIR,\n node: Extract<NodeIR, { type: 'send_event' }>,\n config: JourneyConfig\n): void {\n const contract = config.contract;\n if (contract === undefined) return;\n const where = `workflow '${workflow.id}' node ${node.id}`;\n if (!contract.isEvent(node.event)) {\n throw new ConfigCompileError(\n `${where}: emits '${String(node.event)}', which is not in the contract`\n );\n }\n const schema = contract.schemas.events[node.event];\n const shape = (schema._zod.def as core.$ZodObjectDef).shape;\n const strict = refusesUnknownKeys(schema);\n const problems: string[] = [];\n for (const [field, value] of Object.entries(node.payload)) {\n if (typeof value === 'object' && 'type' in value) continue; // read at emit time\n if (!Object.hasOwn(shape, field)) {\n // A loose or stripping payload may carry extra fields; a strict one refuses them\n if (strict) problems.push(`'${field}' is not a field the contract declares for the event`);\n continue;\n }\n const result = z.safeParse(shape[field], value);\n if (!result.success)\n problems.push(`'${field}' = ${JSON.stringify(value)} is refused by the contract`);\n }\n for (const [field, fieldSchema] of Object.entries(shape)) {\n const optional = canBeOmitted(fieldSchema);\n if (!optional && !Object.hasOwn(node.payload, field))\n problems.push(`required field '${field}' is missing`);\n }\n if (problems.length > 0) {\n throw new ConfigCompileError(`${where}: event '${node.event}': ${problems.join('; ')}`);\n }\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { Contract, Topic } from "./contract.cjs";
|
|
2
|
+
import { ActionRef } from "./dsl/action.cjs";
|
|
3
|
+
import { SegmentRef } from "./dsl/condition.cjs";
|
|
4
|
+
import { WorkflowBuilder } from "./dsl/workflow.cjs";
|
|
5
|
+
import "./dsl/index.cjs";
|
|
6
|
+
import { BundleIR, NodeIR, WorkflowIR } from "./ir.cjs";
|
|
7
|
+
import { JourneyMode, JourneyRuntimeConfig } from "./runtime.cjs";
|
|
8
|
+
import { EmailConfig } from "./template-rules.cjs";
|
|
9
|
+
import { AnyTemplate, TemplateChannel, TemplateRegistry } from "./templates.cjs";
|
|
10
|
+
/**
|
|
11
|
+
* `workflow.config.ts` — the project's journey configuration, typed, flat and
|
|
12
|
+
* committed with the code: what it deploys (workflows, segments, actions),
|
|
13
|
+
* the template registries behind them, the contract every inbound event is
|
|
14
|
+
* checked against, what the email templates share, and how the engine runs per
|
|
15
|
+
* environment (time scale, APNs, FCM). The compiler (`compileConfig`), the
|
|
16
|
+
* Worker (`journeyWorker({ config })`) and the Workflow Studio all read this
|
|
17
|
+
* one object, so everything is registered exactly once:
|
|
18
|
+
*
|
|
19
|
+
* export default defineConfig({
|
|
20
|
+
* title: 'Acme',
|
|
21
|
+
* contract,
|
|
22
|
+
* workflows, // [onboarding, notificationTest]
|
|
23
|
+
* templates, // { email, push }: the definitions the workflows send
|
|
24
|
+
* email: { unsubscribeUrl: 'https://acme.test/unsubscribe' },
|
|
25
|
+
* runtime: { development: { timeScale: 600, logMessages: true } },
|
|
26
|
+
* apns: { topic: 'io.acme.app', keyId: 'ABC123DEFG', teamId: 'TEAM123456' },
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* Secrets are the one thing that stay out: a `.p8`, a service account, the
|
|
30
|
+
* ingest bearer. The host reads them from its environment under fixed names
|
|
31
|
+
* (see `JourneyEnv`), so the config says *which* key without carrying it. The
|
|
32
|
+
* config is a source object (schemas, components, functions); only its
|
|
33
|
+
* compiled bundle and preview-safe template data may cross to a browser.
|
|
34
|
+
*/
|
|
35
|
+
/** Token-based APNs, the `.p8` auth key; the key itself is `APNS_PRIVATE_KEY_BASE64` in the environment. */
|
|
36
|
+
export interface ApnsConfig {
|
|
37
|
+
/** The app's bundle id (`apns-topic`). */
|
|
38
|
+
topic: string;
|
|
39
|
+
/** The key's 10-character id. */
|
|
40
|
+
keyId: string;
|
|
41
|
+
/** The Apple Developer team id. */
|
|
42
|
+
teamId: string;
|
|
43
|
+
/**
|
|
44
|
+
* Which APNs host each mode's device tokens belong to: `sandbox` for builds
|
|
45
|
+
* signed with `aps-environment: development` (Xcode, the simulator),
|
|
46
|
+
* `production` for App Store and TestFlight builds. Unlisted modes default
|
|
47
|
+
* to `production` for the production mode and `sandbox` for every other.
|
|
48
|
+
*/
|
|
49
|
+
environment?: Partial<Record<JourneyMode, 'sandbox' | 'production'>>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Standard Web Push for browsers (VAPID); the key pair is `VAPID_PUBLIC_KEY` /
|
|
53
|
+
* `VAPID_PRIVATE_KEY` in the environment, and the site subscribes with the same public key.
|
|
54
|
+
*/
|
|
55
|
+
export interface WebPushConfig {
|
|
56
|
+
/** Who push services may contact about this sender: `mailto:` or an `https:` URL. */
|
|
57
|
+
subject: string;
|
|
58
|
+
/**
|
|
59
|
+
* The contract event a notification tap the browser reports (`opened_url`) is also recorded
|
|
60
|
+
* as, with `{ message_id }`: the app reports its own taps as an event, and a service worker has
|
|
61
|
+
* no session to do so — without this, browser opens reach the reports but not the conditions
|
|
62
|
+
* (a `performed(e.push_opened)` segment). One event per copy, however often it is tapped.
|
|
63
|
+
*/
|
|
64
|
+
openedEvent?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Push service hosts accepted besides the browsers' own (FCM, Mozilla, WNS, Apple — see
|
|
67
|
+
* `PUSH_SERVICE_HOSTS` in `sendwend/webpush`): an exact host, or `*.example.com` for
|
|
68
|
+
* its subdomains. A subscription whose endpoint is on no listed host is refused at
|
|
69
|
+
* registration and never sent to, since the endpoint is the client's word and the host
|
|
70
|
+
* would be the one making the request.
|
|
71
|
+
*/
|
|
72
|
+
pushServices?: readonly string[];
|
|
73
|
+
}
|
|
74
|
+
/** FCM HTTP v1 for Android; the service account is `GOOGLE_APPLICATION_CREDENTIALS_BASE64` in the environment. */
|
|
75
|
+
export interface FcmConfig {
|
|
76
|
+
/** Android notification channel the pushes land in (`android.notification.channel_id`). */
|
|
77
|
+
androidChannelId?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The engine's tables live in a Postgres schema of their own, so their short names (`event`,
|
|
81
|
+
* `profile`, `message`, …) never meet the app's. `sendwend-studio generate` writes them as one drizzle
|
|
82
|
+
* file on this schema; the host migrates it with its own tooling.
|
|
83
|
+
*/
|
|
84
|
+
export interface DatabaseConfig {
|
|
85
|
+
/** The Postgres schema; `workflow` by default. */
|
|
86
|
+
schema?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface JourneyConfigDefinition<C extends Contract | undefined = Contract | undefined> {
|
|
89
|
+
/**
|
|
90
|
+
* The product's name: the Studio's browser tab, and the title of the pages recipients see (the
|
|
91
|
+
* one-click unsubscribe confirmation), so it names the product, not the tool.
|
|
92
|
+
*/
|
|
93
|
+
title?: string;
|
|
94
|
+
/** The shared `defineContract(...)` the Worker validates ingest against. */
|
|
95
|
+
contract?: C;
|
|
96
|
+
workflows: readonly WorkflowBuilder[];
|
|
97
|
+
segments?: readonly SegmentRef[];
|
|
98
|
+
actions?: readonly ActionRef[];
|
|
99
|
+
/**
|
|
100
|
+
* The template definitions, per channel; each is identified by its own `id`. With a
|
|
101
|
+
* `contract`, an email or push template's `topic` must be one it declares — in the editor
|
|
102
|
+
* here, and at compile for anything the types did not see.
|
|
103
|
+
*/
|
|
104
|
+
templates?: TemplateRegistry<Topic<C>>;
|
|
105
|
+
/** What every email template shares: the default unsubscribe link, how opens and clicks are judged. */
|
|
106
|
+
email?: EmailConfig;
|
|
107
|
+
/** How the engine behaves per mode (`development`, `production`, …): time scale, message logging. */
|
|
108
|
+
runtime?: JourneyRuntimeConfig;
|
|
109
|
+
apns?: ApnsConfig;
|
|
110
|
+
fcm?: FcmConfig;
|
|
111
|
+
webPush?: WebPushConfig;
|
|
112
|
+
/** The schema the store keeps the engine's tables in. */
|
|
113
|
+
database?: DatabaseConfig;
|
|
114
|
+
}
|
|
115
|
+
export interface JourneyConfig extends JourneyConfigDefinition {
|
|
116
|
+
readonly kind: 'journey-config';
|
|
117
|
+
}
|
|
118
|
+
export declare function defineConfig<C extends Contract | undefined = undefined>(definition: JourneyConfigDefinition<C>): JourneyConfig;
|
|
119
|
+
export declare function isConfig(value: unknown): value is JourneyConfig;
|
|
120
|
+
/** The APNs environment for `mode`: the configured one, else production only for production. */
|
|
121
|
+
export declare function apnsEnvironment(config: ApnsConfig, mode: JourneyMode): 'sandbox' | 'production';
|
|
122
|
+
/** A message node the config's registries cannot serve, or whose literal props its template refuses. */
|
|
123
|
+
export declare class ConfigCompileError extends Error {
|
|
124
|
+
readonly name = "ConfigCompileError";
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Compile the config: the bundle `compileBundle` would produce, with the
|
|
128
|
+
* template manifest generated from the registry (every registered template,
|
|
129
|
+
* by id, not a hand-kept list). The registry is checked first, used or not:
|
|
130
|
+
* every entry is a template of its channel with an id, an id is registered
|
|
131
|
+
* once per channel, and every email template's metadata is valid, as is the
|
|
132
|
+
* config's `email` (which replaced `emails`: a config still carrying it fails),
|
|
133
|
+
* and every email and push template's `topic` is one the contract declares (a
|
|
134
|
+
* template with a topic under a config whose contract declares none fails too).
|
|
135
|
+
* Then every message node is checked against it — an
|
|
136
|
+
* unregistered or cross-channel template fails with the workflow, node and
|
|
137
|
+
* channel named, and so does a literal prop the template's schema refuses (a
|
|
138
|
+
* missing required prop, an undeclared one, a wrong literal) — and every
|
|
139
|
+
* definition a workflow sends must be the very object registered under its id,
|
|
140
|
+
* not merely one with the same id. User-property references cannot be parsed
|
|
141
|
+
* here (their values exist only at send time) — they are checked by name only,
|
|
142
|
+
* and parsed before sending.
|
|
143
|
+
*/
|
|
144
|
+
export declare function compileConfig(config: JourneyConfig): BundleIR;
|
|
145
|
+
/**
|
|
146
|
+
* The config's template registries, indexed by channel and id, after the checks `compileConfig`
|
|
147
|
+
* documents (every entry a template of its channel, ids registered once, valid email metadata and
|
|
148
|
+
* `email` config, topics the contract declares). Fails with `ConfigCompileError`.
|
|
149
|
+
*/
|
|
150
|
+
export declare function registryIndex(config: JourneyConfig): RegistryIndex;
|
|
151
|
+
/** The registry by id, per channel. */
|
|
152
|
+
export type RegistryIndex = Record<TemplateChannel, ReadonlyMap<string, AnyTemplate>>;
|
|
153
|
+
/**
|
|
154
|
+
* Whether the registry can send this message node: the template is registered on the node's
|
|
155
|
+
* channel and takes the node's props (see `compileConfig`). Throws `ConfigCompileError` naming
|
|
156
|
+
* the workflow, node and what is wrong. Run at compile over the bundle being built, and again
|
|
157
|
+
* before a deploy over the IRs journeys are still running (`checkInFlight`), against the registry
|
|
158
|
+
* that would then serve them.
|
|
159
|
+
*/
|
|
160
|
+
export declare function checkMessage(workflow: WorkflowIR, node: Extract<NodeIR, {
|
|
161
|
+
type: 'message';
|
|
162
|
+
}>, index: RegistryIndex, config: JourneyConfig): void;
|
|
163
|
+
/**
|
|
164
|
+
* Every field a workflow reads from its trigger's payload is one the contract declares for that
|
|
165
|
+
* event, nested fields included. The DSL's types already say so for a workflow compiled now;
|
|
166
|
+
* this is the same check on IR, so it also runs before a deploy over the IRs journeys are still
|
|
167
|
+
* running (`checkInFlight`) — a field dropped from the contract would read as missing for the
|
|
168
|
+
* journeys that entered after, with nothing failing. Throws `ConfigCompileError`.
|
|
169
|
+
*/
|
|
170
|
+
export declare function checkTriggerRefs(workflow: WorkflowIR, config: JourneyConfig): void;
|
|
171
|
+
/**
|
|
172
|
+
* An emitted event against the contract, as far as compile time can see: the
|
|
173
|
+
* event is declared, literal payload values parse against their field, no
|
|
174
|
+
* required field is missing, and — when the event's schema is strict — no
|
|
175
|
+
* literal field is undeclared (the Worker would refuse the whole event at
|
|
176
|
+
* emit time, failing the journey where the compile could have failed the
|
|
177
|
+
* build). Values read from the profile are checked when the event is emitted,
|
|
178
|
+
* by the same contract. Run at compile, and again before a deploy over the IRs journeys are
|
|
179
|
+
* still running (`checkInFlight`), against the contract that would then take their events.
|
|
180
|
+
*/
|
|
181
|
+
export declare function checkEmit(workflow: WorkflowIR, node: Extract<NodeIR, {
|
|
182
|
+
type: 'send_event';
|
|
183
|
+
}>, config: JourneyConfig): void;
|
|
184
|
+
//# sourceMappingURL=config.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.cts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CiB;;EAEf;;EAEA;;EAEA;;;;;;;EAOA,cAAc,QAAQ,OAAO;;;;;;iBAOd;;EAEf;;;;;;;EAOA;;;;;;;;EAQA;;;iBAIe;;EAEf;;;;;;;iBAQe;;EAEf;;iBAGe,wBAAwB,UAAU,uBAAuB;;;;;EAKxE;;EAEA,WAAW;EACX,oBAAoB;EACpB,oBAAoB;EACpB,mBAAmB;;;;;;EAMnB,YAAY,iBAAiB,MAAM;;EAEnC,QAAQ;;EAER,UAAU;EACV,OAAO;EACP,MAAM;EACN,UAAU;;EAEV,WAAW;;iBAGI,sBAAsB;WAC5B;;wBAGK,aAAa,UAAU,kCACrC,YAAY,wBAAwB,KACnC;wBAIa,SAAS,iBAAiB,SAAS;;wBASnC,gBAAgB,QAAQ,YAAY,MAAM;;qBAK7C,2BAA2B;WACpB;;;;;;;;;;;;;;;;;;;;wBAqBJ,cAAc,QAAQ,gBAAgB;;;;;;wBAwBtC,cAAc,QAAQ,gBAAgB;;YA8C1C,gBAAgB,OAAO,iBAAiB,oBAAoB;;;;;;;;wBAkFxD,aACd,UAAU,YACV,MAAM,QAAQ;EAAU;IACxB,OAAO,eACP,QAAQ;;;;;;;;wBA8DM,iBAAiB,UAAU,YAAY,QAAQ;;;;;;;;;;;wBAiD/C,UACd,UAAU,YACV,MAAM,QAAQ;EAAU;IACxB,QAAQ"}
|