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,55 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { renderToReadableStream } from "react-dom/server";
|
|
3
|
+
import { resolveEmail } from "./email.mjs";
|
|
4
|
+
import { EmailProvider } from "./email-context.mjs";
|
|
5
|
+
import { indexTemplates, lookupTemplate, parseTemplateProps } from "./templates.mjs";
|
|
6
|
+
// src/react-email.ts
|
|
7
|
+
/**
|
|
8
|
+
* `sendwend/react-email` — an EmailRenderer over the project's email
|
|
9
|
+
* registry (`react-dom` is an optional peer dependency; import this subpath
|
|
10
|
+
* only when you use it).
|
|
11
|
+
*
|
|
12
|
+
* The registry holds `emailTemplate({...})` definitions, looked up by their `id`. Props are
|
|
13
|
+
* parsed against the template's schema before the component renders — a
|
|
14
|
+
* failure throws TemplateValidationError and nothing renders — and the
|
|
15
|
+
* component renders as an element inside an `EmailProvider` carrying the
|
|
16
|
+
* template's resolved metadata (`resolveEmail` against the config's `email`
|
|
17
|
+
* and the copy's message id, when the sender has one), so hooks and context
|
|
18
|
+
* work and a layout's `useEmailContext()` reads the unsubscribe and
|
|
19
|
+
* preferences links the email is sent with; the render returns that metadata
|
|
20
|
+
* with the subject and HTML, for the sender. Rendering
|
|
21
|
+
* streams and waits for every Suspense boundary (`allReady`) — react-email's
|
|
22
|
+
* `<Tailwind>` suspends while it compiles the classes, which synchronous
|
|
23
|
+
* static markup cannot wait for — then prepends the XHTML doctype react-email
|
|
24
|
+
* uses. @react-email/render itself is avoided because its Workers build
|
|
25
|
+
* statically imports prettier and html-to-text for options never used here.
|
|
26
|
+
*/
|
|
27
|
+
const DOCTYPE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
|
|
28
|
+
function registryRenderer(emails, config) {
|
|
29
|
+
const index = indexTemplates("email", emails);
|
|
30
|
+
return async (id, props, options) => {
|
|
31
|
+
const template = lookupTemplate(index, "email", id);
|
|
32
|
+
const parsed = parseTemplateProps(template, props);
|
|
33
|
+
const email = resolveEmail(template, config, options);
|
|
34
|
+
const element = createElement(EmailProvider, { email }, createElement(template.component, parsed));
|
|
35
|
+
return {
|
|
36
|
+
...email,
|
|
37
|
+
subject: template.subject,
|
|
38
|
+
html: DOCTYPE + await renderToHtml(element)
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/** Render to a string once every Suspense boundary has resolved; a rendering error rejects. */
|
|
43
|
+
async function renderToHtml(element) {
|
|
44
|
+
let failure;
|
|
45
|
+
const stream = await renderToReadableStream(element, { onError: (error) => {
|
|
46
|
+
failure = error;
|
|
47
|
+
} });
|
|
48
|
+
await stream.allReady;
|
|
49
|
+
const html = await new Response(stream).text();
|
|
50
|
+
if (failure !== void 0) throw failure instanceof Error ? failure : new Error("email render failed", { cause: failure });
|
|
51
|
+
return html.replace(/^<!DOCTYPE html>/i, "").replace(/<link rel="preload" as="image"[^>]*\/>/g, "");
|
|
52
|
+
}
|
|
53
|
+
export { registryRenderer };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=react-email.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-email.mjs","names":[],"sources":["../src/react-email.ts"],"sourcesContent":["import { type ComponentType, type ReactElement, createElement } from 'react';\nimport { renderToReadableStream } from 'react-dom/server';\nimport { resolveEmail } from './email';\nimport { EmailProvider } from './email-context';\nimport type { EmailRenderer } from './email-sender';\nimport type { EmailConfig } from './template-rules';\nimport {\n type EmailTemplate,\n indexTemplates,\n lookupTemplate,\n parseTemplateProps,\n} from './templates';\n\n/**\n * `sendwend/react-email` — an EmailRenderer over the project's email\n * registry (`react-dom` is an optional peer dependency; import this subpath\n * only when you use it).\n *\n * The registry holds `emailTemplate({...})` definitions, looked up by their `id`. Props are\n * parsed against the template's schema before the component renders — a\n * failure throws TemplateValidationError and nothing renders — and the\n * component renders as an element inside an `EmailProvider` carrying the\n * template's resolved metadata (`resolveEmail` against the config's `email`\n * and the copy's message id, when the sender has one), so hooks and context\n * work and a layout's `useEmailContext()` reads the unsubscribe and\n * preferences links the email is sent with; the render returns that metadata\n * with the subject and HTML, for the sender. Rendering\n * streams and waits for every Suspense boundary (`allReady`) — react-email's\n * `<Tailwind>` suspends while it compiles the classes, which synchronous\n * static markup cannot wait for — then prepends the XHTML doctype react-email\n * uses. @react-email/render itself is avoided because its Workers build\n * statically imports prettier and html-to-text for options never used here.\n */\n\nconst DOCTYPE =\n '<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">';\n\nexport function registryRenderer(\n emails: Readonly<Record<string, EmailTemplate>>,\n config?: EmailConfig\n): EmailRenderer {\n const index = indexTemplates('email', emails);\n return async (id, props, options) => {\n const template = lookupTemplate(index, 'email', id);\n const parsed = parseTemplateProps(template, props);\n const email = resolveEmail(template, config, options);\n const element = createElement(\n EmailProvider,\n { email },\n createElement(template.component as ComponentType<object>, parsed)\n );\n return { ...email, subject: template.subject, html: DOCTYPE + (await renderToHtml(element)) };\n };\n}\n\n/** Render to a string once every Suspense boundary has resolved; a rendering error rejects. */\nasync function renderToHtml(element: ReactElement): Promise<string> {\n let failure: unknown;\n const stream = await renderToReadableStream(element, {\n onError: (error) => {\n failure = error;\n },\n });\n await stream.allReady;\n const html = await new Response(stream).text();\n if (failure !== undefined) {\n throw failure instanceof Error ? failure : new Error('email render failed', { cause: failure });\n }\n // Streaming a document adds what static markup did not: an HTML5 doctype (the caller prepends\n // the XHTML one email clients expect) and React 19's image preload hints, which mean nothing in\n // an email. Both are dropped, as @react-email/render does.\n return html\n .replace(/^<!DOCTYPE html>/i, '')\n .replace(/<link rel=\"preload\" as=\"image\"[^>]*\\/>/g, '');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,UACJ;AAEF,SAAgB,iBACd,QACA,QACe;CACf,MAAM,QAAQ,eAAe,SAAS,MAAM;CAC5C,OAAO,OAAO,IAAI,OAAO,YAAY;EACnC,MAAM,WAAW,eAAe,OAAO,SAAS,EAAE;EAClD,MAAM,SAAS,mBAAmB,UAAU,KAAK;EACjD,MAAM,QAAQ,aAAa,UAAU,QAAQ,OAAO;EACpD,MAAM,UAAU,cACd,eACA,EAAE,MAAM,GACR,cAAc,SAAS,WAAoC,MAAM,CACnE;EACA,OAAO;GAAE,GAAG;GAAO,SAAS,SAAS;GAAS,MAAM,UAAW,MAAM,aAAa,OAAO;EAAG;CAC9F;AACF;;AAGA,eAAe,aAAa,SAAwC;CAClE,IAAI;CACJ,MAAM,SAAS,MAAM,uBAAuB,SAAS,EACnD,UAAU,UAAU;EAClB,UAAU;CACZ,EACF,CAAC;CACD,MAAM,OAAO;CACb,MAAM,OAAO,MAAM,IAAI,SAAS,MAAM,CAAC,CAAC,KAAK;CAC7C,IAAI,YAAY,KAAA,GACd,MAAM,mBAAmB,QAAQ,UAAU,IAAI,MAAM,uBAAuB,EAAE,OAAO,QAAQ,CAAC;CAKhG,OAAO,KACJ,QAAQ,qBAAqB,EAAE,CAAC,CAChC,QAAQ,2CAA2C,EAAE;AAC1D"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
// src/reporting/classify.ts
|
|
3
|
+
/** How close together clicks on different links of one message must be to count as one walk. */
|
|
4
|
+
const BURST_WINDOW_MS = 5e3;
|
|
5
|
+
const DEFAULT_QUICK_MS = 1e3;
|
|
6
|
+
const SCANNER = /(?<![a-z])(?:(?!cubot)[a-z]*bot|crawler|spider|headlesschrome|phantomjs|barracuda|mimecast|proofpoint|safelinks|symantec|trend ?micro|forcepoint|zscaler|cisco|fortinet|sophos|messagelabs)(?![a-z])|curl\/|wget\/|python|go-http-client|java\/|okhttp/i;
|
|
7
|
+
const DATACENTER = /\b(?:amazon|aws|microsoft|azure|google cloud|digitalocean|ovh|hetzner|linode|akamai connected cloud|vultr|oracle|alibaba|tencent|proofpoint|mimecast|barracuda)\b/i;
|
|
8
|
+
const PROXY = /\b(?:forcepoint|zscaler|cisco|fortinet|sophos|trend ?micro|symantec|broadcom)\b/i;
|
|
9
|
+
const GOOGLE_PROXY = /GoogleImageProxy|ggpht\.com/i;
|
|
10
|
+
const human = {
|
|
11
|
+
machine: false,
|
|
12
|
+
reason: null
|
|
13
|
+
};
|
|
14
|
+
const machine = (reason) => ({
|
|
15
|
+
machine: true,
|
|
16
|
+
reason
|
|
17
|
+
});
|
|
18
|
+
const scanner = (facts) => SCANNER.test(facts.userAgent?.trim() ?? "");
|
|
19
|
+
function classifyOpen(facts, options = {}) {
|
|
20
|
+
const quickMs = options.quickMs ?? 1e3;
|
|
21
|
+
const agent = facts.userAgent?.trim() ?? "";
|
|
22
|
+
if (agent === "Mozilla/5.0" || /apple/i.test(facts.organization ?? "")) return machine("apple_privacy_proxy");
|
|
23
|
+
if (GOOGLE_PROXY.test(agent)) return facts.sinceDeliveredMs < quickMs ? machine("gmail_prefetch") : human;
|
|
24
|
+
return scanner(facts) ? machine("scanner") : human;
|
|
25
|
+
}
|
|
26
|
+
function classifyClick(facts, options = {}) {
|
|
27
|
+
const quickMs = options.quickMs ?? 1e3;
|
|
28
|
+
if (facts.method === "HEAD") return machine("head_request");
|
|
29
|
+
if (scanner(facts)) return machine("scanner");
|
|
30
|
+
if (DATACENTER.test(facts.organization ?? "")) return machine("datacenter");
|
|
31
|
+
if (facts.linksInBurst >= 3 || facts.linkCount >= 2 && facts.linksInBurst >= facts.linkCount) return machine("link_burst");
|
|
32
|
+
const quick = facts.sinceDeliveredMs < quickMs;
|
|
33
|
+
const pair = facts.linksInBurst >= 2;
|
|
34
|
+
if (quick && pair) return machine("quick+link_pair");
|
|
35
|
+
if (PROXY.test(facts.organization ?? "")) {
|
|
36
|
+
if (quick) return machine("proxy+quick");
|
|
37
|
+
if (pair) return machine("proxy+link_pair");
|
|
38
|
+
}
|
|
39
|
+
return human;
|
|
40
|
+
}
|
|
41
|
+
exports.BURST_WINDOW_MS = BURST_WINDOW_MS;
|
|
42
|
+
exports.DEFAULT_QUICK_MS = DEFAULT_QUICK_MS;
|
|
43
|
+
exports.classifyClick = classifyClick;
|
|
44
|
+
exports.classifyOpen = classifyOpen;
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=classify.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.cjs","names":[],"sources":["../../src/reporting/classify.ts"],"sourcesContent":["/**\n * Who opened or clicked: a person, or a machine acting on the message without one — the split\n * between human and machine engagement that open and click rates are read through. No single\n * signal decides on its own unless it is strong; weak ones only count together, the way the\n * ESPs that publish their approach describe it (a quick click alone is a person on a phone as\n * often as a scanner). Every verdict names the rule that made it, and the request's user agent and\n * network are stored beside it, so the rules can be revisited against history.\n *\n * Strong, alone enough:\n * - `scanner`: a security gateway or link checker announcing itself (Barracuda, Mimecast,\n * Proofpoint, Safe Links, curl, a headless browser…);\n * - `datacenter` (clicks): the request came from a cloud's or a mail security vendor's network\n * (AWS, Azure, Google Cloud, Proofpoint, Mimecast…), where people do not browse — Microsoft\n * Defender detonates links from Azure, and the person's own click arrives from their own\n * network. Not Cloudflare, Akamai or Fastly: iCloud Private Relay egresses there. Not for\n * opens: Gmail's, Outlook's and Yahoo's image proxies fetch from their own networks when the\n * person opens the message;\n * - `apple_privacy_proxy` (opens): Apple Mail Privacy Protection, which fetches every image on\n * delivery through Apple's proxies with the bare `Mozilla/5.0` user agent, read or not;\n * - `head_request` (clicks): a person's click is a GET;\n * - `link_burst` (clicks): three or more different links of one message within a few seconds, or\n * every link of it — the way a scanner walks a message. Earlier clicks of the burst are\n * reclassified too (see `recordClick`).\n *\n * Weak, machine only together:\n * - `quick`: within `quickMs` of delivery (1 s by default, `email.tracking.quickClickMs`);\n * - `link_pair`: another link of the same message clicked within a few seconds;\n * - `proxy` (clicks): the request came from the network of a vendor whose web proxy a company's\n * staff browse through (Zscaler, Cisco, Forcepoint, Fortinet, Sophos, Symantec/Broadcom, Trend\n * Micro). The vendor's scanner and the employee's browser leave from the same network, so the\n * network alone does not tell them apart: with either other weak signal it is a machine\n * (`proxy+quick`, `proxy+link_pair`), alone it is a person. The cost is the scanner that\n * follows one link, late: it counts as a person.\n *\n * Gmail's image proxy fetches when the person opens the message, so its opens count as human —\n * unless it fetched within `quickMs` of delivery (`gmail_prefetch`).\n */\n\nexport interface Verdict {\n machine: boolean;\n reason: string | null;\n}\n\nexport interface RequestFacts {\n method: string;\n userAgent: string | null;\n /** Cloudflare's `request.cf.asOrganization`: who owns the address the request came from. */\n organization: string | null;\n /** Milliseconds between delivering the message and this request. */\n sinceDeliveredMs: number;\n}\n\nexport interface ClassifyOptions {\n /** A request this soon after delivery is a weak machine signal; 1000 ms by default. */\n quickMs?: number;\n}\n\nexport interface ClickFacts extends RequestFacts {\n /** The different links of the message clicked within `BURST_WINDOW_MS`, this one included. */\n linksInBurst: number;\n /** How many tracked links the message has. */\n linkCount: number;\n}\n\n/** How close together clicks on different links of one message must be to count as one walk. */\nexport const BURST_WINDOW_MS = 5_000;\nexport const DEFAULT_QUICK_MS = 1_000;\n\n// Whole words only: \"San Francisco\" is not Cisco, a CUBOT phone is not a bot\nconst SCANNER =\n /(?<![a-z])(?:(?!cubot)[a-z]*bot|crawler|spider|headlesschrome|phantomjs|barracuda|mimecast|proofpoint|safelinks|symantec|trend ?micro|forcepoint|zscaler|cisco|fortinet|sophos|messagelabs)(?![a-z])|curl\\/|wget\\/|python|go-http-client|java\\/|okhttp/i;\nconst DATACENTER =\n /\\b(?:amazon|aws|microsoft|azure|google cloud|digitalocean|ovh|hetzner|linode|akamai connected cloud|vultr|oracle|alibaba|tencent|proofpoint|mimecast|barracuda)\\b/i;\n// Secure web gateways: an employee's own browser leaves from these networks too\nconst PROXY = /\\b(?:forcepoint|zscaler|cisco|fortinet|sophos|trend ?micro|symantec|broadcom)\\b/i;\nconst GOOGLE_PROXY = /GoogleImageProxy|ggpht\\.com/i;\n\nconst human: Verdict = { machine: false, reason: null };\nconst machine = (reason: string): Verdict => ({ machine: true, reason });\n\nconst scanner = (facts: RequestFacts) => SCANNER.test(facts.userAgent?.trim() ?? '');\n\nexport function classifyOpen(facts: RequestFacts, options: ClassifyOptions = {}): Verdict {\n const quickMs = options.quickMs ?? DEFAULT_QUICK_MS;\n const agent = facts.userAgent?.trim() ?? '';\n if (agent === 'Mozilla/5.0' || /apple/i.test(facts.organization ?? '')) {\n return machine('apple_privacy_proxy');\n }\n if (GOOGLE_PROXY.test(agent)) {\n return facts.sinceDeliveredMs < quickMs ? machine('gmail_prefetch') : human;\n }\n return scanner(facts) ? machine('scanner') : human;\n}\n\nexport function classifyClick(facts: ClickFacts, options: ClassifyOptions = {}): Verdict {\n const quickMs = options.quickMs ?? DEFAULT_QUICK_MS;\n if (facts.method === 'HEAD') return machine('head_request');\n if (scanner(facts)) return machine('scanner');\n if (DATACENTER.test(facts.organization ?? '')) return machine('datacenter');\n if (facts.linksInBurst >= 3 || (facts.linkCount >= 2 && facts.linksInBurst >= facts.linkCount)) {\n return machine('link_burst');\n }\n const quick = facts.sinceDeliveredMs < quickMs;\n const pair = facts.linksInBurst >= 2;\n if (quick && pair) return machine('quick+link_pair');\n if (PROXY.test(facts.organization ?? '')) {\n if (quick) return machine('proxy+quick');\n if (pair) return machine('proxy+link_pair');\n }\n return human;\n}\n"],"mappings":";;;AAiEA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;AAGhC,MAAM,UACJ;AACF,MAAM,aACJ;AAEF,MAAM,QAAQ;AACd,MAAM,eAAe;AAErB,MAAM,QAAiB;CAAE,SAAS;CAAO,QAAQ;AAAK;AACtD,MAAM,WAAW,YAA6B;CAAE,SAAS;CAAM;AAAO;AAEtE,MAAM,WAAW,UAAwB,QAAQ,KAAK,MAAM,WAAW,KAAK,KAAK,EAAE;AAEnF,SAAgB,aAAa,OAAqB,UAA2B,CAAC,GAAY;CACxF,MAAM,UAAU,QAAQ,WAAA;CACxB,MAAM,QAAQ,MAAM,WAAW,KAAK,KAAK;CACzC,IAAI,UAAU,iBAAiB,SAAS,KAAK,MAAM,gBAAgB,EAAE,GACnE,OAAO,QAAQ,qBAAqB;CAEtC,IAAI,aAAa,KAAK,KAAK,GACzB,OAAO,MAAM,mBAAmB,UAAU,QAAQ,gBAAgB,IAAI;CAExE,OAAO,QAAQ,KAAK,IAAI,QAAQ,SAAS,IAAI;AAC/C;AAEA,SAAgB,cAAc,OAAmB,UAA2B,CAAC,GAAY;CACvF,MAAM,UAAU,QAAQ,WAAA;CACxB,IAAI,MAAM,WAAW,QAAQ,OAAO,QAAQ,cAAc;CAC1D,IAAI,QAAQ,KAAK,GAAG,OAAO,QAAQ,SAAS;CAC5C,IAAI,WAAW,KAAK,MAAM,gBAAgB,EAAE,GAAG,OAAO,QAAQ,YAAY;CAC1E,IAAI,MAAM,gBAAgB,KAAM,MAAM,aAAa,KAAK,MAAM,gBAAgB,MAAM,WAClF,OAAO,QAAQ,YAAY;CAE7B,MAAM,QAAQ,MAAM,mBAAmB;CACvC,MAAM,OAAO,MAAM,gBAAgB;CACnC,IAAI,SAAS,MAAM,OAAO,QAAQ,iBAAiB;CACnD,IAAI,MAAM,KAAK,MAAM,gBAAgB,EAAE,GAAG;EACxC,IAAI,OAAO,OAAO,QAAQ,aAAa;EACvC,IAAI,MAAM,OAAO,QAAQ,iBAAiB;CAC5C;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who opened or clicked: a person, or a machine acting on the message without one — the split
|
|
3
|
+
* between human and machine engagement that open and click rates are read through. No single
|
|
4
|
+
* signal decides on its own unless it is strong; weak ones only count together, the way the
|
|
5
|
+
* ESPs that publish their approach describe it (a quick click alone is a person on a phone as
|
|
6
|
+
* often as a scanner). Every verdict names the rule that made it, and the request's user agent and
|
|
7
|
+
* network are stored beside it, so the rules can be revisited against history.
|
|
8
|
+
*
|
|
9
|
+
* Strong, alone enough:
|
|
10
|
+
* - `scanner`: a security gateway or link checker announcing itself (Barracuda, Mimecast,
|
|
11
|
+
* Proofpoint, Safe Links, curl, a headless browser…);
|
|
12
|
+
* - `datacenter` (clicks): the request came from a cloud's or a mail security vendor's network
|
|
13
|
+
* (AWS, Azure, Google Cloud, Proofpoint, Mimecast…), where people do not browse — Microsoft
|
|
14
|
+
* Defender detonates links from Azure, and the person's own click arrives from their own
|
|
15
|
+
* network. Not Cloudflare, Akamai or Fastly: iCloud Private Relay egresses there. Not for
|
|
16
|
+
* opens: Gmail's, Outlook's and Yahoo's image proxies fetch from their own networks when the
|
|
17
|
+
* person opens the message;
|
|
18
|
+
* - `apple_privacy_proxy` (opens): Apple Mail Privacy Protection, which fetches every image on
|
|
19
|
+
* delivery through Apple's proxies with the bare `Mozilla/5.0` user agent, read or not;
|
|
20
|
+
* - `head_request` (clicks): a person's click is a GET;
|
|
21
|
+
* - `link_burst` (clicks): three or more different links of one message within a few seconds, or
|
|
22
|
+
* every link of it — the way a scanner walks a message. Earlier clicks of the burst are
|
|
23
|
+
* reclassified too (see `recordClick`).
|
|
24
|
+
*
|
|
25
|
+
* Weak, machine only together:
|
|
26
|
+
* - `quick`: within `quickMs` of delivery (1 s by default, `email.tracking.quickClickMs`);
|
|
27
|
+
* - `link_pair`: another link of the same message clicked within a few seconds;
|
|
28
|
+
* - `proxy` (clicks): the request came from the network of a vendor whose web proxy a company's
|
|
29
|
+
* staff browse through (Zscaler, Cisco, Forcepoint, Fortinet, Sophos, Symantec/Broadcom, Trend
|
|
30
|
+
* Micro). The vendor's scanner and the employee's browser leave from the same network, so the
|
|
31
|
+
* network alone does not tell them apart: with either other weak signal it is a machine
|
|
32
|
+
* (`proxy+quick`, `proxy+link_pair`), alone it is a person. The cost is the scanner that
|
|
33
|
+
* follows one link, late: it counts as a person.
|
|
34
|
+
*
|
|
35
|
+
* Gmail's image proxy fetches when the person opens the message, so its opens count as human —
|
|
36
|
+
* unless it fetched within `quickMs` of delivery (`gmail_prefetch`).
|
|
37
|
+
*/
|
|
38
|
+
export interface Verdict {
|
|
39
|
+
machine: boolean;
|
|
40
|
+
reason: string | null;
|
|
41
|
+
}
|
|
42
|
+
export interface RequestFacts {
|
|
43
|
+
method: string;
|
|
44
|
+
userAgent: string | null;
|
|
45
|
+
/** Cloudflare's `request.cf.asOrganization`: who owns the address the request came from. */
|
|
46
|
+
organization: string | null;
|
|
47
|
+
/** Milliseconds between delivering the message and this request. */
|
|
48
|
+
sinceDeliveredMs: number;
|
|
49
|
+
}
|
|
50
|
+
export interface ClassifyOptions {
|
|
51
|
+
/** A request this soon after delivery is a weak machine signal; 1000 ms by default. */
|
|
52
|
+
quickMs?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface ClickFacts extends RequestFacts {
|
|
55
|
+
/** The different links of the message clicked within `BURST_WINDOW_MS`, this one included. */
|
|
56
|
+
linksInBurst: number;
|
|
57
|
+
/** How many tracked links the message has. */
|
|
58
|
+
linkCount: number;
|
|
59
|
+
}
|
|
60
|
+
/** How close together clicks on different links of one message must be to count as one walk. */
|
|
61
|
+
export declare const BURST_WINDOW_MS = 5000;
|
|
62
|
+
export declare const DEFAULT_QUICK_MS = 1000;
|
|
63
|
+
export declare function classifyOpen(facts: RequestFacts, options?: ClassifyOptions): Verdict;
|
|
64
|
+
export declare function classifyClick(facts: ClickFacts, options?: ClassifyOptions): Verdict;
|
|
65
|
+
//# sourceMappingURL=classify.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.cts","names":[],"sources":["../../src/reporting/classify.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCiB;EACf;EACA;;iBAGe;EACf;EACA;;EAEA;;EAEA;;iBAGe;;EAEf;;iBAGe,mBAAmB;;EAElC;;EAEA;;;qBAIW;qBACA;wBAgBG,aAAa,OAAO,cAAc,UAAS,kBAAuB;wBAYlE,cAAc,OAAO,YAAY,UAAS,kBAAuB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who opened or clicked: a person, or a machine acting on the message without one — the split
|
|
3
|
+
* between human and machine engagement that open and click rates are read through. No single
|
|
4
|
+
* signal decides on its own unless it is strong; weak ones only count together, the way the
|
|
5
|
+
* ESPs that publish their approach describe it (a quick click alone is a person on a phone as
|
|
6
|
+
* often as a scanner). Every verdict names the rule that made it, and the request's user agent and
|
|
7
|
+
* network are stored beside it, so the rules can be revisited against history.
|
|
8
|
+
*
|
|
9
|
+
* Strong, alone enough:
|
|
10
|
+
* - `scanner`: a security gateway or link checker announcing itself (Barracuda, Mimecast,
|
|
11
|
+
* Proofpoint, Safe Links, curl, a headless browser…);
|
|
12
|
+
* - `datacenter` (clicks): the request came from a cloud's or a mail security vendor's network
|
|
13
|
+
* (AWS, Azure, Google Cloud, Proofpoint, Mimecast…), where people do not browse — Microsoft
|
|
14
|
+
* Defender detonates links from Azure, and the person's own click arrives from their own
|
|
15
|
+
* network. Not Cloudflare, Akamai or Fastly: iCloud Private Relay egresses there. Not for
|
|
16
|
+
* opens: Gmail's, Outlook's and Yahoo's image proxies fetch from their own networks when the
|
|
17
|
+
* person opens the message;
|
|
18
|
+
* - `apple_privacy_proxy` (opens): Apple Mail Privacy Protection, which fetches every image on
|
|
19
|
+
* delivery through Apple's proxies with the bare `Mozilla/5.0` user agent, read or not;
|
|
20
|
+
* - `head_request` (clicks): a person's click is a GET;
|
|
21
|
+
* - `link_burst` (clicks): three or more different links of one message within a few seconds, or
|
|
22
|
+
* every link of it — the way a scanner walks a message. Earlier clicks of the burst are
|
|
23
|
+
* reclassified too (see `recordClick`).
|
|
24
|
+
*
|
|
25
|
+
* Weak, machine only together:
|
|
26
|
+
* - `quick`: within `quickMs` of delivery (1 s by default, `email.tracking.quickClickMs`);
|
|
27
|
+
* - `link_pair`: another link of the same message clicked within a few seconds;
|
|
28
|
+
* - `proxy` (clicks): the request came from the network of a vendor whose web proxy a company's
|
|
29
|
+
* staff browse through (Zscaler, Cisco, Forcepoint, Fortinet, Sophos, Symantec/Broadcom, Trend
|
|
30
|
+
* Micro). The vendor's scanner and the employee's browser leave from the same network, so the
|
|
31
|
+
* network alone does not tell them apart: with either other weak signal it is a machine
|
|
32
|
+
* (`proxy+quick`, `proxy+link_pair`), alone it is a person. The cost is the scanner that
|
|
33
|
+
* follows one link, late: it counts as a person.
|
|
34
|
+
*
|
|
35
|
+
* Gmail's image proxy fetches when the person opens the message, so its opens count as human —
|
|
36
|
+
* unless it fetched within `quickMs` of delivery (`gmail_prefetch`).
|
|
37
|
+
*/
|
|
38
|
+
export interface Verdict {
|
|
39
|
+
machine: boolean;
|
|
40
|
+
reason: string | null;
|
|
41
|
+
}
|
|
42
|
+
export interface RequestFacts {
|
|
43
|
+
method: string;
|
|
44
|
+
userAgent: string | null;
|
|
45
|
+
/** Cloudflare's `request.cf.asOrganization`: who owns the address the request came from. */
|
|
46
|
+
organization: string | null;
|
|
47
|
+
/** Milliseconds between delivering the message and this request. */
|
|
48
|
+
sinceDeliveredMs: number;
|
|
49
|
+
}
|
|
50
|
+
export interface ClassifyOptions {
|
|
51
|
+
/** A request this soon after delivery is a weak machine signal; 1000 ms by default. */
|
|
52
|
+
quickMs?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface ClickFacts extends RequestFacts {
|
|
55
|
+
/** The different links of the message clicked within `BURST_WINDOW_MS`, this one included. */
|
|
56
|
+
linksInBurst: number;
|
|
57
|
+
/** How many tracked links the message has. */
|
|
58
|
+
linkCount: number;
|
|
59
|
+
}
|
|
60
|
+
/** How close together clicks on different links of one message must be to count as one walk. */
|
|
61
|
+
export declare const BURST_WINDOW_MS = 5000;
|
|
62
|
+
export declare const DEFAULT_QUICK_MS = 1000;
|
|
63
|
+
export declare function classifyOpen(facts: RequestFacts, options?: ClassifyOptions): Verdict;
|
|
64
|
+
export declare function classifyClick(facts: ClickFacts, options?: ClassifyOptions): Verdict;
|
|
65
|
+
//# sourceMappingURL=classify.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.d.mts","names":[],"sources":["../../src/reporting/classify.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsCiB;EACf;EACA;;iBAGe;EACf;EACA;;EAEA;;EAEA;;iBAGe;;EAEf;;iBAGe,mBAAmB;;EAElC;;EAEA;;;qBAIW;qBACA;wBAgBG,aAAa,OAAO,cAAc,UAAS,kBAAuB;wBAYlE,cAAc,OAAO,YAAY,UAAS,kBAAuB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/reporting/classify.ts
|
|
2
|
+
/** How close together clicks on different links of one message must be to count as one walk. */
|
|
3
|
+
const BURST_WINDOW_MS = 5e3;
|
|
4
|
+
const DEFAULT_QUICK_MS = 1e3;
|
|
5
|
+
const SCANNER = /(?<![a-z])(?:(?!cubot)[a-z]*bot|crawler|spider|headlesschrome|phantomjs|barracuda|mimecast|proofpoint|safelinks|symantec|trend ?micro|forcepoint|zscaler|cisco|fortinet|sophos|messagelabs)(?![a-z])|curl\/|wget\/|python|go-http-client|java\/|okhttp/i;
|
|
6
|
+
const DATACENTER = /\b(?:amazon|aws|microsoft|azure|google cloud|digitalocean|ovh|hetzner|linode|akamai connected cloud|vultr|oracle|alibaba|tencent|proofpoint|mimecast|barracuda)\b/i;
|
|
7
|
+
const PROXY = /\b(?:forcepoint|zscaler|cisco|fortinet|sophos|trend ?micro|symantec|broadcom)\b/i;
|
|
8
|
+
const GOOGLE_PROXY = /GoogleImageProxy|ggpht\.com/i;
|
|
9
|
+
const human = {
|
|
10
|
+
machine: false,
|
|
11
|
+
reason: null
|
|
12
|
+
};
|
|
13
|
+
const machine = (reason) => ({
|
|
14
|
+
machine: true,
|
|
15
|
+
reason
|
|
16
|
+
});
|
|
17
|
+
const scanner = (facts) => SCANNER.test(facts.userAgent?.trim() ?? "");
|
|
18
|
+
function classifyOpen(facts, options = {}) {
|
|
19
|
+
const quickMs = options.quickMs ?? 1e3;
|
|
20
|
+
const agent = facts.userAgent?.trim() ?? "";
|
|
21
|
+
if (agent === "Mozilla/5.0" || /apple/i.test(facts.organization ?? "")) return machine("apple_privacy_proxy");
|
|
22
|
+
if (GOOGLE_PROXY.test(agent)) return facts.sinceDeliveredMs < quickMs ? machine("gmail_prefetch") : human;
|
|
23
|
+
return scanner(facts) ? machine("scanner") : human;
|
|
24
|
+
}
|
|
25
|
+
function classifyClick(facts, options = {}) {
|
|
26
|
+
const quickMs = options.quickMs ?? 1e3;
|
|
27
|
+
if (facts.method === "HEAD") return machine("head_request");
|
|
28
|
+
if (scanner(facts)) return machine("scanner");
|
|
29
|
+
if (DATACENTER.test(facts.organization ?? "")) return machine("datacenter");
|
|
30
|
+
if (facts.linksInBurst >= 3 || facts.linkCount >= 2 && facts.linksInBurst >= facts.linkCount) return machine("link_burst");
|
|
31
|
+
const quick = facts.sinceDeliveredMs < quickMs;
|
|
32
|
+
const pair = facts.linksInBurst >= 2;
|
|
33
|
+
if (quick && pair) return machine("quick+link_pair");
|
|
34
|
+
if (PROXY.test(facts.organization ?? "")) {
|
|
35
|
+
if (quick) return machine("proxy+quick");
|
|
36
|
+
if (pair) return machine("proxy+link_pair");
|
|
37
|
+
}
|
|
38
|
+
return human;
|
|
39
|
+
}
|
|
40
|
+
export { BURST_WINDOW_MS, DEFAULT_QUICK_MS, classifyClick, classifyOpen };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=classify.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.mjs","names":[],"sources":["../../src/reporting/classify.ts"],"sourcesContent":["/**\n * Who opened or clicked: a person, or a machine acting on the message without one — the split\n * between human and machine engagement that open and click rates are read through. No single\n * signal decides on its own unless it is strong; weak ones only count together, the way the\n * ESPs that publish their approach describe it (a quick click alone is a person on a phone as\n * often as a scanner). Every verdict names the rule that made it, and the request's user agent and\n * network are stored beside it, so the rules can be revisited against history.\n *\n * Strong, alone enough:\n * - `scanner`: a security gateway or link checker announcing itself (Barracuda, Mimecast,\n * Proofpoint, Safe Links, curl, a headless browser…);\n * - `datacenter` (clicks): the request came from a cloud's or a mail security vendor's network\n * (AWS, Azure, Google Cloud, Proofpoint, Mimecast…), where people do not browse — Microsoft\n * Defender detonates links from Azure, and the person's own click arrives from their own\n * network. Not Cloudflare, Akamai or Fastly: iCloud Private Relay egresses there. Not for\n * opens: Gmail's, Outlook's and Yahoo's image proxies fetch from their own networks when the\n * person opens the message;\n * - `apple_privacy_proxy` (opens): Apple Mail Privacy Protection, which fetches every image on\n * delivery through Apple's proxies with the bare `Mozilla/5.0` user agent, read or not;\n * - `head_request` (clicks): a person's click is a GET;\n * - `link_burst` (clicks): three or more different links of one message within a few seconds, or\n * every link of it — the way a scanner walks a message. Earlier clicks of the burst are\n * reclassified too (see `recordClick`).\n *\n * Weak, machine only together:\n * - `quick`: within `quickMs` of delivery (1 s by default, `email.tracking.quickClickMs`);\n * - `link_pair`: another link of the same message clicked within a few seconds;\n * - `proxy` (clicks): the request came from the network of a vendor whose web proxy a company's\n * staff browse through (Zscaler, Cisco, Forcepoint, Fortinet, Sophos, Symantec/Broadcom, Trend\n * Micro). The vendor's scanner and the employee's browser leave from the same network, so the\n * network alone does not tell them apart: with either other weak signal it is a machine\n * (`proxy+quick`, `proxy+link_pair`), alone it is a person. The cost is the scanner that\n * follows one link, late: it counts as a person.\n *\n * Gmail's image proxy fetches when the person opens the message, so its opens count as human —\n * unless it fetched within `quickMs` of delivery (`gmail_prefetch`).\n */\n\nexport interface Verdict {\n machine: boolean;\n reason: string | null;\n}\n\nexport interface RequestFacts {\n method: string;\n userAgent: string | null;\n /** Cloudflare's `request.cf.asOrganization`: who owns the address the request came from. */\n organization: string | null;\n /** Milliseconds between delivering the message and this request. */\n sinceDeliveredMs: number;\n}\n\nexport interface ClassifyOptions {\n /** A request this soon after delivery is a weak machine signal; 1000 ms by default. */\n quickMs?: number;\n}\n\nexport interface ClickFacts extends RequestFacts {\n /** The different links of the message clicked within `BURST_WINDOW_MS`, this one included. */\n linksInBurst: number;\n /** How many tracked links the message has. */\n linkCount: number;\n}\n\n/** How close together clicks on different links of one message must be to count as one walk. */\nexport const BURST_WINDOW_MS = 5_000;\nexport const DEFAULT_QUICK_MS = 1_000;\n\n// Whole words only: \"San Francisco\" is not Cisco, a CUBOT phone is not a bot\nconst SCANNER =\n /(?<![a-z])(?:(?!cubot)[a-z]*bot|crawler|spider|headlesschrome|phantomjs|barracuda|mimecast|proofpoint|safelinks|symantec|trend ?micro|forcepoint|zscaler|cisco|fortinet|sophos|messagelabs)(?![a-z])|curl\\/|wget\\/|python|go-http-client|java\\/|okhttp/i;\nconst DATACENTER =\n /\\b(?:amazon|aws|microsoft|azure|google cloud|digitalocean|ovh|hetzner|linode|akamai connected cloud|vultr|oracle|alibaba|tencent|proofpoint|mimecast|barracuda)\\b/i;\n// Secure web gateways: an employee's own browser leaves from these networks too\nconst PROXY = /\\b(?:forcepoint|zscaler|cisco|fortinet|sophos|trend ?micro|symantec|broadcom)\\b/i;\nconst GOOGLE_PROXY = /GoogleImageProxy|ggpht\\.com/i;\n\nconst human: Verdict = { machine: false, reason: null };\nconst machine = (reason: string): Verdict => ({ machine: true, reason });\n\nconst scanner = (facts: RequestFacts) => SCANNER.test(facts.userAgent?.trim() ?? '');\n\nexport function classifyOpen(facts: RequestFacts, options: ClassifyOptions = {}): Verdict {\n const quickMs = options.quickMs ?? DEFAULT_QUICK_MS;\n const agent = facts.userAgent?.trim() ?? '';\n if (agent === 'Mozilla/5.0' || /apple/i.test(facts.organization ?? '')) {\n return machine('apple_privacy_proxy');\n }\n if (GOOGLE_PROXY.test(agent)) {\n return facts.sinceDeliveredMs < quickMs ? machine('gmail_prefetch') : human;\n }\n return scanner(facts) ? machine('scanner') : human;\n}\n\nexport function classifyClick(facts: ClickFacts, options: ClassifyOptions = {}): Verdict {\n const quickMs = options.quickMs ?? DEFAULT_QUICK_MS;\n if (facts.method === 'HEAD') return machine('head_request');\n if (scanner(facts)) return machine('scanner');\n if (DATACENTER.test(facts.organization ?? '')) return machine('datacenter');\n if (facts.linksInBurst >= 3 || (facts.linkCount >= 2 && facts.linksInBurst >= facts.linkCount)) {\n return machine('link_burst');\n }\n const quick = facts.sinceDeliveredMs < quickMs;\n const pair = facts.linksInBurst >= 2;\n if (quick && pair) return machine('quick+link_pair');\n if (PROXY.test(facts.organization ?? '')) {\n if (quick) return machine('proxy+quick');\n if (pair) return machine('proxy+link_pair');\n }\n return human;\n}\n"],"mappings":";;AAiEA,MAAa,kBAAkB;AAC/B,MAAa,mBAAmB;AAGhC,MAAM,UACJ;AACF,MAAM,aACJ;AAEF,MAAM,QAAQ;AACd,MAAM,eAAe;AAErB,MAAM,QAAiB;CAAE,SAAS;CAAO,QAAQ;AAAK;AACtD,MAAM,WAAW,YAA6B;CAAE,SAAS;CAAM;AAAO;AAEtE,MAAM,WAAW,UAAwB,QAAQ,KAAK,MAAM,WAAW,KAAK,KAAK,EAAE;AAEnF,SAAgB,aAAa,OAAqB,UAA2B,CAAC,GAAY;CACxF,MAAM,UAAU,QAAQ,WAAA;CACxB,MAAM,QAAQ,MAAM,WAAW,KAAK,KAAK;CACzC,IAAI,UAAU,iBAAiB,SAAS,KAAK,MAAM,gBAAgB,EAAE,GACnE,OAAO,QAAQ,qBAAqB;CAEtC,IAAI,aAAa,KAAK,KAAK,GACzB,OAAO,MAAM,mBAAmB,UAAU,QAAQ,gBAAgB,IAAI;CAExE,OAAO,QAAQ,KAAK,IAAI,QAAQ,SAAS,IAAI;AAC/C;AAEA,SAAgB,cAAc,OAAmB,UAA2B,CAAC,GAAY;CACvF,MAAM,UAAU,QAAQ,WAAA;CACxB,IAAI,MAAM,WAAW,QAAQ,OAAO,QAAQ,cAAc;CAC1D,IAAI,QAAQ,KAAK,GAAG,OAAO,QAAQ,SAAS;CAC5C,IAAI,WAAW,KAAK,MAAM,gBAAgB,EAAE,GAAG,OAAO,QAAQ,YAAY;CAC1E,IAAI,MAAM,gBAAgB,KAAM,MAAM,aAAa,KAAK,MAAM,gBAAgB,MAAM,WAClF,OAAO,QAAQ,YAAY;CAE7B,MAAM,QAAQ,MAAM,mBAAmB;CACvC,MAAM,OAAO,MAAM,gBAAgB;CACnC,IAAI,SAAS,MAAM,OAAO,QAAQ,iBAAiB;CACnD,IAAI,MAAM,KAAK,MAAM,gBAAgB,EAAE,GAAG;EACxC,IAAI,OAAO,OAAO,QAAQ,aAAa;EACvC,IAAI,MAAM,OAAO,QAAQ,iBAAiB;CAC5C;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
// src/reporting/observer.ts
|
|
3
|
+
/**
|
|
4
|
+
* The observer journeyWorker installs when the store keeps reporting: every node arrival, copy
|
|
5
|
+
* and outcome recorded through `store.reporting`.
|
|
6
|
+
*
|
|
7
|
+
* A copy is recorded before it goes out, so its id can travel with it: with a tracking origin,
|
|
8
|
+
* an email's links become `<origin>/t/l/<message>/<position>` — `/t/u/...` for its unsubscribe
|
|
9
|
+
* link, so what a click means is fixed when it is sent — and an open pixel `<origin>/t/o/<message>`
|
|
10
|
+
* (served by the Worker, ./tracking.ts); the renderer gets the id too, for the email's
|
|
11
|
+
* preferences link (`email.preferencesUrl?m=<message>`), and a push carries
|
|
12
|
+
* `message_id` in its payload for the app to report the tap (`JourneyClient.messageOpened`),
|
|
13
|
+
* plus `delivered_url` / `opened_url` for a client that reports straight to the Worker.
|
|
14
|
+
* The links are recorded when the sender commits the rewritten email, before it goes out.
|
|
15
|
+
*/
|
|
16
|
+
function reportingObserver(reporting, origin) {
|
|
17
|
+
const base = origin?.replace(/\/$/, "");
|
|
18
|
+
return {
|
|
19
|
+
started: (event) => reporting.instanceStarted(event),
|
|
20
|
+
nodeReached: (event) => reporting.nodeReached(event),
|
|
21
|
+
messageSettled: (message) => reporting.messageSettled(message.idempotencyKey),
|
|
22
|
+
messageClaimed: (message) => reporting.claimMessage(message.idempotencyKey, Date.now()),
|
|
23
|
+
messageReleased: (message) => reporting.releaseMessage(message.idempotencyKey),
|
|
24
|
+
async messagePrepared(message) {
|
|
25
|
+
const id = await reporting.recordMessage({
|
|
26
|
+
idempotencyKey: message.idempotencyKey,
|
|
27
|
+
workflow: message.workflow,
|
|
28
|
+
instanceId: message.instanceId,
|
|
29
|
+
nodeId: message.nodeId,
|
|
30
|
+
template: message.template,
|
|
31
|
+
channel: channelOf(message),
|
|
32
|
+
userId: message.userId,
|
|
33
|
+
topic: message.channel === "email" || message.channel === "push" ? message.topic ?? null : null,
|
|
34
|
+
sentAt: Date.now()
|
|
35
|
+
});
|
|
36
|
+
if (message.channel === "email" && base !== void 0) {
|
|
37
|
+
const links = [];
|
|
38
|
+
return {
|
|
39
|
+
messageId: id,
|
|
40
|
+
link: (url, purpose) => {
|
|
41
|
+
links.push({
|
|
42
|
+
url,
|
|
43
|
+
purpose
|
|
44
|
+
});
|
|
45
|
+
return `${base}/t/${purpose === "unsubscribe" ? "u" : "l"}/${id}/${links.length - 1}`;
|
|
46
|
+
},
|
|
47
|
+
pixel: `${base}/t/o/${id}`,
|
|
48
|
+
unsubscribe: `${base}/t/u/${id}`,
|
|
49
|
+
commit: () => reporting.recordLinks(id, links)
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (message.channel === "push") return { data: {
|
|
53
|
+
message_id: id,
|
|
54
|
+
...base === void 0 ? {} : {
|
|
55
|
+
delivered_url: `${base}/t/d/${id}`,
|
|
56
|
+
opened_url: `${base}/t/p/${id}`
|
|
57
|
+
}
|
|
58
|
+
} };
|
|
59
|
+
},
|
|
60
|
+
async messageSent(message, result) {
|
|
61
|
+
await reporting.settleMessage(message.idempotencyKey, result, Date.now());
|
|
62
|
+
},
|
|
63
|
+
finished: (event) => reporting.instanceFinished(event)
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Where the copy lands — the Studio's metric channel: a push is reported per platform. */
|
|
67
|
+
function channelOf(message) {
|
|
68
|
+
if (message.channel !== "push") return message.channel;
|
|
69
|
+
return `push_${message.device?.platform ?? "unknown"}`;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Whether the observer keeps the delivery record itself: it implements one of the three hooks
|
|
73
|
+
* that decide if a copy reaches the transport (see `JourneyObserver`).
|
|
74
|
+
*/
|
|
75
|
+
function decidesDelivery(observer) {
|
|
76
|
+
return observer.messageSettled !== void 0 || observer.messageClaimed !== void 0 || observer.messageReleased !== void 0;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `extra`'s hooks added to `base`'s: every report reaches both, `base` first. `base` keeps the
|
|
80
|
+
* delivery record — at-most-once delivery is its claim, which a host adding a hook of its own
|
|
81
|
+
* must not lose — so `extra` is one that does not decide delivery (`decidesDelivery`). The
|
|
82
|
+
* tracking `extra` prepares is laid over `base`'s: its fields win, the push `data` of both is
|
|
83
|
+
* sent, and both commits run before the transport takes the copy.
|
|
84
|
+
*/
|
|
85
|
+
function composeObservers(base, extra) {
|
|
86
|
+
return {
|
|
87
|
+
async started(event) {
|
|
88
|
+
await base.started?.(event);
|
|
89
|
+
await extra.started?.(event);
|
|
90
|
+
},
|
|
91
|
+
async nodeReached(event) {
|
|
92
|
+
await base.nodeReached?.(event);
|
|
93
|
+
await extra.nodeReached?.(event);
|
|
94
|
+
},
|
|
95
|
+
messageSettled: async (message) => await base.messageSettled?.(message) ?? false,
|
|
96
|
+
async messagePrepared(message) {
|
|
97
|
+
return mergeTracking(await base.messagePrepared?.(message), await extra.messagePrepared?.(message));
|
|
98
|
+
},
|
|
99
|
+
messageClaimed: async (message) => await base.messageClaimed?.(message) ?? true,
|
|
100
|
+
messageReleased: async (message) => base.messageReleased?.(message),
|
|
101
|
+
async messageSent(message, result) {
|
|
102
|
+
await base.messageSent?.(message, result);
|
|
103
|
+
await extra.messageSent?.(message, result);
|
|
104
|
+
},
|
|
105
|
+
async finished(event) {
|
|
106
|
+
await base.finished?.(event);
|
|
107
|
+
await extra.finished?.(event);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function mergeTracking(base, extra) {
|
|
112
|
+
if (base === void 0 || extra === void 0) return base ?? extra;
|
|
113
|
+
const merged = { ...base };
|
|
114
|
+
for (const key of [
|
|
115
|
+
"messageId",
|
|
116
|
+
"link",
|
|
117
|
+
"pixel",
|
|
118
|
+
"unsubscribe"
|
|
119
|
+
]) if (extra[key] !== void 0) Object.assign(merged, { [key]: extra[key] });
|
|
120
|
+
if (extra.data !== void 0) merged.data = {
|
|
121
|
+
...base.data,
|
|
122
|
+
...extra.data
|
|
123
|
+
};
|
|
124
|
+
const first = base.commit;
|
|
125
|
+
const second = extra.commit;
|
|
126
|
+
if (first !== void 0 && second !== void 0) merged.commit = async () => {
|
|
127
|
+
await first();
|
|
128
|
+
await second();
|
|
129
|
+
};
|
|
130
|
+
else if (second !== void 0) merged.commit = second;
|
|
131
|
+
return merged;
|
|
132
|
+
}
|
|
133
|
+
exports.composeObservers = composeObservers;
|
|
134
|
+
exports.decidesDelivery = decidesDelivery;
|
|
135
|
+
exports.reportingObserver = reportingObserver;
|
|
136
|
+
|
|
137
|
+
//# sourceMappingURL=observer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer.cjs","names":[],"sources":["../../src/reporting/observer.ts"],"sourcesContent":["import type { JourneyObserver, MessageTracking, OutboundMessage } from '../engine';\nimport type { JourneyReporting, TrackedLink } from '../store';\n\n/**\n * The observer journeyWorker installs when the store keeps reporting: every node arrival, copy\n * and outcome recorded through `store.reporting`.\n *\n * A copy is recorded before it goes out, so its id can travel with it: with a tracking origin,\n * an email's links become `<origin>/t/l/<message>/<position>` — `/t/u/...` for its unsubscribe\n * link, so what a click means is fixed when it is sent — and an open pixel `<origin>/t/o/<message>`\n * (served by the Worker, ./tracking.ts); the renderer gets the id too, for the email's\n * preferences link (`email.preferencesUrl?m=<message>`), and a push carries\n * `message_id` in its payload for the app to report the tap (`JourneyClient.messageOpened`),\n * plus `delivered_url` / `opened_url` for a client that reports straight to the Worker.\n * The links are recorded when the sender commits the rewritten email, before it goes out.\n */\nexport function reportingObserver(\n reporting: JourneyReporting,\n origin: string | undefined\n): JourneyObserver {\n const base = origin?.replace(/\\/$/, '');\n\n return {\n started: (event) => reporting.instanceStarted(event),\n\n nodeReached: (event) => reporting.nodeReached(event),\n\n messageSettled: (message) => reporting.messageSettled(message.idempotencyKey),\n\n messageClaimed: (message) => reporting.claimMessage(message.idempotencyKey, Date.now()),\n\n messageReleased: (message) => reporting.releaseMessage(message.idempotencyKey),\n\n async messagePrepared(message) {\n const id = await reporting.recordMessage({\n idempotencyKey: message.idempotencyKey,\n workflow: message.workflow,\n instanceId: message.instanceId,\n nodeId: message.nodeId,\n template: message.template,\n channel: channelOf(message),\n userId: message.userId,\n topic:\n message.channel === 'email' || message.channel === 'push'\n ? (message.topic ?? null)\n : null,\n sentAt: Date.now(),\n });\n if (message.channel === 'email' && base !== undefined) {\n const links: TrackedLink[] = [];\n return {\n messageId: id,\n link: (url, purpose) => {\n links.push({ url, purpose });\n return `${base}/t/${purpose === 'unsubscribe' ? 'u' : 'l'}/${id}/${links.length - 1}`;\n },\n pixel: `${base}/t/o/${id}`,\n unsubscribe: `${base}/t/u/${id}`,\n // Before the transport takes it, so no click can reach a link not yet recorded\n commit: () => reporting.recordLinks(id, links),\n };\n }\n if (message.channel === 'push') {\n // The app reports the tap with `message_id`; a client that can reach the Worker on its\n // own (iOS's notification service extension, a browser's service worker) posts to these\n return {\n data: {\n message_id: id,\n ...(base === undefined\n ? {}\n : { delivered_url: `${base}/t/d/${id}`, opened_url: `${base}/t/p/${id}` }),\n },\n };\n }\n return undefined;\n },\n\n async messageSent(message, result) {\n await reporting.settleMessage(message.idempotencyKey, result, Date.now());\n },\n\n finished: (event) => reporting.instanceFinished(event),\n };\n}\n\n/** Where the copy lands — the Studio's metric channel: a push is reported per platform. */\nfunction channelOf(message: OutboundMessage): string {\n if (message.channel !== 'push') return message.channel;\n return `push_${message.device?.platform ?? 'unknown'}`;\n}\n\n/**\n * Whether the observer keeps the delivery record itself: it implements one of the three hooks\n * that decide if a copy reaches the transport (see `JourneyObserver`).\n */\nexport function decidesDelivery(observer: JourneyObserver): boolean {\n return (\n observer.messageSettled !== undefined ||\n observer.messageClaimed !== undefined ||\n observer.messageReleased !== undefined\n );\n}\n\n/**\n * `extra`'s hooks added to `base`'s: every report reaches both, `base` first. `base` keeps the\n * delivery record — at-most-once delivery is its claim, which a host adding a hook of its own\n * must not lose — so `extra` is one that does not decide delivery (`decidesDelivery`). The\n * tracking `extra` prepares is laid over `base`'s: its fields win, the push `data` of both is\n * sent, and both commits run before the transport takes the copy.\n */\nexport function composeObservers(base: JourneyObserver, extra: JourneyObserver): JourneyObserver {\n return {\n async started(event) {\n await base.started?.(event);\n await extra.started?.(event);\n },\n async nodeReached(event) {\n await base.nodeReached?.(event);\n await extra.nodeReached?.(event);\n },\n messageSettled: async (message) => (await base.messageSettled?.(message)) ?? false,\n async messagePrepared(message) {\n const prepared = await base.messagePrepared?.(message);\n return mergeTracking(prepared, await extra.messagePrepared?.(message));\n },\n messageClaimed: async (message) => (await base.messageClaimed?.(message)) ?? true,\n messageReleased: async (message) => base.messageReleased?.(message),\n async messageSent(message, result) {\n // The settle first: a report of the host's own that throws must not leave the copy claimed\n // and unsettled, which a replay reads as possibly delivered\n await base.messageSent?.(message, result);\n await extra.messageSent?.(message, result);\n },\n async finished(event) {\n await base.finished?.(event);\n await extra.finished?.(event);\n },\n };\n}\n\nfunction mergeTracking(\n base: MessageTracking | undefined,\n extra: MessageTracking | undefined\n): MessageTracking | undefined {\n if (base === undefined || extra === undefined) return base ?? extra;\n const merged: MessageTracking = { ...base };\n for (const key of ['messageId', 'link', 'pixel', 'unsubscribe'] as const) {\n if (extra[key] !== undefined) Object.assign(merged, { [key]: extra[key] });\n }\n if (extra.data !== undefined) merged.data = { ...base.data, ...extra.data };\n const first = base.commit;\n const second = extra.commit;\n if (first !== undefined && second !== undefined) {\n merged.commit = async () => {\n await first();\n await second();\n };\n } else if (second !== undefined) {\n merged.commit = second;\n }\n return merged;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,SAAgB,kBACd,WACA,QACiB;CACjB,MAAM,OAAO,QAAQ,QAAQ,OAAO,EAAE;CAEtC,OAAO;EACL,UAAU,UAAU,UAAU,gBAAgB,KAAK;EAEnD,cAAc,UAAU,UAAU,YAAY,KAAK;EAEnD,iBAAiB,YAAY,UAAU,eAAe,QAAQ,cAAc;EAE5E,iBAAiB,YAAY,UAAU,aAAa,QAAQ,gBAAgB,KAAK,IAAI,CAAC;EAEtF,kBAAkB,YAAY,UAAU,eAAe,QAAQ,cAAc;EAE7E,MAAM,gBAAgB,SAAS;GAC7B,MAAM,KAAK,MAAM,UAAU,cAAc;IACvC,gBAAgB,QAAQ;IACxB,UAAU,QAAQ;IAClB,YAAY,QAAQ;IACpB,QAAQ,QAAQ;IAChB,UAAU,QAAQ;IAClB,SAAS,UAAU,OAAO;IAC1B,QAAQ,QAAQ;IAChB,OACE,QAAQ,YAAY,WAAW,QAAQ,YAAY,SAC9C,QAAQ,SAAS,OAClB;IACN,QAAQ,KAAK,IAAI;GACnB,CAAC;GACD,IAAI,QAAQ,YAAY,WAAW,SAAS,KAAA,GAAW;IACrD,MAAM,QAAuB,CAAC;IAC9B,OAAO;KACL,WAAW;KACX,OAAO,KAAK,YAAY;MACtB,MAAM,KAAK;OAAE;OAAK;MAAQ,CAAC;MAC3B,OAAO,GAAG,KAAK,KAAK,YAAY,gBAAgB,MAAM,IAAI,GAAG,GAAG,GAAG,MAAM,SAAS;KACpF;KACA,OAAO,GAAG,KAAK,OAAO;KACtB,aAAa,GAAG,KAAK,OAAO;KAE5B,cAAc,UAAU,YAAY,IAAI,KAAK;IAC/C;GACF;GACA,IAAI,QAAQ,YAAY,QAGtB,OAAO,EACL,MAAM;IACJ,YAAY;IACZ,GAAI,SAAS,KAAA,IACT,CAAC,IACD;KAAE,eAAe,GAAG,KAAK,OAAO;KAAM,YAAY,GAAG,KAAK,OAAO;IAAK;GAC5E,EACF;EAGJ;EAEA,MAAM,YAAY,SAAS,QAAQ;GACjC,MAAM,UAAU,cAAc,QAAQ,gBAAgB,QAAQ,KAAK,IAAI,CAAC;EAC1E;EAEA,WAAW,UAAU,UAAU,iBAAiB,KAAK;CACvD;AACF;;AAGA,SAAS,UAAU,SAAkC;CACnD,IAAI,QAAQ,YAAY,QAAQ,OAAO,QAAQ;CAC/C,OAAO,QAAQ,QAAQ,QAAQ,YAAY;AAC7C;;;;;AAMA,SAAgB,gBAAgB,UAAoC;CAClE,OACE,SAAS,mBAAmB,KAAA,KAC5B,SAAS,mBAAmB,KAAA,KAC5B,SAAS,oBAAoB,KAAA;AAEjC;;;;;;;;AASA,SAAgB,iBAAiB,MAAuB,OAAyC;CAC/F,OAAO;EACL,MAAM,QAAQ,OAAO;GACnB,MAAM,KAAK,UAAU,KAAK;GAC1B,MAAM,MAAM,UAAU,KAAK;EAC7B;EACA,MAAM,YAAY,OAAO;GACvB,MAAM,KAAK,cAAc,KAAK;GAC9B,MAAM,MAAM,cAAc,KAAK;EACjC;EACA,gBAAgB,OAAO,YAAa,MAAM,KAAK,iBAAiB,OAAO,KAAM;EAC7E,MAAM,gBAAgB,SAAS;GAE7B,OAAO,cAAc,MADE,KAAK,kBAAkB,OAAO,GACtB,MAAM,MAAM,kBAAkB,OAAO,CAAC;EACvE;EACA,gBAAgB,OAAO,YAAa,MAAM,KAAK,iBAAiB,OAAO,KAAM;EAC7E,iBAAiB,OAAO,YAAY,KAAK,kBAAkB,OAAO;EAClE,MAAM,YAAY,SAAS,QAAQ;GAGjC,MAAM,KAAK,cAAc,SAAS,MAAM;GACxC,MAAM,MAAM,cAAc,SAAS,MAAM;EAC3C;EACA,MAAM,SAAS,OAAO;GACpB,MAAM,KAAK,WAAW,KAAK;GAC3B,MAAM,MAAM,WAAW,KAAK;EAC9B;CACF;AACF;AAEA,SAAS,cACP,MACA,OAC6B;CAC7B,IAAI,SAAS,KAAA,KAAa,UAAU,KAAA,GAAW,OAAO,QAAQ;CAC9D,MAAM,SAA0B,EAAE,GAAG,KAAK;CAC1C,KAAK,MAAM,OAAO;EAAC;EAAa;EAAQ;EAAS;CAAa,GAC5D,IAAI,MAAM,SAAS,KAAA,GAAW,OAAO,OAAO,QAAQ,GAAG,MAAM,MAAM,KAAK,CAAC;CAE3E,IAAI,MAAM,SAAS,KAAA,GAAW,OAAO,OAAO;EAAE,GAAG,KAAK;EAAM,GAAG,MAAM;CAAK;CAC1E,MAAM,QAAQ,KAAK;CACnB,MAAM,SAAS,MAAM;CACrB,IAAI,UAAU,KAAA,KAAa,WAAW,KAAA,GACpC,OAAO,SAAS,YAAY;EAC1B,MAAM,MAAM;EACZ,MAAM,OAAO;CACf;MACK,IAAI,WAAW,KAAA,GACpB,OAAO,SAAS;CAElB,OAAO;AACT"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { JourneyObserver } from "../engine/ports.cjs";
|
|
2
|
+
import "../engine/index.cjs";
|
|
3
|
+
import { JourneyReporting } from "../store/index.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* The observer journeyWorker installs when the store keeps reporting: every node arrival, copy
|
|
6
|
+
* and outcome recorded through `store.reporting`.
|
|
7
|
+
*
|
|
8
|
+
* A copy is recorded before it goes out, so its id can travel with it: with a tracking origin,
|
|
9
|
+
* an email's links become `<origin>/t/l/<message>/<position>` — `/t/u/...` for its unsubscribe
|
|
10
|
+
* link, so what a click means is fixed when it is sent — and an open pixel `<origin>/t/o/<message>`
|
|
11
|
+
* (served by the Worker, ./tracking.ts); the renderer gets the id too, for the email's
|
|
12
|
+
* preferences link (`email.preferencesUrl?m=<message>`), and a push carries
|
|
13
|
+
* `message_id` in its payload for the app to report the tap (`JourneyClient.messageOpened`),
|
|
14
|
+
* plus `delivered_url` / `opened_url` for a client that reports straight to the Worker.
|
|
15
|
+
* The links are recorded when the sender commits the rewritten email, before it goes out.
|
|
16
|
+
*/
|
|
17
|
+
export declare function reportingObserver(reporting: JourneyReporting, origin: string | undefined): JourneyObserver;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the observer keeps the delivery record itself: it implements one of the three hooks
|
|
20
|
+
* that decide if a copy reaches the transport (see `JourneyObserver`).
|
|
21
|
+
*/
|
|
22
|
+
export declare function decidesDelivery(observer: JourneyObserver): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* `extra`'s hooks added to `base`'s: every report reaches both, `base` first. `base` keeps the
|
|
25
|
+
* delivery record — at-most-once delivery is its claim, which a host adding a hook of its own
|
|
26
|
+
* must not lose — so `extra` is one that does not decide delivery (`decidesDelivery`). The
|
|
27
|
+
* tracking `extra` prepares is laid over `base`'s: its fields win, the push `data` of both is
|
|
28
|
+
* sent, and both commits run before the transport takes the copy.
|
|
29
|
+
*/
|
|
30
|
+
export declare function composeObservers(base: JourneyObserver, extra: JourneyObserver): JourneyObserver;
|
|
31
|
+
//# sourceMappingURL=observer.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer.d.cts","names":[],"sources":["../../src/reporting/observer.ts"],"mappings":";;;;;;;;;;;;;;;;wBAgBgB,kBACd,WAAW,kBACX,6BACC;;;;;wBA4Ea,gBAAgB,UAAU;;;;;;;;wBAe1B,iBAAiB,MAAM,iBAAiB,OAAO,kBAAkB"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { JourneyObserver } from "../engine/ports.mjs";
|
|
2
|
+
import "../engine/index.mjs";
|
|
3
|
+
import { JourneyReporting } from "../store/index.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* The observer journeyWorker installs when the store keeps reporting: every node arrival, copy
|
|
6
|
+
* and outcome recorded through `store.reporting`.
|
|
7
|
+
*
|
|
8
|
+
* A copy is recorded before it goes out, so its id can travel with it: with a tracking origin,
|
|
9
|
+
* an email's links become `<origin>/t/l/<message>/<position>` — `/t/u/...` for its unsubscribe
|
|
10
|
+
* link, so what a click means is fixed when it is sent — and an open pixel `<origin>/t/o/<message>`
|
|
11
|
+
* (served by the Worker, ./tracking.ts); the renderer gets the id too, for the email's
|
|
12
|
+
* preferences link (`email.preferencesUrl?m=<message>`), and a push carries
|
|
13
|
+
* `message_id` in its payload for the app to report the tap (`JourneyClient.messageOpened`),
|
|
14
|
+
* plus `delivered_url` / `opened_url` for a client that reports straight to the Worker.
|
|
15
|
+
* The links are recorded when the sender commits the rewritten email, before it goes out.
|
|
16
|
+
*/
|
|
17
|
+
export declare function reportingObserver(reporting: JourneyReporting, origin: string | undefined): JourneyObserver;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the observer keeps the delivery record itself: it implements one of the three hooks
|
|
20
|
+
* that decide if a copy reaches the transport (see `JourneyObserver`).
|
|
21
|
+
*/
|
|
22
|
+
export declare function decidesDelivery(observer: JourneyObserver): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* `extra`'s hooks added to `base`'s: every report reaches both, `base` first. `base` keeps the
|
|
25
|
+
* delivery record — at-most-once delivery is its claim, which a host adding a hook of its own
|
|
26
|
+
* must not lose — so `extra` is one that does not decide delivery (`decidesDelivery`). The
|
|
27
|
+
* tracking `extra` prepares is laid over `base`'s: its fields win, the push `data` of both is
|
|
28
|
+
* sent, and both commits run before the transport takes the copy.
|
|
29
|
+
*/
|
|
30
|
+
export declare function composeObservers(base: JourneyObserver, extra: JourneyObserver): JourneyObserver;
|
|
31
|
+
//# sourceMappingURL=observer.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer.d.mts","names":[],"sources":["../../src/reporting/observer.ts"],"mappings":";;;;;;;;;;;;;;;;wBAgBgB,kBACd,WAAW,kBACX,6BACC;;;;;wBA4Ea,gBAAgB,UAAU;;;;;;;;wBAe1B,iBAAiB,MAAM,iBAAiB,OAAO,kBAAkB"}
|