sendwend 0.0.0-stage → 12.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (680) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2082 -2
  3. package/dist/_virtual/_rolldown/runtime.cjs +22 -0
  4. package/dist/apns-relay.cjs +91 -0
  5. package/dist/apns-relay.cjs.map +1 -0
  6. package/dist/apns-relay.d.cts +26 -0
  7. package/dist/apns-relay.d.cts.map +1 -0
  8. package/dist/apns-relay.d.mts +26 -0
  9. package/dist/apns-relay.d.mts.map +1 -0
  10. package/dist/apns-relay.mjs +90 -0
  11. package/dist/apns-relay.mjs.map +1 -0
  12. package/dist/apns.cjs +215 -0
  13. package/dist/apns.cjs.map +1 -0
  14. package/dist/apns.d.cts +110 -0
  15. package/dist/apns.d.cts.map +1 -0
  16. package/dist/apns.d.mts +110 -0
  17. package/dist/apns.d.mts.map +1 -0
  18. package/dist/apns.mjs +207 -0
  19. package/dist/apns.mjs.map +1 -0
  20. package/dist/aws/engine-step.cjs +105 -0
  21. package/dist/aws/engine-step.cjs.map +1 -0
  22. package/dist/aws/engine-step.d.cts +42 -0
  23. package/dist/aws/engine-step.d.cts.map +1 -0
  24. package/dist/aws/engine-step.d.mts +42 -0
  25. package/dist/aws/engine-step.d.mts.map +1 -0
  26. package/dist/aws/engine-step.mjs +103 -0
  27. package/dist/aws/engine-step.mjs.map +1 -0
  28. package/dist/aws/function-url.cjs +53 -0
  29. package/dist/aws/function-url.cjs.map +1 -0
  30. package/dist/aws/function-url.d.cts +36 -0
  31. package/dist/aws/function-url.d.cts.map +1 -0
  32. package/dist/aws/function-url.d.mts +36 -0
  33. package/dist/aws/function-url.d.mts.map +1 -0
  34. package/dist/aws/function-url.mjs +50 -0
  35. package/dist/aws/function-url.mjs.map +1 -0
  36. package/dist/aws/index.cjs +232 -0
  37. package/dist/aws/index.cjs.map +1 -0
  38. package/dist/aws/index.d.cts +73 -0
  39. package/dist/aws/index.d.cts.map +1 -0
  40. package/dist/aws/index.d.mts +73 -0
  41. package/dist/aws/index.d.mts.map +1 -0
  42. package/dist/aws/index.mjs +218 -0
  43. package/dist/aws/index.mjs.map +1 -0
  44. package/dist/aws/instances.cjs +218 -0
  45. package/dist/aws/instances.cjs.map +1 -0
  46. package/dist/aws/instances.d.cts +102 -0
  47. package/dist/aws/instances.d.cts.map +1 -0
  48. package/dist/aws/instances.d.mts +102 -0
  49. package/dist/aws/instances.d.mts.map +1 -0
  50. package/dist/aws/instances.mjs +214 -0
  51. package/dist/aws/instances.mjs.map +1 -0
  52. package/dist/aws/lambda-api.cjs +86 -0
  53. package/dist/aws/lambda-api.cjs.map +1 -0
  54. package/dist/aws/lambda-api.d.cts +41 -0
  55. package/dist/aws/lambda-api.d.cts.map +1 -0
  56. package/dist/aws/lambda-api.d.mts +41 -0
  57. package/dist/aws/lambda-api.d.mts.map +1 -0
  58. package/dist/aws/lambda-api.mjs +85 -0
  59. package/dist/aws/lambda-api.mjs.map +1 -0
  60. package/dist/client.cjs +216 -0
  61. package/dist/client.cjs.map +1 -0
  62. package/dist/client.d.cts +193 -0
  63. package/dist/client.d.cts.map +1 -0
  64. package/dist/client.d.mts +193 -0
  65. package/dist/client.d.mts.map +1 -0
  66. package/dist/client.mjs +212 -0
  67. package/dist/client.mjs.map +1 -0
  68. package/dist/cloudflare/bindings.cjs +49 -0
  69. package/dist/cloudflare/bindings.cjs.map +1 -0
  70. package/dist/cloudflare/bindings.d.cts +31 -0
  71. package/dist/cloudflare/bindings.d.cts.map +1 -0
  72. package/dist/cloudflare/bindings.d.mts +31 -0
  73. package/dist/cloudflare/bindings.d.mts.map +1 -0
  74. package/dist/cloudflare/bindings.mjs +46 -0
  75. package/dist/cloudflare/bindings.mjs.map +1 -0
  76. package/dist/cloudflare/index.cjs +73 -0
  77. package/dist/cloudflare/index.d.cts +25 -0
  78. package/dist/cloudflare/index.d.mts +25 -0
  79. package/dist/cloudflare/index.mjs +20 -0
  80. package/dist/cloudflare/runner.cjs +200 -0
  81. package/dist/cloudflare/runner.cjs.map +1 -0
  82. package/dist/cloudflare/runner.d.cts +83 -0
  83. package/dist/cloudflare/runner.d.cts.map +1 -0
  84. package/dist/cloudflare/runner.d.mts +83 -0
  85. package/dist/cloudflare/runner.d.mts.map +1 -0
  86. package/dist/cloudflare/runner.mjs +199 -0
  87. package/dist/cloudflare/runner.mjs.map +1 -0
  88. package/dist/cloudflare/worker.cjs +106 -0
  89. package/dist/cloudflare/worker.cjs.map +1 -0
  90. package/dist/cloudflare/worker.d.cts +52 -0
  91. package/dist/cloudflare/worker.d.cts.map +1 -0
  92. package/dist/cloudflare/worker.d.mts +52 -0
  93. package/dist/cloudflare/worker.d.mts.map +1 -0
  94. package/dist/cloudflare/worker.mjs +104 -0
  95. package/dist/cloudflare/worker.mjs.map +1 -0
  96. package/dist/cloudflare/workers.d.cjs +0 -0
  97. package/dist/cloudflare/workers.d.cts +42 -0
  98. package/dist/cloudflare/workers.d.cts.map +1 -0
  99. package/dist/cloudflare/workers.d.mts +42 -0
  100. package/dist/cloudflare/workers.d.mts.map +1 -0
  101. package/dist/config.cjs +257 -0
  102. package/dist/config.cjs.map +1 -0
  103. package/dist/config.d.cts +184 -0
  104. package/dist/config.d.cts.map +1 -0
  105. package/dist/config.d.mts +184 -0
  106. package/dist/config.d.mts.map +1 -0
  107. package/dist/config.mjs +246 -0
  108. package/dist/config.mjs.map +1 -0
  109. package/dist/contract.cjs +222 -0
  110. package/dist/contract.cjs.map +1 -0
  111. package/dist/contract.d.cts +110 -0
  112. package/dist/contract.d.cts.map +1 -0
  113. package/dist/contract.d.mts +110 -0
  114. package/dist/contract.d.mts.map +1 -0
  115. package/dist/contract.mjs +216 -0
  116. package/dist/contract.mjs.map +1 -0
  117. package/dist/date-time.cjs +22 -0
  118. package/dist/date-time.cjs.map +1 -0
  119. package/dist/date-time.d.cts +10 -0
  120. package/dist/date-time.d.cts.map +1 -0
  121. package/dist/date-time.d.mts +10 -0
  122. package/dist/date-time.d.mts.map +1 -0
  123. package/dist/date-time.mjs +21 -0
  124. package/dist/date-time.mjs.map +1 -0
  125. package/dist/dsl/action.cjs +25 -0
  126. package/dist/dsl/action.cjs.map +1 -0
  127. package/dist/dsl/action.d.cts +63 -0
  128. package/dist/dsl/action.d.cts.map +1 -0
  129. package/dist/dsl/action.d.mts +63 -0
  130. package/dist/dsl/action.d.mts.map +1 -0
  131. package/dist/dsl/action.mjs +24 -0
  132. package/dist/dsl/action.mjs.map +1 -0
  133. package/dist/dsl/base.cjs +33 -0
  134. package/dist/dsl/base.cjs.map +1 -0
  135. package/dist/dsl/base.d.cts +43 -0
  136. package/dist/dsl/base.d.cts.map +1 -0
  137. package/dist/dsl/base.d.mts +43 -0
  138. package/dist/dsl/base.d.mts.map +1 -0
  139. package/dist/dsl/base.mjs +29 -0
  140. package/dist/dsl/base.mjs.map +1 -0
  141. package/dist/dsl/bundle.cjs +287 -0
  142. package/dist/dsl/bundle.cjs.map +1 -0
  143. package/dist/dsl/bundle.d.cts +33 -0
  144. package/dist/dsl/bundle.d.cts.map +1 -0
  145. package/dist/dsl/bundle.d.mts +33 -0
  146. package/dist/dsl/bundle.d.mts.map +1 -0
  147. package/dist/dsl/bundle.mjs +284 -0
  148. package/dist/dsl/bundle.mjs.map +1 -0
  149. package/dist/dsl/condition.cjs +200 -0
  150. package/dist/dsl/condition.cjs.map +1 -0
  151. package/dist/dsl/condition.d.cts +151 -0
  152. package/dist/dsl/condition.d.cts.map +1 -0
  153. package/dist/dsl/condition.d.mts +151 -0
  154. package/dist/dsl/condition.d.mts.map +1 -0
  155. package/dist/dsl/condition.mjs +178 -0
  156. package/dist/dsl/condition.mjs.map +1 -0
  157. package/dist/dsl/flow.cjs +335 -0
  158. package/dist/dsl/flow.cjs.map +1 -0
  159. package/dist/dsl/flow.d.cts +278 -0
  160. package/dist/dsl/flow.d.cts.map +1 -0
  161. package/dist/dsl/flow.d.mts +278 -0
  162. package/dist/dsl/flow.d.mts.map +1 -0
  163. package/dist/dsl/flow.mjs +331 -0
  164. package/dist/dsl/flow.mjs.map +1 -0
  165. package/dist/dsl/index.cjs +37 -0
  166. package/dist/dsl/index.d.cts +34 -0
  167. package/dist/dsl/index.d.mts +34 -0
  168. package/dist/dsl/index.mjs +9 -0
  169. package/dist/dsl/refs.cjs +101 -0
  170. package/dist/dsl/refs.cjs.map +1 -0
  171. package/dist/dsl/refs.d.cts +127 -0
  172. package/dist/dsl/refs.d.cts.map +1 -0
  173. package/dist/dsl/refs.d.mts +127 -0
  174. package/dist/dsl/refs.d.mts.map +1 -0
  175. package/dist/dsl/refs.mjs +93 -0
  176. package/dist/dsl/refs.mjs.map +1 -0
  177. package/dist/dsl/template.cjs +19 -0
  178. package/dist/dsl/template.cjs.map +1 -0
  179. package/dist/dsl/template.d.cts +30 -0
  180. package/dist/dsl/template.d.cts.map +1 -0
  181. package/dist/dsl/template.d.mts +30 -0
  182. package/dist/dsl/template.d.mts.map +1 -0
  183. package/dist/dsl/template.mjs +18 -0
  184. package/dist/dsl/template.mjs.map +1 -0
  185. package/dist/dsl/trigger.cjs +53 -0
  186. package/dist/dsl/trigger.cjs.map +1 -0
  187. package/dist/dsl/trigger.d.cts +112 -0
  188. package/dist/dsl/trigger.d.cts.map +1 -0
  189. package/dist/dsl/trigger.d.mts +112 -0
  190. package/dist/dsl/trigger.d.mts.map +1 -0
  191. package/dist/dsl/trigger.mjs +52 -0
  192. package/dist/dsl/trigger.mjs.map +1 -0
  193. package/dist/dsl/workflow.cjs +143 -0
  194. package/dist/dsl/workflow.cjs.map +1 -0
  195. package/dist/dsl/workflow.d.cts +88 -0
  196. package/dist/dsl/workflow.d.cts.map +1 -0
  197. package/dist/dsl/workflow.d.mts +88 -0
  198. package/dist/dsl/workflow.d.mts.map +1 -0
  199. package/dist/dsl/workflow.mjs +142 -0
  200. package/dist/dsl/workflow.mjs.map +1 -0
  201. package/dist/email-context.cjs +28 -0
  202. package/dist/email-context.cjs.map +1 -0
  203. package/dist/email-context.d.cts +9 -0
  204. package/dist/email-context.d.cts.map +1 -0
  205. package/dist/email-context.d.mts +9 -0
  206. package/dist/email-context.d.mts.map +1 -0
  207. package/dist/email-context.mjs +26 -0
  208. package/dist/email-context.mjs.map +1 -0
  209. package/dist/email-sender.cjs +93 -0
  210. package/dist/email-sender.cjs.map +1 -0
  211. package/dist/email-sender.d.cts +88 -0
  212. package/dist/email-sender.d.cts.map +1 -0
  213. package/dist/email-sender.d.mts +88 -0
  214. package/dist/email-sender.d.mts.map +1 -0
  215. package/dist/email-sender.mjs +90 -0
  216. package/dist/email-sender.mjs.map +1 -0
  217. package/dist/email.cjs +73 -0
  218. package/dist/email.cjs.map +1 -0
  219. package/dist/email.d.cts +59 -0
  220. package/dist/email.d.cts.map +1 -0
  221. package/dist/email.d.mts +59 -0
  222. package/dist/email.d.mts.map +1 -0
  223. package/dist/email.mjs +68 -0
  224. package/dist/email.mjs.map +1 -0
  225. package/dist/engine/actions.cjs +19 -0
  226. package/dist/engine/actions.cjs.map +1 -0
  227. package/dist/engine/actions.d.cts +27 -0
  228. package/dist/engine/actions.d.cts.map +1 -0
  229. package/dist/engine/actions.d.mts +27 -0
  230. package/dist/engine/actions.d.mts.map +1 -0
  231. package/dist/engine/actions.mjs +18 -0
  232. package/dist/engine/actions.mjs.map +1 -0
  233. package/dist/engine/bucket.cjs +71 -0
  234. package/dist/engine/bucket.cjs.map +1 -0
  235. package/dist/engine/bucket.d.cts +30 -0
  236. package/dist/engine/bucket.d.cts.map +1 -0
  237. package/dist/engine/bucket.d.mts +30 -0
  238. package/dist/engine/bucket.d.mts.map +1 -0
  239. package/dist/engine/bucket.mjs +68 -0
  240. package/dist/engine/bucket.mjs.map +1 -0
  241. package/dist/engine/condition.cjs +199 -0
  242. package/dist/engine/condition.cjs.map +1 -0
  243. package/dist/engine/condition.d.cts +76 -0
  244. package/dist/engine/condition.d.cts.map +1 -0
  245. package/dist/engine/condition.d.mts +76 -0
  246. package/dist/engine/condition.d.mts.map +1 -0
  247. package/dist/engine/condition.mjs +192 -0
  248. package/dist/engine/condition.mjs.map +1 -0
  249. package/dist/engine/duration.cjs +33 -0
  250. package/dist/engine/duration.cjs.map +1 -0
  251. package/dist/engine/duration.d.cts +3 -0
  252. package/dist/engine/duration.d.cts.map +1 -0
  253. package/dist/engine/duration.d.mts +3 -0
  254. package/dist/engine/duration.d.mts.map +1 -0
  255. package/dist/engine/duration.mjs +32 -0
  256. package/dist/engine/duration.mjs.map +1 -0
  257. package/dist/engine/index.cjs +33 -0
  258. package/dist/engine/index.d.cts +10 -0
  259. package/dist/engine/index.d.mts +10 -0
  260. package/dist/engine/index.mjs +9 -0
  261. package/dist/engine/interpreter.cjs +613 -0
  262. package/dist/engine/interpreter.cjs.map +1 -0
  263. package/dist/engine/interpreter.d.cts +4 -0
  264. package/dist/engine/interpreter.d.cts.map +1 -0
  265. package/dist/engine/interpreter.d.mts +4 -0
  266. package/dist/engine/interpreter.d.mts.map +1 -0
  267. package/dist/engine/interpreter.mjs +612 -0
  268. package/dist/engine/interpreter.mjs.map +1 -0
  269. package/dist/engine/ports.cjs +0 -0
  270. package/dist/engine/ports.d.cts +373 -0
  271. package/dist/engine/ports.d.cts.map +1 -0
  272. package/dist/engine/ports.d.mts +373 -0
  273. package/dist/engine/ports.d.mts.map +1 -0
  274. package/dist/engine/ports.mjs +1 -0
  275. package/dist/engine/recipient.cjs +22 -0
  276. package/dist/engine/recipient.cjs.map +1 -0
  277. package/dist/engine/recipient.d.cts +11 -0
  278. package/dist/engine/recipient.d.cts.map +1 -0
  279. package/dist/engine/recipient.d.mts +11 -0
  280. package/dist/engine/recipient.d.mts.map +1 -0
  281. package/dist/engine/recipient.mjs +21 -0
  282. package/dist/engine/recipient.mjs.map +1 -0
  283. package/dist/engine/retry.cjs +106 -0
  284. package/dist/engine/retry.cjs.map +1 -0
  285. package/dist/engine/retry.d.cts +73 -0
  286. package/dist/engine/retry.d.cts.map +1 -0
  287. package/dist/engine/retry.d.mts +73 -0
  288. package/dist/engine/retry.d.mts.map +1 -0
  289. package/dist/engine/retry.mjs +98 -0
  290. package/dist/engine/retry.mjs.map +1 -0
  291. package/dist/engine/time-scale.cjs +153 -0
  292. package/dist/engine/time-scale.cjs.map +1 -0
  293. package/dist/engine/time-scale.d.cts +41 -0
  294. package/dist/engine/time-scale.d.cts.map +1 -0
  295. package/dist/engine/time-scale.d.mts +41 -0
  296. package/dist/engine/time-scale.d.mts.map +1 -0
  297. package/dist/engine/time-scale.mjs +150 -0
  298. package/dist/engine/time-scale.mjs.map +1 -0
  299. package/dist/engine/time-window.cjs +148 -0
  300. package/dist/engine/time-window.cjs.map +1 -0
  301. package/dist/engine/time-window.d.cts +20 -0
  302. package/dist/engine/time-window.d.cts.map +1 -0
  303. package/dist/engine/time-window.d.mts +20 -0
  304. package/dist/engine/time-window.d.mts.map +1 -0
  305. package/dist/engine/time-window.mjs +146 -0
  306. package/dist/engine/time-window.mjs.map +1 -0
  307. package/dist/fcm.cjs +208 -0
  308. package/dist/fcm.cjs.map +1 -0
  309. package/dist/fcm.d.cts +89 -0
  310. package/dist/fcm.d.cts.map +1 -0
  311. package/dist/fcm.d.mts +89 -0
  312. package/dist/fcm.d.mts.map +1 -0
  313. package/dist/fcm.mjs +202 -0
  314. package/dist/fcm.mjs.map +1 -0
  315. package/dist/hash.cjs +244 -0
  316. package/dist/hash.cjs.map +1 -0
  317. package/dist/hash.d.cts +28 -0
  318. package/dist/hash.d.cts.map +1 -0
  319. package/dist/hash.d.mts +28 -0
  320. package/dist/hash.d.mts.map +1 -0
  321. package/dist/hash.mjs +238 -0
  322. package/dist/hash.mjs.map +1 -0
  323. package/dist/host/auth.cjs +48 -0
  324. package/dist/host/auth.cjs.map +1 -0
  325. package/dist/host/auth.d.cts +33 -0
  326. package/dist/host/auth.d.cts.map +1 -0
  327. package/dist/host/auth.d.mts +33 -0
  328. package/dist/host/auth.d.mts.map +1 -0
  329. package/dist/host/auth.mjs +45 -0
  330. package/dist/host/auth.mjs.map +1 -0
  331. package/dist/host/batch.cjs +178 -0
  332. package/dist/host/batch.cjs.map +1 -0
  333. package/dist/host/batch.d.cts +92 -0
  334. package/dist/host/batch.d.cts.map +1 -0
  335. package/dist/host/batch.d.mts +92 -0
  336. package/dist/host/batch.d.mts.map +1 -0
  337. package/dist/host/batch.mjs +169 -0
  338. package/dist/host/batch.mjs.map +1 -0
  339. package/dist/host/channels.cjs +256 -0
  340. package/dist/host/channels.cjs.map +1 -0
  341. package/dist/host/channels.d.cts +66 -0
  342. package/dist/host/channels.d.cts.map +1 -0
  343. package/dist/host/channels.d.mts +66 -0
  344. package/dist/host/channels.d.mts.map +1 -0
  345. package/dist/host/channels.mjs +252 -0
  346. package/dist/host/channels.mjs.map +1 -0
  347. package/dist/host/execute.cjs +102 -0
  348. package/dist/host/execute.cjs.map +1 -0
  349. package/dist/host/execute.d.cts +38 -0
  350. package/dist/host/execute.d.cts.map +1 -0
  351. package/dist/host/execute.d.mts +38 -0
  352. package/dist/host/execute.d.mts.map +1 -0
  353. package/dist/host/execute.mjs +101 -0
  354. package/dist/host/execute.mjs.map +1 -0
  355. package/dist/host/fresh-read.cjs +29 -0
  356. package/dist/host/fresh-read.cjs.map +1 -0
  357. package/dist/host/fresh-read.d.cts +16 -0
  358. package/dist/host/fresh-read.d.cts.map +1 -0
  359. package/dist/host/fresh-read.d.mts +16 -0
  360. package/dist/host/fresh-read.d.mts.map +1 -0
  361. package/dist/host/fresh-read.mjs +28 -0
  362. package/dist/host/fresh-read.mjs.map +1 -0
  363. package/dist/host/http.cjs +393 -0
  364. package/dist/host/http.cjs.map +1 -0
  365. package/dist/host/http.d.cts +61 -0
  366. package/dist/host/http.d.cts.map +1 -0
  367. package/dist/host/http.d.mts +61 -0
  368. package/dist/host/http.d.mts.map +1 -0
  369. package/dist/host/http.mjs +389 -0
  370. package/dist/host/http.mjs.map +1 -0
  371. package/dist/host/ingest.cjs +1210 -0
  372. package/dist/host/ingest.cjs.map +1 -0
  373. package/dist/host/ingest.d.cts +497 -0
  374. package/dist/host/ingest.d.cts.map +1 -0
  375. package/dist/host/ingest.d.mts +497 -0
  376. package/dist/host/ingest.d.mts.map +1 -0
  377. package/dist/host/ingest.mjs +1172 -0
  378. package/dist/host/ingest.mjs.map +1 -0
  379. package/dist/host/journey-host.cjs +223 -0
  380. package/dist/host/journey-host.cjs.map +1 -0
  381. package/dist/host/journey-host.d.cts +118 -0
  382. package/dist/host/journey-host.d.cts.map +1 -0
  383. package/dist/host/journey-host.d.mts +118 -0
  384. package/dist/host/journey-host.d.mts.map +1 -0
  385. package/dist/host/journey-host.mjs +219 -0
  386. package/dist/host/journey-host.mjs.map +1 -0
  387. package/dist/host/platform.cjs +20 -0
  388. package/dist/host/platform.cjs.map +1 -0
  389. package/dist/host/platform.d.cts +120 -0
  390. package/dist/host/platform.d.cts.map +1 -0
  391. package/dist/host/platform.d.mts +120 -0
  392. package/dist/host/platform.d.mts.map +1 -0
  393. package/dist/host/platform.mjs +18 -0
  394. package/dist/host/platform.mjs.map +1 -0
  395. package/dist/host/senders.cjs +71 -0
  396. package/dist/host/senders.cjs.map +1 -0
  397. package/dist/host/senders.d.cts +34 -0
  398. package/dist/host/senders.d.cts.map +1 -0
  399. package/dist/host/senders.d.mts +34 -0
  400. package/dist/host/senders.d.mts.map +1 -0
  401. package/dist/host/senders.mjs +67 -0
  402. package/dist/host/senders.mjs.map +1 -0
  403. package/dist/host/workflow-cache.cjs +47 -0
  404. package/dist/host/workflow-cache.cjs.map +1 -0
  405. package/dist/host/workflow-cache.d.cts +21 -0
  406. package/dist/host/workflow-cache.d.cts.map +1 -0
  407. package/dist/host/workflow-cache.d.mts +21 -0
  408. package/dist/host/workflow-cache.d.mts.map +1 -0
  409. package/dist/host/workflow-cache.mjs +46 -0
  410. package/dist/host/workflow-cache.mjs.map +1 -0
  411. package/dist/http2-client.cjs +89 -0
  412. package/dist/http2-client.cjs.map +1 -0
  413. package/dist/http2-client.d.cts +45 -0
  414. package/dist/http2-client.d.cts.map +1 -0
  415. package/dist/http2-client.d.mts +45 -0
  416. package/dist/http2-client.d.mts.map +1 -0
  417. package/dist/http2-client.mjs +87 -0
  418. package/dist/http2-client.mjs.map +1 -0
  419. package/dist/index.cjs +130 -0
  420. package/dist/index.d.cts +21 -0
  421. package/dist/index.d.mts +21 -0
  422. package/dist/index.mjs +20 -0
  423. package/dist/inflight.cjs +116 -0
  424. package/dist/inflight.cjs.map +1 -0
  425. package/dist/inflight.d.cts +49 -0
  426. package/dist/inflight.d.cts.map +1 -0
  427. package/dist/inflight.d.mts +49 -0
  428. package/dist/inflight.d.mts.map +1 -0
  429. package/dist/inflight.mjs +113 -0
  430. package/dist/inflight.mjs.map +1 -0
  431. package/dist/ir.cjs +429 -0
  432. package/dist/ir.cjs.map +1 -0
  433. package/dist/ir.d.cts +593 -0
  434. package/dist/ir.d.cts.map +1 -0
  435. package/dist/ir.d.mts +593 -0
  436. package/dist/ir.d.mts.map +1 -0
  437. package/dist/ir.mjs +404 -0
  438. package/dist/ir.mjs.map +1 -0
  439. package/dist/jwt.cjs +17 -0
  440. package/dist/jwt.cjs.map +1 -0
  441. package/dist/jwt.d.cts +7 -0
  442. package/dist/jwt.d.cts.map +1 -0
  443. package/dist/jwt.d.mts +7 -0
  444. package/dist/jwt.d.mts.map +1 -0
  445. package/dist/jwt.mjs +15 -0
  446. package/dist/jwt.mjs.map +1 -0
  447. package/dist/node/index.cjs +231 -0
  448. package/dist/node/index.cjs.map +1 -0
  449. package/dist/node/index.d.cts +59 -0
  450. package/dist/node/index.d.cts.map +1 -0
  451. package/dist/node/index.d.mts +59 -0
  452. package/dist/node/index.d.mts.map +1 -0
  453. package/dist/node/index.mjs +225 -0
  454. package/dist/node/index.mjs.map +1 -0
  455. package/dist/node/runs.cjs +222 -0
  456. package/dist/node/runs.cjs.map +1 -0
  457. package/dist/node/runs.d.cts +93 -0
  458. package/dist/node/runs.d.cts.map +1 -0
  459. package/dist/node/runs.d.mts +93 -0
  460. package/dist/node/runs.d.mts.map +1 -0
  461. package/dist/node/runs.mjs +221 -0
  462. package/dist/node/runs.mjs.map +1 -0
  463. package/dist/node/runtime.cjs +351 -0
  464. package/dist/node/runtime.cjs.map +1 -0
  465. package/dist/node/runtime.d.cts +96 -0
  466. package/dist/node/runtime.d.cts.map +1 -0
  467. package/dist/node/runtime.d.mts +96 -0
  468. package/dist/node/runtime.d.mts.map +1 -0
  469. package/dist/node/runtime.mjs +348 -0
  470. package/dist/node/runtime.mjs.map +1 -0
  471. package/dist/plan.cjs +221 -0
  472. package/dist/plan.cjs.map +1 -0
  473. package/dist/plan.d.cts +68 -0
  474. package/dist/plan.d.cts.map +1 -0
  475. package/dist/plan.d.mts +68 -0
  476. package/dist/plan.d.mts.map +1 -0
  477. package/dist/plan.mjs +218 -0
  478. package/dist/plan.mjs.map +1 -0
  479. package/dist/postgres-js.cjs +51 -0
  480. package/dist/postgres-js.cjs.map +1 -0
  481. package/dist/postgres-js.d.cts +32 -0
  482. package/dist/postgres-js.d.cts.map +1 -0
  483. package/dist/postgres-js.d.mts +32 -0
  484. package/dist/postgres-js.d.mts.map +1 -0
  485. package/dist/postgres-js.mjs +46 -0
  486. package/dist/postgres-js.mjs.map +1 -0
  487. package/dist/provenance.cjs +66 -0
  488. package/dist/provenance.cjs.map +1 -0
  489. package/dist/provenance.d.cts +40 -0
  490. package/dist/provenance.d.cts.map +1 -0
  491. package/dist/provenance.d.mts +40 -0
  492. package/dist/provenance.d.mts.map +1 -0
  493. package/dist/provenance.mjs +64 -0
  494. package/dist/provenance.mjs.map +1 -0
  495. package/dist/push.cjs +11 -0
  496. package/dist/push.cjs.map +1 -0
  497. package/dist/push.d.cts +14 -0
  498. package/dist/push.d.cts.map +1 -0
  499. package/dist/push.d.mts +14 -0
  500. package/dist/push.d.mts.map +1 -0
  501. package/dist/push.mjs +10 -0
  502. package/dist/push.mjs.map +1 -0
  503. package/dist/react-email.cjs +56 -0
  504. package/dist/react-email.cjs.map +1 -0
  505. package/dist/react-email.d.cts +5 -0
  506. package/dist/react-email.d.cts.map +1 -0
  507. package/dist/react-email.d.mts +5 -0
  508. package/dist/react-email.d.mts.map +1 -0
  509. package/dist/react-email.mjs +55 -0
  510. package/dist/react-email.mjs.map +1 -0
  511. package/dist/reporting/classify.cjs +46 -0
  512. package/dist/reporting/classify.cjs.map +1 -0
  513. package/dist/reporting/classify.d.cts +65 -0
  514. package/dist/reporting/classify.d.cts.map +1 -0
  515. package/dist/reporting/classify.d.mts +65 -0
  516. package/dist/reporting/classify.d.mts.map +1 -0
  517. package/dist/reporting/classify.mjs +42 -0
  518. package/dist/reporting/classify.mjs.map +1 -0
  519. package/dist/reporting/observer.cjs +137 -0
  520. package/dist/reporting/observer.cjs.map +1 -0
  521. package/dist/reporting/observer.d.cts +31 -0
  522. package/dist/reporting/observer.d.cts.map +1 -0
  523. package/dist/reporting/observer.d.mts +31 -0
  524. package/dist/reporting/observer.d.mts.map +1 -0
  525. package/dist/reporting/observer.mjs +134 -0
  526. package/dist/reporting/observer.mjs.map +1 -0
  527. package/dist/reporting/tracking.cjs +185 -0
  528. package/dist/reporting/tracking.cjs.map +1 -0
  529. package/dist/reporting/tracking.d.cts +63 -0
  530. package/dist/reporting/tracking.d.cts.map +1 -0
  531. package/dist/reporting/tracking.d.mts +63 -0
  532. package/dist/reporting/tracking.d.mts.map +1 -0
  533. package/dist/reporting/tracking.mjs +182 -0
  534. package/dist/reporting/tracking.mjs.map +1 -0
  535. package/dist/runtime.cjs +18 -0
  536. package/dist/runtime.cjs.map +1 -0
  537. package/dist/runtime.d.cts +44 -0
  538. package/dist/runtime.d.cts.map +1 -0
  539. package/dist/runtime.d.mts +44 -0
  540. package/dist/runtime.d.mts.map +1 -0
  541. package/dist/runtime.mjs +17 -0
  542. package/dist/runtime.mjs.map +1 -0
  543. package/dist/store/condition-sql.cjs +145 -0
  544. package/dist/store/condition-sql.cjs.map +1 -0
  545. package/dist/store/condition-sql.d.cts +38 -0
  546. package/dist/store/condition-sql.d.cts.map +1 -0
  547. package/dist/store/condition-sql.d.mts +38 -0
  548. package/dist/store/condition-sql.d.mts.map +1 -0
  549. package/dist/store/condition-sql.mjs +144 -0
  550. package/dist/store/condition-sql.mjs.map +1 -0
  551. package/dist/store/erasure.cjs +21 -0
  552. package/dist/store/erasure.cjs.map +1 -0
  553. package/dist/store/erasure.d.cts +16 -0
  554. package/dist/store/erasure.d.cts.map +1 -0
  555. package/dist/store/erasure.d.mts +16 -0
  556. package/dist/store/erasure.d.mts.map +1 -0
  557. package/dist/store/erasure.mjs +20 -0
  558. package/dist/store/erasure.mjs.map +1 -0
  559. package/dist/store/facts.cjs +79 -0
  560. package/dist/store/facts.cjs.map +1 -0
  561. package/dist/store/facts.d.cts +41 -0
  562. package/dist/store/facts.d.cts.map +1 -0
  563. package/dist/store/facts.d.mts +41 -0
  564. package/dist/store/facts.d.mts.map +1 -0
  565. package/dist/store/facts.mjs +77 -0
  566. package/dist/store/facts.mjs.map +1 -0
  567. package/dist/store/identity.cjs +34 -0
  568. package/dist/store/identity.cjs.map +1 -0
  569. package/dist/store/identity.d.cts +13 -0
  570. package/dist/store/identity.d.cts.map +1 -0
  571. package/dist/store/identity.d.mts +13 -0
  572. package/dist/store/identity.d.mts.map +1 -0
  573. package/dist/store/identity.mjs +30 -0
  574. package/dist/store/identity.mjs.map +1 -0
  575. package/dist/store/index.cjs +35 -0
  576. package/dist/store/index.cjs.map +1 -0
  577. package/dist/store/index.d.cts +766 -0
  578. package/dist/store/index.d.cts.map +1 -0
  579. package/dist/store/index.d.mts +766 -0
  580. package/dist/store/index.d.mts.map +1 -0
  581. package/dist/store/index.mjs +22 -0
  582. package/dist/store/index.mjs.map +1 -0
  583. package/dist/store/postgres-reporting.cjs +327 -0
  584. package/dist/store/postgres-reporting.cjs.map +1 -0
  585. package/dist/store/postgres-reporting.d.cts +95 -0
  586. package/dist/store/postgres-reporting.d.cts.map +1 -0
  587. package/dist/store/postgres-reporting.d.mts +95 -0
  588. package/dist/store/postgres-reporting.d.mts.map +1 -0
  589. package/dist/store/postgres-reporting.mjs +326 -0
  590. package/dist/store/postgres-reporting.mjs.map +1 -0
  591. package/dist/store/postgres.cjs +1173 -0
  592. package/dist/store/postgres.cjs.map +1 -0
  593. package/dist/store/postgres.d.cts +199 -0
  594. package/dist/store/postgres.d.cts.map +1 -0
  595. package/dist/store/postgres.d.mts +199 -0
  596. package/dist/store/postgres.d.mts.map +1 -0
  597. package/dist/store/postgres.mjs +1170 -0
  598. package/dist/store/postgres.mjs.map +1 -0
  599. package/dist/store/sql.cjs +24 -0
  600. package/dist/store/sql.cjs.map +1 -0
  601. package/dist/store/sql.d.cts +26 -0
  602. package/dist/store/sql.d.cts.map +1 -0
  603. package/dist/store/sql.d.mts +26 -0
  604. package/dist/store/sql.d.mts.map +1 -0
  605. package/dist/store/sql.mjs +23 -0
  606. package/dist/store/sql.mjs.map +1 -0
  607. package/dist/store/tables.cjs +660 -0
  608. package/dist/store/tables.cjs.map +1 -0
  609. package/dist/store/tables.d.cts +103 -0
  610. package/dist/store/tables.d.cts.map +1 -0
  611. package/dist/store/tables.d.mts +103 -0
  612. package/dist/store/tables.d.mts.map +1 -0
  613. package/dist/store/tables.mjs +653 -0
  614. package/dist/store/tables.mjs.map +1 -0
  615. package/dist/store/user-lock.cjs +42 -0
  616. package/dist/store/user-lock.cjs.map +1 -0
  617. package/dist/store/user-lock.d.cts +30 -0
  618. package/dist/store/user-lock.d.cts.map +1 -0
  619. package/dist/store/user-lock.d.mts +30 -0
  620. package/dist/store/user-lock.d.mts.map +1 -0
  621. package/dist/store/user-lock.mjs +39 -0
  622. package/dist/store/user-lock.mjs.map +1 -0
  623. package/dist/template-rules.cjs +94 -0
  624. package/dist/template-rules.cjs.map +1 -0
  625. package/dist/template-rules.d.cts +80 -0
  626. package/dist/template-rules.d.cts.map +1 -0
  627. package/dist/template-rules.d.mts +80 -0
  628. package/dist/template-rules.d.mts.map +1 -0
  629. package/dist/template-rules.mjs +86 -0
  630. package/dist/template-rules.mjs.map +1 -0
  631. package/dist/templates.cjs +375 -0
  632. package/dist/templates.cjs.map +1 -0
  633. package/dist/templates.d.cts +358 -0
  634. package/dist/templates.d.cts.map +1 -0
  635. package/dist/templates.d.mts +358 -0
  636. package/dist/templates.d.mts.map +1 -0
  637. package/dist/templates.mjs +353 -0
  638. package/dist/templates.mjs.map +1 -0
  639. package/dist/transports/cloudflare-email.cjs +69 -0
  640. package/dist/transports/cloudflare-email.cjs.map +1 -0
  641. package/dist/transports/cloudflare-email.d.cts +63 -0
  642. package/dist/transports/cloudflare-email.d.cts.map +1 -0
  643. package/dist/transports/cloudflare-email.d.mts +63 -0
  644. package/dist/transports/cloudflare-email.d.mts.map +1 -0
  645. package/dist/transports/cloudflare-email.mjs +67 -0
  646. package/dist/transports/cloudflare-email.mjs.map +1 -0
  647. package/dist/transports/ses.cjs +142 -0
  648. package/dist/transports/ses.cjs.map +1 -0
  649. package/dist/transports/ses.d.cts +49 -0
  650. package/dist/transports/ses.d.cts.map +1 -0
  651. package/dist/transports/ses.d.mts +49 -0
  652. package/dist/transports/ses.d.mts.map +1 -0
  653. package/dist/transports/ses.mjs +139 -0
  654. package/dist/transports/ses.mjs.map +1 -0
  655. package/dist/transports/sigv4.cjs +86 -0
  656. package/dist/transports/sigv4.cjs.map +1 -0
  657. package/dist/transports/sigv4.d.cts +25 -0
  658. package/dist/transports/sigv4.d.cts.map +1 -0
  659. package/dist/transports/sigv4.d.mts +25 -0
  660. package/dist/transports/sigv4.d.mts.map +1 -0
  661. package/dist/transports/sigv4.mjs +85 -0
  662. package/dist/transports/sigv4.mjs.map +1 -0
  663. package/dist/webhooks.cjs +97 -0
  664. package/dist/webhooks.cjs.map +1 -0
  665. package/dist/webhooks.d.cts +23 -0
  666. package/dist/webhooks.d.cts.map +1 -0
  667. package/dist/webhooks.d.mts +23 -0
  668. package/dist/webhooks.d.mts.map +1 -0
  669. package/dist/webhooks.mjs +95 -0
  670. package/dist/webhooks.mjs.map +1 -0
  671. package/dist/webpush.cjs +361 -0
  672. package/dist/webpush.cjs.map +1 -0
  673. package/dist/webpush.d.cts +135 -0
  674. package/dist/webpush.d.cts.map +1 -0
  675. package/dist/webpush.d.mts +135 -0
  676. package/dist/webpush.d.mts.map +1 -0
  677. package/dist/webpush.mjs +350 -0
  678. package/dist/webpush.mjs.map +1 -0
  679. package/package.json +279 -3
  680. package/src/cloudflare/workers.d.ts +44 -0
@@ -0,0 +1,212 @@
1
+ import { SUBSCRIPTION_CHANNELS } from "./host/ingest.mjs";
2
+ // src/client.ts
3
+ var JourneyClientError = class extends Error {
4
+ path;
5
+ status;
6
+ body;
7
+ constructor(path, status, body) {
8
+ super(`journey ${path} failed: ${status} ${body}`);
9
+ this.path = path;
10
+ this.status = status;
11
+ this.body = body;
12
+ this.name = "JourneyClientError";
13
+ }
14
+ };
15
+ /** A payload or profile patch the contract refuses — raised before the request, with the field paths. */
16
+ var JourneyValidationError = class extends Error {
17
+ path;
18
+ event;
19
+ issues;
20
+ constructor(path, event, issues) {
21
+ super(`journey ${path}${event === void 0 ? "" : ` '${event}'`} refused by the contract: ${issues.map((i) => `${i.path || "(root)"} ${i.message}`).join("; ")}`);
22
+ this.path = path;
23
+ this.event = event;
24
+ this.issues = issues;
25
+ this.name = "JourneyValidationError";
26
+ }
27
+ };
28
+ /**
29
+ * The batch as it travels: checked against the contract, with the time and the event ids and
30
+ * timestamps fixed here, so every redelivery is the same report.
31
+ */
32
+ function prepareBatch(contract, input) {
33
+ const { userId, visitorId, profile, events } = input;
34
+ if (contract !== void 0) {
35
+ if (profile !== void 0) {
36
+ const result = contract.parseProfilePatch(profile);
37
+ if (!result.ok) throw new JourneyValidationError("/ingest", void 0, result.issues);
38
+ }
39
+ for (const { event, payload } of events ?? []) {
40
+ const result = contract.parseEvent(event, payload ?? {});
41
+ if (!result.ok) throw new JourneyValidationError("/ingest", event, result.issues);
42
+ }
43
+ }
44
+ const now = Date.now();
45
+ return {
46
+ ...userId === void 0 ? {} : { userId },
47
+ ...visitorId === void 0 ? {} : { visitorId },
48
+ ...profile === void 0 ? {} : {
49
+ profile,
50
+ at: now
51
+ },
52
+ ...events === void 0 ? {} : { events: events.map((e) => ({
53
+ event: e.event,
54
+ payload: e.payload ?? {},
55
+ id: e.id ?? crypto.randomUUID(),
56
+ ts: e.ts ?? now
57
+ })) }
58
+ };
59
+ }
60
+ /**
61
+ * `JourneyClient.ingest` through a queue, for a producer that must not lose a report and must not
62
+ * wait for the engine: once `ingest` resolves the batch is durable, and the consumer retries it
63
+ * until it is applied. Delivery is at least once and in no guaranteed order: the batch is the unit
64
+ * that stays in order and event ids and property times absorb the rest. A rejected `ingest` was
65
+ * not queued; the caller decides (a 5xx so its client retries, say).
66
+ */
67
+ var JourneyQueue = class {
68
+ options;
69
+ constructor(options) {
70
+ this.options = options;
71
+ }
72
+ async ingest(input) {
73
+ await this.options.queue.send(prepareBatch(this.options.contract, input));
74
+ }
75
+ };
76
+ var JourneyClient = class {
77
+ options;
78
+ constructor(options) {
79
+ this.options = options;
80
+ }
81
+ /**
82
+ * The one way in: a profile and the events it belongs to, as one batch. A visitor who signed in
83
+ * merges first, then the profile, then the events in order, so a journey cannot start without
84
+ * its recipient. A caller that retries should pass each event's `id`: the Worker stores one
85
+ * occurrence per id. `ts` defaults to now. `JourneyQueue` is the same report through a queue.
86
+ */
87
+ async ingest(input) {
88
+ return this.post("/ingest", prepareBatch(this.options.contract, input));
89
+ }
90
+ /**
91
+ * A push token registered for whoever holds the device now (call it on every registration): a
92
+ * token moves to the latest owner, and a `deviceId` seen with a new token replaces the old one.
93
+ * The engine keeps devices itself — pushes go to them, a token APNs / FCM reports as gone is
94
+ * dropped — and journeys waiting on `reachable('push')` wake. Naming both ids merges the visitor,
95
+ * as `ingest` does.
96
+ */
97
+ registerDevice(device) {
98
+ return this.post("/devices", device);
99
+ }
100
+ /**
101
+ * A journey push tapped open: the `message_id` the push carried, reported for the user who
102
+ * tapped it. Recorded as a human open on the copy (an email's opens are tracked by the Worker).
103
+ */
104
+ messageOpened(userId, messageId) {
105
+ return this.post("/messages/opened", {
106
+ userId,
107
+ messageId
108
+ });
109
+ }
110
+ /**
111
+ * A deleted account: the engine records the erasure, stops the user's running journeys, then
112
+ * erases everything it keeps about them (profile, devices, events, reporting). Once this
113
+ * resolves the request is durable: `erased: false` means an instance would not stop yet, and
114
+ * the Worker's scheduled sweep finishes the job.
115
+ */
116
+ forgetUser(userId) {
117
+ return this.post("/users/forget", { userId });
118
+ }
119
+ /** `forgetUser` for a visitor who never signed in. */
120
+ forgetVisitor(visitorId) {
121
+ return this.post("/users/forget", { visitorId });
122
+ }
123
+ /** The user signed out on that device: the token stays registered, bound to nobody. */
124
+ unbindDevice(token) {
125
+ return this.post("/devices/unbind", { token });
126
+ }
127
+ /** Forget a push token for good (an uninstall the app learned of, a token it replaced). */
128
+ removeDevice(token) {
129
+ return this.post("/devices/remove", { token });
130
+ }
131
+ /**
132
+ * Where the user stands, topic × channel: for `email` and for `push`, `all` (false once they
133
+ * opted out of the whole channel) and each declared topic (false once they opted out of it on
134
+ * that channel) — the engine's record, which a preference page shows as it is. The two are
135
+ * independent flags: a topic answers its own opt-out even while `all` is false, so `all: false`
136
+ * masks every topic however they read (nothing is sent on the channel until it is true again).
137
+ * Rejects with a 410 for an erased user.
138
+ */
139
+ getSubscriptions(userId) {
140
+ return this.request("GET", subscriptionsPath(userId));
141
+ }
142
+ /**
143
+ * Set subscriptions: only what the patch names changes, per channel (`{ email: { topics: {
144
+ * newsletter: false } } }` opts out of one topic's emails, `{ push: { all: false } }` of every
145
+ * push — the in-app opt-out App Store Review Guideline 4.5.4 asks for). `all: true` clears the
146
+ * channel-wide opt-out only: a topic opted out on its own stays off until the patch names it,
147
+ * so a preference page's "subscribe to all" sends `all: true` plus every topic `true`. Answers
148
+ * the subscriptions as they now stand. With a contract, a topic it does not declare is refused
149
+ * here, before the request; the engine refuses it too.
150
+ */
151
+ setSubscriptions(userId, patch) {
152
+ const refused = this.undeclaredTopics(patch);
153
+ if (refused !== void 0) return Promise.reject(refused);
154
+ return this.request("PUT", subscriptionsPath(userId), patch);
155
+ }
156
+ /**
157
+ * `getSubscriptions` for the recipient of one copy, by the message id an email's preferences
158
+ * link carries (`email.preferencesUrl?m=<message id>`): how a preference page works without a
159
+ * sign-in. The answer adds `message: { channel, topic }`, the copy the page was opened from,
160
+ * so it can highlight that topic. Rejects with a 404 for an id that names no copy — never
161
+ * sent, or erased with its user — and for a transactional one; the page should show the link
162
+ * as expired. The message id is the capability, so the app proxies this behind its own API
163
+ * and rate-limits it.
164
+ */
165
+ getSubscriptionsByMessage(messageId) {
166
+ return this.request("GET", subscriptionsByMessagePath(messageId));
167
+ }
168
+ /** `setSubscriptions` for the recipient of one copy; the patch and the answer are those of `getSubscriptionsByMessage`. */
169
+ setSubscriptionsByMessage(messageId, patch) {
170
+ const refused = this.undeclaredTopics(patch);
171
+ if (refused !== void 0) return Promise.reject(refused);
172
+ return this.request("PUT", subscriptionsByMessagePath(messageId), patch);
173
+ }
174
+ /** With a contract, the refusal of a patch naming a topic it does not declare; undefined when the patch is fine. */
175
+ undeclaredTopics(patch) {
176
+ const contract = this.options.contract;
177
+ if (contract === void 0) return void 0;
178
+ const issues = [];
179
+ for (const channel of SUBSCRIPTION_CHANNELS) for (const topic of Object.keys(patch[channel]?.topics ?? {})) {
180
+ if (contract.topics.includes(topic)) continue;
181
+ issues.push({
182
+ path: `${channel}.topics.${topic}`,
183
+ message: "not a declared topic"
184
+ });
185
+ }
186
+ return issues.length > 0 ? new JourneyValidationError("/subscriptions", void 0, issues) : void 0;
187
+ }
188
+ /** Deploy a compiled bundle (BundleIR). */
189
+ deploy(bundle) {
190
+ return this.post("/deploy", bundle);
191
+ }
192
+ post(path, body) {
193
+ return this.request("POST", path, body);
194
+ }
195
+ async request(method, path, body) {
196
+ const headers = {};
197
+ if (body !== void 0) headers["content-type"] = "application/json";
198
+ if (this.options.token !== void 0) headers.authorization = `Bearer ${this.options.token}`;
199
+ const response = await (this.options.fetch ?? fetch)(`${this.options.origin.replace(/\/$/, "")}${path}`, {
200
+ method,
201
+ headers,
202
+ ...body === void 0 ? {} : { body: JSON.stringify(body) }
203
+ });
204
+ if (!response.ok) throw new JourneyClientError(path, response.status, await response.text());
205
+ return await response.json();
206
+ }
207
+ };
208
+ const subscriptionsPath = (userId) => `/subscriptions/${encodeURIComponent(userId)}`;
209
+ const subscriptionsByMessagePath = (messageId) => `/subscriptions/by-message/${encodeURIComponent(messageId)}`;
210
+ export { JourneyClient, JourneyClientError, JourneyQueue, JourneyValidationError };
211
+
212
+ //# sourceMappingURL=client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type * as core from 'zod/v4/core';\nimport type { Contract, ContractIssue, ProfilePatch, Topic } from './contract';\nimport type { BatchResult, JourneyBatch } from './host/batch';\nimport {\n type DeployResult,\n type MessageSubscriptions,\n SUBSCRIPTION_CHANNELS,\n type Subscriptions,\n type SubscriptionsPatch,\n} from './host/ingest';\nimport type { ProfileProps } from './store';\n\n/**\n * `sendwend/client` — the producer side of the ingest API, for the\n * service that knows what users do (an api server, a webhook handler). Plain\n * fetch, no dependencies; errors carry the status and body so a caller can\n * log them without failing the request that triggered the report.\n */\n\nexport interface JourneyClientOptions<C extends Contract | undefined = undefined> {\n /**\n * The shared `defineContract(...)`: types `ingest` (the event name picks the payload type, the\n * profile patch is the contract's), and checks both before anything is sent.\n */\n contract?: C;\n /** The journey Worker's origin, e.g. `https://workflow.example.com`. */\n origin: string;\n /** Its API_TOKEN, sent as a bearer; omit against an open local instance. */\n token?: string;\n /** Fetch implementation (defaults to the global one). */\n fetch?: typeof fetch;\n}\n\nexport class JourneyClientError extends Error {\n constructor(\n readonly path: string,\n readonly status: number,\n readonly body: string\n ) {\n super(`journey ${path} failed: ${status} ${body}`);\n this.name = 'JourneyClientError';\n }\n}\n\n/** A payload or profile patch the contract refuses — raised before the request, with the field paths. */\nexport class JourneyValidationError extends Error {\n constructor(\n readonly path: string,\n readonly event: string | undefined,\n readonly issues: ContractIssue[]\n ) {\n super(\n `journey ${path}${event === undefined ? '' : ` '${event}'`} refused by the contract: ${issues\n .map((i) => `${i.path || '(root)'} ${i.message}`)\n .join('; ')}`\n );\n this.name = 'JourneyValidationError';\n }\n}\n\ntype EventsOf<C> = C extends Contract<infer E> ? E : never;\ntype IdentifyProps<C> = [C] extends [undefined]\n ? ProfileProps\n : C extends Contract<Record<string, core.$ZodObject>, infer P>\n ? ProfilePatch<P>\n : never;\n\n/** The topics the client's contract declares; any string without a contract. */\nexport type ClientTopic<C> = [C] extends [undefined] ? string : Topic<C>;\n\nexport type { BatchEvent, BatchResult, JourneyBatch } from './host/batch';\nexport type {\n ChannelSubscriptions,\n ChannelSubscriptionsPatch,\n MessageOrigin,\n MessageSubscriptions,\n SubscriptionChannel,\n Subscriptions,\n SubscriptionsPatch,\n} from './host/ingest';\n\n/** One event of a batch: with a contract, the name picks the payload type. */\nexport type BatchEventInput<C> = [C] extends [undefined]\n ? { event: string; payload?: Record<string, unknown>; id?: string; ts?: number }\n : {\n [K in keyof EventsOf<C> & string]: {\n event: K;\n payload: core.input<EventsOf<C>[K]>;\n id?: string;\n ts?: number;\n };\n }[keyof EventsOf<C> & string];\n\n/**\n * Who a report or device is about: a signed-in user, or a visitor before sign-in (a stable id for\n * one client, renewed when a user signs out). Naming both says this visitor is this user: what the\n * engine knows of the visitor moves to the user, once.\n */\nexport type JourneyIdentity =\n | { userId: string; visitorId?: string | undefined }\n | { userId?: undefined; visitorId: string };\n\n/** What the profile now says and what they just did, as one report. */\nexport type BatchInput<C> = JourneyIdentity & {\n /** Merged before the first event: a journey the events start finds this recipient. */\n profile?: IdentifyProps<C>;\n events?: readonly BatchEventInput<C>[];\n};\n\n/**\n * The batch as it travels: checked against the contract, with the time and the event ids and\n * timestamps fixed here, so every redelivery is the same report.\n */\nfunction prepareBatch<C extends Contract | undefined>(\n contract: C,\n input: BatchInput<C>\n): JourneyBatch {\n const { userId, visitorId, profile, events } = input as {\n userId?: string;\n visitorId?: string;\n profile?: ProfileProps;\n events?: readonly {\n event: string;\n payload?: Record<string, unknown>;\n id?: string;\n ts?: number;\n }[];\n };\n if (contract !== undefined) {\n if (profile !== undefined) {\n const result = contract.parseProfilePatch(profile);\n if (!result.ok) throw new JourneyValidationError('/ingest', undefined, result.issues);\n }\n for (const { event, payload } of events ?? []) {\n const result = contract.parseEvent(event, payload ?? {});\n if (!result.ok) throw new JourneyValidationError('/ingest', event, result.issues);\n }\n }\n const now = Date.now();\n return {\n ...(userId === undefined ? {} : { userId }),\n ...(visitorId === undefined ? {} : { visitorId }),\n ...(profile === undefined ? {} : { profile, at: now }),\n ...(events === undefined\n ? {}\n : {\n events: events.map((e) => ({\n event: e.event,\n payload: e.payload ?? {},\n id: e.id ?? crypto.randomUUID(),\n ts: e.ts ?? now,\n })),\n }),\n };\n}\n\n/** The producer side of a queue (the subset of a Cloudflare Queues binding used). */\nexport interface JourneyQueueBinding {\n send(body: JourneyBatch): Promise<unknown>;\n}\n\nexport interface JourneyQueueOptions<C extends Contract | undefined = undefined> {\n /** The shared `defineContract(...)`: types `ingest` and checks each batch before it is sent. */\n contract?: C;\n /** The queue `journeyWorker`'s `queue` handler consumes. */\n queue: JourneyQueueBinding;\n}\n\n/**\n * `JourneyClient.ingest` through a queue, for a producer that must not lose a report and must not\n * wait for the engine: once `ingest` resolves the batch is durable, and the consumer retries it\n * until it is applied. Delivery is at least once and in no guaranteed order: the batch is the unit\n * that stays in order and event ids and property times absorb the rest. A rejected `ingest` was\n * not queued; the caller decides (a 5xx so its client retries, say).\n */\nexport class JourneyQueue<C extends Contract | undefined = undefined> {\n constructor(private readonly options: JourneyQueueOptions<C>) {}\n\n async ingest(input: BatchInput<C>): Promise<void> {\n await this.options.queue.send(prepareBatch(this.options.contract as C, input));\n }\n}\n\nexport class JourneyClient<C extends Contract | undefined = undefined> {\n constructor(private readonly options: JourneyClientOptions<C>) {}\n\n /**\n * The one way in: a profile and the events it belongs to, as one batch. A visitor who signed in\n * merges first, then the profile, then the events in order, so a journey cannot start without\n * its recipient. A caller that retries should pass each event's `id`: the Worker stores one\n * occurrence per id. `ts` defaults to now. `JourneyQueue` is the same report through a queue.\n */\n async ingest(input: BatchInput<C>): Promise<BatchResult> {\n return this.post<BatchResult>('/ingest', prepareBatch(this.options.contract as C, input));\n }\n\n /**\n * A push token registered for whoever holds the device now (call it on every registration): a\n * token moves to the latest owner, and a `deviceId` seen with a new token replaces the old one.\n * The engine keeps devices itself — pushes go to them, a token APNs / FCM reports as gone is\n * dropped — and journeys waiting on `reachable('push')` wake. Naming both ids merges the visitor,\n * as `ingest` does.\n */\n registerDevice(\n device: JourneyIdentity & {\n deviceId?: string;\n token: string;\n platform: 'ios' | 'android' | 'web';\n }\n ): Promise<{ ok: true; woke: number }> {\n return this.post('/devices', device);\n }\n\n /**\n * A journey push tapped open: the `message_id` the push carried, reported for the user who\n * tapped it. Recorded as a human open on the copy (an email's opens are tracked by the Worker).\n */\n messageOpened(userId: string, messageId: string): Promise<{ ok: true; recorded: boolean }> {\n return this.post('/messages/opened', { userId, messageId });\n }\n\n /**\n * A deleted account: the engine records the erasure, stops the user's running journeys, then\n * erases everything it keeps about them (profile, devices, events, reporting). Once this\n * resolves the request is durable: `erased: false` means an instance would not stop yet, and\n * the Worker's scheduled sweep finishes the job.\n */\n forgetUser(userId: string): Promise<{ ok: true; erased: boolean; pending: string[] }> {\n return this.post('/users/forget', { userId });\n }\n\n /** `forgetUser` for a visitor who never signed in. */\n forgetVisitor(visitorId: string): Promise<{ ok: true; erased: boolean; pending: string[] }> {\n return this.post('/users/forget', { visitorId });\n }\n\n /** The user signed out on that device: the token stays registered, bound to nobody. */\n unbindDevice(token: string): Promise<{ ok: true; woke: number }> {\n return this.post('/devices/unbind', { token });\n }\n\n /** Forget a push token for good (an uninstall the app learned of, a token it replaced). */\n removeDevice(token: string): Promise<{ ok: true; woke: number }> {\n return this.post('/devices/remove', { token });\n }\n\n /**\n * Where the user stands, topic × channel: for `email` and for `push`, `all` (false once they\n * opted out of the whole channel) and each declared topic (false once they opted out of it on\n * that channel) — the engine's record, which a preference page shows as it is. The two are\n * independent flags: a topic answers its own opt-out even while `all` is false, so `all: false`\n * masks every topic however they read (nothing is sent on the channel until it is true again).\n * Rejects with a 410 for an erased user.\n */\n getSubscriptions(userId: string): Promise<Subscriptions<ClientTopic<C>>> {\n return this.request('GET', subscriptionsPath(userId));\n }\n\n /**\n * Set subscriptions: only what the patch names changes, per channel (`{ email: { topics: {\n * newsletter: false } } }` opts out of one topic's emails, `{ push: { all: false } }` of every\n * push — the in-app opt-out App Store Review Guideline 4.5.4 asks for). `all: true` clears the\n * channel-wide opt-out only: a topic opted out on its own stays off until the patch names it,\n * so a preference page's \"subscribe to all\" sends `all: true` plus every topic `true`. Answers\n * the subscriptions as they now stand. With a contract, a topic it does not declare is refused\n * here, before the request; the engine refuses it too.\n */\n setSubscriptions(\n userId: string,\n patch: SubscriptionsPatch<ClientTopic<C>>\n ): Promise<Subscriptions<ClientTopic<C>>> {\n const refused = this.undeclaredTopics(patch);\n if (refused !== undefined) return Promise.reject(refused);\n return this.request('PUT', subscriptionsPath(userId), patch);\n }\n\n /**\n * `getSubscriptions` for the recipient of one copy, by the message id an email's preferences\n * link carries (`email.preferencesUrl?m=<message id>`): how a preference page works without a\n * sign-in. The answer adds `message: { channel, topic }`, the copy the page was opened from,\n * so it can highlight that topic. Rejects with a 404 for an id that names no copy — never\n * sent, or erased with its user — and for a transactional one; the page should show the link\n * as expired. The message id is the capability, so the app proxies this behind its own API\n * and rate-limits it.\n */\n getSubscriptionsByMessage(messageId: string): Promise<MessageSubscriptions<ClientTopic<C>>> {\n return this.request('GET', subscriptionsByMessagePath(messageId));\n }\n\n /** `setSubscriptions` for the recipient of one copy; the patch and the answer are those of `getSubscriptionsByMessage`. */\n setSubscriptionsByMessage(\n messageId: string,\n patch: SubscriptionsPatch<ClientTopic<C>>\n ): Promise<MessageSubscriptions<ClientTopic<C>>> {\n const refused = this.undeclaredTopics(patch);\n if (refused !== undefined) return Promise.reject(refused);\n return this.request('PUT', subscriptionsByMessagePath(messageId), patch);\n }\n\n /** With a contract, the refusal of a patch naming a topic it does not declare; undefined when the patch is fine. */\n private undeclaredTopics(\n patch: SubscriptionsPatch<ClientTopic<C>>\n ): JourneyValidationError | undefined {\n const contract = this.options.contract;\n if (contract === undefined) return undefined;\n const issues: ContractIssue[] = [];\n for (const channel of SUBSCRIPTION_CHANNELS) {\n for (const topic of Object.keys(patch[channel]?.topics ?? {})) {\n // `includes`, not the predicate: narrowing `string` by a `topic is string` leaves `never`\n if (contract.topics.includes(topic)) continue;\n issues.push({ path: `${channel}.topics.${topic}`, message: 'not a declared topic' });\n }\n }\n return issues.length > 0\n ? new JourneyValidationError('/subscriptions', undefined, issues)\n : undefined;\n }\n\n /** Deploy a compiled bundle (BundleIR). */\n deploy(bundle: unknown): Promise<DeployResult> {\n return this.post<DeployResult>('/deploy', bundle);\n }\n\n private post<T>(path: string, body: unknown): Promise<T> {\n return this.request<T>('POST', path, body);\n }\n\n private async request<T>(\n method: 'GET' | 'POST' | 'PUT',\n path: string,\n body?: unknown\n ): Promise<T> {\n const headers: Record<string, string> = {};\n if (body !== undefined) headers['content-type'] = 'application/json';\n if (this.options.token !== undefined) headers.authorization = `Bearer ${this.options.token}`;\n const doFetch = this.options.fetch ?? fetch;\n const response = await doFetch(`${this.options.origin.replace(/\\/$/, '')}${path}`, {\n method,\n headers,\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n });\n if (!response.ok) throw new JourneyClientError(path, response.status, await response.text());\n return (await response.json()) as T;\n }\n}\n\nconst subscriptionsPath = (userId: string) => `/subscriptions/${encodeURIComponent(userId)}`;\nconst subscriptionsByMessagePath = (messageId: string) =>\n `/subscriptions/by-message/${encodeURIComponent(messageId)}`;\n"],"mappings":";;AAiCA,IAAa,qBAAb,cAAwC,MAAM;CAEjC;CACA;CACA;CAHX,YACW,MACA,QACA,MACT;EACA,MAAM,WAAW,KAAK,WAAW,OAAO,GAAG,MAAM;EAJxC,KAAA,OAAA;EACA,KAAA,SAAA;EACA,KAAA,OAAA;EAGT,KAAK,OAAO;CACd;AACF;;AAGA,IAAa,yBAAb,cAA4C,MAAM;CAErC;CACA;CACA;CAHX,YACW,MACA,OACA,QACT;EACA,MACE,WAAW,OAAO,UAAU,KAAA,IAAY,KAAK,KAAK,MAAM,GAAG,4BAA4B,OACpF,KAAK,MAAM,GAAG,EAAE,QAAQ,SAAS,GAAG,EAAE,SAAS,CAAC,CAChD,KAAK,IAAI,GACd;EARS,KAAA,OAAA;EACA,KAAA,QAAA;EACA,KAAA,SAAA;EAOT,KAAK,OAAO;CACd;AACF;;;;;AAuDA,SAAS,aACP,UACA,OACc;CACd,MAAM,EAAE,QAAQ,WAAW,SAAS,WAAW;CAW/C,IAAI,aAAa,KAAA,GAAW;EAC1B,IAAI,YAAY,KAAA,GAAW;GACzB,MAAM,SAAS,SAAS,kBAAkB,OAAO;GACjD,IAAI,CAAC,OAAO,IAAI,MAAM,IAAI,uBAAuB,WAAW,KAAA,GAAW,OAAO,MAAM;EACtF;EACA,KAAK,MAAM,EAAE,OAAO,aAAa,UAAU,CAAC,GAAG;GAC7C,MAAM,SAAS,SAAS,WAAW,OAAO,WAAW,CAAC,CAAC;GACvD,IAAI,CAAC,OAAO,IAAI,MAAM,IAAI,uBAAuB,WAAW,OAAO,OAAO,MAAM;EAClF;CACF;CACA,MAAM,MAAM,KAAK,IAAI;CACrB,OAAO;EACL,GAAI,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,OAAO;EACzC,GAAI,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU;EAC/C,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI;GAAE;GAAS,IAAI;EAAI;EACpD,GAAI,WAAW,KAAA,IACX,CAAC,IACD,EACE,QAAQ,OAAO,KAAK,OAAO;GACzB,OAAO,EAAE;GACT,SAAS,EAAE,WAAW,CAAC;GACvB,IAAI,EAAE,MAAM,OAAO,WAAW;GAC9B,IAAI,EAAE,MAAM;EACd,EAAE,EACJ;CACN;AACF;;;;;;;;AAqBA,IAAa,eAAb,MAAsE;CACvC;CAA7B,YAA6B,SAAiC;EAAjC,KAAA,UAAA;CAAkC;CAE/D,MAAM,OAAO,OAAqC;EAChD,MAAM,KAAK,QAAQ,MAAM,KAAK,aAAa,KAAK,QAAQ,UAAe,KAAK,CAAC;CAC/E;AACF;AAEA,IAAa,gBAAb,MAAuE;CACxC;CAA7B,YAA6B,SAAkC;EAAlC,KAAA,UAAA;CAAmC;;;;;;;CAQhE,MAAM,OAAO,OAA4C;EACvD,OAAO,KAAK,KAAkB,WAAW,aAAa,KAAK,QAAQ,UAAe,KAAK,CAAC;CAC1F;;;;;;;;CASA,eACE,QAKqC;EACrC,OAAO,KAAK,KAAK,YAAY,MAAM;CACrC;;;;;CAMA,cAAc,QAAgB,WAA6D;EACzF,OAAO,KAAK,KAAK,oBAAoB;GAAE;GAAQ;EAAU,CAAC;CAC5D;;;;;;;CAQA,WAAW,QAA2E;EACpF,OAAO,KAAK,KAAK,iBAAiB,EAAE,OAAO,CAAC;CAC9C;;CAGA,cAAc,WAA8E;EAC1F,OAAO,KAAK,KAAK,iBAAiB,EAAE,UAAU,CAAC;CACjD;;CAGA,aAAa,OAAoD;EAC/D,OAAO,KAAK,KAAK,mBAAmB,EAAE,MAAM,CAAC;CAC/C;;CAGA,aAAa,OAAoD;EAC/D,OAAO,KAAK,KAAK,mBAAmB,EAAE,MAAM,CAAC;CAC/C;;;;;;;;;CAUA,iBAAiB,QAAwD;EACvE,OAAO,KAAK,QAAQ,OAAO,kBAAkB,MAAM,CAAC;CACtD;;;;;;;;;;CAWA,iBACE,QACA,OACwC;EACxC,MAAM,UAAU,KAAK,iBAAiB,KAAK;EAC3C,IAAI,YAAY,KAAA,GAAW,OAAO,QAAQ,OAAO,OAAO;EACxD,OAAO,KAAK,QAAQ,OAAO,kBAAkB,MAAM,GAAG,KAAK;CAC7D;;;;;;;;;;CAWA,0BAA0B,WAAkE;EAC1F,OAAO,KAAK,QAAQ,OAAO,2BAA2B,SAAS,CAAC;CAClE;;CAGA,0BACE,WACA,OAC+C;EAC/C,MAAM,UAAU,KAAK,iBAAiB,KAAK;EAC3C,IAAI,YAAY,KAAA,GAAW,OAAO,QAAQ,OAAO,OAAO;EACxD,OAAO,KAAK,QAAQ,OAAO,2BAA2B,SAAS,GAAG,KAAK;CACzE;;CAGQ,iBACN,OACoC;EACpC,MAAM,WAAW,KAAK,QAAQ;EAC9B,IAAI,aAAa,KAAA,GAAW,OAAO,KAAA;EACnC,MAAM,SAA0B,CAAC;EACjC,KAAK,MAAM,WAAW,uBACpB,KAAK,MAAM,SAAS,OAAO,KAAK,MAAM,QAAQ,EAAE,UAAU,CAAC,CAAC,GAAG;GAE7D,IAAI,SAAS,OAAO,SAAS,KAAK,GAAG;GACrC,OAAO,KAAK;IAAE,MAAM,GAAG,QAAQ,UAAU;IAAS,SAAS;GAAuB,CAAC;EACrF;EAEF,OAAO,OAAO,SAAS,IACnB,IAAI,uBAAuB,kBAAkB,KAAA,GAAW,MAAM,IAC9D,KAAA;CACN;;CAGA,OAAO,QAAwC;EAC7C,OAAO,KAAK,KAAmB,WAAW,MAAM;CAClD;CAEQ,KAAQ,MAAc,MAA2B;EACvD,OAAO,KAAK,QAAW,QAAQ,MAAM,IAAI;CAC3C;CAEA,MAAc,QACZ,QACA,MACA,MACY;EACZ,MAAM,UAAkC,CAAC;EACzC,IAAI,SAAS,KAAA,GAAW,QAAQ,kBAAkB;EAClD,IAAI,KAAK,QAAQ,UAAU,KAAA,GAAW,QAAQ,gBAAgB,UAAU,KAAK,QAAQ;EAErF,MAAM,WAAW,OADD,KAAK,QAAQ,SAAS,MAAA,CACP,GAAG,KAAK,QAAQ,OAAO,QAAQ,OAAO,EAAE,IAAI,QAAQ;GACjF;GACA;GACA,GAAI,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,IAAI,EAAE;EAC7D,CAAC;EACD,IAAI,CAAC,SAAS,IAAI,MAAM,IAAI,mBAAmB,MAAM,SAAS,QAAQ,MAAM,SAAS,KAAK,CAAC;EAC3F,OAAQ,MAAM,SAAS,KAAK;CAC9B;AACF;AAEA,MAAM,qBAAqB,WAAmB,kBAAkB,mBAAmB,MAAM;AACzF,MAAM,8BAA8B,cAClC,6BAA6B,mBAAmB,SAAS"}
@@ -0,0 +1,49 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_host_platform = require("../host/platform.cjs");
3
+ // src/cloudflare/bindings.ts
4
+ /** How Cloudflare's `get` reports an unknown instance id. */
5
+ const CF_NOT_FOUND = "instance.not_found";
6
+ /**
7
+ * The Workflow binding as the host's runtime port: `get` answers an unknown id with
8
+ * `InstanceNotFoundError`, as the port promises, instead of Cloudflare's own error. Everything
9
+ * else is forwarded as is.
10
+ */
11
+ function cloudflareJourneyBinding(binding) {
12
+ return {
13
+ create: (options) => binding.create(options),
14
+ async get(id) {
15
+ try {
16
+ return await binding.get(id);
17
+ } catch (error) {
18
+ if (String(error).includes(CF_NOT_FOUND)) throw new require_host_platform.InstanceNotFoundError(id, { cause: error });
19
+ throw error;
20
+ }
21
+ }
22
+ };
23
+ }
24
+ /**
25
+ * Slack on the deadline when deciding whether a thrown wait was a timeout: the
26
+ * platform may surface the expiry a moment early, and a wait shorter than this
27
+ * has no room to tell the two apart anyway.
28
+ */
29
+ const WAKE_TIMEOUT_TOLERANCE_MS = 5e3;
30
+ /**
31
+ * Did a wait that threw actually reach its deadline?
32
+ *
33
+ * CF signals a wait timeout by throwing, and so does every other failure in
34
+ * there — a broken binding, an evicted instance, a malformed timeout. Reading
35
+ * them all as timeouts would make an infrastructure fault indistinguishable
36
+ * from "the user never did it" (the journey would take its onTimeout branch,
37
+ * early and silently). Only the clock can tell them apart, and only against
38
+ * the absolute deadline: measured from when the wait was parked, a replay
39
+ * after an eviction would start the measure over and read a
40
+ * genuine expiry as a failure.
41
+ */
42
+ function wakeExpired(deadlineMs, now) {
43
+ return now >= deadlineMs - WAKE_TIMEOUT_TOLERANCE_MS;
44
+ }
45
+ exports.WAKE_TIMEOUT_TOLERANCE_MS = WAKE_TIMEOUT_TOLERANCE_MS;
46
+ exports.cloudflareJourneyBinding = cloudflareJourneyBinding;
47
+ exports.wakeExpired = wakeExpired;
48
+
49
+ //# sourceMappingURL=bindings.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.cjs","names":["InstanceNotFoundError"],"sources":["../../src/cloudflare/bindings.ts"],"sourcesContent":["import { InstanceNotFoundError, type WorkflowBindingLike } from '../host/platform';\n\n/**\n * A minimal structural interface over the Cloudflare bindings.\n *\n * @cloudflare/workers-types is deliberately not used: the global types it\n * injects clash with the DOM lib this package's react side needs. A structural\n * subset plus the ambient cloudflare:workers declaration is enough to compile,\n * and the real bindings satisfy it structurally at runtime.\n */\n\n// The send_email binding's shape lives with the transport that calls it; re-exported for callers\nexport type { EmailBindingLike } from '../transports/cloudflare-email';\n\n/** Cloudflare's Workflow binding, as far as the host uses it. */\nexport type CfWorkflowBinding = Pick<WorkflowBindingLike, 'create' | 'get'>;\n\n/** How Cloudflare's `get` reports an unknown instance id. */\nconst CF_NOT_FOUND = 'instance.not_found';\n\n/**\n * The Workflow binding as the host's runtime port: `get` answers an unknown id with\n * `InstanceNotFoundError`, as the port promises, instead of Cloudflare's own error. Everything\n * else is forwarded as is.\n */\nexport function cloudflareJourneyBinding(binding: CfWorkflowBinding): WorkflowBindingLike {\n return {\n create: (options) => binding.create(options),\n async get(id) {\n try {\n return await binding.get(id);\n } catch (error) {\n if (String(error).includes(CF_NOT_FOUND)) {\n throw new InstanceNotFoundError(id, { cause: error });\n }\n throw error;\n }\n },\n };\n}\n\n/**\n * Slack on the deadline when deciding whether a thrown wait was a timeout: the\n * platform may surface the expiry a moment early, and a wait shorter than this\n * has no room to tell the two apart anyway.\n */\nexport const WAKE_TIMEOUT_TOLERANCE_MS = 5_000;\n\n/**\n * Did a wait that threw actually reach its deadline?\n *\n * CF signals a wait timeout by throwing, and so does every other failure in\n * there — a broken binding, an evicted instance, a malformed timeout. Reading\n * them all as timeouts would make an infrastructure fault indistinguishable\n * from \"the user never did it\" (the journey would take its onTimeout branch,\n * early and silently). Only the clock can tell them apart, and only against\n * the absolute deadline: measured from when the wait was parked, a replay\n * after an eviction would start the measure over and read a\n * genuine expiry as a failure.\n */\nexport function wakeExpired(deadlineMs: number, now: number): boolean {\n return now >= deadlineMs - WAKE_TIMEOUT_TOLERANCE_MS;\n}\n"],"mappings":";;;;AAkBA,MAAM,eAAe;;;;;;AAOrB,SAAgB,yBAAyB,SAAiD;CACxF,OAAO;EACL,SAAS,YAAY,QAAQ,OAAO,OAAO;EAC3C,MAAM,IAAI,IAAI;GACZ,IAAI;IACF,OAAO,MAAM,QAAQ,IAAI,EAAE;GAC7B,SAAS,OAAO;IACd,IAAI,OAAO,KAAK,CAAC,CAAC,SAAS,YAAY,GACrC,MAAM,IAAIA,sBAAAA,sBAAsB,IAAI,EAAE,OAAO,MAAM,CAAC;IAEtD,MAAM;GACR;EACF;CACF;AACF;;;;;;AAOA,MAAa,4BAA4B;;;;;;;;;;;;;AAczC,SAAgB,YAAY,YAAoB,KAAsB;CACpE,OAAO,OAAO,aAAa;AAC7B"}
@@ -0,0 +1,31 @@
1
+ import { WorkflowBindingLike } from "../host/platform.cjs";
2
+ import { EmailBindingLike } from "../transports/cloudflare-email.cjs";
3
+ /** Cloudflare's Workflow binding, as far as the host uses it. */
4
+ export type CfWorkflowBinding = Pick<WorkflowBindingLike, 'create' | 'get'>;
5
+ /**
6
+ * The Workflow binding as the host's runtime port: `get` answers an unknown id with
7
+ * `InstanceNotFoundError`, as the port promises, instead of Cloudflare's own error. Everything
8
+ * else is forwarded as is.
9
+ */
10
+ export declare function cloudflareJourneyBinding(binding: CfWorkflowBinding): WorkflowBindingLike;
11
+ /**
12
+ * Slack on the deadline when deciding whether a thrown wait was a timeout: the
13
+ * platform may surface the expiry a moment early, and a wait shorter than this
14
+ * has no room to tell the two apart anyway.
15
+ */
16
+ export declare const WAKE_TIMEOUT_TOLERANCE_MS = 5000;
17
+ /**
18
+ * Did a wait that threw actually reach its deadline?
19
+ *
20
+ * CF signals a wait timeout by throwing, and so does every other failure in
21
+ * there — a broken binding, an evicted instance, a malformed timeout. Reading
22
+ * them all as timeouts would make an infrastructure fault indistinguishable
23
+ * from "the user never did it" (the journey would take its onTimeout branch,
24
+ * early and silently). Only the clock can tell them apart, and only against
25
+ * the absolute deadline: measured from when the wait was parked, a replay
26
+ * after an eviction would start the measure over and read a
27
+ * genuine expiry as a failure.
28
+ */
29
+ export declare function wakeExpired(deadlineMs: number, now: number): boolean;
30
+ export type { EmailBindingLike };
31
+ //# sourceMappingURL=bindings.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.d.cts","names":[],"sources":["../../src/cloudflare/bindings.ts"],"mappings":";;;YAeY,oBAAoB,KAAK;;;;;;wBAUrB,yBAAyB,SAAS,oBAAoB;;;;;;qBAqBzD;;;;;;;;;;;;;wBAcG,YAAY,oBAAoB"}
@@ -0,0 +1,31 @@
1
+ import { WorkflowBindingLike } from "../host/platform.mjs";
2
+ import { EmailBindingLike } from "../transports/cloudflare-email.mjs";
3
+ /** Cloudflare's Workflow binding, as far as the host uses it. */
4
+ export type CfWorkflowBinding = Pick<WorkflowBindingLike, 'create' | 'get'>;
5
+ /**
6
+ * The Workflow binding as the host's runtime port: `get` answers an unknown id with
7
+ * `InstanceNotFoundError`, as the port promises, instead of Cloudflare's own error. Everything
8
+ * else is forwarded as is.
9
+ */
10
+ export declare function cloudflareJourneyBinding(binding: CfWorkflowBinding): WorkflowBindingLike;
11
+ /**
12
+ * Slack on the deadline when deciding whether a thrown wait was a timeout: the
13
+ * platform may surface the expiry a moment early, and a wait shorter than this
14
+ * has no room to tell the two apart anyway.
15
+ */
16
+ export declare const WAKE_TIMEOUT_TOLERANCE_MS = 5000;
17
+ /**
18
+ * Did a wait that threw actually reach its deadline?
19
+ *
20
+ * CF signals a wait timeout by throwing, and so does every other failure in
21
+ * there — a broken binding, an evicted instance, a malformed timeout. Reading
22
+ * them all as timeouts would make an infrastructure fault indistinguishable
23
+ * from "the user never did it" (the journey would take its onTimeout branch,
24
+ * early and silently). Only the clock can tell them apart, and only against
25
+ * the absolute deadline: measured from when the wait was parked, a replay
26
+ * after an eviction would start the measure over and read a
27
+ * genuine expiry as a failure.
28
+ */
29
+ export declare function wakeExpired(deadlineMs: number, now: number): boolean;
30
+ export type { EmailBindingLike };
31
+ //# sourceMappingURL=bindings.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.d.mts","names":[],"sources":["../../src/cloudflare/bindings.ts"],"mappings":";;;YAeY,oBAAoB,KAAK;;;;;;wBAUrB,yBAAyB,SAAS,oBAAoB;;;;;;qBAqBzD;;;;;;;;;;;;;wBAcG,YAAY,oBAAoB"}
@@ -0,0 +1,46 @@
1
+ import { InstanceNotFoundError } from "../host/platform.mjs";
2
+ // src/cloudflare/bindings.ts
3
+ /** How Cloudflare's `get` reports an unknown instance id. */
4
+ const CF_NOT_FOUND = "instance.not_found";
5
+ /**
6
+ * The Workflow binding as the host's runtime port: `get` answers an unknown id with
7
+ * `InstanceNotFoundError`, as the port promises, instead of Cloudflare's own error. Everything
8
+ * else is forwarded as is.
9
+ */
10
+ function cloudflareJourneyBinding(binding) {
11
+ return {
12
+ create: (options) => binding.create(options),
13
+ async get(id) {
14
+ try {
15
+ return await binding.get(id);
16
+ } catch (error) {
17
+ if (String(error).includes(CF_NOT_FOUND)) throw new InstanceNotFoundError(id, { cause: error });
18
+ throw error;
19
+ }
20
+ }
21
+ };
22
+ }
23
+ /**
24
+ * Slack on the deadline when deciding whether a thrown wait was a timeout: the
25
+ * platform may surface the expiry a moment early, and a wait shorter than this
26
+ * has no room to tell the two apart anyway.
27
+ */
28
+ const WAKE_TIMEOUT_TOLERANCE_MS = 5e3;
29
+ /**
30
+ * Did a wait that threw actually reach its deadline?
31
+ *
32
+ * CF signals a wait timeout by throwing, and so does every other failure in
33
+ * there — a broken binding, an evicted instance, a malformed timeout. Reading
34
+ * them all as timeouts would make an infrastructure fault indistinguishable
35
+ * from "the user never did it" (the journey would take its onTimeout branch,
36
+ * early and silently). Only the clock can tell them apart, and only against
37
+ * the absolute deadline: measured from when the wait was parked, a replay
38
+ * after an eviction would start the measure over and read a
39
+ * genuine expiry as a failure.
40
+ */
41
+ function wakeExpired(deadlineMs, now) {
42
+ return now >= deadlineMs - WAKE_TIMEOUT_TOLERANCE_MS;
43
+ }
44
+ export { WAKE_TIMEOUT_TOLERANCE_MS, cloudflareJourneyBinding, wakeExpired };
45
+
46
+ //# sourceMappingURL=bindings.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.mjs","names":[],"sources":["../../src/cloudflare/bindings.ts"],"sourcesContent":["import { InstanceNotFoundError, type WorkflowBindingLike } from '../host/platform';\n\n/**\n * A minimal structural interface over the Cloudflare bindings.\n *\n * @cloudflare/workers-types is deliberately not used: the global types it\n * injects clash with the DOM lib this package's react side needs. A structural\n * subset plus the ambient cloudflare:workers declaration is enough to compile,\n * and the real bindings satisfy it structurally at runtime.\n */\n\n// The send_email binding's shape lives with the transport that calls it; re-exported for callers\nexport type { EmailBindingLike } from '../transports/cloudflare-email';\n\n/** Cloudflare's Workflow binding, as far as the host uses it. */\nexport type CfWorkflowBinding = Pick<WorkflowBindingLike, 'create' | 'get'>;\n\n/** How Cloudflare's `get` reports an unknown instance id. */\nconst CF_NOT_FOUND = 'instance.not_found';\n\n/**\n * The Workflow binding as the host's runtime port: `get` answers an unknown id with\n * `InstanceNotFoundError`, as the port promises, instead of Cloudflare's own error. Everything\n * else is forwarded as is.\n */\nexport function cloudflareJourneyBinding(binding: CfWorkflowBinding): WorkflowBindingLike {\n return {\n create: (options) => binding.create(options),\n async get(id) {\n try {\n return await binding.get(id);\n } catch (error) {\n if (String(error).includes(CF_NOT_FOUND)) {\n throw new InstanceNotFoundError(id, { cause: error });\n }\n throw error;\n }\n },\n };\n}\n\n/**\n * Slack on the deadline when deciding whether a thrown wait was a timeout: the\n * platform may surface the expiry a moment early, and a wait shorter than this\n * has no room to tell the two apart anyway.\n */\nexport const WAKE_TIMEOUT_TOLERANCE_MS = 5_000;\n\n/**\n * Did a wait that threw actually reach its deadline?\n *\n * CF signals a wait timeout by throwing, and so does every other failure in\n * there — a broken binding, an evicted instance, a malformed timeout. Reading\n * them all as timeouts would make an infrastructure fault indistinguishable\n * from \"the user never did it\" (the journey would take its onTimeout branch,\n * early and silently). Only the clock can tell them apart, and only against\n * the absolute deadline: measured from when the wait was parked, a replay\n * after an eviction would start the measure over and read a\n * genuine expiry as a failure.\n */\nexport function wakeExpired(deadlineMs: number, now: number): boolean {\n return now >= deadlineMs - WAKE_TIMEOUT_TOLERANCE_MS;\n}\n"],"mappings":";;;AAkBA,MAAM,eAAe;;;;;;AAOrB,SAAgB,yBAAyB,SAAiD;CACxF,OAAO;EACL,SAAS,YAAY,QAAQ,OAAO,OAAO;EAC3C,MAAM,IAAI,IAAI;GACZ,IAAI;IACF,OAAO,MAAM,QAAQ,IAAI,EAAE;GAC7B,SAAS,OAAO;IACd,IAAI,OAAO,KAAK,CAAC,CAAC,SAAS,YAAY,GACrC,MAAM,IAAI,sBAAsB,IAAI,EAAE,OAAO,MAAM,CAAC;IAEtD,MAAM;GACR;EACF;CACF;AACF;;;;;;AAOA,MAAa,4BAA4B;;;;;;;;;;;;;AAczC,SAAgB,YAAY,YAAoB,KAAsB;CACpE,OAAO,OAAO,aAAa;AAC7B"}
@@ -0,0 +1,73 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_cloudflare_bindings = require("./bindings.cjs");
3
+ const require_host_platform = require("../host/platform.cjs");
4
+ const require_store_facts = require("../store/facts.cjs");
5
+ const require_store_erasure = require("../store/erasure.cjs");
6
+ const require_store_postgres_reporting = require("../store/postgres-reporting.cjs");
7
+ const require_store_postgres = require("../store/postgres.cjs");
8
+ const require_host_ingest = require("../host/ingest.cjs");
9
+ const require_host_http = require("../host/http.cjs");
10
+ const require_host_auth = require("../host/auth.cjs");
11
+ const require_cloudflare_runner = require("./runner.cjs");
12
+ const require_host_senders = require("../host/senders.cjs");
13
+ const require_email_sender = require("../email-sender.cjs");
14
+ const require_host_channels = require("../host/channels.cjs");
15
+ const require_reporting_observer = require("../reporting/observer.cjs");
16
+ const require_reporting_tracking = require("../reporting/tracking.cjs");
17
+ const require_host_journey_host = require("../host/journey-host.cjs");
18
+ const require_reporting_classify = require("../reporting/classify.cjs");
19
+ const require_cloudflare_worker = require("./worker.cjs");
20
+ const require_store_index = require("../store/index.cjs");
21
+ exports.BURST_WINDOW_MS = require_reporting_classify.BURST_WINDOW_MS;
22
+ exports.BundleIntegrityError = require_host_ingest.BundleIntegrityError;
23
+ exports.DATE_FANOUT_BUDGET_MS = require_host_ingest.DATE_FANOUT_BUDGET_MS;
24
+ exports.DATE_TRIGGER_GRACE_MS = require_host_ingest.DATE_TRIGGER_GRACE_MS;
25
+ exports.DEFAULT_QUICK_MS = require_reporting_classify.DEFAULT_QUICK_MS;
26
+ exports.EmailSender = require_email_sender.EmailSender;
27
+ exports.EnvValidationError = require_host_journey_host.EnvValidationError;
28
+ exports.EventPayloadTooLargeError = require_host_ingest.EventPayloadTooLargeError;
29
+ exports.InstanceNotFoundError = require_host_platform.InstanceNotFoundError;
30
+ exports.JourneyFactSource = require_store_facts.JourneyFactSource;
31
+ exports.JourneyRunner = require_cloudflare_runner.JourneyRunner;
32
+ exports.LogMessageSender = require_host_senders.LogMessageSender;
33
+ exports.MAX_EVENT_PAYLOAD_BYTES = require_host_ingest.MAX_EVENT_PAYLOAD_BYTES;
34
+ exports.PostgresJourneyStore = require_store_postgres.PostgresJourneyStore;
35
+ exports.PostgresReporting = require_store_postgres_reporting.PostgresReporting;
36
+ exports.SWEEP_BUDGET_MS = require_host_ingest.SWEEP_BUDGET_MS;
37
+ exports.SWEEP_PAGE_SIZE = require_host_ingest.SWEEP_PAGE_SIZE;
38
+ exports.SchemaMismatchError = require_store_index.SchemaMismatchError;
39
+ exports.UserErasedError = require_store_erasure.UserErasedError;
40
+ exports.WAKE_EVENT_TYPE = require_host_platform.WAKE_EVENT_TYPE;
41
+ exports.WAKE_TIMEOUT_TOLERANCE_MS = require_cloudflare_bindings.WAKE_TIMEOUT_TOLERANCE_MS;
42
+ exports.WebhookMessageSender = require_host_senders.WebhookMessageSender;
43
+ exports.authorized = require_host_auth.authorized;
44
+ exports.bearerMatches = require_host_auth.bearerMatches;
45
+ exports.channelsFromConfig = require_host_channels.channelsFromConfig;
46
+ exports.classifyClick = require_reporting_classify.classifyClick;
47
+ exports.classifyOpen = require_reporting_classify.classifyOpen;
48
+ exports.cloudflareJourneyBinding = require_cloudflare_bindings.cloudflareJourneyBinding;
49
+ exports.deployBundle = require_host_ingest.deployBundle;
50
+ exports.fanOutDatePage = require_host_ingest.fanOutDatePage;
51
+ exports.forgetUser = require_host_ingest.forgetUser;
52
+ exports.handleRequest = require_host_http.handleRequest;
53
+ exports.handleTracking = require_reporting_tracking.handleTracking;
54
+ exports.identifyUser = require_host_ingest.identifyUser;
55
+ exports.ingestEvent = require_host_ingest.ingestEvent;
56
+ exports.journeyMode = require_host_channels.journeyMode;
57
+ exports.journeyWorker = require_cloudflare_worker.journeyWorker;
58
+ exports.recordPushOpen = require_reporting_tracking.recordPushOpen;
59
+ exports.registerDevice = require_host_ingest.registerDevice;
60
+ exports.removeDevice = require_host_ingest.removeDevice;
61
+ exports.reportingObserver = require_reporting_observer.reportingObserver;
62
+ exports.routeByChannel = require_host_senders.routeByChannel;
63
+ exports.routeByPlatform = require_host_senders.routeByPlatform;
64
+ exports.runtimeFromConfig = require_host_channels.runtimeFromConfig;
65
+ exports.sweepDateTriggers = require_host_ingest.sweepDateTriggers;
66
+ exports.sweepMaintenance = require_host_ingest.sweepMaintenance;
67
+ exports.sweepSegmentPass = require_host_ingest.sweepSegmentPass;
68
+ exports.sweepSegments = require_host_ingest.sweepSegments;
69
+ exports.sweepSegmentsPaged = require_host_ingest.sweepSegmentsPaged;
70
+ exports.timingSafeEqual = require_host_auth.timingSafeEqual;
71
+ exports.trackEmail = require_email_sender.trackEmail;
72
+ exports.unbindDevice = require_host_ingest.unbindDevice;
73
+ exports.wakeExpired = require_cloudflare_bindings.wakeExpired;
@@ -0,0 +1,25 @@
1
+ import { WAKE_TIMEOUT_TOLERANCE_MS, cloudflareJourneyBinding, wakeExpired } from "./bindings.cjs";
2
+ import { InstanceNotFoundError, JourneyEnv, JourneyParams, WAKE_EVENT_TYPE, WorkflowBindingLike, WorkflowInstanceLike } from "../host/platform.cjs";
3
+ import { UserErasedError } from "../store/erasure.cjs";
4
+ import { JourneyFactSource } from "../store/facts.cjs";
5
+ import { SqlClientLike } from "../store/sql.cjs";
6
+ import { PostgresJourneyStore, PostgresJourneyStoreOptions } from "../store/postgres.cjs";
7
+ import { PostgresReporting } from "../store/postgres-reporting.cjs";
8
+ import { BundleIntegrityError, DATE_FANOUT_BUDGET_MS, DATE_TRIGGER_GRACE_MS, DeployResult, DeviceRegistration, EventPayloadTooLargeError, IdentifyResult, IngestInput, IngestResult, MAX_EVENT_PAYLOAD_BYTES, SWEEP_BUDGET_MS, SWEEP_PAGE_SIZE, SweepPage, SweepResult, deployBundle, fanOutDatePage, forgetUser, identifyUser, ingestEvent, registerDevice, removeDevice, sweepDateTriggers, sweepMaintenance, sweepSegmentPass, sweepSegments, sweepSegmentsPaged, unbindDevice } from "../host/ingest.cjs";
9
+ import { IngestValidation, handleRequest } from "../host/http.cjs";
10
+ import { Authorize, authorized, bearerMatches, timingSafeEqual } from "../host/auth.cjs";
11
+ import { JourneyRunner } from "./runner.cjs";
12
+ import { EmailBindingLike } from "../transports/cloudflare-email.cjs";
13
+ import { LogMessageSender, WebhookMessageSender, routeByChannel, routeByPlatform } from "../host/senders.cjs";
14
+ import { EmailAddress } from "../template-rules.cjs";
15
+ import { EmailMessage, EmailRenderer, EmailSender, EmailSenderOptions, EmailTransport, RenderedEmail, trackEmail } from "../email-sender.cjs";
16
+ import { ChannelsConfig, channelsFromConfig, journeyMode, runtimeFromConfig } from "../host/channels.cjs";
17
+ import { EnvValidationError } from "../host/journey-host.cjs";
18
+ import { JourneyObserver, LinkPurpose, MessageTracking, OutboundMessage, PushDevice, SendResult } from "../engine/ports.cjs";
19
+ import { reportingObserver } from "../reporting/observer.cjs";
20
+ import { TrackingOptions, handleTracking, recordPushOpen } from "../reporting/tracking.cjs";
21
+ import { BURST_WINDOW_MS, ClassifyOptions, ClickFacts, DEFAULT_QUICK_MS, RequestFacts, Verdict, classifyClick, classifyOpen } from "../reporting/classify.cjs";
22
+ import { QueueMessageLike } from "../host/batch.cjs";
23
+ import { ExecutionContextLike, JourneyWorker, JourneyWorkerOptions, journeyWorker } from "./worker.cjs";
24
+ import { BundleVersion, Engagement, EntryInput, EntryOutcome, EventInput, JourneyReporting, JourneyStore, MessageRecord, ProfileProps, SchemaMismatchError, SegmentCandidate, SegmentTriggerRoute, StoreLease, TriggerRoute } from "../store/index.cjs";
25
+ export { type Authorize, BURST_WINDOW_MS, BundleIntegrityError, type BundleVersion, type ChannelsConfig, type ClassifyOptions, type ClickFacts, DATE_FANOUT_BUDGET_MS, DATE_TRIGGER_GRACE_MS, DEFAULT_QUICK_MS, type DeployResult, type DeviceRegistration, type EmailAddress, type EmailBindingLike, type EmailMessage, type EmailRenderer, EmailSender, type EmailSenderOptions, type EmailTransport, type Engagement, type EntryInput, type EntryOutcome, EnvValidationError, type EventInput, EventPayloadTooLargeError, type ExecutionContextLike, type IdentifyResult, type IngestInput, type IngestResult, type IngestValidation, InstanceNotFoundError, type JourneyEnv, JourneyFactSource, type JourneyObserver, type JourneyParams, type JourneyReporting, JourneyRunner, type JourneyStore, type JourneyWorker, type JourneyWorkerOptions, type LinkPurpose, LogMessageSender, MAX_EVENT_PAYLOAD_BYTES, type MessageRecord, type MessageTracking, type OutboundMessage, PostgresJourneyStore, type PostgresJourneyStoreOptions, PostgresReporting, type ProfileProps, type PushDevice, type QueueMessageLike, type RenderedEmail, type RequestFacts, SWEEP_BUDGET_MS, SWEEP_PAGE_SIZE, SchemaMismatchError, type SegmentCandidate, type SegmentTriggerRoute, type SendResult, type SqlClientLike, type StoreLease, type SweepPage, type SweepResult, type TrackingOptions, type TriggerRoute, UserErasedError, type Verdict, WAKE_EVENT_TYPE, WAKE_TIMEOUT_TOLERANCE_MS, WebhookMessageSender, type WorkflowBindingLike, type WorkflowInstanceLike, authorized, bearerMatches, channelsFromConfig, classifyClick, classifyOpen, cloudflareJourneyBinding, deployBundle, fanOutDatePage, forgetUser, handleRequest, handleTracking, identifyUser, ingestEvent, journeyMode, journeyWorker, recordPushOpen, registerDevice, removeDevice, reportingObserver, routeByChannel, routeByPlatform, runtimeFromConfig, sweepDateTriggers, sweepMaintenance, sweepSegmentPass, sweepSegments, sweepSegmentsPaged, timingSafeEqual, trackEmail, unbindDevice, wakeExpired };
@@ -0,0 +1,25 @@
1
+ import { WAKE_TIMEOUT_TOLERANCE_MS, cloudflareJourneyBinding, wakeExpired } from "./bindings.mjs";
2
+ import { InstanceNotFoundError, JourneyEnv, JourneyParams, WAKE_EVENT_TYPE, WorkflowBindingLike, WorkflowInstanceLike } from "../host/platform.mjs";
3
+ import { UserErasedError } from "../store/erasure.mjs";
4
+ import { JourneyFactSource } from "../store/facts.mjs";
5
+ import { SqlClientLike } from "../store/sql.mjs";
6
+ import { PostgresJourneyStore, PostgresJourneyStoreOptions } from "../store/postgres.mjs";
7
+ import { PostgresReporting } from "../store/postgres-reporting.mjs";
8
+ import { BundleIntegrityError, DATE_FANOUT_BUDGET_MS, DATE_TRIGGER_GRACE_MS, DeployResult, DeviceRegistration, EventPayloadTooLargeError, IdentifyResult, IngestInput, IngestResult, MAX_EVENT_PAYLOAD_BYTES, SWEEP_BUDGET_MS, SWEEP_PAGE_SIZE, SweepPage, SweepResult, deployBundle, fanOutDatePage, forgetUser, identifyUser, ingestEvent, registerDevice, removeDevice, sweepDateTriggers, sweepMaintenance, sweepSegmentPass, sweepSegments, sweepSegmentsPaged, unbindDevice } from "../host/ingest.mjs";
9
+ import { IngestValidation, handleRequest } from "../host/http.mjs";
10
+ import { Authorize, authorized, bearerMatches, timingSafeEqual } from "../host/auth.mjs";
11
+ import { JourneyRunner } from "./runner.mjs";
12
+ import { EmailBindingLike } from "../transports/cloudflare-email.mjs";
13
+ import { LogMessageSender, WebhookMessageSender, routeByChannel, routeByPlatform } from "../host/senders.mjs";
14
+ import { EmailAddress } from "../template-rules.mjs";
15
+ import { EmailMessage, EmailRenderer, EmailSender, EmailSenderOptions, EmailTransport, RenderedEmail, trackEmail } from "../email-sender.mjs";
16
+ import { ChannelsConfig, channelsFromConfig, journeyMode, runtimeFromConfig } from "../host/channels.mjs";
17
+ import { EnvValidationError } from "../host/journey-host.mjs";
18
+ import { JourneyObserver, LinkPurpose, MessageTracking, OutboundMessage, PushDevice, SendResult } from "../engine/ports.mjs";
19
+ import { reportingObserver } from "../reporting/observer.mjs";
20
+ import { TrackingOptions, handleTracking, recordPushOpen } from "../reporting/tracking.mjs";
21
+ import { BURST_WINDOW_MS, ClassifyOptions, ClickFacts, DEFAULT_QUICK_MS, RequestFacts, Verdict, classifyClick, classifyOpen } from "../reporting/classify.mjs";
22
+ import { QueueMessageLike } from "../host/batch.mjs";
23
+ import { ExecutionContextLike, JourneyWorker, JourneyWorkerOptions, journeyWorker } from "./worker.mjs";
24
+ import { BundleVersion, Engagement, EntryInput, EntryOutcome, EventInput, JourneyReporting, JourneyStore, MessageRecord, ProfileProps, SchemaMismatchError, SegmentCandidate, SegmentTriggerRoute, StoreLease, TriggerRoute } from "../store/index.mjs";
25
+ export { type Authorize, BURST_WINDOW_MS, BundleIntegrityError, type BundleVersion, type ChannelsConfig, type ClassifyOptions, type ClickFacts, DATE_FANOUT_BUDGET_MS, DATE_TRIGGER_GRACE_MS, DEFAULT_QUICK_MS, type DeployResult, type DeviceRegistration, type EmailAddress, type EmailBindingLike, type EmailMessage, type EmailRenderer, EmailSender, type EmailSenderOptions, type EmailTransport, type Engagement, type EntryInput, type EntryOutcome, EnvValidationError, type EventInput, EventPayloadTooLargeError, type ExecutionContextLike, type IdentifyResult, type IngestInput, type IngestResult, type IngestValidation, InstanceNotFoundError, type JourneyEnv, JourneyFactSource, type JourneyObserver, type JourneyParams, type JourneyReporting, JourneyRunner, type JourneyStore, type JourneyWorker, type JourneyWorkerOptions, type LinkPurpose, LogMessageSender, MAX_EVENT_PAYLOAD_BYTES, type MessageRecord, type MessageTracking, type OutboundMessage, PostgresJourneyStore, type PostgresJourneyStoreOptions, PostgresReporting, type ProfileProps, type PushDevice, type QueueMessageLike, type RenderedEmail, type RequestFacts, SWEEP_BUDGET_MS, SWEEP_PAGE_SIZE, SchemaMismatchError, type SegmentCandidate, type SegmentTriggerRoute, type SendResult, type SqlClientLike, type StoreLease, type SweepPage, type SweepResult, type TrackingOptions, type TriggerRoute, UserErasedError, type Verdict, WAKE_EVENT_TYPE, WAKE_TIMEOUT_TOLERANCE_MS, WebhookMessageSender, type WorkflowBindingLike, type WorkflowInstanceLike, authorized, bearerMatches, channelsFromConfig, classifyClick, classifyOpen, cloudflareJourneyBinding, deployBundle, fanOutDatePage, forgetUser, handleRequest, handleTracking, identifyUser, ingestEvent, journeyMode, journeyWorker, recordPushOpen, registerDevice, removeDevice, reportingObserver, routeByChannel, routeByPlatform, runtimeFromConfig, sweepDateTriggers, sweepMaintenance, sweepSegmentPass, sweepSegments, sweepSegmentsPaged, timingSafeEqual, trackEmail, unbindDevice, wakeExpired };
@@ -0,0 +1,20 @@
1
+ import { WAKE_TIMEOUT_TOLERANCE_MS, cloudflareJourneyBinding, wakeExpired } from "./bindings.mjs";
2
+ import { InstanceNotFoundError, WAKE_EVENT_TYPE } from "../host/platform.mjs";
3
+ import { JourneyFactSource } from "../store/facts.mjs";
4
+ import { UserErasedError } from "../store/erasure.mjs";
5
+ import { PostgresReporting } from "../store/postgres-reporting.mjs";
6
+ import { PostgresJourneyStore } from "../store/postgres.mjs";
7
+ import { BundleIntegrityError, DATE_FANOUT_BUDGET_MS, DATE_TRIGGER_GRACE_MS, EventPayloadTooLargeError, MAX_EVENT_PAYLOAD_BYTES, SWEEP_BUDGET_MS, SWEEP_PAGE_SIZE, deployBundle, fanOutDatePage, forgetUser, identifyUser, ingestEvent, registerDevice, removeDevice, sweepDateTriggers, sweepMaintenance, sweepSegmentPass, sweepSegments, sweepSegmentsPaged, unbindDevice } from "../host/ingest.mjs";
8
+ import { handleRequest } from "../host/http.mjs";
9
+ import { authorized, bearerMatches, timingSafeEqual } from "../host/auth.mjs";
10
+ import { JourneyRunner } from "./runner.mjs";
11
+ import { LogMessageSender, WebhookMessageSender, routeByChannel, routeByPlatform } from "../host/senders.mjs";
12
+ import { EmailSender, trackEmail } from "../email-sender.mjs";
13
+ import { channelsFromConfig, journeyMode, runtimeFromConfig } from "../host/channels.mjs";
14
+ import { reportingObserver } from "../reporting/observer.mjs";
15
+ import { handleTracking, recordPushOpen } from "../reporting/tracking.mjs";
16
+ import { EnvValidationError } from "../host/journey-host.mjs";
17
+ import { BURST_WINDOW_MS, DEFAULT_QUICK_MS, classifyClick, classifyOpen } from "../reporting/classify.mjs";
18
+ import { journeyWorker } from "./worker.mjs";
19
+ import { SchemaMismatchError } from "../store/index.mjs";
20
+ export { BURST_WINDOW_MS, BundleIntegrityError, DATE_FANOUT_BUDGET_MS, DATE_TRIGGER_GRACE_MS, DEFAULT_QUICK_MS, EmailSender, EnvValidationError, EventPayloadTooLargeError, InstanceNotFoundError, JourneyFactSource, JourneyRunner, LogMessageSender, MAX_EVENT_PAYLOAD_BYTES, PostgresJourneyStore, PostgresReporting, SWEEP_BUDGET_MS, SWEEP_PAGE_SIZE, SchemaMismatchError, UserErasedError, WAKE_EVENT_TYPE, WAKE_TIMEOUT_TOLERANCE_MS, WebhookMessageSender, authorized, bearerMatches, channelsFromConfig, classifyClick, classifyOpen, cloudflareJourneyBinding, deployBundle, fanOutDatePage, forgetUser, handleRequest, handleTracking, identifyUser, ingestEvent, journeyMode, journeyWorker, recordPushOpen, registerDevice, removeDevice, reportingObserver, routeByChannel, routeByPlatform, runtimeFromConfig, sweepDateTriggers, sweepMaintenance, sweepSegmentPass, sweepSegments, sweepSegmentsPaged, timingSafeEqual, trackEmail, unbindDevice, wakeExpired };