@hogsend/engine 0.67.0 → 0.68.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/README.md +3 -2
- package/dist/account-links/__fixtures__/fake-fetch.d.ts +38 -0
- package/dist/account-links/__fixtures__/fake-fetch.d.ts.map +1 -0
- package/dist/account-links/battlenet.d.ts +36 -0
- package/dist/account-links/battlenet.d.ts.map +1 -0
- package/dist/account-links/epic.d.ts +36 -0
- package/dist/account-links/epic.d.ts.map +1 -0
- package/dist/account-links/index.d.ts +7 -0
- package/dist/account-links/index.d.ts.map +1 -0
- package/dist/account-links/riot.d.ts +35 -0
- package/dist/account-links/riot.d.ts.map +1 -0
- package/dist/account-links/steam.d.ts +35 -0
- package/dist/account-links/steam.d.ts.map +1 -0
- package/dist/account-links/twitch.d.ts +38 -0
- package/dist/account-links/twitch.d.ts.map +1 -0
- package/dist/account-links/xbox.d.ts +39 -0
- package/dist/account-links/xbox.d.ts.map +1 -0
- package/dist/app.d.ts +50 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/buckets/bucket-access.d.ts +60 -0
- package/dist/buckets/bucket-access.d.ts.map +1 -0
- package/dist/buckets/bucket-reactions.d.ts +100 -0
- package/dist/buckets/bucket-reactions.d.ts.map +1 -0
- package/dist/buckets/check-membership.d.ts +105 -0
- package/dist/buckets/check-membership.d.ts.map +1 -0
- package/dist/buckets/define-bucket.d.ts +53 -0
- package/dist/buckets/define-bucket.d.ts.map +1 -0
- package/dist/buckets/membership-epoch.d.ts +74 -0
- package/dist/buckets/membership-epoch.d.ts.map +1 -0
- package/dist/buckets/registry-singleton.d.ts +6 -0
- package/dist/buckets/registry-singleton.d.ts.map +1 -0
- package/dist/buckets/registry.d.ts +59 -0
- package/dist/buckets/registry.d.ts.map +1 -0
- package/dist/campaigns/cohort-sql.d.ts +54 -0
- package/dist/campaigns/cohort-sql.d.ts.map +1 -0
- package/dist/campaigns/define-campaign.d.ts +105 -0
- package/dist/campaigns/define-campaign.d.ts.map +1 -0
- package/dist/campaigns/reconcile.d.ts +13 -0
- package/dist/campaigns/reconcile.d.ts.map +1 -0
- package/dist/campaigns/steps.d.ts +29 -0
- package/dist/campaigns/steps.d.ts.map +1 -0
- package/dist/cold-connect/index.d.ts +98 -0
- package/dist/cold-connect/index.d.ts.map +1 -0
- package/dist/cold-connect/page.d.ts +69 -0
- package/dist/cold-connect/page.d.ts.map +1 -0
- package/dist/cold-connect/throttle.d.ts +39 -0
- package/dist/cold-connect/throttle.d.ts.map +1 -0
- package/dist/cold-connect/token.d.ts +57 -0
- package/dist/cold-connect/token.d.ts.map +1 -0
- package/dist/connectors/action-registry-singleton.d.ts +21 -0
- package/dist/connectors/action-registry-singleton.d.ts.map +1 -0
- package/dist/connectors/define-action.d.ts +117 -0
- package/dist/connectors/define-action.d.ts.map +1 -0
- package/dist/connectors/define-connector.d.ts +172 -0
- package/dist/connectors/define-connector.d.ts.map +1 -0
- package/dist/connectors/presets/index.d.ts +17 -0
- package/dist/connectors/presets/index.d.ts.map +1 -0
- package/dist/connectors/registry-singleton.d.ts +34 -0
- package/dist/connectors/registry-singleton.d.ts.map +1 -0
- package/dist/connectors/runtime.d.ts +68 -0
- package/dist/connectors/runtime.d.ts.map +1 -0
- package/dist/container.d.ts +678 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/destinations/define-destination.d.ts +96 -0
- package/dist/destinations/define-destination.d.ts.map +1 -0
- package/dist/destinations/presets/index.d.ts +42 -0
- package/dist/destinations/presets/index.d.ts.map +1 -0
- package/dist/destinations/presets/posthog.d.ts +12 -0
- package/dist/destinations/presets/posthog.d.ts.map +1 -0
- package/dist/destinations/presets/segment.d.ts +15 -0
- package/dist/destinations/presets/segment.d.ts.map +1 -0
- package/dist/destinations/presets/slack.d.ts +10 -0
- package/dist/destinations/presets/slack.d.ts.map +1 -0
- package/dist/destinations/presets/webhook.d.ts +14 -0
- package/dist/destinations/presets/webhook.d.ts.map +1 -0
- package/dist/destinations/registry-singleton.d.ts +44 -0
- package/dist/destinations/registry-singleton.d.ts.map +1 -0
- package/dist/env.d.ts +119 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/flags/reconcile.d.ts +36 -0
- package/dist/flags/reconcile.d.ts.map +1 -0
- package/dist/index.d.ts +210 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/journeys/authoring.d.ts +15 -0
- package/dist/journeys/authoring.d.ts.map +1 -0
- package/dist/journeys/client-defaults-singleton.d.ts +16 -0
- package/dist/journeys/client-defaults-singleton.d.ts.map +1 -0
- package/dist/journeys/constants.d.ts +32 -0
- package/dist/journeys/constants.d.ts.map +1 -0
- package/dist/journeys/define-journey.d.ts +33 -0
- package/dist/journeys/define-journey.d.ts.map +1 -0
- package/dist/journeys/durable-law-harness.d.ts +74 -0
- package/dist/journeys/durable-law-harness.d.ts.map +1 -0
- package/dist/journeys/errors.d.ts +13 -0
- package/dist/journeys/errors.d.ts.map +1 -0
- package/dist/journeys/execute-journey-run.d.ts +160 -0
- package/dist/journeys/execute-journey-run.d.ts.map +1 -0
- package/dist/journeys/graph/build-graph.d.ts +24 -0
- package/dist/journeys/graph/build-graph.d.ts.map +1 -0
- package/dist/journeys/group-scope.d.ts +56 -0
- package/dist/journeys/group-scope.d.ts.map +1 -0
- package/dist/journeys/journey-boundary.d.ts +264 -0
- package/dist/journeys/journey-boundary.d.ts.map +1 -0
- package/dist/journeys/journey-context.d.ts +60 -0
- package/dist/journeys/journey-context.d.ts.map +1 -0
- package/dist/journeys/journey-log.d.ts +42 -0
- package/dist/journeys/journey-log.d.ts.map +1 -0
- package/dist/journeys/journey-source-locations-singleton.d.ts +6 -0
- package/dist/journeys/journey-source-locations-singleton.d.ts.map +1 -0
- package/dist/journeys/journey-sources-singleton.d.ts +5 -0
- package/dist/journeys/journey-sources-singleton.d.ts.map +1 -0
- package/dist/journeys/journey-task-factory.d.ts +11 -0
- package/dist/journeys/journey-task-factory.d.ts.map +1 -0
- package/dist/journeys/journey-task-runtime.d.ts +2 -0
- package/dist/journeys/journey-task-runtime.d.ts.map +1 -0
- package/dist/journeys/journey-version.d.ts +71 -0
- package/dist/journeys/journey-version.d.ts.map +1 -0
- package/dist/journeys/record-once.d.ts +56 -0
- package/dist/journeys/record-once.d.ts.map +1 -0
- package/dist/journeys/registry-singleton.d.ts +6 -0
- package/dist/journeys/registry-singleton.d.ts.map +1 -0
- package/dist/journeys/registry.d.ts +59 -0
- package/dist/journeys/registry.d.ts.map +1 -0
- package/dist/journeys/with-durable-gate.d.ts +97 -0
- package/dist/journeys/with-durable-gate.d.ts.map +1 -0
- package/dist/lib/account-link-emit.d.ts +69 -0
- package/dist/lib/account-link-emit.d.ts.map +1 -0
- package/dist/lib/account-link-events.d.ts +128 -0
- package/dist/lib/account-link-events.d.ts.map +1 -0
- package/dist/lib/account-link-hooks.d.ts +32 -0
- package/dist/lib/account-link-hooks.d.ts.map +1 -0
- package/dist/lib/account-link-ingest.d.ts +78 -0
- package/dist/lib/account-link-ingest.d.ts.map +1 -0
- package/dist/lib/account-link-nonce.d.ts +29 -0
- package/dist/lib/account-link-nonce.d.ts.map +1 -0
- package/dist/lib/account-link-origins.d.ts +37 -0
- package/dist/lib/account-link-origins.d.ts.map +1 -0
- package/dist/lib/account-link-pkce.d.ts +48 -0
- package/dist/lib/account-link-pkce.d.ts.map +1 -0
- package/dist/lib/account-link-provider-registry.d.ts +35 -0
- package/dist/lib/account-link-provider-registry.d.ts.map +1 -0
- package/dist/lib/account-link-throttle.d.ts +76 -0
- package/dist/lib/account-link-throttle.d.ts.map +1 -0
- package/dist/lib/account-link-url.d.ts +41 -0
- package/dist/lib/account-link-url.d.ts.map +1 -0
- package/dist/lib/account-links-from-env.d.ts +62 -0
- package/dist/lib/account-links-from-env.d.ts.map +1 -0
- package/dist/lib/account-links.d.ts +353 -0
- package/dist/lib/account-links.d.ts.map +1 -0
- package/dist/lib/agent/config.d.ts +14 -0
- package/dist/lib/agent/config.d.ts.map +1 -0
- package/dist/lib/agent/proposals.d.ts +52 -0
- package/dist/lib/agent/proposals.d.ts.map +1 -0
- package/dist/lib/agent/provider.d.ts +9 -0
- package/dist/lib/agent/provider.d.ts.map +1 -0
- package/dist/lib/agent/risk.d.ts +24 -0
- package/dist/lib/agent/risk.d.ts.map +1 -0
- package/dist/lib/agent/system-prompt.d.ts +8 -0
- package/dist/lib/agent/system-prompt.d.ts.map +1 -0
- package/dist/lib/agent/tools.d.ts +258 -0
- package/dist/lib/agent/tools.d.ts.map +1 -0
- package/dist/lib/alerting.d.ts +7 -0
- package/dist/lib/alerting.d.ts.map +1 -0
- package/dist/lib/analytics-adapter.d.ts +24 -0
- package/dist/lib/analytics-adapter.d.ts.map +1 -0
- package/dist/lib/analytics-identity.d.ts +60 -0
- package/dist/lib/analytics-identity.d.ts.map +1 -0
- package/dist/lib/analytics-provider-registry.d.ts +20 -0
- package/dist/lib/analytics-provider-registry.d.ts.map +1 -0
- package/dist/lib/analytics-providers-from-env.d.ts +41 -0
- package/dist/lib/analytics-providers-from-env.d.ts.map +1 -0
- package/dist/lib/analytics-singleton.d.ts +10 -0
- package/dist/lib/analytics-singleton.d.ts.map +1 -0
- package/dist/lib/api-key-hash.d.ts +9 -0
- package/dist/lib/api-key-hash.d.ts.map +1 -0
- package/dist/lib/app-secret.d.ts +29 -0
- package/dist/lib/app-secret.d.ts.map +1 -0
- package/dist/lib/attachments.d.ts +53 -0
- package/dist/lib/attachments.d.ts.map +1 -0
- package/dist/lib/attribution-backfill.d.ts +48 -0
- package/dist/lib/attribution-backfill.d.ts.map +1 -0
- package/dist/lib/attribution.d.ts +44 -0
- package/dist/lib/attribution.d.ts.map +1 -0
- package/dist/lib/auth.d.ts +136 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/backfill.d.ts +41 -0
- package/dist/lib/backfill.d.ts.map +1 -0
- package/dist/lib/banner.d.ts +52 -0
- package/dist/lib/banner.d.ts.map +1 -0
- package/dist/lib/blueprint-lock.d.ts +19 -0
- package/dist/lib/blueprint-lock.d.ts.map +1 -0
- package/dist/lib/blueprints.d.ts +573 -0
- package/dist/lib/blueprints.d.ts.map +1 -0
- package/dist/lib/boot-api-key.d.ts +38 -0
- package/dist/lib/boot-api-key.d.ts.map +1 -0
- package/dist/lib/boot.d.ts +23 -0
- package/dist/lib/boot.d.ts.map +1 -0
- package/dist/lib/bootstrap-admin.d.ts +33 -0
- package/dist/lib/bootstrap-admin.d.ts.map +1 -0
- package/dist/lib/bot-prefetch.d.ts +21 -0
- package/dist/lib/bot-prefetch.d.ts.map +1 -0
- package/dist/lib/bucket-emit.d.ts +75 -0
- package/dist/lib/bucket-emit.d.ts.map +1 -0
- package/dist/lib/bucket-posthog-sync.d.ts +29 -0
- package/dist/lib/bucket-posthog-sync.d.ts.map +1 -0
- package/dist/lib/campaign-send-key.d.ts +31 -0
- package/dist/lib/campaign-send-key.d.ts.map +1 -0
- package/dist/lib/connector-actions.d.ts +83 -0
- package/dist/lib/connector-actions.d.ts.map +1 -0
- package/dist/lib/connector-heartbeat.d.ts +35 -0
- package/dist/lib/connector-heartbeat.d.ts.map +1 -0
- package/dist/lib/connector-link-codes.d.ts +105 -0
- package/dist/lib/connector-link-codes.d.ts.map +1 -0
- package/dist/lib/connector-state.d.ts +97 -0
- package/dist/lib/connector-state.d.ts.map +1 -0
- package/dist/lib/contacts.d.ts +622 -0
- package/dist/lib/contacts.d.ts.map +1 -0
- package/dist/lib/conversion-dispatch.d.ts +98 -0
- package/dist/lib/conversion-dispatch.d.ts.map +1 -0
- package/dist/lib/conversions.d.ts +75 -0
- package/dist/lib/conversions.d.ts.map +1 -0
- package/dist/lib/create-admin.d.ts +54 -0
- package/dist/lib/create-admin.d.ts.map +1 -0
- package/dist/lib/crm-deals.d.ts +66 -0
- package/dist/lib/crm-deals.d.ts.map +1 -0
- package/dist/lib/crm-ingest.d.ts +38 -0
- package/dist/lib/crm-ingest.d.ts.map +1 -0
- package/dist/lib/crm-provider-registry.d.ts +20 -0
- package/dist/lib/crm-provider-registry.d.ts.map +1 -0
- package/dist/lib/crm-registry-singleton.d.ts +18 -0
- package/dist/lib/crm-registry-singleton.d.ts.map +1 -0
- package/dist/lib/db.d.ts +3 -0
- package/dist/lib/db.d.ts.map +1 -0
- package/dist/lib/deal-money-events.d.ts +35 -0
- package/dist/lib/deal-money-events.d.ts.map +1 -0
- package/dist/lib/discord-gateway-heartbeat.d.ts +47 -0
- package/dist/lib/discord-gateway-heartbeat.d.ts.map +1 -0
- package/dist/lib/domain-status.d.ts +87 -0
- package/dist/lib/domain-status.d.ts.map +1 -0
- package/dist/lib/email-provider-registry.d.ts +30 -0
- package/dist/lib/email-provider-registry.d.ts.map +1 -0
- package/dist/lib/email-providers-from-env.d.ts +12 -0
- package/dist/lib/email-providers-from-env.d.ts.map +1 -0
- package/dist/lib/email-service-types.d.ts +189 -0
- package/dist/lib/email-service-types.d.ts.map +1 -0
- package/dist/lib/email-stats.d.ts +12 -0
- package/dist/lib/email-stats.d.ts.map +1 -0
- package/dist/lib/email.d.ts +73 -0
- package/dist/lib/email.d.ts.map +1 -0
- package/dist/lib/enrichment-ledger.d.ts +101 -0
- package/dist/lib/enrichment-ledger.d.ts.map +1 -0
- package/dist/lib/enrichment-provider-registry.d.ts +20 -0
- package/dist/lib/enrichment-provider-registry.d.ts.map +1 -0
- package/dist/lib/enrichment-providers-from-env.d.ts +13 -0
- package/dist/lib/enrichment-providers-from-env.d.ts.map +1 -0
- package/dist/lib/enrichment-registry-singleton.d.ts +9 -0
- package/dist/lib/enrichment-registry-singleton.d.ts.map +1 -0
- package/dist/lib/enrollment-guards.d.ts +28 -0
- package/dist/lib/enrollment-guards.d.ts.map +1 -0
- package/dist/lib/enrollment-policy.d.ts +25 -0
- package/dist/lib/enrollment-policy.d.ts.map +1 -0
- package/dist/lib/event-names.d.ts +27 -0
- package/dist/lib/event-names.d.ts.map +1 -0
- package/dist/lib/feed.d.ts +64 -0
- package/dist/lib/feed.d.ts.map +1 -0
- package/dist/lib/flags-registry.d.ts +23 -0
- package/dist/lib/flags-registry.d.ts.map +1 -0
- package/dist/lib/flags.d.ts +143 -0
- package/dist/lib/flags.d.ts.map +1 -0
- package/dist/lib/frequency-cap.d.ts +38 -0
- package/dist/lib/frequency-cap.d.ts.map +1 -0
- package/dist/lib/from-address.d.ts +15 -0
- package/dist/lib/from-address.d.ts.map +1 -0
- package/dist/lib/funnel-progress.d.ts +37 -0
- package/dist/lib/funnel-progress.d.ts.map +1 -0
- package/dist/lib/funnel-registry.d.ts +44 -0
- package/dist/lib/funnel-registry.d.ts.map +1 -0
- package/dist/lib/funnel-transitions.d.ts +63 -0
- package/dist/lib/funnel-transitions.d.ts.map +1 -0
- package/dist/lib/fx.d.ts +118 -0
- package/dist/lib/fx.d.ts.map +1 -0
- package/dist/lib/global-control-readout.d.ts +72 -0
- package/dist/lib/global-control-readout.d.ts.map +1 -0
- package/dist/lib/groups.d.ts +138 -0
- package/dist/lib/groups.d.ts.map +1 -0
- package/dist/lib/hatchet-duration.d.ts +14 -0
- package/dist/lib/hatchet-duration.d.ts.map +1 -0
- package/dist/lib/hatchet.d.ts +3 -0
- package/dist/lib/hatchet.d.ts.map +1 -0
- package/dist/lib/headers.d.ts +8 -0
- package/dist/lib/headers.d.ts.map +1 -0
- package/dist/lib/holdout.d.ts +36 -0
- package/dist/lib/holdout.d.ts.map +1 -0
- package/dist/lib/html.d.ts +5 -0
- package/dist/lib/html.d.ts.map +1 -0
- package/dist/lib/identity-service.d.ts +60 -0
- package/dist/lib/identity-service.d.ts.map +1 -0
- package/dist/lib/identity-token.d.ts +81 -0
- package/dist/lib/identity-token.d.ts.map +1 -0
- package/dist/lib/ingestion.d.ts +218 -0
- package/dist/lib/ingestion.d.ts.map +1 -0
- package/dist/lib/journey-lift.d.ts +56 -0
- package/dist/lib/journey-lift.d.ts.map +1 -0
- package/dist/lib/journey-suppress.d.ts +59 -0
- package/dist/lib/journey-suppress.d.ts.map +1 -0
- package/dist/lib/leader-lease.d.ts +36 -0
- package/dist/lib/leader-lease.d.ts.map +1 -0
- package/dist/lib/lift-stats.d.ts +46 -0
- package/dist/lib/lift-stats.d.ts.map +1 -0
- package/dist/lib/links.d.ts +186 -0
- package/dist/lib/links.d.ts.map +1 -0
- package/dist/lib/load-optional-plugin.d.ts +47 -0
- package/dist/lib/load-optional-plugin.d.ts.map +1 -0
- package/dist/lib/logger.d.ts +4 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/mailer.d.ts +43 -0
- package/dist/lib/mailer.d.ts.map +1 -0
- package/dist/lib/metrics-sql.d.ts +11 -0
- package/dist/lib/metrics-sql.d.ts.map +1 -0
- package/dist/lib/notifications.d.ts +17 -0
- package/dist/lib/notifications.d.ts.map +1 -0
- package/dist/lib/oauth-token-manager.d.ts +74 -0
- package/dist/lib/oauth-token-manager.d.ts.map +1 -0
- package/dist/lib/operator-settings.d.ts +33 -0
- package/dist/lib/operator-settings.d.ts.map +1 -0
- package/dist/lib/operator.d.ts +20 -0
- package/dist/lib/operator.d.ts.map +1 -0
- package/dist/lib/outbound-endpoint-cache.d.ts +25 -0
- package/dist/lib/outbound-endpoint-cache.d.ts.map +1 -0
- package/dist/lib/outbound.d.ts +687 -0
- package/dist/lib/outbound.d.ts.map +1 -0
- package/dist/lib/phone.d.ts +11 -0
- package/dist/lib/phone.d.ts.map +1 -0
- package/dist/lib/posthog-scopes.d.ts +30 -0
- package/dist/lib/posthog-scopes.d.ts.map +1 -0
- package/dist/lib/posthog.d.ts +16 -0
- package/dist/lib/posthog.d.ts.map +1 -0
- package/dist/lib/preferences.d.ts +72 -0
- package/dist/lib/preferences.d.ts.map +1 -0
- package/dist/lib/provider-credentials.d.ts +149 -0
- package/dist/lib/provider-credentials.d.ts.map +1 -0
- package/dist/lib/provision-posthog-loop.d.ts +100 -0
- package/dist/lib/provision-posthog-loop.d.ts.map +1 -0
- package/dist/lib/recipient-preferences.d.ts +29 -0
- package/dist/lib/recipient-preferences.d.ts.map +1 -0
- package/dist/lib/redis.d.ts +33 -0
- package/dist/lib/redis.d.ts.map +1 -0
- package/dist/lib/referral-intent.d.ts +99 -0
- package/dist/lib/referral-intent.d.ts.map +1 -0
- package/dist/lib/referral-link.d.ts +59 -0
- package/dist/lib/referral-link.d.ts.map +1 -0
- package/dist/lib/referral-registry.d.ts +37 -0
- package/dist/lib/referral-registry.d.ts.map +1 -0
- package/dist/lib/referral-report.d.ts +178 -0
- package/dist/lib/referral-report.d.ts.map +1 -0
- package/dist/lib/referral-runtime.d.ts +43 -0
- package/dist/lib/referral-runtime.d.ts.map +1 -0
- package/dist/lib/referrals.d.ts +184 -0
- package/dist/lib/referrals.d.ts.map +1 -0
- package/dist/lib/refine-chain.d.ts +236 -0
- package/dist/lib/refine-chain.d.ts.map +1 -0
- package/dist/lib/refine-traits.d.ts +78 -0
- package/dist/lib/refine-traits.d.ts.map +1 -0
- package/dist/lib/refine.d.ts +35 -0
- package/dist/lib/refine.d.ts.map +1 -0
- package/dist/lib/reset-email.d.ts +38 -0
- package/dist/lib/reset-email.d.ts.map +1 -0
- package/dist/lib/revenue.d.ts +61 -0
- package/dist/lib/revenue.d.ts.map +1 -0
- package/dist/lib/schemas.d.ts +9 -0
- package/dist/lib/schemas.d.ts.map +1 -0
- package/dist/lib/seed-posthog-destination.d.ts +22 -0
- package/dist/lib/seed-posthog-destination.d.ts.map +1 -0
- package/dist/lib/semantic-click.d.ts +58 -0
- package/dist/lib/semantic-click.d.ts.map +1 -0
- package/dist/lib/sending-domain-guidance.d.ts +40 -0
- package/dist/lib/sending-domain-guidance.d.ts.map +1 -0
- package/dist/lib/singleton.d.ts +24 -0
- package/dist/lib/singleton.d.ts.map +1 -0
- package/dist/lib/sms-frequency-cap.d.ts +16 -0
- package/dist/lib/sms-frequency-cap.d.ts.map +1 -0
- package/dist/lib/sms-inbound.d.ts +37 -0
- package/dist/lib/sms-inbound.d.ts.map +1 -0
- package/dist/lib/sms-link-tracking.d.ts +53 -0
- package/dist/lib/sms-link-tracking.d.ts.map +1 -0
- package/dist/lib/sms-mailer.d.ts +12 -0
- package/dist/lib/sms-mailer.d.ts.map +1 -0
- package/dist/lib/sms-provider-registry.d.ts +20 -0
- package/dist/lib/sms-provider-registry.d.ts.map +1 -0
- package/dist/lib/sms-providers-from-env.d.ts +4 -0
- package/dist/lib/sms-providers-from-env.d.ts.map +1 -0
- package/dist/lib/sms-service-types.d.ts +131 -0
- package/dist/lib/sms-service-types.d.ts.map +1 -0
- package/dist/lib/sms-tracked.d.ts +36 -0
- package/dist/lib/sms-tracked.d.ts.map +1 -0
- package/dist/lib/sms.d.ts +58 -0
- package/dist/lib/sms.d.ts.map +1 -0
- package/dist/lib/snippet.d.ts +32 -0
- package/dist/lib/snippet.d.ts.map +1 -0
- package/dist/lib/stable-stringify.d.ts +12 -0
- package/dist/lib/stable-stringify.d.ts.map +1 -0
- package/dist/lib/studio.d.ts +21 -0
- package/dist/lib/studio.d.ts.map +1 -0
- package/dist/lib/survey.d.ts +35 -0
- package/dist/lib/survey.d.ts.map +1 -0
- package/dist/lib/test-mode.d.ts +77 -0
- package/dist/lib/test-mode.d.ts.map +1 -0
- package/dist/lib/timezone.d.ts +55 -0
- package/dist/lib/timezone.d.ts.map +1 -0
- package/dist/lib/tracked.d.ts +95 -0
- package/dist/lib/tracked.d.ts.map +1 -0
- package/dist/lib/tracking-event-names.d.ts +7 -0
- package/dist/lib/tracking-event-names.d.ts.map +1 -0
- package/dist/lib/tracking-events.d.ts +232 -0
- package/dist/lib/tracking-events.d.ts.map +1 -0
- package/dist/lib/tracking.d.ts +47 -0
- package/dist/lib/tracking.d.ts.map +1 -0
- package/dist/lib/unconfigured-email-provider.d.ts +20 -0
- package/dist/lib/unconfigured-email-provider.d.ts.map +1 -0
- package/dist/lib/unique-violation.d.ts +22 -0
- package/dist/lib/unique-violation.d.ts.map +1 -0
- package/dist/lib/user-token.d.ts +44 -0
- package/dist/lib/user-token.d.ts.map +1 -0
- package/dist/lib/variant.d.ts +44 -0
- package/dist/lib/variant.d.ts.map +1 -0
- package/dist/lib/webhook-signing.d.ts +120 -0
- package/dist/lib/webhook-signing.d.ts.map +1 -0
- package/dist/lib/worker-heartbeat.d.ts +18 -0
- package/dist/lib/worker-heartbeat.d.ts.map +1 -0
- package/dist/lists/channels.d.ts +43 -0
- package/dist/lists/channels.d.ts.map +1 -0
- package/dist/lists/define-list.d.ts +76 -0
- package/dist/lists/define-list.d.ts.map +1 -0
- package/dist/lists/registry-singleton.d.ts +8 -0
- package/dist/lists/registry-singleton.d.ts.map +1 -0
- package/dist/lists/registry.d.ts +66 -0
- package/dist/lists/registry.d.ts.map +1 -0
- package/dist/lists/subscription.d.ts +10 -0
- package/dist/lists/subscription.d.ts.map +1 -0
- package/dist/mcp/authoring-guide.d.ts +33 -0
- package/dist/mcp/authoring-guide.d.ts.map +1 -0
- package/dist/mcp/blueprint-tools.d.ts +266 -0
- package/dist/mcp/blueprint-tools.d.ts.map +1 -0
- package/dist/middleware/api-key.d.ts +45 -0
- package/dist/middleware/api-key.d.ts.map +1 -0
- package/dist/middleware/audit.d.ts +3 -0
- package/dist/middleware/audit.d.ts.map +1 -0
- package/dist/middleware/error-handler.d.ts +4 -0
- package/dist/middleware/error-handler.d.ts.map +1 -0
- package/dist/middleware/publishable-key.d.ts +27 -0
- package/dist/middleware/publishable-key.d.ts.map +1 -0
- package/dist/middleware/rate-limit.d.ts +105 -0
- package/dist/middleware/rate-limit.d.ts.map +1 -0
- package/dist/middleware/request-logger.d.ts +4 -0
- package/dist/middleware/request-logger.d.ts.map +1 -0
- package/dist/middleware/require-admin.d.ts +3 -0
- package/dist/middleware/require-admin.d.ts.map +1 -0
- package/dist/routes/_shared.d.ts +52 -0
- package/dist/routes/_shared.d.ts.map +1 -0
- package/dist/routes/accounts/callback.d.ts +18 -0
- package/dist/routes/accounts/callback.d.ts.map +1 -0
- package/dist/routes/accounts/emit.d.ts +96 -0
- package/dist/routes/accounts/emit.d.ts.map +1 -0
- package/dist/routes/accounts/import-links.d.ts +4 -0
- package/dist/routes/accounts/import-links.d.ts.map +1 -0
- package/dist/routes/accounts/index.d.ts +39 -0
- package/dist/routes/accounts/index.d.ts.map +1 -0
- package/dist/routes/accounts/lookup.d.ts +6 -0
- package/dist/routes/accounts/lookup.d.ts.map +1 -0
- package/dist/routes/accounts/me.d.ts +5 -0
- package/dist/routes/accounts/me.d.ts.map +1 -0
- package/dist/routes/accounts/mint.d.ts +5 -0
- package/dist/routes/accounts/mint.d.ts.map +1 -0
- package/dist/routes/accounts/pages.d.ts +23 -0
- package/dist/routes/accounts/pages.d.ts.map +1 -0
- package/dist/routes/accounts/resolve.d.ts +33 -0
- package/dist/routes/accounts/resolve.d.ts.map +1 -0
- package/dist/routes/accounts/serialize.d.ts +57 -0
- package/dist/routes/accounts/serialize.d.ts.map +1 -0
- package/dist/routes/accounts/shared.d.ts +68 -0
- package/dist/routes/accounts/shared.d.ts.map +1 -0
- package/dist/routes/accounts/start.d.ts +16 -0
- package/dist/routes/accounts/start.d.ts.map +1 -0
- package/dist/routes/accounts/unlink.d.ts +36 -0
- package/dist/routes/accounts/unlink.d.ts.map +1 -0
- package/dist/routes/admin/agent.d.ts +4 -0
- package/dist/routes/admin/agent.d.ts.map +1 -0
- package/dist/routes/admin/alerts.d.ts +190 -0
- package/dist/routes/admin/alerts.d.ts.map +1 -0
- package/dist/routes/admin/analytics.d.ts +137 -0
- package/dist/routes/admin/analytics.d.ts.map +1 -0
- package/dist/routes/admin/api-keys.d.ts +158 -0
- package/dist/routes/admin/api-keys.d.ts.map +1 -0
- package/dist/routes/admin/attribution.d.ts +93 -0
- package/dist/routes/admin/attribution.d.ts.map +1 -0
- package/dist/routes/admin/audit-logs.d.ts +40 -0
- package/dist/routes/admin/audit-logs.d.ts.map +1 -0
- package/dist/routes/admin/blueprints.d.ts +4 -0
- package/dist/routes/admin/blueprints.d.ts.map +1 -0
- package/dist/routes/admin/buckets.d.ts +215 -0
- package/dist/routes/admin/buckets.d.ts.map +1 -0
- package/dist/routes/admin/bulk.d.ts +203 -0
- package/dist/routes/admin/bulk.d.ts.map +1 -0
- package/dist/routes/admin/campaigns.d.ts +198 -0
- package/dist/routes/admin/campaigns.d.ts.map +1 -0
- package/dist/routes/admin/connectors.d.ts +116 -0
- package/dist/routes/admin/connectors.d.ts.map +1 -0
- package/dist/routes/admin/contacts.d.ts +246 -0
- package/dist/routes/admin/contacts.d.ts.map +1 -0
- package/dist/routes/admin/conversions.d.ts +103 -0
- package/dist/routes/admin/conversions.d.ts.map +1 -0
- package/dist/routes/admin/deals.d.ts +136 -0
- package/dist/routes/admin/deals.d.ts.map +1 -0
- package/dist/routes/admin/dlq.d.ts +100 -0
- package/dist/routes/admin/dlq.d.ts.map +1 -0
- package/dist/routes/admin/domain.d.ts +314 -0
- package/dist/routes/admin/domain.d.ts.map +1 -0
- package/dist/routes/admin/emails.d.ts +127 -0
- package/dist/routes/admin/emails.d.ts.map +1 -0
- package/dist/routes/admin/events.d.ts +140 -0
- package/dist/routes/admin/events.d.ts.map +1 -0
- package/dist/routes/admin/flags.d.ts +719 -0
- package/dist/routes/admin/flags.d.ts.map +1 -0
- package/dist/routes/admin/funnels.d.ts +71 -0
- package/dist/routes/admin/funnels.d.ts.map +1 -0
- package/dist/routes/admin/groups.d.ts +169 -0
- package/dist/routes/admin/groups.d.ts.map +1 -0
- package/dist/routes/admin/identity.d.ts +72 -0
- package/dist/routes/admin/identity.d.ts.map +1 -0
- package/dist/routes/admin/impact-schemas.d.ts +48 -0
- package/dist/routes/admin/impact-schemas.d.ts.map +1 -0
- package/dist/routes/admin/impact.d.ts +316 -0
- package/dist/routes/admin/impact.d.ts.map +1 -0
- package/dist/routes/admin/index.d.ts +4 -0
- package/dist/routes/admin/index.d.ts.map +1 -0
- package/dist/routes/admin/journey-impact.d.ts +320 -0
- package/dist/routes/admin/journey-impact.d.ts.map +1 -0
- package/dist/routes/admin/journey-logs.d.ts +57 -0
- package/dist/routes/admin/journey-logs.d.ts.map +1 -0
- package/dist/routes/admin/journeys.d.ts +736 -0
- package/dist/routes/admin/journeys.d.ts.map +1 -0
- package/dist/routes/admin/links.d.ts +382 -0
- package/dist/routes/admin/links.d.ts.map +1 -0
- package/dist/routes/admin/lists.d.ts +22 -0
- package/dist/routes/admin/lists.d.ts.map +1 -0
- package/dist/routes/admin/maintenance.d.ts +72 -0
- package/dist/routes/admin/maintenance.d.ts.map +1 -0
- package/dist/routes/admin/metrics.d.ts +212 -0
- package/dist/routes/admin/metrics.d.ts.map +1 -0
- package/dist/routes/admin/open-editor.d.ts +36 -0
- package/dist/routes/admin/open-editor.d.ts.map +1 -0
- package/dist/routes/admin/preferences.d.ts +109 -0
- package/dist/routes/admin/preferences.d.ts.map +1 -0
- package/dist/routes/admin/provider-credentials.d.ts +108 -0
- package/dist/routes/admin/provider-credentials.d.ts.map +1 -0
- package/dist/routes/admin/readiness.d.ts +24 -0
- package/dist/routes/admin/readiness.d.ts.map +1 -0
- package/dist/routes/admin/referrals.d.ts +230 -0
- package/dist/routes/admin/referrals.d.ts.map +1 -0
- package/dist/routes/admin/reporting.d.ts +149 -0
- package/dist/routes/admin/reporting.d.ts.map +1 -0
- package/dist/routes/admin/settings.d.ts +80 -0
- package/dist/routes/admin/settings.d.ts.map +1 -0
- package/dist/routes/admin/suppressions.d.ts +90 -0
- package/dist/routes/admin/suppressions.d.ts.map +1 -0
- package/dist/routes/admin/targeting.d.ts +58 -0
- package/dist/routes/admin/targeting.d.ts.map +1 -0
- package/dist/routes/admin/templates.d.ts +197 -0
- package/dist/routes/admin/templates.d.ts.map +1 -0
- package/dist/routes/admin/timeline.d.ts +51 -0
- package/dist/routes/admin/timeline.d.ts.map +1 -0
- package/dist/routes/admin/webhooks.d.ts +250 -0
- package/dist/routes/admin/webhooks.d.ts.map +1 -0
- package/dist/routes/campaigns/index.d.ts +239 -0
- package/dist/routes/campaigns/index.d.ts.map +1 -0
- package/dist/routes/connectors/index.d.ts +16 -0
- package/dist/routes/connectors/index.d.ts.map +1 -0
- package/dist/routes/contacts/index.d.ts +187 -0
- package/dist/routes/contacts/index.d.ts.map +1 -0
- package/dist/routes/email/index.d.ts +4 -0
- package/dist/routes/email/index.d.ts.map +1 -0
- package/dist/routes/email/preferences.d.ts +17 -0
- package/dist/routes/email/preferences.d.ts.map +1 -0
- package/dist/routes/email/unsubscribe.d.ts +17 -0
- package/dist/routes/email/unsubscribe.d.ts.map +1 -0
- package/dist/routes/emails/index.d.ts +90 -0
- package/dist/routes/emails/index.d.ts.map +1 -0
- package/dist/routes/events/index.d.ts +116 -0
- package/dist/routes/events/index.d.ts.map +1 -0
- package/dist/routes/feed/index.d.ts +248 -0
- package/dist/routes/feed/index.d.ts.map +1 -0
- package/dist/routes/feed/recipient.d.ts +65 -0
- package/dist/routes/feed/recipient.d.ts.map +1 -0
- package/dist/routes/flags/index.d.ts +94 -0
- package/dist/routes/flags/index.d.ts.map +1 -0
- package/dist/routes/groups/index.d.ts +192 -0
- package/dist/routes/groups/index.d.ts.map +1 -0
- package/dist/routes/health.d.ts +57 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/index.d.ts +8 -0
- package/dist/routes/index.d.ts.map +1 -0
- package/dist/routes/lists/index.d.ts +266 -0
- package/dist/routes/lists/index.d.ts.map +1 -0
- package/dist/routes/referrals/index.d.ts +22 -0
- package/dist/routes/referrals/index.d.ts.map +1 -0
- package/dist/routes/referrals/me.d.ts +4 -0
- package/dist/routes/referrals/me.d.ts.map +1 -0
- package/dist/routes/referrals/report.d.ts +5 -0
- package/dist/routes/referrals/report.d.ts.map +1 -0
- package/dist/routes/referrals/shared.d.ts +16 -0
- package/dist/routes/referrals/shared.d.ts.map +1 -0
- package/dist/routes/referrals/touch.d.ts +5 -0
- package/dist/routes/referrals/touch.d.ts.map +1 -0
- package/dist/routes/snippet.d.ts +12 -0
- package/dist/routes/snippet.d.ts.map +1 -0
- package/dist/routes/tracking/answer.d.ts +56 -0
- package/dist/routes/tracking/answer.d.ts.map +1 -0
- package/dist/routes/tracking/arrive.d.ts +32 -0
- package/dist/routes/tracking/arrive.d.ts.map +1 -0
- package/dist/routes/tracking/click-pipeline.d.ts +213 -0
- package/dist/routes/tracking/click-pipeline.d.ts.map +1 -0
- package/dist/routes/tracking/click.d.ts +26 -0
- package/dist/routes/tracking/click.d.ts.map +1 -0
- package/dist/routes/tracking/identify.d.ts +32 -0
- package/dist/routes/tracking/identify.d.ts.map +1 -0
- package/dist/routes/tracking/index.d.ts +4 -0
- package/dist/routes/tracking/index.d.ts.map +1 -0
- package/dist/routes/tracking/open.d.ts +17 -0
- package/dist/routes/tracking/open.d.ts.map +1 -0
- package/dist/routes/tracking/short.d.ts +17 -0
- package/dist/routes/tracking/short.d.ts.map +1 -0
- package/dist/routes/tracking/vanity.d.ts +17 -0
- package/dist/routes/tracking/vanity.d.ts.map +1 -0
- package/dist/routes/webhooks/crm-provider.d.ts +24 -0
- package/dist/routes/webhooks/crm-provider.d.ts.map +1 -0
- package/dist/routes/webhooks/email-provider.d.ts +21 -0
- package/dist/routes/webhooks/email-provider.d.ts.map +1 -0
- package/dist/routes/webhooks/index.d.ts +8 -0
- package/dist/routes/webhooks/index.d.ts.map +1 -0
- package/dist/routes/webhooks/resend.d.ts +35 -0
- package/dist/routes/webhooks/resend.d.ts.map +1 -0
- package/dist/routes/webhooks/sms-provider.d.ts +23 -0
- package/dist/routes/webhooks/sms-provider.d.ts.map +1 -0
- package/dist/routes/webhooks/sources.d.ts +12 -0
- package/dist/routes/webhooks/sources.d.ts.map +1 -0
- package/dist/sources/define-contact-source.d.ts +114 -0
- package/dist/sources/define-contact-source.d.ts.map +1 -0
- package/dist/sources/registry.d.ts +31 -0
- package/dist/sources/registry.d.ts.map +1 -0
- package/dist/sources/webhook-source.d.ts +53 -0
- package/dist/sources/webhook-source.d.ts.map +1 -0
- package/dist/testing.d.ts +10 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/webhook-sources/define-webhook-source.d.ts +60 -0
- package/dist/webhook-sources/define-webhook-source.d.ts.map +1 -0
- package/dist/webhook-sources/presets/clerk.d.ts +9 -0
- package/dist/webhook-sources/presets/clerk.d.ts.map +1 -0
- package/dist/webhook-sources/presets/index.d.ts +140 -0
- package/dist/webhook-sources/presets/index.d.ts.map +1 -0
- package/dist/webhook-sources/presets/intercom.d.ts +44 -0
- package/dist/webhook-sources/presets/intercom.d.ts.map +1 -0
- package/dist/webhook-sources/presets/segment.d.ts +16 -0
- package/dist/webhook-sources/presets/segment.d.ts.map +1 -0
- package/dist/webhook-sources/presets/stripe.d.ts +20 -0
- package/dist/webhook-sources/presets/stripe.d.ts.map +1 -0
- package/dist/webhook-sources/presets/supabase.d.ts +23 -0
- package/dist/webhook-sources/presets/supabase.d.ts.map +1 -0
- package/dist/webhook-sources/verify.d.ts +48 -0
- package/dist/webhook-sources/verify.d.ts.map +1 -0
- package/dist/worker.d.ts +37 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/workflows/backfill-contact-id.d.ts +202 -0
- package/dist/workflows/backfill-contact-id.d.ts.map +1 -0
- package/dist/workflows/bucket-backfill.d.ts +64 -0
- package/dist/workflows/bucket-backfill.d.ts.map +1 -0
- package/dist/workflows/bucket-reconcile.d.ts +73 -0
- package/dist/workflows/bucket-reconcile.d.ts.map +1 -0
- package/dist/workflows/check-alerts.d.ts +10 -0
- package/dist/workflows/check-alerts.d.ts.map +1 -0
- package/dist/workflows/confirm-semantic-click.d.ts +15 -0
- package/dist/workflows/confirm-semantic-click.d.ts.map +1 -0
- package/dist/workflows/crm-reconcile.d.ts +27 -0
- package/dist/workflows/crm-reconcile.d.ts.map +1 -0
- package/dist/workflows/deliver-webhook.d.ts +88 -0
- package/dist/workflows/deliver-webhook.d.ts.map +1 -0
- package/dist/workflows/dispatch-conversion.d.ts +14 -0
- package/dist/workflows/dispatch-conversion.d.ts.map +1 -0
- package/dist/workflows/identity-alias-backfill.d.ts +96 -0
- package/dist/workflows/identity-alias-backfill.d.ts.map +1 -0
- package/dist/workflows/impact-digest.d.ts +142 -0
- package/dist/workflows/impact-digest.d.ts.map +1 -0
- package/dist/workflows/import-contacts.d.ts +14 -0
- package/dist/workflows/import-contacts.d.ts.map +1 -0
- package/dist/workflows/import-suppressions.d.ts +55 -0
- package/dist/workflows/import-suppressions.d.ts.map +1 -0
- package/dist/workflows/journey-blueprint-interpreter.d.ts +73 -0
- package/dist/workflows/journey-blueprint-interpreter.d.ts.map +1 -0
- package/dist/workflows/send-campaign.d.ts +128 -0
- package/dist/workflows/send-campaign.d.ts.map +1 -0
- package/dist/workflows/send-email.d.ts +15 -0
- package/dist/workflows/send-email.d.ts.map +1 -0
- package/dist/workflows/send-feed.d.ts +37 -0
- package/dist/workflows/send-feed.d.ts.map +1 -0
- package/package.json +60 -22
- package/src/app.ts +9 -1
- package/src/buckets/check-membership.ts +54 -20
- package/src/env.ts +30 -0
- package/src/journeys/journey-log.ts +25 -8
- package/src/lib/contacts.ts +47 -1
- package/src/lib/email-service-types.ts +10 -0
- package/src/lib/ingestion.ts +30 -19
- package/src/lib/mailer-bounce-idempotency.test.ts +7 -2
- package/src/lib/mailer-replied.test.ts +7 -2
- package/src/lib/mailer.ts +1 -0
- package/src/lib/outbound-endpoint-cache.ts +83 -0
- package/src/lib/outbound.ts +56 -37
- package/src/lib/seed-posthog-destination.ts +5 -1
- package/src/lib/tracked.ts +11 -3
- package/src/lib/tracking-events.ts +20 -3
- package/src/middleware/api-key.ts +69 -60
- package/src/middleware/publishable-key.ts +11 -23
- package/src/middleware/rate-limit.ts +165 -3
- package/src/routes/admin/api-keys.ts +148 -0
- package/src/routes/admin/targeting.ts +6 -1
- package/src/routes/admin/webhooks.ts +4 -0
- package/src/routes/index.ts +67 -24
- package/src/workflows/backfill-contact-id.ts +3 -7
- package/src/workflows/bucket-backfill.ts +2 -2
- package/src/workflows/bucket-reconcile.ts +28 -12
- package/src/workflows/check-alerts.ts +3 -9
- package/src/workflows/crm-reconcile.ts +3 -2
- package/src/workflows/deliver-webhook.ts +21 -8
- package/src/workflows/dispatch-conversion.ts +2 -2
- package/src/workflows/identity-alias-backfill.ts +3 -2
- package/src/workflows/impact-digest.ts +2 -2
- package/src/workflows/import-contacts.ts +3 -4
- package/src/workflows/import-suppressions.ts +4 -5
- package/src/workflows/send-campaign.ts +10 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { JsonValue } from "@hatchet-dev/typescript-sdk/v1/types.js";
|
|
2
|
+
import { type BlueprintGraph } from "@hogsend/core";
|
|
3
|
+
import type { JourneyContext, JourneyMeta, JourneyUser } from "@hogsend/core/types";
|
|
4
|
+
import { type Database, journeyBlueprints } from "@hogsend/db";
|
|
5
|
+
/** A `journey_blueprints` row as Drizzle returns it. */
|
|
6
|
+
export type JourneyBlueprintRow = typeof journeyBlueprints.$inferSelect;
|
|
7
|
+
/**
|
|
8
|
+
* Build the `JourneyMeta` the shared run lifecycle consumes from a
|
|
9
|
+
* `journey_blueprints` row. The row's trigger/entry/exit/suppress columns
|
|
10
|
+
* mirror `JourneyMeta` 1:1 by design (spec §4) so the SAME enrollment-guard
|
|
11
|
+
* functions `defineJourney` uses receive it verbatim — `status !== "enabled"`
|
|
12
|
+
* is the blueprint's `meta.enabled === false`. The jsonb columns are opaque in
|
|
13
|
+
* `@hogsend/db` (db cannot import core), so this is the single read-site
|
|
14
|
+
* narrowing, per the `campaigns.steps` convention.
|
|
15
|
+
*/
|
|
16
|
+
export declare function blueprintMetaFromRow(row: JourneyBlueprintRow): JourneyMeta;
|
|
17
|
+
export interface WalkBlueprintGraphOptions {
|
|
18
|
+
blueprintId: string;
|
|
19
|
+
/** A graph that passed {@link validateBlueprintGraph}. */
|
|
20
|
+
graph: BlueprintGraph;
|
|
21
|
+
user: JourneyUser;
|
|
22
|
+
ctx: JourneyContext;
|
|
23
|
+
db: Database;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Tree-walk a validated blueprint graph, executing each node through the
|
|
27
|
+
* EXACT same primitives a code journey calls (spec §6): `ctx.sleep`,
|
|
28
|
+
* `ctx.waitForEvent`, `ctx.checkpoint`, `ctx.trigger`, `sendEmail()`,
|
|
29
|
+
* `sendConnectorAction()`, `evaluateCondition()`. Every label/idempotencyLabel
|
|
30
|
+
* is the node id — as replay-stable as a hand-authored `ctx.sleep({ label })`
|
|
31
|
+
* — so the existing two-layer exactly-once machinery applies unchanged.
|
|
32
|
+
*
|
|
33
|
+
* The dispatch is an exhaustive `switch` over the FULL `JourneyNodeType`
|
|
34
|
+
* union with a compiler-enforced `never` default (spec §6.1): adding a node
|
|
35
|
+
* type without an interpreter case is a compile error, and the four
|
|
36
|
+
* non-executable display-tier types throw typed errors as defense-in-depth
|
|
37
|
+
* (validation already rejected them).
|
|
38
|
+
*/
|
|
39
|
+
export declare function walkBlueprintGraph(opts: WalkBlueprintGraphOptions): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* The event payload `checkBlueprintTriggers` pushes for each matching enabled
|
|
42
|
+
* blueprint — one push per (blueprint, user) enrollment attempt.
|
|
43
|
+
*/
|
|
44
|
+
export interface BlueprintRunPayload {
|
|
45
|
+
blueprintId: JsonValue;
|
|
46
|
+
blueprintVersion: JsonValue;
|
|
47
|
+
userId: JsonValue;
|
|
48
|
+
userEmail: JsonValue;
|
|
49
|
+
triggerProperties: JsonValue;
|
|
50
|
+
[key: string]: JsonValue;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The generic blueprint interpreter — ONE statically-registered durable task
|
|
54
|
+
* for ALL blueprints, ever (spec §5): blueprints created/edited/enabled at
|
|
55
|
+
* runtime need no worker redeploy because dispatch is a DB lookup at ingest
|
|
56
|
+
* (`checkBlueprintTriggers`) feeding this task via `blueprint:run`, not a
|
|
57
|
+
* per-blueprint `onEvents` registration.
|
|
58
|
+
*
|
|
59
|
+
* Each run loads the blueprint row, re-validates the stored graph
|
|
60
|
+
* (defense-in-depth — jsonb is not trusted at execution time either), builds
|
|
61
|
+
* the row's `JourneyMeta` mirror, and hands the tree-walk to the SAME
|
|
62
|
+
* `executeJourneyRun` lifecycle `defineJourney` tasks use — identical
|
|
63
|
+
* enrollment guards, replay recovery, journey context, replay-safety
|
|
64
|
+
* boundary, and terminal transitions.
|
|
65
|
+
*/
|
|
66
|
+
export declare const journeyBlueprintInterpreter: import("@hatchet-dev/typescript-sdk/index.js").TaskWorkflowDeclaration<BlueprintRunPayload, {
|
|
67
|
+
stateId: string;
|
|
68
|
+
status: "completed" | "exited";
|
|
69
|
+
} | {
|
|
70
|
+
status: string;
|
|
71
|
+
reason: string;
|
|
72
|
+
}, {}, {}, {}, {}>;
|
|
73
|
+
//# sourceMappingURL=journey-blueprint-interpreter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey-blueprint-interpreter.d.ts","sourceRoot":"","sources":["../../src/workflows/journey-blueprint-interpreter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EACL,KAAK,cAAc,EAYpB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,QAAQ,EAAE,iBAAiB,EAAiB,MAAM,aAAa,CAAC;AAyB9E,wDAAwD;AACxD,MAAM,MAAM,mBAAmB,GAAG,OAAO,iBAAiB,CAAC,YAAY,CAAC;AAExE;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,mBAAmB,GAAG,WAAW,CAuC1E;AA6CD,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,0DAA0D;IAC1D,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,GAAG,EAAE,cAAc,CAAC;IACpB,EAAE,EAAE,QAAQ,CAAC;CACd;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAiTf;AAuED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,SAAS,CAAC;IACvB,gBAAgB,EAAE,SAAS,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,iBAAiB,EAAE,SAAS,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,2BAA2B;;;;;;kBA8GtC,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in durable campaign / broadcast task (Loops "campaign" parity). A
|
|
3
|
+
* legacy row (NULL `steps`) sends a single template to every subscribed member
|
|
4
|
+
* of a list (or every active member of a bucket). A multi-step row executes
|
|
5
|
+
* its `steps` blob as WAVES — each send step a SET operation over the
|
|
6
|
+
* campaign's anchored cohort, separated by durable waits (status `waiting`,
|
|
7
|
+
* resumed at `nextStepAt`) — see docs/campaign-steps-spec.md §Wave runtime.
|
|
8
|
+
* The task keeps its name and `{ campaignId }` input either way; the row's
|
|
9
|
+
* `currentStep` is the sole resume cursor.
|
|
10
|
+
*
|
|
11
|
+
* Retry-safety: each send carries an idempotency key minted by
|
|
12
|
+
* `campaignSendKey` — legacy `campaign:<id>:<email>` for single-step
|
|
13
|
+
* campaigns, step-scoped `campaign:<id>:<step>:<email>` for EVERY step of a
|
|
14
|
+
* multi-step campaign (email_sends.idempotency_key, migration 0015) — so a
|
|
15
|
+
* Hatchet retry re-runs the wave but every already-dispatched send
|
|
16
|
+
* short-circuits to its prior row instead of dispatching a duplicate provider
|
|
17
|
+
* call. Counts are derived as-you-go from each `send()` result status — which
|
|
18
|
+
* is itself idempotency-aware (a retried send returns the prior row's status),
|
|
19
|
+
* so the tallies stay consistent across re-attempts.
|
|
20
|
+
*
|
|
21
|
+
* Counts across waves: the row counts are CUMULATIVE across waves.
|
|
22
|
+
* `stepBaseCounts` snapshots the cumulative tallies through the last COMPLETED
|
|
23
|
+
* wave (written with each cursor advance); the current wave always re-derives
|
|
24
|
+
* its own tally from scratch on top of that seed, and every flush stays an
|
|
25
|
+
* absolute overwrite — so a retried wave re-tallies exactly rather than
|
|
26
|
+
* double-counting. Prior-wave counts are deliberately NOT derived from
|
|
27
|
+
* `email_sends`: a suppressed send writes its row WITHOUT the idempotency key
|
|
28
|
+
* and a frequency-capped send writes NO row at all, so the ledger cannot
|
|
29
|
+
* reproduce skipped counts — hence the snapshot column.
|
|
30
|
+
*
|
|
31
|
+
* Resume-on-retry: the terminal guard short-circuits ONLY a terminal campaign —
|
|
32
|
+
* a `failed`/`sending` row is NOT terminal, so a Hatchet retry (or the reaper's
|
|
33
|
+
* re-enqueue) re-enters at `currentStep` and re-runs the current wave.
|
|
34
|
+
* Already-dispatched sends no-op via the idempotency key, so the re-run safely
|
|
35
|
+
* completes the TAIL of a partial wave instead of abandoning it. The catch
|
|
36
|
+
* block therefore does NOT stamp `failed` before re-throwing — that would make
|
|
37
|
+
* the retry short-circuit and silently under-deliver. A run that exhausts its
|
|
38
|
+
* retries is reaped to `failed`/re-enqueued by {@link reapStuckCampaignsTask}.
|
|
39
|
+
*/
|
|
40
|
+
export declare const sendCampaignTask: import("@hatchet-dev/typescript-sdk/index.js").TaskWorkflowDeclaration<{
|
|
41
|
+
campaignId: string;
|
|
42
|
+
}, {
|
|
43
|
+
status: string;
|
|
44
|
+
reason: "not_found";
|
|
45
|
+
skipped?: undefined;
|
|
46
|
+
currentStep?: undefined;
|
|
47
|
+
nextStepAt?: undefined;
|
|
48
|
+
totalRecipients?: undefined;
|
|
49
|
+
sentCount?: undefined;
|
|
50
|
+
skippedCount?: undefined;
|
|
51
|
+
failedCount?: undefined;
|
|
52
|
+
} | {
|
|
53
|
+
status: string;
|
|
54
|
+
skipped: true;
|
|
55
|
+
reason?: undefined;
|
|
56
|
+
currentStep?: undefined;
|
|
57
|
+
nextStepAt?: undefined;
|
|
58
|
+
totalRecipients?: undefined;
|
|
59
|
+
sentCount?: undefined;
|
|
60
|
+
skippedCount?: undefined;
|
|
61
|
+
failedCount?: undefined;
|
|
62
|
+
} | {
|
|
63
|
+
status: string;
|
|
64
|
+
skipped: true;
|
|
65
|
+
reason: "not_due";
|
|
66
|
+
currentStep?: undefined;
|
|
67
|
+
nextStepAt?: undefined;
|
|
68
|
+
totalRecipients?: undefined;
|
|
69
|
+
sentCount?: undefined;
|
|
70
|
+
skippedCount?: undefined;
|
|
71
|
+
failedCount?: undefined;
|
|
72
|
+
} | {
|
|
73
|
+
status: "waiting";
|
|
74
|
+
currentStep: number;
|
|
75
|
+
nextStepAt: string;
|
|
76
|
+
totalRecipients: number;
|
|
77
|
+
sentCount: number;
|
|
78
|
+
skippedCount: number;
|
|
79
|
+
failedCount: number;
|
|
80
|
+
reason?: undefined;
|
|
81
|
+
skipped?: undefined;
|
|
82
|
+
} | {
|
|
83
|
+
status: string;
|
|
84
|
+
totalRecipients: number;
|
|
85
|
+
sentCount: number;
|
|
86
|
+
skippedCount: number;
|
|
87
|
+
failedCount: number;
|
|
88
|
+
reason?: undefined;
|
|
89
|
+
skipped?: undefined;
|
|
90
|
+
currentStep?: undefined;
|
|
91
|
+
nextStepAt?: undefined;
|
|
92
|
+
}, {}, {}, {}, {}>;
|
|
93
|
+
/**
|
|
94
|
+
* Engine-owned reaper cron for campaigns left in a non-terminal in-flight state
|
|
95
|
+
* with no live run to finish them (closes the "stuck forever" gap):
|
|
96
|
+
*
|
|
97
|
+
* - A `sending` campaign whose worker was hard-killed (OOM/SIGKILL/pod
|
|
98
|
+
* eviction) or whose run exceeded `executionTimeout` AFTER its retry — the JS
|
|
99
|
+
* catch never ran, so the row is stuck `sending` with no live run.
|
|
100
|
+
* - A `queued` campaign whose enqueue threw at create time (broker down /
|
|
101
|
+
* network) — the row was committed but no run was ever created (orphan).
|
|
102
|
+
* - A `scheduled` campaign whose punctual Hatchet scheduled run never fired
|
|
103
|
+
* (schedule-create failed at POST/reconcile time, or the run was lost) —
|
|
104
|
+
* promoted once `scheduledAt` is {@link SCHEDULE_PROMOTE_GRACE_MS} past
|
|
105
|
+
* due. A scheduled row stuck past the give-up window (measured from
|
|
106
|
+
* `scheduledAt`, NOT `updatedAt` — a row is legitimately idle between
|
|
107
|
+
* create and send time) is declared `failed`.
|
|
108
|
+
* - A `waiting` campaign whose punctual next-step run was lost — promoted
|
|
109
|
+
* once `nextStepAt` is past the same grace. Give-up is likewise measured
|
|
110
|
+
* from `nextStepAt`, NOT `updatedAt` — a row is legitimately idle mid-wait,
|
|
111
|
+
* exactly like `scheduled`/`scheduledAt`.
|
|
112
|
+
*
|
|
113
|
+
* Recovery is a simple RE-ENQUEUE of `sendCampaignTask` (safe: the per-send
|
|
114
|
+
* idempotency key no-ops already-sent recipients and the re-run completes the
|
|
115
|
+
* unsent tail). A campaign that stays stuck past `GIVE_UP_AFTER_MS` is declared
|
|
116
|
+
* `failed` so it stops being re-driven and surfaces to operators.
|
|
117
|
+
*
|
|
118
|
+
* Self-bootstraps `db` (memoized `getDb()` singleton) / `logger` from
|
|
119
|
+
* `process.env` (cron runs have no request container), cloned from
|
|
120
|
+
* `bucket-reconcile.ts`. NON-cancelling single-flight concurrency so an
|
|
121
|
+
* overrunning sweep finishes rather than being cancelled.
|
|
122
|
+
*/
|
|
123
|
+
export declare const reapStuckCampaignsTask: import("@hatchet-dev/typescript-sdk/index.js").TaskWorkflowDeclaration<import("@hatchet-dev/typescript-sdk/index.js").UnknownInputType, {
|
|
124
|
+
failed: number;
|
|
125
|
+
reEnqueued: number;
|
|
126
|
+
promoted: number;
|
|
127
|
+
}, {}, {}, {}, {}>;
|
|
128
|
+
//# sourceMappingURL=send-campaign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-campaign.d.ts","sourceRoot":"","sources":["../../src/workflows/send-campaign.ts"],"names":[],"mappings":"AAyDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,gBAAgB;gBAOK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA0hBtC,CAAC;AA2CH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,sBAAsB;;;;kBAwHjC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const sendEmailTask: import("@hatchet-dev/typescript-sdk/v1").TaskWorkflowDeclaration<{
|
|
2
|
+
to: string;
|
|
3
|
+
subject: string;
|
|
4
|
+
html: string;
|
|
5
|
+
from?: string;
|
|
6
|
+
replyTo?: string;
|
|
7
|
+
tags?: Array<{
|
|
8
|
+
name: string;
|
|
9
|
+
value: string;
|
|
10
|
+
}>;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
}, {
|
|
13
|
+
emailId: string;
|
|
14
|
+
}, {}, {}, {}, {}>;
|
|
15
|
+
//# sourceMappingURL=send-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-email.d.ts","sourceRoot":"","sources":["../../src/workflows/send-email.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;QAWlB,MAAM;aACD,MAAM;UACT,MAAM;WACL,MAAM;cACH,MAAM;WACT,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;cACnC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;kBAkClC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { JsonValue } from "@hatchet-dev/typescript-sdk/v1/types.js";
|
|
2
|
+
import type { FeedBlock } from "@hogsend/db";
|
|
3
|
+
/**
|
|
4
|
+
* JSON-serializable input for the `send-feed` task. Mirrors the journey task
|
|
5
|
+
* convention (explicit fields + a `[key: string]: JsonValue` index signature) so
|
|
6
|
+
* Hatchet's `JsonObject` constraint is satisfied; the fn re-narrows it to the
|
|
7
|
+
* structured {@link SendFeedItemOptions} at the boundary.
|
|
8
|
+
*/
|
|
9
|
+
interface SendFeedTaskInput {
|
|
10
|
+
recipient: {
|
|
11
|
+
userId?: string;
|
|
12
|
+
email?: string;
|
|
13
|
+
anonymousId?: string;
|
|
14
|
+
};
|
|
15
|
+
type: string;
|
|
16
|
+
title?: string;
|
|
17
|
+
body?: string;
|
|
18
|
+
blocks?: FeedBlock[];
|
|
19
|
+
actionUrl?: string;
|
|
20
|
+
metadata?: Record<string, JsonValue>;
|
|
21
|
+
category?: string;
|
|
22
|
+
templateKey?: string;
|
|
23
|
+
journeyStateId?: string;
|
|
24
|
+
idempotencyKey?: string;
|
|
25
|
+
[key: string]: JsonValue | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Durable wrapper around {@link sendFeedItem} — the in-app-feed sibling of the
|
|
29
|
+
* `send-email` task. `sendFeedItem` owns recipient resolution, `in_app`
|
|
30
|
+
* suppression, the replay-safe idempotency key, and the Redis publish.
|
|
31
|
+
*/
|
|
32
|
+
export declare const sendFeedTask: import("@hatchet-dev/typescript-sdk/index.js").TaskWorkflowDeclaration<SendFeedTaskInput, {
|
|
33
|
+
feedItemId: string | null;
|
|
34
|
+
suppressed: boolean;
|
|
35
|
+
}, {}, {}, {}, {}>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=send-feed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-feed.d.ts","sourceRoot":"","sources":["../../src/workflows/send-feed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAI7C;;;;;GAKG;AACH,UAAU,iBAAiB;IACzB,SAAS,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACtC;AAED;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;kBAYvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hogsend/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.68.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -9,20 +9,57 @@
|
|
|
9
9
|
"directory": "packages/engine"
|
|
10
10
|
},
|
|
11
11
|
"main": "./src/index.ts",
|
|
12
|
-
"types": "./
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
13
|
"exports": {
|
|
14
|
-
".":
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"./
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
".": {
|
|
15
|
+
"@hogsend/source": "./src/index.ts",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./src/index.ts"
|
|
18
|
+
},
|
|
19
|
+
"./worker": {
|
|
20
|
+
"@hogsend/source": "./src/worker.ts",
|
|
21
|
+
"types": "./dist/worker.d.ts",
|
|
22
|
+
"default": "./src/worker.ts"
|
|
23
|
+
},
|
|
24
|
+
"./auth": {
|
|
25
|
+
"@hogsend/source": "./src/lib/auth.ts",
|
|
26
|
+
"types": "./dist/lib/auth.d.ts",
|
|
27
|
+
"default": "./src/lib/auth.ts"
|
|
28
|
+
},
|
|
29
|
+
"./create-admin": {
|
|
30
|
+
"@hogsend/source": "./src/lib/create-admin.ts",
|
|
31
|
+
"types": "./dist/lib/create-admin.d.ts",
|
|
32
|
+
"default": "./src/lib/create-admin.ts"
|
|
33
|
+
},
|
|
34
|
+
"./api-key-hash": {
|
|
35
|
+
"@hogsend/source": "./src/lib/api-key-hash.ts",
|
|
36
|
+
"types": "./dist/lib/api-key-hash.d.ts",
|
|
37
|
+
"default": "./src/lib/api-key-hash.ts"
|
|
38
|
+
},
|
|
39
|
+
"./posthog-scopes": {
|
|
40
|
+
"@hogsend/source": "./src/lib/posthog-scopes.ts",
|
|
41
|
+
"types": "./dist/lib/posthog-scopes.d.ts",
|
|
42
|
+
"default": "./src/lib/posthog-scopes.ts"
|
|
43
|
+
},
|
|
44
|
+
"./journeys": {
|
|
45
|
+
"@hogsend/source": "./src/journeys/authoring.ts",
|
|
46
|
+
"types": "./dist/journeys/authoring.d.ts",
|
|
47
|
+
"default": "./src/journeys/authoring.ts"
|
|
48
|
+
},
|
|
49
|
+
"./testing": {
|
|
50
|
+
"@hogsend/source": "./src/testing.ts",
|
|
51
|
+
"types": "./dist/testing.d.ts",
|
|
52
|
+
"default": "./src/testing.ts"
|
|
53
|
+
},
|
|
54
|
+
"./mcp/authoring-guide": {
|
|
55
|
+
"@hogsend/source": "./src/mcp/authoring-guide.ts",
|
|
56
|
+
"types": "./dist/mcp/authoring-guide.d.ts",
|
|
57
|
+
"default": "./src/mcp/authoring-guide.ts"
|
|
58
|
+
},
|
|
23
59
|
"./package.json": "./package.json"
|
|
24
60
|
},
|
|
25
61
|
"files": [
|
|
62
|
+
"dist",
|
|
26
63
|
"src",
|
|
27
64
|
"README.md"
|
|
28
65
|
],
|
|
@@ -53,19 +90,19 @@
|
|
|
53
90
|
"svix": "^1.95.1",
|
|
54
91
|
"winston": "^3.19.0",
|
|
55
92
|
"zod": "^4.4.3",
|
|
56
|
-
"@hogsend/attribution": "^0.
|
|
57
|
-
"@hogsend/core": "^0.
|
|
58
|
-
"@hogsend/db": "^0.
|
|
59
|
-
"@hogsend/email": "^0.
|
|
60
|
-
"@hogsend/plugin-posthog": "^0.
|
|
61
|
-
"@hogsend/plugin-resend": "^0.
|
|
62
|
-
"@hogsend/sms": "^0.
|
|
93
|
+
"@hogsend/attribution": "^0.68.0",
|
|
94
|
+
"@hogsend/core": "^0.68.0",
|
|
95
|
+
"@hogsend/db": "^0.68.0",
|
|
96
|
+
"@hogsend/email": "^0.68.0",
|
|
97
|
+
"@hogsend/plugin-posthog": "^0.68.0",
|
|
98
|
+
"@hogsend/plugin-resend": "^0.68.0",
|
|
99
|
+
"@hogsend/sms": "^0.68.0"
|
|
63
100
|
},
|
|
64
101
|
"optionalDependencies": {
|
|
65
|
-
"@hogsend/plugin-apollo": "^0.
|
|
66
|
-
"@hogsend/plugin-hogsend": "^0.
|
|
67
|
-
"@hogsend/plugin-postmark": "^0.
|
|
68
|
-
"@hogsend/plugin-twilio": "^0.
|
|
102
|
+
"@hogsend/plugin-apollo": "^0.68.0",
|
|
103
|
+
"@hogsend/plugin-hogsend": "^0.68.0",
|
|
104
|
+
"@hogsend/plugin-postmark": "^0.68.0",
|
|
105
|
+
"@hogsend/plugin-twilio": "^0.68.0"
|
|
69
106
|
},
|
|
70
107
|
"devDependencies": {
|
|
71
108
|
"@types/node": "^22.15.3",
|
|
@@ -76,6 +113,7 @@
|
|
|
76
113
|
"node": ">=22"
|
|
77
114
|
},
|
|
78
115
|
"scripts": {
|
|
116
|
+
"build": "tsc -p tsconfig.build.json",
|
|
79
117
|
"check-types": "tsc --noEmit",
|
|
80
118
|
"test": "tsx --test 'src/**/*.test.ts'",
|
|
81
119
|
"lint": "biome check .",
|
package/src/app.ts
CHANGED
|
@@ -13,7 +13,11 @@ import type { Auth } from "./lib/auth.js";
|
|
|
13
13
|
import { mountStudio } from "./lib/studio.js";
|
|
14
14
|
import type { ApiKeyContext } from "./middleware/api-key.js";
|
|
15
15
|
import { errorHandler } from "./middleware/error-handler.js";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
clientIpKey,
|
|
18
|
+
createRateLimit,
|
|
19
|
+
RATE_LIMIT_HEADERS,
|
|
20
|
+
} from "./middleware/rate-limit.js";
|
|
17
21
|
import { requestLogger } from "./middleware/request-logger.js";
|
|
18
22
|
import { registerRoutes } from "./routes/index.js";
|
|
19
23
|
import { SNIPPET_PATH } from "./routes/snippet.js";
|
|
@@ -105,6 +109,10 @@ export function createApp(
|
|
|
105
109
|
// header-bearer, not cookie-auth), so reflecting the Origin does not widen
|
|
106
110
|
// credentialed/cookie exposure.
|
|
107
111
|
origin: (origin) => origin ?? "*",
|
|
112
|
+
// Let browser code read the rate-limit headers. None is CORS-safelisted,
|
|
113
|
+
// so without this `@hogsend/js` sees a 429 but no `Retry-After` (its
|
|
114
|
+
// `RateLimitError.retryAfter` stays undefined) and no `RateLimit-*`.
|
|
115
|
+
exposeHeaders: [...RATE_LIMIT_HEADERS],
|
|
108
116
|
}),
|
|
109
117
|
);
|
|
110
118
|
app.use("*", compress());
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "@hogsend/core";
|
|
9
9
|
import type { JourneyRegistry } from "@hogsend/core/registry";
|
|
10
10
|
import { bucketMemberships, contacts, type Database } from "@hogsend/db";
|
|
11
|
-
import { and, desc, eq, isNotNull, isNull } from "drizzle-orm";
|
|
11
|
+
import { and, desc, eq, inArray, isNotNull, isNull } from "drizzle-orm";
|
|
12
12
|
import { emitBucketTransition } from "../lib/bucket-emit.js";
|
|
13
13
|
import {
|
|
14
14
|
contactKeySql,
|
|
@@ -26,6 +26,9 @@ import { getBucketRegistrySingleton } from "./registry-singleton.js";
|
|
|
26
26
|
|
|
27
27
|
export type BucketTransitionKind = "entered" | "left";
|
|
28
28
|
|
|
29
|
+
/** A stable member's `last_evaluated_at` is rewritten at most once a minute. */
|
|
30
|
+
const LAST_EVALUATED_BUMP_MS = 60_000;
|
|
31
|
+
|
|
29
32
|
export interface BucketTransition {
|
|
30
33
|
bucketId: string;
|
|
31
34
|
transition: BucketTransitionKind;
|
|
@@ -216,7 +219,13 @@ export async function checkBucketMembership(opts: {
|
|
|
216
219
|
// it returns null for exactly the soft-deleted contact that failure (2)
|
|
217
220
|
// above is about. Stopping at the null would leave `contactDeleted` false
|
|
218
221
|
// and silently re-open the GDPR guard for the rows it exists to protect.
|
|
219
|
-
|
|
222
|
+
//
|
|
223
|
+
// PRD 09 part B — when `ingestEvent` hands us the contact id it just
|
|
224
|
+
// resolved, read by that id directly: it is the alias-resolved survivor
|
|
225
|
+
// already, so the extra `lookupContactIdByKey` round trip would only
|
|
226
|
+
// re-derive it. The select still returns `deletedAt`, so the GDPR guard
|
|
227
|
+
// below holds for the pinned path too.
|
|
228
|
+
const resolvedId = contactId ?? (await lookupContactIdByKey(db, userId));
|
|
220
229
|
const [contact] = await db
|
|
221
230
|
.select({
|
|
222
231
|
properties: contacts.properties,
|
|
@@ -249,26 +258,43 @@ export async function checkBucketMembership(opts: {
|
|
|
249
258
|
|
|
250
259
|
const transitions: BucketTransition[] = [];
|
|
251
260
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
// wasMember — current active, non-deleted membership rows (cheap pre-filter;
|
|
262
|
+
// the authoritative guard is the RETURNING-gated mutation below). Read by
|
|
263
|
+
// SUBJECT: a membership adopted onto this contact under a since-stale key
|
|
264
|
+
// is invisible to a `user_id` probe, and missing it re-runs the JOIN path,
|
|
265
|
+
// which then loses the arbiter-less race and no-ops — a member who silently
|
|
266
|
+
// never re-emits and never leaves.
|
|
267
|
+
//
|
|
268
|
+
// PRD 09 part B — one `bucket_id IN (...)` read for every candidate instead
|
|
269
|
+
// of one probe per bucket. The first row per bucket wins, as `findFirst` did.
|
|
270
|
+
const activeRows = await db
|
|
271
|
+
.select()
|
|
272
|
+
.from(bucketMemberships)
|
|
273
|
+
.where(
|
|
274
|
+
and(
|
|
263
275
|
bySubject(bucketMemberships, {
|
|
264
276
|
contactId: contactId ?? null,
|
|
265
277
|
userKey: userId,
|
|
266
278
|
}),
|
|
267
|
-
|
|
279
|
+
inArray(
|
|
280
|
+
bucketMemberships.bucketId,
|
|
281
|
+
candidates.map((bucket) => bucket.id),
|
|
282
|
+
),
|
|
268
283
|
eq(bucketMemberships.status, "active"),
|
|
269
284
|
isNull(bucketMemberships.deletedAt),
|
|
270
285
|
),
|
|
271
|
-
|
|
286
|
+
);
|
|
287
|
+
const activeByBucket = new Map<string, (typeof activeRows)[number]>();
|
|
288
|
+
for (const row of activeRows) {
|
|
289
|
+
if (!activeByBucket.has(row.bucketId))
|
|
290
|
+
activeByBucket.set(row.bucketId, row);
|
|
291
|
+
}
|
|
292
|
+
const bumpBefore = Date.now() - LAST_EVALUATED_BUMP_MS;
|
|
293
|
+
|
|
294
|
+
for (const bucket of candidates) {
|
|
295
|
+
if (!bucket.criteria) continue;
|
|
296
|
+
|
|
297
|
+
const active = activeByBucket.get(bucket.id);
|
|
272
298
|
const wasMember = !!active;
|
|
273
299
|
|
|
274
300
|
// isMember — the criteria evaluation. event/count sub-conditions read
|
|
@@ -303,11 +329,19 @@ export async function checkBucketMembership(opts: {
|
|
|
303
329
|
});
|
|
304
330
|
if (transition) transitions.push(transition);
|
|
305
331
|
} else if (wasMember && isMember) {
|
|
306
|
-
// stable member → no transition, no emit. Cheap observability bump
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
332
|
+
// stable member → no transition, no emit. Cheap observability bump,
|
|
333
|
+
// skipped when the row was evaluated within the last minute: a busy
|
|
334
|
+
// member would otherwise write this row on every event. The reconcile
|
|
335
|
+
// cron orders by this column, so a minute of staleness only nudges it.
|
|
336
|
+
if (
|
|
337
|
+
active.lastEvaluatedAt == null ||
|
|
338
|
+
active.lastEvaluatedAt.getTime() < bumpBefore
|
|
339
|
+
) {
|
|
340
|
+
await db
|
|
341
|
+
.update(bucketMemberships)
|
|
342
|
+
.set({ lastEvaluatedAt: new Date() })
|
|
343
|
+
.where(eq(bucketMemberships.id, active.id));
|
|
344
|
+
}
|
|
311
345
|
} else if (wasMember && !isMember) {
|
|
312
346
|
const transition = await handleLeave({
|
|
313
347
|
db,
|
package/src/env.ts
CHANGED
|
@@ -368,6 +368,27 @@ export const env = createEnv({
|
|
|
368
368
|
* HOGSEND_TEST_MODE precedent). Unset ⇒ "false" ⇒ behavior unchanged.
|
|
369
369
|
*/
|
|
370
370
|
HOGSEND_INGEST_SUSPENDED: z.enum(["true", "false"]).default("false"),
|
|
371
|
+
// --- Data-plane rate limits (middleware/rate-limit.ts) ---
|
|
372
|
+
// Sliding-window budgets on the data plane. All optional: unset falls back
|
|
373
|
+
// to the defaults in `middleware/rate-limit.ts`, the single source for the
|
|
374
|
+
// numbers (the OUTBOUND_WEBHOOK_* stance).
|
|
375
|
+
//
|
|
376
|
+
// The browser-reachable ingest routes (everything behind
|
|
377
|
+
// `requirePublishableOrIngest`: `/v1/events`, the `/v1/contacts` upsert,
|
|
378
|
+
// `/v1/contacts/me`, `/v1/lists*`, `/v1/feed*`, `/v1/flags`, and the
|
|
379
|
+
// `/me` reads of accounts and referrals) carry two budgets that share one
|
|
380
|
+
// window:
|
|
381
|
+
// - INGEST_RATE_LIMIT_MAX: per SECRET key (default 3000).
|
|
382
|
+
// - INGEST_PUBLIC_RATE_LIMIT_MAX: per PUBLISHABLE key per client IP
|
|
383
|
+
// (default 1000). A pk_ key is shared by every visitor of a site, so
|
|
384
|
+
// its budget is per visitor, not per key.
|
|
385
|
+
// - INGEST_RATE_LIMIT_WINDOW_MS: the window (default 60000).
|
|
386
|
+
INGEST_RATE_LIMIT_MAX: z.coerce.number().int().positive().optional(),
|
|
387
|
+
INGEST_PUBLIC_RATE_LIMIT_MAX: z.coerce.number().int().positive().optional(),
|
|
388
|
+
INGEST_RATE_LIMIT_WINDOW_MS: z.coerce.number().int().positive().optional(),
|
|
389
|
+
// Per-key budget on `/v1/emails` (transactional sends), separate from the
|
|
390
|
+
// ingest budgets above. Per minute, default 30.
|
|
391
|
+
EMAIL_RATE_LIMIT_MAX: z.coerce.number().int().positive().optional(),
|
|
371
392
|
ENABLED_JOURNEYS: z.string().default("*"),
|
|
372
393
|
// Buckets: same `"*"`-or-csv contract as ENABLED_JOURNEYS (Section 9.3).
|
|
373
394
|
// Evaluated at worker boot — a toggle requires a worker restart; only the
|
|
@@ -400,6 +421,15 @@ export const env = createEnv({
|
|
|
400
421
|
OUTBOUND_WEBHOOK_BASE_DELAY_MS: z.coerce.number().optional(),
|
|
401
422
|
OUTBOUND_WEBHOOK_MAX_DELAY_MS: z.coerce.number().optional(),
|
|
402
423
|
OUTBOUND_WEBHOOK_STUCK_AFTER_MS: z.coerce.number().optional(),
|
|
424
|
+
// How long the outbound spine reuses its list of enabled endpoints before
|
|
425
|
+
// re-reading `webhook_endpoints` (lib/outbound-endpoint-cache.ts). Read raw
|
|
426
|
+
// off process.env at emit time; default 30000, 0 disables the cache. The
|
|
427
|
+
// admin webhook routes clear it on the instance that handled the write.
|
|
428
|
+
OUTBOUND_ENDPOINT_CACHE_TTL_MS: z.coerce
|
|
429
|
+
.number()
|
|
430
|
+
.int()
|
|
431
|
+
.nonnegative()
|
|
432
|
+
.optional(),
|
|
403
433
|
// --- Integration presets (Section 2.2) ---
|
|
404
434
|
// Signature-source secrets. The webhook route resolves a preset's secret via
|
|
405
435
|
// env[source.auth.envKey]; a signature source FAILS CLOSED when its secret is
|
|
@@ -45,16 +45,33 @@ export interface LogTransitionArgs {
|
|
|
45
45
|
* Do NOT attempt to dedupe log rows.
|
|
46
46
|
*/
|
|
47
47
|
export function logTransition(args: LogTransitionArgs): void {
|
|
48
|
+
const { db, ...row } = args;
|
|
49
|
+
logTransitions(db, [row]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* `logTransition` for many states at once: one multi-row insert, with the same
|
|
54
|
+
* fire-and-forget, never-throws contract. Used where a single event moves a
|
|
55
|
+
* batch of states (an exit fan-out), so the log costs one statement instead of
|
|
56
|
+
* one per state.
|
|
57
|
+
*/
|
|
58
|
+
export function logTransitions(
|
|
59
|
+
db: Database,
|
|
60
|
+
rows: ReadonlyArray<Omit<LogTransitionArgs, "db">>,
|
|
61
|
+
): void {
|
|
62
|
+
if (rows.length === 0) return;
|
|
48
63
|
try {
|
|
49
|
-
void
|
|
64
|
+
void db
|
|
50
65
|
.insert(journeyLogs)
|
|
51
|
-
.values(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
.values(
|
|
67
|
+
rows.map((row) => ({
|
|
68
|
+
journeyStateId: row.journeyStateId,
|
|
69
|
+
fromNodeId: row.from ?? null,
|
|
70
|
+
toNodeId: row.to ?? null,
|
|
71
|
+
action: row.action,
|
|
72
|
+
detail: row.detail ?? null,
|
|
73
|
+
})),
|
|
74
|
+
)
|
|
58
75
|
.catch(() => {
|
|
59
76
|
// best-effort timeline write — never surface into journey execution
|
|
60
77
|
});
|