@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.
Files changed (738) hide show
  1. package/README.md +3 -2
  2. package/dist/account-links/__fixtures__/fake-fetch.d.ts +38 -0
  3. package/dist/account-links/__fixtures__/fake-fetch.d.ts.map +1 -0
  4. package/dist/account-links/battlenet.d.ts +36 -0
  5. package/dist/account-links/battlenet.d.ts.map +1 -0
  6. package/dist/account-links/epic.d.ts +36 -0
  7. package/dist/account-links/epic.d.ts.map +1 -0
  8. package/dist/account-links/index.d.ts +7 -0
  9. package/dist/account-links/index.d.ts.map +1 -0
  10. package/dist/account-links/riot.d.ts +35 -0
  11. package/dist/account-links/riot.d.ts.map +1 -0
  12. package/dist/account-links/steam.d.ts +35 -0
  13. package/dist/account-links/steam.d.ts.map +1 -0
  14. package/dist/account-links/twitch.d.ts +38 -0
  15. package/dist/account-links/twitch.d.ts.map +1 -0
  16. package/dist/account-links/xbox.d.ts +39 -0
  17. package/dist/account-links/xbox.d.ts.map +1 -0
  18. package/dist/app.d.ts +50 -0
  19. package/dist/app.d.ts.map +1 -0
  20. package/dist/buckets/bucket-access.d.ts +60 -0
  21. package/dist/buckets/bucket-access.d.ts.map +1 -0
  22. package/dist/buckets/bucket-reactions.d.ts +100 -0
  23. package/dist/buckets/bucket-reactions.d.ts.map +1 -0
  24. package/dist/buckets/check-membership.d.ts +105 -0
  25. package/dist/buckets/check-membership.d.ts.map +1 -0
  26. package/dist/buckets/define-bucket.d.ts +53 -0
  27. package/dist/buckets/define-bucket.d.ts.map +1 -0
  28. package/dist/buckets/membership-epoch.d.ts +74 -0
  29. package/dist/buckets/membership-epoch.d.ts.map +1 -0
  30. package/dist/buckets/registry-singleton.d.ts +6 -0
  31. package/dist/buckets/registry-singleton.d.ts.map +1 -0
  32. package/dist/buckets/registry.d.ts +59 -0
  33. package/dist/buckets/registry.d.ts.map +1 -0
  34. package/dist/campaigns/cohort-sql.d.ts +54 -0
  35. package/dist/campaigns/cohort-sql.d.ts.map +1 -0
  36. package/dist/campaigns/define-campaign.d.ts +105 -0
  37. package/dist/campaigns/define-campaign.d.ts.map +1 -0
  38. package/dist/campaigns/reconcile.d.ts +13 -0
  39. package/dist/campaigns/reconcile.d.ts.map +1 -0
  40. package/dist/campaigns/steps.d.ts +29 -0
  41. package/dist/campaigns/steps.d.ts.map +1 -0
  42. package/dist/cold-connect/index.d.ts +98 -0
  43. package/dist/cold-connect/index.d.ts.map +1 -0
  44. package/dist/cold-connect/page.d.ts +69 -0
  45. package/dist/cold-connect/page.d.ts.map +1 -0
  46. package/dist/cold-connect/throttle.d.ts +39 -0
  47. package/dist/cold-connect/throttle.d.ts.map +1 -0
  48. package/dist/cold-connect/token.d.ts +57 -0
  49. package/dist/cold-connect/token.d.ts.map +1 -0
  50. package/dist/connectors/action-registry-singleton.d.ts +21 -0
  51. package/dist/connectors/action-registry-singleton.d.ts.map +1 -0
  52. package/dist/connectors/define-action.d.ts +117 -0
  53. package/dist/connectors/define-action.d.ts.map +1 -0
  54. package/dist/connectors/define-connector.d.ts +172 -0
  55. package/dist/connectors/define-connector.d.ts.map +1 -0
  56. package/dist/connectors/presets/index.d.ts +17 -0
  57. package/dist/connectors/presets/index.d.ts.map +1 -0
  58. package/dist/connectors/registry-singleton.d.ts +34 -0
  59. package/dist/connectors/registry-singleton.d.ts.map +1 -0
  60. package/dist/connectors/runtime.d.ts +68 -0
  61. package/dist/connectors/runtime.d.ts.map +1 -0
  62. package/dist/container.d.ts +678 -0
  63. package/dist/container.d.ts.map +1 -0
  64. package/dist/destinations/define-destination.d.ts +96 -0
  65. package/dist/destinations/define-destination.d.ts.map +1 -0
  66. package/dist/destinations/presets/index.d.ts +42 -0
  67. package/dist/destinations/presets/index.d.ts.map +1 -0
  68. package/dist/destinations/presets/posthog.d.ts +12 -0
  69. package/dist/destinations/presets/posthog.d.ts.map +1 -0
  70. package/dist/destinations/presets/segment.d.ts +15 -0
  71. package/dist/destinations/presets/segment.d.ts.map +1 -0
  72. package/dist/destinations/presets/slack.d.ts +10 -0
  73. package/dist/destinations/presets/slack.d.ts.map +1 -0
  74. package/dist/destinations/presets/webhook.d.ts +14 -0
  75. package/dist/destinations/presets/webhook.d.ts.map +1 -0
  76. package/dist/destinations/registry-singleton.d.ts +44 -0
  77. package/dist/destinations/registry-singleton.d.ts.map +1 -0
  78. package/dist/env.d.ts +119 -0
  79. package/dist/env.d.ts.map +1 -0
  80. package/dist/flags/reconcile.d.ts +36 -0
  81. package/dist/flags/reconcile.d.ts.map +1 -0
  82. package/dist/index.d.ts +210 -0
  83. package/dist/index.d.ts.map +1 -0
  84. package/dist/journeys/authoring.d.ts +15 -0
  85. package/dist/journeys/authoring.d.ts.map +1 -0
  86. package/dist/journeys/client-defaults-singleton.d.ts +16 -0
  87. package/dist/journeys/client-defaults-singleton.d.ts.map +1 -0
  88. package/dist/journeys/constants.d.ts +32 -0
  89. package/dist/journeys/constants.d.ts.map +1 -0
  90. package/dist/journeys/define-journey.d.ts +33 -0
  91. package/dist/journeys/define-journey.d.ts.map +1 -0
  92. package/dist/journeys/durable-law-harness.d.ts +74 -0
  93. package/dist/journeys/durable-law-harness.d.ts.map +1 -0
  94. package/dist/journeys/errors.d.ts +13 -0
  95. package/dist/journeys/errors.d.ts.map +1 -0
  96. package/dist/journeys/execute-journey-run.d.ts +160 -0
  97. package/dist/journeys/execute-journey-run.d.ts.map +1 -0
  98. package/dist/journeys/graph/build-graph.d.ts +24 -0
  99. package/dist/journeys/graph/build-graph.d.ts.map +1 -0
  100. package/dist/journeys/group-scope.d.ts +56 -0
  101. package/dist/journeys/group-scope.d.ts.map +1 -0
  102. package/dist/journeys/journey-boundary.d.ts +264 -0
  103. package/dist/journeys/journey-boundary.d.ts.map +1 -0
  104. package/dist/journeys/journey-context.d.ts +60 -0
  105. package/dist/journeys/journey-context.d.ts.map +1 -0
  106. package/dist/journeys/journey-log.d.ts +42 -0
  107. package/dist/journeys/journey-log.d.ts.map +1 -0
  108. package/dist/journeys/journey-source-locations-singleton.d.ts +6 -0
  109. package/dist/journeys/journey-source-locations-singleton.d.ts.map +1 -0
  110. package/dist/journeys/journey-sources-singleton.d.ts +5 -0
  111. package/dist/journeys/journey-sources-singleton.d.ts.map +1 -0
  112. package/dist/journeys/journey-task-factory.d.ts +11 -0
  113. package/dist/journeys/journey-task-factory.d.ts.map +1 -0
  114. package/dist/journeys/journey-task-runtime.d.ts +2 -0
  115. package/dist/journeys/journey-task-runtime.d.ts.map +1 -0
  116. package/dist/journeys/journey-version.d.ts +71 -0
  117. package/dist/journeys/journey-version.d.ts.map +1 -0
  118. package/dist/journeys/record-once.d.ts +56 -0
  119. package/dist/journeys/record-once.d.ts.map +1 -0
  120. package/dist/journeys/registry-singleton.d.ts +6 -0
  121. package/dist/journeys/registry-singleton.d.ts.map +1 -0
  122. package/dist/journeys/registry.d.ts +59 -0
  123. package/dist/journeys/registry.d.ts.map +1 -0
  124. package/dist/journeys/with-durable-gate.d.ts +97 -0
  125. package/dist/journeys/with-durable-gate.d.ts.map +1 -0
  126. package/dist/lib/account-link-emit.d.ts +69 -0
  127. package/dist/lib/account-link-emit.d.ts.map +1 -0
  128. package/dist/lib/account-link-events.d.ts +128 -0
  129. package/dist/lib/account-link-events.d.ts.map +1 -0
  130. package/dist/lib/account-link-hooks.d.ts +32 -0
  131. package/dist/lib/account-link-hooks.d.ts.map +1 -0
  132. package/dist/lib/account-link-ingest.d.ts +78 -0
  133. package/dist/lib/account-link-ingest.d.ts.map +1 -0
  134. package/dist/lib/account-link-nonce.d.ts +29 -0
  135. package/dist/lib/account-link-nonce.d.ts.map +1 -0
  136. package/dist/lib/account-link-origins.d.ts +37 -0
  137. package/dist/lib/account-link-origins.d.ts.map +1 -0
  138. package/dist/lib/account-link-pkce.d.ts +48 -0
  139. package/dist/lib/account-link-pkce.d.ts.map +1 -0
  140. package/dist/lib/account-link-provider-registry.d.ts +35 -0
  141. package/dist/lib/account-link-provider-registry.d.ts.map +1 -0
  142. package/dist/lib/account-link-throttle.d.ts +76 -0
  143. package/dist/lib/account-link-throttle.d.ts.map +1 -0
  144. package/dist/lib/account-link-url.d.ts +41 -0
  145. package/dist/lib/account-link-url.d.ts.map +1 -0
  146. package/dist/lib/account-links-from-env.d.ts +62 -0
  147. package/dist/lib/account-links-from-env.d.ts.map +1 -0
  148. package/dist/lib/account-links.d.ts +353 -0
  149. package/dist/lib/account-links.d.ts.map +1 -0
  150. package/dist/lib/agent/config.d.ts +14 -0
  151. package/dist/lib/agent/config.d.ts.map +1 -0
  152. package/dist/lib/agent/proposals.d.ts +52 -0
  153. package/dist/lib/agent/proposals.d.ts.map +1 -0
  154. package/dist/lib/agent/provider.d.ts +9 -0
  155. package/dist/lib/agent/provider.d.ts.map +1 -0
  156. package/dist/lib/agent/risk.d.ts +24 -0
  157. package/dist/lib/agent/risk.d.ts.map +1 -0
  158. package/dist/lib/agent/system-prompt.d.ts +8 -0
  159. package/dist/lib/agent/system-prompt.d.ts.map +1 -0
  160. package/dist/lib/agent/tools.d.ts +258 -0
  161. package/dist/lib/agent/tools.d.ts.map +1 -0
  162. package/dist/lib/alerting.d.ts +7 -0
  163. package/dist/lib/alerting.d.ts.map +1 -0
  164. package/dist/lib/analytics-adapter.d.ts +24 -0
  165. package/dist/lib/analytics-adapter.d.ts.map +1 -0
  166. package/dist/lib/analytics-identity.d.ts +60 -0
  167. package/dist/lib/analytics-identity.d.ts.map +1 -0
  168. package/dist/lib/analytics-provider-registry.d.ts +20 -0
  169. package/dist/lib/analytics-provider-registry.d.ts.map +1 -0
  170. package/dist/lib/analytics-providers-from-env.d.ts +41 -0
  171. package/dist/lib/analytics-providers-from-env.d.ts.map +1 -0
  172. package/dist/lib/analytics-singleton.d.ts +10 -0
  173. package/dist/lib/analytics-singleton.d.ts.map +1 -0
  174. package/dist/lib/api-key-hash.d.ts +9 -0
  175. package/dist/lib/api-key-hash.d.ts.map +1 -0
  176. package/dist/lib/app-secret.d.ts +29 -0
  177. package/dist/lib/app-secret.d.ts.map +1 -0
  178. package/dist/lib/attachments.d.ts +53 -0
  179. package/dist/lib/attachments.d.ts.map +1 -0
  180. package/dist/lib/attribution-backfill.d.ts +48 -0
  181. package/dist/lib/attribution-backfill.d.ts.map +1 -0
  182. package/dist/lib/attribution.d.ts +44 -0
  183. package/dist/lib/attribution.d.ts.map +1 -0
  184. package/dist/lib/auth.d.ts +136 -0
  185. package/dist/lib/auth.d.ts.map +1 -0
  186. package/dist/lib/backfill.d.ts +41 -0
  187. package/dist/lib/backfill.d.ts.map +1 -0
  188. package/dist/lib/banner.d.ts +52 -0
  189. package/dist/lib/banner.d.ts.map +1 -0
  190. package/dist/lib/blueprint-lock.d.ts +19 -0
  191. package/dist/lib/blueprint-lock.d.ts.map +1 -0
  192. package/dist/lib/blueprints.d.ts +573 -0
  193. package/dist/lib/blueprints.d.ts.map +1 -0
  194. package/dist/lib/boot-api-key.d.ts +38 -0
  195. package/dist/lib/boot-api-key.d.ts.map +1 -0
  196. package/dist/lib/boot.d.ts +23 -0
  197. package/dist/lib/boot.d.ts.map +1 -0
  198. package/dist/lib/bootstrap-admin.d.ts +33 -0
  199. package/dist/lib/bootstrap-admin.d.ts.map +1 -0
  200. package/dist/lib/bot-prefetch.d.ts +21 -0
  201. package/dist/lib/bot-prefetch.d.ts.map +1 -0
  202. package/dist/lib/bucket-emit.d.ts +75 -0
  203. package/dist/lib/bucket-emit.d.ts.map +1 -0
  204. package/dist/lib/bucket-posthog-sync.d.ts +29 -0
  205. package/dist/lib/bucket-posthog-sync.d.ts.map +1 -0
  206. package/dist/lib/campaign-send-key.d.ts +31 -0
  207. package/dist/lib/campaign-send-key.d.ts.map +1 -0
  208. package/dist/lib/connector-actions.d.ts +83 -0
  209. package/dist/lib/connector-actions.d.ts.map +1 -0
  210. package/dist/lib/connector-heartbeat.d.ts +35 -0
  211. package/dist/lib/connector-heartbeat.d.ts.map +1 -0
  212. package/dist/lib/connector-link-codes.d.ts +105 -0
  213. package/dist/lib/connector-link-codes.d.ts.map +1 -0
  214. package/dist/lib/connector-state.d.ts +97 -0
  215. package/dist/lib/connector-state.d.ts.map +1 -0
  216. package/dist/lib/contacts.d.ts +622 -0
  217. package/dist/lib/contacts.d.ts.map +1 -0
  218. package/dist/lib/conversion-dispatch.d.ts +98 -0
  219. package/dist/lib/conversion-dispatch.d.ts.map +1 -0
  220. package/dist/lib/conversions.d.ts +75 -0
  221. package/dist/lib/conversions.d.ts.map +1 -0
  222. package/dist/lib/create-admin.d.ts +54 -0
  223. package/dist/lib/create-admin.d.ts.map +1 -0
  224. package/dist/lib/crm-deals.d.ts +66 -0
  225. package/dist/lib/crm-deals.d.ts.map +1 -0
  226. package/dist/lib/crm-ingest.d.ts +38 -0
  227. package/dist/lib/crm-ingest.d.ts.map +1 -0
  228. package/dist/lib/crm-provider-registry.d.ts +20 -0
  229. package/dist/lib/crm-provider-registry.d.ts.map +1 -0
  230. package/dist/lib/crm-registry-singleton.d.ts +18 -0
  231. package/dist/lib/crm-registry-singleton.d.ts.map +1 -0
  232. package/dist/lib/db.d.ts +3 -0
  233. package/dist/lib/db.d.ts.map +1 -0
  234. package/dist/lib/deal-money-events.d.ts +35 -0
  235. package/dist/lib/deal-money-events.d.ts.map +1 -0
  236. package/dist/lib/discord-gateway-heartbeat.d.ts +47 -0
  237. package/dist/lib/discord-gateway-heartbeat.d.ts.map +1 -0
  238. package/dist/lib/domain-status.d.ts +87 -0
  239. package/dist/lib/domain-status.d.ts.map +1 -0
  240. package/dist/lib/email-provider-registry.d.ts +30 -0
  241. package/dist/lib/email-provider-registry.d.ts.map +1 -0
  242. package/dist/lib/email-providers-from-env.d.ts +12 -0
  243. package/dist/lib/email-providers-from-env.d.ts.map +1 -0
  244. package/dist/lib/email-service-types.d.ts +189 -0
  245. package/dist/lib/email-service-types.d.ts.map +1 -0
  246. package/dist/lib/email-stats.d.ts +12 -0
  247. package/dist/lib/email-stats.d.ts.map +1 -0
  248. package/dist/lib/email.d.ts +73 -0
  249. package/dist/lib/email.d.ts.map +1 -0
  250. package/dist/lib/enrichment-ledger.d.ts +101 -0
  251. package/dist/lib/enrichment-ledger.d.ts.map +1 -0
  252. package/dist/lib/enrichment-provider-registry.d.ts +20 -0
  253. package/dist/lib/enrichment-provider-registry.d.ts.map +1 -0
  254. package/dist/lib/enrichment-providers-from-env.d.ts +13 -0
  255. package/dist/lib/enrichment-providers-from-env.d.ts.map +1 -0
  256. package/dist/lib/enrichment-registry-singleton.d.ts +9 -0
  257. package/dist/lib/enrichment-registry-singleton.d.ts.map +1 -0
  258. package/dist/lib/enrollment-guards.d.ts +28 -0
  259. package/dist/lib/enrollment-guards.d.ts.map +1 -0
  260. package/dist/lib/enrollment-policy.d.ts +25 -0
  261. package/dist/lib/enrollment-policy.d.ts.map +1 -0
  262. package/dist/lib/event-names.d.ts +27 -0
  263. package/dist/lib/event-names.d.ts.map +1 -0
  264. package/dist/lib/feed.d.ts +64 -0
  265. package/dist/lib/feed.d.ts.map +1 -0
  266. package/dist/lib/flags-registry.d.ts +23 -0
  267. package/dist/lib/flags-registry.d.ts.map +1 -0
  268. package/dist/lib/flags.d.ts +143 -0
  269. package/dist/lib/flags.d.ts.map +1 -0
  270. package/dist/lib/frequency-cap.d.ts +38 -0
  271. package/dist/lib/frequency-cap.d.ts.map +1 -0
  272. package/dist/lib/from-address.d.ts +15 -0
  273. package/dist/lib/from-address.d.ts.map +1 -0
  274. package/dist/lib/funnel-progress.d.ts +37 -0
  275. package/dist/lib/funnel-progress.d.ts.map +1 -0
  276. package/dist/lib/funnel-registry.d.ts +44 -0
  277. package/dist/lib/funnel-registry.d.ts.map +1 -0
  278. package/dist/lib/funnel-transitions.d.ts +63 -0
  279. package/dist/lib/funnel-transitions.d.ts.map +1 -0
  280. package/dist/lib/fx.d.ts +118 -0
  281. package/dist/lib/fx.d.ts.map +1 -0
  282. package/dist/lib/global-control-readout.d.ts +72 -0
  283. package/dist/lib/global-control-readout.d.ts.map +1 -0
  284. package/dist/lib/groups.d.ts +138 -0
  285. package/dist/lib/groups.d.ts.map +1 -0
  286. package/dist/lib/hatchet-duration.d.ts +14 -0
  287. package/dist/lib/hatchet-duration.d.ts.map +1 -0
  288. package/dist/lib/hatchet.d.ts +3 -0
  289. package/dist/lib/hatchet.d.ts.map +1 -0
  290. package/dist/lib/headers.d.ts +8 -0
  291. package/dist/lib/headers.d.ts.map +1 -0
  292. package/dist/lib/holdout.d.ts +36 -0
  293. package/dist/lib/holdout.d.ts.map +1 -0
  294. package/dist/lib/html.d.ts +5 -0
  295. package/dist/lib/html.d.ts.map +1 -0
  296. package/dist/lib/identity-service.d.ts +60 -0
  297. package/dist/lib/identity-service.d.ts.map +1 -0
  298. package/dist/lib/identity-token.d.ts +81 -0
  299. package/dist/lib/identity-token.d.ts.map +1 -0
  300. package/dist/lib/ingestion.d.ts +218 -0
  301. package/dist/lib/ingestion.d.ts.map +1 -0
  302. package/dist/lib/journey-lift.d.ts +56 -0
  303. package/dist/lib/journey-lift.d.ts.map +1 -0
  304. package/dist/lib/journey-suppress.d.ts +59 -0
  305. package/dist/lib/journey-suppress.d.ts.map +1 -0
  306. package/dist/lib/leader-lease.d.ts +36 -0
  307. package/dist/lib/leader-lease.d.ts.map +1 -0
  308. package/dist/lib/lift-stats.d.ts +46 -0
  309. package/dist/lib/lift-stats.d.ts.map +1 -0
  310. package/dist/lib/links.d.ts +186 -0
  311. package/dist/lib/links.d.ts.map +1 -0
  312. package/dist/lib/load-optional-plugin.d.ts +47 -0
  313. package/dist/lib/load-optional-plugin.d.ts.map +1 -0
  314. package/dist/lib/logger.d.ts +4 -0
  315. package/dist/lib/logger.d.ts.map +1 -0
  316. package/dist/lib/mailer.d.ts +43 -0
  317. package/dist/lib/mailer.d.ts.map +1 -0
  318. package/dist/lib/metrics-sql.d.ts +11 -0
  319. package/dist/lib/metrics-sql.d.ts.map +1 -0
  320. package/dist/lib/notifications.d.ts +17 -0
  321. package/dist/lib/notifications.d.ts.map +1 -0
  322. package/dist/lib/oauth-token-manager.d.ts +74 -0
  323. package/dist/lib/oauth-token-manager.d.ts.map +1 -0
  324. package/dist/lib/operator-settings.d.ts +33 -0
  325. package/dist/lib/operator-settings.d.ts.map +1 -0
  326. package/dist/lib/operator.d.ts +20 -0
  327. package/dist/lib/operator.d.ts.map +1 -0
  328. package/dist/lib/outbound-endpoint-cache.d.ts +25 -0
  329. package/dist/lib/outbound-endpoint-cache.d.ts.map +1 -0
  330. package/dist/lib/outbound.d.ts +687 -0
  331. package/dist/lib/outbound.d.ts.map +1 -0
  332. package/dist/lib/phone.d.ts +11 -0
  333. package/dist/lib/phone.d.ts.map +1 -0
  334. package/dist/lib/posthog-scopes.d.ts +30 -0
  335. package/dist/lib/posthog-scopes.d.ts.map +1 -0
  336. package/dist/lib/posthog.d.ts +16 -0
  337. package/dist/lib/posthog.d.ts.map +1 -0
  338. package/dist/lib/preferences.d.ts +72 -0
  339. package/dist/lib/preferences.d.ts.map +1 -0
  340. package/dist/lib/provider-credentials.d.ts +149 -0
  341. package/dist/lib/provider-credentials.d.ts.map +1 -0
  342. package/dist/lib/provision-posthog-loop.d.ts +100 -0
  343. package/dist/lib/provision-posthog-loop.d.ts.map +1 -0
  344. package/dist/lib/recipient-preferences.d.ts +29 -0
  345. package/dist/lib/recipient-preferences.d.ts.map +1 -0
  346. package/dist/lib/redis.d.ts +33 -0
  347. package/dist/lib/redis.d.ts.map +1 -0
  348. package/dist/lib/referral-intent.d.ts +99 -0
  349. package/dist/lib/referral-intent.d.ts.map +1 -0
  350. package/dist/lib/referral-link.d.ts +59 -0
  351. package/dist/lib/referral-link.d.ts.map +1 -0
  352. package/dist/lib/referral-registry.d.ts +37 -0
  353. package/dist/lib/referral-registry.d.ts.map +1 -0
  354. package/dist/lib/referral-report.d.ts +178 -0
  355. package/dist/lib/referral-report.d.ts.map +1 -0
  356. package/dist/lib/referral-runtime.d.ts +43 -0
  357. package/dist/lib/referral-runtime.d.ts.map +1 -0
  358. package/dist/lib/referrals.d.ts +184 -0
  359. package/dist/lib/referrals.d.ts.map +1 -0
  360. package/dist/lib/refine-chain.d.ts +236 -0
  361. package/dist/lib/refine-chain.d.ts.map +1 -0
  362. package/dist/lib/refine-traits.d.ts +78 -0
  363. package/dist/lib/refine-traits.d.ts.map +1 -0
  364. package/dist/lib/refine.d.ts +35 -0
  365. package/dist/lib/refine.d.ts.map +1 -0
  366. package/dist/lib/reset-email.d.ts +38 -0
  367. package/dist/lib/reset-email.d.ts.map +1 -0
  368. package/dist/lib/revenue.d.ts +61 -0
  369. package/dist/lib/revenue.d.ts.map +1 -0
  370. package/dist/lib/schemas.d.ts +9 -0
  371. package/dist/lib/schemas.d.ts.map +1 -0
  372. package/dist/lib/seed-posthog-destination.d.ts +22 -0
  373. package/dist/lib/seed-posthog-destination.d.ts.map +1 -0
  374. package/dist/lib/semantic-click.d.ts +58 -0
  375. package/dist/lib/semantic-click.d.ts.map +1 -0
  376. package/dist/lib/sending-domain-guidance.d.ts +40 -0
  377. package/dist/lib/sending-domain-guidance.d.ts.map +1 -0
  378. package/dist/lib/singleton.d.ts +24 -0
  379. package/dist/lib/singleton.d.ts.map +1 -0
  380. package/dist/lib/sms-frequency-cap.d.ts +16 -0
  381. package/dist/lib/sms-frequency-cap.d.ts.map +1 -0
  382. package/dist/lib/sms-inbound.d.ts +37 -0
  383. package/dist/lib/sms-inbound.d.ts.map +1 -0
  384. package/dist/lib/sms-link-tracking.d.ts +53 -0
  385. package/dist/lib/sms-link-tracking.d.ts.map +1 -0
  386. package/dist/lib/sms-mailer.d.ts +12 -0
  387. package/dist/lib/sms-mailer.d.ts.map +1 -0
  388. package/dist/lib/sms-provider-registry.d.ts +20 -0
  389. package/dist/lib/sms-provider-registry.d.ts.map +1 -0
  390. package/dist/lib/sms-providers-from-env.d.ts +4 -0
  391. package/dist/lib/sms-providers-from-env.d.ts.map +1 -0
  392. package/dist/lib/sms-service-types.d.ts +131 -0
  393. package/dist/lib/sms-service-types.d.ts.map +1 -0
  394. package/dist/lib/sms-tracked.d.ts +36 -0
  395. package/dist/lib/sms-tracked.d.ts.map +1 -0
  396. package/dist/lib/sms.d.ts +58 -0
  397. package/dist/lib/sms.d.ts.map +1 -0
  398. package/dist/lib/snippet.d.ts +32 -0
  399. package/dist/lib/snippet.d.ts.map +1 -0
  400. package/dist/lib/stable-stringify.d.ts +12 -0
  401. package/dist/lib/stable-stringify.d.ts.map +1 -0
  402. package/dist/lib/studio.d.ts +21 -0
  403. package/dist/lib/studio.d.ts.map +1 -0
  404. package/dist/lib/survey.d.ts +35 -0
  405. package/dist/lib/survey.d.ts.map +1 -0
  406. package/dist/lib/test-mode.d.ts +77 -0
  407. package/dist/lib/test-mode.d.ts.map +1 -0
  408. package/dist/lib/timezone.d.ts +55 -0
  409. package/dist/lib/timezone.d.ts.map +1 -0
  410. package/dist/lib/tracked.d.ts +95 -0
  411. package/dist/lib/tracked.d.ts.map +1 -0
  412. package/dist/lib/tracking-event-names.d.ts +7 -0
  413. package/dist/lib/tracking-event-names.d.ts.map +1 -0
  414. package/dist/lib/tracking-events.d.ts +232 -0
  415. package/dist/lib/tracking-events.d.ts.map +1 -0
  416. package/dist/lib/tracking.d.ts +47 -0
  417. package/dist/lib/tracking.d.ts.map +1 -0
  418. package/dist/lib/unconfigured-email-provider.d.ts +20 -0
  419. package/dist/lib/unconfigured-email-provider.d.ts.map +1 -0
  420. package/dist/lib/unique-violation.d.ts +22 -0
  421. package/dist/lib/unique-violation.d.ts.map +1 -0
  422. package/dist/lib/user-token.d.ts +44 -0
  423. package/dist/lib/user-token.d.ts.map +1 -0
  424. package/dist/lib/variant.d.ts +44 -0
  425. package/dist/lib/variant.d.ts.map +1 -0
  426. package/dist/lib/webhook-signing.d.ts +120 -0
  427. package/dist/lib/webhook-signing.d.ts.map +1 -0
  428. package/dist/lib/worker-heartbeat.d.ts +18 -0
  429. package/dist/lib/worker-heartbeat.d.ts.map +1 -0
  430. package/dist/lists/channels.d.ts +43 -0
  431. package/dist/lists/channels.d.ts.map +1 -0
  432. package/dist/lists/define-list.d.ts +76 -0
  433. package/dist/lists/define-list.d.ts.map +1 -0
  434. package/dist/lists/registry-singleton.d.ts +8 -0
  435. package/dist/lists/registry-singleton.d.ts.map +1 -0
  436. package/dist/lists/registry.d.ts +66 -0
  437. package/dist/lists/registry.d.ts.map +1 -0
  438. package/dist/lists/subscription.d.ts +10 -0
  439. package/dist/lists/subscription.d.ts.map +1 -0
  440. package/dist/mcp/authoring-guide.d.ts +33 -0
  441. package/dist/mcp/authoring-guide.d.ts.map +1 -0
  442. package/dist/mcp/blueprint-tools.d.ts +266 -0
  443. package/dist/mcp/blueprint-tools.d.ts.map +1 -0
  444. package/dist/middleware/api-key.d.ts +45 -0
  445. package/dist/middleware/api-key.d.ts.map +1 -0
  446. package/dist/middleware/audit.d.ts +3 -0
  447. package/dist/middleware/audit.d.ts.map +1 -0
  448. package/dist/middleware/error-handler.d.ts +4 -0
  449. package/dist/middleware/error-handler.d.ts.map +1 -0
  450. package/dist/middleware/publishable-key.d.ts +27 -0
  451. package/dist/middleware/publishable-key.d.ts.map +1 -0
  452. package/dist/middleware/rate-limit.d.ts +105 -0
  453. package/dist/middleware/rate-limit.d.ts.map +1 -0
  454. package/dist/middleware/request-logger.d.ts +4 -0
  455. package/dist/middleware/request-logger.d.ts.map +1 -0
  456. package/dist/middleware/require-admin.d.ts +3 -0
  457. package/dist/middleware/require-admin.d.ts.map +1 -0
  458. package/dist/routes/_shared.d.ts +52 -0
  459. package/dist/routes/_shared.d.ts.map +1 -0
  460. package/dist/routes/accounts/callback.d.ts +18 -0
  461. package/dist/routes/accounts/callback.d.ts.map +1 -0
  462. package/dist/routes/accounts/emit.d.ts +96 -0
  463. package/dist/routes/accounts/emit.d.ts.map +1 -0
  464. package/dist/routes/accounts/import-links.d.ts +4 -0
  465. package/dist/routes/accounts/import-links.d.ts.map +1 -0
  466. package/dist/routes/accounts/index.d.ts +39 -0
  467. package/dist/routes/accounts/index.d.ts.map +1 -0
  468. package/dist/routes/accounts/lookup.d.ts +6 -0
  469. package/dist/routes/accounts/lookup.d.ts.map +1 -0
  470. package/dist/routes/accounts/me.d.ts +5 -0
  471. package/dist/routes/accounts/me.d.ts.map +1 -0
  472. package/dist/routes/accounts/mint.d.ts +5 -0
  473. package/dist/routes/accounts/mint.d.ts.map +1 -0
  474. package/dist/routes/accounts/pages.d.ts +23 -0
  475. package/dist/routes/accounts/pages.d.ts.map +1 -0
  476. package/dist/routes/accounts/resolve.d.ts +33 -0
  477. package/dist/routes/accounts/resolve.d.ts.map +1 -0
  478. package/dist/routes/accounts/serialize.d.ts +57 -0
  479. package/dist/routes/accounts/serialize.d.ts.map +1 -0
  480. package/dist/routes/accounts/shared.d.ts +68 -0
  481. package/dist/routes/accounts/shared.d.ts.map +1 -0
  482. package/dist/routes/accounts/start.d.ts +16 -0
  483. package/dist/routes/accounts/start.d.ts.map +1 -0
  484. package/dist/routes/accounts/unlink.d.ts +36 -0
  485. package/dist/routes/accounts/unlink.d.ts.map +1 -0
  486. package/dist/routes/admin/agent.d.ts +4 -0
  487. package/dist/routes/admin/agent.d.ts.map +1 -0
  488. package/dist/routes/admin/alerts.d.ts +190 -0
  489. package/dist/routes/admin/alerts.d.ts.map +1 -0
  490. package/dist/routes/admin/analytics.d.ts +137 -0
  491. package/dist/routes/admin/analytics.d.ts.map +1 -0
  492. package/dist/routes/admin/api-keys.d.ts +158 -0
  493. package/dist/routes/admin/api-keys.d.ts.map +1 -0
  494. package/dist/routes/admin/attribution.d.ts +93 -0
  495. package/dist/routes/admin/attribution.d.ts.map +1 -0
  496. package/dist/routes/admin/audit-logs.d.ts +40 -0
  497. package/dist/routes/admin/audit-logs.d.ts.map +1 -0
  498. package/dist/routes/admin/blueprints.d.ts +4 -0
  499. package/dist/routes/admin/blueprints.d.ts.map +1 -0
  500. package/dist/routes/admin/buckets.d.ts +215 -0
  501. package/dist/routes/admin/buckets.d.ts.map +1 -0
  502. package/dist/routes/admin/bulk.d.ts +203 -0
  503. package/dist/routes/admin/bulk.d.ts.map +1 -0
  504. package/dist/routes/admin/campaigns.d.ts +198 -0
  505. package/dist/routes/admin/campaigns.d.ts.map +1 -0
  506. package/dist/routes/admin/connectors.d.ts +116 -0
  507. package/dist/routes/admin/connectors.d.ts.map +1 -0
  508. package/dist/routes/admin/contacts.d.ts +246 -0
  509. package/dist/routes/admin/contacts.d.ts.map +1 -0
  510. package/dist/routes/admin/conversions.d.ts +103 -0
  511. package/dist/routes/admin/conversions.d.ts.map +1 -0
  512. package/dist/routes/admin/deals.d.ts +136 -0
  513. package/dist/routes/admin/deals.d.ts.map +1 -0
  514. package/dist/routes/admin/dlq.d.ts +100 -0
  515. package/dist/routes/admin/dlq.d.ts.map +1 -0
  516. package/dist/routes/admin/domain.d.ts +314 -0
  517. package/dist/routes/admin/domain.d.ts.map +1 -0
  518. package/dist/routes/admin/emails.d.ts +127 -0
  519. package/dist/routes/admin/emails.d.ts.map +1 -0
  520. package/dist/routes/admin/events.d.ts +140 -0
  521. package/dist/routes/admin/events.d.ts.map +1 -0
  522. package/dist/routes/admin/flags.d.ts +719 -0
  523. package/dist/routes/admin/flags.d.ts.map +1 -0
  524. package/dist/routes/admin/funnels.d.ts +71 -0
  525. package/dist/routes/admin/funnels.d.ts.map +1 -0
  526. package/dist/routes/admin/groups.d.ts +169 -0
  527. package/dist/routes/admin/groups.d.ts.map +1 -0
  528. package/dist/routes/admin/identity.d.ts +72 -0
  529. package/dist/routes/admin/identity.d.ts.map +1 -0
  530. package/dist/routes/admin/impact-schemas.d.ts +48 -0
  531. package/dist/routes/admin/impact-schemas.d.ts.map +1 -0
  532. package/dist/routes/admin/impact.d.ts +316 -0
  533. package/dist/routes/admin/impact.d.ts.map +1 -0
  534. package/dist/routes/admin/index.d.ts +4 -0
  535. package/dist/routes/admin/index.d.ts.map +1 -0
  536. package/dist/routes/admin/journey-impact.d.ts +320 -0
  537. package/dist/routes/admin/journey-impact.d.ts.map +1 -0
  538. package/dist/routes/admin/journey-logs.d.ts +57 -0
  539. package/dist/routes/admin/journey-logs.d.ts.map +1 -0
  540. package/dist/routes/admin/journeys.d.ts +736 -0
  541. package/dist/routes/admin/journeys.d.ts.map +1 -0
  542. package/dist/routes/admin/links.d.ts +382 -0
  543. package/dist/routes/admin/links.d.ts.map +1 -0
  544. package/dist/routes/admin/lists.d.ts +22 -0
  545. package/dist/routes/admin/lists.d.ts.map +1 -0
  546. package/dist/routes/admin/maintenance.d.ts +72 -0
  547. package/dist/routes/admin/maintenance.d.ts.map +1 -0
  548. package/dist/routes/admin/metrics.d.ts +212 -0
  549. package/dist/routes/admin/metrics.d.ts.map +1 -0
  550. package/dist/routes/admin/open-editor.d.ts +36 -0
  551. package/dist/routes/admin/open-editor.d.ts.map +1 -0
  552. package/dist/routes/admin/preferences.d.ts +109 -0
  553. package/dist/routes/admin/preferences.d.ts.map +1 -0
  554. package/dist/routes/admin/provider-credentials.d.ts +108 -0
  555. package/dist/routes/admin/provider-credentials.d.ts.map +1 -0
  556. package/dist/routes/admin/readiness.d.ts +24 -0
  557. package/dist/routes/admin/readiness.d.ts.map +1 -0
  558. package/dist/routes/admin/referrals.d.ts +230 -0
  559. package/dist/routes/admin/referrals.d.ts.map +1 -0
  560. package/dist/routes/admin/reporting.d.ts +149 -0
  561. package/dist/routes/admin/reporting.d.ts.map +1 -0
  562. package/dist/routes/admin/settings.d.ts +80 -0
  563. package/dist/routes/admin/settings.d.ts.map +1 -0
  564. package/dist/routes/admin/suppressions.d.ts +90 -0
  565. package/dist/routes/admin/suppressions.d.ts.map +1 -0
  566. package/dist/routes/admin/targeting.d.ts +58 -0
  567. package/dist/routes/admin/targeting.d.ts.map +1 -0
  568. package/dist/routes/admin/templates.d.ts +197 -0
  569. package/dist/routes/admin/templates.d.ts.map +1 -0
  570. package/dist/routes/admin/timeline.d.ts +51 -0
  571. package/dist/routes/admin/timeline.d.ts.map +1 -0
  572. package/dist/routes/admin/webhooks.d.ts +250 -0
  573. package/dist/routes/admin/webhooks.d.ts.map +1 -0
  574. package/dist/routes/campaigns/index.d.ts +239 -0
  575. package/dist/routes/campaigns/index.d.ts.map +1 -0
  576. package/dist/routes/connectors/index.d.ts +16 -0
  577. package/dist/routes/connectors/index.d.ts.map +1 -0
  578. package/dist/routes/contacts/index.d.ts +187 -0
  579. package/dist/routes/contacts/index.d.ts.map +1 -0
  580. package/dist/routes/email/index.d.ts +4 -0
  581. package/dist/routes/email/index.d.ts.map +1 -0
  582. package/dist/routes/email/preferences.d.ts +17 -0
  583. package/dist/routes/email/preferences.d.ts.map +1 -0
  584. package/dist/routes/email/unsubscribe.d.ts +17 -0
  585. package/dist/routes/email/unsubscribe.d.ts.map +1 -0
  586. package/dist/routes/emails/index.d.ts +90 -0
  587. package/dist/routes/emails/index.d.ts.map +1 -0
  588. package/dist/routes/events/index.d.ts +116 -0
  589. package/dist/routes/events/index.d.ts.map +1 -0
  590. package/dist/routes/feed/index.d.ts +248 -0
  591. package/dist/routes/feed/index.d.ts.map +1 -0
  592. package/dist/routes/feed/recipient.d.ts +65 -0
  593. package/dist/routes/feed/recipient.d.ts.map +1 -0
  594. package/dist/routes/flags/index.d.ts +94 -0
  595. package/dist/routes/flags/index.d.ts.map +1 -0
  596. package/dist/routes/groups/index.d.ts +192 -0
  597. package/dist/routes/groups/index.d.ts.map +1 -0
  598. package/dist/routes/health.d.ts +57 -0
  599. package/dist/routes/health.d.ts.map +1 -0
  600. package/dist/routes/index.d.ts +8 -0
  601. package/dist/routes/index.d.ts.map +1 -0
  602. package/dist/routes/lists/index.d.ts +266 -0
  603. package/dist/routes/lists/index.d.ts.map +1 -0
  604. package/dist/routes/referrals/index.d.ts +22 -0
  605. package/dist/routes/referrals/index.d.ts.map +1 -0
  606. package/dist/routes/referrals/me.d.ts +4 -0
  607. package/dist/routes/referrals/me.d.ts.map +1 -0
  608. package/dist/routes/referrals/report.d.ts +5 -0
  609. package/dist/routes/referrals/report.d.ts.map +1 -0
  610. package/dist/routes/referrals/shared.d.ts +16 -0
  611. package/dist/routes/referrals/shared.d.ts.map +1 -0
  612. package/dist/routes/referrals/touch.d.ts +5 -0
  613. package/dist/routes/referrals/touch.d.ts.map +1 -0
  614. package/dist/routes/snippet.d.ts +12 -0
  615. package/dist/routes/snippet.d.ts.map +1 -0
  616. package/dist/routes/tracking/answer.d.ts +56 -0
  617. package/dist/routes/tracking/answer.d.ts.map +1 -0
  618. package/dist/routes/tracking/arrive.d.ts +32 -0
  619. package/dist/routes/tracking/arrive.d.ts.map +1 -0
  620. package/dist/routes/tracking/click-pipeline.d.ts +213 -0
  621. package/dist/routes/tracking/click-pipeline.d.ts.map +1 -0
  622. package/dist/routes/tracking/click.d.ts +26 -0
  623. package/dist/routes/tracking/click.d.ts.map +1 -0
  624. package/dist/routes/tracking/identify.d.ts +32 -0
  625. package/dist/routes/tracking/identify.d.ts.map +1 -0
  626. package/dist/routes/tracking/index.d.ts +4 -0
  627. package/dist/routes/tracking/index.d.ts.map +1 -0
  628. package/dist/routes/tracking/open.d.ts +17 -0
  629. package/dist/routes/tracking/open.d.ts.map +1 -0
  630. package/dist/routes/tracking/short.d.ts +17 -0
  631. package/dist/routes/tracking/short.d.ts.map +1 -0
  632. package/dist/routes/tracking/vanity.d.ts +17 -0
  633. package/dist/routes/tracking/vanity.d.ts.map +1 -0
  634. package/dist/routes/webhooks/crm-provider.d.ts +24 -0
  635. package/dist/routes/webhooks/crm-provider.d.ts.map +1 -0
  636. package/dist/routes/webhooks/email-provider.d.ts +21 -0
  637. package/dist/routes/webhooks/email-provider.d.ts.map +1 -0
  638. package/dist/routes/webhooks/index.d.ts +8 -0
  639. package/dist/routes/webhooks/index.d.ts.map +1 -0
  640. package/dist/routes/webhooks/resend.d.ts +35 -0
  641. package/dist/routes/webhooks/resend.d.ts.map +1 -0
  642. package/dist/routes/webhooks/sms-provider.d.ts +23 -0
  643. package/dist/routes/webhooks/sms-provider.d.ts.map +1 -0
  644. package/dist/routes/webhooks/sources.d.ts +12 -0
  645. package/dist/routes/webhooks/sources.d.ts.map +1 -0
  646. package/dist/sources/define-contact-source.d.ts +114 -0
  647. package/dist/sources/define-contact-source.d.ts.map +1 -0
  648. package/dist/sources/registry.d.ts +31 -0
  649. package/dist/sources/registry.d.ts.map +1 -0
  650. package/dist/sources/webhook-source.d.ts +53 -0
  651. package/dist/sources/webhook-source.d.ts.map +1 -0
  652. package/dist/testing.d.ts +10 -0
  653. package/dist/testing.d.ts.map +1 -0
  654. package/dist/webhook-sources/define-webhook-source.d.ts +60 -0
  655. package/dist/webhook-sources/define-webhook-source.d.ts.map +1 -0
  656. package/dist/webhook-sources/presets/clerk.d.ts +9 -0
  657. package/dist/webhook-sources/presets/clerk.d.ts.map +1 -0
  658. package/dist/webhook-sources/presets/index.d.ts +140 -0
  659. package/dist/webhook-sources/presets/index.d.ts.map +1 -0
  660. package/dist/webhook-sources/presets/intercom.d.ts +44 -0
  661. package/dist/webhook-sources/presets/intercom.d.ts.map +1 -0
  662. package/dist/webhook-sources/presets/segment.d.ts +16 -0
  663. package/dist/webhook-sources/presets/segment.d.ts.map +1 -0
  664. package/dist/webhook-sources/presets/stripe.d.ts +20 -0
  665. package/dist/webhook-sources/presets/stripe.d.ts.map +1 -0
  666. package/dist/webhook-sources/presets/supabase.d.ts +23 -0
  667. package/dist/webhook-sources/presets/supabase.d.ts.map +1 -0
  668. package/dist/webhook-sources/verify.d.ts +48 -0
  669. package/dist/webhook-sources/verify.d.ts.map +1 -0
  670. package/dist/worker.d.ts +37 -0
  671. package/dist/worker.d.ts.map +1 -0
  672. package/dist/workflows/backfill-contact-id.d.ts +202 -0
  673. package/dist/workflows/backfill-contact-id.d.ts.map +1 -0
  674. package/dist/workflows/bucket-backfill.d.ts +64 -0
  675. package/dist/workflows/bucket-backfill.d.ts.map +1 -0
  676. package/dist/workflows/bucket-reconcile.d.ts +73 -0
  677. package/dist/workflows/bucket-reconcile.d.ts.map +1 -0
  678. package/dist/workflows/check-alerts.d.ts +10 -0
  679. package/dist/workflows/check-alerts.d.ts.map +1 -0
  680. package/dist/workflows/confirm-semantic-click.d.ts +15 -0
  681. package/dist/workflows/confirm-semantic-click.d.ts.map +1 -0
  682. package/dist/workflows/crm-reconcile.d.ts +27 -0
  683. package/dist/workflows/crm-reconcile.d.ts.map +1 -0
  684. package/dist/workflows/deliver-webhook.d.ts +88 -0
  685. package/dist/workflows/deliver-webhook.d.ts.map +1 -0
  686. package/dist/workflows/dispatch-conversion.d.ts +14 -0
  687. package/dist/workflows/dispatch-conversion.d.ts.map +1 -0
  688. package/dist/workflows/identity-alias-backfill.d.ts +96 -0
  689. package/dist/workflows/identity-alias-backfill.d.ts.map +1 -0
  690. package/dist/workflows/impact-digest.d.ts +142 -0
  691. package/dist/workflows/impact-digest.d.ts.map +1 -0
  692. package/dist/workflows/import-contacts.d.ts +14 -0
  693. package/dist/workflows/import-contacts.d.ts.map +1 -0
  694. package/dist/workflows/import-suppressions.d.ts +55 -0
  695. package/dist/workflows/import-suppressions.d.ts.map +1 -0
  696. package/dist/workflows/journey-blueprint-interpreter.d.ts +73 -0
  697. package/dist/workflows/journey-blueprint-interpreter.d.ts.map +1 -0
  698. package/dist/workflows/send-campaign.d.ts +128 -0
  699. package/dist/workflows/send-campaign.d.ts.map +1 -0
  700. package/dist/workflows/send-email.d.ts +15 -0
  701. package/dist/workflows/send-email.d.ts.map +1 -0
  702. package/dist/workflows/send-feed.d.ts +37 -0
  703. package/dist/workflows/send-feed.d.ts.map +1 -0
  704. package/package.json +60 -22
  705. package/src/app.ts +9 -1
  706. package/src/buckets/check-membership.ts +54 -20
  707. package/src/env.ts +30 -0
  708. package/src/journeys/journey-log.ts +25 -8
  709. package/src/lib/contacts.ts +47 -1
  710. package/src/lib/email-service-types.ts +10 -0
  711. package/src/lib/ingestion.ts +30 -19
  712. package/src/lib/mailer-bounce-idempotency.test.ts +7 -2
  713. package/src/lib/mailer-replied.test.ts +7 -2
  714. package/src/lib/mailer.ts +1 -0
  715. package/src/lib/outbound-endpoint-cache.ts +83 -0
  716. package/src/lib/outbound.ts +56 -37
  717. package/src/lib/seed-posthog-destination.ts +5 -1
  718. package/src/lib/tracked.ts +11 -3
  719. package/src/lib/tracking-events.ts +20 -3
  720. package/src/middleware/api-key.ts +69 -60
  721. package/src/middleware/publishable-key.ts +11 -23
  722. package/src/middleware/rate-limit.ts +165 -3
  723. package/src/routes/admin/api-keys.ts +148 -0
  724. package/src/routes/admin/targeting.ts +6 -1
  725. package/src/routes/admin/webhooks.ts +4 -0
  726. package/src/routes/index.ts +67 -24
  727. package/src/workflows/backfill-contact-id.ts +3 -7
  728. package/src/workflows/bucket-backfill.ts +2 -2
  729. package/src/workflows/bucket-reconcile.ts +28 -12
  730. package/src/workflows/check-alerts.ts +3 -9
  731. package/src/workflows/crm-reconcile.ts +3 -2
  732. package/src/workflows/deliver-webhook.ts +21 -8
  733. package/src/workflows/dispatch-conversion.ts +2 -2
  734. package/src/workflows/identity-alias-backfill.ts +3 -2
  735. package/src/workflows/impact-digest.ts +2 -2
  736. package/src/workflows/import-contacts.ts +3 -4
  737. package/src/workflows/import-suppressions.ts +4 -5
  738. package/src/workflows/send-campaign.ts +10 -1
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Outbound webhook signing core.
3
+ *
4
+ * Hogsend emits a Svix-style HMAC-SHA256 signed event stream. The signing
5
+ * scheme is the Standard Webhooks spec (the same one `svix` implements and that
6
+ * `plugin-resend` consumes for inbound Resend webhooks):
7
+ *
8
+ * signedContent = `${id}.${timestampSeconds}.${body}`
9
+ * signature = base64( HMAC_SHA256( base64decode(secret without `whsec_`), signedContent ) )
10
+ * header value = `v1,${signature}`
11
+ *
12
+ * Pure `node:crypto` equivalent (documented for the SDK / spec consumers and
13
+ * subscriber-side verification without a `svix` dependency):
14
+ *
15
+ * import { createHmac, timingSafeEqual } from "node:crypto";
16
+ * const key = Buffer.from(secret.slice(6), "base64"); // drop the `whsec_` prefix
17
+ * const sig = createHmac("sha256", key)
18
+ * .update(`${id}.${ts}.${body}`)
19
+ * .digest("base64");
20
+ * const header = `v1,${sig}`;
21
+ * // compare each space-delimited `v1,<sig>` candidate with timingSafeEqual.
22
+ */
23
+ /**
24
+ * The 35-event catalog — the SINGLE source of truth (schema, routes, client,
25
+ * CLI all derive from this). The `webhook.test` sentinel is intentionally NOT a
26
+ * member (it is delivered out-of-band regardless of an endpoint's `eventTypes`).
27
+ *
28
+ * `contact.subscribed` mirrors `contact.unsubscribed` for a genuine opt-IN
29
+ * (resubscribe-all or a category/channel grant), emitted from the single
30
+ * preference-write choke with `source` provenance — the consent audit signal
31
+ * for the explicit-opt-in SMS channel (grants were previously silent).
32
+ *
33
+ * The `sms.*` family mirrors the email lifecycle for the SMS channel:
34
+ * `sms.sent` (provider-accepted, first-party), `sms.delivered` / `sms.failed`
35
+ * (provider status webhook — the single source, no first-party signal), and
36
+ * `sms.clicked` (first-party, per-hit, from the `/s/:code` short-link
37
+ * redirect — the SMS sibling of `email.clicked`).
38
+ *
39
+ * `link.clicked` is the NON-email click event: a click on a tracked link that
40
+ * has no email send (Discord/referral/ad-hoc `createTrackedLink`). It is the
41
+ * deliberate counterpart to `email.clicked` so a non-email click never fires a
42
+ * malformed `email.clicked` (MF-missing #3).
43
+ *
44
+ * `link.arrived` is the landing-confirmed subset of `link.clicked`: the
45
+ * visitor reported back from the destination (opt-in `hs_ref` +
46
+ * POST /v1/t/arrive) with identity evidence.
47
+ *
48
+ * The `account.*` family reports a player's third-party platform account
49
+ * (`defineAccountLink`: Steam, Twitch, …) being bound to or released from a
50
+ * contact. `account.linked` and `account.unlinked` are the two STATE events —
51
+ * each carries the FULL current state including `{ state, version }`, never a
52
+ * delta, so a subscriber upserts on `(provider, providerUserId)` and applies
53
+ * only when `incoming.version > stored.version`. `account.link_failed` reports
54
+ * a flow that ended without mutating anything, so it carries no version and
55
+ * never mints a contact. Like `group.*`, all three are emitted from the
56
+ * intent-layer link/unlink call sites ONLY — never from the ingest path.
57
+ *
58
+ * `impact.digest` is the weekly facts-only impact rollup (shipped journey
59
+ * versions/labels + holdout-lift threshold crossings). It is the one
60
+ * SELF-REFERENTIAL event: the digest cron derives its watermark from its
61
+ * own `impact.digest` delivery rows in `webhook_deliveries`.
62
+ */
63
+ export declare const WEBHOOK_EVENT_TYPES: readonly ["contact.created", "contact.updated", "contact.deleted", "contact.unsubscribed", "contact.subscribed", "contact.control_group", "contact.refined", "email.sent", "email.delivered", "email.opened", "email.clicked", "email.action", "email.bounced", "email.complained", "email.replied", "sms.sent", "sms.delivered", "sms.failed", "sms.clicked", "journey.completed", "journey.heldout", "bucket.entered", "bucket.left", "link.clicked", "link.arrived", "funnel.stage_changed", "deal.quoted", "deal.sold", "group.identified", "group.member_added", "group.member_removed", "account.linked", "account.unlinked", "account.link_failed", "referral.touched", "referral.bound", "referral.qualified", "referral.converted", "referral.tree_converted", "referral.rejected", "impact.digest"];
64
+ export type WebhookEventType = (typeof WEBHOOK_EVENT_TYPES)[number];
65
+ /**
66
+ * Generate a new `whsec_<base64(32 bytes)>` signing secret plus its display
67
+ * prefix (safe to surface on list/get responses).
68
+ *
69
+ * NOTE: the secret body is STANDARD base64, not base64url. svix (via
70
+ * standardwebhooks → @stablelib/base64) strips the `whsec_` prefix and decodes
71
+ * the remainder with a STRICT standard-base64 decoder that rejects the `-`/`_`
72
+ * characters base64url emits (~74% of base64url secrets contain one and fail
73
+ * `new Webhook(secret)`). Standard base64 round-trips cleanly through both svix
74
+ * and the `node:crypto` fallback (`Buffer.from(secret.slice(6), "base64")`).
75
+ */
76
+ export declare function generateWebhookSecret(): {
77
+ secret: string;
78
+ secretPrefix: string;
79
+ };
80
+ export interface SignedWebhook {
81
+ headers: {
82
+ "Webhook-Id": string;
83
+ "Webhook-Timestamp": string;
84
+ "Webhook-Signature": string;
85
+ "Content-Type": "application/json";
86
+ };
87
+ /**
88
+ * The EXACT bytes that were signed AND must be sent. Never re-stringify the
89
+ * payload between signing and sending — the signature covers these bytes.
90
+ */
91
+ body: string;
92
+ }
93
+ /**
94
+ * Sign an outbound webhook payload, producing the Standard Webhooks header set
95
+ * (`Webhook-Id` / `Webhook-Timestamp` / `Webhook-Signature`) plus the exact
96
+ * `body` bytes that were signed.
97
+ *
98
+ * `timestamp` is unix SECONDS — the caller passes `Math.floor(Date.now()/1000)`.
99
+ * `payload` is JSON-stringified when an object; a string is used verbatim.
100
+ */
101
+ export declare function signWebhook(opts: {
102
+ id: string;
103
+ timestamp: number;
104
+ payload: unknown;
105
+ secret: string;
106
+ }): SignedWebhook;
107
+ /**
108
+ * Consumer/test-facing verification of an inbound Hogsend webhook. Enforces the
109
+ * 5-minute timestamp tolerance and uses a constant-time signature compare (both
110
+ * inside svix). Throws on a bad signature or stale timestamp.
111
+ *
112
+ * Accepts either Title-Case (`Webhook-Id`) or lowercase (`webhook-id`) header
113
+ * keys — and the `svix-*` aliases — by normalizing the header map first.
114
+ */
115
+ export declare function verifyWebhookSignature(opts: {
116
+ payload: string;
117
+ headers: Record<string, string>;
118
+ secret: string;
119
+ }): unknown;
120
+ //# sourceMappingURL=webhook-signing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook-signing.d.ts","sourceRoot":"","sources":["../../src/lib/webhook-signing.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,mBAAmB,+wBAmEtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,IAAI;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,CAGA;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE;QACP,YAAY,EAAE,MAAM,CAAC;QACrB,mBAAmB,EAAE,MAAM,CAAC;QAC5B,mBAAmB,EAAE,MAAM,CAAC;QAC5B,cAAc,EAAE,kBAAkB,CAAC;KACpC,CAAC;IACF;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,aAAa,CAqBhB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAqBV"}
@@ -0,0 +1,18 @@
1
+ import type { Logger } from "./logger.js";
2
+ export interface WorkerHeartbeat {
3
+ /** True when a fresh worker heartbeat is present in Redis. */
4
+ alive: boolean;
5
+ /** ISO timestamp the worker last wrote, when alive. */
6
+ lastSeenAt?: string;
7
+ }
8
+ /**
9
+ * Begin writing the worker heartbeat. Writes once immediately, then refreshes
10
+ * every {@link REFRESH_MS} with a {@link TTL_SECONDS} expiry — so an ungraceful
11
+ * worker death is reflected as "down" within the TTL. Returns a stop function
12
+ * that clears the timer and deletes the key for an immediate "down" signal on
13
+ * graceful shutdown.
14
+ */
15
+ export declare function startWorkerHeartbeat(logger: Logger): () => Promise<void>;
16
+ /** Read the current worker heartbeat. Resolves to `{ alive: false }` if Redis is unreachable. */
17
+ export declare function getWorkerHeartbeat(): Promise<WorkerHeartbeat>;
18
+ //# sourceMappingURL=worker-heartbeat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker-heartbeat.d.ts","sourceRoot":"","sources":["../../src/lib/worker-heartbeat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAmB1C,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,KAAK,EAAE,OAAO,CAAC;IACf,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAkCxE;AAED,iGAAiG;AACjG,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC,CAOnE"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Channel lists — engine-synthesized delivery channels layered on the SAME
3
+ * `email_preferences.categories` JSONB namespace as author-defined lists (D3).
4
+ * A channel is an auto-registered opt-out list: `in_app` (the notification
5
+ * feed) plus one per connector that exposes member-directed actions (discord,
6
+ * telegram). There is no new table and no authoring surface — channels are
7
+ * derived from the registered connector actions at container build time.
8
+ *
9
+ * POLARITY (zero behaviour flip): every channel is `defaultOptIn: true`, so
10
+ * `ListRegistry.isSubscribed(categories, id)` returns `categories[id] !== false`
11
+ * — subscribed unless the recipient explicitly set the category to `false`.
12
+ * That is EXACTLY the unknown-id fallback an UNregistered channel already
13
+ * resolved to (`isSubscribedByDefault` → `?? true`), so registering these lists
14
+ * flips zero existing behaviour; it only makes the channels visible in the
15
+ * catalog and (in a later phase) enforceable in `sendConnectorAction`.
16
+ */
17
+ import type { DefinedConnectorAction } from "../connectors/define-action.js";
18
+ import type { ListMeta } from "./define-list.js";
19
+ /**
20
+ * Reserved list id for the engine's in-app channel (the notification feed).
21
+ * Always synthesized first by {@link synthesizeChannelLists}; also the
22
+ * suppression key consulted by `sendFeedItem`.
23
+ */
24
+ export declare const IN_APP_LIST_ID = "in_app";
25
+ /**
26
+ * Synthesize the engine-owned channel {@link ListMeta}s from the registered
27
+ * connector actions.
28
+ *
29
+ * Always yields the `in_app` channel first. Then one channel per DISTINCT
30
+ * `connectorId` among actions declaring a member audience
31
+ * (`action.audience?.kind === "member"`), de-duplicated via a `Set` in stable
32
+ * first-appearance order. Actions WITHOUT a member audience (ops/channel-
33
+ * directed) never mint a channel. Channel display name = the connector id with
34
+ * its first letter capitalized ("discord" → "Discord").
35
+ *
36
+ * Every channel shares the opt-out polarity shape `{ defaultOptIn: true,
37
+ * enabled: true, kind: "channel" }` — see the module docblock for why this
38
+ * flips no existing behaviour.
39
+ */
40
+ export declare function synthesizeChannelLists(actions: DefinedConnectorAction[], opts?: {
41
+ sms?: boolean;
42
+ }): ListMeta[];
43
+ //# sourceMappingURL=channels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.d.ts","sourceRoot":"","sources":["../../src/lists/channels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,cAAc,WAAW,CAAC;AAOvC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,sBAAsB,EAAE,EACjC,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GACvB,QAAQ,EAAE,CA8CZ"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Email lists (D3) — code-defined subscription categories layered on top of the
3
+ * existing `email_preferences.categories` JSONB. A list is just a named category
4
+ * with a declared default polarity (`defaultOptIn`); there is NO new table.
5
+ *
6
+ * `defineList()` is the authoring entry point, mirroring `defineBucket()` /
7
+ * `defineJourney()`: a synchronous, definition-time call that validates the id
8
+ * and returns a `DefinedList`. The id shares the `email_preferences.categories`
9
+ * key namespace, so two ids are RESERVED for the engine's own non-list
10
+ * categories (`transactional`, `journey`) and rejected here (open risk #11).
11
+ */
12
+ /**
13
+ * List ids that collide with the engine's built-in, non-list
14
+ * `email_preferences.categories` keys — rejected by {@link defineList}, and
15
+ * ALSO the allowlist of categories a template may legitimately carry that are
16
+ * NOT a defined list (the boot-time template-category guard in `container.ts`
17
+ * reuses this set so the two can never drift). Exported for that reuse.
18
+ */
19
+ export declare const RESERVED_LIST_IDS: Set<string>;
20
+ /**
21
+ * Is `id` one of the reserved built-in categories ({@link RESERVED_LIST_IDS})?
22
+ * Case-insensitive, matching the `defineList` reservation check — so callers
23
+ * (e.g. the container's template-category validation) never re-implement the
24
+ * comparison and can't drift from the reservation rule.
25
+ */
26
+ export declare function isReservedListId(id: string): boolean;
27
+ /**
28
+ * The kind of list. `"topic"` is an author-defined subscription category (the
29
+ * `defineList` output — every manual list is a topic). `"channel"` is an
30
+ * engine-synthesized delivery channel (the in-app feed + one per connector that
31
+ * exposes member-directed actions), minted by `synthesizeChannelLists`, never
32
+ * authored. Read sites treat an absent `kind` as `"topic"` (`meta.kind ??
33
+ * "topic"`) so pre-existing manual `ListMeta` constructions keep compiling.
34
+ */
35
+ export type ListKind = "channel" | "topic";
36
+ /**
37
+ * The validated, fully-defaulted list metadata. `enabled` is always present
38
+ * after `defineList` (defaults to `true`); authoring input leaves it optional.
39
+ */
40
+ export interface ListMeta<Id extends string = string> {
41
+ id: Id;
42
+ name: string;
43
+ description?: string;
44
+ defaultOptIn: boolean;
45
+ enabled: boolean;
46
+ /**
47
+ * Whether this is an author-defined `"topic"` or an engine-synthesized
48
+ * delivery `"channel"`. Optional so existing manual constructions compile;
49
+ * read as `meta.kind ?? "topic"`. `defineList` always stamps `"topic"`.
50
+ */
51
+ kind?: ListKind;
52
+ }
53
+ /**
54
+ * A defined list. `meta` carries the canonical, defaulted metadata; `id` is
55
+ * surfaced directly for literal-typed consumption (mirrors `DefinedBucket`).
56
+ */
57
+ export interface DefinedList<Id extends string = string> {
58
+ readonly meta: ListMeta<Id>;
59
+ readonly id: Id;
60
+ }
61
+ /**
62
+ * Define an email list. Validates the id against {@link LIST_ID_PATTERN} and the
63
+ * {@link RESERVED_LIST_IDS} blocklist (since list ids share the
64
+ * `email_preferences.categories` namespace), then returns a `DefinedList` with
65
+ * `enabled` defaulted to `true`.
66
+ *
67
+ * @throws if `id` is empty, malformed, or a reserved category id.
68
+ */
69
+ export declare function defineList<const Id extends string>(meta: {
70
+ id: Id;
71
+ name: string;
72
+ description?: string;
73
+ defaultOptIn: boolean;
74
+ enabled?: boolean;
75
+ }): DefinedList<Id>;
76
+ //# sourceMappingURL=define-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-list.d.ts","sourceRoot":"","sources":["../../src/lists/define-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,aAAwC,CAAC;AAEvE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAEpD;AAgBD;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3C;;;GAGG;AACH,MAAM,WAAW,QAAQ,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM;IAClD,EAAE,EAAE,EAAE,CAAC;IACP,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW,CAAC,EAAE,SAAS,MAAM,GAAG,MAAM;IACrD,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,IAAI,EAAE;IACxD,EAAE,EAAE,EAAE,CAAC;IACP,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,WAAW,CAAC,EAAE,CAAC,CAkClB"}
@@ -0,0 +1,8 @@
1
+ import { ListRegistry } from "./registry.js";
2
+ /** Read the installed registry, or an empty (legacy-behaviour) default. */
3
+ export declare function getListRegistry(): ListRegistry;
4
+ /** Install the process registry (called by `buildListRegistry`). */
5
+ export declare function setListRegistry(next: ListRegistry): void;
6
+ /** Reset to an empty registry — for test cleanup. */
7
+ export declare function resetListRegistry(): void;
8
+ //# sourceMappingURL=registry-singleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-singleton.d.ts","sourceRoot":"","sources":["../../src/lists/registry-singleton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAsB7C,2EAA2E;AAC3E,wBAAgB,eAAe,IAAI,YAAY,CAK9C;AAED,oEAAoE;AACpE,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAExD;AAED,qDAAqD;AACrD,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
@@ -0,0 +1,66 @@
1
+ import type { DefinedList, ListMeta } from "./define-list.js";
2
+ /**
3
+ * In-process index of the defined email lists (D3). Mirrors `BucketRegistry` /
4
+ * `JourneyRegistry`: a plain id-keyed map plus the polarity helpers that are the
5
+ * SINGLE SOURCE OF TRUTH for "is this category subscribed", consumed by the
6
+ * mailer's suppression check AND the preference-center render so the two never
7
+ * drift.
8
+ *
9
+ * A list shares the `email_preferences.categories` JSONB key namespace with the
10
+ * built-in `transactional`/`journey` categories. The registry only knows about
11
+ * defined lists — an UNKNOWN id resolves to legacy opt-in behaviour via
12
+ * {@link ListRegistry.isSubscribedByDefault} (`?? true`).
13
+ */
14
+ export declare class ListRegistry {
15
+ private lists;
16
+ register(list: ListMeta): void;
17
+ get(id: string): ListMeta | undefined;
18
+ getAll(): ListMeta[];
19
+ getEnabled(): ListMeta[];
20
+ has(id: string): boolean;
21
+ count(): number;
22
+ /**
23
+ * The list's default polarity. An unknown id (not a defined list — e.g. a
24
+ * built-in `transactional`/`journey` category, or a stale list) defaults to
25
+ * `true` (opt-in), preserving legacy behaviour: blocked only on explicit
26
+ * `false`.
27
+ */
28
+ isSubscribedByDefault(id: string): boolean;
29
+ /**
30
+ * The LOCKED polarity rule (§2.6). Given the stored `categories` map and a
31
+ * category id, decide whether the recipient is subscribed:
32
+ * - opt-in default (`defaultOptIn true`): subscribed unless explicitly `false`
33
+ * - opt-out default (`defaultOptIn false`): subscribed only when explicitly `true`
34
+ *
35
+ * Unknown ids fall through to opt-in default (via
36
+ * {@link ListRegistry.isSubscribedByDefault}), matching legacy semantics.
37
+ */
38
+ isSubscribed(categories: Record<string, boolean>, id: string): boolean;
39
+ /**
40
+ * Is `id` a registered channel (an engine-synthesized delivery channel — the
41
+ * in-app feed or a per-connector opt-out list) rather than an author-defined
42
+ * topic? False for topics, unknown ids, and the built-in categories.
43
+ */
44
+ isChannel(id: string): boolean;
45
+ }
46
+ /**
47
+ * Build a {@link ListRegistry} from an injected array of lists, applying the
48
+ * enabled filter, and install it as the process singleton (so the mailer's
49
+ * suppression check and the preference center can resolve it). Returns the
50
+ * registry.
51
+ *
52
+ * `parseEnabledFilter` (journeys/registry.ts) is reused as-is — `ENABLED_LISTS`
53
+ * honours the same `"*"`-or-csv contract as `ENABLED_JOURNEYS` /
54
+ * `ENABLED_BUCKETS`. Disabled user lists (filtered out OR `enabled: false`) are
55
+ * NOT registered, so an unknown id resolves to legacy opt-in.
56
+ *
57
+ * `channels` (engine-synthesized channel metas from `synthesizeChannelLists`)
58
+ * are registered AFTER the user lists, UNCONDITIONALLY — the `ENABLED_LISTS`
59
+ * filter does NOT apply. A "disabled" channel would hide the catalog entry while
60
+ * opt-out-polarity enforcement silently continued (a confusing half-state), so
61
+ * channels are always on. If a filtered-IN user list id collides with a channel
62
+ * id, we throw an actionable error rather than let one silently shadow the
63
+ * other.
64
+ */
65
+ export declare function buildListRegistry(lists: DefinedList[], enabledFilter?: string, channels?: ListMeta[]): ListRegistry;
66
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/lists/registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI9D;;;;;;;;;;;GAWG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAoC;IAEjD,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI;IAI9B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS;IAIrC,MAAM,IAAI,QAAQ,EAAE;IAIpB,UAAU,IAAI,QAAQ,EAAE;IAIxB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB,KAAK,IAAI,MAAM;IAIf;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAI1C;;;;;;;;OAQG;IACH,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO;IAQtE;;;;OAIG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;CAG/B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,WAAW,EAAE,EACpB,aAAa,CAAC,EAAE,MAAM,EACtB,QAAQ,GAAE,QAAQ,EAAO,GACxB,YAAY,CAqBd"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Pure list-polarity decision shared by production registries and deterministic
3
+ * journey tests.
4
+ */
5
+ export declare function isListSubscribed(opts: {
6
+ categories: Record<string, boolean>;
7
+ id: string;
8
+ defaultOptIn: boolean;
9
+ }): boolean;
10
+ //# sourceMappingURL=subscription.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/lists/subscription.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAIV"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Journey Blueprint authoring vocabulary — the shared description text for
3
+ * every agent-facing surface (the in-process tools in `blueprint-tools.ts`
4
+ * and the `@hogsend/mcp` server's authoring-guide resource). One source of
5
+ * truth, so the tool descriptions and the MCP resource can never drift.
6
+ *
7
+ * Two tiers:
8
+ * - `GRAPH_FORMAT` / `ISSUE_LOOP_HINT` — compact one-liners embedded in tool
9
+ * descriptions, paid for on every turn (keep terse).
10
+ * - `BLUEPRINT_AUTHORING_GUIDE` — the full markdown reference, loaded on
11
+ * demand (an MCP resource fetch), so the complete vocabulary doesn't tax
12
+ * every conversation turn.
13
+ *
14
+ * Every factual claim below is cross-checked against the execution-tier
15
+ * schema (`blueprintGraphSchema` + the structural checks,
16
+ * `@hogsend/core/src/journey-graph/blueprint.ts`) and the service-layer input
17
+ * schemas (`lib/blueprints.ts`). Update THIS file when the vocabulary grows.
18
+ */
19
+ /**
20
+ * The closed executable vocabulary (spec §6/§7), summarized for the model.
21
+ * Kept in the descriptions of every graph-accepting tool so an agent can
22
+ * author without a docs round-trip.
23
+ */
24
+ export declare const GRAPH_FORMAT: string;
25
+ export declare const ISSUE_LOOP_HINT: string;
26
+ /**
27
+ * The full authoring reference — `GRAPH_FORMAT` expanded into a readable
28
+ * markdown document. Served on demand (e.g. as the
29
+ * `hogsend://blueprint-authoring-guide` MCP resource) instead of inlined
30
+ * into every tool description.
31
+ */
32
+ export declare const BLUEPRINT_AUTHORING_GUIDE = "# Journey Blueprint authoring guide\n\nA Journey Blueprint is a lifecycle automation authored as a JSON graph,\nstored in the database, and executed by the engine's generic interpreter \u2014\nno deploy in the loop. The graph is fully validated at save time (schema +\nstructure + template/connector registries); an invalid graph is never saved.\n\n## Graph shape\n\n```\n{ \"journeyId\": \"<blueprint id>\", \"nodes\": [...], \"edges\": [...] }\n```\n\n- `journeyId` IS the blueprint id \u2014 one id, one namespace (it must not\n collide with a registered code journey's id, and it is immutable after\n create: an updated graph's `journeyId` must equal the blueprint id).\n- Every node: `{ id, type, title, subtitle?, meta? }` \u2014 `id` and\n `title` are required strings; `meta` requirements depend on `type`.\n- Every edge: `{ id, source, target, label?, kind? }` \u2014 `source`/\n `target` are node ids. `kind` is one of `\"default\"` (same as\n omitted), `\"answered\"`, `\"timedOut\"`, `\"conditional-true\"`,\n `\"conditional-false\"`.\n\n## Node types (closed executable vocabulary)\n\n| Type | Required meta | Semantics |\n|---|---|---|\n| `start` | \u2014 | Exactly one per graph; the entry point. |\n| `sleep` | `duration` | Durable sleep for a fixed duration. |\n| `wait` | `event`, `timeout` (a duration) | Wait until THIS user emits `event` OR `timeout` elapses. Fork with one `answered` + one `timedOut` edge, or use a single unconditional edge. |\n| `send` | `template`, optional `idempotencyLabel` | Send an email. `template` MUST be a registered template key (list them first); an unregistered key is rejected at save time. |\n| `connector` | `connectorId`, `action` | Fire a registered connector action (e.g. Discord/Telegram). Rejected at save time if the action isn't registered. |\n| `checkpoint` | \u2014 | Observability marker; the node id is the label. |\n| `trigger` | `event` | Push an event through the full ingest pipeline (can enroll other journeys). |\n| `decision` / `branch` | `conditions` (non-empty `ConditionEval[]`) | Binary fork: exactly one `conditional-true` + one `conditional-false` outgoing edge. The conditions array is ANDed \u2014 use a single `composite` condition for OR. |\n| `end-completed` / `end-exited` / `end-failed` | \u2014 | Terminals; no outgoing edges. |\n\nNOT executable in a blueprint (display-tier only, rejected with a named\nissue): `sleepUntil`, `capture`, `digest`, `unknown`.\n\n## Durations\n\nEverywhere a duration appears (`sleep.meta.duration`, `wait.meta.timeout`,\n`entryPeriod`, `suppress`):\n\n```\n{ \"hours\"?: number, \"minutes\"?: number, \"seconds\"?: number }\n```\n\nKeys are strict and values non-negative. At least one key is required\n(except `suppress`, where `{}` means \"disabled\"). There is NO `days`\nkey \u2014 `{ \"days\": 3 }` is rejected loudly (write `{ \"hours\": 72 }`).\n\n## Conditions (`ConditionEval`)\n\nUsed by `decision`/`branch` nodes. Discriminated on `type`:\n\n- **property** \u2014 `{ type: \"property\", property, operator, value? }`.\n Operators: `eq | neq | gt | gte | lt | lte | exists | not_exists |\n contains`. `value` is a string/number/boolean (omit for\n `exists`/`not_exists`).\n- **event** \u2014 `{ type: \"event\", eventName, check, operator?, value?,\n within? }`. `check`: `exists | not_exists | count`; for `count`,\n pair `operator` (`gt | gte | lt | lte | eq`) with a numeric `value`.\n `within` is an optional duration window.\n- **email_engagement** \u2014 `{ type: \"email_engagement\", templateKey,\n check }`. `check`: `opened | clicked | not_opened | not_clicked`.\n- **composite** \u2014 `{ type: \"composite\", operator: \"and\" | \"or\",\n conditions: ConditionEval[] }` (nestable).\n\n`triggerWhere` and `exitOn[].where` accept ONLY property conditions\n(they evaluate against the incoming event's properties).\n\n## Structural rules (all validated at save time)\n\n- Node and edge ids are unique; every edge connects two existing nodes.\n- Exactly one `start` node; every node is reachable from it.\n- The graph is acyclic (no loop constructs in v1).\n- Fan-out is unambiguous: only `decision`/`branch` (one true + one false\n edge) and `wait` (one answered + one timedOut, or a single unconditional\n edge) fork; every other node has at most one outgoing edge; `end-*`\n nodes have none.\n\n## Record-level fields (on the blueprint, NOT in the graph)\n\n- `name` (required), `description?`.\n- `status` \u2014 `draft` (default) | `enabled` | `disabled`. Create\n accepts `draft`/`enabled`; afterwards transitions go through the\n enable/disable operations (enable re-validates the stored graph against\n the CURRENT template/connector registries).\n- `triggerEvent` (required) \u2014 the event name that enrolls users.\n- `triggerWhere?` \u2014 property conditions the trigger event's properties\n must satisfy for enrollment.\n- `entryLimit` (required) \u2014 `once | once_per_period | unlimited`; pair\n `once_per_period` with `entryPeriod` (a duration).\n- `exitOn?` \u2014 `[{ event, where? }]`: events that abort in-flight runs.\n- `suppress` (required) \u2014 quiet-period duration after a completed run;\n `{}` disables suppression.\n\nReserved namespaces `email.*`, `journey.*`, `bucket.*`, `contact.*`\nare engine-emitted \u2014 do not use them as blueprint trigger events.\n\n## Workflow: validate, iterate, then write\n\nValidation returns structured issues `[{ nodeId?, edgeId?, path, code,\nmessage }]` naming exactly what is wrong and where \u2014 fix and retry.\nIterate with the validate (dry-run) surface until the graph is valid, then\ncreate/update; the same checks run on every write, so nothing invalid is\never saved. A `valid: false` report is a successful call, not an error.\nEvent names are an open vocabulary (prefer an observed/declared name over\ninventing a near-duplicate); template keys and connector actions are closed\nregistries \u2014 list them before referencing them.\n";
33
+ //# sourceMappingURL=authoring-guide.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authoring-guide.d.ts","sourceRoot":"","sources":["../../src/mcp/authoring-guide.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY,QAW6D,CAAC;AAEvF,eAAO,MAAM,eAAe,QAEgD,CAAC;AAE7E;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,61LAgHrC,CAAC"}