@shware/workflow 0.0.0-stage → 0.0.0
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 +154 -2
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/apns-relay.cjs +105 -0
- package/dist/apns-relay.cjs.map +1 -0
- package/dist/apns-relay.d.cts +28 -0
- package/dist/apns-relay.d.cts.map +1 -0
- package/dist/apns-relay.d.mts +28 -0
- package/dist/apns-relay.d.mts.map +1 -0
- package/dist/apns-relay.mjs +104 -0
- package/dist/apns-relay.mjs.map +1 -0
- package/dist/apns.cjs +121 -0
- package/dist/apns.cjs.map +1 -0
- package/dist/apns.d.cts +63 -0
- package/dist/apns.d.cts.map +1 -0
- package/dist/apns.d.mts +63 -0
- package/dist/apns.d.mts.map +1 -0
- package/dist/apns.mjs +116 -0
- package/dist/apns.mjs.map +1 -0
- package/dist/client.cjs +125 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.cts +108 -0
- package/dist/client.d.cts.map +1 -0
- package/dist/client.d.mts +108 -0
- package/dist/client.d.mts.map +1 -0
- package/dist/client.mjs +122 -0
- package/dist/client.mjs.map +1 -0
- package/dist/cloudflare/bindings.cjs +28 -0
- package/dist/cloudflare/bindings.cjs.map +1 -0
- package/dist/cloudflare/bindings.d.cts +144 -0
- package/dist/cloudflare/bindings.d.cts.map +1 -0
- package/dist/cloudflare/bindings.d.mts +144 -0
- package/dist/cloudflare/bindings.d.mts.map +1 -0
- package/dist/cloudflare/bindings.mjs +25 -0
- package/dist/cloudflare/bindings.mjs.map +1 -0
- package/dist/cloudflare/channels.cjs +164 -0
- package/dist/cloudflare/channels.cjs.map +1 -0
- package/dist/cloudflare/channels.d.cts +29 -0
- package/dist/cloudflare/channels.d.cts.map +1 -0
- package/dist/cloudflare/channels.d.mts +29 -0
- package/dist/cloudflare/channels.d.mts.map +1 -0
- package/dist/cloudflare/channels.mjs +161 -0
- package/dist/cloudflare/channels.mjs.map +1 -0
- package/dist/cloudflare/d1-env.cjs +17 -0
- package/dist/cloudflare/d1-env.cjs.map +1 -0
- package/dist/cloudflare/d1-env.d.cts +12 -0
- package/dist/cloudflare/d1-env.d.cts.map +1 -0
- package/dist/cloudflare/d1-env.d.mts +12 -0
- package/dist/cloudflare/d1-env.d.mts.map +1 -0
- package/dist/cloudflare/d1-env.mjs +16 -0
- package/dist/cloudflare/d1-env.mjs.map +1 -0
- package/dist/cloudflare/index.cjs +54 -0
- package/dist/cloudflare/index.d.cts +19 -0
- package/dist/cloudflare/index.d.mts +19 -0
- package/dist/cloudflare/index.mjs +16 -0
- package/dist/cloudflare/router.cjs +516 -0
- package/dist/cloudflare/router.cjs.map +1 -0
- package/dist/cloudflare/router.d.cts +157 -0
- package/dist/cloudflare/router.d.cts.map +1 -0
- package/dist/cloudflare/router.d.mts +157 -0
- package/dist/cloudflare/router.d.mts.map +1 -0
- package/dist/cloudflare/router.mjs +503 -0
- package/dist/cloudflare/router.mjs.map +1 -0
- package/dist/cloudflare/runner.cjs +225 -0
- package/dist/cloudflare/runner.cjs.map +1 -0
- package/dist/cloudflare/runner.d.cts +73 -0
- package/dist/cloudflare/runner.d.cts.map +1 -0
- package/dist/cloudflare/runner.d.mts +73 -0
- package/dist/cloudflare/runner.d.mts.map +1 -0
- package/dist/cloudflare/runner.mjs +224 -0
- package/dist/cloudflare/runner.mjs.map +1 -0
- package/dist/cloudflare/schema.sql +127 -0
- package/dist/cloudflare/senders.cjs +114 -0
- package/dist/cloudflare/senders.cjs.map +1 -0
- package/dist/cloudflare/senders.d.cts +68 -0
- package/dist/cloudflare/senders.d.cts.map +1 -0
- package/dist/cloudflare/senders.d.mts +68 -0
- package/dist/cloudflare/senders.d.mts.map +1 -0
- package/dist/cloudflare/senders.mjs +108 -0
- package/dist/cloudflare/senders.mjs.map +1 -0
- package/dist/cloudflare/worker.cjs +228 -0
- package/dist/cloudflare/worker.cjs.map +1 -0
- package/dist/cloudflare/worker.d.cts +92 -0
- package/dist/cloudflare/worker.d.cts.map +1 -0
- package/dist/cloudflare/worker.d.mts +92 -0
- package/dist/cloudflare/worker.d.mts.map +1 -0
- package/dist/cloudflare/worker.mjs +224 -0
- package/dist/cloudflare/worker.mjs.map +1 -0
- package/dist/cloudflare/workers.d.cjs +0 -0
- package/dist/cloudflare/workers.d.cts +44 -0
- package/dist/cloudflare/workers.d.cts.map +1 -0
- package/dist/cloudflare/workers.d.mts +44 -0
- package/dist/cloudflare/workers.d.mts.map +1 -0
- package/dist/config.cjs +151 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.cts +149 -0
- package/dist/config.d.cts.map +1 -0
- package/dist/config.d.mts +149 -0
- package/dist/config.d.mts.map +1 -0
- package/dist/config.mjs +143 -0
- package/dist/config.mjs.map +1 -0
- package/dist/contract.cjs +212 -0
- package/dist/contract.cjs.map +1 -0
- package/dist/contract.d.cts +90 -0
- package/dist/contract.d.cts.map +1 -0
- package/dist/contract.d.mts +90 -0
- package/dist/contract.d.mts.map +1 -0
- package/dist/contract.mjs +206 -0
- package/dist/contract.mjs.map +1 -0
- package/dist/dsl/action.cjs +29 -0
- package/dist/dsl/action.cjs.map +1 -0
- package/dist/dsl/action.d.cts +64 -0
- package/dist/dsl/action.d.cts.map +1 -0
- package/dist/dsl/action.d.mts +64 -0
- package/dist/dsl/action.d.mts.map +1 -0
- package/dist/dsl/action.mjs +28 -0
- package/dist/dsl/action.mjs.map +1 -0
- package/dist/dsl/base.cjs +34 -0
- package/dist/dsl/base.cjs.map +1 -0
- package/dist/dsl/base.d.cts +45 -0
- package/dist/dsl/base.d.cts.map +1 -0
- package/dist/dsl/base.d.mts +45 -0
- package/dist/dsl/base.d.mts.map +1 -0
- package/dist/dsl/base.mjs +30 -0
- package/dist/dsl/base.mjs.map +1 -0
- package/dist/dsl/bundle.cjs +207 -0
- package/dist/dsl/bundle.cjs.map +1 -0
- package/dist/dsl/bundle.d.cts +19 -0
- package/dist/dsl/bundle.d.cts.map +1 -0
- package/dist/dsl/bundle.d.mts +19 -0
- package/dist/dsl/bundle.d.mts.map +1 -0
- package/dist/dsl/bundle.mjs +206 -0
- package/dist/dsl/bundle.mjs.map +1 -0
- package/dist/dsl/condition.cjs +177 -0
- package/dist/dsl/condition.cjs.map +1 -0
- package/dist/dsl/condition.d.cts +140 -0
- package/dist/dsl/condition.d.cts.map +1 -0
- package/dist/dsl/condition.d.mts +140 -0
- package/dist/dsl/condition.d.mts.map +1 -0
- package/dist/dsl/condition.mjs +156 -0
- package/dist/dsl/condition.mjs.map +1 -0
- package/dist/dsl/flow.cjs +228 -0
- package/dist/dsl/flow.cjs.map +1 -0
- package/dist/dsl/flow.d.cts +223 -0
- package/dist/dsl/flow.d.cts.map +1 -0
- package/dist/dsl/flow.d.mts +223 -0
- package/dist/dsl/flow.d.mts.map +1 -0
- package/dist/dsl/flow.mjs +226 -0
- package/dist/dsl/flow.mjs.map +1 -0
- package/dist/dsl/index.cjs +38 -0
- package/dist/dsl/index.d.cts +10 -0
- package/dist/dsl/index.d.mts +10 -0
- package/dist/dsl/index.mjs +9 -0
- package/dist/dsl/refs.cjs +59 -0
- package/dist/dsl/refs.cjs.map +1 -0
- package/dist/dsl/refs.d.cts +88 -0
- package/dist/dsl/refs.d.cts.map +1 -0
- package/dist/dsl/refs.d.mts +88 -0
- package/dist/dsl/refs.d.mts.map +1 -0
- package/dist/dsl/refs.mjs +55 -0
- package/dist/dsl/refs.mjs.map +1 -0
- package/dist/dsl/template.cjs +65 -0
- package/dist/dsl/template.cjs.map +1 -0
- package/dist/dsl/template.d.cts +75 -0
- package/dist/dsl/template.d.cts.map +1 -0
- package/dist/dsl/template.d.mts +75 -0
- package/dist/dsl/template.d.mts.map +1 -0
- package/dist/dsl/template.mjs +63 -0
- package/dist/dsl/template.mjs.map +1 -0
- package/dist/dsl/trigger.cjs +40 -0
- package/dist/dsl/trigger.cjs.map +1 -0
- package/dist/dsl/trigger.d.cts +65 -0
- package/dist/dsl/trigger.d.cts.map +1 -0
- package/dist/dsl/trigger.d.mts +65 -0
- package/dist/dsl/trigger.d.mts.map +1 -0
- package/dist/dsl/trigger.mjs +39 -0
- package/dist/dsl/trigger.mjs.map +1 -0
- package/dist/dsl/workflow.cjs +121 -0
- package/dist/dsl/workflow.cjs.map +1 -0
- package/dist/dsl/workflow.d.cts +59 -0
- package/dist/dsl/workflow.d.cts.map +1 -0
- package/dist/dsl/workflow.d.mts +59 -0
- package/dist/dsl/workflow.d.mts.map +1 -0
- package/dist/dsl/workflow.mjs +120 -0
- package/dist/dsl/workflow.mjs.map +1 -0
- package/dist/engine/actions.cjs +27 -0
- package/dist/engine/actions.cjs.map +1 -0
- package/dist/engine/actions.d.cts +40 -0
- package/dist/engine/actions.d.cts.map +1 -0
- package/dist/engine/actions.d.mts +40 -0
- package/dist/engine/actions.d.mts.map +1 -0
- package/dist/engine/actions.mjs +26 -0
- package/dist/engine/actions.mjs.map +1 -0
- package/dist/engine/bucket.cjs +72 -0
- package/dist/engine/bucket.cjs.map +1 -0
- package/dist/engine/bucket.d.cts +32 -0
- package/dist/engine/bucket.d.cts.map +1 -0
- package/dist/engine/bucket.d.mts +32 -0
- package/dist/engine/bucket.d.mts.map +1 -0
- package/dist/engine/bucket.mjs +69 -0
- package/dist/engine/bucket.mjs.map +1 -0
- package/dist/engine/condition.cjs +166 -0
- package/dist/engine/condition.cjs.map +1 -0
- package/dist/engine/condition.d.cts +52 -0
- package/dist/engine/condition.d.cts.map +1 -0
- package/dist/engine/condition.d.mts +52 -0
- package/dist/engine/condition.d.mts.map +1 -0
- package/dist/engine/condition.mjs +161 -0
- package/dist/engine/condition.mjs.map +1 -0
- package/dist/engine/index.cjs +20 -0
- package/dist/engine/index.d.cts +8 -0
- package/dist/engine/index.d.mts +8 -0
- package/dist/engine/index.mjs +7 -0
- package/dist/engine/interpreter.cjs +428 -0
- package/dist/engine/interpreter.cjs.map +1 -0
- package/dist/engine/interpreter.d.cts +6 -0
- package/dist/engine/interpreter.d.cts.map +1 -0
- package/dist/engine/interpreter.d.mts +6 -0
- package/dist/engine/interpreter.d.mts.map +1 -0
- package/dist/engine/interpreter.mjs +427 -0
- package/dist/engine/interpreter.mjs.map +1 -0
- package/dist/engine/ports.cjs +0 -0
- package/dist/engine/ports.d.cts +252 -0
- package/dist/engine/ports.d.cts.map +1 -0
- package/dist/engine/ports.d.mts +252 -0
- package/dist/engine/ports.d.mts.map +1 -0
- package/dist/engine/ports.mjs +1 -0
- package/dist/engine/recipient.cjs +23 -0
- package/dist/engine/recipient.cjs.map +1 -0
- package/dist/engine/recipient.d.cts +13 -0
- package/dist/engine/recipient.d.cts.map +1 -0
- package/dist/engine/recipient.d.mts +13 -0
- package/dist/engine/recipient.d.mts.map +1 -0
- package/dist/engine/recipient.mjs +22 -0
- package/dist/engine/recipient.mjs.map +1 -0
- package/dist/engine/time-scale.cjs +54 -0
- package/dist/engine/time-scale.cjs.map +1 -0
- package/dist/engine/time-scale.d.cts +31 -0
- package/dist/engine/time-scale.d.cts.map +1 -0
- package/dist/engine/time-scale.d.mts +31 -0
- package/dist/engine/time-scale.d.mts.map +1 -0
- package/dist/engine/time-scale.mjs +52 -0
- package/dist/engine/time-scale.mjs.map +1 -0
- package/dist/engine/time-window.cjs +149 -0
- package/dist/engine/time-window.cjs.map +1 -0
- package/dist/engine/time-window.d.cts +22 -0
- package/dist/engine/time-window.d.cts.map +1 -0
- package/dist/engine/time-window.d.mts +22 -0
- package/dist/engine/time-window.d.mts.map +1 -0
- package/dist/engine/time-window.mjs +147 -0
- package/dist/engine/time-window.mjs.map +1 -0
- package/dist/fcm.cjs +125 -0
- package/dist/fcm.cjs.map +1 -0
- package/dist/fcm.d.cts +48 -0
- package/dist/fcm.d.cts.map +1 -0
- package/dist/fcm.d.mts +48 -0
- package/dist/fcm.d.mts.map +1 -0
- package/dist/fcm.mjs +121 -0
- package/dist/fcm.mjs.map +1 -0
- package/dist/hash.cjs +245 -0
- package/dist/hash.cjs.map +1 -0
- package/dist/hash.d.cts +30 -0
- package/dist/hash.d.cts.map +1 -0
- package/dist/hash.d.mts +30 -0
- package/dist/hash.d.mts.map +1 -0
- package/dist/hash.mjs +239 -0
- package/dist/hash.mjs.map +1 -0
- package/dist/index.cjs +100 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.mjs +17 -0
- package/dist/ir.cjs +366 -0
- package/dist/ir.cjs.map +1 -0
- package/dist/ir.d.cts +486 -0
- package/dist/ir.d.cts.map +1 -0
- package/dist/ir.d.mts +486 -0
- package/dist/ir.d.mts.map +1 -0
- package/dist/ir.mjs +344 -0
- package/dist/ir.mjs.map +1 -0
- package/dist/jwt.cjs +22 -0
- package/dist/jwt.cjs.map +1 -0
- package/dist/jwt.d.cts +9 -0
- package/dist/jwt.d.cts.map +1 -0
- package/dist/jwt.d.mts +9 -0
- package/dist/jwt.d.mts.map +1 -0
- package/dist/jwt.mjs +20 -0
- package/dist/jwt.mjs.map +1 -0
- package/dist/plan.cjs +223 -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 +221 -0
- package/dist/plan.mjs.map +1 -0
- package/dist/postgres-js.cjs +42 -0
- package/dist/postgres-js.cjs.map +1 -0
- package/dist/postgres-js.d.cts +28 -0
- package/dist/postgres-js.d.cts.map +1 -0
- package/dist/postgres-js.d.mts +28 -0
- package/dist/postgres-js.d.mts.map +1 -0
- package/dist/postgres-js.mjs +38 -0
- package/dist/postgres-js.mjs.map +1 -0
- package/dist/provenance.cjs +67 -0
- package/dist/provenance.cjs.map +1 -0
- package/dist/provenance.d.cts +41 -0
- package/dist/provenance.d.cts.map +1 -0
- package/dist/provenance.d.mts +41 -0
- package/dist/provenance.d.mts.map +1 -0
- package/dist/provenance.mjs +65 -0
- package/dist/provenance.mjs.map +1 -0
- package/dist/push.cjs +14 -0
- package/dist/push.cjs.map +1 -0
- package/dist/push.d.cts +16 -0
- package/dist/push.d.cts.map +1 -0
- package/dist/push.d.mts +16 -0
- package/dist/push.d.mts.map +1 -0
- package/dist/push.mjs +13 -0
- package/dist/push.mjs.map +1 -0
- package/dist/react-email.cjs +48 -0
- package/dist/react-email.cjs.map +1 -0
- package/dist/react-email.d.cts +7 -0
- package/dist/react-email.d.cts.map +1 -0
- package/dist/react-email.d.mts +7 -0
- package/dist/react-email.d.mts.map +1 -0
- package/dist/react-email.mjs +47 -0
- package/dist/react-email.mjs.map +1 -0
- package/dist/reporting/classify.cjs +42 -0
- package/dist/reporting/classify.cjs.map +1 -0
- package/dist/reporting/classify.d.cts +60 -0
- package/dist/reporting/classify.d.cts.map +1 -0
- package/dist/reporting/classify.d.mts +60 -0
- package/dist/reporting/classify.d.mts.map +1 -0
- package/dist/reporting/classify.mjs +38 -0
- package/dist/reporting/classify.mjs.map +1 -0
- package/dist/reporting/observer.cjs +63 -0
- package/dist/reporting/observer.cjs.map +1 -0
- package/dist/reporting/observer.d.cts +18 -0
- package/dist/reporting/observer.d.cts.map +1 -0
- package/dist/reporting/observer.d.mts +18 -0
- package/dist/reporting/observer.d.mts.map +1 -0
- package/dist/reporting/observer.mjs +62 -0
- package/dist/reporting/observer.mjs.map +1 -0
- package/dist/reporting/tracking.cjs +153 -0
- package/dist/reporting/tracking.cjs.map +1 -0
- package/dist/reporting/tracking.d.cts +43 -0
- package/dist/reporting/tracking.d.cts.map +1 -0
- package/dist/reporting/tracking.d.mts +43 -0
- package/dist/reporting/tracking.d.mts.map +1 -0
- package/dist/reporting/tracking.mjs +151 -0
- package/dist/reporting/tracking.mjs.map +1 -0
- package/dist/runtime.cjs +19 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +30 -0
- package/dist/runtime.d.cts.map +1 -0
- package/dist/runtime.d.mts +30 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +18 -0
- package/dist/runtime.mjs.map +1 -0
- package/dist/store/d1.cjs +185 -0
- package/dist/store/d1.cjs.map +1 -0
- package/dist/store/d1.d.cts +55 -0
- package/dist/store/d1.d.cts.map +1 -0
- package/dist/store/d1.d.mts +55 -0
- package/dist/store/d1.d.mts.map +1 -0
- package/dist/store/d1.mjs +184 -0
- package/dist/store/d1.mjs.map +1 -0
- package/dist/store/facts.cjs +60 -0
- package/dist/store/facts.cjs.map +1 -0
- package/dist/store/facts.d.cts +38 -0
- package/dist/store/facts.d.cts.map +1 -0
- package/dist/store/facts.d.mts +38 -0
- package/dist/store/facts.d.mts.map +1 -0
- package/dist/store/facts.mjs +58 -0
- package/dist/store/facts.mjs.map +1 -0
- package/dist/store/index.cjs +31 -0
- package/dist/store/index.cjs.map +1 -0
- package/dist/store/index.d.cts +291 -0
- package/dist/store/index.d.cts.map +1 -0
- package/dist/store/index.d.mts +291 -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 +213 -0
- package/dist/store/postgres-reporting.cjs.map +1 -0
- package/dist/store/postgres-reporting.d.cts +63 -0
- package/dist/store/postgres-reporting.d.cts.map +1 -0
- package/dist/store/postgres-reporting.d.mts +63 -0
- package/dist/store/postgres-reporting.d.mts.map +1 -0
- package/dist/store/postgres-reporting.mjs +212 -0
- package/dist/store/postgres-reporting.mjs.map +1 -0
- package/dist/store/postgres.cjs +309 -0
- package/dist/store/postgres.cjs.map +1 -0
- package/dist/store/postgres.d.cts +77 -0
- package/dist/store/postgres.d.cts.map +1 -0
- package/dist/store/postgres.d.mts +77 -0
- package/dist/store/postgres.d.mts.map +1 -0
- package/dist/store/postgres.mjs +306 -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 +25 -0
- package/dist/store/sql.d.cts.map +1 -0
- package/dist/store/sql.d.mts +25 -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 +404 -0
- package/dist/store/tables.cjs.map +1 -0
- package/dist/store/tables.d.cts +81 -0
- package/dist/store/tables.d.cts.map +1 -0
- package/dist/store/tables.d.mts +81 -0
- package/dist/store/tables.d.mts.map +1 -0
- package/dist/store/tables.mjs +399 -0
- package/dist/store/tables.mjs.map +1 -0
- package/dist/templates.cjs +247 -0
- package/dist/templates.cjs.map +1 -0
- package/dist/templates.d.cts +187 -0
- package/dist/templates.d.cts.map +1 -0
- package/dist/templates.d.mts +187 -0
- package/dist/templates.d.mts.map +1 -0
- package/dist/templates.mjs +230 -0
- package/dist/templates.mjs.map +1 -0
- package/dist/webhooks.cjs +96 -0
- package/dist/webhooks.cjs.map +1 -0
- package/dist/webhooks.d.cts +25 -0
- package/dist/webhooks.d.cts.map +1 -0
- package/dist/webhooks.d.mts +25 -0
- package/dist/webhooks.d.mts.map +1 -0
- package/dist/webhooks.mjs +94 -0
- package/dist/webhooks.mjs.map +1 -0
- package/dist/webpush.cjs +180 -0
- package/dist/webpush.cjs.map +1 -0
- package/dist/webpush.d.cts +53 -0
- package/dist/webpush.d.cts.map +1 -0
- package/dist/webpush.d.mts +53 -0
- package/dist/webpush.d.mts.map +1 -0
- package/dist/webpush.mjs +175 -0
- package/dist/webpush.mjs.map +1 -0
- package/package.json +189 -3
- package/src/cloudflare/schema.sql +127 -0
- package/src/cloudflare/workers.d.ts +44 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { TriggerIR } from "../ir.cjs";
|
|
2
|
+
import { Contract } from "../contract.cjs";
|
|
3
|
+
import { JourneyEnv } from "./bindings.cjs";
|
|
4
|
+
import { JourneyStore, ProfileProps } from "../store/index.cjs";
|
|
5
|
+
//#region src/cloudflare/router.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Ingest router. An incoming event does four things: it is stored, it wakes
|
|
8
|
+
* waiting instances, it is matched against event triggers, and it re-evaluates
|
|
9
|
+
* segment-trigger membership. Plus /deploy (persist a bundle) and /identify
|
|
10
|
+
* (merge a profile — which wakes property-condition waits via
|
|
11
|
+
* PROFILE_UPDATED_EVENT and re-evaluates segment triggers too).
|
|
12
|
+
*
|
|
13
|
+
* Storage goes through a JourneyStore; the `store` argument defaults to the
|
|
14
|
+
* D1 + KV store built from the env's bindings, so a Worker that only has those
|
|
15
|
+
* calls these functions exactly as before.
|
|
16
|
+
*/
|
|
17
|
+
export interface IngestInput {
|
|
18
|
+
userId: string;
|
|
19
|
+
event: string;
|
|
20
|
+
payload?: Record<string, unknown>;
|
|
21
|
+
ts?: number;
|
|
22
|
+
/**
|
|
23
|
+
* This occurrence's identity, and with it the idempotency of sending it.
|
|
24
|
+
*
|
|
25
|
+
* Only the sender can know whether two deliveries describe one occurrence or
|
|
26
|
+
* two, so the engine does not decide: an id it has already stored makes the
|
|
27
|
+
* second delivery a no-op. That matters because ingest is reachable from two
|
|
28
|
+
* retrying callers — an HTTP client retrying a 500, and the interpreter's
|
|
29
|
+
* send_event step being retried after it already committed its row — and a
|
|
30
|
+
* second copy of an event silently changes every count- and window-based
|
|
31
|
+
* condition that reads the log.
|
|
32
|
+
*
|
|
33
|
+
* Callers that retry should send an id they can reproduce. Omitting it gets
|
|
34
|
+
* a fresh one, which records the event as its own occurrence.
|
|
35
|
+
*/
|
|
36
|
+
id?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface IngestResult {
|
|
39
|
+
/** The occurrence's identity: the caller's `id`, or the one minted for it. */
|
|
40
|
+
id: string;
|
|
41
|
+
/** False when that id was already in the log: nothing was written this time. */
|
|
42
|
+
stored: boolean;
|
|
43
|
+
woke: number;
|
|
44
|
+
started: string[];
|
|
45
|
+
}
|
|
46
|
+
export declare function ingestEvent(env: JourneyEnv, input: IngestInput, store?: JourneyStore): Promise<IngestResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Segment-entry triggers, maintained lazily: on each ingest/identify for a
|
|
49
|
+
* user, re-evaluate every trigger-routed segment for that user and act on the
|
|
50
|
+
* membership transition (enter → start journeys, leave → drop membership so a
|
|
51
|
+
* later re-entry is observable). Purely time-driven drift (an inactivity
|
|
52
|
+
* segment turning true by clock alone) has no event to ride on: the scheduled
|
|
53
|
+
* sweep catches it (`sweepSegments`).
|
|
54
|
+
*/
|
|
55
|
+
export declare function refreshSegmentTriggers(env: JourneyEnv, store: JourneyStore, userId: string, ts: number): Promise<string[]>;
|
|
56
|
+
export interface SweepResult {
|
|
57
|
+
users: number;
|
|
58
|
+
/** Journeys the segments' entries started. */
|
|
59
|
+
started: string[];
|
|
60
|
+
/** Each deployed segment's size after the sweep (empty when the store keeps no reporting). */
|
|
61
|
+
sizes: {
|
|
62
|
+
segment: string;
|
|
63
|
+
size: number;
|
|
64
|
+
}[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The scheduled sweep: every deployed segment evaluated for every known user — the evaluator a
|
|
68
|
+
* journey's conditions run on, so a member is exactly who a journey would see in it. Membership
|
|
69
|
+
* follows (joiners keep the time they joined, leavers are removed), segment triggers start the
|
|
70
|
+
* journeys of whoever entered by the clock alone, and the store records each segment's size.
|
|
71
|
+
* It walks users one by one: fine for thousands, a large audience wants SQL-side evaluation.
|
|
72
|
+
*/
|
|
73
|
+
export declare function sweepSegments(env: JourneyEnv, store: JourneyStore, now?: number): Promise<SweepResult>;
|
|
74
|
+
export interface IdentifyResult {
|
|
75
|
+
ok: true;
|
|
76
|
+
props: ProfileProps;
|
|
77
|
+
woke: number;
|
|
78
|
+
started: string[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Merge-patch profile properties (a null removes one), then wake property waits
|
|
82
|
+
* and re-evaluate segment triggers. The merge is one statement in the store, so
|
|
83
|
+
* two identifies landing together cannot lose each other's fields.
|
|
84
|
+
*/
|
|
85
|
+
export declare function identifyUser(env: JourneyEnv, userId: string, props: ProfileProps, store?: JourneyStore): Promise<IdentifyResult>;
|
|
86
|
+
export interface DeviceRegistration {
|
|
87
|
+
userId: string;
|
|
88
|
+
token: string;
|
|
89
|
+
platform: string;
|
|
90
|
+
ts?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A push token registered for the user (or moved to them from another account: a token belongs
|
|
94
|
+
* to one user at a time). Wakes the waits that read devices (`reachable('push')` inside
|
|
95
|
+
* `waitUntil`), for the new owner and the previous one.
|
|
96
|
+
*/
|
|
97
|
+
export declare function registerDevice(env: JourneyEnv, device: DeviceRegistration, store?: JourneyStore): Promise<{
|
|
98
|
+
ok: true;
|
|
99
|
+
woke: number;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Forget a user (a deleted account): the request is recorded first, then carried out. An
|
|
103
|
+
* instance that will not stop leaves it pending — nothing erased yet — and the scheduled sweep
|
|
104
|
+
* retries it; `erased: false` says so.
|
|
105
|
+
*/
|
|
106
|
+
export declare function forgetUser(env: JourneyEnv, userId: string, store?: JourneyStore, now?: number): Promise<{
|
|
107
|
+
ok: true;
|
|
108
|
+
erased: boolean;
|
|
109
|
+
pending: string[];
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* The user signed out on the device: the token stays registered, bound to nobody, so the next
|
|
113
|
+
* sign-in only has to bind it again. Wakes the former owner's device waits (`reachable('push')`
|
|
114
|
+
* may no longer hold).
|
|
115
|
+
*/
|
|
116
|
+
export declare function unbindDevice(env: JourneyEnv, token: string, store?: JourneyStore): Promise<{
|
|
117
|
+
ok: true;
|
|
118
|
+
woke: number;
|
|
119
|
+
}>;
|
|
120
|
+
/** A push token forgotten for good (the push service reports it gone); wakes its owner's device waits. */
|
|
121
|
+
export declare function removeDevice(env: JourneyEnv, token: string, store?: JourneyStore): Promise<{
|
|
122
|
+
ok: true;
|
|
123
|
+
woke: number;
|
|
124
|
+
}>;
|
|
125
|
+
export interface DeployResult {
|
|
126
|
+
workflows: string[];
|
|
127
|
+
/**
|
|
128
|
+
* Workflows whose trigger type has no runtime routing yet — they deploy (the
|
|
129
|
+
* IR is stored and versioned) but will never start until the routing lands.
|
|
130
|
+
* Currently: date (TODO — needs cron + Queues, instance creation is
|
|
131
|
+
* rate-limited and a date trigger fans out to the whole audience at once)
|
|
132
|
+
* and webhook (TODO — needs endpoint allocation).
|
|
133
|
+
*/
|
|
134
|
+
unrouted: {
|
|
135
|
+
workflow: string;
|
|
136
|
+
trigger: TriggerIR['type'];
|
|
137
|
+
}[];
|
|
138
|
+
}
|
|
139
|
+
/** A bundle whose declared hashes do not describe its contents — rejected before anything is written. */
|
|
140
|
+
export declare class BundleIntegrityError extends Error {
|
|
141
|
+
constructor(message: string);
|
|
142
|
+
}
|
|
143
|
+
/** Bundle deploy, terraform-apply style: workflow bodies first (content-addressed, so a failed deploy leaves only harmless orphans), then the routing swap. */
|
|
144
|
+
export declare function deployBundle(env: JourneyEnv, bundle: unknown, store?: JourneyStore): Promise<DeployResult>;
|
|
145
|
+
/**
|
|
146
|
+
* How the ingest API applies a contract: 'enforce' refuses an invalid event or
|
|
147
|
+
* patch with a 400 before anything is stored, woken or started; 'report' logs
|
|
148
|
+
* the issues (event id, name, field paths — never the payload) and accepts it,
|
|
149
|
+
* for checking real producers before turning enforcement on.
|
|
150
|
+
*/
|
|
151
|
+
export interface IngestValidation {
|
|
152
|
+
contract?: Contract | undefined;
|
|
153
|
+
mode?: 'enforce' | 'report' | undefined;
|
|
154
|
+
}
|
|
155
|
+
export declare function handleRequest(request: Request, env: JourneyEnv, store?: JourneyStore, validation?: IngestValidation): Promise<Response>;
|
|
156
|
+
//#endregion
|
|
157
|
+
//# sourceMappingURL=router.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.cts","names":[],"sources":["../../src/cloudflare/router.ts"],"mappings":";;;;;;;;;;;;;;;;iBAuCiB;EACf;EACA;EACA,UAAU;EACV;;;;;;;;;;;;;;;EAeA;;iBAGe;;EAEf;;EAEA;EACA;EACA;;wBAGoB,YACpB,KAAK,YACL,OAAO,aACP,QAAO,eACN,QAAQ;;;;;;;;;wBAsGW,uBACpB,KAAK,YACL,OAAO,cACP,gBACA,aACC;iBAgFc;EACf;;EAEA;;EAEA;IAAS;IAAiB;;;;;;;;;;wBAUN,cACpB,KAAK,YACL,OAAO,cACP,eACC,QAAQ;iBAqFM;EACf;EACA,OAAO;EACP;EACA;;;;;;;wBAQoB,aACpB,KAAK,YACL,gBACA,OAAO,cACP,QAAO,eACN,QAAQ;iBAUM;EACf;EACA;EACA;EACA;;;;;;;wBAQoB,eACpB,KAAK,YACL,QAAQ,oBACR,QAAO,eACN;EAAU;EAAU;;;;;;;wBAoED,WACpB,KAAK,YACL,gBACA,QAAO,cACP,eACC;EAAU;EAAU;EAAiB;;;;;;;wBAUlB,aACpB,KAAK,YACL,eACA,QAAO,eACN;EAAU;EAAU;;;wBAQD,aACpB,KAAK,YACL,eACA,QAAO,eACN;EAAU;EAAU;;iBASN;EACf;;;;;;;;EAQA;IAAY;IAAkB,SAAS;;;;qBAI5B,6BAA6B;EACxC,YAAY;;;wBAyCQ,aACpB,KAAK,YACL,iBACA,QAAO,eACN,QAAQ;;;;;;;iBA+CM;EACf,WAAW;EACX;;wBAGoB,cACpB,SAAS,SACT,KAAK,YACL,QAAO,cACP,aAAY,mBACX,QAAQ"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { TriggerIR } from "../ir.mjs";
|
|
2
|
+
import { Contract } from "../contract.mjs";
|
|
3
|
+
import { JourneyEnv } from "./bindings.mjs";
|
|
4
|
+
import { JourneyStore, ProfileProps } from "../store/index.mjs";
|
|
5
|
+
//#region src/cloudflare/router.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Ingest router. An incoming event does four things: it is stored, it wakes
|
|
8
|
+
* waiting instances, it is matched against event triggers, and it re-evaluates
|
|
9
|
+
* segment-trigger membership. Plus /deploy (persist a bundle) and /identify
|
|
10
|
+
* (merge a profile — which wakes property-condition waits via
|
|
11
|
+
* PROFILE_UPDATED_EVENT and re-evaluates segment triggers too).
|
|
12
|
+
*
|
|
13
|
+
* Storage goes through a JourneyStore; the `store` argument defaults to the
|
|
14
|
+
* D1 + KV store built from the env's bindings, so a Worker that only has those
|
|
15
|
+
* calls these functions exactly as before.
|
|
16
|
+
*/
|
|
17
|
+
export interface IngestInput {
|
|
18
|
+
userId: string;
|
|
19
|
+
event: string;
|
|
20
|
+
payload?: Record<string, unknown>;
|
|
21
|
+
ts?: number;
|
|
22
|
+
/**
|
|
23
|
+
* This occurrence's identity, and with it the idempotency of sending it.
|
|
24
|
+
*
|
|
25
|
+
* Only the sender can know whether two deliveries describe one occurrence or
|
|
26
|
+
* two, so the engine does not decide: an id it has already stored makes the
|
|
27
|
+
* second delivery a no-op. That matters because ingest is reachable from two
|
|
28
|
+
* retrying callers — an HTTP client retrying a 500, and the interpreter's
|
|
29
|
+
* send_event step being retried after it already committed its row — and a
|
|
30
|
+
* second copy of an event silently changes every count- and window-based
|
|
31
|
+
* condition that reads the log.
|
|
32
|
+
*
|
|
33
|
+
* Callers that retry should send an id they can reproduce. Omitting it gets
|
|
34
|
+
* a fresh one, which records the event as its own occurrence.
|
|
35
|
+
*/
|
|
36
|
+
id?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface IngestResult {
|
|
39
|
+
/** The occurrence's identity: the caller's `id`, or the one minted for it. */
|
|
40
|
+
id: string;
|
|
41
|
+
/** False when that id was already in the log: nothing was written this time. */
|
|
42
|
+
stored: boolean;
|
|
43
|
+
woke: number;
|
|
44
|
+
started: string[];
|
|
45
|
+
}
|
|
46
|
+
export declare function ingestEvent(env: JourneyEnv, input: IngestInput, store?: JourneyStore): Promise<IngestResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Segment-entry triggers, maintained lazily: on each ingest/identify for a
|
|
49
|
+
* user, re-evaluate every trigger-routed segment for that user and act on the
|
|
50
|
+
* membership transition (enter → start journeys, leave → drop membership so a
|
|
51
|
+
* later re-entry is observable). Purely time-driven drift (an inactivity
|
|
52
|
+
* segment turning true by clock alone) has no event to ride on: the scheduled
|
|
53
|
+
* sweep catches it (`sweepSegments`).
|
|
54
|
+
*/
|
|
55
|
+
export declare function refreshSegmentTriggers(env: JourneyEnv, store: JourneyStore, userId: string, ts: number): Promise<string[]>;
|
|
56
|
+
export interface SweepResult {
|
|
57
|
+
users: number;
|
|
58
|
+
/** Journeys the segments' entries started. */
|
|
59
|
+
started: string[];
|
|
60
|
+
/** Each deployed segment's size after the sweep (empty when the store keeps no reporting). */
|
|
61
|
+
sizes: {
|
|
62
|
+
segment: string;
|
|
63
|
+
size: number;
|
|
64
|
+
}[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The scheduled sweep: every deployed segment evaluated for every known user — the evaluator a
|
|
68
|
+
* journey's conditions run on, so a member is exactly who a journey would see in it. Membership
|
|
69
|
+
* follows (joiners keep the time they joined, leavers are removed), segment triggers start the
|
|
70
|
+
* journeys of whoever entered by the clock alone, and the store records each segment's size.
|
|
71
|
+
* It walks users one by one: fine for thousands, a large audience wants SQL-side evaluation.
|
|
72
|
+
*/
|
|
73
|
+
export declare function sweepSegments(env: JourneyEnv, store: JourneyStore, now?: number): Promise<SweepResult>;
|
|
74
|
+
export interface IdentifyResult {
|
|
75
|
+
ok: true;
|
|
76
|
+
props: ProfileProps;
|
|
77
|
+
woke: number;
|
|
78
|
+
started: string[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Merge-patch profile properties (a null removes one), then wake property waits
|
|
82
|
+
* and re-evaluate segment triggers. The merge is one statement in the store, so
|
|
83
|
+
* two identifies landing together cannot lose each other's fields.
|
|
84
|
+
*/
|
|
85
|
+
export declare function identifyUser(env: JourneyEnv, userId: string, props: ProfileProps, store?: JourneyStore): Promise<IdentifyResult>;
|
|
86
|
+
export interface DeviceRegistration {
|
|
87
|
+
userId: string;
|
|
88
|
+
token: string;
|
|
89
|
+
platform: string;
|
|
90
|
+
ts?: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A push token registered for the user (or moved to them from another account: a token belongs
|
|
94
|
+
* to one user at a time). Wakes the waits that read devices (`reachable('push')` inside
|
|
95
|
+
* `waitUntil`), for the new owner and the previous one.
|
|
96
|
+
*/
|
|
97
|
+
export declare function registerDevice(env: JourneyEnv, device: DeviceRegistration, store?: JourneyStore): Promise<{
|
|
98
|
+
ok: true;
|
|
99
|
+
woke: number;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Forget a user (a deleted account): the request is recorded first, then carried out. An
|
|
103
|
+
* instance that will not stop leaves it pending — nothing erased yet — and the scheduled sweep
|
|
104
|
+
* retries it; `erased: false` says so.
|
|
105
|
+
*/
|
|
106
|
+
export declare function forgetUser(env: JourneyEnv, userId: string, store?: JourneyStore, now?: number): Promise<{
|
|
107
|
+
ok: true;
|
|
108
|
+
erased: boolean;
|
|
109
|
+
pending: string[];
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* The user signed out on the device: the token stays registered, bound to nobody, so the next
|
|
113
|
+
* sign-in only has to bind it again. Wakes the former owner's device waits (`reachable('push')`
|
|
114
|
+
* may no longer hold).
|
|
115
|
+
*/
|
|
116
|
+
export declare function unbindDevice(env: JourneyEnv, token: string, store?: JourneyStore): Promise<{
|
|
117
|
+
ok: true;
|
|
118
|
+
woke: number;
|
|
119
|
+
}>;
|
|
120
|
+
/** A push token forgotten for good (the push service reports it gone); wakes its owner's device waits. */
|
|
121
|
+
export declare function removeDevice(env: JourneyEnv, token: string, store?: JourneyStore): Promise<{
|
|
122
|
+
ok: true;
|
|
123
|
+
woke: number;
|
|
124
|
+
}>;
|
|
125
|
+
export interface DeployResult {
|
|
126
|
+
workflows: string[];
|
|
127
|
+
/**
|
|
128
|
+
* Workflows whose trigger type has no runtime routing yet — they deploy (the
|
|
129
|
+
* IR is stored and versioned) but will never start until the routing lands.
|
|
130
|
+
* Currently: date (TODO — needs cron + Queues, instance creation is
|
|
131
|
+
* rate-limited and a date trigger fans out to the whole audience at once)
|
|
132
|
+
* and webhook (TODO — needs endpoint allocation).
|
|
133
|
+
*/
|
|
134
|
+
unrouted: {
|
|
135
|
+
workflow: string;
|
|
136
|
+
trigger: TriggerIR['type'];
|
|
137
|
+
}[];
|
|
138
|
+
}
|
|
139
|
+
/** A bundle whose declared hashes do not describe its contents — rejected before anything is written. */
|
|
140
|
+
export declare class BundleIntegrityError extends Error {
|
|
141
|
+
constructor(message: string);
|
|
142
|
+
}
|
|
143
|
+
/** Bundle deploy, terraform-apply style: workflow bodies first (content-addressed, so a failed deploy leaves only harmless orphans), then the routing swap. */
|
|
144
|
+
export declare function deployBundle(env: JourneyEnv, bundle: unknown, store?: JourneyStore): Promise<DeployResult>;
|
|
145
|
+
/**
|
|
146
|
+
* How the ingest API applies a contract: 'enforce' refuses an invalid event or
|
|
147
|
+
* patch with a 400 before anything is stored, woken or started; 'report' logs
|
|
148
|
+
* the issues (event id, name, field paths — never the payload) and accepts it,
|
|
149
|
+
* for checking real producers before turning enforcement on.
|
|
150
|
+
*/
|
|
151
|
+
export interface IngestValidation {
|
|
152
|
+
contract?: Contract | undefined;
|
|
153
|
+
mode?: 'enforce' | 'report' | undefined;
|
|
154
|
+
}
|
|
155
|
+
export declare function handleRequest(request: Request, env: JourneyEnv, store?: JourneyStore, validation?: IngestValidation): Promise<Response>;
|
|
156
|
+
//#endregion
|
|
157
|
+
//# sourceMappingURL=router.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.mts","names":[],"sources":["../../src/cloudflare/router.ts"],"mappings":";;;;;;;;;;;;;;;;iBAuCiB;EACf;EACA;EACA,UAAU;EACV;;;;;;;;;;;;;;;EAeA;;iBAGe;;EAEf;;EAEA;EACA;EACA;;wBAGoB,YACpB,KAAK,YACL,OAAO,aACP,QAAO,eACN,QAAQ;;;;;;;;;wBAsGW,uBACpB,KAAK,YACL,OAAO,cACP,gBACA,aACC;iBAgFc;EACf;;EAEA;;EAEA;IAAS;IAAiB;;;;;;;;;;wBAUN,cACpB,KAAK,YACL,OAAO,cACP,eACC,QAAQ;iBAqFM;EACf;EACA,OAAO;EACP;EACA;;;;;;;wBAQoB,aACpB,KAAK,YACL,gBACA,OAAO,cACP,QAAO,eACN,QAAQ;iBAUM;EACf;EACA;EACA;EACA;;;;;;;wBAQoB,eACpB,KAAK,YACL,QAAQ,oBACR,QAAO,eACN;EAAU;EAAU;;;;;;;wBAoED,WACpB,KAAK,YACL,gBACA,QAAO,cACP,eACC;EAAU;EAAU;EAAiB;;;;;;;wBAUlB,aACpB,KAAK,YACL,eACA,QAAO,eACN;EAAU;EAAU;;;wBAQD,aACpB,KAAK,YACL,eACA,QAAO,eACN;EAAU;EAAU;;iBASN;EACf;;;;;;;;EAQA;IAAY;IAAkB,SAAS;;;;qBAI5B,6BAA6B;EACxC,YAAY;;;wBAyCQ,aACpB,KAAK,YACL,iBACA,QAAO,eACN,QAAQ;;;;;;;iBA+CM;EACf,WAAW;EACX;;wBAGoB,cACpB,SAAS,SACT,KAAK,YACL,QAAO,cACP,aAAY,mBACX,QAAQ"}
|