@hogsend/engine 0.66.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/container.ts +77 -0
- package/src/env.ts +30 -0
- package/src/index.ts +78 -0
- package/src/journeys/journey-log.ts +25 -8
- package/src/lib/contacts.ts +117 -1
- package/src/lib/email-service-types.ts +10 -0
- package/src/lib/ingestion.ts +91 -19
- package/src/lib/links.ts +94 -11
- 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 +150 -37
- package/src/lib/referral-intent.ts +723 -0
- package/src/lib/referral-link.ts +200 -0
- package/src/lib/referral-registry.ts +83 -0
- package/src/lib/referral-report.ts +739 -0
- package/src/lib/referral-runtime.ts +49 -0
- package/src/lib/referrals-no-emit.test.ts +109 -0
- package/src/lib/referrals.ts +712 -0
- 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/lib/webhook-signing.ts +10 -0
- 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 +153 -0
- package/src/routes/admin/index.ts +2 -0
- package/src/routes/admin/links.ts +14 -5
- package/src/routes/admin/referrals.ts +565 -0
- package/src/routes/admin/targeting.ts +6 -1
- package/src/routes/admin/webhooks.ts +4 -0
- package/src/routes/contacts/index.ts +78 -0
- package/src/routes/index.ts +104 -22
- package/src/routes/referrals/index.ts +41 -0
- package/src/routes/referrals/me.ts +123 -0
- package/src/routes/referrals/report.ts +285 -0
- package/src/routes/referrals/shared.ts +34 -0
- package/src/routes/referrals/touch.ts +313 -0
- package/src/routes/tracking/arrive.ts +90 -0
- package/src/routes/tracking/click-pipeline.ts +8 -0
- 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,236 @@
|
|
|
1
|
+
import type { EnrichmentProvider } from "@hogsend/core";
|
|
2
|
+
import type { EnrichmentLookupKind, EnrichmentLookupStatus } from "./enrichment-ledger.js";
|
|
3
|
+
export interface RefineContactOptions {
|
|
4
|
+
/** The contact's canonical key (`external_id ?? anonymous_id ?? id`). */
|
|
5
|
+
userId?: string;
|
|
6
|
+
email?: string;
|
|
7
|
+
/** The contact row id — the unforgeable, engine-internal pin. */
|
|
8
|
+
contactId?: string;
|
|
9
|
+
/** Override the container's active enrichment provider by registry id. */
|
|
10
|
+
provider?: string;
|
|
11
|
+
/** Bypass the TTL + negative cache. Does NOT bypass the budget cap. */
|
|
12
|
+
force?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Disambiguates the replay key when two refine sites in one journey share a
|
|
15
|
+
* nearest wait label. Mirrors `sendEmail`/`sendSms`/`sendConnectorAction`.
|
|
16
|
+
*/
|
|
17
|
+
idempotencyLabel?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface RefineContactResult {
|
|
20
|
+
status: "refined" | "cached" | "not_found" | "skipped";
|
|
21
|
+
/**
|
|
22
|
+
* Present on `skipped` — `no_lookup_key` | `no_provider` | `budget_exceeded`
|
|
23
|
+
* | `provider_error` | `ingest_failed`.
|
|
24
|
+
*/
|
|
25
|
+
reason?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The vendor's FULL canonical trait patch (facts + the nested `enrichment`
|
|
28
|
+
* provenance) — on `refined` AND on `cached`. This is what the vendor
|
|
29
|
+
* answered, NOT the fill-if-absent subset that actually landed on any one
|
|
30
|
+
* contact.
|
|
31
|
+
*/
|
|
32
|
+
properties?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
/** The refinement subject, resolved INSIDE the durable memo. */
|
|
35
|
+
export interface RefineTarget {
|
|
36
|
+
/** `contacts.id`, when a row exists. */
|
|
37
|
+
contactId?: string;
|
|
38
|
+
/** Canonical contact key, used as the ingest `userId`. */
|
|
39
|
+
userId?: string;
|
|
40
|
+
email?: string;
|
|
41
|
+
/** Company domain, when the contact carries one and has no email. */
|
|
42
|
+
domain?: string;
|
|
43
|
+
firstName?: string;
|
|
44
|
+
lastName?: string;
|
|
45
|
+
company?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The properties already on THIS contact's row, used by fill-if-absent to
|
|
48
|
+
* decide which vendor facts to keep (a fact the contact already holds from a
|
|
49
|
+
* first-party source is never overwritten). Absent for a brand-new email with
|
|
50
|
+
* no row yet — nothing to preserve, so every vendor fact lands.
|
|
51
|
+
*/
|
|
52
|
+
existingProperties?: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
/** The event the refinement pipeline emits through `ingestEvent`. */
|
|
55
|
+
export declare const REFINE_EVENT = "contact.refined";
|
|
56
|
+
export interface RefineIngestInput {
|
|
57
|
+
userId?: string;
|
|
58
|
+
email?: string;
|
|
59
|
+
contactId?: string;
|
|
60
|
+
eventProperties: Record<string, unknown>;
|
|
61
|
+
contactProperties: Record<string, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* Fact key NAMES to re-evaluate buckets for even when their value is not in
|
|
64
|
+
* `contactProperties` (fill-if-absent dropped it). Candidate-narrowing only —
|
|
65
|
+
* never written, never in value eval. See {@link reconcileTraits}.
|
|
66
|
+
*/
|
|
67
|
+
touchProperties?: string[];
|
|
68
|
+
idempotencyKey?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* What the outbound `contact.refined` emit needs. Handed to
|
|
72
|
+
* {@link RefineChainDeps.emitRefined} on a GENUINE refinement and nothing else.
|
|
73
|
+
*
|
|
74
|
+
* `traitKeys` are the mapped trait NAMES, never their values — the payload says
|
|
75
|
+
* what changed and a subscriber that wants the values reads the contact.
|
|
76
|
+
*/
|
|
77
|
+
export interface RefineEmitInput {
|
|
78
|
+
/** The canonical contact key the traits landed under. */
|
|
79
|
+
userId?: string;
|
|
80
|
+
email?: string;
|
|
81
|
+
contactId?: string;
|
|
82
|
+
/** The enrichment provider id that answered. */
|
|
83
|
+
provider: string;
|
|
84
|
+
/** Sorted canonical FACT keys actually filled on this contact (never the
|
|
85
|
+
* nested `enrichment` provenance key). */
|
|
86
|
+
traitKeys: string[];
|
|
87
|
+
/** The lookup instant — the same value the patch's `enrichment.at` carries. */
|
|
88
|
+
refinedAt: Date;
|
|
89
|
+
/** Per-endpoint delivery dedupe — see {@link refineOutboundDedupeKey}. */
|
|
90
|
+
dedupeKey: string;
|
|
91
|
+
}
|
|
92
|
+
/** What the ledger gate needs to know about a prior lookup. */
|
|
93
|
+
export interface RefineLedgerRow {
|
|
94
|
+
status: EnrichmentLookupStatus;
|
|
95
|
+
expiresAt: Date;
|
|
96
|
+
/**
|
|
97
|
+
* The normalized canonical trait patch the paid answer produced, if stored —
|
|
98
|
+
* the vendor's FULL answer, so a cache hit can land it (fill-if-absent) on a
|
|
99
|
+
* DIFFERENT contact that shares the lookup key.
|
|
100
|
+
*/
|
|
101
|
+
traits?: Record<string, unknown> | null;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Everything stateful the chain touches, injected. Two reasons this is a seam
|
|
105
|
+
* rather than direct imports: `refineContact` must reach `ingestEvent` (which
|
|
106
|
+
* needs the db/registry/hatchet/logger singletons) from a STANDALONE call site,
|
|
107
|
+
* and the positional-journal law (AC 11) has to be provable by a pure test with
|
|
108
|
+
* no database and no Hatchet client.
|
|
109
|
+
*/
|
|
110
|
+
export interface RefineChainDeps {
|
|
111
|
+
/** The resolved ACTIVE provider, or undefined when none is configured. */
|
|
112
|
+
provider?: EnrichmentProvider;
|
|
113
|
+
/** The active provider's `meta.id` — what the ledger rows are keyed by. */
|
|
114
|
+
providerId?: string;
|
|
115
|
+
/** `ENRICHMENT_TTL_DAYS`. */
|
|
116
|
+
ttlDays: number;
|
|
117
|
+
/** `ENRICHMENT_MONTHLY_LOOKUPS`; 0 = uncapped. */
|
|
118
|
+
monthlyCap: number;
|
|
119
|
+
now: () => Date;
|
|
120
|
+
logger: {
|
|
121
|
+
info(message: string, meta?: Record<string, unknown>): void;
|
|
122
|
+
warn(message: string, meta?: Record<string, unknown>): void;
|
|
123
|
+
error(message: string, meta?: Record<string, unknown>): void;
|
|
124
|
+
};
|
|
125
|
+
resolveTarget(opts: RefineContactOptions): Promise<RefineTarget | null>;
|
|
126
|
+
findLedgerRow(input: {
|
|
127
|
+
provider: string;
|
|
128
|
+
lookupKind: EnrichmentLookupKind;
|
|
129
|
+
lookupKey: string;
|
|
130
|
+
}): Promise<RefineLedgerRow | null>;
|
|
131
|
+
/** Provider CALLS charged to the window starting at `since`. */
|
|
132
|
+
countLookupsSince(input: {
|
|
133
|
+
since: Date;
|
|
134
|
+
}): Promise<number>;
|
|
135
|
+
writeLedgerRow(input: {
|
|
136
|
+
provider: string;
|
|
137
|
+
lookupKind: EnrichmentLookupKind;
|
|
138
|
+
lookupKey: string;
|
|
139
|
+
status: EnrichmentLookupStatus;
|
|
140
|
+
contactId?: string | null;
|
|
141
|
+
refinedAt: Date;
|
|
142
|
+
expiresAt: Date;
|
|
143
|
+
raw?: unknown;
|
|
144
|
+
traits?: Record<string, unknown> | null;
|
|
145
|
+
spendWindow: Date;
|
|
146
|
+
}): Promise<void>;
|
|
147
|
+
ingest(input: RefineIngestInput): Promise<void>;
|
|
148
|
+
/** First instant of the budget window containing `at` (UTC calendar month). */
|
|
149
|
+
budgetWindowStart(at: Date): Date;
|
|
150
|
+
/**
|
|
151
|
+
* Fire-and-forget outbound `contact.refined` emit. SYNCHRONOUS and
|
|
152
|
+
* `void`-returning by contract: the chain must not await it, so an outbound
|
|
153
|
+
* problem can never slow or fail a refinement. Optional — a caller with no
|
|
154
|
+
* db/hatchet (a test, a pure driver) omits it and the chain is unchanged.
|
|
155
|
+
*/
|
|
156
|
+
emitRefined?(input: RefineEmitInput): void;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The refinement gate chain, in its fixed order.
|
|
160
|
+
*
|
|
161
|
+
* THE LAW (the single thing this file exists to get right): the Hatchet journal
|
|
162
|
+
* is POSITIONAL, and `boundary.memoize` is a durable call, so its ISSUANCE must
|
|
163
|
+
* never be conditional on a live DB read, and its KEY must never contain one.
|
|
164
|
+
* The law is written out at `lib/feed.ts:152-165`; the corrected shape is
|
|
165
|
+
* `lib/connector-actions.ts:320-381` and this function mirrors it exactly.
|
|
166
|
+
*
|
|
167
|
+
* Refinement is the WORST case for the law, which is why the structure below is
|
|
168
|
+
* not negotiable. TWO live reads want to sit in front of the memo and neither
|
|
169
|
+
* may:
|
|
170
|
+
*
|
|
171
|
+
* - the ledger gate reads the very row this function's own final step writes,
|
|
172
|
+
* so a naive "check the ledger, early-return `cached`, otherwise memoize"
|
|
173
|
+
* would issue the durable call on the first run and NOT on the replay — not
|
|
174
|
+
* racily, but on EVERY replay;
|
|
175
|
+
* - resolving the SUBJECT is a live `contacts` read, and refinement is the one
|
|
176
|
+
* function in the engine whose whole purpose is to be called after a wait —
|
|
177
|
+
* exactly when the row has had time to gain an email (a form fill, an
|
|
178
|
+
* identify, a merge). With eviction live, replay-from-top is the NORMAL
|
|
179
|
+
* resume after every long sleep, so the divergence window is the whole
|
|
180
|
+
* sleep, and an anonymous-then-identified contact would issue ZERO memos on
|
|
181
|
+
* the run and ONE on the replay.
|
|
182
|
+
*
|
|
183
|
+
* So:
|
|
184
|
+
*
|
|
185
|
+
* - Step 0 is a PURE ARGUMENT check: with no `contactId`/`email`/`userId` at
|
|
186
|
+
* all there is nothing to refine and nothing to key from. It reads no
|
|
187
|
+
* database, so it cannot diverge, and returning `no_lookup_key` before the
|
|
188
|
+
* memo is safe.
|
|
189
|
+
* - Step 1 (no active provider) is a boot-time config read — also genuinely
|
|
190
|
+
* replay-stable, also safe outside.
|
|
191
|
+
* - Then `withDurableGate` OWNS the rest of the shape structurally (it is this
|
|
192
|
+
* function's former hand-rolled block, extracted): whenever a journey
|
|
193
|
+
* boundary exists it UNCONDITIONALLY derives the key from the CALLER'S
|
|
194
|
+
* ARGUMENTS ONLY (the branded `CallerRef` makes anything else a type
|
|
195
|
+
* error), `registerKey`s it, and issues `boundary.memoize`. No condition
|
|
196
|
+
* guards that call.
|
|
197
|
+
* - Steps 2-6 (resolve, ledger gate, budget cap, provider call, ledger write +
|
|
198
|
+
* ingest) ALL live INSIDE the memo closure, so EVERY verdict — including
|
|
199
|
+
* `no_lookup_key` — is recorded by the durable memo and replayed verbatim.
|
|
200
|
+
* - With NO boundary (a webhook, a cron, a test) the chain runs directly with
|
|
201
|
+
* no memo at all, exactly as `connector-actions.ts:342` does. Layer 2 — the
|
|
202
|
+
* `enrichment_lookups` unique index — carries exactly-once on its own there.
|
|
203
|
+
*/
|
|
204
|
+
export declare function runRefineChain(deps: RefineChainDeps, opts: RefineContactOptions): Promise<RefineContactResult>;
|
|
205
|
+
/**
|
|
206
|
+
* The per-endpoint delivery dedupe key for `contact.refined`.
|
|
207
|
+
*
|
|
208
|
+
* The LEDGER ROW'S IDENTITY — `(provider, lookupKind, lookupKey)`, the
|
|
209
|
+
* `enrichment_lookups` unique triple — PLUS the lookup instant of the answer
|
|
210
|
+
* being announced.
|
|
211
|
+
*
|
|
212
|
+
* The instant is load-bearing, not decoration. `webhook_deliveries` carries a
|
|
213
|
+
* unique `(endpointId, dedupeKey)` index (schema/webhook-deliveries.ts) and
|
|
214
|
+
* nothing in the engine ever deletes a delivery row, so a key that is only the
|
|
215
|
+
* triple is PERMANENT: a contact refined today, re-refined in 90 days when
|
|
216
|
+
* `ENRICHMENT_TTL_DAYS` expires and the vendor reports a new job title, would
|
|
217
|
+
* recompute a byte-identical key and the subscriber would never be told —
|
|
218
|
+
* which is precisely the event a CRM sync exists to receive. Same for any
|
|
219
|
+
* `force: true` refresh.
|
|
220
|
+
*
|
|
221
|
+
* That costs nothing on the re-drive side, because the instant is not what
|
|
222
|
+
* defends a re-drive: the LEDGER GATE is. A retry of the same refinement finds
|
|
223
|
+
* the row the first attempt wrote, returns `cached`, and never reaches the
|
|
224
|
+
* emit at all. The dedupe is the backstop for the narrow race where two
|
|
225
|
+
* concurrent lookups of one subject both pass that gate — and for the truly
|
|
226
|
+
* identical answer (same `refinedAt`) it still holds exactly.
|
|
227
|
+
*
|
|
228
|
+
* `toISOString()` because the key must be byte-stable: a locale string is not.
|
|
229
|
+
*/
|
|
230
|
+
export declare function refineOutboundDedupeKey(input: {
|
|
231
|
+
provider: string;
|
|
232
|
+
lookupKind: EnrichmentLookupKind;
|
|
233
|
+
lookupKey: string;
|
|
234
|
+
refinedAt: Date;
|
|
235
|
+
}): string;
|
|
236
|
+
//# sourceMappingURL=refine-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refine-chain.d.ts","sourceRoot":"","sources":["../../src/lib/refine-chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAGnB,MAAM,eAAe,CAAC;AAMvB,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAWhC,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAC;IACvD;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9C;AAED,qEAAqE;AACrE,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB;8CAC0C;IAC1C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,+EAA+E;IAC/E,SAAS,EAAE,IAAI,CAAC;IAChB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,sBAAsB,CAAC;IAC/B,SAAS,EAAE,IAAI,CAAC;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACzC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,MAAM,EAAE;QACN,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QAC5D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QAC5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;KAC9D,CAAC;IACF,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACxE,aAAa,CAAC,KAAK,EAAE;QACnB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,oBAAoB,CAAC;QACjC,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;IACpC,gEAAgE;IAChE,iBAAiB,CAAC,KAAK,EAAE;QAAE,KAAK,EAAE,IAAI,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,cAAc,CAAC,KAAK,EAAE;QACpB,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,oBAAoB,CAAC;QACjC,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,sBAAsB,CAAC;QAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,SAAS,EAAE,IAAI,CAAC;QAChB,SAAS,EAAE,IAAI,CAAC;QAChB,GAAG,CAAC,EAAE,OAAO,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;QACxC,WAAW,EAAE,IAAI,CAAC;KACnB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClB,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,EAAE,IAAI,GAAG,IAAI,CAAC;IAClC;;;;;OAKG;IACH,WAAW,CAAC,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;CAC5C;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,mBAAmB,CAAC,CAyB9B;AAiYD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,oBAAoB,CAAC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;CACjB,GAAG,MAAM,CAGT"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { EnrichmentResult } from "@hogsend/core";
|
|
2
|
+
/**
|
|
3
|
+
* Identity of the lookup that produced a patch — the provenance every
|
|
4
|
+
* successful refinement stamps alongside the vendor's own facts.
|
|
5
|
+
*/
|
|
6
|
+
export interface RefinedTraitsMeta {
|
|
7
|
+
/** The enrichment provider id that answered (`enrichment.provider`). */
|
|
8
|
+
provider: string;
|
|
9
|
+
/** The lookup instant, written as an ISO string (`enrichment.at`). */
|
|
10
|
+
refinedAt: Date;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The single nested key that carries refinement PROVENANCE — who answered and
|
|
14
|
+
* when. Split out from the vendor FACTS on purpose:
|
|
15
|
+
*
|
|
16
|
+
* - Facts land on the CANONICAL, flat property keys a contact already carries
|
|
17
|
+
* (`title`, `company`, `company_employees`, …) so a bucket segments on the
|
|
18
|
+
* field it already knows — `b.prop("company_employees").gte(100)` — instead
|
|
19
|
+
* of a parallel `refined_*` vocabulary sitting next to the real one.
|
|
20
|
+
* - Provenance is NEVER read by `evaluatePropertyConditions` (segmentation is
|
|
21
|
+
* about facts, not who told us), so it nests freely under one key with no
|
|
22
|
+
* dotted-path support required from the condition engine. That is the whole
|
|
23
|
+
* reason the facts must stay flat and the provenance is free to be an object.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ENRICHMENT_KEY = "enrichment";
|
|
26
|
+
/** The provenance object stored under {@link ENRICHMENT_KEY}. */
|
|
27
|
+
export interface EnrichmentProvenance {
|
|
28
|
+
/** The enrichment provider id that answered. */
|
|
29
|
+
provider: string;
|
|
30
|
+
/** ISO — the instant the vendor answer was obtained. */
|
|
31
|
+
at: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Map a normalized {@link EnrichmentResult} onto a CANONICAL contact-property
|
|
35
|
+
* patch that `ingestEvent` merges into `contacts.properties`. The vendor facts
|
|
36
|
+
* fill the fields a contact already segments and personalizes on; a single
|
|
37
|
+
* nested `enrichment` object records the provenance.
|
|
38
|
+
*
|
|
39
|
+
* Three rules make this function load-bearing rather than cosmetic:
|
|
40
|
+
*
|
|
41
|
+
* - **Facts are flat + canonical.** `evaluatePropertyConditions` reads
|
|
42
|
+
* `properties[condition.property]` — a flat lookup with no dotted-path
|
|
43
|
+
* traversal — so every fact key is a top-level string a bucket can author
|
|
44
|
+
* verbatim (`company_industry`, not `company.industry`).
|
|
45
|
+
* - **Provenance is one nested object.** The condition engine never reads it,
|
|
46
|
+
* so `enrichment: { provider, at }` replaces the old flat `refined_at` /
|
|
47
|
+
* `refined_provider` sibling keys without touching the evaluator.
|
|
48
|
+
* - **Absent means ABSENT.** An undefined vendor field is omitted from the
|
|
49
|
+
* patch entirely — never written as `null`. `mergePropertiesSql` wraps the
|
|
50
|
+
* patch in `jsonb_strip_nulls`, so a null would DELETE a previously-good key
|
|
51
|
+
* rather than leave it alone.
|
|
52
|
+
*
|
|
53
|
+
* Numeric traits are written as real JSON numbers: `conditions/property.ts` does
|
|
54
|
+
* no coercion, so a `"42"` would silently never match a `gte`.
|
|
55
|
+
*
|
|
56
|
+
* The patch is the vendor's FULL answer, keyed canonically. Whether an
|
|
57
|
+
* individual fact actually overwrites what a contact already holds is decided at
|
|
58
|
+
* LANDING time (fill-if-absent, in `refine-chain.ts`), because that answer
|
|
59
|
+
* depends on the specific contact — the same stored patch lands on every contact
|
|
60
|
+
* that shares a company domain, and each may already carry different first-party
|
|
61
|
+
* fields.
|
|
62
|
+
*/
|
|
63
|
+
export declare function flattenTraits(result: EnrichmentResult, meta: RefinedTraitsMeta): Record<string, unknown>;
|
|
64
|
+
/**
|
|
65
|
+
* Translate a ledger `traits` patch written by the PRE-canonical release (flat
|
|
66
|
+
* `refined_*` fact keys plus flat `refined_at` / `refined_provider` provenance)
|
|
67
|
+
* into the canonical shape {@link flattenTraits} now produces. A cache HIT can
|
|
68
|
+
* land a row written by an older engine, and landing it verbatim would
|
|
69
|
+
* re-introduce exactly the flat vocabulary this design removed.
|
|
70
|
+
*
|
|
71
|
+
* A patch with no `refined_*` key is already canonical and passes through
|
|
72
|
+
* untouched (the common case, once the ledger has turned over). The two legacy
|
|
73
|
+
* provenance keys are dropped: they are not facts, and the fresh ISO provenance
|
|
74
|
+
* is not recoverable from them here, so a legacy cache hit simply lands the
|
|
75
|
+
* facts without a new `enrichment` stamp.
|
|
76
|
+
*/
|
|
77
|
+
export declare function canonicalizeStoredTraits(traits: Record<string, unknown>): Record<string, unknown>;
|
|
78
|
+
//# sourceMappingURL=refine-traits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refine-traits.d.ts","sourceRoot":"","sources":["../../src/lib/refine-traits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc,eAAe,CAAC;AAE3C,iEAAiE;AACjE,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,iBAAiB,GACtB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAyBzB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type RefineContactOptions, type RefineContactResult } from "./refine-chain.js";
|
|
2
|
+
export type { RefineContactOptions, RefineContactResult, } from "./refine-chain.js";
|
|
3
|
+
export { REFINE_EVENT } from "./refine-chain.js";
|
|
4
|
+
/**
|
|
5
|
+
* Refinement — the one new public function of this release. Resolves a contact,
|
|
6
|
+
* spends AT MOST one provider lookup, and lands the vendor's answer on the
|
|
7
|
+
* CANONICAL contact-property fields (fill-if-absent, so first-party data is
|
|
8
|
+
* never overwritten) THROUGH `ingestEvent`, so bucket membership re-evaluates
|
|
9
|
+
* synchronously and the GTM loop closes:
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* behaviour → bucket("gtm-high-intent").on("enter")
|
|
13
|
+
* → refineContact()
|
|
14
|
+
* → contacts.properties.{company_employees, seniority, …} (via ingestEvent)
|
|
15
|
+
* → checkBucketMembership re-runs
|
|
16
|
+
* → bucket("gtm-qualified", b => b.prop("company_employees").gte(100))
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* A STANDALONE import, never a `ctx` method — the journey context stays
|
|
20
|
+
* orchestration primitives only, exactly like `sendEmail()` and `sendSms()`.
|
|
21
|
+
*
|
|
22
|
+
* Replay-safety is two-layer. Layer 1 is Hatchet's durable `memo`, keyed by
|
|
23
|
+
* `deriveJourneyKey({ kind: "refine", … })` over the CALLER'S ARGUMENTS ONLY and
|
|
24
|
+
* issued UNCONDITIONALLY whenever a journey boundary exists — see the law
|
|
25
|
+
* spelled out on `runRefineChain`. Layer 2 is the `enrichment_lookups` unique
|
|
26
|
+
* index, which carries exactly-once on its own outside a journey.
|
|
27
|
+
*
|
|
28
|
+
* It NEVER throws. A vendor 5xx writes an `error` ledger row (which records the
|
|
29
|
+
* spend but does not suppress a later retry) and returns
|
|
30
|
+
* `{ status: "skipped", reason: "provider_error" }`; a failed ingest returns
|
|
31
|
+
* `{ status: "skipped", reason: "ingest_failed" }` rather than escaping into the
|
|
32
|
+
* journey run that called it.
|
|
33
|
+
*/
|
|
34
|
+
export declare function refineContact(opts?: RefineContactOptions): Promise<RefineContactResult>;
|
|
35
|
+
//# sourceMappingURL=refine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refine.d.ts","sourceRoot":"","sources":["../../src/lib/refine.ts"],"names":[],"mappings":"AAuBA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAGzB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAOjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAsB,aAAa,CACjC,IAAI,GAAE,oBAAyB,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CAyE9B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { EmailService } from "./email-service-types.js";
|
|
2
|
+
import { type Logger } from "./logger.js";
|
|
3
|
+
/**
|
|
4
|
+
* The engine-owned, self-contained password-reset email. The engine ships NO
|
|
5
|
+
* business templates (those live in the consumer's `src/emails/`), so a reset
|
|
6
|
+
* email that required a consumer template would break the "works out of the box"
|
|
7
|
+
* guarantee. This builds a tiny inline HTML + plaintext body — no React Email
|
|
8
|
+
* dependency, no template-registry lookup — and sends it through the resolved
|
|
9
|
+
* provider via the mailer's RAW path.
|
|
10
|
+
*
|
|
11
|
+
* `sendRaw` is correct here (not `send`): a password reset is strictly
|
|
12
|
+
* transactional and must bypass template resolution AND the
|
|
13
|
+
* preference/suppression check — a recovering operator must always receive it,
|
|
14
|
+
* marketing opt-out or not. There is no tracking pixel and no unsubscribe footer
|
|
15
|
+
* for the same reason.
|
|
16
|
+
*
|
|
17
|
+
* Security:
|
|
18
|
+
* - NEVER logs the `url` or the token. On a delivery failure we log a generic
|
|
19
|
+
* warning (pointing the operator at the CLI) and RESOLVE without throwing, so
|
|
20
|
+
* better-auth's neutral "if this email exists…" response is preserved (no user
|
|
21
|
+
* enumeration, no leak of whether the address was real).
|
|
22
|
+
* - The `from` resolves from `EMAIL_FROM ?? RESEND_FROM_EMAIL` — but we don't
|
|
23
|
+
* pass it explicitly: the mailer's `sendRaw` defaults `from` to its configured
|
|
24
|
+
* `defaultFrom`, which is exactly that pair.
|
|
25
|
+
*/
|
|
26
|
+
export declare function sendResetPasswordEmail(opts: {
|
|
27
|
+
to: string;
|
|
28
|
+
url: string;
|
|
29
|
+
/**
|
|
30
|
+
* The mailer to send through. Optional: defaults to the container-installed
|
|
31
|
+
* singleton (`getEmailService()`). Injectable so tests can pass a spy and
|
|
32
|
+
* assert the send fires without touching a real provider.
|
|
33
|
+
*/
|
|
34
|
+
emailService?: EmailService;
|
|
35
|
+
/** Optional structured logger; defaults to a stdout logger. */
|
|
36
|
+
logger?: Logger;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
//# sourceMappingURL=reset-email.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reset-email.d.ts","sourceRoot":"","sources":["../../src/lib/reset-email.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAaxD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgChB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type Database } from "@hogsend/db";
|
|
2
|
+
/**
|
|
3
|
+
* Revenue rollups over the event spine — pure reads of the first-class
|
|
4
|
+
* `user_events.value`/`currency` columns (served by the partial
|
|
5
|
+
* `user_events_valued_user_idx`). Totals are grouped per currency and NEVER
|
|
6
|
+
* summed across currencies (a GBP deal and a USD deal don't add).
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Events whose `value` must NOT count toward revenue: one CRM deal's value
|
|
10
|
+
* rides `funnel.stage_changed` on EVERY stage change plus the once-per-stage
|
|
11
|
+
* money events, so summing them all counts one sale several times over —
|
|
12
|
+
* and a quote is unrealized money, not revenue. Only `deal.sold` (and
|
|
13
|
+
* any other valued event) contributes.
|
|
14
|
+
*/
|
|
15
|
+
export declare const REVENUE_EXCLUDED_EVENTS: readonly ["funnel.stage_changed", "deal.quoted"];
|
|
16
|
+
/**
|
|
17
|
+
* The full exclusion list at query time: the static machinery events plus
|
|
18
|
+
* every funnel MILESTONE trigger event. An event that triggers a
|
|
19
|
+
* quoted/won stage hands its value to the minted money event (`deal.sold`
|
|
20
|
+
* counts; `deal.quoted` is unrealized), so counting the raw trigger row too
|
|
21
|
+
* would double-count one sale — the event-native twin of the
|
|
22
|
+
* `funnel.stage_changed` exclusion. Non-milestone triggers never mint and
|
|
23
|
+
* stay counted.
|
|
24
|
+
*/
|
|
25
|
+
export declare function revenueExcludedEvents(): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Rollup trust gate: browser (`pk_`/`inapp`) events can carry any value
|
|
28
|
+
* anyone mints, so they never count toward revenue — the same trust tier
|
|
29
|
+
* the conversion-point forged-value guard enforces. `source` null =
|
|
30
|
+
* engine-written, trusted.
|
|
31
|
+
*/
|
|
32
|
+
export declare function trustedValuedEventFilter(): import("drizzle-orm").SQL<unknown> | undefined;
|
|
33
|
+
export interface ContactRevenueTotal {
|
|
34
|
+
/** ISO-4217 code, or null for valued events ingested without a currency. */
|
|
35
|
+
currency: string | null;
|
|
36
|
+
total: number;
|
|
37
|
+
/** Number of valued events contributing to this total. */
|
|
38
|
+
count: number;
|
|
39
|
+
}
|
|
40
|
+
export interface ContactRevenue {
|
|
41
|
+
totals: ContactRevenueTotal[];
|
|
42
|
+
/** `occurredAt` of the most recent valued event, across all currencies. */
|
|
43
|
+
lastValuedAt: string | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Sum a contact's valued events, per currency. `contactId` is the trusted
|
|
47
|
+
* owner uuid and is REQUIRED (not optional) for the same reason the
|
|
48
|
+
* enrollment guards' is: an optional field silently defaults a new caller
|
|
49
|
+
* onto the mutable text key, so a contact whose valued events were ingested
|
|
50
|
+
* under an earlier key reports zero revenue. Pass `null` explicitly for a
|
|
51
|
+
* subject with no contact — a permanent, supported state (the engine refuses
|
|
52
|
+
* to mint a contact on observation), and the case `key` still serves. `key`
|
|
53
|
+
* is the canonical event key (`external_id ?? anonymous_id ?? id`) — the same
|
|
54
|
+
* key `ingestEvent` stamps on `user_events.user_id`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getContactRevenue(opts: {
|
|
57
|
+
db: Database;
|
|
58
|
+
key: string;
|
|
59
|
+
contactId: string | null;
|
|
60
|
+
}): Promise<ContactRevenue>;
|
|
61
|
+
//# sourceMappingURL=revenue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revenue.d.ts","sourceRoot":"","sources":["../../src/lib/revenue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAc,MAAM,aAAa,CAAC;AAcxD;;;;;GAKG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,kDAG1B,CAAC;AAEX;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,EAAE,CAKhD;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,mDAMvC;AAED,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,2EAA2E;IAC3E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,EAAE,EAAE,QAAQ,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,GAAG,OAAO,CAAC,cAAc,CAAC,CAqC1B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const errorSchema: z.ZodObject<{
|
|
3
|
+
error: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const paginationQuerySchema: z.ZodObject<{
|
|
6
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
7
|
+
offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/lib/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAEtC,eAAO,MAAM,WAAW;;iBAAkC,CAAC;AAE3D,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Database } from "@hogsend/db";
|
|
2
|
+
import type { Logger } from "./logger.js";
|
|
3
|
+
/**
|
|
4
|
+
* Idempotently seed ONE `kind="posthog"` webhook endpoint subscribed to the
|
|
5
|
+
* email funnel, so the full email lifecycle fans out to PostHog DURABLY on the
|
|
6
|
+
* delivery spine.
|
|
7
|
+
*
|
|
8
|
+
* Guarded against duplicates: it inserts only when no single-tenant
|
|
9
|
+
* (`organization_id IS NULL`) `kind="posthog"` endpoint already exists. Safe to
|
|
10
|
+
* call from BOTH the API and worker boots (both build the client) — the second
|
|
11
|
+
* caller finds the row and no-ops. Fire-and-forget at the call site: a transient
|
|
12
|
+
* seed failure must never block boot.
|
|
13
|
+
*/
|
|
14
|
+
export declare function seedPostHogDestination(opts: {
|
|
15
|
+
db: Database;
|
|
16
|
+
logger: Logger;
|
|
17
|
+
apiKey: string;
|
|
18
|
+
host?: string;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
seeded: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
//# sourceMappingURL=seed-posthog-destination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed-posthog-destination.d.ts","sourceRoot":"","sources":["../../src/lib/seed-posthog-destination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAoB,MAAM,aAAa,CAAC;AAE9D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAqC1C;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAwG/B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { HatchetClient } from "@hatchet-dev/typescript-sdk/v1/index.js";
|
|
2
|
+
import type { JourneyRegistry } from "@hogsend/core/registry";
|
|
3
|
+
import { type Database } from "@hogsend/db";
|
|
4
|
+
import type { Logger } from "./logger.js";
|
|
5
|
+
/**
|
|
6
|
+
* Scanner-burst window: SafeLinks/Proofpoint-style scanners follow EVERY link
|
|
7
|
+
* in an email within seconds of delivery; humans don't. Confirmation of a
|
|
8
|
+
* semantic answer is DEFERRED until the window around the candidate click has
|
|
9
|
+
* fully elapsed, so the gate sees the WHOLE burst — including clicks that land
|
|
10
|
+
* AFTER the candidate. An inline check could never suppress a scanner's first
|
|
11
|
+
* click (the burst isn't visible yet); this one can.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SEMANTIC_BURST_WINDOW_MS = 30000;
|
|
14
|
+
export declare const SEMANTIC_BURST_DISTINCT_LINKS = 3;
|
|
15
|
+
export type ConfirmSemanticClickInput = {
|
|
16
|
+
trackedLinkId: string;
|
|
17
|
+
/** ISO instant of the candidate click. */
|
|
18
|
+
clickedAt: string;
|
|
19
|
+
};
|
|
20
|
+
export type ConfirmSemanticClickResult = {
|
|
21
|
+
status: "confirmed";
|
|
22
|
+
event: string;
|
|
23
|
+
} | {
|
|
24
|
+
status: "suppressed";
|
|
25
|
+
distinctLinks: number;
|
|
26
|
+
}
|
|
27
|
+
/** Another link's answer claimed this send's slot first. */
|
|
28
|
+
| {
|
|
29
|
+
status: "lost";
|
|
30
|
+
} | {
|
|
31
|
+
status: "skipped";
|
|
32
|
+
reason: string;
|
|
33
|
+
};
|
|
34
|
+
export interface ConfirmSemanticClickDeps {
|
|
35
|
+
db: Database;
|
|
36
|
+
hatchet: HatchetClient;
|
|
37
|
+
registry: JourneyRegistry;
|
|
38
|
+
logger: Logger;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Confirm (or suppress) one provisional semantic-link answer. Idempotent end
|
|
42
|
+
* to end, so the wrapping Hatchet task can retry safely:
|
|
43
|
+
*
|
|
44
|
+
* 1. Sleep out the remainder of the burst window past the candidate click.
|
|
45
|
+
* 2. Count DISTINCT links of the send clicked inside the window around the
|
|
46
|
+
* candidate — at/over the threshold the whole burst is scanner traffic
|
|
47
|
+
* and the answer is suppressed (the raw clicks stay recorded).
|
|
48
|
+
* 3. Claim the send's answer slot via `ingestEvent` with the
|
|
49
|
+
* `sem:<emailSendId>:<event>` idempotency key (first answer wins; a
|
|
50
|
+
* failed Hatchet publish rolls the claim back inside `ingestEvent`, so a
|
|
51
|
+
* retry re-claims).
|
|
52
|
+
* 4. If we claimed (or a crashed earlier attempt of THIS link did — detected
|
|
53
|
+
* by the stored row's `linkId`), stamp `semanticEmittedAt` and emit the
|
|
54
|
+
* `email.action` outbound envelope with the same key as `dedupeKey`, so
|
|
55
|
+
* re-runs are per-endpoint no-ops.
|
|
56
|
+
*/
|
|
57
|
+
export declare function confirmSemanticClick(deps: ConfirmSemanticClickDeps, input: ConfirmSemanticClickInput): Promise<ConfirmSemanticClickResult>;
|
|
58
|
+
//# sourceMappingURL=semantic-click.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic-click.d.ts","sourceRoot":"","sources":["../../src/lib/semantic-click.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EACL,KAAK,QAAQ,EAId,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAO1C;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAI/C,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,0CAA0C;IAC1C,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAClC;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE;AACjD,4DAA4D;GAC1D;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1C,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,QAAQ,CAAC;IACb,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,wBAAwB,EAC9B,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,0BAA0B,CAAC,CAqIrC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sending-subdomain setup guidance — one source of truth for every surface.
|
|
3
|
+
*
|
|
4
|
+
* A customer typing their sending domain will reach for the root
|
|
5
|
+
* (`acme.com`). That works, and it is the wrong default: spam complaints
|
|
6
|
+
* damage the reputation of the domain that sent the mail, and the root also
|
|
7
|
+
* carries password resets, invoices and contracts. The engine recommends a
|
|
8
|
+
* subdomain, states the reason once, and never blocks the root.
|
|
9
|
+
*
|
|
10
|
+
* The shape is structured (not a paragraph blob) so each surface renders it
|
|
11
|
+
* in its own idiom — CLI coloured lines, Studio JSX — with identical words.
|
|
12
|
+
*/
|
|
13
|
+
export interface SendingDomainGuidance {
|
|
14
|
+
/** Short imperative headline. */
|
|
15
|
+
title: string;
|
|
16
|
+
/** The reason, stated once. */
|
|
17
|
+
body: string;
|
|
18
|
+
/** Why it is advice and not a gate. */
|
|
19
|
+
note: string;
|
|
20
|
+
/** Suggested single DNS labels, best first. */
|
|
21
|
+
recommendedLabels: readonly string[];
|
|
22
|
+
}
|
|
23
|
+
/** The approved copy. Frozen — surfaces render it, never mutate it. */
|
|
24
|
+
export declare const SENDING_DOMAIN_GUIDANCE: SendingDomainGuidance;
|
|
25
|
+
/** `acme.com` -> `notifications.acme.com`. Uses the first recommended label. */
|
|
26
|
+
export declare function exampleSendingSubdomain(domain: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether `domain` looks like a ROOT domain (`acme.com`, `acme.co.uk`) rather
|
|
29
|
+
* than a subdomain (`notifications.acme.com`) — the case where the subdomain
|
|
30
|
+
* recommendation is worth surfacing. Callers warn ONLY when this is true, so
|
|
31
|
+
* someone who already typed a subdomain is never nagged.
|
|
32
|
+
*
|
|
33
|
+
* Rule: exactly two labels, OR three labels whose last two form a known
|
|
34
|
+
* multi-part public suffix (see {@link MULTI_PART_SUFFIXES} for the honest
|
|
35
|
+
* limits of that list). Input is normalized (trim, lowercase, trailing dot
|
|
36
|
+
* stripped); empty / whitespace / single-label input returns `false` —
|
|
37
|
+
* nothing sensible to say about it.
|
|
38
|
+
*/
|
|
39
|
+
export declare function looksLikeRootDomain(domain: string): boolean;
|
|
40
|
+
//# sourceMappingURL=sending-domain-guidance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sending-domain-guidance.d.ts","sourceRoot":"","sources":["../../src/lib/sending-domain-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,qBAAqB;IACpC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,uEAAuE;AACvE,eAAO,MAAM,uBAAuB,EAAE,qBAKpC,CAAC;AAEH,gFAAgF;AAChF,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE9D;AA2BD;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAU3D"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny process-singletons: a value set once by `createHogsendClient` at startup
|
|
3
|
+
* and read by module-level task-execution sites that have no client reference of
|
|
4
|
+
* their own (journey/bucket durable tasks, the send-email task). Replaces the
|
|
5
|
+
* hand-rolled `let _x` + set/get/reset trios that were copied across the engine.
|
|
6
|
+
*
|
|
7
|
+
* Two variants:
|
|
8
|
+
* - `createSingleton` — required: `get()` throws if read before it is set.
|
|
9
|
+
* - `createOptionalSingleton` — `undefined` is a legitimate value (e.g. analytics
|
|
10
|
+
* with no `POSTHOG_API_KEY`); `get()` returns `T | undefined` and never throws.
|
|
11
|
+
*/
|
|
12
|
+
export interface Singleton<T> {
|
|
13
|
+
set(value: T): void;
|
|
14
|
+
get(): T;
|
|
15
|
+
reset(): void;
|
|
16
|
+
}
|
|
17
|
+
export interface OptionalSingleton<T> {
|
|
18
|
+
set(value: T | undefined): void;
|
|
19
|
+
get(): T | undefined;
|
|
20
|
+
reset(): void;
|
|
21
|
+
}
|
|
22
|
+
export declare function createSingleton<T>(name: string): Singleton<T>;
|
|
23
|
+
export declare function createOptionalSingleton<T>(): OptionalSingleton<T>;
|
|
24
|
+
//# sourceMappingURL=singleton.d.ts.map
|