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/ir.mjs
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
|
+
// src/ir.ts
|
|
3
|
+
/**
|
|
4
|
+
* IR (Intermediate Representation) — what the DSL compiles to: serializable
|
|
5
|
+
* JSON. It is the three-way contract between the engine that interprets it,
|
|
6
|
+
* the UI (react-flow) that renders it, and diff / audit tooling.
|
|
7
|
+
*
|
|
8
|
+
* Validation strategy: the zod/mini schemas are the authoritative definition.
|
|
9
|
+
* TS types are either inferred from a schema or hand-written under the same
|
|
10
|
+
* name (zod cannot infer recursive types; the hand-written type is anchored
|
|
11
|
+
* with a ZodMiniType<T> annotation, so any drift fails to compile). IR crosses
|
|
12
|
+
* process boundaries (database, network, UI), so runtime validation is a must.
|
|
13
|
+
*
|
|
14
|
+
* ## Versioning (two independent axes)
|
|
15
|
+
*
|
|
16
|
+
* 1. IR format version (irVersion): evolution of the IR schema itself. Adding
|
|
17
|
+
* optional fields does not bump it; only structurally incompatible changes
|
|
18
|
+
* do (changing a discriminant, dropping a field, altering semantics).
|
|
19
|
+
* Writers always write the current version, and readers accept only it:
|
|
20
|
+
* every schema below takes `irVersion` as the literal `IR_VERSION`, and
|
|
21
|
+
* there is no reader for an earlier version nor a migrator to this one. A
|
|
22
|
+
* bump therefore strands what is stored — pinned IRs stop parsing and the
|
|
23
|
+
* journeys running on them fail — and `irVersion` is part of the hash, so
|
|
24
|
+
* every content hash changes with it. Until readers dispatch on irVersion
|
|
25
|
+
* and migrate, a bump is a breaking release that drains or clears the
|
|
26
|
+
* engine's data first (README "Upgrading to 12.0" was one).
|
|
27
|
+
* 2. Content version (contentHash): a content-addressed id for a single
|
|
28
|
+
* definition's **execution semantics** — the canonical-JSON hash after
|
|
29
|
+
* metadata (meta / label / reason) is stripped, see hash.ts. It is used to:
|
|
30
|
+
* - pin a version when a user enters, so an in-flight journey runs the
|
|
31
|
+
* pinned version to completion. The pin covers the workflow's own
|
|
32
|
+
* structure and nothing else, by design (README "Versioning"): a
|
|
33
|
+
* template, segment or action is named by id and resolved when it is
|
|
34
|
+
* used, so a journey sends the latest content and a segment is a live
|
|
35
|
+
* audience — what marketing automation does. What a deploy must not do
|
|
36
|
+
* is take away or reshape something a pinned IR still names; that is
|
|
37
|
+
* checked before the deploy against the pinned IRs (inflight.ts);
|
|
38
|
+
* - diff on deploy: same hash means unchanged, skip publishing;
|
|
39
|
+
* - audit: answer "which version was this user on" at any point.
|
|
40
|
+
*
|
|
41
|
+
* ## Node ids
|
|
42
|
+
*
|
|
43
|
+
* Derived from the structural path at compile time — stable and deterministic:
|
|
44
|
+
* root level '0', '1', …; the j-th child of a branch's i-th case is
|
|
45
|
+
* '{branchId}.c{i}.{j}', the default arm '{branchId}.o.{j}'; cohort arms use
|
|
46
|
+
* the arm name '{cohortId}.{armName}.{j}'; a waitUntil timeout flow '{id}.t.{j}'.
|
|
47
|
+
* Editing a node's parameters keeps its id; inserting a node shifts the ids of
|
|
48
|
+
* its later siblings (a known trade-off — locating in-flight users relies on
|
|
49
|
+
* the pinned version rather than cross-version id alignment, and cross-version
|
|
50
|
+
* mapping is an explicit migrator's job).
|
|
51
|
+
*/
|
|
52
|
+
const IR_VERSION = 3;
|
|
53
|
+
const ScalarIR = z.union([
|
|
54
|
+
z.string(),
|
|
55
|
+
z.number(),
|
|
56
|
+
z.boolean()
|
|
57
|
+
]);
|
|
58
|
+
/** Duration: `value` keeps the DSL literal ('23 hours', for display), `ms` is what the engine uses. */
|
|
59
|
+
const DurationIR = z.object({
|
|
60
|
+
value: z.string(),
|
|
61
|
+
ms: z.number()
|
|
62
|
+
});
|
|
63
|
+
/** User-property reference — isomorphic to the DSL's UserPropertyRef once serialized (phantom type dropped). */
|
|
64
|
+
const UserPropertyRefIR = z.object({
|
|
65
|
+
type: z.literal("user_property"),
|
|
66
|
+
path: z.string()
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* A field of the event that started the journey (`t.payload.<field>` in the DSL), read from the
|
|
70
|
+
* payload the instance entered with. `event` names the workflow's own trigger event — the
|
|
71
|
+
* compiler refuses any other — and `path` is dotted for nested fields.
|
|
72
|
+
*/
|
|
73
|
+
const TriggerPayloadRefIR = z.object({
|
|
74
|
+
type: z.literal("trigger_payload"),
|
|
75
|
+
event: z.string(),
|
|
76
|
+
path: z.string()
|
|
77
|
+
});
|
|
78
|
+
/** A message prop / event payload value: a literal, a user-property reference or a trigger payload reference. */
|
|
79
|
+
const PropValueIR = z.union([
|
|
80
|
+
ScalarIR,
|
|
81
|
+
UserPropertyRefIR,
|
|
82
|
+
TriggerPayloadRefIR
|
|
83
|
+
]);
|
|
84
|
+
const ChannelIR = z.enum([
|
|
85
|
+
"email",
|
|
86
|
+
"sms",
|
|
87
|
+
"push",
|
|
88
|
+
"in_app",
|
|
89
|
+
"slack",
|
|
90
|
+
"discord",
|
|
91
|
+
"survey"
|
|
92
|
+
]);
|
|
93
|
+
const WeekdayIR = z.enum([
|
|
94
|
+
"mon",
|
|
95
|
+
"tue",
|
|
96
|
+
"wed",
|
|
97
|
+
"thu",
|
|
98
|
+
"fri",
|
|
99
|
+
"sat",
|
|
100
|
+
"sun"
|
|
101
|
+
]);
|
|
102
|
+
/**
|
|
103
|
+
* Source location of the builder call that produced a definition — the IR's
|
|
104
|
+
* source map. Lives under `meta`, so it is **excluded from contentHash**
|
|
105
|
+
* (see hash.ts): provenance never affects execution identity or plan.
|
|
106
|
+
* `file` is cwd-relative when compiled under Node, a URL under Vite dev.
|
|
107
|
+
*/
|
|
108
|
+
const SourceLocIR = z.object({
|
|
109
|
+
file: z.string(),
|
|
110
|
+
line: z.number(),
|
|
111
|
+
column: z.number()
|
|
112
|
+
});
|
|
113
|
+
/** Node-level metadata: provenance only, for now. Excluded from contentHash. */
|
|
114
|
+
const NodeMetaIR = z.object({ loc: z.optional(SourceLocIR) });
|
|
115
|
+
const PropertyOperatorIR = z.enum([
|
|
116
|
+
"eq",
|
|
117
|
+
"ne",
|
|
118
|
+
"gt",
|
|
119
|
+
"gte",
|
|
120
|
+
"lt",
|
|
121
|
+
"lte",
|
|
122
|
+
"between",
|
|
123
|
+
"not_between",
|
|
124
|
+
"in_array",
|
|
125
|
+
"not_in_array",
|
|
126
|
+
"exists",
|
|
127
|
+
"not_exists",
|
|
128
|
+
"contains",
|
|
129
|
+
"not_contains"
|
|
130
|
+
]);
|
|
131
|
+
const conditionBase = { meta: z.optional(NodeMetaIR) };
|
|
132
|
+
const ConditionIR = z.lazy(() => z.discriminatedUnion("type", [
|
|
133
|
+
z.object({
|
|
134
|
+
...conditionBase,
|
|
135
|
+
type: z.literal("and"),
|
|
136
|
+
conditions: z.array(ConditionIR)
|
|
137
|
+
}),
|
|
138
|
+
z.object({
|
|
139
|
+
...conditionBase,
|
|
140
|
+
type: z.literal("or"),
|
|
141
|
+
conditions: z.array(ConditionIR)
|
|
142
|
+
}),
|
|
143
|
+
z.object({
|
|
144
|
+
...conditionBase,
|
|
145
|
+
type: z.literal("not"),
|
|
146
|
+
condition: ConditionIR
|
|
147
|
+
}),
|
|
148
|
+
z.object({
|
|
149
|
+
...conditionBase,
|
|
150
|
+
type: z.literal("segment"),
|
|
151
|
+
segment: z.string()
|
|
152
|
+
}),
|
|
153
|
+
z.object({
|
|
154
|
+
...conditionBase,
|
|
155
|
+
type: z.literal("property"),
|
|
156
|
+
path: z.string(),
|
|
157
|
+
op: PropertyOperatorIR,
|
|
158
|
+
value: z.optional(ScalarIR),
|
|
159
|
+
values: z.optional(z.array(ScalarIR))
|
|
160
|
+
}),
|
|
161
|
+
z.object({
|
|
162
|
+
...conditionBase,
|
|
163
|
+
type: z.literal("payload"),
|
|
164
|
+
path: z.string(),
|
|
165
|
+
op: PropertyOperatorIR,
|
|
166
|
+
value: z.optional(ScalarIR),
|
|
167
|
+
values: z.optional(z.array(ScalarIR))
|
|
168
|
+
}),
|
|
169
|
+
z.object({
|
|
170
|
+
...conditionBase,
|
|
171
|
+
type: z.literal("trigger_payload"),
|
|
172
|
+
event: z.string(),
|
|
173
|
+
path: z.string(),
|
|
174
|
+
op: PropertyOperatorIR,
|
|
175
|
+
value: z.optional(ScalarIR),
|
|
176
|
+
values: z.optional(z.array(ScalarIR))
|
|
177
|
+
}),
|
|
178
|
+
z.object({
|
|
179
|
+
...conditionBase,
|
|
180
|
+
type: z.literal("performed"),
|
|
181
|
+
event: z.string(),
|
|
182
|
+
where: z.optional(ConditionIR),
|
|
183
|
+
within: z.optional(DurationIR),
|
|
184
|
+
count: z.optional(z.number())
|
|
185
|
+
}),
|
|
186
|
+
z.object({
|
|
187
|
+
...conditionBase,
|
|
188
|
+
type: z.literal("reachable"),
|
|
189
|
+
channel: ChannelIR
|
|
190
|
+
})
|
|
191
|
+
]));
|
|
192
|
+
/**
|
|
193
|
+
* Trigger shapes. A date trigger starts a journey for every known user its `filter` holds for,
|
|
194
|
+
* once, when its time comes. The event trigger has two independent gates: `where` tests
|
|
195
|
+
* the triggering event's payload (payload-only subtree, evaluated against the
|
|
196
|
+
* incoming event before anything else), `filter` tests the user's profile.
|
|
197
|
+
*/
|
|
198
|
+
const TriggerIR = z.discriminatedUnion("type", [
|
|
199
|
+
z.object({
|
|
200
|
+
type: z.literal("event"),
|
|
201
|
+
event: z.string(),
|
|
202
|
+
where: z.optional(ConditionIR),
|
|
203
|
+
filter: z.optional(ConditionIR),
|
|
204
|
+
visitors: z.optional(z.literal(true))
|
|
205
|
+
}),
|
|
206
|
+
z.object({
|
|
207
|
+
type: z.literal("segment"),
|
|
208
|
+
segment: z.string()
|
|
209
|
+
}),
|
|
210
|
+
z.object({
|
|
211
|
+
type: z.literal("date"),
|
|
212
|
+
/** 'YYYY-MM-DD HH:mm:ss', UTC. */
|
|
213
|
+
at: z.string(),
|
|
214
|
+
/** Who enters at that time: everyone known when absent, else those the condition holds for then. */
|
|
215
|
+
filter: z.optional(ConditionIR)
|
|
216
|
+
}),
|
|
217
|
+
z.object({ type: z.literal("webhook") })
|
|
218
|
+
]);
|
|
219
|
+
const nodeBase = {
|
|
220
|
+
id: z.string(),
|
|
221
|
+
label: z.optional(z.string()),
|
|
222
|
+
meta: z.optional(NodeMetaIR)
|
|
223
|
+
};
|
|
224
|
+
const NodeIR = z.lazy(() => z.discriminatedUnion("type", [
|
|
225
|
+
z.object({
|
|
226
|
+
...nodeBase,
|
|
227
|
+
type: z.literal("message"),
|
|
228
|
+
channel: ChannelIR,
|
|
229
|
+
template: z.string(),
|
|
230
|
+
props: z.record(z.string(), PropValueIR),
|
|
231
|
+
devices: z.optional(z.literal("latest")),
|
|
232
|
+
topic: z.optional(z.nullable(z.string())),
|
|
233
|
+
redelivery: z.optional(z.literal("resend"))
|
|
234
|
+
}),
|
|
235
|
+
z.object({
|
|
236
|
+
...nodeBase,
|
|
237
|
+
type: z.literal("delay"),
|
|
238
|
+
duration: DurationIR
|
|
239
|
+
}),
|
|
240
|
+
z.object({
|
|
241
|
+
...nodeBase,
|
|
242
|
+
type: z.literal("random_delay"),
|
|
243
|
+
min: DurationIR,
|
|
244
|
+
max: DurationIR
|
|
245
|
+
}),
|
|
246
|
+
z.object({
|
|
247
|
+
...nodeBase,
|
|
248
|
+
type: z.literal("time_window"),
|
|
249
|
+
days: z.array(WeekdayIR),
|
|
250
|
+
between: z.tuple([z.string(), z.string()]),
|
|
251
|
+
tz: z.string()
|
|
252
|
+
}),
|
|
253
|
+
z.object({
|
|
254
|
+
...nodeBase,
|
|
255
|
+
type: z.literal("wait_until"),
|
|
256
|
+
condition: ConditionIR,
|
|
257
|
+
timeout: DurationIR,
|
|
258
|
+
onTimeout: z.union([
|
|
259
|
+
z.literal("continue"),
|
|
260
|
+
z.literal("exit"),
|
|
261
|
+
z.array(NodeIR)
|
|
262
|
+
])
|
|
263
|
+
}),
|
|
264
|
+
z.object({
|
|
265
|
+
...nodeBase,
|
|
266
|
+
type: z.literal("branch"),
|
|
267
|
+
cases: z.array(z.object({
|
|
268
|
+
label: z.optional(z.string()),
|
|
269
|
+
condition: ConditionIR,
|
|
270
|
+
flow: z.array(NodeIR)
|
|
271
|
+
})),
|
|
272
|
+
otherwise: z.optional(z.array(NodeIR))
|
|
273
|
+
}),
|
|
274
|
+
z.object({
|
|
275
|
+
...nodeBase,
|
|
276
|
+
type: z.literal("filter"),
|
|
277
|
+
condition: ConditionIR,
|
|
278
|
+
reason: z.optional(z.string())
|
|
279
|
+
}),
|
|
280
|
+
z.object({
|
|
281
|
+
...nodeBase,
|
|
282
|
+
type: z.literal("cohort"),
|
|
283
|
+
key: z.optional(z.string()),
|
|
284
|
+
arms: z.array(z.object({
|
|
285
|
+
name: z.string(),
|
|
286
|
+
weight: z.number(),
|
|
287
|
+
flow: z.array(NodeIR)
|
|
288
|
+
}))
|
|
289
|
+
}),
|
|
290
|
+
z.object({
|
|
291
|
+
...nodeBase,
|
|
292
|
+
type: z.literal("exit"),
|
|
293
|
+
reason: z.optional(z.string())
|
|
294
|
+
}),
|
|
295
|
+
z.object({
|
|
296
|
+
...nodeBase,
|
|
297
|
+
type: z.literal("send_event"),
|
|
298
|
+
event: z.string(),
|
|
299
|
+
payload: z.record(z.string(), PropValueIR)
|
|
300
|
+
}),
|
|
301
|
+
z.object({
|
|
302
|
+
...nodeBase,
|
|
303
|
+
type: z.literal("action"),
|
|
304
|
+
action: z.string(),
|
|
305
|
+
args: z.record(z.string(), PropValueIR)
|
|
306
|
+
})
|
|
307
|
+
]));
|
|
308
|
+
const GoalIR = z.object({
|
|
309
|
+
condition: ConditionIR,
|
|
310
|
+
within: z.optional(DurationIR),
|
|
311
|
+
exitOnMatch: z.boolean()
|
|
312
|
+
});
|
|
313
|
+
/**
|
|
314
|
+
* Human-facing metadata: **excluded from contentHash** (see hash.ts).
|
|
315
|
+
* Editing a name or description does not touch execution semantics, so it never
|
|
316
|
+
* invalidates the version in-flight users are pinned to, nor shows up in plan.
|
|
317
|
+
*/
|
|
318
|
+
const MetaIR = z.object({
|
|
319
|
+
/**
|
|
320
|
+
* Human label. The asset's `id` is its identity — a wire key that routing
|
|
321
|
+
* tables and the entry ledger are built on — so it is not something to
|
|
322
|
+
* rename for readability. This is: it is metadata, dropped before hashing,
|
|
323
|
+
* and the studio shows it in place of the key wherever it is set.
|
|
324
|
+
*/
|
|
325
|
+
name: z.optional(z.string()),
|
|
326
|
+
description: z.optional(z.string()),
|
|
327
|
+
loc: z.optional(SourceLocIR)
|
|
328
|
+
});
|
|
329
|
+
/**
|
|
330
|
+
* Re-entry policy (`workflow({ reentry })`, README "Re-entry"): whether a user who already entered
|
|
331
|
+
* may enter again. `never` enters a user once; `after_exit` again once their previous instance
|
|
332
|
+
* ended; `concurrent` while it still runs. `cooldown` is the least time from the user's previous
|
|
333
|
+
* entry to the next one. The `never` branch is strict, so a cooldown on it is refused rather
|
|
334
|
+
* than dropped.
|
|
335
|
+
*/
|
|
336
|
+
const ReentryIR = z.discriminatedUnion("mode", [
|
|
337
|
+
z.strictObject({ mode: z.literal("never") }),
|
|
338
|
+
z.strictObject({
|
|
339
|
+
mode: z.literal("after_exit"),
|
|
340
|
+
cooldown: z.optional(DurationIR)
|
|
341
|
+
}),
|
|
342
|
+
z.strictObject({
|
|
343
|
+
mode: z.literal("concurrent"),
|
|
344
|
+
cooldown: z.optional(DurationIR)
|
|
345
|
+
})
|
|
346
|
+
]);
|
|
347
|
+
const WorkflowIR = z.object({
|
|
348
|
+
irVersion: z.literal(3),
|
|
349
|
+
/** Wire identity (`workflow({ id })`): routing tables, the entry ledger and reporting are keyed on it. */
|
|
350
|
+
id: z.string(),
|
|
351
|
+
contentHash: z.string(),
|
|
352
|
+
meta: z.optional(MetaIR),
|
|
353
|
+
trigger: TriggerIR,
|
|
354
|
+
reentry: ReentryIR,
|
|
355
|
+
goal: z.optional(GoalIR),
|
|
356
|
+
exitWhen: z.optional(ConditionIR),
|
|
357
|
+
flow: z.array(NodeIR)
|
|
358
|
+
});
|
|
359
|
+
const SegmentIR = z.object({
|
|
360
|
+
irVersion: z.literal(3),
|
|
361
|
+
/** Wire identity (`segment({ id })`): segment references and the membership store are keyed on it. */
|
|
362
|
+
id: z.string(),
|
|
363
|
+
contentHash: z.string(),
|
|
364
|
+
/** Provenance plus the human label — MetaIR, same as a workflow's. */
|
|
365
|
+
meta: z.optional(MetaIR),
|
|
366
|
+
condition: ConditionIR
|
|
367
|
+
});
|
|
368
|
+
/** Template manifest entry: IR records only the reference; the body lives in the template system. */
|
|
369
|
+
const TemplateIR = z.object({
|
|
370
|
+
irVersion: z.literal(3),
|
|
371
|
+
key: z.string(),
|
|
372
|
+
channel: ChannelIR
|
|
373
|
+
});
|
|
374
|
+
/**
|
|
375
|
+
* Action manifest entry: IR records the name; the implementation solidifies
|
|
376
|
+
* into the Worker bundle at deploy time, never into IR (custom code stays out
|
|
377
|
+
* of the data plane by design).
|
|
378
|
+
*/
|
|
379
|
+
const ActionIR = z.object({
|
|
380
|
+
irVersion: z.literal(3),
|
|
381
|
+
name: z.string()
|
|
382
|
+
});
|
|
383
|
+
/**
|
|
384
|
+
* Deployment unit: the complete snapshot one `deploy` produces (terraform
|
|
385
|
+
* apply, same mental model). The server diffs each definition's contentHash to
|
|
386
|
+
* decide publish / skip / retire.
|
|
387
|
+
*/
|
|
388
|
+
/**
|
|
389
|
+
* The subscription topics the contract declares, carried by the bundle so the engine validates
|
|
390
|
+
* `/subscriptions` and the templates' topics against the deployed list, not the SDK's word.
|
|
391
|
+
*/
|
|
392
|
+
const SubscriptionsIR = z.object({ topics: z.array(z.string()) });
|
|
393
|
+
const BundleIR = z.object({
|
|
394
|
+
irVersion: z.literal(3),
|
|
395
|
+
workflows: z.array(WorkflowIR),
|
|
396
|
+
segments: z.array(SegmentIR),
|
|
397
|
+
templates: z.array(TemplateIR),
|
|
398
|
+
actions: z.array(ActionIR),
|
|
399
|
+
/** Absent in a bundle compiled before topics existed: no topics. */
|
|
400
|
+
subscriptions: z.optional(SubscriptionsIR)
|
|
401
|
+
});
|
|
402
|
+
export { ActionIR, BundleIR, ChannelIR, ConditionIR, DurationIR, GoalIR, IR_VERSION, MetaIR, NodeIR, NodeMetaIR, PropValueIR, PropertyOperatorIR, ReentryIR, ScalarIR, SegmentIR, SourceLocIR, SubscriptionsIR, TemplateIR, TriggerIR, TriggerPayloadRefIR, UserPropertyRefIR, WeekdayIR, WorkflowIR };
|
|
403
|
+
|
|
404
|
+
//# sourceMappingURL=ir.mjs.map
|
package/dist/ir.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.mjs","names":[],"sources":["../src/ir.ts"],"sourcesContent":["import * as z from 'zod/mini';\n\n/**\n * IR (Intermediate Representation) — what the DSL compiles to: serializable\n * JSON. It is the three-way contract between the engine that interprets it,\n * the UI (react-flow) that renders it, and diff / audit tooling.\n *\n * Validation strategy: the zod/mini schemas are the authoritative definition.\n * TS types are either inferred from a schema or hand-written under the same\n * name (zod cannot infer recursive types; the hand-written type is anchored\n * with a ZodMiniType<T> annotation, so any drift fails to compile). IR crosses\n * process boundaries (database, network, UI), so runtime validation is a must.\n *\n * ## Versioning (two independent axes)\n *\n * 1. IR format version (irVersion): evolution of the IR schema itself. Adding\n * optional fields does not bump it; only structurally incompatible changes\n * do (changing a discriminant, dropping a field, altering semantics).\n * Writers always write the current version, and readers accept only it:\n * every schema below takes `irVersion` as the literal `IR_VERSION`, and\n * there is no reader for an earlier version nor a migrator to this one. A\n * bump therefore strands what is stored — pinned IRs stop parsing and the\n * journeys running on them fail — and `irVersion` is part of the hash, so\n * every content hash changes with it. Until readers dispatch on irVersion\n * and migrate, a bump is a breaking release that drains or clears the\n * engine's data first (README \"Upgrading to 12.0\" was one).\n * 2. Content version (contentHash): a content-addressed id for a single\n * definition's **execution semantics** — the canonical-JSON hash after\n * metadata (meta / label / reason) is stripped, see hash.ts. It is used to:\n * - pin a version when a user enters, so an in-flight journey runs the\n * pinned version to completion. The pin covers the workflow's own\n * structure and nothing else, by design (README \"Versioning\"): a\n * template, segment or action is named by id and resolved when it is\n * used, so a journey sends the latest content and a segment is a live\n * audience — what marketing automation does. What a deploy must not do\n * is take away or reshape something a pinned IR still names; that is\n * checked before the deploy against the pinned IRs (inflight.ts);\n * - diff on deploy: same hash means unchanged, skip publishing;\n * - audit: answer \"which version was this user on\" at any point.\n *\n * ## Node ids\n *\n * Derived from the structural path at compile time — stable and deterministic:\n * root level '0', '1', …; the j-th child of a branch's i-th case is\n * '{branchId}.c{i}.{j}', the default arm '{branchId}.o.{j}'; cohort arms use\n * the arm name '{cohortId}.{armName}.{j}'; a waitUntil timeout flow '{id}.t.{j}'.\n * Editing a node's parameters keeps its id; inserting a node shifts the ids of\n * its later siblings (a known trade-off — locating in-flight users relies on\n * the pinned version rather than cross-version id alignment, and cross-version\n * mapping is an explicit migrator's job).\n */\n\nexport const IR_VERSION = 3;\n\n/* -------------------------------- Base values ------------------------------- */\n\nexport const ScalarIR = z.union([z.string(), z.number(), z.boolean()]);\nexport type ScalarIR = z.infer<typeof ScalarIR>;\n\n/** Duration: `value` keeps the DSL literal ('23 hours', for display), `ms` is what the engine uses. */\n/*\n * TODO: `value` is hashed alongside `ms`, so '7 days' / '1 week' / '168 hours'\n * — identical to the engine, which only reads ms — produce three different\n * contentHashes. Rewording a duration therefore reports as a semantic change in\n * plan and repins in-flight users. Moving `value` out of the hash (it is a\n * display string) would fix it; deferred because it changes existing hashes.\n */\nexport const DurationIR = z.object({ value: z.string(), ms: z.number() });\nexport type DurationIR = z.infer<typeof DurationIR>;\n\n/** User-property reference — isomorphic to the DSL's UserPropertyRef once serialized (phantom type dropped). */\nexport const UserPropertyRefIR = z.object({\n type: z.literal('user_property'),\n path: z.string(),\n});\nexport type UserPropertyRefIR = z.infer<typeof UserPropertyRefIR>;\n\n/**\n * A field of the event that started the journey (`t.payload.<field>` in the DSL), read from the\n * payload the instance entered with. `event` names the workflow's own trigger event — the\n * compiler refuses any other — and `path` is dotted for nested fields.\n */\nexport const TriggerPayloadRefIR = z.object({\n type: z.literal('trigger_payload'),\n event: z.string(),\n path: z.string(),\n});\nexport type TriggerPayloadRefIR = z.infer<typeof TriggerPayloadRefIR>;\n\n/** A message prop / event payload value: a literal, a user-property reference or a trigger payload reference. */\nexport const PropValueIR = z.union([ScalarIR, UserPropertyRefIR, TriggerPayloadRefIR]);\nexport type PropValueIR = z.infer<typeof PropValueIR>;\n\nexport const ChannelIR = z.enum(['email', 'sms', 'push', 'in_app', 'slack', 'discord', 'survey']);\nexport type ChannelIR = z.infer<typeof ChannelIR>;\n\nexport const WeekdayIR = z.enum(['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']);\nexport type WeekdayIR = z.infer<typeof WeekdayIR>;\n\n/* --------------------------------- Provenance -------------------------------- */\n\n/**\n * Source location of the builder call that produced a definition — the IR's\n * source map. Lives under `meta`, so it is **excluded from contentHash**\n * (see hash.ts): provenance never affects execution identity or plan.\n * `file` is cwd-relative when compiled under Node, a URL under Vite dev.\n */\nexport const SourceLocIR = z.object({\n file: z.string(),\n line: z.number(),\n column: z.number(),\n});\nexport type SourceLocIR = z.infer<typeof SourceLocIR>;\n\n/** Node-level metadata: provenance only, for now. Excluded from contentHash. */\nexport const NodeMetaIR = z.object({\n loc: z.optional(SourceLocIR),\n});\nexport type NodeMetaIR = z.infer<typeof NodeMetaIR>;\n\n/* -------------------------------- Conditions -------------------------------- */\n\nexport const PropertyOperatorIR = z.enum([\n 'eq',\n 'ne',\n 'gt',\n 'gte',\n 'lt',\n 'lte',\n 'between',\n 'not_between',\n 'in_array',\n 'not_in_array',\n 'exists',\n 'not_exists',\n 'contains',\n 'not_contains',\n]);\nexport type PropertyOperatorIR = z.infer<typeof PropertyOperatorIR>;\n\n/**\n * Condition expression tree. The shape of value/values follows `op`:\n * eq/ne/gt/gte/lt/lte/contains/not_contains → value; in_array/not_in_array →\n * values; between/not_between → values = [min, max]; exists/not_exists → neither.\n *\n * `payload` predicates test the payload of an event (dotted paths reach nested\n * fields). They are only valid inside a `where` subtree — `performed.where`\n * and the event trigger's `where` — where an event row is in scope; the\n * compiler (compileBundle) and the evaluator both enforce the placement.\n * TODO: runtime refinement narrowing by op.\n */\n/**\n * Provenance rides on conditions too, so the studio can point at the exact\n * `eq(...)` / `and(...)` that produced a node — same rule as nodes: `meta` is\n * dropped before hashing, so carrying it never affects execution identity.\n */\ninterface ConditionBaseIR {\n meta?: NodeMetaIR | undefined;\n}\n\nexport type ConditionIR =\n | (ConditionBaseIR & { type: 'and'; conditions: ConditionIR[] })\n | (ConditionBaseIR & { type: 'or'; conditions: ConditionIR[] })\n | (ConditionBaseIR & { type: 'not'; condition: ConditionIR })\n /** Reference a segment by id (defined in SegmentIR, versioned separately). */\n | (ConditionBaseIR & { type: 'segment'; segment: string })\n | (ConditionBaseIR & {\n type: 'property';\n path: string;\n op: PropertyOperatorIR;\n value?: ScalarIR | undefined;\n values?: ScalarIR[] | undefined;\n })\n | (ConditionBaseIR & {\n /** Event payload predicate; `path` is dotted for nested fields ('tags.utm_source'). */\n type: 'payload';\n path: string;\n op: PropertyOperatorIR;\n value?: ScalarIR | undefined;\n values?: ScalarIR[] | undefined;\n })\n | (ConditionBaseIR & {\n /**\n * A predicate on the payload of the event that started the journey. Valid in the workflow\n * that event triggers (flow conditions, goal, exitWhen) and nowhere else: a segment or a\n * trigger filter has no journey to read it from.\n */\n type: 'trigger_payload';\n event: string;\n path: string;\n op: PropertyOperatorIR;\n value?: ScalarIR | undefined;\n values?: ScalarIR[] | undefined;\n })\n | (ConditionBaseIR & {\n type: 'performed';\n event: string;\n /** Payload filter: only events matching it count (a payload-only subtree). */\n where?: ConditionIR | undefined;\n within?: DurationIR | undefined;\n count?: number | undefined;\n })\n /**\n * The user can be reached on the channel right now: for push, the host's\n * device directory lists at least one device; for the others, the channel's\n * recipient property (email, phone, …) is set.\n */\n | (ConditionBaseIR & { type: 'reachable'; channel: ChannelIR });\n\nconst conditionBase = { meta: z.optional(NodeMetaIR) };\n\nexport const ConditionIR: z.ZodMiniType<ConditionIR> = z.lazy(() =>\n z.discriminatedUnion('type', [\n z.object({ ...conditionBase, type: z.literal('and'), conditions: z.array(ConditionIR) }),\n z.object({ ...conditionBase, type: z.literal('or'), conditions: z.array(ConditionIR) }),\n z.object({ ...conditionBase, type: z.literal('not'), condition: ConditionIR }),\n z.object({ ...conditionBase, type: z.literal('segment'), segment: z.string() }),\n z.object({\n ...conditionBase,\n type: z.literal('property'),\n path: z.string(),\n op: PropertyOperatorIR,\n value: z.optional(ScalarIR),\n values: z.optional(z.array(ScalarIR)),\n }),\n z.object({\n ...conditionBase,\n type: z.literal('payload'),\n path: z.string(),\n op: PropertyOperatorIR,\n value: z.optional(ScalarIR),\n values: z.optional(z.array(ScalarIR)),\n }),\n z.object({\n ...conditionBase,\n type: z.literal('trigger_payload'),\n event: z.string(),\n path: z.string(),\n op: PropertyOperatorIR,\n value: z.optional(ScalarIR),\n values: z.optional(z.array(ScalarIR)),\n }),\n z.object({\n ...conditionBase,\n type: z.literal('performed'),\n event: z.string(),\n where: z.optional(ConditionIR),\n within: z.optional(DurationIR),\n count: z.optional(z.number()),\n }),\n z.object({ ...conditionBase, type: z.literal('reachable'), channel: ChannelIR }),\n ])\n);\n\n/* --------------------------------- Triggers --------------------------------- */\n\n/**\n * Trigger shapes. A date trigger starts a journey for every known user its `filter` holds for,\n * once, when its time comes. The event trigger has two independent gates: `where` tests\n * the triggering event's payload (payload-only subtree, evaluated against the\n * incoming event before anything else), `filter` tests the user's profile.\n */\nexport const TriggerIR = z.discriminatedUnion('type', [\n z.object({\n type: z.literal('event'),\n event: z.string(),\n where: z.optional(ConditionIR),\n filter: z.optional(ConditionIR),\n visitors: z.optional(z.literal(true)),\n }),\n z.object({ type: z.literal('segment'), segment: z.string() }),\n z.object({\n type: z.literal('date'),\n /** 'YYYY-MM-DD HH:mm:ss', UTC. */\n at: z.string(),\n /** Who enters at that time: everyone known when absent, else those the condition holds for then. */\n filter: z.optional(ConditionIR),\n }),\n z.object({ type: z.literal('webhook') }),\n]);\nexport type TriggerIR = z.infer<typeof TriggerIR>;\n\n/* ----------------------------------- Nodes ---------------------------------- */\n\ninterface NodeBaseIR {\n /** Stable id derived from the structural path (rules in the file header). */\n id: string;\n /** Optional node name: UI title / observability handle (branch's optional first argument lands here). */\n label?: string | undefined;\n /** Metadata (provenance); excluded from contentHash. */\n meta?: NodeMetaIR | undefined;\n}\n\nexport type NodeIR =\n | (NodeBaseIR & {\n type: 'message';\n channel: ChannelIR;\n template: string;\n props: Record<string, PropValueIR>;\n /**\n * Push only: which of the user's devices get a copy. Absent means every\n * device the directory lists; 'latest' only the most recently registered.\n */\n devices?: 'latest' | undefined;\n /**\n * Email and push: the template's subscription topic, or null for a transactional message\n * (sent whatever the user opted out of). Absent for other channels, and in IR compiled\n * before topics existed: such a step checks the channel-level opt-out only, as it always did.\n */\n topic?: string | null | undefined;\n /**\n * The template opted into at-least-once: a replayed send step sends a copy an earlier run\n * claimed but never settled again. Absent (the default, 'skip') the copy is not sent again\n * — kept absent rather than written as 'skip', so adding the option changed no node hash.\n */\n redelivery?: 'resend' | undefined;\n })\n | (NodeBaseIR & { type: 'delay'; duration: DurationIR })\n | (NodeBaseIR & { type: 'random_delay'; min: DurationIR; max: DurationIR })\n | (NodeBaseIR & {\n type: 'time_window';\n days: WeekdayIR[];\n between: [string, string];\n tz: string;\n })\n | (NodeBaseIR & {\n type: 'wait_until';\n condition: ConditionIR;\n timeout: DurationIR;\n onTimeout: 'continue' | 'exit' | NodeIR[];\n })\n | (NodeBaseIR & {\n type: 'branch';\n cases: { label?: string | undefined; condition: ConditionIR; flow: NodeIR[] }[];\n /** Default arm (the DSL's bare tail argument). Absent = fall through to the main line. */\n otherwise?: NodeIR[] | undefined;\n })\n | (NodeBaseIR & {\n type: 'filter';\n /** Audit-log line for the users this gate drops. Metadata: excluded from contentHash. */\n reason?: string | undefined;\n condition: ConditionIR;\n })\n | (NodeBaseIR & {\n type: 'cohort';\n /**\n * Explicit experiment key: bucketing hashes `userId:key` instead of the\n * structural node id, so the assignment survives node insertion/moves and\n * the experiment keeps one identity across workflow versions. Absent →\n * the node id is used (fine for one-off splits).\n */\n key?: string | undefined;\n /**\n * Arms in authoring order — the order the interpreter accumulates weights\n * in, so it decides which bucket range each arm owns. The DSL keeps that\n * promise by rejecting integer-like arm names, which JavaScript would\n * hoist to the front of the object in numeric order. Weights sum to 100.\n */\n arms: { name: string; weight: number; flow: NodeIR[] }[];\n })\n | (NodeBaseIR & {\n /** `reason` is the audit-log line. Metadata: excluded from contentHash. */\n type: 'exit';\n reason?: string | undefined;\n })\n | (NodeBaseIR & { type: 'send_event'; event: string; payload: Record<string, PropValueIR> })\n | (NodeBaseIR & {\n type: 'action';\n /** Registry name of the custom action; the code itself lives in the deployed Worker bundle. */\n action: string;\n /** Argument values; user_property references are resolved at run time, like message props. */\n args: Record<string, PropValueIR>;\n });\n\nconst nodeBase = { id: z.string(), label: z.optional(z.string()), meta: z.optional(NodeMetaIR) };\n\nexport const NodeIR: z.ZodMiniType<NodeIR> = z.lazy(() =>\n z.discriminatedUnion('type', [\n z.object({\n ...nodeBase,\n type: z.literal('message'),\n channel: ChannelIR,\n template: z.string(),\n props: z.record(z.string(), PropValueIR),\n devices: z.optional(z.literal('latest')),\n topic: z.optional(z.nullable(z.string())),\n redelivery: z.optional(z.literal('resend')),\n }),\n z.object({ ...nodeBase, type: z.literal('delay'), duration: DurationIR }),\n z.object({ ...nodeBase, type: z.literal('random_delay'), min: DurationIR, max: DurationIR }),\n z.object({\n ...nodeBase,\n type: z.literal('time_window'),\n days: z.array(WeekdayIR),\n between: z.tuple([z.string(), z.string()]),\n tz: z.string(),\n }),\n z.object({\n ...nodeBase,\n type: z.literal('wait_until'),\n condition: ConditionIR,\n timeout: DurationIR,\n onTimeout: z.union([z.literal('continue'), z.literal('exit'), z.array(NodeIR)]),\n }),\n z.object({\n ...nodeBase,\n type: z.literal('branch'),\n cases: z.array(\n z.object({\n label: z.optional(z.string()),\n condition: ConditionIR,\n flow: z.array(NodeIR),\n })\n ),\n otherwise: z.optional(z.array(NodeIR)),\n }),\n z.object({\n ...nodeBase,\n type: z.literal('filter'),\n condition: ConditionIR,\n reason: z.optional(z.string()),\n }),\n z.object({\n ...nodeBase,\n type: z.literal('cohort'),\n key: z.optional(z.string()),\n arms: z.array(z.object({ name: z.string(), weight: z.number(), flow: z.array(NodeIR) })),\n }),\n z.object({ ...nodeBase, type: z.literal('exit'), reason: z.optional(z.string()) }),\n z.object({\n ...nodeBase,\n type: z.literal('send_event'),\n event: z.string(),\n payload: z.record(z.string(), PropValueIR),\n }),\n z.object({\n ...nodeBase,\n type: z.literal('action'),\n action: z.string(),\n args: z.record(z.string(), PropValueIR),\n }),\n ])\n);\n\n/* ---------------------- Top-level definitions and bundle --------------------- */\n\nexport const GoalIR = z.object({\n condition: ConditionIR,\n within: z.optional(DurationIR),\n exitOnMatch: z.boolean(),\n});\nexport type GoalIR = z.infer<typeof GoalIR>;\n\n/**\n * Human-facing metadata: **excluded from contentHash** (see hash.ts).\n * Editing a name or description does not touch execution semantics, so it never\n * invalidates the version in-flight users are pinned to, nor shows up in plan.\n */\nexport const MetaIR = z.object({\n /**\n * Human label. The asset's `id` is its identity — a wire key that routing\n * tables and the entry ledger are built on — so it is not something to\n * rename for readability. This is: it is metadata, dropped before hashing,\n * and the studio shows it in place of the key wherever it is set.\n */\n name: z.optional(z.string()),\n description: z.optional(z.string()),\n loc: z.optional(SourceLocIR),\n});\nexport type MetaIR = z.infer<typeof MetaIR>;\n\n/**\n * Re-entry policy (`workflow({ reentry })`, README \"Re-entry\"): whether a user who already entered\n * may enter again. `never` enters a user once; `after_exit` again once their previous instance\n * ended; `concurrent` while it still runs. `cooldown` is the least time from the user's previous\n * entry to the next one. The `never` branch is strict, so a cooldown on it is refused rather\n * than dropped.\n */\nexport const ReentryIR = z.discriminatedUnion('mode', [\n z.strictObject({ mode: z.literal('never') }),\n z.strictObject({ mode: z.literal('after_exit'), cooldown: z.optional(DurationIR) }),\n z.strictObject({ mode: z.literal('concurrent'), cooldown: z.optional(DurationIR) }),\n]);\nexport type ReentryIR = z.infer<typeof ReentryIR>;\n\nexport const WorkflowIR = z.object({\n irVersion: z.literal(IR_VERSION),\n /** Wire identity (`workflow({ id })`): routing tables, the entry ledger and reporting are keyed on it. */\n id: z.string(),\n contentHash: z.string(),\n meta: z.optional(MetaIR),\n trigger: TriggerIR,\n reentry: ReentryIR,\n goal: z.optional(GoalIR),\n exitWhen: z.optional(ConditionIR),\n flow: z.array(NodeIR),\n});\nexport type WorkflowIR = z.infer<typeof WorkflowIR>;\n\nexport const SegmentIR = z.object({\n irVersion: z.literal(IR_VERSION),\n /** Wire identity (`segment({ id })`): segment references and the membership store are keyed on it. */\n id: z.string(),\n contentHash: z.string(),\n /** Provenance plus the human label — MetaIR, same as a workflow's. */\n meta: z.optional(MetaIR),\n condition: ConditionIR,\n});\nexport type SegmentIR = z.infer<typeof SegmentIR>;\n\n/** Template manifest entry: IR records only the reference; the body lives in the template system. */\nexport const TemplateIR = z.object({\n irVersion: z.literal(IR_VERSION),\n key: z.string(),\n channel: ChannelIR,\n});\nexport type TemplateIR = z.infer<typeof TemplateIR>;\n\n/**\n * Action manifest entry: IR records the name; the implementation solidifies\n * into the Worker bundle at deploy time, never into IR (custom code stays out\n * of the data plane by design).\n */\nexport const ActionIR = z.object({\n irVersion: z.literal(IR_VERSION),\n name: z.string(),\n});\nexport type ActionIR = z.infer<typeof ActionIR>;\n\n/**\n * Deployment unit: the complete snapshot one `deploy` produces (terraform\n * apply, same mental model). The server diffs each definition's contentHash to\n * decide publish / skip / retire.\n */\n/**\n * The subscription topics the contract declares, carried by the bundle so the engine validates\n * `/subscriptions` and the templates' topics against the deployed list, not the SDK's word.\n */\nexport const SubscriptionsIR = z.object({\n topics: z.array(z.string()),\n});\nexport type SubscriptionsIR = z.infer<typeof SubscriptionsIR>;\n\nexport const BundleIR = z.object({\n irVersion: z.literal(IR_VERSION),\n workflows: z.array(WorkflowIR),\n segments: z.array(SegmentIR),\n templates: z.array(TemplateIR),\n actions: z.array(ActionIR),\n /** Absent in a bundle compiled before topics existed: no topics. */\n subscriptions: z.optional(SubscriptionsIR),\n});\nexport type BundleIR = z.infer<typeof BundleIR>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AACX,CAAC;;;;;;AAQD,MAAa,WAAW,EAAE,OAAO;CAC/B,WAAW,EAAE,QAAA,CAAkB;CAC/B,MAAM,EAAE,OAAO;AACjB,CAAC;;;;;;;;;;AAYD,MAAa,kBAAkB,EAAE,OAAO,EACtC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAC5B,CAAC;AAGD,MAAa,WAAW,EAAE,OAAO;CAC/B,WAAW,EAAE,QAAA,CAAkB;CAC/B,WAAW,EAAE,MAAM,UAAU;CAC7B,UAAU,EAAE,MAAM,SAAS;CAC3B,WAAW,EAAE,MAAM,UAAU;CAC7B,SAAS,EAAE,MAAM,QAAQ;;CAEzB,eAAe,EAAE,SAAS,eAAe;AAC3C,CAAC"}
|
package/dist/jwt.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let node_buffer = require("node:buffer");
|
|
3
|
+
// src/jwt.ts
|
|
4
|
+
/**
|
|
5
|
+
* The byte-level helpers the token signers share (`fcm.ts`, `apns.ts`, `webpush.ts`): JWT
|
|
6
|
+
* base64url and PEM → DER for WebCrypto's `importKey('pkcs8', …)`.
|
|
7
|
+
*/
|
|
8
|
+
const base64url = (bytes) => node_buffer.Buffer.from(bytes).toString("base64url");
|
|
9
|
+
function pemToDer(pem) {
|
|
10
|
+
const body = pem.replace(/-----[A-Z ]+-----/g, "").replace(/\s+/g, "");
|
|
11
|
+
const der = node_buffer.Buffer.from(body, "base64");
|
|
12
|
+
return der.buffer.slice(der.byteOffset, der.byteOffset + der.byteLength);
|
|
13
|
+
}
|
|
14
|
+
exports.base64url = base64url;
|
|
15
|
+
exports.pemToDer = pemToDer;
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=jwt.cjs.map
|
package/dist/jwt.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.cjs","names":["Buffer"],"sources":["../src/jwt.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\n/**\n * The byte-level helpers the token signers share (`fcm.ts`, `apns.ts`, `webpush.ts`): JWT\n * base64url and PEM → DER for WebCrypto's `importKey('pkcs8', …)`.\n */\n\nexport const base64url = (bytes: Uint8Array | string): string =>\n Buffer.from(bytes).toString('base64url');\n\nexport function pemToDer(pem: string): ArrayBuffer {\n const body = pem.replace(/-----[A-Z ]+-----/g, '').replace(/\\s+/g, '');\n const der = Buffer.from(body, 'base64');\n return der.buffer.slice(der.byteOffset, der.byteOffset + der.byteLength);\n}\n"],"mappings":";;;;;;;AAOA,MAAa,aAAa,UACxBA,YAAAA,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,WAAW;AAEzC,SAAgB,SAAS,KAA0B;CACjD,MAAM,OAAO,IAAI,QAAQ,sBAAsB,EAAE,CAAC,CAAC,QAAQ,QAAQ,EAAE;CACrE,MAAM,MAAMA,YAAAA,OAAO,KAAK,MAAM,QAAQ;CACtC,OAAO,IAAI,OAAO,MAAM,IAAI,YAAY,IAAI,aAAa,IAAI,UAAU;AACzE"}
|
package/dist/jwt.d.cts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The byte-level helpers the token signers share (`fcm.ts`, `apns.ts`, `webpush.ts`): JWT
|
|
3
|
+
* base64url and PEM → DER for WebCrypto's `importKey('pkcs8', …)`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const base64url: (bytes: Uint8Array | string) => string;
|
|
6
|
+
export declare function pemToDer(pem: string): ArrayBuffer;
|
|
7
|
+
//# sourceMappingURL=jwt.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.d.cts","names":[],"sources":["../src/jwt.ts"],"mappings":";;;;qBAOa,YAAS,OAAW;wBAGjB,SAAS,cAAc"}
|
package/dist/jwt.d.mts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The byte-level helpers the token signers share (`fcm.ts`, `apns.ts`, `webpush.ts`): JWT
|
|
3
|
+
* base64url and PEM → DER for WebCrypto's `importKey('pkcs8', …)`.
|
|
4
|
+
*/
|
|
5
|
+
export declare const base64url: (bytes: Uint8Array | string) => string;
|
|
6
|
+
export declare function pemToDer(pem: string): ArrayBuffer;
|
|
7
|
+
//# sourceMappingURL=jwt.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.d.mts","names":[],"sources":["../src/jwt.ts"],"mappings":";;;;qBAOa,YAAS,OAAW;wBAGjB,SAAS,cAAc"}
|
package/dist/jwt.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
// src/jwt.ts
|
|
3
|
+
/**
|
|
4
|
+
* The byte-level helpers the token signers share (`fcm.ts`, `apns.ts`, `webpush.ts`): JWT
|
|
5
|
+
* base64url and PEM → DER for WebCrypto's `importKey('pkcs8', …)`.
|
|
6
|
+
*/
|
|
7
|
+
const base64url = (bytes) => Buffer.from(bytes).toString("base64url");
|
|
8
|
+
function pemToDer(pem) {
|
|
9
|
+
const body = pem.replace(/-----[A-Z ]+-----/g, "").replace(/\s+/g, "");
|
|
10
|
+
const der = Buffer.from(body, "base64");
|
|
11
|
+
return der.buffer.slice(der.byteOffset, der.byteOffset + der.byteLength);
|
|
12
|
+
}
|
|
13
|
+
export { base64url, pemToDer };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=jwt.mjs.map
|
package/dist/jwt.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.mjs","names":[],"sources":["../src/jwt.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\n/**\n * The byte-level helpers the token signers share (`fcm.ts`, `apns.ts`, `webpush.ts`): JWT\n * base64url and PEM → DER for WebCrypto's `importKey('pkcs8', …)`.\n */\n\nexport const base64url = (bytes: Uint8Array | string): string =>\n Buffer.from(bytes).toString('base64url');\n\nexport function pemToDer(pem: string): ArrayBuffer {\n const body = pem.replace(/-----[A-Z ]+-----/g, '').replace(/\\s+/g, '');\n const der = Buffer.from(body, 'base64');\n return der.buffer.slice(der.byteOffset, der.byteOffset + der.byteLength);\n}\n"],"mappings":";;;;;;AAOA,MAAa,aAAa,UACxB,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,WAAW;AAEzC,SAAgB,SAAS,KAA0B;CACjD,MAAM,OAAO,IAAI,QAAQ,sBAAsB,EAAE,CAAC,CAAC,QAAQ,QAAQ,EAAE;CACrE,MAAM,MAAM,OAAO,KAAK,MAAM,QAAQ;CACtC,OAAO,IAAI,OAAO,MAAM,IAAI,YAAY,IAAI,aAAa,IAAI,UAAU;AACzE"}
|