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 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.cts","names":[],"sources":["../../src/dsl/base.ts"],"mappings":";;;;;;;;;;;;;;;YAkBY;;;;;;iBAOK;EACf;EACA;;;YAIU;YAYA;;YAGA;;;;;;wBASI,iBAAiB,OAAO;;;;;;wBAWxB,WAAW,OAAO,WAAW"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DurationIR } from "../ir.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Base vocabulary shared by the whole DSL: the schema constraints an app's
|
|
4
|
+
* types must satisfy, and the literal types (durations, weekdays, clock times)
|
|
5
|
+
* the builder methods accept.
|
|
6
|
+
*
|
|
7
|
+
* Type technique: `Duration` is a template-literal union — '1 huor' is a
|
|
8
|
+
* compile error, no runtime validation needed for the common case.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Event name → payload shape, supplied by the app (its analytics schema).
|
|
12
|
+
* Constrained to `object` rather than `Record`: interfaces have no implicit
|
|
13
|
+
* index signature, so a Record constraint would reject an interface-defined
|
|
14
|
+
* schema. Event names come from `keyof E`, payloads from `E[N]`.
|
|
15
|
+
*/
|
|
16
|
+
export type EventMap = object;
|
|
17
|
+
/**
|
|
18
|
+
* Base shape of user properties; the app extends it with concrete fields.
|
|
19
|
+
* `email` is optional: a profile can exist before (or without) an address,
|
|
20
|
+
* and an email step refuses to send when the recipient is missing.
|
|
21
|
+
*/
|
|
22
|
+
export interface UserPropertyBase {
|
|
23
|
+
userId: string;
|
|
24
|
+
email?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Duration literal: '1 hour' / '23 hours' / '30 days' — typos fail to compile. */
|
|
27
|
+
export type Duration = `${number} ${'second' | 'seconds' | 'minute' | 'minutes' | 'hour' | 'hours' | 'day' | 'days' | 'week' | 'weeks'}`;
|
|
28
|
+
export type Weekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';
|
|
29
|
+
/** 'HH:mm' (24h, leading zeros). The type cannot express digit ranges, so builders validate at runtime via timeOfDayMinutes. */
|
|
30
|
+
export type TimeOfDay = `${string}:${string}`;
|
|
31
|
+
/**
|
|
32
|
+
* Parse an 'HH:mm' literal to minutes since midnight, throwing on anything the
|
|
33
|
+
* type let through ('9:00', '25:00', 'ab:cd').
|
|
34
|
+
* @internal shared by flow builders, not part of the public API
|
|
35
|
+
*/
|
|
36
|
+
export declare function timeOfDayMinutes(value: TimeOfDay): number;
|
|
37
|
+
/**
|
|
38
|
+
* Duration parsing delegates to `ms` (typed StringValue); Duration is it's
|
|
39
|
+
* stricter, full-word subset.
|
|
40
|
+
* @internal shared by condition/flow/workflow, not part of the public API
|
|
41
|
+
*/
|
|
42
|
+
export declare function durationIR(value: Duration): DurationIR;
|
|
43
|
+
//# sourceMappingURL=base.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.mts","names":[],"sources":["../../src/dsl/base.ts"],"mappings":";;;;;;;;;;;;;;;YAkBY;;;;;;iBAOK;EACf;EACA;;;YAIU;YAYA;;YAGA;;;;;;wBASI,iBAAiB,OAAO;;;;;;wBAWxB,WAAW,OAAO,WAAW"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import ms from "ms";
|
|
2
|
+
// src/dsl/base.ts
|
|
3
|
+
const TIME_OF_DAY = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
4
|
+
/**
|
|
5
|
+
* Parse an 'HH:mm' literal to minutes since midnight, throwing on anything the
|
|
6
|
+
* type let through ('9:00', '25:00', 'ab:cd').
|
|
7
|
+
* @internal shared by flow builders, not part of the public API
|
|
8
|
+
*/
|
|
9
|
+
function timeOfDayMinutes(value) {
|
|
10
|
+
const match = TIME_OF_DAY.exec(value);
|
|
11
|
+
if (!match) throw new Error(`Invalid time of day: '${value}' (expected 'HH:mm', e.g. '09:00')`);
|
|
12
|
+
return Number(match[1]) * 60 + Number(match[2]);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Duration parsing delegates to `ms` (typed StringValue); Duration is it's
|
|
16
|
+
* stricter, full-word subset.
|
|
17
|
+
* @internal shared by condition/flow/workflow, not part of the public API
|
|
18
|
+
*/
|
|
19
|
+
function durationIR(value) {
|
|
20
|
+
const millis = ms(value);
|
|
21
|
+
if (typeof millis !== "number" || Number.isNaN(millis) || millis < 0) throw new Error(`Invalid duration: '${value}'`);
|
|
22
|
+
return {
|
|
23
|
+
value,
|
|
24
|
+
ms: millis
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export { durationIR, timeOfDayMinutes };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=base.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.mjs","names":[],"sources":["../../src/dsl/base.ts"],"sourcesContent":["import ms from 'ms';\nimport type { DurationIR } from '../ir';\n\n/**\n * Base vocabulary shared by the whole DSL: the schema constraints an app's\n * types must satisfy, and the literal types (durations, weekdays, clock times)\n * the builder methods accept.\n *\n * Type technique: `Duration` is a template-literal union — '1 huor' is a\n * compile error, no runtime validation needed for the common case.\n */\n\n/**\n * Event name → payload shape, supplied by the app (its analytics schema).\n * Constrained to `object` rather than `Record`: interfaces have no implicit\n * index signature, so a Record constraint would reject an interface-defined\n * schema. Event names come from `keyof E`, payloads from `E[N]`.\n */\nexport type EventMap = object;\n\n/**\n * Base shape of user properties; the app extends it with concrete fields.\n * `email` is optional: a profile can exist before (or without) an address,\n * and an email step refuses to send when the recipient is missing.\n */\nexport interface UserPropertyBase {\n userId: string;\n email?: string;\n}\n\n/** Duration literal: '1 hour' / '23 hours' / '30 days' — typos fail to compile. */\nexport type Duration = `${number} ${\n | 'second'\n | 'seconds'\n | 'minute'\n | 'minutes'\n | 'hour'\n | 'hours'\n | 'day'\n | 'days'\n | 'week'\n | 'weeks'}`;\n\nexport type Weekday = 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat' | 'sun';\n\n/** 'HH:mm' (24h, leading zeros). The type cannot express digit ranges, so builders validate at runtime via timeOfDayMinutes. */\nexport type TimeOfDay = `${string}:${string}`;\n\nconst TIME_OF_DAY = /^([01]\\d|2[0-3]):([0-5]\\d)$/;\n\n/**\n * Parse an 'HH:mm' literal to minutes since midnight, throwing on anything the\n * type let through ('9:00', '25:00', 'ab:cd').\n * @internal shared by flow builders, not part of the public API\n */\nexport function timeOfDayMinutes(value: TimeOfDay): number {\n const match = TIME_OF_DAY.exec(value);\n if (!match) throw new Error(`Invalid time of day: '${value}' (expected 'HH:mm', e.g. '09:00')`);\n return Number(match[1]) * 60 + Number(match[2]);\n}\n\n/**\n * Duration parsing delegates to `ms` (typed StringValue); Duration is it's\n * stricter, full-word subset.\n * @internal shared by condition/flow/workflow, not part of the public API\n */\nexport function durationIR(value: Duration): DurationIR {\n const millis = ms(value);\n if (typeof millis !== 'number' || Number.isNaN(millis) || millis < 0) {\n throw new Error(`Invalid duration: '${value}'`);\n }\n return { value, ms: millis };\n}\n"],"mappings":";;AAgDA,MAAM,cAAc;;;;;;AAOpB,SAAgB,iBAAiB,OAA0B;CACzD,MAAM,QAAQ,YAAY,KAAK,KAAK;CACpC,IAAI,CAAC,OAAO,MAAM,IAAI,MAAM,yBAAyB,MAAM,mCAAmC;CAC9F,OAAO,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE;AAChD;;;;;;AAOA,SAAgB,WAAW,OAA6B;CACtD,MAAM,SAAS,GAAG,KAAK;CACvB,IAAI,OAAO,WAAW,YAAY,OAAO,MAAM,MAAM,KAAK,SAAS,GACjE,MAAM,IAAI,MAAM,sBAAsB,MAAM,EAAE;CAEhD,OAAO;EAAE;EAAO,IAAI;CAAO;AAC7B"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_hash = require("../hash.cjs");
|
|
3
|
+
const require_ir = require("../ir.cjs");
|
|
4
|
+
const require_plan = require("../plan.cjs");
|
|
5
|
+
const require_templates = require("../templates.cjs");
|
|
6
|
+
const require_dsl_flow = require("./flow.cjs");
|
|
7
|
+
// src/dsl/bundle.ts
|
|
8
|
+
/**
|
|
9
|
+
* The deployment unit — compileBundle gathers workflows, segments and the
|
|
10
|
+
* template manifest into one BundleIR snapshot (terraform-apply mental model);
|
|
11
|
+
* the server diffs each definition by contentHash (see plan.ts).
|
|
12
|
+
*/
|
|
13
|
+
function compileBundle(input) {
|
|
14
|
+
const segments = (input.segments ?? []).map((segment) => {
|
|
15
|
+
const { id, definition, loc, meta } = segment;
|
|
16
|
+
const compiled = {
|
|
17
|
+
irVersion: 3,
|
|
18
|
+
id,
|
|
19
|
+
contentHash: require_hash.semanticHash(definition),
|
|
20
|
+
condition: definition
|
|
21
|
+
};
|
|
22
|
+
const merged = {
|
|
23
|
+
...meta?.name !== void 0 ? { name: meta.name } : {},
|
|
24
|
+
...meta?.description !== void 0 ? { description: meta.description } : {},
|
|
25
|
+
...loc !== void 0 ? { loc } : {}
|
|
26
|
+
};
|
|
27
|
+
if (Object.keys(merged).length > 0) compiled.meta = merged;
|
|
28
|
+
return compiled;
|
|
29
|
+
});
|
|
30
|
+
const templates = (input.templates ?? []).map((template) => ({
|
|
31
|
+
irVersion: 3,
|
|
32
|
+
key: template.id,
|
|
33
|
+
channel: require_templates.CHANNEL_OF[template.kind]
|
|
34
|
+
}));
|
|
35
|
+
const actions = (input.actions ?? []).map((a) => ({
|
|
36
|
+
irVersion: 3,
|
|
37
|
+
name: a.name
|
|
38
|
+
}));
|
|
39
|
+
const workflows = input.workflows.map((builder) => builder.toIR());
|
|
40
|
+
assertUniqueNames(workflows.map((w) => w.id), "workflow");
|
|
41
|
+
assertUniqueNames(segments.map((s) => s.id), "segment");
|
|
42
|
+
assertUniqueNames(templates.map((t) => `${t.channel}:${t.key}`), "template");
|
|
43
|
+
assertUniqueNames(actions.map((a) => a.name), "action");
|
|
44
|
+
assertSegmentRefsResolve(workflows, segments);
|
|
45
|
+
assertNoSegmentCycles(segments);
|
|
46
|
+
assertConditionPlacement(workflows, segments);
|
|
47
|
+
for (const workflow of workflows) assertTriggerRefs(workflow);
|
|
48
|
+
assertActionRefsResolve(workflows, input.workflows, input.actions ?? []);
|
|
49
|
+
return require_ir.BundleIR.parse({
|
|
50
|
+
irVersion: 3,
|
|
51
|
+
workflows,
|
|
52
|
+
segments,
|
|
53
|
+
templates,
|
|
54
|
+
actions,
|
|
55
|
+
subscriptions: { topics: [...input.subscriptions?.topics ?? []] }
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function assertUniqueNames(names, kind) {
|
|
59
|
+
const seen = /* @__PURE__ */ new Set();
|
|
60
|
+
for (const name of names) {
|
|
61
|
+
if (seen.has(name)) throw new Error(`compileBundle: duplicate ${kind} name '${name}'`);
|
|
62
|
+
seen.add(name);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function assertSegmentRefsResolve(workflows, segments) {
|
|
66
|
+
const defined = new Set(segments.map((s) => s.id));
|
|
67
|
+
const check = (refs, owner) => {
|
|
68
|
+
for (const ref of refs) if (!defined.has(ref)) throw new Error(`compileBundle: ${owner} references segment '${ref}' that is not in the bundle — pass it in 'segments'`);
|
|
69
|
+
};
|
|
70
|
+
for (const workflow of workflows) check(referencedSegments(workflow), `workflow '${workflow.id}'`);
|
|
71
|
+
for (const segment of segments) {
|
|
72
|
+
const refs = /* @__PURE__ */ new Set();
|
|
73
|
+
collectConditionRefs(segment.condition, refs);
|
|
74
|
+
check(refs, `segment '${segment.id}'`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Every segment the workflow names: its trigger, filter, goal, exit condition and the conditions in its flow. */
|
|
78
|
+
function referencedSegments(workflow) {
|
|
79
|
+
const refs = /* @__PURE__ */ new Set();
|
|
80
|
+
if (workflow.trigger.type === "segment") refs.add(workflow.trigger.segment);
|
|
81
|
+
if ((workflow.trigger.type === "event" || workflow.trigger.type === "date") && workflow.trigger.filter !== void 0) collectConditionRefs(workflow.trigger.filter, refs);
|
|
82
|
+
if (workflow.goal !== void 0) collectConditionRefs(workflow.goal.condition, refs);
|
|
83
|
+
if (workflow.exitWhen !== void 0) collectConditionRefs(workflow.exitWhen, refs);
|
|
84
|
+
collectNodeRefs(workflow.flow, refs);
|
|
85
|
+
return refs;
|
|
86
|
+
}
|
|
87
|
+
function collectConditionRefs(condition, into) {
|
|
88
|
+
switch (condition.type) {
|
|
89
|
+
case "and":
|
|
90
|
+
case "or":
|
|
91
|
+
for (const child of condition.conditions) collectConditionRefs(child, into);
|
|
92
|
+
break;
|
|
93
|
+
case "not":
|
|
94
|
+
collectConditionRefs(condition.condition, into);
|
|
95
|
+
break;
|
|
96
|
+
case "segment": into.add(condition.segment);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function collectNodeRefs(nodes, into) {
|
|
100
|
+
for (const node of nodes) switch (node.type) {
|
|
101
|
+
case "wait_until":
|
|
102
|
+
collectConditionRefs(node.condition, into);
|
|
103
|
+
if (Array.isArray(node.onTimeout)) collectNodeRefs(node.onTimeout, into);
|
|
104
|
+
break;
|
|
105
|
+
case "branch":
|
|
106
|
+
for (const branchCase of node.cases) {
|
|
107
|
+
collectConditionRefs(branchCase.condition, into);
|
|
108
|
+
collectNodeRefs(branchCase.flow, into);
|
|
109
|
+
}
|
|
110
|
+
if (node.otherwise) collectNodeRefs(node.otherwise, into);
|
|
111
|
+
break;
|
|
112
|
+
case "filter":
|
|
113
|
+
collectConditionRefs(node.condition, into);
|
|
114
|
+
break;
|
|
115
|
+
case "cohort": for (const arm of node.arms) collectNodeRefs(arm.flow, into);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function assertActionRefsResolve(workflows, builders, actions) {
|
|
119
|
+
const listed = new Map(actions.map((a) => [a.name, a]));
|
|
120
|
+
workflows.forEach((workflow, i) => {
|
|
121
|
+
for (const used of require_dsl_flow.actionUses(builders[i])) {
|
|
122
|
+
const manifest = listed.get(used.name);
|
|
123
|
+
if (manifest === void 0) throw new Error(`compileBundle: workflow '${workflow.id}' runs action '${used.name}' that is not in the bundle — pass it in 'actions'`);
|
|
124
|
+
if (manifest !== used && manifest.handler !== used.handler) throw new Error(`compileBundle: workflow '${workflow.id}' runs action '${used.name}' that is not the definition listed in 'actions' — two definitions are sharing that name`);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/** Walk segment → segment references depth-first; the first back edge is reported as the cycle path. */
|
|
129
|
+
function assertNoSegmentCycles(segments) {
|
|
130
|
+
const refsOf = /* @__PURE__ */ new Map();
|
|
131
|
+
for (const segment of segments) {
|
|
132
|
+
const refs = /* @__PURE__ */ new Set();
|
|
133
|
+
collectConditionRefs(segment.condition, refs);
|
|
134
|
+
refsOf.set(segment.id, refs);
|
|
135
|
+
}
|
|
136
|
+
const done = /* @__PURE__ */ new Set();
|
|
137
|
+
const path = [];
|
|
138
|
+
const visit = (id) => {
|
|
139
|
+
const at = path.indexOf(id);
|
|
140
|
+
if (at !== -1) {
|
|
141
|
+
const cycle = [...path.slice(at), id].join(" → ");
|
|
142
|
+
throw new Error(`compileBundle: segments reference each other in a cycle: ${cycle}`);
|
|
143
|
+
}
|
|
144
|
+
if (done.has(id)) return;
|
|
145
|
+
path.push(id);
|
|
146
|
+
for (const ref of refsOf.get(id) ?? []) visit(ref);
|
|
147
|
+
path.pop();
|
|
148
|
+
done.add(id);
|
|
149
|
+
};
|
|
150
|
+
for (const id of refsOf.keys()) visit(id);
|
|
151
|
+
}
|
|
152
|
+
function assertConditionPlacement(workflows, segments) {
|
|
153
|
+
for (const workflow of workflows) {
|
|
154
|
+
if (workflow.trigger.type === "event") {
|
|
155
|
+
if (workflow.trigger.where !== void 0) assertWhereTree(workflow.trigger.where, `workflow '${workflow.id}' trigger where`);
|
|
156
|
+
if (workflow.trigger.filter !== void 0) assertProfileTree(workflow.trigger.filter, `workflow '${workflow.id}' trigger filter`, { journey: false });
|
|
157
|
+
}
|
|
158
|
+
if (workflow.trigger.type === "date" && workflow.trigger.filter !== void 0) assertProfileTree(workflow.trigger.filter, `workflow '${workflow.id}' trigger filter`, { journey: false });
|
|
159
|
+
if (workflow.goal !== void 0) assertProfileTree(workflow.goal.condition, `workflow '${workflow.id}' goal`, JOURNEY);
|
|
160
|
+
if (workflow.exitWhen !== void 0) assertProfileTree(workflow.exitWhen, `workflow '${workflow.id}' exitWhen`, JOURNEY);
|
|
161
|
+
assertNodeTrees(workflow.flow, `workflow '${workflow.id}'`);
|
|
162
|
+
}
|
|
163
|
+
for (const segment of segments) assertProfileTree(segment.condition, `segment '${segment.id}'`, { journey: false });
|
|
164
|
+
}
|
|
165
|
+
const JOURNEY = { journey: true };
|
|
166
|
+
/**
|
|
167
|
+
* A profile-context tree: payload predicates may appear only under a performed.where, and
|
|
168
|
+
* trigger payload predicates only where a journey is running.
|
|
169
|
+
*/
|
|
170
|
+
function assertProfileTree(condition, owner, at) {
|
|
171
|
+
switch (condition.type) {
|
|
172
|
+
case "and":
|
|
173
|
+
case "or":
|
|
174
|
+
for (const child of condition.conditions) assertProfileTree(child, owner, at);
|
|
175
|
+
break;
|
|
176
|
+
case "not":
|
|
177
|
+
assertProfileTree(condition.condition, owner, at);
|
|
178
|
+
break;
|
|
179
|
+
case "trigger_payload":
|
|
180
|
+
if (!at.journey) throw new Error(`compileBundle: ${owner} reads the trigger payload ('${condition.path}') — only a running journey has one; in a trigger, test the event with a where clause`);
|
|
181
|
+
break;
|
|
182
|
+
case "performed":
|
|
183
|
+
if (condition.where !== void 0) assertWhereTree(condition.where, owner);
|
|
184
|
+
break;
|
|
185
|
+
case "payload": throw new Error(`compileBundle: ${owner} uses a payload predicate outside a where clause — payload refs are only valid inside performed({ where }) or trigger.event({ where })`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/** A where tree: payload predicates and combinators only — no profile facts in event scope. */
|
|
189
|
+
function assertWhereTree(condition, owner) {
|
|
190
|
+
switch (condition.type) {
|
|
191
|
+
case "and":
|
|
192
|
+
case "or":
|
|
193
|
+
for (const child of condition.conditions) assertWhereTree(child, owner);
|
|
194
|
+
break;
|
|
195
|
+
case "not":
|
|
196
|
+
assertWhereTree(condition.condition, owner);
|
|
197
|
+
break;
|
|
198
|
+
case "payload": break;
|
|
199
|
+
default: throw new Error(`compileBundle: ${owner} where clause may only contain payload predicates and and/or/not, found '${condition.type}'`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function assertNodeTrees(nodes, owner) {
|
|
203
|
+
for (const node of nodes) switch (node.type) {
|
|
204
|
+
case "wait_until":
|
|
205
|
+
assertProfileTree(node.condition, owner, JOURNEY);
|
|
206
|
+
if (Array.isArray(node.onTimeout)) assertNodeTrees(node.onTimeout, owner);
|
|
207
|
+
break;
|
|
208
|
+
case "branch":
|
|
209
|
+
for (const branchCase of node.cases) {
|
|
210
|
+
assertProfileTree(branchCase.condition, owner, JOURNEY);
|
|
211
|
+
assertNodeTrees(branchCase.flow, owner);
|
|
212
|
+
}
|
|
213
|
+
if (node.otherwise) assertNodeTrees(node.otherwise, owner);
|
|
214
|
+
break;
|
|
215
|
+
case "filter":
|
|
216
|
+
assertProfileTree(node.condition, owner, JOURNEY);
|
|
217
|
+
break;
|
|
218
|
+
case "cohort": for (const arm of node.arms) assertNodeTrees(arm.flow, owner);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/** Every trigger payload reference in a workflow — predicates and values alike. */
|
|
222
|
+
function triggerRefUses(workflow) {
|
|
223
|
+
const uses = [];
|
|
224
|
+
const inCondition = (condition, where) => {
|
|
225
|
+
switch (condition.type) {
|
|
226
|
+
case "and":
|
|
227
|
+
case "or":
|
|
228
|
+
for (const child of condition.conditions) inCondition(child, where);
|
|
229
|
+
break;
|
|
230
|
+
case "not":
|
|
231
|
+
inCondition(condition.condition, where);
|
|
232
|
+
break;
|
|
233
|
+
case "trigger_payload": uses.push({
|
|
234
|
+
event: condition.event,
|
|
235
|
+
path: condition.path,
|
|
236
|
+
where
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
const inValues = (values, where) => {
|
|
241
|
+
for (const value of Object.values(values)) if (typeof value === "object" && value.type === "trigger_payload") uses.push({
|
|
242
|
+
event: value.event,
|
|
243
|
+
path: value.path,
|
|
244
|
+
where
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
if (workflow.goal !== void 0) inCondition(workflow.goal.condition, "the goal");
|
|
248
|
+
if (workflow.exitWhen !== void 0) inCondition(workflow.exitWhen, "exitWhen");
|
|
249
|
+
for (const node of require_plan.nodesOf(workflow.flow)) {
|
|
250
|
+
const where = `node ${node.id}`;
|
|
251
|
+
switch (node.type) {
|
|
252
|
+
case "wait_until":
|
|
253
|
+
case "filter":
|
|
254
|
+
inCondition(node.condition, where);
|
|
255
|
+
break;
|
|
256
|
+
case "branch":
|
|
257
|
+
for (const branchCase of node.cases) inCondition(branchCase.condition, where);
|
|
258
|
+
break;
|
|
259
|
+
case "message":
|
|
260
|
+
inValues(node.props, where);
|
|
261
|
+
break;
|
|
262
|
+
case "send_event":
|
|
263
|
+
inValues(node.payload, where);
|
|
264
|
+
break;
|
|
265
|
+
case "action": inValues(node.args, where);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return uses;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* A workflow reads only the payload it was started with: every reference names the workflow's
|
|
272
|
+
* own trigger event. A handle taken from another trigger type-checks just the same, and would
|
|
273
|
+
* read fields the entering event never had.
|
|
274
|
+
*/
|
|
275
|
+
function assertTriggerRefs(workflow) {
|
|
276
|
+
const { trigger } = workflow;
|
|
277
|
+
for (const use of triggerRefUses(workflow)) {
|
|
278
|
+
const at = `compileBundle: workflow '${workflow.id}' ${use.where} reads '${use.path}' from the payload of a '${use.event}' trigger`;
|
|
279
|
+
if (trigger.type !== "event") throw new Error(`${at}, but the workflow has a ${trigger.type} trigger, which has no payload`);
|
|
280
|
+
if (trigger.event !== use.event) throw new Error(`${at}, but the workflow is triggered by '${trigger.event}' — use the handle of its own trigger`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.compileBundle = compileBundle;
|
|
284
|
+
exports.referencedSegments = referencedSegments;
|
|
285
|
+
exports.triggerRefUses = triggerRefUses;
|
|
286
|
+
|
|
287
|
+
//# sourceMappingURL=bundle.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.cjs","names":["semanticHash","CHANNEL_OF","BundleIRSchema","actionUses","nodesOf"],"sources":["../../src/dsl/bundle.ts"],"sourcesContent":["import { semanticHash } from '../hash';\nimport {\n type BundleIR,\n BundleIR as BundleIRSchema,\n type ConditionIR,\n IR_VERSION,\n type NodeIR,\n type PropValueIR,\n type SegmentIR,\n type WorkflowIR,\n} from '../ir';\nimport { nodesOf } from '../plan';\nimport { type AnyTemplate, CHANNEL_OF } from '../templates';\nimport type { ActionRef } from './action';\nimport type { SegmentInternal, SegmentRef } from './condition';\nimport { actionUses } from './flow';\nimport type { WorkflowBuilder } from './workflow';\n\n/**\n * The deployment unit — compileBundle gathers workflows, segments and the\n * template manifest into one BundleIR snapshot (terraform-apply mental model);\n * the server diffs each definition by contentHash (see plan.ts).\n */\nexport function compileBundle(input: {\n workflows: readonly WorkflowBuilder[];\n segments?: readonly SegmentRef[];\n /** The template manifest: these definitions, by channel and id. */\n templates?: readonly AnyTemplate[];\n actions?: readonly ActionRef[];\n /** The contract's subscription topics, carried for the engine (`compileConfig` passes them). */\n subscriptions?: { topics: readonly string[] };\n}): BundleIR {\n const segments = (input.segments ?? []).map((segment) => {\n const { id, definition, loc, meta } = segment as SegmentInternal;\n const compiled: SegmentIR = {\n irVersion: IR_VERSION,\n id,\n // Labels and provenance both live in meta, which stripMeta drops before hashing\n contentHash: semanticHash(definition),\n condition: definition,\n };\n const merged = {\n ...(meta?.name !== undefined ? { name: meta.name } : {}),\n ...(meta?.description !== undefined ? { description: meta.description } : {}),\n ...(loc !== undefined ? { loc } : {}),\n };\n if (Object.keys(merged).length > 0) compiled.meta = merged;\n return compiled;\n });\n\n const templates = (input.templates ?? []).map((template) => ({\n irVersion: IR_VERSION,\n key: template.id,\n channel: CHANNEL_OF[template.kind],\n }));\n\n // Manifest only — names; the implementation ships in the Worker bundle, never in IR\n const actions = (input.actions ?? []).map((a) => ({ irVersion: IR_VERSION, name: a.name }));\n\n const workflows = input.workflows.map((builder) => builder.toIR());\n\n // Names are wire identity (routing tables, entry ledger, by-name refs):\n // duplicates would silently last-write-win on deploy, so fail the compile.\n assertUniqueNames(\n workflows.map((w) => w.id),\n 'workflow'\n );\n assertUniqueNames(\n segments.map((s) => s.id),\n 'segment'\n );\n // A message node names its template by channel and key, so the key is unique per channel:\n // an email and a push of one nudge may share it\n assertUniqueNames(\n templates.map((t) => `${t.channel}:${t.key}`),\n 'template'\n );\n assertUniqueNames(\n actions.map((a) => a.name),\n 'action'\n );\n\n // Deploy replaces the whole segment table, so every by-name reference must\n // resolve inside this bundle — catching it here turns a runtime \"Unknown\n // segment\" in some user's journey into a compile error.\n assertSegmentRefsResolve(workflows, segments);\n\n // A segment is evaluated by evaluating the segments it names; a cycle among\n // them has no evaluation order and would recurse until the stack ran out —\n // at run time, in some user's journey. Caught here, with the cycle spelled out.\n assertNoSegmentCycles(segments);\n\n // Payload predicates and profile predicates share the Condition type, so\n // placement is checked here: payload only inside where-trees, and where-trees\n // contain nothing but payload predicates and combinators.\n assertConditionPlacement(workflows, segments);\n\n // A trigger payload reference carries the event it was taken from, and a\n // workflow can only read the payload it was itself started with.\n for (const workflow of workflows) assertTriggerRefs(workflow);\n\n // Same rationale as segments: the runtime registry is looked up by name, so\n // an action a workflow runs must be in the bundle — and it must be the very\n // definition listed there, or two same-named definitions are competing for\n // one identity (the IR names it; only the compile can tell them apart).\n assertActionRefsResolve(workflows, input.workflows, input.actions ?? []);\n\n return BundleIRSchema.parse({\n irVersion: IR_VERSION,\n workflows,\n segments,\n templates,\n actions,\n subscriptions: { topics: [...(input.subscriptions?.topics ?? [])] },\n });\n}\n\nfunction assertUniqueNames(names: readonly string[], kind: string): void {\n const seen = new Set<string>();\n for (const name of names) {\n if (seen.has(name)) throw new Error(`compileBundle: duplicate ${kind} name '${name}'`);\n seen.add(name);\n }\n}\n\nfunction assertSegmentRefsResolve(\n workflows: readonly WorkflowIR[],\n segments: readonly SegmentIR[]\n): void {\n const defined = new Set(segments.map((s) => s.id));\n const check = (refs: ReadonlySet<string>, owner: string): void => {\n for (const ref of refs) {\n if (!defined.has(ref)) {\n throw new Error(\n `compileBundle: ${owner} references segment '${ref}' that is not in the bundle — pass it in 'segments'`\n );\n }\n }\n };\n for (const workflow of workflows) {\n check(referencedSegments(workflow), `workflow '${workflow.id}'`);\n }\n // Segments may reference other segments; those must resolve too\n for (const segment of segments) {\n const refs = new Set<string>();\n collectConditionRefs(segment.condition, refs);\n check(refs, `segment '${segment.id}'`);\n }\n}\n\n/** Every segment the workflow names: its trigger, filter, goal, exit condition and the conditions in its flow. */\nexport function referencedSegments(workflow: WorkflowIR): Set<string> {\n const refs = new Set<string>();\n if (workflow.trigger.type === 'segment') refs.add(workflow.trigger.segment);\n if (\n (workflow.trigger.type === 'event' || workflow.trigger.type === 'date') &&\n workflow.trigger.filter !== undefined\n ) {\n collectConditionRefs(workflow.trigger.filter, refs);\n }\n if (workflow.goal !== undefined) collectConditionRefs(workflow.goal.condition, refs);\n if (workflow.exitWhen !== undefined) collectConditionRefs(workflow.exitWhen, refs);\n collectNodeRefs(workflow.flow, refs);\n return refs;\n}\n\nfunction collectConditionRefs(condition: ConditionIR, into: Set<string>): void {\n switch (condition.type) {\n case 'and':\n case 'or':\n for (const child of condition.conditions) collectConditionRefs(child, into);\n break;\n case 'not':\n collectConditionRefs(condition.condition, into);\n break;\n case 'segment':\n into.add(condition.segment);\n break;\n default:\n break;\n }\n}\n\nfunction collectNodeRefs(nodes: readonly NodeIR[], into: Set<string>): void {\n for (const node of nodes) {\n switch (node.type) {\n case 'wait_until':\n collectConditionRefs(node.condition, into);\n if (Array.isArray(node.onTimeout)) collectNodeRefs(node.onTimeout, into);\n break;\n case 'branch':\n for (const branchCase of node.cases) {\n collectConditionRefs(branchCase.condition, into);\n collectNodeRefs(branchCase.flow, into);\n }\n if (node.otherwise) collectNodeRefs(node.otherwise, into);\n break;\n case 'filter':\n collectConditionRefs(node.condition, into);\n break;\n case 'cohort':\n for (const arm of node.arms) collectNodeRefs(arm.flow, into);\n break;\n default:\n break;\n }\n }\n}\n\nfunction assertActionRefsResolve(\n workflows: readonly WorkflowIR[],\n builders: readonly WorkflowBuilder[],\n actions: readonly ActionRef[]\n): void {\n const listed = new Map(actions.map((a) => [a.name, a]));\n workflows.forEach((workflow, i) => {\n for (const used of actionUses(builders[i])) {\n const manifest = listed.get(used.name);\n if (manifest === undefined) {\n throw new Error(\n `compileBundle: workflow '${workflow.id}' runs action '${used.name}' that is not in the bundle — pass it in 'actions'`\n );\n }\n // Identity, not source text: the printed handler depends on the bundler.\n // Every use is checked, not one per name — with two definitions under one\n // name, whichever is listed, the *other* node would run the wrong code.\n if (manifest !== used && manifest.handler !== used.handler) {\n throw new Error(\n `compileBundle: workflow '${workflow.id}' runs action '${used.name}' that is not the definition listed in 'actions' — two definitions are sharing that name`\n );\n }\n }\n });\n}\n\n/** Walk segment → segment references depth-first; the first back edge is reported as the cycle path. */\nfunction assertNoSegmentCycles(segments: readonly SegmentIR[]): void {\n const refsOf = new Map<string, Set<string>>();\n for (const segment of segments) {\n const refs = new Set<string>();\n collectConditionRefs(segment.condition, refs);\n refsOf.set(segment.id, refs);\n }\n const done = new Set<string>();\n const path: string[] = [];\n const visit = (id: string): void => {\n const at = path.indexOf(id);\n if (at !== -1) {\n const cycle = [...path.slice(at), id].join(' → ');\n throw new Error(`compileBundle: segments reference each other in a cycle: ${cycle}`);\n }\n if (done.has(id)) return;\n path.push(id);\n for (const ref of refsOf.get(id) ?? []) visit(ref);\n path.pop();\n done.add(id);\n };\n for (const id of refsOf.keys()) visit(id);\n}\n\n/* --------------------- payload / profile placement checks --------------------- */\n\nfunction assertConditionPlacement(\n workflows: readonly WorkflowIR[],\n segments: readonly SegmentIR[]\n): void {\n for (const workflow of workflows) {\n if (workflow.trigger.type === 'event') {\n if (workflow.trigger.where !== undefined) {\n assertWhereTree(workflow.trigger.where, `workflow '${workflow.id}' trigger where`);\n }\n if (workflow.trigger.filter !== undefined) {\n assertProfileTree(workflow.trigger.filter, `workflow '${workflow.id}' trigger filter`, {\n journey: false,\n });\n }\n }\n if (workflow.trigger.type === 'date' && workflow.trigger.filter !== undefined) {\n assertProfileTree(workflow.trigger.filter, `workflow '${workflow.id}' trigger filter`, {\n journey: false,\n });\n }\n if (workflow.goal !== undefined) {\n assertProfileTree(workflow.goal.condition, `workflow '${workflow.id}' goal`, JOURNEY);\n }\n if (workflow.exitWhen !== undefined) {\n assertProfileTree(workflow.exitWhen, `workflow '${workflow.id}' exitWhen`, JOURNEY);\n }\n assertNodeTrees(workflow.flow, `workflow '${workflow.id}'`);\n }\n for (const segment of segments) {\n assertProfileTree(segment.condition, `segment '${segment.id}'`, { journey: false });\n }\n}\n\n/** Whether the tree is evaluated inside a running journey, which alone has a trigger payload. */\ninterface Placement {\n journey: boolean;\n}\nconst JOURNEY: Placement = { journey: true };\n\n/**\n * A profile-context tree: payload predicates may appear only under a performed.where, and\n * trigger payload predicates only where a journey is running.\n */\nfunction assertProfileTree(condition: ConditionIR, owner: string, at: Placement): void {\n switch (condition.type) {\n case 'and':\n case 'or':\n for (const child of condition.conditions) assertProfileTree(child, owner, at);\n break;\n case 'not':\n assertProfileTree(condition.condition, owner, at);\n break;\n case 'trigger_payload':\n if (!at.journey) {\n throw new Error(\n `compileBundle: ${owner} reads the trigger payload ('${condition.path}') — only a running journey has one; in a trigger, test the event with a where clause`\n );\n }\n break;\n case 'performed':\n if (condition.where !== undefined) assertWhereTree(condition.where, owner);\n break;\n case 'payload':\n throw new Error(\n `compileBundle: ${owner} uses a payload predicate outside a where clause — payload refs are only valid inside performed({ where }) or trigger.event({ where })`\n );\n default:\n break; // property / segment\n }\n}\n\n/** A where tree: payload predicates and combinators only — no profile facts in event scope. */\nfunction assertWhereTree(condition: ConditionIR, owner: string): void {\n switch (condition.type) {\n case 'and':\n case 'or':\n for (const child of condition.conditions) assertWhereTree(child, owner);\n break;\n case 'not':\n assertWhereTree(condition.condition, owner);\n break;\n case 'payload':\n break;\n default:\n throw new Error(\n `compileBundle: ${owner} where clause may only contain payload predicates and and/or/not, found '${condition.type}'`\n );\n }\n}\n\nfunction assertNodeTrees(nodes: readonly NodeIR[], owner: string): void {\n for (const node of nodes) {\n switch (node.type) {\n case 'wait_until':\n assertProfileTree(node.condition, owner, JOURNEY);\n if (Array.isArray(node.onTimeout)) assertNodeTrees(node.onTimeout, owner);\n break;\n case 'branch':\n for (const branchCase of node.cases) {\n assertProfileTree(branchCase.condition, owner, JOURNEY);\n assertNodeTrees(branchCase.flow, owner);\n }\n if (node.otherwise) assertNodeTrees(node.otherwise, owner);\n break;\n case 'filter':\n assertProfileTree(node.condition, owner, JOURNEY);\n break;\n case 'cohort':\n for (const arm of node.arms) assertNodeTrees(arm.flow, owner);\n break;\n default:\n break;\n }\n }\n}\n\n/* --------------------------- trigger payload references --------------------------- */\n\n/** One read of the trigger payload: the event the reference was taken from, the field, and where. */\nexport interface TriggerRefUse {\n event: string;\n path: string;\n /** 'node n3', 'the goal' or 'exitWhen'. */\n where: string;\n}\n\n/** Every trigger payload reference in a workflow — predicates and values alike. */\nexport function triggerRefUses(workflow: WorkflowIR): TriggerRefUse[] {\n const uses: TriggerRefUse[] = [];\n const inCondition = (condition: ConditionIR, where: string): void => {\n switch (condition.type) {\n case 'and':\n case 'or':\n for (const child of condition.conditions) inCondition(child, where);\n break;\n case 'not':\n inCondition(condition.condition, where);\n break;\n case 'trigger_payload':\n uses.push({ event: condition.event, path: condition.path, where });\n break;\n default:\n break;\n }\n };\n const inValues = (values: Record<string, PropValueIR>, where: string): void => {\n for (const value of Object.values(values)) {\n if (typeof value === 'object' && value.type === 'trigger_payload') {\n uses.push({ event: value.event, path: value.path, where });\n }\n }\n };\n if (workflow.goal !== undefined) inCondition(workflow.goal.condition, 'the goal');\n if (workflow.exitWhen !== undefined) inCondition(workflow.exitWhen, 'exitWhen');\n for (const node of nodesOf(workflow.flow)) {\n const where = `node ${node.id}`;\n switch (node.type) {\n case 'wait_until':\n case 'filter':\n inCondition(node.condition, where);\n break;\n case 'branch':\n for (const branchCase of node.cases) inCondition(branchCase.condition, where);\n break;\n case 'message':\n inValues(node.props, where);\n break;\n case 'send_event':\n inValues(node.payload, where);\n break;\n case 'action':\n inValues(node.args, where);\n break;\n default:\n break;\n }\n }\n return uses;\n}\n\n/**\n * A workflow reads only the payload it was started with: every reference names the workflow's\n * own trigger event. A handle taken from another trigger type-checks just the same, and would\n * read fields the entering event never had.\n */\nfunction assertTriggerRefs(workflow: WorkflowIR): void {\n const { trigger } = workflow;\n for (const use of triggerRefUses(workflow)) {\n const at = `compileBundle: workflow '${workflow.id}' ${use.where} reads '${use.path}' from the payload of a '${use.event}' trigger`;\n if (trigger.type !== 'event') {\n throw new Error(\n `${at}, but the workflow has a ${trigger.type} trigger, which has no payload`\n );\n }\n if (trigger.event !== use.event) {\n throw new Error(\n `${at}, but the workflow is triggered by '${trigger.event}' — use the handle of its own trigger`\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAuBA,SAAgB,cAAc,OAQjB;CACX,MAAM,YAAY,MAAM,YAAY,CAAC,EAAA,CAAG,KAAK,YAAY;EACvD,MAAM,EAAE,IAAI,YAAY,KAAK,SAAS;EACtC,MAAM,WAAsB;GAC1B,WAAA;GACA;GAEA,aAAaA,aAAAA,aAAa,UAAU;GACpC,WAAW;EACb;EACA,MAAM,SAAS;GACb,GAAI,MAAM,SAAS,KAAA,IAAY,EAAE,MAAM,KAAK,KAAK,IAAI,CAAC;GACtD,GAAI,MAAM,gBAAgB,KAAA,IAAY,EAAE,aAAa,KAAK,YAAY,IAAI,CAAC;GAC3E,GAAI,QAAQ,KAAA,IAAY,EAAE,IAAI,IAAI,CAAC;EACrC;EACA,IAAI,OAAO,KAAK,MAAM,CAAC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,MAAM,UAAU,IAAI,KAAK,2BAA2B,IAAI,MAAM;EACzH,IAAI,QAAQ,SAAS,SACnB,MAAM,IAAI,MACR,GAAG,GAAG,2BAA2B,QAAQ,KAAK,+BAChD;EAEF,IAAI,QAAQ,UAAU,IAAI,OACxB,MAAM,IAAI,MACR,GAAG,GAAG,sCAAsC,QAAQ,MAAM,sCAC5D;CAEJ;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BundleIR, WorkflowIR } from "../ir.cjs";
|
|
2
|
+
import { AnyTemplate } from "../templates.cjs";
|
|
3
|
+
import { ActionRef } from "./action.cjs";
|
|
4
|
+
import { SegmentRef } from "./condition.cjs";
|
|
5
|
+
import { WorkflowBuilder } from "./workflow.cjs";
|
|
6
|
+
/**
|
|
7
|
+
* The deployment unit — compileBundle gathers workflows, segments and the
|
|
8
|
+
* template manifest into one BundleIR snapshot (terraform-apply mental model);
|
|
9
|
+
* the server diffs each definition by contentHash (see plan.ts).
|
|
10
|
+
*/
|
|
11
|
+
export declare function compileBundle(input: {
|
|
12
|
+
workflows: readonly WorkflowBuilder[];
|
|
13
|
+
segments?: readonly SegmentRef[];
|
|
14
|
+
/** The template manifest: these definitions, by channel and id. */
|
|
15
|
+
templates?: readonly AnyTemplate[];
|
|
16
|
+
actions?: readonly ActionRef[];
|
|
17
|
+
/** The contract's subscription topics, carried for the engine (`compileConfig` passes them). */
|
|
18
|
+
subscriptions?: {
|
|
19
|
+
topics: readonly string[];
|
|
20
|
+
};
|
|
21
|
+
}): BundleIR;
|
|
22
|
+
/** Every segment the workflow names: its trigger, filter, goal, exit condition and the conditions in its flow. */
|
|
23
|
+
export declare function referencedSegments(workflow: WorkflowIR): Set<string>;
|
|
24
|
+
/** One read of the trigger payload: the event the reference was taken from, the field, and where. */
|
|
25
|
+
export interface TriggerRefUse {
|
|
26
|
+
event: string;
|
|
27
|
+
path: string;
|
|
28
|
+
/** 'node n3', 'the goal' or 'exitWhen'. */
|
|
29
|
+
where: string;
|
|
30
|
+
}
|
|
31
|
+
/** Every trigger payload reference in a workflow — predicates and values alike. */
|
|
32
|
+
export declare function triggerRefUses(workflow: WorkflowIR): TriggerRefUse[];
|
|
33
|
+
//# sourceMappingURL=bundle.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.cts","names":[],"sources":["../../src/dsl/bundle.ts"],"mappings":";;;;;;;;;;wBAuBgB,cAAc;EAC5B,oBAAoB;EACpB,oBAAoB;;EAEpB,qBAAqB;EACrB,mBAAmB;;EAEnB;IAAkB;;IAChB;;wBAwHY,mBAAmB,UAAU,aAAa;;iBAsOzC;EACf;EACA;;EAEA;;;wBAIc,eAAe,UAAU,aAAa"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BundleIR, WorkflowIR } from "../ir.mjs";
|
|
2
|
+
import { AnyTemplate } from "../templates.mjs";
|
|
3
|
+
import { ActionRef } from "./action.mjs";
|
|
4
|
+
import { SegmentRef } from "./condition.mjs";
|
|
5
|
+
import { WorkflowBuilder } from "./workflow.mjs";
|
|
6
|
+
/**
|
|
7
|
+
* The deployment unit — compileBundle gathers workflows, segments and the
|
|
8
|
+
* template manifest into one BundleIR snapshot (terraform-apply mental model);
|
|
9
|
+
* the server diffs each definition by contentHash (see plan.ts).
|
|
10
|
+
*/
|
|
11
|
+
export declare function compileBundle(input: {
|
|
12
|
+
workflows: readonly WorkflowBuilder[];
|
|
13
|
+
segments?: readonly SegmentRef[];
|
|
14
|
+
/** The template manifest: these definitions, by channel and id. */
|
|
15
|
+
templates?: readonly AnyTemplate[];
|
|
16
|
+
actions?: readonly ActionRef[];
|
|
17
|
+
/** The contract's subscription topics, carried for the engine (`compileConfig` passes them). */
|
|
18
|
+
subscriptions?: {
|
|
19
|
+
topics: readonly string[];
|
|
20
|
+
};
|
|
21
|
+
}): BundleIR;
|
|
22
|
+
/** Every segment the workflow names: its trigger, filter, goal, exit condition and the conditions in its flow. */
|
|
23
|
+
export declare function referencedSegments(workflow: WorkflowIR): Set<string>;
|
|
24
|
+
/** One read of the trigger payload: the event the reference was taken from, the field, and where. */
|
|
25
|
+
export interface TriggerRefUse {
|
|
26
|
+
event: string;
|
|
27
|
+
path: string;
|
|
28
|
+
/** 'node n3', 'the goal' or 'exitWhen'. */
|
|
29
|
+
where: string;
|
|
30
|
+
}
|
|
31
|
+
/** Every trigger payload reference in a workflow — predicates and values alike. */
|
|
32
|
+
export declare function triggerRefUses(workflow: WorkflowIR): TriggerRefUse[];
|
|
33
|
+
//# sourceMappingURL=bundle.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.d.mts","names":[],"sources":["../../src/dsl/bundle.ts"],"mappings":";;;;;;;;;;wBAuBgB,cAAc;EAC5B,oBAAoB;EACpB,oBAAoB;;EAEpB,qBAAqB;EACrB,mBAAmB;;EAEnB;IAAkB;;IAChB;;wBAwHY,mBAAmB,UAAU,aAAa;;iBAsOzC;EACf;EACA;;EAEA;;;wBAIc,eAAe,UAAU,aAAa"}
|