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,49 @@
|
|
|
1
|
+
import { JourneyConfig } from "./config.cjs";
|
|
2
|
+
import { BundleIR, WorkflowIR } from "./ir.cjs";
|
|
3
|
+
import { JourneyStore } from "./store/index.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* In-flight compatibility: what a deploy would take away from the journeys still running.
|
|
6
|
+
*
|
|
7
|
+
* A journey is pinned to the workflow IR it entered on and runs it to completion, but the IR only
|
|
8
|
+
* *names* what it uses — a template by channel and key, a segment or an action by id — and those
|
|
9
|
+
* are resolved at the moment of use against the deployed bundle and the code serving it. That is
|
|
10
|
+
* the design (README "Versioning"): the latest content goes out, a segment is a live audience. It
|
|
11
|
+
* leaves one way to break a running journey — a deploy that removes or reshapes something a
|
|
12
|
+
* pinned IR still names — and these checks find it before the deploy, on the pinned IRs
|
|
13
|
+
* themselves, against the bundle and registry that would serve them. A compatible change (a
|
|
14
|
+
* reworded template, a new optional prop, a segment's condition) passes; an incompatible one (a
|
|
15
|
+
* template gone or moved to another channel, a new required prop, a segment or action removed,
|
|
16
|
+
* an event a journey emits or waits for gone from the contract, a trigger payload field a
|
|
17
|
+
* journey reads gone from the event's schema) is reported with the journeys it
|
|
18
|
+
* would break.
|
|
19
|
+
*
|
|
20
|
+
* Not checked: a profile field whose type changed under a template prop that reads it. The
|
|
21
|
+
* field's name is (`checkMessage`); its value is parsed by the template at each send.
|
|
22
|
+
*/
|
|
23
|
+
/** One pinned version of a workflow: the IR and how many journeys are running on it. */
|
|
24
|
+
export interface PinnedWorkflow {
|
|
25
|
+
workflow: string;
|
|
26
|
+
contentHash: string;
|
|
27
|
+
/** Journeys with a `running` entry on this hash. */
|
|
28
|
+
running: number;
|
|
29
|
+
/** The stored IR; undefined when the store has no body for the hash (those journeys cannot run). */
|
|
30
|
+
ir: WorkflowIR | undefined;
|
|
31
|
+
}
|
|
32
|
+
export interface InFlightProblem {
|
|
33
|
+
workflow: string;
|
|
34
|
+
contentHash: string;
|
|
35
|
+
running: number;
|
|
36
|
+
/** What the bundle would take away, as a sentence naming the node where there is one. */
|
|
37
|
+
problem: string;
|
|
38
|
+
}
|
|
39
|
+
/** The pinned versions with running journeys, each with its stored IR. */
|
|
40
|
+
export declare function pinnedWorkflows(store: Pick<JourneyStore, 'runningPins' | 'getWorkflowIR'>): Promise<PinnedWorkflow[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Every way `bundle` (and `config`'s registry, when given — the templates the code would then
|
|
43
|
+
* serve) fails a pinned IR. Without a config only the bundle is checked: segments, actions, and
|
|
44
|
+
* the template manifest when the bundle carries one. Empty when the deploy is safe.
|
|
45
|
+
*/
|
|
46
|
+
export declare function checkInFlight(pinned: readonly PinnedWorkflow[], bundle: BundleIR, config?: JourneyConfig): InFlightProblem[];
|
|
47
|
+
/** The problems as lines, one per pinned version, with the journeys it carries. */
|
|
48
|
+
export declare function describeInFlight(problems: readonly InFlightProblem[]): string[];
|
|
49
|
+
//# sourceMappingURL=inflight.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inflight.d.cts","names":[],"sources":["../src/inflight.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAkCiB;EACf;EACA;;EAEA;;EAEA,IAAI;;iBAGW;EACf;EACA;EACA;;EAEA;;;wBAIoB,gBACpB,OAAO,KAAK,iDACX,QAAQ;;;;;;wBAiBK,cACd,iBAAiB,kBACjB,QAAQ,UACR,SAAS,gBACR;;wBAuGa,iBAAiB,mBAAmB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { JourneyConfig } from "./config.mjs";
|
|
2
|
+
import { BundleIR, WorkflowIR } from "./ir.mjs";
|
|
3
|
+
import { JourneyStore } from "./store/index.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* In-flight compatibility: what a deploy would take away from the journeys still running.
|
|
6
|
+
*
|
|
7
|
+
* A journey is pinned to the workflow IR it entered on and runs it to completion, but the IR only
|
|
8
|
+
* *names* what it uses — a template by channel and key, a segment or an action by id — and those
|
|
9
|
+
* are resolved at the moment of use against the deployed bundle and the code serving it. That is
|
|
10
|
+
* the design (README "Versioning"): the latest content goes out, a segment is a live audience. It
|
|
11
|
+
* leaves one way to break a running journey — a deploy that removes or reshapes something a
|
|
12
|
+
* pinned IR still names — and these checks find it before the deploy, on the pinned IRs
|
|
13
|
+
* themselves, against the bundle and registry that would serve them. A compatible change (a
|
|
14
|
+
* reworded template, a new optional prop, a segment's condition) passes; an incompatible one (a
|
|
15
|
+
* template gone or moved to another channel, a new required prop, a segment or action removed,
|
|
16
|
+
* an event a journey emits or waits for gone from the contract, a trigger payload field a
|
|
17
|
+
* journey reads gone from the event's schema) is reported with the journeys it
|
|
18
|
+
* would break.
|
|
19
|
+
*
|
|
20
|
+
* Not checked: a profile field whose type changed under a template prop that reads it. The
|
|
21
|
+
* field's name is (`checkMessage`); its value is parsed by the template at each send.
|
|
22
|
+
*/
|
|
23
|
+
/** One pinned version of a workflow: the IR and how many journeys are running on it. */
|
|
24
|
+
export interface PinnedWorkflow {
|
|
25
|
+
workflow: string;
|
|
26
|
+
contentHash: string;
|
|
27
|
+
/** Journeys with a `running` entry on this hash. */
|
|
28
|
+
running: number;
|
|
29
|
+
/** The stored IR; undefined when the store has no body for the hash (those journeys cannot run). */
|
|
30
|
+
ir: WorkflowIR | undefined;
|
|
31
|
+
}
|
|
32
|
+
export interface InFlightProblem {
|
|
33
|
+
workflow: string;
|
|
34
|
+
contentHash: string;
|
|
35
|
+
running: number;
|
|
36
|
+
/** What the bundle would take away, as a sentence naming the node where there is one. */
|
|
37
|
+
problem: string;
|
|
38
|
+
}
|
|
39
|
+
/** The pinned versions with running journeys, each with its stored IR. */
|
|
40
|
+
export declare function pinnedWorkflows(store: Pick<JourneyStore, 'runningPins' | 'getWorkflowIR'>): Promise<PinnedWorkflow[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Every way `bundle` (and `config`'s registry, when given — the templates the code would then
|
|
43
|
+
* serve) fails a pinned IR. Without a config only the bundle is checked: segments, actions, and
|
|
44
|
+
* the template manifest when the bundle carries one. Empty when the deploy is safe.
|
|
45
|
+
*/
|
|
46
|
+
export declare function checkInFlight(pinned: readonly PinnedWorkflow[], bundle: BundleIR, config?: JourneyConfig): InFlightProblem[];
|
|
47
|
+
/** The problems as lines, one per pinned version, with the journeys it carries. */
|
|
48
|
+
export declare function describeInFlight(problems: readonly InFlightProblem[]): string[];
|
|
49
|
+
//# sourceMappingURL=inflight.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inflight.d.mts","names":[],"sources":["../src/inflight.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAkCiB;EACf;EACA;;EAEA;;EAEA,IAAI;;iBAGW;EACf;EACA;EACA;;EAEA;;;wBAIoB,gBACpB,OAAO,KAAK,iDACX,QAAQ;;;;;;wBAiBK,cACd,iBAAiB,kBACjB,QAAQ,UACR,SAAS,gBACR;;wBAuGa,iBAAiB,mBAAmB"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ConfigCompileError, checkEmit, checkMessage, checkTriggerRefs, registryIndex } from "./config.mjs";
|
|
2
|
+
import { referencedSegments } from "./dsl/bundle.mjs";
|
|
3
|
+
import { nodesOf } from "./plan.mjs";
|
|
4
|
+
// src/inflight.ts
|
|
5
|
+
/** The pinned versions with running journeys, each with its stored IR. */
|
|
6
|
+
async function pinnedWorkflows(store) {
|
|
7
|
+
const pins = await store.runningPins();
|
|
8
|
+
return Promise.all(pins.map(async ({ workflow, contentHash, running }) => ({
|
|
9
|
+
workflow,
|
|
10
|
+
contentHash,
|
|
11
|
+
running,
|
|
12
|
+
ir: await store.getWorkflowIR(contentHash)
|
|
13
|
+
})));
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Every way `bundle` (and `config`'s registry, when given — the templates the code would then
|
|
17
|
+
* serve) fails a pinned IR. Without a config only the bundle is checked: segments, actions, and
|
|
18
|
+
* the template manifest when the bundle carries one. Empty when the deploy is safe.
|
|
19
|
+
*/
|
|
20
|
+
function checkInFlight(pinned, bundle, config) {
|
|
21
|
+
const segments = new Set(bundle.segments.map((s) => s.id));
|
|
22
|
+
const actions = new Set(bundle.actions.map((a) => a.name));
|
|
23
|
+
const templates = new Set(bundle.templates.map((t) => `${t.channel}:${t.key}`));
|
|
24
|
+
const index = config === void 0 ? void 0 : registryIndex(config);
|
|
25
|
+
const problems = [];
|
|
26
|
+
for (const pin of pinned) {
|
|
27
|
+
const report = (problem) => {
|
|
28
|
+
const { workflow, contentHash, running } = pin;
|
|
29
|
+
problems.push({
|
|
30
|
+
workflow,
|
|
31
|
+
contentHash,
|
|
32
|
+
running,
|
|
33
|
+
problem
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
if (pin.ir === void 0) {
|
|
37
|
+
report("its workflow body is not in the store");
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
for (const segment of referencedSegments(pin.ir)) if (!segments.has(segment)) report(`segment '${segment}' is not in the bundle`);
|
|
41
|
+
const contract = config?.contract;
|
|
42
|
+
if (contract !== void 0) {
|
|
43
|
+
for (const [event, where] of awaitedEvents(pin.ir)) if (!contract.isEvent(event)) report(`${where} waits for '${String(event)}', which is not in the contract`);
|
|
44
|
+
}
|
|
45
|
+
if (config !== void 0) try {
|
|
46
|
+
checkTriggerRefs(pin.ir, config);
|
|
47
|
+
} catch (error) {
|
|
48
|
+
if (!(error instanceof ConfigCompileError)) throw error;
|
|
49
|
+
report(error.message);
|
|
50
|
+
}
|
|
51
|
+
for (const node of nodesOf(pin.ir.flow)) {
|
|
52
|
+
if (node.type === "action" && !actions.has(node.action)) report(`node ${node.id}: action '${node.action}' is not in the bundle`);
|
|
53
|
+
if (node.type === "send_event" && config !== void 0) try {
|
|
54
|
+
checkEmit(pin.ir, node, config);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
if (!(error instanceof ConfigCompileError)) throw error;
|
|
57
|
+
report(error.message);
|
|
58
|
+
}
|
|
59
|
+
if (node.type !== "message") continue;
|
|
60
|
+
if (index !== void 0 && config !== void 0) try {
|
|
61
|
+
checkMessage(pin.ir, node, index, config);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
if (!(error instanceof ConfigCompileError)) throw error;
|
|
64
|
+
report(error.message);
|
|
65
|
+
}
|
|
66
|
+
else if (bundle.templates.length > 0) {
|
|
67
|
+
const key = `${node.channel}:${node.template}`;
|
|
68
|
+
if (!templates.has(key)) report(`node ${node.id}: ${node.channel} template '${node.template}' is not in the bundle`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return problems;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The events a running journey still waits for, each with where it waits: a `waitUntil`, the
|
|
76
|
+
* exit condition, the goal. Conditions that only look back (a branch, a filter, the trigger) are
|
|
77
|
+
* left out — the occurrences they count are in the log whatever the contract says now.
|
|
78
|
+
*/
|
|
79
|
+
function awaitedEvents(workflow) {
|
|
80
|
+
const awaited = [];
|
|
81
|
+
const collect = (condition, where) => {
|
|
82
|
+
switch (condition.type) {
|
|
83
|
+
case "and":
|
|
84
|
+
case "or":
|
|
85
|
+
for (const child of condition.conditions) collect(child, where);
|
|
86
|
+
break;
|
|
87
|
+
case "not":
|
|
88
|
+
collect(condition.condition, where);
|
|
89
|
+
break;
|
|
90
|
+
case "performed": awaited.push([condition.event, where]);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
if (workflow.exitWhen !== void 0) collect(workflow.exitWhen, "exitWhen");
|
|
94
|
+
if (workflow.goal !== void 0) collect(workflow.goal.condition, "the goal");
|
|
95
|
+
for (const node of nodesOf(workflow.flow)) if (node.type === "wait_until") collect(node.condition, `node ${node.id}`);
|
|
96
|
+
return awaited;
|
|
97
|
+
}
|
|
98
|
+
/** The problems as lines, one per pinned version, with the journeys it carries. */
|
|
99
|
+
function describeInFlight(problems) {
|
|
100
|
+
const byPin = /* @__PURE__ */ new Map();
|
|
101
|
+
for (const problem of problems) {
|
|
102
|
+
const key = `${problem.workflow}@${problem.contentHash}`;
|
|
103
|
+
byPin.set(key, [...byPin.get(key) ?? [], problem]);
|
|
104
|
+
}
|
|
105
|
+
return [...byPin.values()].map((group) => {
|
|
106
|
+
const [{ workflow, contentHash, running }] = group;
|
|
107
|
+
const journeys = `${running} running ${running === 1 ? "journey" : "journeys"}`;
|
|
108
|
+
return `${workflow}@${contentHash.slice(0, 8)} (${journeys}): ${group.map((p) => p.problem).join("; ")}`;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
export { checkInFlight, describeInFlight, pinnedWorkflows };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=inflight.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inflight.mjs","names":[],"sources":["../src/inflight.ts"],"sourcesContent":["import {\n ConfigCompileError,\n type JourneyConfig,\n checkEmit,\n checkMessage,\n checkTriggerRefs,\n registryIndex,\n} from './config';\nimport { referencedSegments } from './dsl/bundle';\nimport type { BundleIR, ConditionIR, WorkflowIR } from './ir';\nimport { nodesOf } from './plan';\nimport type { JourneyStore } from './store/index';\n\n/**\n * In-flight compatibility: what a deploy would take away from the journeys still running.\n *\n * A journey is pinned to the workflow IR it entered on and runs it to completion, but the IR only\n * *names* what it uses — a template by channel and key, a segment or an action by id — and those\n * are resolved at the moment of use against the deployed bundle and the code serving it. That is\n * the design (README \"Versioning\"): the latest content goes out, a segment is a live audience. It\n * leaves one way to break a running journey — a deploy that removes or reshapes something a\n * pinned IR still names — and these checks find it before the deploy, on the pinned IRs\n * themselves, against the bundle and registry that would serve them. A compatible change (a\n * reworded template, a new optional prop, a segment's condition) passes; an incompatible one (a\n * template gone or moved to another channel, a new required prop, a segment or action removed,\n * an event a journey emits or waits for gone from the contract, a trigger payload field a\n * journey reads gone from the event's schema) is reported with the journeys it\n * would break.\n *\n * Not checked: a profile field whose type changed under a template prop that reads it. The\n * field's name is (`checkMessage`); its value is parsed by the template at each send.\n */\n\n/** One pinned version of a workflow: the IR and how many journeys are running on it. */\nexport interface PinnedWorkflow {\n workflow: string;\n contentHash: string;\n /** Journeys with a `running` entry on this hash. */\n running: number;\n /** The stored IR; undefined when the store has no body for the hash (those journeys cannot run). */\n ir: WorkflowIR | undefined;\n}\n\nexport interface InFlightProblem {\n workflow: string;\n contentHash: string;\n running: number;\n /** What the bundle would take away, as a sentence naming the node where there is one. */\n problem: string;\n}\n\n/** The pinned versions with running journeys, each with its stored IR. */\nexport async function pinnedWorkflows(\n store: Pick<JourneyStore, 'runningPins' | 'getWorkflowIR'>\n): Promise<PinnedWorkflow[]> {\n const pins = await store.runningPins();\n return Promise.all(\n pins.map(async ({ workflow, contentHash, running }) => ({\n workflow,\n contentHash,\n running,\n ir: await store.getWorkflowIR(contentHash),\n }))\n );\n}\n\n/**\n * Every way `bundle` (and `config`'s registry, when given — the templates the code would then\n * serve) fails a pinned IR. Without a config only the bundle is checked: segments, actions, and\n * the template manifest when the bundle carries one. Empty when the deploy is safe.\n */\nexport function checkInFlight(\n pinned: readonly PinnedWorkflow[],\n bundle: BundleIR,\n config?: JourneyConfig\n): InFlightProblem[] {\n const segments = new Set(bundle.segments.map((s) => s.id));\n const actions = new Set(bundle.actions.map((a) => a.name));\n const templates = new Set(bundle.templates.map((t) => `${t.channel}:${t.key}`));\n const index = config === undefined ? undefined : registryIndex(config);\n const problems: InFlightProblem[] = [];\n for (const pin of pinned) {\n const report = (problem: string) => {\n const { workflow, contentHash, running } = pin;\n problems.push({ workflow, contentHash, running, problem });\n };\n if (pin.ir === undefined) {\n report('its workflow body is not in the store');\n continue;\n }\n for (const segment of referencedSegments(pin.ir)) {\n if (!segments.has(segment)) report(`segment '${segment}' is not in the bundle`);\n }\n const contract = config?.contract;\n if (contract !== undefined) {\n // An event the contract no longer declares is refused at ingest, so it never arrives\n // again: the journey would sit out its wait to the timeout, or never exit or convert\n for (const [event, where] of awaitedEvents(pin.ir)) {\n if (!contract.isEvent(event)) {\n report(`${where} waits for '${String(event)}', which is not in the contract`);\n }\n }\n }\n if (config !== undefined) {\n // A field gone from the contract reads as missing from then on, and nothing fails\n try {\n checkTriggerRefs(pin.ir, config);\n } catch (error) {\n if (!(error instanceof ConfigCompileError)) throw error;\n report(error.message);\n }\n }\n for (const node of nodesOf(pin.ir.flow)) {\n if (node.type === 'action' && !actions.has(node.action)) {\n report(`node ${node.id}: action '${node.action}' is not in the bundle`);\n }\n if (node.type === 'send_event' && config !== undefined) {\n // The emit is refused when it happens, and that failure is not retried\n try {\n checkEmit(pin.ir, node, config);\n } catch (error) {\n if (!(error instanceof ConfigCompileError)) throw error;\n report(error.message);\n }\n }\n if (node.type !== 'message') continue;\n if (index !== undefined && config !== undefined) {\n try {\n checkMessage(pin.ir, node, index, config);\n } catch (error) {\n if (!(error instanceof ConfigCompileError)) throw error;\n report(error.message);\n }\n } else if (bundle.templates.length > 0) {\n const key = `${node.channel}:${node.template}`;\n if (!templates.has(key)) {\n report(\n `node ${node.id}: ${node.channel} template '${node.template}' is not in the bundle`\n );\n }\n }\n }\n }\n return problems;\n}\n\n/**\n * The events a running journey still waits for, each with where it waits: a `waitUntil`, the\n * exit condition, the goal. Conditions that only look back (a branch, a filter, the trigger) are\n * left out — the occurrences they count are in the log whatever the contract says now.\n */\nfunction awaitedEvents(workflow: WorkflowIR): [event: string, where: string][] {\n const awaited: [string, string][] = [];\n const collect = (condition: ConditionIR, where: string): void => {\n switch (condition.type) {\n case 'and':\n case 'or':\n for (const child of condition.conditions) collect(child, where);\n break;\n case 'not':\n collect(condition.condition, where);\n break;\n case 'performed':\n awaited.push([condition.event, where]);\n break;\n default:\n break;\n }\n };\n if (workflow.exitWhen !== undefined) collect(workflow.exitWhen, 'exitWhen');\n if (workflow.goal !== undefined) collect(workflow.goal.condition, 'the goal');\n for (const node of nodesOf(workflow.flow)) {\n if (node.type === 'wait_until') collect(node.condition, `node ${node.id}`);\n }\n return awaited;\n}\n\n/** The problems as lines, one per pinned version, with the journeys it carries. */\nexport function describeInFlight(problems: readonly InFlightProblem[]): string[] {\n const byPin = new Map<string, InFlightProblem[]>();\n for (const problem of problems) {\n const key = `${problem.workflow}@${problem.contentHash}`;\n byPin.set(key, [...(byPin.get(key) ?? []), problem]);\n }\n return [...byPin.values()].map((group) => {\n const [{ workflow, contentHash, running }] = group as [InFlightProblem, ...InFlightProblem[]];\n const journeys = `${running} running ${running === 1 ? 'journey' : 'journeys'}`;\n return `${workflow}@${contentHash.slice(0, 8)} (${journeys}): ${group.map((p) => p.problem).join('; ')}`;\n });\n}\n"],"mappings":";;;;;AAoDA,eAAsB,gBACpB,OAC2B;CAC3B,MAAM,OAAO,MAAM,MAAM,YAAY;CACrC,OAAO,QAAQ,IACb,KAAK,IAAI,OAAO,EAAE,UAAU,aAAa,eAAe;EACtD;EACA;EACA;EACA,IAAI,MAAM,MAAM,cAAc,WAAW;CAC3C,EAAE,CACJ;AACF;;;;;;AAOA,SAAgB,cACd,QACA,QACA,QACmB;CACnB,MAAM,WAAW,IAAI,IAAI,OAAO,SAAS,KAAK,MAAM,EAAE,EAAE,CAAC;CACzD,MAAM,UAAU,IAAI,IAAI,OAAO,QAAQ,KAAK,MAAM,EAAE,IAAI,CAAC;CACzD,MAAM,YAAY,IAAI,IAAI,OAAO,UAAU,KAAK,MAAM,GAAG,EAAE,QAAQ,GAAG,EAAE,KAAK,CAAC;CAC9E,MAAM,QAAQ,WAAW,KAAA,IAAY,KAAA,IAAY,cAAc,MAAM;CACrE,MAAM,WAA8B,CAAC;CACrC,KAAK,MAAM,OAAO,QAAQ;EACxB,MAAM,UAAU,YAAoB;GAClC,MAAM,EAAE,UAAU,aAAa,YAAY;GAC3C,SAAS,KAAK;IAAE;IAAU;IAAa;IAAS;GAAQ,CAAC;EAC3D;EACA,IAAI,IAAI,OAAO,KAAA,GAAW;GACxB,OAAO,uCAAuC;GAC9C;EACF;EACA,KAAK,MAAM,WAAW,mBAAmB,IAAI,EAAE,GAC7C,IAAI,CAAC,SAAS,IAAI,OAAO,GAAG,OAAO,YAAY,QAAQ,uBAAuB;EAEhF,MAAM,WAAW,QAAQ;EACzB,IAAI,aAAa,KAAA,GAGV;QAAA,MAAM,CAAC,OAAO,UAAU,cAAc,IAAI,EAAE,GAC/C,IAAI,CAAC,SAAS,QAAQ,KAAK,GACzB,OAAO,GAAG,MAAM,cAAc,OAAO,KAAK,EAAE,gCAAgC;EAAA;EAIlF,IAAI,WAAW,KAAA,GAEb,IAAI;GACF,iBAAiB,IAAI,IAAI,MAAM;EACjC,SAAS,OAAO;GACd,IAAI,EAAE,iBAAiB,qBAAqB,MAAM;GAClD,OAAO,MAAM,OAAO;EACtB;EAEF,KAAK,MAAM,QAAQ,QAAQ,IAAI,GAAG,IAAI,GAAG;GACvC,IAAI,KAAK,SAAS,YAAY,CAAC,QAAQ,IAAI,KAAK,MAAM,GACpD,OAAO,QAAQ,KAAK,GAAG,YAAY,KAAK,OAAO,uBAAuB;GAExE,IAAI,KAAK,SAAS,gBAAgB,WAAW,KAAA,GAE3C,IAAI;IACF,UAAU,IAAI,IAAI,MAAM,MAAM;GAChC,SAAS,OAAO;IACd,IAAI,EAAE,iBAAiB,qBAAqB,MAAM;IAClD,OAAO,MAAM,OAAO;GACtB;GAEF,IAAI,KAAK,SAAS,WAAW;GAC7B,IAAI,UAAU,KAAA,KAAa,WAAW,KAAA,GACpC,IAAI;IACF,aAAa,IAAI,IAAI,MAAM,OAAO,MAAM;GAC1C,SAAS,OAAO;IACd,IAAI,EAAE,iBAAiB,qBAAqB,MAAM;IAClD,OAAO,MAAM,OAAO;GACtB;QACK,IAAI,OAAO,UAAU,SAAS,GAAG;IACtC,MAAM,MAAM,GAAG,KAAK,QAAQ,GAAG,KAAK;IACpC,IAAI,CAAC,UAAU,IAAI,GAAG,GACpB,OACE,QAAQ,KAAK,GAAG,IAAI,KAAK,QAAQ,aAAa,KAAK,SAAS,uBAC9D;GAEJ;EACF;CACF;CACA,OAAO;AACT;;;;;;AAOA,SAAS,cAAc,UAAwD;CAC7E,MAAM,UAA8B,CAAC;CACrC,MAAM,WAAW,WAAwB,UAAwB;EAC/D,QAAQ,UAAU,MAAlB;GACE,KAAK;GACL,KAAK;IACH,KAAK,MAAM,SAAS,UAAU,YAAY,QAAQ,OAAO,KAAK;IAC9D;GACF,KAAK;IACH,QAAQ,UAAU,WAAW,KAAK;IAClC;GACF,KAAK,aACH,QAAQ,KAAK,CAAC,UAAU,OAAO,KAAK,CAAC;EAIzC;CACF;CACA,IAAI,SAAS,aAAa,KAAA,GAAW,QAAQ,SAAS,UAAU,UAAU;CAC1E,IAAI,SAAS,SAAS,KAAA,GAAW,QAAQ,SAAS,KAAK,WAAW,UAAU;CAC5E,KAAK,MAAM,QAAQ,QAAQ,SAAS,IAAI,GACtC,IAAI,KAAK,SAAS,cAAc,QAAQ,KAAK,WAAW,QAAQ,KAAK,IAAI;CAE3E,OAAO;AACT;;AAGA,SAAgB,iBAAiB,UAAgD;CAC/E,MAAM,wBAAQ,IAAI,IAA+B;CACjD,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,MAAM,GAAG,QAAQ,SAAS,GAAG,QAAQ;EAC3C,MAAM,IAAI,KAAK,CAAC,GAAI,MAAM,IAAI,GAAG,KAAK,CAAC,GAAI,OAAO,CAAC;CACrD;CACA,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,UAAU;EACxC,MAAM,CAAC,EAAE,UAAU,aAAa,aAAa;EAC7C,MAAM,WAAW,GAAG,QAAQ,WAAW,YAAY,IAAI,YAAY;EACnE,OAAO,GAAG,SAAS,GAAG,YAAY,MAAM,GAAG,CAAC,EAAE,IAAI,SAAS,KAAK,MAAM,KAAK,MAAM,EAAE,OAAO,CAAC,CAAC,KAAK,IAAI;CACvG,CAAC;AACH"}
|
package/dist/ir.cjs
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
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
|
+
zod_mini = require_runtime.__toESM(zod_mini, 1);
|
|
5
|
+
// src/ir.ts
|
|
6
|
+
/**
|
|
7
|
+
* IR (Intermediate Representation) — what the DSL compiles to: serializable
|
|
8
|
+
* JSON. It is the three-way contract between the engine that interprets it,
|
|
9
|
+
* the UI (react-flow) that renders it, and diff / audit tooling.
|
|
10
|
+
*
|
|
11
|
+
* Validation strategy: the zod/mini schemas are the authoritative definition.
|
|
12
|
+
* TS types are either inferred from a schema or hand-written under the same
|
|
13
|
+
* name (zod cannot infer recursive types; the hand-written type is anchored
|
|
14
|
+
* with a ZodMiniType<T> annotation, so any drift fails to compile). IR crosses
|
|
15
|
+
* process boundaries (database, network, UI), so runtime validation is a must.
|
|
16
|
+
*
|
|
17
|
+
* ## Versioning (two independent axes)
|
|
18
|
+
*
|
|
19
|
+
* 1. IR format version (irVersion): evolution of the IR schema itself. Adding
|
|
20
|
+
* optional fields does not bump it; only structurally incompatible changes
|
|
21
|
+
* do (changing a discriminant, dropping a field, altering semantics).
|
|
22
|
+
* Writers always write the current version, and readers accept only it:
|
|
23
|
+
* every schema below takes `irVersion` as the literal `IR_VERSION`, and
|
|
24
|
+
* there is no reader for an earlier version nor a migrator to this one. A
|
|
25
|
+
* bump therefore strands what is stored — pinned IRs stop parsing and the
|
|
26
|
+
* journeys running on them fail — and `irVersion` is part of the hash, so
|
|
27
|
+
* every content hash changes with it. Until readers dispatch on irVersion
|
|
28
|
+
* and migrate, a bump is a breaking release that drains or clears the
|
|
29
|
+
* engine's data first (README "Upgrading to 12.0" was one).
|
|
30
|
+
* 2. Content version (contentHash): a content-addressed id for a single
|
|
31
|
+
* definition's **execution semantics** — the canonical-JSON hash after
|
|
32
|
+
* metadata (meta / label / reason) is stripped, see hash.ts. It is used to:
|
|
33
|
+
* - pin a version when a user enters, so an in-flight journey runs the
|
|
34
|
+
* pinned version to completion. The pin covers the workflow's own
|
|
35
|
+
* structure and nothing else, by design (README "Versioning"): a
|
|
36
|
+
* template, segment or action is named by id and resolved when it is
|
|
37
|
+
* used, so a journey sends the latest content and a segment is a live
|
|
38
|
+
* audience — what marketing automation does. What a deploy must not do
|
|
39
|
+
* is take away or reshape something a pinned IR still names; that is
|
|
40
|
+
* checked before the deploy against the pinned IRs (inflight.ts);
|
|
41
|
+
* - diff on deploy: same hash means unchanged, skip publishing;
|
|
42
|
+
* - audit: answer "which version was this user on" at any point.
|
|
43
|
+
*
|
|
44
|
+
* ## Node ids
|
|
45
|
+
*
|
|
46
|
+
* Derived from the structural path at compile time — stable and deterministic:
|
|
47
|
+
* root level '0', '1', …; the j-th child of a branch's i-th case is
|
|
48
|
+
* '{branchId}.c{i}.{j}', the default arm '{branchId}.o.{j}'; cohort arms use
|
|
49
|
+
* the arm name '{cohortId}.{armName}.{j}'; a waitUntil timeout flow '{id}.t.{j}'.
|
|
50
|
+
* Editing a node's parameters keeps its id; inserting a node shifts the ids of
|
|
51
|
+
* its later siblings (a known trade-off — locating in-flight users relies on
|
|
52
|
+
* the pinned version rather than cross-version id alignment, and cross-version
|
|
53
|
+
* mapping is an explicit migrator's job).
|
|
54
|
+
*/
|
|
55
|
+
const IR_VERSION = 3;
|
|
56
|
+
const ScalarIR = zod_mini.union([
|
|
57
|
+
zod_mini.string(),
|
|
58
|
+
zod_mini.number(),
|
|
59
|
+
zod_mini.boolean()
|
|
60
|
+
]);
|
|
61
|
+
/** Duration: `value` keeps the DSL literal ('23 hours', for display), `ms` is what the engine uses. */
|
|
62
|
+
const DurationIR = zod_mini.object({
|
|
63
|
+
value: zod_mini.string(),
|
|
64
|
+
ms: zod_mini.number()
|
|
65
|
+
});
|
|
66
|
+
/** User-property reference — isomorphic to the DSL's UserPropertyRef once serialized (phantom type dropped). */
|
|
67
|
+
const UserPropertyRefIR = zod_mini.object({
|
|
68
|
+
type: zod_mini.literal("user_property"),
|
|
69
|
+
path: zod_mini.string()
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* A field of the event that started the journey (`t.payload.<field>` in the DSL), read from the
|
|
73
|
+
* payload the instance entered with. `event` names the workflow's own trigger event — the
|
|
74
|
+
* compiler refuses any other — and `path` is dotted for nested fields.
|
|
75
|
+
*/
|
|
76
|
+
const TriggerPayloadRefIR = zod_mini.object({
|
|
77
|
+
type: zod_mini.literal("trigger_payload"),
|
|
78
|
+
event: zod_mini.string(),
|
|
79
|
+
path: zod_mini.string()
|
|
80
|
+
});
|
|
81
|
+
/** A message prop / event payload value: a literal, a user-property reference or a trigger payload reference. */
|
|
82
|
+
const PropValueIR = zod_mini.union([
|
|
83
|
+
ScalarIR,
|
|
84
|
+
UserPropertyRefIR,
|
|
85
|
+
TriggerPayloadRefIR
|
|
86
|
+
]);
|
|
87
|
+
const ChannelIR = zod_mini.enum([
|
|
88
|
+
"email",
|
|
89
|
+
"sms",
|
|
90
|
+
"push",
|
|
91
|
+
"in_app",
|
|
92
|
+
"slack",
|
|
93
|
+
"discord",
|
|
94
|
+
"survey"
|
|
95
|
+
]);
|
|
96
|
+
const WeekdayIR = zod_mini.enum([
|
|
97
|
+
"mon",
|
|
98
|
+
"tue",
|
|
99
|
+
"wed",
|
|
100
|
+
"thu",
|
|
101
|
+
"fri",
|
|
102
|
+
"sat",
|
|
103
|
+
"sun"
|
|
104
|
+
]);
|
|
105
|
+
/**
|
|
106
|
+
* Source location of the builder call that produced a definition — the IR's
|
|
107
|
+
* source map. Lives under `meta`, so it is **excluded from contentHash**
|
|
108
|
+
* (see hash.ts): provenance never affects execution identity or plan.
|
|
109
|
+
* `file` is cwd-relative when compiled under Node, a URL under Vite dev.
|
|
110
|
+
*/
|
|
111
|
+
const SourceLocIR = zod_mini.object({
|
|
112
|
+
file: zod_mini.string(),
|
|
113
|
+
line: zod_mini.number(),
|
|
114
|
+
column: zod_mini.number()
|
|
115
|
+
});
|
|
116
|
+
/** Node-level metadata: provenance only, for now. Excluded from contentHash. */
|
|
117
|
+
const NodeMetaIR = zod_mini.object({ loc: zod_mini.optional(SourceLocIR) });
|
|
118
|
+
const PropertyOperatorIR = zod_mini.enum([
|
|
119
|
+
"eq",
|
|
120
|
+
"ne",
|
|
121
|
+
"gt",
|
|
122
|
+
"gte",
|
|
123
|
+
"lt",
|
|
124
|
+
"lte",
|
|
125
|
+
"between",
|
|
126
|
+
"not_between",
|
|
127
|
+
"in_array",
|
|
128
|
+
"not_in_array",
|
|
129
|
+
"exists",
|
|
130
|
+
"not_exists",
|
|
131
|
+
"contains",
|
|
132
|
+
"not_contains"
|
|
133
|
+
]);
|
|
134
|
+
const conditionBase = { meta: zod_mini.optional(NodeMetaIR) };
|
|
135
|
+
const ConditionIR = zod_mini.lazy(() => zod_mini.discriminatedUnion("type", [
|
|
136
|
+
zod_mini.object({
|
|
137
|
+
...conditionBase,
|
|
138
|
+
type: zod_mini.literal("and"),
|
|
139
|
+
conditions: zod_mini.array(ConditionIR)
|
|
140
|
+
}),
|
|
141
|
+
zod_mini.object({
|
|
142
|
+
...conditionBase,
|
|
143
|
+
type: zod_mini.literal("or"),
|
|
144
|
+
conditions: zod_mini.array(ConditionIR)
|
|
145
|
+
}),
|
|
146
|
+
zod_mini.object({
|
|
147
|
+
...conditionBase,
|
|
148
|
+
type: zod_mini.literal("not"),
|
|
149
|
+
condition: ConditionIR
|
|
150
|
+
}),
|
|
151
|
+
zod_mini.object({
|
|
152
|
+
...conditionBase,
|
|
153
|
+
type: zod_mini.literal("segment"),
|
|
154
|
+
segment: zod_mini.string()
|
|
155
|
+
}),
|
|
156
|
+
zod_mini.object({
|
|
157
|
+
...conditionBase,
|
|
158
|
+
type: zod_mini.literal("property"),
|
|
159
|
+
path: zod_mini.string(),
|
|
160
|
+
op: PropertyOperatorIR,
|
|
161
|
+
value: zod_mini.optional(ScalarIR),
|
|
162
|
+
values: zod_mini.optional(zod_mini.array(ScalarIR))
|
|
163
|
+
}),
|
|
164
|
+
zod_mini.object({
|
|
165
|
+
...conditionBase,
|
|
166
|
+
type: zod_mini.literal("payload"),
|
|
167
|
+
path: zod_mini.string(),
|
|
168
|
+
op: PropertyOperatorIR,
|
|
169
|
+
value: zod_mini.optional(ScalarIR),
|
|
170
|
+
values: zod_mini.optional(zod_mini.array(ScalarIR))
|
|
171
|
+
}),
|
|
172
|
+
zod_mini.object({
|
|
173
|
+
...conditionBase,
|
|
174
|
+
type: zod_mini.literal("trigger_payload"),
|
|
175
|
+
event: zod_mini.string(),
|
|
176
|
+
path: zod_mini.string(),
|
|
177
|
+
op: PropertyOperatorIR,
|
|
178
|
+
value: zod_mini.optional(ScalarIR),
|
|
179
|
+
values: zod_mini.optional(zod_mini.array(ScalarIR))
|
|
180
|
+
}),
|
|
181
|
+
zod_mini.object({
|
|
182
|
+
...conditionBase,
|
|
183
|
+
type: zod_mini.literal("performed"),
|
|
184
|
+
event: zod_mini.string(),
|
|
185
|
+
where: zod_mini.optional(ConditionIR),
|
|
186
|
+
within: zod_mini.optional(DurationIR),
|
|
187
|
+
count: zod_mini.optional(zod_mini.number())
|
|
188
|
+
}),
|
|
189
|
+
zod_mini.object({
|
|
190
|
+
...conditionBase,
|
|
191
|
+
type: zod_mini.literal("reachable"),
|
|
192
|
+
channel: ChannelIR
|
|
193
|
+
})
|
|
194
|
+
]));
|
|
195
|
+
/**
|
|
196
|
+
* Trigger shapes. A date trigger starts a journey for every known user its `filter` holds for,
|
|
197
|
+
* once, when its time comes. The event trigger has two independent gates: `where` tests
|
|
198
|
+
* the triggering event's payload (payload-only subtree, evaluated against the
|
|
199
|
+
* incoming event before anything else), `filter` tests the user's profile.
|
|
200
|
+
*/
|
|
201
|
+
const TriggerIR = zod_mini.discriminatedUnion("type", [
|
|
202
|
+
zod_mini.object({
|
|
203
|
+
type: zod_mini.literal("event"),
|
|
204
|
+
event: zod_mini.string(),
|
|
205
|
+
where: zod_mini.optional(ConditionIR),
|
|
206
|
+
filter: zod_mini.optional(ConditionIR),
|
|
207
|
+
visitors: zod_mini.optional(zod_mini.literal(true))
|
|
208
|
+
}),
|
|
209
|
+
zod_mini.object({
|
|
210
|
+
type: zod_mini.literal("segment"),
|
|
211
|
+
segment: zod_mini.string()
|
|
212
|
+
}),
|
|
213
|
+
zod_mini.object({
|
|
214
|
+
type: zod_mini.literal("date"),
|
|
215
|
+
/** 'YYYY-MM-DD HH:mm:ss', UTC. */
|
|
216
|
+
at: zod_mini.string(),
|
|
217
|
+
/** Who enters at that time: everyone known when absent, else those the condition holds for then. */
|
|
218
|
+
filter: zod_mini.optional(ConditionIR)
|
|
219
|
+
}),
|
|
220
|
+
zod_mini.object({ type: zod_mini.literal("webhook") })
|
|
221
|
+
]);
|
|
222
|
+
const nodeBase = {
|
|
223
|
+
id: zod_mini.string(),
|
|
224
|
+
label: zod_mini.optional(zod_mini.string()),
|
|
225
|
+
meta: zod_mini.optional(NodeMetaIR)
|
|
226
|
+
};
|
|
227
|
+
const NodeIR = zod_mini.lazy(() => zod_mini.discriminatedUnion("type", [
|
|
228
|
+
zod_mini.object({
|
|
229
|
+
...nodeBase,
|
|
230
|
+
type: zod_mini.literal("message"),
|
|
231
|
+
channel: ChannelIR,
|
|
232
|
+
template: zod_mini.string(),
|
|
233
|
+
props: zod_mini.record(zod_mini.string(), PropValueIR),
|
|
234
|
+
devices: zod_mini.optional(zod_mini.literal("latest")),
|
|
235
|
+
topic: zod_mini.optional(zod_mini.nullable(zod_mini.string())),
|
|
236
|
+
redelivery: zod_mini.optional(zod_mini.literal("resend"))
|
|
237
|
+
}),
|
|
238
|
+
zod_mini.object({
|
|
239
|
+
...nodeBase,
|
|
240
|
+
type: zod_mini.literal("delay"),
|
|
241
|
+
duration: DurationIR
|
|
242
|
+
}),
|
|
243
|
+
zod_mini.object({
|
|
244
|
+
...nodeBase,
|
|
245
|
+
type: zod_mini.literal("random_delay"),
|
|
246
|
+
min: DurationIR,
|
|
247
|
+
max: DurationIR
|
|
248
|
+
}),
|
|
249
|
+
zod_mini.object({
|
|
250
|
+
...nodeBase,
|
|
251
|
+
type: zod_mini.literal("time_window"),
|
|
252
|
+
days: zod_mini.array(WeekdayIR),
|
|
253
|
+
between: zod_mini.tuple([zod_mini.string(), zod_mini.string()]),
|
|
254
|
+
tz: zod_mini.string()
|
|
255
|
+
}),
|
|
256
|
+
zod_mini.object({
|
|
257
|
+
...nodeBase,
|
|
258
|
+
type: zod_mini.literal("wait_until"),
|
|
259
|
+
condition: ConditionIR,
|
|
260
|
+
timeout: DurationIR,
|
|
261
|
+
onTimeout: zod_mini.union([
|
|
262
|
+
zod_mini.literal("continue"),
|
|
263
|
+
zod_mini.literal("exit"),
|
|
264
|
+
zod_mini.array(NodeIR)
|
|
265
|
+
])
|
|
266
|
+
}),
|
|
267
|
+
zod_mini.object({
|
|
268
|
+
...nodeBase,
|
|
269
|
+
type: zod_mini.literal("branch"),
|
|
270
|
+
cases: zod_mini.array(zod_mini.object({
|
|
271
|
+
label: zod_mini.optional(zod_mini.string()),
|
|
272
|
+
condition: ConditionIR,
|
|
273
|
+
flow: zod_mini.array(NodeIR)
|
|
274
|
+
})),
|
|
275
|
+
otherwise: zod_mini.optional(zod_mini.array(NodeIR))
|
|
276
|
+
}),
|
|
277
|
+
zod_mini.object({
|
|
278
|
+
...nodeBase,
|
|
279
|
+
type: zod_mini.literal("filter"),
|
|
280
|
+
condition: ConditionIR,
|
|
281
|
+
reason: zod_mini.optional(zod_mini.string())
|
|
282
|
+
}),
|
|
283
|
+
zod_mini.object({
|
|
284
|
+
...nodeBase,
|
|
285
|
+
type: zod_mini.literal("cohort"),
|
|
286
|
+
key: zod_mini.optional(zod_mini.string()),
|
|
287
|
+
arms: zod_mini.array(zod_mini.object({
|
|
288
|
+
name: zod_mini.string(),
|
|
289
|
+
weight: zod_mini.number(),
|
|
290
|
+
flow: zod_mini.array(NodeIR)
|
|
291
|
+
}))
|
|
292
|
+
}),
|
|
293
|
+
zod_mini.object({
|
|
294
|
+
...nodeBase,
|
|
295
|
+
type: zod_mini.literal("exit"),
|
|
296
|
+
reason: zod_mini.optional(zod_mini.string())
|
|
297
|
+
}),
|
|
298
|
+
zod_mini.object({
|
|
299
|
+
...nodeBase,
|
|
300
|
+
type: zod_mini.literal("send_event"),
|
|
301
|
+
event: zod_mini.string(),
|
|
302
|
+
payload: zod_mini.record(zod_mini.string(), PropValueIR)
|
|
303
|
+
}),
|
|
304
|
+
zod_mini.object({
|
|
305
|
+
...nodeBase,
|
|
306
|
+
type: zod_mini.literal("action"),
|
|
307
|
+
action: zod_mini.string(),
|
|
308
|
+
args: zod_mini.record(zod_mini.string(), PropValueIR)
|
|
309
|
+
})
|
|
310
|
+
]));
|
|
311
|
+
const GoalIR = zod_mini.object({
|
|
312
|
+
condition: ConditionIR,
|
|
313
|
+
within: zod_mini.optional(DurationIR),
|
|
314
|
+
exitOnMatch: zod_mini.boolean()
|
|
315
|
+
});
|
|
316
|
+
/**
|
|
317
|
+
* Human-facing metadata: **excluded from contentHash** (see hash.ts).
|
|
318
|
+
* Editing a name or description does not touch execution semantics, so it never
|
|
319
|
+
* invalidates the version in-flight users are pinned to, nor shows up in plan.
|
|
320
|
+
*/
|
|
321
|
+
const MetaIR = zod_mini.object({
|
|
322
|
+
/**
|
|
323
|
+
* Human label. The asset's `id` is its identity — a wire key that routing
|
|
324
|
+
* tables and the entry ledger are built on — so it is not something to
|
|
325
|
+
* rename for readability. This is: it is metadata, dropped before hashing,
|
|
326
|
+
* and the studio shows it in place of the key wherever it is set.
|
|
327
|
+
*/
|
|
328
|
+
name: zod_mini.optional(zod_mini.string()),
|
|
329
|
+
description: zod_mini.optional(zod_mini.string()),
|
|
330
|
+
loc: zod_mini.optional(SourceLocIR)
|
|
331
|
+
});
|
|
332
|
+
/**
|
|
333
|
+
* Re-entry policy (`workflow({ reentry })`, README "Re-entry"): whether a user who already entered
|
|
334
|
+
* may enter again. `never` enters a user once; `after_exit` again once their previous instance
|
|
335
|
+
* ended; `concurrent` while it still runs. `cooldown` is the least time from the user's previous
|
|
336
|
+
* entry to the next one. The `never` branch is strict, so a cooldown on it is refused rather
|
|
337
|
+
* than dropped.
|
|
338
|
+
*/
|
|
339
|
+
const ReentryIR = zod_mini.discriminatedUnion("mode", [
|
|
340
|
+
zod_mini.strictObject({ mode: zod_mini.literal("never") }),
|
|
341
|
+
zod_mini.strictObject({
|
|
342
|
+
mode: zod_mini.literal("after_exit"),
|
|
343
|
+
cooldown: zod_mini.optional(DurationIR)
|
|
344
|
+
}),
|
|
345
|
+
zod_mini.strictObject({
|
|
346
|
+
mode: zod_mini.literal("concurrent"),
|
|
347
|
+
cooldown: zod_mini.optional(DurationIR)
|
|
348
|
+
})
|
|
349
|
+
]);
|
|
350
|
+
const WorkflowIR = zod_mini.object({
|
|
351
|
+
irVersion: zod_mini.literal(3),
|
|
352
|
+
/** Wire identity (`workflow({ id })`): routing tables, the entry ledger and reporting are keyed on it. */
|
|
353
|
+
id: zod_mini.string(),
|
|
354
|
+
contentHash: zod_mini.string(),
|
|
355
|
+
meta: zod_mini.optional(MetaIR),
|
|
356
|
+
trigger: TriggerIR,
|
|
357
|
+
reentry: ReentryIR,
|
|
358
|
+
goal: zod_mini.optional(GoalIR),
|
|
359
|
+
exitWhen: zod_mini.optional(ConditionIR),
|
|
360
|
+
flow: zod_mini.array(NodeIR)
|
|
361
|
+
});
|
|
362
|
+
const SegmentIR = zod_mini.object({
|
|
363
|
+
irVersion: zod_mini.literal(3),
|
|
364
|
+
/** Wire identity (`segment({ id })`): segment references and the membership store are keyed on it. */
|
|
365
|
+
id: zod_mini.string(),
|
|
366
|
+
contentHash: zod_mini.string(),
|
|
367
|
+
/** Provenance plus the human label — MetaIR, same as a workflow's. */
|
|
368
|
+
meta: zod_mini.optional(MetaIR),
|
|
369
|
+
condition: ConditionIR
|
|
370
|
+
});
|
|
371
|
+
/** Template manifest entry: IR records only the reference; the body lives in the template system. */
|
|
372
|
+
const TemplateIR = zod_mini.object({
|
|
373
|
+
irVersion: zod_mini.literal(3),
|
|
374
|
+
key: zod_mini.string(),
|
|
375
|
+
channel: ChannelIR
|
|
376
|
+
});
|
|
377
|
+
/**
|
|
378
|
+
* Action manifest entry: IR records the name; the implementation solidifies
|
|
379
|
+
* into the Worker bundle at deploy time, never into IR (custom code stays out
|
|
380
|
+
* of the data plane by design).
|
|
381
|
+
*/
|
|
382
|
+
const ActionIR = zod_mini.object({
|
|
383
|
+
irVersion: zod_mini.literal(3),
|
|
384
|
+
name: zod_mini.string()
|
|
385
|
+
});
|
|
386
|
+
/**
|
|
387
|
+
* Deployment unit: the complete snapshot one `deploy` produces (terraform
|
|
388
|
+
* apply, same mental model). The server diffs each definition's contentHash to
|
|
389
|
+
* decide publish / skip / retire.
|
|
390
|
+
*/
|
|
391
|
+
/**
|
|
392
|
+
* The subscription topics the contract declares, carried by the bundle so the engine validates
|
|
393
|
+
* `/subscriptions` and the templates' topics against the deployed list, not the SDK's word.
|
|
394
|
+
*/
|
|
395
|
+
const SubscriptionsIR = zod_mini.object({ topics: zod_mini.array(zod_mini.string()) });
|
|
396
|
+
const BundleIR = zod_mini.object({
|
|
397
|
+
irVersion: zod_mini.literal(3),
|
|
398
|
+
workflows: zod_mini.array(WorkflowIR),
|
|
399
|
+
segments: zod_mini.array(SegmentIR),
|
|
400
|
+
templates: zod_mini.array(TemplateIR),
|
|
401
|
+
actions: zod_mini.array(ActionIR),
|
|
402
|
+
/** Absent in a bundle compiled before topics existed: no topics. */
|
|
403
|
+
subscriptions: zod_mini.optional(SubscriptionsIR)
|
|
404
|
+
});
|
|
405
|
+
exports.ActionIR = ActionIR;
|
|
406
|
+
exports.BundleIR = BundleIR;
|
|
407
|
+
exports.ChannelIR = ChannelIR;
|
|
408
|
+
exports.ConditionIR = ConditionIR;
|
|
409
|
+
exports.DurationIR = DurationIR;
|
|
410
|
+
exports.GoalIR = GoalIR;
|
|
411
|
+
exports.IR_VERSION = IR_VERSION;
|
|
412
|
+
exports.MetaIR = MetaIR;
|
|
413
|
+
exports.NodeIR = NodeIR;
|
|
414
|
+
exports.NodeMetaIR = NodeMetaIR;
|
|
415
|
+
exports.PropValueIR = PropValueIR;
|
|
416
|
+
exports.PropertyOperatorIR = PropertyOperatorIR;
|
|
417
|
+
exports.ReentryIR = ReentryIR;
|
|
418
|
+
exports.ScalarIR = ScalarIR;
|
|
419
|
+
exports.SegmentIR = SegmentIR;
|
|
420
|
+
exports.SourceLocIR = SourceLocIR;
|
|
421
|
+
exports.SubscriptionsIR = SubscriptionsIR;
|
|
422
|
+
exports.TemplateIR = TemplateIR;
|
|
423
|
+
exports.TriggerIR = TriggerIR;
|
|
424
|
+
exports.TriggerPayloadRefIR = TriggerPayloadRefIR;
|
|
425
|
+
exports.UserPropertyRefIR = UserPropertyRefIR;
|
|
426
|
+
exports.WeekdayIR = WeekdayIR;
|
|
427
|
+
exports.WorkflowIR = WorkflowIR;
|
|
428
|
+
|
|
429
|
+
//# sourceMappingURL=ir.cjs.map
|