sendwend 0.0.0-stage → 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 +21 -0
- package/README.md +2082 -2
- 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 +279 -3
- package/src/cloudflare/workers.d.ts +44 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { NodeIR, SourceLocIR } from "../ir.cjs";
|
|
2
|
+
import { AnyTemplate, DiscordTemplate, EmailTemplate, PropsSchema, PushTemplate, SlackTemplate } from "../templates.cjs";
|
|
3
|
+
import { ActionRef } from "./action.cjs";
|
|
4
|
+
import { Duration, TimeOfDay, Weekday } from "./base.cjs";
|
|
5
|
+
import { Condition } from "./condition.cjs";
|
|
6
|
+
import { EventRef, MessageArgs, PropInput, PropsInput } from "./refs.cjs";
|
|
7
|
+
import { PropsOf, TemplateRef } from "./template.cjs";
|
|
8
|
+
/**
|
|
9
|
+
* The flow chain — FlowBuilder is the DSL's step surface (messages, delays,
|
|
10
|
+
* flow control, data), and its implementation is the compiler front half: each
|
|
11
|
+
* chained call executes no logic, it just collects one IR node (ids are
|
|
12
|
+
* assigned later, in workflow.toIR()). Sub-flow callbacks run exactly once at
|
|
13
|
+
* construction — builder in, builder out — so the output is always a static
|
|
14
|
+
* tree.
|
|
15
|
+
*
|
|
16
|
+
* Every public method also captures its callsite (provenance): the loc lands
|
|
17
|
+
* in the node's hash-excluded meta and is the anchor for future in-place
|
|
18
|
+
* editing from the studio.
|
|
19
|
+
*/
|
|
20
|
+
type Scalar = string | number | boolean;
|
|
21
|
+
/** An emitted field: a scalar (or a profile ref to one); a nested field cannot be sent. */
|
|
22
|
+
type EmitValue<T> = [NonNullable<T>] extends [Scalar] ? PropInput<T> : never;
|
|
23
|
+
/** The payload `sendEvent` accepts for an event: its fields, scalar ones only. */
|
|
24
|
+
export type EmitPayload<P> = { [K in keyof P]: EmitValue<P[K]>; };
|
|
25
|
+
/** Payload may be omitted when the event declares no required field. */
|
|
26
|
+
export type EmitArgs<P> = Record<string, never> extends P ? [payload?: EmitPayload<P>] : [payload: EmitPayload<P>];
|
|
27
|
+
/** Per-node push options. */
|
|
28
|
+
export interface PushOptions {
|
|
29
|
+
/** Which devices get a copy: 'all' (the default) or only the most recently registered. */
|
|
30
|
+
devices?: 'all' | 'latest';
|
|
31
|
+
}
|
|
32
|
+
/** `prefer()` options. */
|
|
33
|
+
export interface PreferOptions {
|
|
34
|
+
/** The generated branch's name in IR (UI title / observability handle), as `branch(label, …)`. */
|
|
35
|
+
label?: string;
|
|
36
|
+
}
|
|
37
|
+
/** The candidates `prefer()` takes: one push and one email template, in priority order. */
|
|
38
|
+
type PreferPair = readonly [PushTemplate, EmailTemplate] | readonly [EmailTemplate, PushTemplate];
|
|
39
|
+
type NormalizeProps<P> = { -readonly [K in keyof P]: P[K]; };
|
|
40
|
+
type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => (T extends B ? 1 : 2)) ? true : false;
|
|
41
|
+
/** Both candidates render the one props object, so they must declare the same props type — not merely overlap. */
|
|
42
|
+
type SameProps<T extends PreferPair> = Equal<NormalizeProps<PropsOf<T[0]>>, NormalizeProps<PropsOf<T[1]>>> extends true ? unknown : {
|
|
43
|
+
readonly __prefer_error__: 'Both templates must declare the same props type';
|
|
44
|
+
};
|
|
45
|
+
/** Distributes, so a field only one member of a union variable has still counts as extra. */
|
|
46
|
+
type KeysOfUnion<A> = A extends unknown ? keyof A : never;
|
|
47
|
+
/** Rejects known extra fields, which `{}` (an empty props schema) would otherwise accept. */
|
|
48
|
+
type NoExtra<A, P> = Record<Exclude<KeysOfUnion<A>, keyof P>, never>;
|
|
49
|
+
/** A reusable flow fragment (what `flow(...)` returns), referenced directly by branch arms. */
|
|
50
|
+
export interface Flow {
|
|
51
|
+
readonly __flow: true;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @internal A template definition a flow sends, kept beside the IR (which names it by id only):
|
|
55
|
+
* compileConfig checks that the registered definition under that id is this very object, so the
|
|
56
|
+
* schema that typed the call is the one that renders it. Never part of the IR or its hash.
|
|
57
|
+
*/
|
|
58
|
+
export interface TemplateUse {
|
|
59
|
+
readonly template: AnyTemplate;
|
|
60
|
+
readonly loc: SourceLocIR | undefined;
|
|
61
|
+
}
|
|
62
|
+
/** @internal The template definitions a workflow sends, sub-flows and fragments included. */
|
|
63
|
+
export declare function templateUses(builder: FlowBuilder): readonly TemplateUse[];
|
|
64
|
+
/**
|
|
65
|
+
* @internal The action definitions a workflow runs, sub-flows and fragments included. The IR
|
|
66
|
+
* names an action only; compileBundle checks that each ref is the very object listed in
|
|
67
|
+
* `actions`, which is what keeps two definitions from sharing one name. Never part of the IR.
|
|
68
|
+
*/
|
|
69
|
+
export declare function actionUses(builder: FlowBuilder): readonly ActionRef[];
|
|
70
|
+
/** Sub-flow: a named fragment, or an inline callback (runs once at construction — builder in, builder out). */
|
|
71
|
+
export type SubFlow = Flow | ((w: FlowBuilder) => FlowBuilder);
|
|
72
|
+
/** A branch arm: the [condition, sub-flow] tuple — an [if, then] ordering convention. */
|
|
73
|
+
export type BranchCase = readonly [condition: Condition, flow: SubFlow];
|
|
74
|
+
/**
|
|
75
|
+
* A branch argument: either a tuple arm, or a bare sub-flow meaning the default
|
|
76
|
+
* arm. The bare form may appear once, and must come last (checked at runtime).
|
|
77
|
+
*/
|
|
78
|
+
export type BranchArm = BranchCase | SubFlow;
|
|
79
|
+
export interface FlowBuilder {
|
|
80
|
+
email<T extends EmailTemplate>(template: T, ...props: MessageArgs<PropsOf<T>>): this;
|
|
81
|
+
sms<P extends object>(template: TemplateRef<'sms', P>, ...props: MessageArgs<P>): this;
|
|
82
|
+
/**
|
|
83
|
+
* Push to the user's devices — every device the host's directory lists, or
|
|
84
|
+
* only the most recently registered with `{ devices: 'latest' }`. A user with
|
|
85
|
+
* no device is skipped (`prefer([pushTpl, emailTpl], props)` falls back to email).
|
|
86
|
+
*/
|
|
87
|
+
push<T extends PushTemplate>(template: T, ...args: [...props: MessageArgs<PropsOf<T>>, options?: PushOptions]): this;
|
|
88
|
+
inApp<P extends object>(template: TemplateRef<'in_app', P>, ...props: MessageArgs<P>): this;
|
|
89
|
+
slack<T extends SlackTemplate<PropsSchema, never>>(template: T, ...props: MessageArgs<PropsOf<T>>): this;
|
|
90
|
+
discord<T extends DiscordTemplate<PropsSchema, never>>(template: T, ...props: MessageArgs<PropsOf<T>>): this;
|
|
91
|
+
survey<P extends object>(template: TemplateRef<'survey', P>, ...props: MessageArgs<P>): this;
|
|
92
|
+
/**
|
|
93
|
+
* Send one message on the first channel the user can be reached on: one push
|
|
94
|
+
* and one email template, in priority order, rendered with the same props.
|
|
95
|
+
* Sugar for the branch it compiles to — same IR, ids and hash as writing
|
|
96
|
+
*
|
|
97
|
+
* .branch(label, [reachable(first.channel), (b) => b.<first>(first, props)], (b) => b.<second>(second, props))
|
|
98
|
+
*
|
|
99
|
+
* so the choice is made once, when the step is reached, and a first choice
|
|
100
|
+
* that fails to send retries as itself — it never falls through to the
|
|
101
|
+
* second. Props are always passed (`{}` for templates that declare none),
|
|
102
|
+
* and both templates must declare the same props type; for differing props
|
|
103
|
+
* or other channels, write the branch.
|
|
104
|
+
*
|
|
105
|
+
* .prefer([push.tip, email.tip], { name: u.name }, { label: 'tip by channel' })
|
|
106
|
+
*/
|
|
107
|
+
prefer<const T extends PreferPair, const A extends PropsInput<NoInfer<PropsOf<T[0]>>>>(candidates: T & SameProps<NoInfer<T>>, props: A & NoInfer<NoExtra<A, PropsOf<T[0]>>>, options?: PreferOptions): this;
|
|
108
|
+
/** Time Delay; passing { min, max } makes it a Randomized Delay. */
|
|
109
|
+
delay(duration: Duration): this;
|
|
110
|
+
delay(range: {
|
|
111
|
+
min: Duration;
|
|
112
|
+
max: Duration;
|
|
113
|
+
}): this;
|
|
114
|
+
/** Time Window: hold until inside the window (e.g. weekdays 09:00–17:00). tz: 'user' uses the user's timezone. */
|
|
115
|
+
timeWindow(opts: {
|
|
116
|
+
days?: readonly Weekday[];
|
|
117
|
+
between: readonly [TimeOfDay, TimeOfDay];
|
|
118
|
+
tz?: 'user' | (string & {});
|
|
119
|
+
}): this;
|
|
120
|
+
/**
|
|
121
|
+
* Wait Until: continue on the main line once the condition holds, or take
|
|
122
|
+
* onTimeout when it expires (default 'continue'). On the engine side this is
|
|
123
|
+
* "await event racing a timer" — a native primitive of durable runtimes.
|
|
124
|
+
*/
|
|
125
|
+
waitUntil(condition: Condition, opts: {
|
|
126
|
+
timeout: Duration;
|
|
127
|
+
onTimeout?: 'continue' | 'exit' | SubFlow;
|
|
128
|
+
}): this;
|
|
129
|
+
/**
|
|
130
|
+
* Splice a fragment in place: a named `flow(...)` or a callback, expanded
|
|
131
|
+
* once while the workflow is defined — a composition step before compiling,
|
|
132
|
+
* not a node (the IR has no trace of it, and ids are assigned over the whole
|
|
133
|
+
* workflow as if the steps were written inline). Each use gets its own copy,
|
|
134
|
+
* so one fragment can be used in several places and workflows.
|
|
135
|
+
*
|
|
136
|
+
* const officeHours = flow((w) => w.timeWindow({ days: ['mon', 'tue', 'wed', 'thu', 'fri'], between: ['09:00', '17:00'] }));
|
|
137
|
+
* workflow({ id: 'onboarding', reentry: { mode: 'never' }, ... }).delay('1 day').use(officeHours).email(email.tip, { name: u.name })
|
|
138
|
+
*/
|
|
139
|
+
use(fragment: SubFlow): this;
|
|
140
|
+
/**
|
|
141
|
+
* Conditional branch: ordered first-match (same semantics as Step Functions
|
|
142
|
+
* Choice / Knock branch). This one primitive covers both the UI's True/False
|
|
143
|
+
* Branch (two arms) and Multi-Split Branch (N arms). Arms are
|
|
144
|
+
* [condition, sub-flow] tuples; a bare sub-flow in tail position is the
|
|
145
|
+
* default arm. With no match and no default, execution simply continues.
|
|
146
|
+
* Rejoin is structural: after the matching arm finishes, execution resumes
|
|
147
|
+
* at the node following the branch — to opt out, call .exit() inside the arm.
|
|
148
|
+
*
|
|
149
|
+
* .branch([activeSubscriber, upgradeFlow], firstTimeFlow) // True/False
|
|
150
|
+
* .branch([vip, vipFlow], [trial, trialFlow], defaultFlow) // Multi-Split
|
|
151
|
+
* .branch([not(usedStaging), eduFlow]) // single arm: no match continues
|
|
152
|
+
*
|
|
153
|
+
* The optional first argument `label` becomes the node's name in IR (UI title
|
|
154
|
+
* / observability handle). It is not a jump target — there is no goto here;
|
|
155
|
+
* looping goes through re-entry (see sendEvent). Arm labels in
|
|
156
|
+
* the UI are derived from the condition.
|
|
157
|
+
*/
|
|
158
|
+
branch(...arms: readonly BranchArm[]): this;
|
|
159
|
+
branch(label: string, ...arms: readonly BranchArm[]): this;
|
|
160
|
+
/**
|
|
161
|
+
* Gate: exit unless the condition holds, otherwise continue. A first-class
|
|
162
|
+
* node rather than sugar over branch — same semantics as Zapier's "only
|
|
163
|
+
* continue if" / Iterable's Filter tile, and rendered on its own in the UI.
|
|
164
|
+
* `reason` is the audit-log line — metadata, so rewording it is free
|
|
165
|
+
* (excluded from contentHash, see hash.ts).
|
|
166
|
+
*/
|
|
167
|
+
filter(condition: Condition, opts?: {
|
|
168
|
+
reason?: string;
|
|
169
|
+
}): this;
|
|
170
|
+
/**
|
|
171
|
+
* Random Cohort Branch (A/B): weights must sum to 100 (checked at runtime).
|
|
172
|
+
* `key` names the experiment: bucketing hashes `userId:key` instead of the
|
|
173
|
+
* structural node id, so assignments survive node insertion/moves and the
|
|
174
|
+
* experiment keeps one identity across workflow versions — set it for any
|
|
175
|
+
* A/B whose results you intend to read.
|
|
176
|
+
*
|
|
177
|
+
* Arm names become node id segments and are read back in authoring order, so
|
|
178
|
+
* they are restricted to letters, digits, '_' and '-', never starting with a
|
|
179
|
+
* digit (checked at runtime).
|
|
180
|
+
*/
|
|
181
|
+
cohort(arms: Record<string, {
|
|
182
|
+
weight: number;
|
|
183
|
+
flow?: SubFlow;
|
|
184
|
+
}>, opts?: {
|
|
185
|
+
key?: string;
|
|
186
|
+
}): this;
|
|
187
|
+
/**
|
|
188
|
+
* Exit: end the whole workflow immediately (the UI's Exit node); `reason`
|
|
189
|
+
* goes into the audit log and is metadata, so rewording it neither repins
|
|
190
|
+
* in-flight journeys nor shows up in plan. Inside a branch arm this means
|
|
191
|
+
* "terminate, do not rejoin" — it stops here instead of falling through,
|
|
192
|
+
* while an arm without exit rejoins naturally.
|
|
193
|
+
*/
|
|
194
|
+
exit(reason?: string): this;
|
|
195
|
+
/**
|
|
196
|
+
* Emit a typed event (customer.io's Send Event). The event comes from an
|
|
197
|
+
* e.xxx reference, so payload types flow in the same way trigger.event works.
|
|
198
|
+
* This is how workflows compose: an event can trigger another workflow, and
|
|
199
|
+
* the resulting call graph is statically analyzable. Payload values may
|
|
200
|
+
* reference u.xxx. Only scalar fields can be sent (IR carries literals and
|
|
201
|
+
* profile refs, not nested JSON): an event whose payload requires a nested
|
|
202
|
+
* field cannot be emitted from a journey, and the types say so.
|
|
203
|
+
*
|
|
204
|
+
* Note on loops: a trailing self-triggering sendEvent re-enters the
|
|
205
|
+
* workflow only as its `reentry` policy allows: under `never` it does not
|
|
206
|
+
* loop; under `after_exit` the emitted event arrives while this instance is
|
|
207
|
+
* still running, so it is refused too; `concurrent` (with a `cooldown` to
|
|
208
|
+
* pace it) is the periodic-flow shape.
|
|
209
|
+
* TODO: the rest of the Data category — outbound webhook / profile update /
|
|
210
|
+
* journey attributes.
|
|
211
|
+
*/
|
|
212
|
+
sendEvent<P extends object>(event: EventRef<P>, ...payload: EmitArgs<P>): this;
|
|
213
|
+
/**
|
|
214
|
+
* Run a custom action (see dsl/action.ts for the model). The chain records
|
|
215
|
+
* identity only — name and args — never the code: the implementation
|
|
216
|
+
* ships inside the deployed Worker bundle and is resolved by name from the
|
|
217
|
+
* runtime registry. Args are typed by the ActionRef and may reference u.xxx,
|
|
218
|
+
* resolved at run time exactly like message props. Executed inside a durable
|
|
219
|
+
* step: retried on throw, checkpointed on success.
|
|
220
|
+
*/
|
|
221
|
+
run<A extends object>(action: ActionRef<A>, ...args: MessageArgs<A>): this;
|
|
222
|
+
}
|
|
223
|
+
/** @internal extended by WorkflowBuilderImpl; not part of the public API */
|
|
224
|
+
export declare class FlowBuilderImpl implements FlowBuilder {
|
|
225
|
+
/** Nodes as collected; ids are assigned in one pass inside toIR, so '' is a placeholder here. */
|
|
226
|
+
readonly nodes: NodeIR[];
|
|
227
|
+
/** The template definitions sent, with where: compile-time only, never in the IR. */
|
|
228
|
+
readonly uses: TemplateUse[];
|
|
229
|
+
/** The action definitions run: compile-time identity only, never in the IR. */
|
|
230
|
+
readonly actions: ActionRef[];
|
|
231
|
+
/** Provenance: the callsite (captured in the public method) lands in meta.loc, outside the hash. */
|
|
232
|
+
private pushNode;
|
|
233
|
+
private message;
|
|
234
|
+
email<T extends EmailTemplate>(t: T, ...args: MessageArgs<PropsOf<T>>): this;
|
|
235
|
+
sms<P extends object>(t: TemplateRef<'sms', P>, ...args: MessageArgs<P>): this;
|
|
236
|
+
push<T extends PushTemplate>(t: T, ...args: [...props: MessageArgs<PropsOf<T>>, options?: PushOptions]): this;
|
|
237
|
+
inApp<P extends object>(t: TemplateRef<'in_app', P>, ...args: MessageArgs<P>): this;
|
|
238
|
+
slack<T extends SlackTemplate<PropsSchema, never>>(t: T, ...args: MessageArgs<PropsOf<T>>): this;
|
|
239
|
+
discord<T extends DiscordTemplate<PropsSchema, never>>(t: T, ...args: MessageArgs<PropsOf<T>>): this;
|
|
240
|
+
survey<P extends object>(t: TemplateRef<'survey', P>, ...args: MessageArgs<P>): this;
|
|
241
|
+
prefer<const T extends PreferPair, const A extends PropsInput<NoInfer<PropsOf<T[0]>>>>(candidates: T & SameProps<NoInfer<T>>, props: A & NoInfer<NoExtra<A, PropsOf<T[0]>>>, options?: PreferOptions): this;
|
|
242
|
+
delay(duration: Duration): this;
|
|
243
|
+
delay(range: {
|
|
244
|
+
min: Duration;
|
|
245
|
+
max: Duration;
|
|
246
|
+
}): this;
|
|
247
|
+
timeWindow(opts: {
|
|
248
|
+
days?: readonly Weekday[];
|
|
249
|
+
between: readonly [TimeOfDay, TimeOfDay];
|
|
250
|
+
tz?: 'user' | (string & {});
|
|
251
|
+
}): this;
|
|
252
|
+
waitUntil(condition: Condition, opts: {
|
|
253
|
+
timeout: Duration;
|
|
254
|
+
onTimeout?: 'continue' | 'exit' | SubFlow;
|
|
255
|
+
}): this;
|
|
256
|
+
use(fragment: SubFlow): this;
|
|
257
|
+
branch(...arms: readonly BranchArm[]): this;
|
|
258
|
+
branch(label: string, ...arms: readonly BranchArm[]): this;
|
|
259
|
+
filter(condition: Condition, opts?: {
|
|
260
|
+
reason?: string;
|
|
261
|
+
}): this;
|
|
262
|
+
cohort(arms: Record<string, {
|
|
263
|
+
weight: number;
|
|
264
|
+
flow?: SubFlow;
|
|
265
|
+
}>, opts?: {
|
|
266
|
+
key?: string;
|
|
267
|
+
}): this;
|
|
268
|
+
exit(reason?: string): this;
|
|
269
|
+
sendEvent<P extends object>(ev: EventRef<P>, ...payload: EmitArgs<P>): this;
|
|
270
|
+
run<A extends object>(a: ActionRef<A>, ...args: MessageArgs<A>): this;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* A reusable flow fragment: a free function. Once personalization goes through
|
|
274
|
+
* u.xxx and events through e.xxx, the flow layer carries no schema generics.
|
|
275
|
+
*/
|
|
276
|
+
export declare function flow(build: (w: FlowBuilder) => FlowBuilder): Flow;
|
|
277
|
+
export {};
|
|
278
|
+
//# sourceMappingURL=flow.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.d.cts","names":[],"sources":["../../src/dsl/flow.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAiDK;;KAGA,UAAU,MAAM,YAAY,aAAa,UAAU,UAAU;;YAGtD,YAAY,QAAQ,WAAW,IAAI,UAAU,EAAE;;YAG/C,SAAS,KACnB,8BAA8B,KAAK,UAAU,YAAY,OAAO,SAAS,YAAY;;iBAGtE;;EAEf;;;iBAIe;;EAEf;;;KAIG,uBAAuB,cAAc,2BAA2B,eAAe;KAE/E,eAAe,kBAAkB,WAAW,IAAI,EAAE;KAClD,MAAM,GAAG,OACV,QAAQ,UAAU,qBAAoB,SAAQ,UAAU;;KAGvD,UAAU,UAAU,cACvB,MAAM,eAAe,QAAQ,QAAQ,eAAe,QAAQ;WAE7C;;;KAGZ,YAAY,KAAK,0BAA0B;;KAE3C,QAAQ,GAAG,KAAK,OAAO,QAAQ,YAAY,UAAU;;iBAoCzC;WACN;;;;;;;iBAcM;WACN,UAAU;WACV,KAAK;;;wBAIA,aAAa,SAAS,uBAAuB;;;;;;wBAS7C,WAAW,SAAS,uBAAuB;;YAK/C,UAAU,SAAS,G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Template } from "../templates.mjs";
|
|
3
|
+
import { ActionRef } from "./action.mjs";
|
|
4
|
+
import { Duration, TimeOfDay, Weekday } from "./base.mjs";
|
|
5
|
+
import { Condition } from "./condition.mjs";
|
|
6
|
+
import { EventRef, MessageArgs, PropInput, PropsInput } from "./refs.mjs";
|
|
7
|
+
import { PropsOf, TemplateRef } from "./template.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* The flow chain — FlowBuilder is the DSL's step surface (messages, delays,
|
|
10
|
+
* flow control, data), and its implementation is the compiler front half: each
|
|
11
|
+
* chained call executes no logic, it just collects one IR node (ids are
|
|
12
|
+
* assigned later, in workflow.toIR()). Sub-flow callbacks run exactly once at
|
|
13
|
+
* construction — builder in, builder out — so the output is always a static
|
|
14
|
+
* tree.
|
|
15
|
+
*
|
|
16
|
+
* Every public method also captures its callsite (provenance): the loc lands
|
|
17
|
+
* in the node's hash-excluded meta and is the anchor for future in-place
|
|
18
|
+
* editing from the studio.
|
|
19
|
+
*/
|
|
20
|
+
type Scalar = string | number | boolean;
|
|
21
|
+
/** An emitted field: a scalar (or a profile ref to one); a nested field cannot be sent. */
|
|
22
|
+
type EmitValue<T> = [NonNullable<T>] extends [Scalar] ? PropInput<T> : never;
|
|
23
|
+
/** The payload `sendEvent` accepts for an event: its fields, scalar ones only. */
|
|
24
|
+
export type EmitPayload<P> = { [K in keyof P]: EmitValue<P[K]>; };
|
|
25
|
+
/** Payload may be omitted when the event declares no required field. */
|
|
26
|
+
export type EmitArgs<P> = Record<string, never> extends P ? [payload?: EmitPayload<P>] : [payload: EmitPayload<P>];
|
|
27
|
+
/** Per-node push options. */
|
|
28
|
+
export interface PushOptions {
|
|
29
|
+
/** Which devices get a copy: 'all' (the default) or only the most recently registered. */
|
|
30
|
+
devices?: 'all' | 'latest';
|
|
31
|
+
}
|
|
32
|
+
/** `prefer()` options. */
|
|
33
|
+
export interface PreferOptions {
|
|
34
|
+
/** The generated branch's name in IR (UI title / observability handle), as `branch(label, …)`. */
|
|
35
|
+
label?: string;
|
|
36
|
+
}
|
|
37
|
+
/** The candidates `prefer()` takes: one push and one email template, in priority order. */
|
|
38
|
+
type PreferPair = readonly [PushTemplate, EmailTemplate] | readonly [EmailTemplate, PushTemplate];
|
|
39
|
+
type NormalizeProps<P> = { -readonly [K in keyof P]: P[K]; };
|
|
40
|
+
type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends (<T>() => (T extends B ? 1 : 2)) ? true : false;
|
|
41
|
+
/** Both candidates render the one props object, so they must declare the same props type — not merely overlap. */
|
|
42
|
+
type SameProps<T extends PreferPair> = Equal<NormalizeProps<PropsOf<T[0]>>, NormalizeProps<PropsOf<T[1]>>> extends true ? unknown : {
|
|
43
|
+
readonly __prefer_error__: 'Both templates must declare the same props type';
|
|
44
|
+
};
|
|
45
|
+
/** Distributes, so a field only one member of a union variable has still counts as extra. */
|
|
46
|
+
type KeysOfUnion<A> = A extends unknown ? keyof A : never;
|
|
47
|
+
/** Rejects known extra fields, which `{}` (an empty props schema) would otherwise accept. */
|
|
48
|
+
type NoExtra<A, P> = Record<Exclude<KeysOfUnion<A>, keyof P>, never>;
|
|
49
|
+
/** A reusable flow fragment (what `flow(...)` returns), referenced directly by branch arms. */
|
|
50
|
+
export interface Flow {
|
|
51
|
+
readonly __flow: true;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @internal A template definition a flow sends, kept beside the IR (which names it by id only):
|
|
55
|
+
* compileConfig checks that the registered definition under that id is this very object, so the
|
|
56
|
+
* schema that typed the call is the one that renders it. Never part of the IR or its hash.
|
|
57
|
+
*/
|
|
58
|
+
export interface TemplateUse {
|
|
59
|
+
readonly template: AnyTemplate;
|
|
60
|
+
readonly loc: SourceLocIR | undefined;
|
|
61
|
+
}
|
|
62
|
+
/** @internal The template definitions a workflow sends, sub-flows and fragments included. */
|
|
63
|
+
export declare function templateUses(builder: FlowBuilder): readonly TemplateUse[];
|
|
64
|
+
/**
|
|
65
|
+
* @internal The action definitions a workflow runs, sub-flows and fragments included. The IR
|
|
66
|
+
* names an action only; compileBundle checks that each ref is the very object listed in
|
|
67
|
+
* `actions`, which is what keeps two definitions from sharing one name. Never part of the IR.
|
|
68
|
+
*/
|
|
69
|
+
export declare function actionUses(builder: FlowBuilder): readonly ActionRef[];
|
|
70
|
+
/** Sub-flow: a named fragment, or an inline callback (runs once at construction — builder in, builder out). */
|
|
71
|
+
export type SubFlow = Flow | ((w: FlowBuilder) => FlowBuilder);
|
|
72
|
+
/** A branch arm: the [condition, sub-flow] tuple — an [if, then] ordering convention. */
|
|
73
|
+
export type BranchCase = readonly [condition: Condition, flow: SubFlow];
|
|
74
|
+
/**
|
|
75
|
+
* A branch argument: either a tuple arm, or a bare sub-flow meaning the default
|
|
76
|
+
* arm. The bare form may appear once, and must come last (checked at runtime).
|
|
77
|
+
*/
|
|
78
|
+
export type BranchArm = BranchCase | SubFlow;
|
|
79
|
+
export interface FlowBuilder {
|
|
80
|
+
email<T extends EmailTemplate>(template: T, ...props: MessageArgs<PropsOf<T>>): this;
|
|
81
|
+
sms<P extends object>(template: TemplateRef<'sms', P>, ...props: MessageArgs<P>): this;
|
|
82
|
+
/**
|
|
83
|
+
* Push to the user's devices — every device the host's directory lists, or
|
|
84
|
+
* only the most recently registered with `{ devices: 'latest' }`. A user with
|
|
85
|
+
* no device is skipped (`prefer([pushTpl, emailTpl], props)` falls back to email).
|
|
86
|
+
*/
|
|
87
|
+
push<T extends PushTemplate>(template: T, ...args: [...props: MessageArgs<PropsOf<T>>, options?: PushOptions]): this;
|
|
88
|
+
inApp<P extends object>(template: TemplateRef<'in_app', P>, ...props: MessageArgs<P>): this;
|
|
89
|
+
slack<T extends SlackTemplate<PropsSchema, never>>(template: T, ...props: MessageArgs<PropsOf<T>>): this;
|
|
90
|
+
discord<T extends DiscordTemplate<PropsSchema, never>>(template: T, ...props: MessageArgs<PropsOf<T>>): this;
|
|
91
|
+
survey<P extends object>(template: TemplateRef<'survey', P>, ...props: MessageArgs<P>): this;
|
|
92
|
+
/**
|
|
93
|
+
* Send one message on the first channel the user can be reached on: one push
|
|
94
|
+
* and one email template, in priority order, rendered with the same props.
|
|
95
|
+
* Sugar for the branch it compiles to — same IR, ids and hash as writing
|
|
96
|
+
*
|
|
97
|
+
* .branch(label, [reachable(first.channel), (b) => b.<first>(first, props)], (b) => b.<second>(second, props))
|
|
98
|
+
*
|
|
99
|
+
* so the choice is made once, when the step is reached, and a first choice
|
|
100
|
+
* that fails to send retries as itself — it never falls through to the
|
|
101
|
+
* second. Props are always passed (`{}` for templates that declare none),
|
|
102
|
+
* and both templates must declare the same props type; for differing props
|
|
103
|
+
* or other channels, write the branch.
|
|
104
|
+
*
|
|
105
|
+
* .prefer([push.tip, email.tip], { name: u.name }, { label: 'tip by channel' })
|
|
106
|
+
*/
|
|
107
|
+
prefer<const T extends PreferPair, const A extends PropsInput<NoInfer<PropsOf<T[0]>>>>(candidates: T & SameProps<NoInfer<T>>, props: A & NoInfer<NoExtra<A, PropsOf<T[0]>>>, options?: PreferOptions): this;
|
|
108
|
+
/** Time Delay; passing { min, max } makes it a Randomized Delay. */
|
|
109
|
+
delay(duration: Duration): this;
|
|
110
|
+
delay(range: {
|
|
111
|
+
min: Duration;
|
|
112
|
+
max: Duration;
|
|
113
|
+
}): this;
|
|
114
|
+
/** Time Window: hold until inside the window (e.g. weekdays 09:00–17:00). tz: 'user' uses the user's timezone. */
|
|
115
|
+
timeWindow(opts: {
|
|
116
|
+
days?: readonly Weekday[];
|
|
117
|
+
between: readonly [TimeOfDay, TimeOfDay];
|
|
118
|
+
tz?: 'user' | (string & {});
|
|
119
|
+
}): this;
|
|
120
|
+
/**
|
|
121
|
+
* Wait Until: continue on the main line once the condition holds, or take
|
|
122
|
+
* onTimeout when it expires (default 'continue'). On the engine side this is
|
|
123
|
+
* "await event racing a timer" — a native primitive of durable runtimes.
|
|
124
|
+
*/
|
|
125
|
+
waitUntil(condition: Condition, opts: {
|
|
126
|
+
timeout: Duration;
|
|
127
|
+
onTimeout?: 'continue' | 'exit' | SubFlow;
|
|
128
|
+
}): this;
|
|
129
|
+
/**
|
|
130
|
+
* Splice a fragment in place: a named `flow(...)` or a callback, expanded
|
|
131
|
+
* once while the workflow is defined — a composition step before compiling,
|
|
132
|
+
* not a node (the IR has no trace of it, and ids are assigned over the whole
|
|
133
|
+
* workflow as if the steps were written inline). Each use gets its own copy,
|
|
134
|
+
* so one fragment can be used in several places and workflows.
|
|
135
|
+
*
|
|
136
|
+
* const officeHours = flow((w) => w.timeWindow({ days: ['mon', 'tue', 'wed', 'thu', 'fri'], between: ['09:00', '17:00'] }));
|
|
137
|
+
* workflow({ id: 'onboarding', reentry: { mode: 'never' }, ... }).delay('1 day').use(officeHours).email(email.tip, { name: u.name })
|
|
138
|
+
*/
|
|
139
|
+
use(fragment: SubFlow): this;
|
|
140
|
+
/**
|
|
141
|
+
* Conditional branch: ordered first-match (same semantics as Step Functions
|
|
142
|
+
* Choice / Knock branch). This one primitive covers both the UI's True/False
|
|
143
|
+
* Branch (two arms) and Multi-Split Branch (N arms). Arms are
|
|
144
|
+
* [condition, sub-flow] tuples; a bare sub-flow in tail position is the
|
|
145
|
+
* default arm. With no match and no default, execution simply continues.
|
|
146
|
+
* Rejoin is structural: after the matching arm finishes, execution resumes
|
|
147
|
+
* at the node following the branch — to opt out, call .exit() inside the arm.
|
|
148
|
+
*
|
|
149
|
+
* .branch([activeSubscriber, upgradeFlow], firstTimeFlow) // True/False
|
|
150
|
+
* .branch([vip, vipFlow], [trial, trialFlow], defaultFlow) // Multi-Split
|
|
151
|
+
* .branch([not(usedStaging), eduFlow]) // single arm: no match continues
|
|
152
|
+
*
|
|
153
|
+
* The optional first argument `label` becomes the node's name in IR (UI title
|
|
154
|
+
* / observability handle). It is not a jump target — there is no goto here;
|
|
155
|
+
* looping goes through re-entry (see sendEvent). Arm labels in
|
|
156
|
+
* the UI are derived from the condition.
|
|
157
|
+
*/
|
|
158
|
+
branch(...arms: readonly BranchArm[]): this;
|
|
159
|
+
branch(label: string, ...arms: readonly BranchArm[]): this;
|
|
160
|
+
/**
|
|
161
|
+
* Gate: exit unless the condition holds, otherwise continue. A first-class
|
|
162
|
+
* node rather than sugar over branch — same semantics as Zapier's "only
|
|
163
|
+
* continue if" / Iterable's Filter tile, and rendered on its own in the UI.
|
|
164
|
+
* `reason` is the audit-log line — metadata, so rewording it is free
|
|
165
|
+
* (excluded from contentHash, see hash.ts).
|
|
166
|
+
*/
|
|
167
|
+
filter(condition: Condition, opts?: {
|
|
168
|
+
reason?: string;
|
|
169
|
+
}): this;
|
|
170
|
+
/**
|
|
171
|
+
* Random Cohort Branch (A/B): weights must sum to 100 (checked at runtime).
|
|
172
|
+
* `key` names the experiment: bucketing hashes `userId:key` instead of the
|
|
173
|
+
* structural node id, so assignments survive node insertion/moves and the
|
|
174
|
+
* experiment keeps one identity across workflow versions — set it for any
|
|
175
|
+
* A/B whose results you intend to read.
|
|
176
|
+
*
|
|
177
|
+
* Arm names become node id segments and are read back in authoring order, so
|
|
178
|
+
* they are restricted to letters, digits, '_' and '-', never starting with a
|
|
179
|
+
* digit (checked at runtime).
|
|
180
|
+
*/
|
|
181
|
+
cohort(arms: Record<string, {
|
|
182
|
+
weight: number;
|
|
183
|
+
flow?: SubFlow;
|
|
184
|
+
}>, opts?: {
|
|
185
|
+
key?: string;
|
|
186
|
+
}): this;
|
|
187
|
+
/**
|
|
188
|
+
* Exit: end the whole workflow immediately (the UI's Exit node); `reason`
|
|
189
|
+
* goes into the audit log and is metadata, so rewording it neither repins
|
|
190
|
+
* in-flight journeys nor shows up in plan. Inside a branch arm this means
|
|
191
|
+
* "terminate, do not rejoin" — it stops here instead of falling through,
|
|
192
|
+
* while an arm without exit rejoins naturally.
|
|
193
|
+
*/
|
|
194
|
+
exit(reason?: string): this;
|
|
195
|
+
/**
|
|
196
|
+
* Emit a typed event (customer.io's Send Event). The event comes from an
|
|
197
|
+
* e.xxx reference, so payload types flow in the same way trigger.event works.
|
|
198
|
+
* This is how workflows compose: an event can trigger another workflow, and
|
|
199
|
+
* the resulting call graph is statically analyzable. Payload values may
|
|
200
|
+
* reference u.xxx. Only scalar fields can be sent (IR carries literals and
|
|
201
|
+
* profile refs, not nested JSON): an event whose payload requires a nested
|
|
202
|
+
* field cannot be emitted from a journey, and the types say so.
|
|
203
|
+
*
|
|
204
|
+
* Note on loops: a trailing self-triggering sendEvent re-enters the
|
|
205
|
+
* workflow only as its `reentry` policy allows: under `never` it does not
|
|
206
|
+
* loop; under `after_exit` the emitted event arrives while this instance is
|
|
207
|
+
* still running, so it is refused too; `concurrent` (with a `cooldown` to
|
|
208
|
+
* pace it) is the periodic-flow shape.
|
|
209
|
+
* TODO: the rest of the Data category — outbound webhook / profile update /
|
|
210
|
+
* journey attributes.
|
|
211
|
+
*/
|
|
212
|
+
sendEvent<P extends object>(event: EventRef<P>, ...payload: EmitArgs<P>): this;
|
|
213
|
+
/**
|
|
214
|
+
* Run a custom action (see dsl/action.ts for the model). The chain records
|
|
215
|
+
* identity only — name and args — never the code: the implementation
|
|
216
|
+
* ships inside the deployed Worker bundle and is resolved by name from the
|
|
217
|
+
* runtime registry. Args are typed by the ActionRef and may reference u.xxx,
|
|
218
|
+
* resolved at run time exactly like message props. Executed inside a durable
|
|
219
|
+
* step: retried on throw, checkpointed on success.
|
|
220
|
+
*/
|
|
221
|
+
run<A extends object>(action: ActionRef<A>, ...args: MessageArgs<A>): this;
|
|
222
|
+
}
|
|
223
|
+
/** @internal extended by WorkflowBuilderImpl; not part of the public API */
|
|
224
|
+
export declare class FlowBuilderImpl implements FlowBuilder {
|
|
225
|
+
/** Nodes as collected; ids are assigned in one pass inside toIR, so '' is a placeholder here. */
|
|
226
|
+
readonly nodes: NodeIR[];
|
|
227
|
+
/** The template definitions sent, with where: compile-time only, never in the IR. */
|
|
228
|
+
readonly uses: TemplateUse[];
|
|
229
|
+
/** The action definitions run: compile-time identity only, never in the IR. */
|
|
230
|
+
readonly actions: ActionRef[];
|
|
231
|
+
/** Provenance: the callsite (captured in the public method) lands in meta.loc, outside the hash. */
|
|
232
|
+
private pushNode;
|
|
233
|
+
private message;
|
|
234
|
+
email<T extends EmailTemplate>(t: T, ...args: MessageArgs<PropsOf<T>>): this;
|
|
235
|
+
sms<P extends object>(t: TemplateRef<'sms', P>, ...args: MessageArgs<P>): this;
|
|
236
|
+
push<T extends PushTemplate>(t: T, ...args: [...props: MessageArgs<PropsOf<T>>, options?: PushOptions]): this;
|
|
237
|
+
inApp<P extends object>(t: TemplateRef<'in_app', P>, ...args: MessageArgs<P>): this;
|
|
238
|
+
slack<T extends SlackTemplate<PropsSchema, never>>(t: T, ...args: MessageArgs<PropsOf<T>>): this;
|
|
239
|
+
discord<T extends DiscordTemplate<PropsSchema, never>>(t: T, ...args: MessageArgs<PropsOf<T>>): this;
|
|
240
|
+
survey<P extends object>(t: TemplateRef<'survey', P>, ...args: MessageArgs<P>): this;
|
|
241
|
+
prefer<const T extends PreferPair, const A extends PropsInput<NoInfer<PropsOf<T[0]>>>>(candidates: T & SameProps<NoInfer<T>>, props: A & NoInfer<NoExtra<A, PropsOf<T[0]>>>, options?: PreferOptions): this;
|
|
242
|
+
delay(duration: Duration): this;
|
|
243
|
+
delay(range: {
|
|
244
|
+
min: Duration;
|
|
245
|
+
max: Duration;
|
|
246
|
+
}): this;
|
|
247
|
+
timeWindow(opts: {
|
|
248
|
+
days?: readonly Weekday[];
|
|
249
|
+
between: readonly [TimeOfDay, TimeOfDay];
|
|
250
|
+
tz?: 'user' | (string & {});
|
|
251
|
+
}): this;
|
|
252
|
+
waitUntil(condition: Condition, opts: {
|
|
253
|
+
timeout: Duration;
|
|
254
|
+
onTimeout?: 'continue' | 'exit' | SubFlow;
|
|
255
|
+
}): this;
|
|
256
|
+
use(fragment: SubFlow): this;
|
|
257
|
+
branch(...arms: readonly BranchArm[]): this;
|
|
258
|
+
branch(label: string, ...arms: readonly BranchArm[]): this;
|
|
259
|
+
filter(condition: Condition, opts?: {
|
|
260
|
+
reason?: string;
|
|
261
|
+
}): this;
|
|
262
|
+
cohort(arms: Record<string, {
|
|
263
|
+
weight: number;
|
|
264
|
+
flow?: SubFlow;
|
|
265
|
+
}>, opts?: {
|
|
266
|
+
key?: string;
|
|
267
|
+
}): this;
|
|
268
|
+
exit(reason?: string): this;
|
|
269
|
+
sendEvent<P extends object>(ev: EventRef<P>, ...payload: EmitArgs<P>): this;
|
|
270
|
+
run<A extends object>(a: ActionRef<A>, ...args: MessageArgs<A>): this;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* A reusable flow fragment: a free function. Once personalization goes through
|
|
274
|
+
* u.xxx and events through e.xxx, the flow layer carries no schema generics.
|
|
275
|
+
*/
|
|
276
|
+
export declare function flow(build: (w: FlowBuilder) => FlowBuilder): Flow;
|
|
277
|
+
export {};
|
|
278
|
+
//# sourceMappingURL=flow.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.d.mts","names":[],"sources":["../../src/dsl/flow.ts"],"mappings":";;;;;;;;;;;;;;;;;;;KAiDK;;KAGA,UAAU,MAAM,YAAY,aAAa,UAAU,UAAU;;YAGtD,YAAY,QAAQ,WAAW,IAAI,UAAU,EAAE;;YAG/C,SAAS,KACnB,8BAA8B,KAAK,UAAU,YAAY,OAAO,SAAS,YAAY;;iBAGtE;;EAEf;;;iBAIe;;EAEf;;;KAIG,uBAAuB,cAAc,2BAA2B,eAAe;KAE/E,eAAe,kBAAkB,WAAW,IAAI,EAAE;KAClD,MAAM,GAAG,OACV,QAAQ,UAAU,qBAAoB,SAAQ,UAAU;;KAGvD,UAAU,UAAU,cACvB,MAAM,eAAe,QAAQ,QAAQ,eAAe,QAAQ;WAE7C;;;KAGZ,YAAY,KAAK,0BAA0B;;KAE3C,QAAQ,GAAG,KAAK,OAAO,QAAQ,YAAY,UAAU;;iBAoCzC;WACN;;;;;;;iBAcM;WACN,UAAU;WACV,KAAK;;;wBAIA,aAAa,SAAS,uBAAuB;;;;;;wBAS7C,WAAW,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