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,766 @@
|
|
|
1
|
+
import { LinkPurpose, PushDevice } from "../engine/ports.mjs";
|
|
2
|
+
import { BundleIR, ConditionIR, ReentryIR, ScalarIR, WorkflowIR } from "../ir.mjs";
|
|
3
|
+
import { ErasureState, UserErasedError } from "./erasure.mjs";
|
|
4
|
+
import { instanceOwner, isVisitorSubject, visitorIdOf, visitorSubject } from "./identity.mjs";
|
|
5
|
+
import { JourneyFactSource } from "./facts.mjs";
|
|
6
|
+
import { SqlClientLike } from "./sql.mjs";
|
|
7
|
+
import { PostgresJourneyStore, PostgresJourneyStoreOptions } from "./postgres.mjs";
|
|
8
|
+
import { PostgresReporting } from "./postgres-reporting.mjs";
|
|
9
|
+
import { DEFAULT_SCHEMA, TABLES, TableSpec, UniqueConstraintSpec, renderDrizzleSchema, renderPostgresDdl } from "./tables.mjs";
|
|
10
|
+
/**
|
|
11
|
+
* The journey engine's data plane. Postgres is the store (`PostgresJourneyStore`); this
|
|
12
|
+
* interface is the port the host, the runner and the fact source use to persist or look
|
|
13
|
+
* anything up, and what a test stub implements in its place. Execution (durable steps,
|
|
14
|
+
* sleeps, wake-ups) is the workflow runtime's job and stays out of here.
|
|
15
|
+
*
|
|
16
|
+
* Timestamps are epoch milliseconds throughout; a store may persist them in
|
|
17
|
+
* its native type as long as `sinceMs` comparisons behave.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* A profile patch or a stored profile. On the way in, `null` means "remove
|
|
21
|
+
* this property" (RFC 7386 merge-patch, the only way the API has to unset
|
|
22
|
+
* one); a stored profile never contains null.
|
|
23
|
+
*/
|
|
24
|
+
export type ProfileProps = Record<string, ScalarIR | null | undefined>;
|
|
25
|
+
export interface EventInput {
|
|
26
|
+
/** The occurrence's identity, chosen by the sender; a second insert with the same id is a no-op. */
|
|
27
|
+
id: string;
|
|
28
|
+
userId: string;
|
|
29
|
+
event: string;
|
|
30
|
+
ts: number;
|
|
31
|
+
payload: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
export interface TriggerRoute {
|
|
34
|
+
workflow: string;
|
|
35
|
+
hash: string;
|
|
36
|
+
/** Payload gate (payload-only condition tree), or null when the trigger has none. */
|
|
37
|
+
where: ConditionIR | null;
|
|
38
|
+
/** Profile gate, or null. */
|
|
39
|
+
filter: ConditionIR | null;
|
|
40
|
+
/** Whether a visitor not signed in may enter. */
|
|
41
|
+
visitors: boolean;
|
|
42
|
+
/** The workflow's re-entry policy, deployed with the route. */
|
|
43
|
+
reentry: ReentryIR;
|
|
44
|
+
/**
|
|
45
|
+
* The code version that applied these routes; absent after a hand-posted `POST /deploy`. Read
|
|
46
|
+
* in the same row as the hash, so the pair is always one deploy's.
|
|
47
|
+
*/
|
|
48
|
+
version?: string | undefined;
|
|
49
|
+
}
|
|
50
|
+
export interface SegmentTriggerRoute {
|
|
51
|
+
workflow: string;
|
|
52
|
+
hash: string;
|
|
53
|
+
segment: string;
|
|
54
|
+
/**
|
|
55
|
+
* The segment is being seeded (see `SeedingSegment`): a user found matching is recorded as a
|
|
56
|
+
* member and no journey is started for them.
|
|
57
|
+
*/
|
|
58
|
+
seeding?: boolean | undefined;
|
|
59
|
+
/** As `TriggerRoute.reentry`. */
|
|
60
|
+
reentry: ReentryIR;
|
|
61
|
+
/** As `TriggerRoute.version`. */
|
|
62
|
+
version?: string | undefined;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A segment a deploy brought in new, or with a changed condition, that no sweep has gone through
|
|
66
|
+
* yet. Its membership says nothing so far, so a user who matches cannot be told from one who has
|
|
67
|
+
* matched all along — and a segment trigger is about entering, not about being in. Until a sweep
|
|
68
|
+
* completes, matching users become members without a journey; from then on a new member entered.
|
|
69
|
+
* `since` is when the deploy set it: a sweep ends the seeding it began with, not a later one's.
|
|
70
|
+
*/
|
|
71
|
+
export interface SeedingSegment {
|
|
72
|
+
id: string;
|
|
73
|
+
since: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* One pass of the segment sweep over every user. It lives in the store, not in the sweep that
|
|
77
|
+
* began it: a sweep that runs out of time leaves it where it got to and the next one carries on,
|
|
78
|
+
* so a pass ends however many sweeps it takes. `seeding` is what `seedingSegments` answered when
|
|
79
|
+
* it began — only that pass has been through every user for them.
|
|
80
|
+
*/
|
|
81
|
+
export interface SweepPass {
|
|
82
|
+
startedAt: number;
|
|
83
|
+
/** The last user id the pass went past; undefined before its first page. */
|
|
84
|
+
after?: string | undefined;
|
|
85
|
+
seeding: SeedingSegment[];
|
|
86
|
+
/** Users evaluated so far. */
|
|
87
|
+
evaluated: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A Worker version, as Cloudflare's version metadata binding names it: the bundle compiled into
|
|
91
|
+
* that version goes live only over an older one (`replaceRoutesIfNewer`).
|
|
92
|
+
*/
|
|
93
|
+
export interface BundleVersion {
|
|
94
|
+
id: string;
|
|
95
|
+
/** When the version was created (epoch ms): later versions are newer. */
|
|
96
|
+
createdAt: number;
|
|
97
|
+
}
|
|
98
|
+
/** A workflow version journeys are still running on: the hash their entries pin, and how many. */
|
|
99
|
+
export interface RunningPin {
|
|
100
|
+
workflow: string;
|
|
101
|
+
contentHash: string;
|
|
102
|
+
running: number;
|
|
103
|
+
}
|
|
104
|
+
export interface EntryInput {
|
|
105
|
+
workflow: string;
|
|
106
|
+
userId: string;
|
|
107
|
+
instanceId: string;
|
|
108
|
+
hash: string;
|
|
109
|
+
/** The entry's anchor: the triggering event's time, or when the segment membership began. */
|
|
110
|
+
ts: number;
|
|
111
|
+
/**
|
|
112
|
+
* The triggering occurrence's stable identity: the event id from ingest, or the segment
|
|
113
|
+
* membership (segment and since when) for a segment trigger. A retry of the same occurrence
|
|
114
|
+
* carries the same one, and the ledger holds at most one entry per (workflow, user,
|
|
115
|
+
* occurrence) — the idempotency every re-entry mode keeps.
|
|
116
|
+
*/
|
|
117
|
+
occurrence: string;
|
|
118
|
+
/** The workflow's re-entry policy, from the IR the entry pins. */
|
|
119
|
+
reentry: ReentryIR;
|
|
120
|
+
/**
|
|
121
|
+
* The instance's start, recorded in the same transaction as the entry — for a runtime whose
|
|
122
|
+
* start is an asynchronous submit (AWS) that may have to be retried.
|
|
123
|
+
*/
|
|
124
|
+
execution?: ExecutionStart | undefined;
|
|
125
|
+
}
|
|
126
|
+
/** How an instance is started on a runtime that submits it: replayed as is on every retry. */
|
|
127
|
+
export interface ExecutionStart {
|
|
128
|
+
/** The runtime's idempotency key (the durable execution name). */
|
|
129
|
+
name: string;
|
|
130
|
+
/** What is invoked: a qualified function ARN, its version included. */
|
|
131
|
+
target: string;
|
|
132
|
+
/** The exact payload: a retried submit must send the same bytes, or the runtime refuses it. */
|
|
133
|
+
input: string;
|
|
134
|
+
}
|
|
135
|
+
export interface ExecutionRecord extends ExecutionStart {
|
|
136
|
+
instanceId: string;
|
|
137
|
+
workflow: string;
|
|
138
|
+
userId: string;
|
|
139
|
+
createdAt: number;
|
|
140
|
+
submittedAt?: number | undefined;
|
|
141
|
+
arn?: string | undefined;
|
|
142
|
+
unresolvedAt?: number | undefined;
|
|
143
|
+
callbackId?: string | undefined;
|
|
144
|
+
/** Bumped by every wait the instance arms: a wake or a cleanup of an older one leaves it alone. */
|
|
145
|
+
generation: number;
|
|
146
|
+
deadlineAt?: number | undefined;
|
|
147
|
+
checkedAt?: number | undefined;
|
|
148
|
+
stoppedAt?: number | undefined;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* What a runtime that submits its starts and parks waits on one-shot callbacks (AWS) keeps
|
|
152
|
+
* beside the entry ledger. The runtime holds the execution history; this holds only the
|
|
153
|
+
* mapping from the engine's instance id to it.
|
|
154
|
+
*/
|
|
155
|
+
export interface ExecutionRegistry {
|
|
156
|
+
get(instanceId: string): Promise<ExecutionRecord | undefined>;
|
|
157
|
+
/**
|
|
158
|
+
* Starts not yet confirmed and not given up on, oldest first: of one (workflow, user) entry
|
|
159
|
+
* still running, or every one created before `createdBefore`.
|
|
160
|
+
*/
|
|
161
|
+
pendingStarts(filter: {
|
|
162
|
+
workflow?: string;
|
|
163
|
+
userId?: string;
|
|
164
|
+
createdBefore?: number;
|
|
165
|
+
limit: number;
|
|
166
|
+
}): Promise<ExecutionRecord[]>;
|
|
167
|
+
markSubmitted(instanceId: string, arn: string | undefined, at: number): Promise<void>;
|
|
168
|
+
markUnresolved(instanceId: string, at: number): Promise<void>;
|
|
169
|
+
setArn(instanceId: string, arn: string): Promise<void>;
|
|
170
|
+
/** Record the callback a wait parks on; false when a newer generation is already armed. */
|
|
171
|
+
armCallback(instanceId: string, callback: {
|
|
172
|
+
id: string;
|
|
173
|
+
generation: number;
|
|
174
|
+
deadlineAt?: number | undefined;
|
|
175
|
+
}): Promise<boolean>;
|
|
176
|
+
/** Forget the callback — only if it is still that generation's. */
|
|
177
|
+
clearCallback(instanceId: string, generation: number): Promise<void>;
|
|
178
|
+
/** Submitted executions whose entry is still running, least recently checked first. */
|
|
179
|
+
toReconcile(limit: number, checkedBefore: number): Promise<ExecutionRecord[]>;
|
|
180
|
+
markChecked(instanceId: string, at: number): Promise<void>;
|
|
181
|
+
/** Record the first stop; a later one keeps it. */
|
|
182
|
+
markStopped(instanceId: string, at: number): Promise<void>;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* How an entry attempt ended:
|
|
186
|
+
* - `entered`: a new row for the occurrence;
|
|
187
|
+
* - `reclaimed`: the occurrence's own 'failed' row (a dead instance) taken over;
|
|
188
|
+
* - `duplicate`: the occurrence already holds a live entry (running or ended);
|
|
189
|
+
* - `refused`: the re-entry policy turned it away; nothing of it is owed.
|
|
190
|
+
*/
|
|
191
|
+
export type EntryOutcome = 'entered' | 'reclaimed' | 'duplicate' | 'refused';
|
|
192
|
+
/** A device registered for pushes: its provider token belongs to the user who registered it last. */
|
|
193
|
+
export interface DeviceInput {
|
|
194
|
+
deviceId?: string | undefined;
|
|
195
|
+
/** Null until the device's visitor signs in. */
|
|
196
|
+
userId: string | null;
|
|
197
|
+
visitorId?: string | undefined;
|
|
198
|
+
token: string;
|
|
199
|
+
/** `ios` (APNs) or `android` (FCM): which provider the token belongs to. */
|
|
200
|
+
platform: string;
|
|
201
|
+
at: number;
|
|
202
|
+
}
|
|
203
|
+
/** What linking a visitor to a user did; null when it was already linked, or to another user. */
|
|
204
|
+
export interface VisitorMerge {
|
|
205
|
+
/** Instances dropped because the user is already in the same workflow: to stop. */
|
|
206
|
+
dropped: string[];
|
|
207
|
+
/** The event names and profile properties the user gained: their waits must wake. */
|
|
208
|
+
events: string[];
|
|
209
|
+
props: string[];
|
|
210
|
+
}
|
|
211
|
+
/** An instance of a user still in the ledger, and whether its runner was admitted (see `admitInstance`). */
|
|
212
|
+
export interface RunningInstance {
|
|
213
|
+
instanceId: string;
|
|
214
|
+
/** False until the runner admitted itself: nothing has run, and the tombstone keeps it that way. */
|
|
215
|
+
admitted: boolean;
|
|
216
|
+
}
|
|
217
|
+
/** One entry: the attempt it records and how far that attempt got. */
|
|
218
|
+
export interface EntryState {
|
|
219
|
+
instanceId: string;
|
|
220
|
+
/** 'running' until the run finalizes it ('completed', 'goal', 'failed', …). */
|
|
221
|
+
status: string;
|
|
222
|
+
/** The runner admitted itself (`admitInstance`): the instance did reach the runtime. */
|
|
223
|
+
admitted: boolean;
|
|
224
|
+
}
|
|
225
|
+
/** An entry still waiting for its first admission (`unadmittedEntries`). */
|
|
226
|
+
export interface UnadmittedEntry {
|
|
227
|
+
instanceId: string;
|
|
228
|
+
workflow: string;
|
|
229
|
+
userId: string;
|
|
230
|
+
}
|
|
231
|
+
/** A running entry whose runner admitted itself (`admittedEntries`). */
|
|
232
|
+
export interface AdmittedEntry {
|
|
233
|
+
instanceId: string;
|
|
234
|
+
workflow: string;
|
|
235
|
+
userId: string;
|
|
236
|
+
}
|
|
237
|
+
/** A store plus how to release what opening it acquired (a connection, say). */
|
|
238
|
+
export interface StoreLease {
|
|
239
|
+
store: JourneyStore;
|
|
240
|
+
close?: () => Promise<void>;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The live database lacks tables or columns the engine reads (an SDK upgrade added them, or the
|
|
244
|
+
* host never ran the migration). Raised before a deploy writes anything.
|
|
245
|
+
*/
|
|
246
|
+
export declare class SchemaMismatchError extends Error {
|
|
247
|
+
readonly problems: readonly string[];
|
|
248
|
+
readonly name = "SchemaMismatchError";
|
|
249
|
+
constructor(problems: readonly string[]);
|
|
250
|
+
}
|
|
251
|
+
/** A message copy as reporting records it, before it goes out. */
|
|
252
|
+
export interface MessageRecord {
|
|
253
|
+
idempotencyKey: string;
|
|
254
|
+
workflow: string;
|
|
255
|
+
instanceId: string;
|
|
256
|
+
nodeId: string;
|
|
257
|
+
template: string;
|
|
258
|
+
/** Where the copy lands: `email`, `push_ios`, `push_android`. */
|
|
259
|
+
channel: string;
|
|
260
|
+
userId: string;
|
|
261
|
+
/** An email's subscription topic; null for a transactional email and for every other channel. */
|
|
262
|
+
topic: string | null;
|
|
263
|
+
sentAt: number;
|
|
264
|
+
}
|
|
265
|
+
/** What is known of a copy without its engagement: whose it is, where it went, its topic. */
|
|
266
|
+
export interface MessageSummary {
|
|
267
|
+
userId: string;
|
|
268
|
+
channel: string;
|
|
269
|
+
topic: string | null;
|
|
270
|
+
}
|
|
271
|
+
/** One opt-out to set or clear: a topic of the channel, or the whole channel (`topic: null`). */
|
|
272
|
+
export interface SuppressionChange {
|
|
273
|
+
topic: string | null;
|
|
274
|
+
suppressed: boolean;
|
|
275
|
+
}
|
|
276
|
+
/** What a click is judged by. */
|
|
277
|
+
/** One tracked link of an email: where it goes and what following it means. */
|
|
278
|
+
export interface TrackedLink {
|
|
279
|
+
url: string;
|
|
280
|
+
purpose: LinkPurpose;
|
|
281
|
+
}
|
|
282
|
+
export interface ClickContext {
|
|
283
|
+
url: string;
|
|
284
|
+
deliveredAt: number;
|
|
285
|
+
linkCount: number;
|
|
286
|
+
/** The copy's clicks in the window before this one. */
|
|
287
|
+
recent: {
|
|
288
|
+
position: number;
|
|
289
|
+
at: number;
|
|
290
|
+
}[];
|
|
291
|
+
}
|
|
292
|
+
/** An open or a click, with the verdict on who made it and where it came from. */
|
|
293
|
+
export interface Engagement {
|
|
294
|
+
at: number;
|
|
295
|
+
machine: boolean;
|
|
296
|
+
/** The rule that called it a machine; null for a person. */
|
|
297
|
+
reason: string | null;
|
|
298
|
+
userAgent: string | null;
|
|
299
|
+
/** The network the request came from (Cloudflare's `cf.asn`, `cf.asOrganization`, `cf.country`), never the address. */
|
|
300
|
+
asn: number | null;
|
|
301
|
+
organization: string | null;
|
|
302
|
+
country: string | null;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Journey reporting: where each instance stands, every copy and how it was engaged with, segment
|
|
306
|
+
* sizes. The store exposes it as `reporting`; the host records it and serves email tracking.
|
|
307
|
+
* Every write is idempotent — a retried step reports again.
|
|
308
|
+
*/
|
|
309
|
+
/** Bounds on when an event happened, both inclusive (epoch ms); an absent side is open. */
|
|
310
|
+
export interface EventWindow {
|
|
311
|
+
sinceMs?: number;
|
|
312
|
+
untilMs?: number;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Where a page of events ended: the last row's timestamp and id, the keyset `(ts, id)` the next
|
|
316
|
+
* page starts after. Opaque to callers; `ts` is the store's own rendering of the timestamp, so a
|
|
317
|
+
* round trip loses no precision.
|
|
318
|
+
*/
|
|
319
|
+
export interface EventCursor {
|
|
320
|
+
ts: string;
|
|
321
|
+
id: string;
|
|
322
|
+
}
|
|
323
|
+
export interface JourneyReporting {
|
|
324
|
+
/** The instance entered: its row exists from here, so one a guard ends at once still counts. */
|
|
325
|
+
instanceStarted(input: {
|
|
326
|
+
workflow: string;
|
|
327
|
+
instanceId: string;
|
|
328
|
+
userId: string;
|
|
329
|
+
at: number;
|
|
330
|
+
}): Promise<void>;
|
|
331
|
+
nodeReached(input: {
|
|
332
|
+
workflow: string;
|
|
333
|
+
instanceId: string;
|
|
334
|
+
userId: string;
|
|
335
|
+
nodeId: string;
|
|
336
|
+
at: number;
|
|
337
|
+
}): Promise<void>;
|
|
338
|
+
instanceFinished(input: {
|
|
339
|
+
workflow: string;
|
|
340
|
+
instanceId: string;
|
|
341
|
+
userId: string;
|
|
342
|
+
status: string;
|
|
343
|
+
at: number;
|
|
344
|
+
convertedAt?: number;
|
|
345
|
+
}): Promise<void>;
|
|
346
|
+
/** The copy's row id; the row a retry already wrote, when there is one. */
|
|
347
|
+
recordMessage(message: MessageRecord): Promise<string>;
|
|
348
|
+
/**
|
|
349
|
+
* Whether the copy was settled (`settleMessage`: delivered, or settled undelivered) — read from
|
|
350
|
+
* the database itself, so a replayed send step never trusts a cache that missed the settle.
|
|
351
|
+
*/
|
|
352
|
+
messageSettled(idempotencyKey: string): Promise<boolean>;
|
|
353
|
+
/**
|
|
354
|
+
* Mark the copy as handed to the transport, committed before the send: true when this call
|
|
355
|
+
* made the claim, false when an earlier run of the step already held it — the copy may have
|
|
356
|
+
* gone out then, and the engine does not send it again (see `OutboundMessage.redelivery`).
|
|
357
|
+
*/
|
|
358
|
+
claimMessage(idempotencyKey: string, at: number): Promise<boolean>;
|
|
359
|
+
/** The transport threw before taking the copy: clear the claim, so the step's retry sends it. */
|
|
360
|
+
releaseMessage(idempotencyKey: string): Promise<void>;
|
|
361
|
+
settleMessage(idempotencyKey: string, result: {
|
|
362
|
+
delivered: true;
|
|
363
|
+
} | {
|
|
364
|
+
delivered: false;
|
|
365
|
+
reason: string;
|
|
366
|
+
}, at: number): Promise<void>;
|
|
367
|
+
/**
|
|
368
|
+
* An email's tracked links, in document order. A bare URL is a link of the email's content;
|
|
369
|
+
* one with a purpose other than 'link' (the unsubscribe link) is followed and recorded all the
|
|
370
|
+
* same, but a click on it is not engagement: it sets no `clicked_at` on the copy.
|
|
371
|
+
*/
|
|
372
|
+
recordLinks(messageId: string, links: readonly (string | TrackedLink)[]): Promise<void>;
|
|
373
|
+
/**
|
|
374
|
+
* Record an open of the copy, judged by `judge` against the copy (its recipient and when it was
|
|
375
|
+
* delivered — when it was sent, before the transport answered); `undefined` from the judge
|
|
376
|
+
* records nothing. Read and written in one transaction. False for an unknown copy. The copy's
|
|
377
|
+
* `channel` lets a route refuse a copy of another channel (a push beacon given an email's id).
|
|
378
|
+
*/
|
|
379
|
+
recordOpen(messageId: string, judge: (message: {
|
|
380
|
+
userId: string;
|
|
381
|
+
deliveredAt: number;
|
|
382
|
+
channel: string;
|
|
383
|
+
}) => Engagement | undefined): Promise<boolean>;
|
|
384
|
+
/**
|
|
385
|
+
* Record a click on the copy's link at `position`, judged by `judge` against the link, how
|
|
386
|
+
* many links the copy has and its clicks of the last `windowMs`. The copy is locked for the
|
|
387
|
+
* transaction, so clicks arriving together (a scanner following every link at once) are
|
|
388
|
+
* judged one after another, each seeing the ones before. When the judge asks to `backdate`,
|
|
389
|
+
* the window's earlier clicks are reclassified with this one's verdict. A click implies an
|
|
390
|
+
* open. Undefined for an unknown link.
|
|
391
|
+
*/
|
|
392
|
+
recordClick(messageId: string, position: number, at: number, windowMs: number, judge: (link: ClickContext) => {
|
|
393
|
+
engagement: Engagement;
|
|
394
|
+
backdate: boolean;
|
|
395
|
+
}): Promise<{
|
|
396
|
+
url: string;
|
|
397
|
+
engagement: Engagement;
|
|
398
|
+
} | undefined>;
|
|
399
|
+
/**
|
|
400
|
+
* The email copy's recipient opted out: of the copy's topic, or with `scope: 'all'` of every
|
|
401
|
+
* email. Recorded on the copy and as a suppression (the topic's row, or the channel-wide
|
|
402
|
+
* null-topic row), in one transaction, which also yields who the recipient is and the topic —
|
|
403
|
+
* so the caller acts on the unsubscribe without a second read. A transactional copy
|
|
404
|
+
* (`topic: null`) has nothing to opt out of: nothing is recorded, and the answer says so.
|
|
405
|
+
* Undefined for an unknown copy.
|
|
406
|
+
*/
|
|
407
|
+
recordUnsubscribe(messageId: string, at: number, scope?: 'topic' | 'all'): Promise<{
|
|
408
|
+
userId: string;
|
|
409
|
+
topic: string | null;
|
|
410
|
+
} | undefined>;
|
|
411
|
+
/** The copy's owner, channel and topic; undefined for an unknown copy. */
|
|
412
|
+
lookupMessage(messageId: string): Promise<MessageSummary | undefined>;
|
|
413
|
+
/** A push copy the device reported it received. False for an unknown copy, or one of another channel. */
|
|
414
|
+
recordDeviceDelivered(messageId: string, at: number): Promise<boolean>;
|
|
415
|
+
/** Drop members of segments no longer deployed, then record every deployed segment's size. */
|
|
416
|
+
snapshotSegments(at: number): Promise<{
|
|
417
|
+
segment: string;
|
|
418
|
+
size: number;
|
|
419
|
+
}[]>;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* A date trigger whose time has come and whose fan-out is not over: the route (what to start, on
|
|
423
|
+
* which version) and how far it got.
|
|
424
|
+
*/
|
|
425
|
+
export interface DueDateTrigger {
|
|
426
|
+
workflow: string;
|
|
427
|
+
hash: string;
|
|
428
|
+
reentry: ReentryIR;
|
|
429
|
+
version?: string | undefined;
|
|
430
|
+
/** The trigger's time, epoch milliseconds: with the workflow, the run's identity. */
|
|
431
|
+
at: number;
|
|
432
|
+
filter?: ConditionIR | undefined;
|
|
433
|
+
/** The last user the fan-out went past; undefined before its first page. */
|
|
434
|
+
after?: string | undefined;
|
|
435
|
+
/** Journeys started so far. */
|
|
436
|
+
entered: number;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* A user a date trigger's fan-out has to look at. `certain` when SQL alone decided the filter
|
|
440
|
+
* holds; otherwise the evaluator journeys run on decides.
|
|
441
|
+
*/
|
|
442
|
+
export interface DateCandidate {
|
|
443
|
+
userId: string;
|
|
444
|
+
certain: boolean;
|
|
445
|
+
}
|
|
446
|
+
/** A user the segment sweep has to evaluate, and for which segments. */
|
|
447
|
+
export interface SegmentCandidate {
|
|
448
|
+
userId: string;
|
|
449
|
+
segments: string[];
|
|
450
|
+
}
|
|
451
|
+
export interface JourneyStore {
|
|
452
|
+
/** Where instances stand, every copy and its engagement, segment sizes. */
|
|
453
|
+
readonly reporting: JourneyReporting;
|
|
454
|
+
/**
|
|
455
|
+
* Record that the user's data must go (a deleted account): the tombstone every write about
|
|
456
|
+
* the user is conditional on, from here on and for good. Committed before anything is
|
|
457
|
+
* stopped or erased, so an entry that got in before it is found by the erasure and none gets
|
|
458
|
+
* in after it. Idempotent: a second request, or one for a user already erased, changes nothing.
|
|
459
|
+
*/
|
|
460
|
+
requestErasure(userId: string, at: number): Promise<void>;
|
|
461
|
+
/** Users whose erasure was requested and not carried out yet (`'erasing'`), oldest first. */
|
|
462
|
+
pendingErasures(): Promise<string[]>;
|
|
463
|
+
/**
|
|
464
|
+
* Where the user stands: `'none'` (no tombstone), `'erasing'` (requested, their instances
|
|
465
|
+
* being stopped, data still there) or `'erased'` (`forgetUser` went through). Both
|
|
466
|
+
* tombstone states refuse every write about the user; the entry points read this for a fast
|
|
467
|
+
* answer, and the store's conditional writes are the gate itself.
|
|
468
|
+
*/
|
|
469
|
+
erasureState(userId: string): Promise<ErasureState>;
|
|
470
|
+
/** The user's journey instances still running, by the entry ledger. */
|
|
471
|
+
runningInstances(userId: string): Promise<RunningInstance[]>;
|
|
472
|
+
/**
|
|
473
|
+
* The runner's admission, before its first observable effect: records that the instance runs
|
|
474
|
+
* (`admitted_at`, kept on replay) — unless the user has an erasure tombstone, in which case
|
|
475
|
+
* nothing is recorded and the runner must not run. Mutually exclusive with `requestErasure`
|
|
476
|
+
* and `forgetUser` for that user (Postgres: the user's advisory lock), so an erasure either
|
|
477
|
+
* finds the instance admitted and stops it, or commits its tombstone first and the admission
|
|
478
|
+
* is refused — never neither.
|
|
479
|
+
*
|
|
480
|
+
* A first admission needs the entry running. An instance already admitted is admitted again
|
|
481
|
+
* whatever the entry's status — the legitimate replay of an instance whose finalisation was
|
|
482
|
+
* cut short after the entry reached its terminal status, which resumes on its own checkpoint
|
|
483
|
+
* and finishes what is left. Never a new attempt's way in: false for a terminal entry never
|
|
484
|
+
* admitted, for an entry no longer in the ledger, for another user's entry, and for an
|
|
485
|
+
* instance whose entry was reclaimed since (`enterJourney` resets the admission with the
|
|
486
|
+
* instance id, so a superseded attempt cannot pass under the id it lost).
|
|
487
|
+
*/
|
|
488
|
+
admitInstance(instanceId: string, userId: string): Promise<boolean>;
|
|
489
|
+
/**
|
|
490
|
+
* Erase everything kept about the user — profile, devices, events, wake subscriptions, segment
|
|
491
|
+
* memberships, entries and reporting — and mark the tombstone erased (`erased_at`), which
|
|
492
|
+
* stays: a write that was in flight when the data went cannot bring the user back, and the
|
|
493
|
+
* same id is never reactivated by ingest — which is also why the suppressions go with the
|
|
494
|
+
* rest: nothing is ever sent to the id again, so no opt-out needs keeping. Run only once no
|
|
495
|
+
* instance of theirs runs any more, or one could write some of it back. Idempotent. Mutually
|
|
496
|
+
* exclusive with every write about the user (the user's advisory lock), so the data is gone
|
|
497
|
+
* when this returns — nothing of theirs lands afterwards.
|
|
498
|
+
*/
|
|
499
|
+
forgetUser(userId: string, at: number): Promise<void>;
|
|
500
|
+
/**
|
|
501
|
+
* The user opted out of the channel (recorded by an unsubscribe, or set through
|
|
502
|
+
* `/subscriptions`): with a `topic`, an opt-out of that topic or of the whole channel; without
|
|
503
|
+
* one, only the whole channel.
|
|
504
|
+
*/
|
|
505
|
+
isSuppressed(userId: string, channel: string, topic?: string): Promise<boolean>;
|
|
506
|
+
/** Every opt-out of the user on the channel: the topics, and `null` for the whole channel. */
|
|
507
|
+
listSuppressions(userId: string, channel: string): Promise<(string | null)[]>;
|
|
508
|
+
/**
|
|
509
|
+
* Set or clear opt-outs, all in one transaction: a suppressed change inserts the row (keeping
|
|
510
|
+
* the time of one already there), an unsuppressed one deletes it. Written whatever the user's
|
|
511
|
+
* erasure state — the caller refuses an erased user first — since an opt-out is never refused.
|
|
512
|
+
*/
|
|
513
|
+
updateSuppressions(userId: string, channel: string, changes: readonly SuppressionChange[], at: number): Promise<void>;
|
|
514
|
+
/**
|
|
515
|
+
* What the live database lacks against the engine's tables (read-only); a deploy refuses to
|
|
516
|
+
* run while it lists anything.
|
|
517
|
+
*/
|
|
518
|
+
checkSchema(): Promise<string[]>;
|
|
519
|
+
/**
|
|
520
|
+
* Append the occurrence; false when its id was already in the log (nothing written). Throws
|
|
521
|
+
* `UserErasedError` for a user with a tombstone, like every write about a user below.
|
|
522
|
+
*/
|
|
523
|
+
insertEvent(input: EventInput): Promise<boolean>;
|
|
524
|
+
/**
|
|
525
|
+
* The occurrence as the log holds it: its name, when it happened and its payload. Undefined
|
|
526
|
+
* when the user has no event under that id. A redelivery reads it to act on what was stored
|
|
527
|
+
* the first time, not on what this delivery happens to carry.
|
|
528
|
+
*/
|
|
529
|
+
storedEvent(userId: string, id: string): Promise<{
|
|
530
|
+
event: string;
|
|
531
|
+
ts: number;
|
|
532
|
+
payload: Record<string, unknown>;
|
|
533
|
+
} | undefined>;
|
|
534
|
+
/**
|
|
535
|
+
* Occurrences of `event` for the user, optionally only those within the window. With
|
|
536
|
+
* `atLeast`, counting may stop there: the result is exact below it and some number ≥ it
|
|
537
|
+
* otherwise — all a `performed(…, { count })` check needs, without counting a heavy user's
|
|
538
|
+
* whole history.
|
|
539
|
+
*/
|
|
540
|
+
countEvents(userId: string, event: string, window?: EventWindow, atLeast?: number): Promise<number>;
|
|
541
|
+
/**
|
|
542
|
+
* One page of those occurrences' payloads, oldest first — the caller filters them with the
|
|
543
|
+
* shared evaluator and pages on with `next` only while it still needs matches, so a `where`
|
|
544
|
+
* never loads a user's whole history at once. `next` is absent on the last page.
|
|
545
|
+
*/
|
|
546
|
+
pageEventPayloads(userId: string, event: string, window: EventWindow | undefined, page: {
|
|
547
|
+
limit: number;
|
|
548
|
+
after?: EventCursor | undefined;
|
|
549
|
+
}): Promise<{
|
|
550
|
+
payloads: Record<string, unknown>[];
|
|
551
|
+
next?: EventCursor | undefined;
|
|
552
|
+
}>;
|
|
553
|
+
/** The user a visitor became, if they did. */
|
|
554
|
+
linkedUser(visitorId: string): Promise<string | undefined>;
|
|
555
|
+
/** The visitor was heard from: who they are now, the user they became or their own subject. */
|
|
556
|
+
touchVisitor(visitorId: string, at: number): Promise<string>;
|
|
557
|
+
/**
|
|
558
|
+
* Forget visitors who never signed in and were last heard from before `before`, with no journey
|
|
559
|
+
* running: up to `limit` of them, leaving no tombstone. Answers how many.
|
|
560
|
+
*/
|
|
561
|
+
pruneVisitors(before: number, limit: number): Promise<number>;
|
|
562
|
+
/**
|
|
563
|
+
* The visitor became the user: their events, profile, devices, opt-outs and journeys move to the
|
|
564
|
+
* user, once. A visitor already linked keeps its first user. Where the user already has an entry
|
|
565
|
+
* in a workflow, theirs win over the visitor's, whose instances there are dropped.
|
|
566
|
+
*/
|
|
567
|
+
linkVisitor(visitorId: string, userId: string, at: number): Promise<VisitorMerge | null>;
|
|
568
|
+
/** Who an instance's entry belongs to now. */
|
|
569
|
+
entryOwner(instanceId: string): Promise<string | undefined>;
|
|
570
|
+
getProfile(userId: string): Promise<ProfileProps | undefined>;
|
|
571
|
+
/**
|
|
572
|
+
* Merge-patch `props` into the stored profile (a null removes the property) and return the
|
|
573
|
+
* result, atomically: two concurrent identifies cannot lose each other's keys. `at` is when the
|
|
574
|
+
* values were read (now by default): a property written with a later `at` keeps its value, so
|
|
575
|
+
* a redelivered patch cannot undo a newer one.
|
|
576
|
+
*/
|
|
577
|
+
mergeProfile(userId: string, props: ProfileProps, at?: number): Promise<ProfileProps>;
|
|
578
|
+
/**
|
|
579
|
+
* Who the segment sweep has to evaluate: for each user the engine knows (a profile, an event or
|
|
580
|
+
* a membership), the segments whose membership may have to change, or whose entry still owes a
|
|
581
|
+
* start. It may name a user whose membership turns out right, since `evaluateCondition` decides;
|
|
582
|
+
* it must not leave out one whose membership is wrong. Users come in ascending order; `after`
|
|
583
|
+
* resumes past the last id of the previous page, and users with nothing to do are left out.
|
|
584
|
+
*/
|
|
585
|
+
listSegmentCandidates(page: {
|
|
586
|
+
segments: readonly {
|
|
587
|
+
id: string;
|
|
588
|
+
condition: ConditionIR;
|
|
589
|
+
}[];
|
|
590
|
+
now: number;
|
|
591
|
+
after?: string | undefined;
|
|
592
|
+
limit: number;
|
|
593
|
+
}): Promise<SegmentCandidate[]>;
|
|
594
|
+
/** The push devices a user or visitor holds now, most recently registered first. */
|
|
595
|
+
listDevices(subject: string): Promise<PushDevice[]>;
|
|
596
|
+
/**
|
|
597
|
+
* Register a device: one row per token and per device, holding only its current owner. A token
|
|
598
|
+
* registered again moves to whoever registered it last (a phone signed into another account) and
|
|
599
|
+
* to the front of their list; a device's new token replaces its old one. Answers the previous
|
|
600
|
+
* owners, whose device waits must wake.
|
|
601
|
+
*/
|
|
602
|
+
upsertDevice(device: DeviceInput): Promise<string[]>;
|
|
603
|
+
/** Forget a token (reported dead by APNs / FCM); the user or visitor it belonged to, if any. */
|
|
604
|
+
removeDevice(token: string): Promise<string | undefined>;
|
|
605
|
+
/**
|
|
606
|
+
* The user signed out on the device: the token is kept, bound to nobody, until the next
|
|
607
|
+
* registration binds it again. Who it belonged to, if anyone.
|
|
608
|
+
*/
|
|
609
|
+
unbindDevice(token: string): Promise<string | undefined>;
|
|
610
|
+
getSegmentCondition(id: string): Promise<ConditionIR | undefined>;
|
|
611
|
+
/** Every deployed segment with its definition: what the segment sweep evaluates. */
|
|
612
|
+
listSegments(): Promise<{
|
|
613
|
+
id: string;
|
|
614
|
+
condition: ConditionIR;
|
|
615
|
+
}[]>;
|
|
616
|
+
/** The segments still being seeded, as a sweep reads them before its first page. */
|
|
617
|
+
seedingSegments(): Promise<SeedingSegment[]>;
|
|
618
|
+
/**
|
|
619
|
+
* A sweep went through every user: the segments it began with are seeded. One redeployed
|
|
620
|
+
* since (another `since`) stays as it is, for the next sweep.
|
|
621
|
+
*/
|
|
622
|
+
finishSeeding(segments: readonly SeedingSegment[]): Promise<void>;
|
|
623
|
+
/** The segment sweep's pass under way, or a new one begun at `now` with the segments being seeded. */
|
|
624
|
+
openSweepPass(now: number): Promise<SweepPass>;
|
|
625
|
+
/**
|
|
626
|
+
* The pass went past `after`. Only from the place `pass` was read at: false when another sweep
|
|
627
|
+
* moved it meanwhile (an overlap, a sweep called by hand), and this one should leave it alone.
|
|
628
|
+
*/
|
|
629
|
+
advanceSweepPass(pass: SweepPass, progress: {
|
|
630
|
+
after: string;
|
|
631
|
+
evaluated: number;
|
|
632
|
+
}): Promise<boolean>;
|
|
633
|
+
/** The pass has been through every user: the next sweep begins another. False as above. */
|
|
634
|
+
finishSweepPass(pass: SweepPass): Promise<boolean>;
|
|
635
|
+
findTriggers(event: string): Promise<TriggerRoute[]>;
|
|
636
|
+
listSegmentTriggers(): Promise<SegmentTriggerRoute[]>;
|
|
637
|
+
/** Date triggers at or past their time (`at <= now`) with a fan-out still to finish, earliest first. */
|
|
638
|
+
dueDateTriggers(now: number): Promise<DueDateTrigger[]>;
|
|
639
|
+
/**
|
|
640
|
+
* The next users (ascending, at most `limit`, past `after`) a date trigger may enter: every
|
|
641
|
+
* known user without a filter, else those it holds for or SQL cannot decide.
|
|
642
|
+
*/
|
|
643
|
+
listDateCandidates(page: {
|
|
644
|
+
filter?: ConditionIR | undefined;
|
|
645
|
+
now: number;
|
|
646
|
+
after?: string | undefined;
|
|
647
|
+
limit: number;
|
|
648
|
+
}): Promise<DateCandidate[]>;
|
|
649
|
+
/**
|
|
650
|
+
* Record how far a date trigger's fan-out got: the cursor moves to `after`, `entered` is added
|
|
651
|
+
* to the count, and with `finished` (or `skipped`, the reason it ended without running) the
|
|
652
|
+
* run is over. Only from the place `run` was read at: two sweeps on one run (an overlap, a
|
|
653
|
+
* sweep called by hand) both do the page, the ledger keeps the second from starting anything,
|
|
654
|
+
* and the one that comes back late must not move the cursor back over what the other did since.
|
|
655
|
+
*/
|
|
656
|
+
advanceDateRun(run: {
|
|
657
|
+
workflow: string;
|
|
658
|
+
at: number;
|
|
659
|
+
after?: string | undefined;
|
|
660
|
+
}, progress: {
|
|
661
|
+
after?: string | undefined;
|
|
662
|
+
entered?: number;
|
|
663
|
+
finished?: boolean;
|
|
664
|
+
skipped?: 'missed';
|
|
665
|
+
now: number;
|
|
666
|
+
}): Promise<void>;
|
|
667
|
+
putWorkflowIR(workflow: WorkflowIR): Promise<void>;
|
|
668
|
+
getWorkflowIR(contentHash: string): Promise<WorkflowIR | undefined>;
|
|
669
|
+
/**
|
|
670
|
+
* The (workflow, hash) pairs with a `running` entry, each with its count: what a deploy must
|
|
671
|
+
* keep serving (`checkInFlight`).
|
|
672
|
+
*/
|
|
673
|
+
runningPins(): Promise<RunningPin[]>;
|
|
674
|
+
/**
|
|
675
|
+
* Swap the routing tables (segments, event triggers, segment triggers) for
|
|
676
|
+
* the bundle's — atomically, so a concurrent ingest never sees them half
|
|
677
|
+
* empty. Workflow bodies are stored separately (`putWorkflowIR`) because they
|
|
678
|
+
* are content-addressed and outlive the routes that point at them.
|
|
679
|
+
*
|
|
680
|
+
* With `version` — a forced apply of the code's own bundle (`POST /bundle/deploy`) — the
|
|
681
|
+
* version is recorded too, unconditionally and in the same transaction, so the live version
|
|
682
|
+
* always names the code the routes came from. Without it (a hand-posted `POST /deploy`) the
|
|
683
|
+
* recorded version stays as it was: that bundle holds until a newer code version applies its own.
|
|
684
|
+
*/
|
|
685
|
+
replaceRoutes(bundle: BundleIR, version?: BundleVersion): Promise<void>;
|
|
686
|
+
/**
|
|
687
|
+
* The Worker version whose bundle the routes came from, when one put them there (through
|
|
688
|
+
* `replaceRoutesIfNewer`, or a forced `replaceRoutes` with a version). Read from the database
|
|
689
|
+
* itself, not a cache in front of it.
|
|
690
|
+
*/
|
|
691
|
+
liveBundleVersion(): Promise<BundleVersion | undefined>;
|
|
692
|
+
/**
|
|
693
|
+
* `replaceRoutes`, only when `version` is newer than the live one, recorded in the same
|
|
694
|
+
* transaction: two versions serving side by side during a rollout cannot leave the older one's
|
|
695
|
+
* routes in force. False, with nothing written, when a version as new or newer is live.
|
|
696
|
+
*/
|
|
697
|
+
replaceRoutesIfNewer(bundle: BundleIR, version: BundleVersion): Promise<boolean>;
|
|
698
|
+
isSegmentMember(segment: string, userId: string): Promise<boolean>;
|
|
699
|
+
/** Record the membership, with the workflows its entry has to start (see segment_start). */
|
|
700
|
+
addSegmentMember(segment: string, userId: string, ts: number, workflows: readonly string[]): Promise<void>;
|
|
701
|
+
/**
|
|
702
|
+
* The workflows the member's entry has not started yet, each with when the membership began
|
|
703
|
+
* (`since`, the `ts` it was added with): one qualification's stable identity, so a retried start
|
|
704
|
+
* is the same occurrence and a fresh qualification a new one.
|
|
705
|
+
*/
|
|
706
|
+
pendingSegmentStarts(segment: string, userId: string): Promise<{
|
|
707
|
+
workflow: string;
|
|
708
|
+
since: number;
|
|
709
|
+
}[]>;
|
|
710
|
+
completeSegmentStart(segment: string, userId: string, workflow: string): Promise<void>;
|
|
711
|
+
/** Drop the membership and any start it still owed. */
|
|
712
|
+
removeSegmentMember(segment: string, userId: string): Promise<void>;
|
|
713
|
+
/**
|
|
714
|
+
* Record the entry under the workflow's re-entry policy (`entry.reentry`), one row per entry.
|
|
715
|
+
* The same occurrence is never entered twice: its live row makes the attempt a `duplicate`,
|
|
716
|
+
* its 'failed' row is reclaimed. A new occurrence is decided on the user's other entries of
|
|
717
|
+
* the workflow, 'failed' ones left out (an outage, not a journey: they neither block nor start
|
|
718
|
+
* a cooldown): `never` refuses once any exists, `after_exit` while one is still running, and a
|
|
719
|
+
* `cooldown` while one entered less than it before (by `ts`); otherwise a new row. Atomic under
|
|
720
|
+
* concurrent ingests: of two racing attempts the policy admits exactly the ones it would admit
|
|
721
|
+
* one after the other.
|
|
722
|
+
*/
|
|
723
|
+
enterJourney(entry: EntryInput): Promise<EntryOutcome>;
|
|
724
|
+
removeEntry(instanceId: string): Promise<void>;
|
|
725
|
+
setEntryStatus(instanceId: string, status: string): Promise<void>;
|
|
726
|
+
/**
|
|
727
|
+
* The entry the occurrence made in the workflow, as it stands, read from the database itself;
|
|
728
|
+
* undefined if it made none.
|
|
729
|
+
*/
|
|
730
|
+
getEntry(workflow: string, userId: string, occurrence: string): Promise<EntryState | undefined>;
|
|
731
|
+
/**
|
|
732
|
+
* Running entries no runner has admitted, claimed before `claimedBefore` (epoch ms), oldest
|
|
733
|
+
* first: candidates for a start that was lost between the claim and the platform's create.
|
|
734
|
+
*/
|
|
735
|
+
unadmittedEntries(claimedBefore: number, limit: number): Promise<UnadmittedEntry[]>;
|
|
736
|
+
/**
|
|
737
|
+
* Mark a lost start `failed`: a retry of the occurrence reclaims it, and it no longer blocks
|
|
738
|
+
* the next entry the policy allows. Only while the entry is
|
|
739
|
+
* still running and unadmitted under this instance id; false when it moved on meanwhile.
|
|
740
|
+
*/
|
|
741
|
+
failUnadmittedEntry(instanceId: string): Promise<boolean>;
|
|
742
|
+
/**
|
|
743
|
+
* Running entries whose runner admitted itself before `admittedBefore` (epoch ms): candidates
|
|
744
|
+
* for an instance the platform ended without the run finalizing its entry. A sample of at most
|
|
745
|
+
* `limit`, in no fixed order — ordered by age, the oldest entries still legitimately running
|
|
746
|
+
* (a long wait) would fill every batch and a lost one behind them would never be reached.
|
|
747
|
+
*/
|
|
748
|
+
admittedEntries(admittedBefore: number, limit: number): Promise<AdmittedEntry[]>;
|
|
749
|
+
/**
|
|
750
|
+
* Mark an admitted entry whose instance ended without finalizing `failed`, so it no longer
|
|
751
|
+
* counts as running and the next trigger the policy allows enters again. Only while the entry is still running and admitted under this instance
|
|
752
|
+
* id: a run that finalized meanwhile keeps its status, and a reclaim its new attempt; false
|
|
753
|
+
* then.
|
|
754
|
+
*/
|
|
755
|
+
failAdmittedEntry(instanceId: string): Promise<boolean>;
|
|
756
|
+
/** Execution starts and wake callbacks, for a runtime that submits its starts (AWS). */
|
|
757
|
+
readonly executions: ExecutionRegistry;
|
|
758
|
+
/** Distinct wake handles registered for (user, event). */
|
|
759
|
+
findWakeHandles(userId: string, event: string): Promise<string[]>;
|
|
760
|
+
/** Register the handle for each event; repeated registrations are idempotent. */
|
|
761
|
+
subscribe(handle: string, userId: string, events: readonly string[], ts: number): Promise<void>;
|
|
762
|
+
/** Drop every registration the handle holds. */
|
|
763
|
+
unsubscribe(handle: string): Promise<void>;
|
|
764
|
+
}
|
|
765
|
+
export { DEFAULT_SCHEMA, type ErasureState, JourneyFactSource, PostgresJourneyStore, type PostgresJourneyStoreOptions, PostgresReporting, type SqlClientLike, TABLES, type TableSpec, type UniqueConstraintSpec, UserErasedError, instanceOwner, isVisitorSubject, renderDrizzleSchema, renderPostgresDdl, visitorIdOf, visitorSubject };
|
|
766
|
+
//# sourceMappingURL=index.d.mts.map
|