sendwend 0.0.1 → 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 (684) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +2065 -22
  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 +270 -31
  680. package/src/cloudflare/workers.d.ts +44 -0
  681. package/index.cjs +0 -18
  682. package/index.d.cts +0 -4
  683. package/index.d.mts +0 -4
  684. package/index.mjs +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fcm.mjs","names":[],"sources":["../src/fcm.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\nimport type { MessageSender, OutboundMessage, SendResult } from './engine';\nimport { PermanentError, awaitAnswer, isRetryableStatus } from './engine/retry';\nimport { base64url, pemToDer } from './jwt';\nimport type { PushRenderer } from './push';\n\n/**\n * `sendwend/fcm` — push delivery through Firebase Cloud Messaging's\n * HTTP v1 API, from a service account. No dependencies: the OAuth2 access\n * token is minted by signing a JWT with WebCrypto (Workers, Node 20+, Deno,\n * Bun), so this runs wherever the engine runs.\n *\n * The recipient is an FCM registration token the app registered for the user\n * (`registerDevice`); the engine sends one message per device.\n */\n\n/** The fields of a Google service-account JSON this sender needs. */\nexport interface FcmServiceAccount {\n project_id: string;\n client_email: string;\n /** PEM, `-----BEGIN PRIVATE KEY-----` (PKCS #8). */\n private_key: string;\n token_uri?: string;\n}\n\nexport interface FcmAccessTokenOptions {\n serviceAccount: FcmServiceAccount;\n /** Fetch implementation for the token exchange (defaults to the global one). */\n fetch?: typeof fetch;\n}\n\nexport interface FcmPushOptions {\n /** The access token the requests carry — shared by every sender on the same service account. */\n credentials: FcmAccessToken;\n render: PushRenderer;\n /** Android-specific delivery options, e.g. `{ channel_id: 'default' }` (FCM v1 `android.notification`). */\n android?: Record<string, unknown>;\n /** APNs-specific payload options merged into `aps`, e.g. `{ sound: 'default' }`. */\n apns?: Record<string, unknown>;\n /** Fetch implementation (defaults to the global one). */\n fetch?: typeof fetch;\n}\n\n/**\n * How an FCM v1 answer is classified, after the API's error codes\n * (https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode):\n *\n * - dead token: 404 `UNREGISTERED` (the app was uninstalled, or the token expired) — also a 404\n * whose only code is the gRPC status `NOT_FOUND`. The copy settles undelivered and the host\n * forgets the token.\n * - undelivered, device kept: 400 `INVALID_ARGUMENT`. FCM gives it for a malformed token but\n * just as well for a payload problem (a message too big, a bad data key, a bad TTL), which\n * would hit every device of the template at once; the copy settles with the reason, so the\n * report shows it, and nothing is deleted on a guess.\n * So does 403 `SENDER_ID_MISMATCH`: the token belongs to another Firebase project — a\n * development build registered against this backend — which is about this one device, unless\n * the deployment's own service account is another project's, when every device answers so.\n * The user's other devices and the rest of the journey go on either way.\n * - configuration: 401 `THIRD_PARTY_AUTH_ERROR` (the APNs or web push credentials in the\n * Firebase project): `PermanentError`, devices kept.\n * - transient: 401 `UNAUTHENTICATED` (the cached access token is dropped first), 429\n * `QUOTA_EXCEEDED`, 503 `UNAVAILABLE`, 500 `INTERNAL` and any other 429 / 5xx.\n * - everything else (another 4xx) is this request itself: a `PermanentError`.\n */\nexport const DEAD_TOKEN_REASONS: ReadonlySet<string> = new Set(['UNREGISTERED', 'NOT_FOUND']);\n\n/** This one token is refused, or this payload: the copy settles and the device is kept. */\nconst DEVICE_CODES: ReadonlySet<string> = new Set(['INVALID_ARGUMENT', 'SENDER_ID_MISMATCH']);\nconst CONFIGURATION_CODES: ReadonlySet<string> = new Set(['THIRD_PARTY_AUTH_ERROR']);\nconst TRANSIENT_CODES: ReadonlySet<string> = new Set(['QUOTA_EXCEEDED', 'UNAVAILABLE', 'INTERNAL']);\n\nconst SCOPE = 'https://www.googleapis.com/auth/firebase.messaging';\n\n/**\n * The OAuth2 access token for one service account, exchanged once and reused until a minute\n * before it expires. Concurrent callers without a usable token share the one exchange in flight,\n * and an exchange that failed is not kept, so the next call tries again. One instance serves every\n * sender built on the account — a host keeps it across runs, and builds the senders per run.\n */\nexport class FcmAccessToken {\n /** The Firebase project the account belongs to — the `messages:send` URL names it. */\n readonly projectId: string;\n private minted: { value: string; expiresAt: number } | undefined;\n private minting: Promise<string> | undefined;\n\n constructor(private readonly options: FcmAccessTokenOptions) {\n this.projectId = options.serviceAccount.project_id;\n }\n\n /** The current token, exchanged now if there is none or it is about to expire. */\n async token(now = Date.now()): Promise<string> {\n if (this.minted !== undefined && this.minted.expiresAt - 60_000 > now) {\n return this.minted.value;\n }\n this.minting ??= this.exchange(now)\n .then((minted) => {\n this.minted = minted;\n return minted.value;\n })\n .finally(() => {\n this.minting = undefined;\n });\n return this.minting;\n }\n\n /** Forget the token: FCM refused it (401), so the next call exchanges a new one. */\n invalidate(): void {\n this.minted = undefined;\n }\n\n private async exchange(now: number): Promise<{ value: string; expiresAt: number }> {\n const { serviceAccount } = this.options;\n const tokenUri = serviceAccount.token_uri ?? 'https://oauth2.googleapis.com/token';\n const assertion = await signJwt(serviceAccount, tokenUri, SCOPE, now);\n const doFetch = this.options.fetch ?? fetch;\n const response = await doFetch(tokenUri, {\n method: 'POST',\n headers: { 'content-type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams({\n grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer',\n assertion,\n }),\n });\n if (!response.ok) {\n const detail = `${response.status} ${await response.text()}`;\n // A 4xx from the token endpoint (`invalid_grant`: the key was revoked, `invalid_client`)\n // is the service account itself; only a throttled or failing endpoint is worth a retry\n if (isRetryableStatus(response.status)) {\n throw new Error(`FCM token exchange failed: ${detail}`);\n }\n throw new PermanentError(\n `FCM token exchange refused for '${serviceAccount.client_email}': ${detail}`,\n { reason: 'bad_credentials' }\n );\n }\n const json = (await response.json()) as { access_token: string; expires_in: number };\n return { value: json.access_token, expiresAt: now + json.expires_in * 1000 };\n }\n}\n\nexport class FcmPushSender implements MessageSender {\n constructor(private readonly options: FcmPushOptions) {}\n\n async send(message: OutboundMessage): Promise<void | SendResult> {\n if (message.channel !== 'push') {\n throw new Error(`FcmPushSender: unsupported channel '${message.channel}'`);\n }\n if (message.recipient === undefined) {\n throw new Error(`FcmPushSender: no push token for user '${message.userId}'`);\n }\n const { title, body, image, url } = await this.options.render(message.template, message.props);\n const { credentials, android, apns } = this.options;\n const doFetch = this.options.fetch ?? fetch;\n\n // Before the send, not inside it: a token that cannot be had means nothing went out\n const token = await credentials.token();\n // FCM does not de-duplicate: a request it never answered is not sent again (see deliver)\n const response = await awaitAnswer('FCM send', () =>\n doFetch(`https://fcm.googleapis.com/v1/projects/${credentials.projectId}/messages:send`, {\n method: 'POST',\n headers: {\n authorization: `Bearer ${token}`,\n 'content-type': 'application/json',\n },\n body: JSON.stringify({\n message: {\n token: message.recipient,\n notification: { title, body, ...(image === undefined ? {} : { image }) },\n // The template key travels as data so the app can route a tap; the\n // idempotency key lets the app de-duplicate a redelivered push.\n data: {\n template: message.template,\n idempotencyKey: message.idempotencyKey,\n ...(url === undefined ? {} : { url }),\n ...message.tracking?.data,\n },\n ...(android === undefined ? {} : { android: { notification: android } }),\n apns: { payload: { aps: { sound: 'default', ...apns } } },\n },\n }),\n })\n );\n if (response.ok) return;\n\n const text = await response.text();\n const { status } = response;\n const code = fcmErrorCode(text);\n if (code === 'UNREGISTERED' || (status === 404 && DEAD_TOKEN_REASONS.has(code))) {\n // A dead token is a fact about the recipient, not a transient failure:\n // report it and move on, so the step does not retry into the same wall.\n console.warn(`[fcm] token gone for user ${message.userId}: ${code}`);\n return { delivered: false, reason: code };\n }\n if (DEVICE_CODES.has(code)) {\n // The token, its project or our payload: settled so the report says which device, nothing\n // deleted, and one device's refusal does not end the journey for the others\n console.warn(`[fcm] refused for user ${message.userId}: ${status} ${text}`);\n return { delivered: false, reason: code };\n }\n if (CONFIGURATION_CODES.has(code)) {\n throw new PermanentError(\n `FCM refused the request for project '${credentials.projectId}': ${status} ${code}`,\n { reason: code }\n );\n }\n if (status === 401 || code === 'UNAUTHENTICATED') {\n // The access token was revoked before it expired: mint a new one on the retry\n credentials.invalidate();\n throw new Error(\n `FCM send failed: ${status} ${code || text} (access token renewed for the retry)`\n );\n }\n if (TRANSIENT_CODES.has(code) || isRetryableStatus(status)) {\n throw new Error(`FCM send failed: ${status} ${code || text}`);\n }\n throw new PermanentError(`FCM refused the request: ${status} ${code || text}`, {\n reason: code || `Refused${status}`,\n });\n }\n}\n\n/** FCM v1 error bodies carry the code at `error.status` and, for messaging, in `error.details[].errorCode`. */\nexport function fcmErrorCode(body: string): string {\n try {\n const parsed = JSON.parse(body) as {\n error?: { status?: string; details?: { errorCode?: string }[] };\n };\n const detail = parsed.error?.details?.find((d) => d.errorCode !== undefined)?.errorCode;\n return detail ?? parsed.error?.status ?? '';\n } catch {\n return '';\n }\n}\n\n/** RS256-sign the OAuth2 JWT assertion for a service account. */\nexport async function signJwt(\n account: FcmServiceAccount,\n audience: string,\n scope: string,\n nowMs = Date.now()\n): Promise<string> {\n const iat = Math.floor(nowMs / 1000);\n const header = base64url(JSON.stringify({ alg: 'RS256', typ: 'JWT' }));\n const claims = base64url(\n JSON.stringify({ iss: account.client_email, scope, aud: audience, iat, exp: iat + 3600 })\n );\n const key = await crypto.subtle.importKey(\n 'pkcs8',\n pemToDer(account.private_key),\n { name: 'RSASSA-PKCS1-v1_5', hash: 'SHA-256' },\n false,\n ['sign']\n );\n const signature = await crypto.subtle.sign(\n 'RSASSA-PKCS1-v1_5',\n key,\n new TextEncoder().encode(`${header}.${claims}`)\n );\n return `${header}.${claims}.${base64url(new Uint8Array(signature))}`;\n}\n\n/** Parse the service-account JSON as it is usually shipped: base64 of the file, in one secret. */\nexport function serviceAccountFromBase64(value: string): FcmServiceAccount {\n let json: Partial<FcmServiceAccount>;\n try {\n json = JSON.parse(Buffer.from(value, 'base64').toString()) as Partial<FcmServiceAccount>;\n } catch (error) {\n // A secret that is not base64 JSON is the same on every attempt: not worth a retry\n throw new PermanentError('service account is not base64-encoded JSON', {\n cause: error,\n reason: 'bad_credentials',\n });\n }\n if (!json.project_id || !json.client_email || !json.private_key) {\n throw new PermanentError(\n 'service account JSON is missing project_id, client_email or private_key',\n { reason: 'bad_credentials' }\n );\n }\n return json as FcmServiceAccount;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAa,qCAA0C,IAAI,IAAI,CAAC,gBAAgB,WAAW,CAAC;;AAG5F,MAAM,+BAAoC,IAAI,IAAI,CAAC,oBAAoB,oBAAoB,CAAC;AAC5F,MAAM,sCAA2C,IAAI,IAAI,CAAC,wBAAwB,CAAC;AACnF,MAAM,kCAAuC,IAAI,IAAI;CAAC;CAAkB;CAAe;AAAU,CAAC;AAElG,MAAM,QAAQ;;;;;;;AAQd,IAAa,iBAAb,MAA4B;CAMG;;CAJpB;CACD;CACA;CAER,YAA6B,SAAgC;EAAhC,KAAA,UAAA;EAC3B,KAAK,YAAY,QAAQ,eAAe;CAC1C;;CAGA,MAAM,MAAM,MAAM,KAAK,IAAI,GAAoB;EAC7C,IAAI,KAAK,WAAW,KAAA,KAAa,KAAK,OAAO,YAAY,MAAS,KAChE,OAAO,KAAK,OAAO;EAErB,KAAK,YAAY,KAAK,SAAS,GAAG,CAAC,CAChC,MAAM,WAAW;GAChB,KAAK,SAAS;GACd,OAAO,OAAO;EAChB,CAAC,CAAC,CACD,cAAc;GACb,KAAK,UAAU,KAAA;EACjB,CAAC;EACH,OAAO,KAAK;CACd;;CAGA,aAAmB;EACjB,KAAK,SAAS,KAAA;CAChB;CAEA,MAAc,SAAS,KAA4D;EACjF,MAAM,EAAE,mBAAmB,KAAK;EAChC,MAAM,WAAW,eAAe,aAAa;EAC7C,MAAM,YAAY,MAAM,QAAQ,gBAAgB,UAAU,OAAO,GAAG;EAEpE,MAAM,WAAW,OADD,KAAK,QAAQ,SAAS,MAAA,CACP,UAAU;GACvC,QAAQ;GACR,SAAS,EAAE,gBAAgB,oCAAoC;GAC/D,MAAM,IAAI,gBAAgB;IACxB,YAAY;IACZ;GACF,CAAC;EACH,CAAC;E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,SAAS,MAAM,MAAM,EAAE,cAAc,KAAA,CAAS,CAAC,EAAE,aAC7D,OAAO,OAAO,UAAU;CAC3C,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,eAAsB,QACpB,SACA,UACA,OACA,QAAQ,KAAK,IAAI,GACA;CACjB,MAAM,MAAM,KAAK,MAAM,QAAQ,GAAI;CACnC,MAAM,SAAS,UAAU,KAAK,UAAU;EAAE,KAAK;EAAS,KAAK;CAAM,CAAC,CAAC;CACrE,MAAM,SAAS,UACb,KAAK,UAAU;EAAE,KAAK,QAAQ;EAAc;EAAO,KAAK;EAAU;EAAK,KAAK,MAAM;CAAK,CAAC,CAC1F;CACA,MAAM,MAAM,MAAM,OAAO,OAAO,UAC9B,SACA,SAAS,QAAQ,WAAW,GAC5B;EAAE,MAAM;EAAqB,MAAM;CAAU,GAC7C,OACA,CAAC,MAAM,CACT;CACA,MAAM,YAAY,MAAM,OAAO,OAAO,KACpC,qBACA,KACA,IAAI,YAAY,CAAC,CAAC,OAAO,GAAG,OAAO,GAAG,QAAQ,CAChD;CACA,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,IAAI,WAAW,SAAS,CAAC;AACnE;;AAGA,SAAgB,yBAAyB,OAAkC;CACzE,IAAI;CACJ,IAAI;EACF,OAAO,KAAK,MAAM,OAAO,KAAK,OAAO,QAAQ,CAAC,CAAC,SAAS,CAAC;CAC3D,SAAS,OAAO;EAEd,MAAM,IAAI,eAAe,8CAA8C;GACrE,OAAO;GACP,QAAQ;EACV,CAAC;CACH;CACA,IAAI,CAAC,KAAK,cAAc,CAAC,KAAK,gBAAgB,CAAC,KAAK,aAClD,MAAM,IAAI,eACR,2EACA,EAAE,QAAQ,kBAAkB,CAC9B;CAEF,OAAO;AACT"}
package/dist/hash.cjs ADDED
@@ -0,0 +1,244 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ // src/hash.ts
3
+ /**
4
+ * Content hashing — contentHash covers execution semantics only.
5
+ *
6
+ * Human-facing metadata (name / description, node labels) is excluded,
7
+ * because it cannot change which path a user takes:
8
+ * - rewording a description must not invalidate the version an in-flight
9
+ * journey is pinned to;
10
+ * - nor should it surface as a change in `plan`.
11
+ *
12
+ * Storage, by contrast, always keeps the full IR (including the latest
13
+ * description). contentHash carries exactly two responsibilities: deciding
14
+ * whether semantics moved (plan / migration), and pinning a version for
15
+ * in-flight instances. So after a description edit: the UI shows the new text,
16
+ * plan reports no change, and in-flight users are untouched.
17
+ */
18
+ /**
19
+ * Keys excluded from hashing.
20
+ * - meta: metadata at any level — workflow (name / description) and
21
+ * node/segment provenance (`loc`, the callsite source map)
22
+ * - label: node and branch-arm names (UI titles / observability, never routing)
23
+ * - reason: the exit / filter audit string. It is written into the audit log
24
+ * and shown in the studio, but no user takes a different path because of it —
25
+ * the same test as a description, so rewording one must not repin in-flight
26
+ * journeys or report as a semantic change in plan.
27
+ * - contentHash: the hash itself
28
+ *
29
+ * Note that a cohort arm's `name` IS hashed: it becomes part of the node id
30
+ * (`{id}.{armName}.{j}`), and node ids are durable step names — renaming an arm
31
+ * changes execution identity.
32
+ */
33
+ const UNHASHED_KEYS = /* @__PURE__ */ new Set([
34
+ "meta",
35
+ "label",
36
+ "reason",
37
+ "contentHash"
38
+ ]);
39
+ /**
40
+ * Provenance only. `loc` is a source map, not content: it moves with the
41
+ * machine and with the directory the compile ran from, so plan compares full
42
+ * content with it removed (see plan.ts) — otherwise CI, compiling from the
43
+ * workspace root, reports every definition as metadata_only against a deploy
44
+ * compiled from a package directory.
45
+ */
46
+ const PROVENANCE_KEYS = /* @__PURE__ */ new Set(["loc"]);
47
+ /**
48
+ * Fields whose values are maps the *author* keys, not the IR: message props,
49
+ * send_event payloads and action args. Everything inside them is execution
50
+ * data and is hashed whole.
51
+ *
52
+ * This is what keeps the exclusion above positional: stripping by name at every
53
+ * depth would reach inside these maps, and a prop or payload field that happens
54
+ * to be called `label` (or `meta`) would vanish from the hash — two sends
55
+ * carrying different values would hash identically, `plan` would report a real
56
+ * change as metadata-only, and the deploy would write different content under
57
+ * the same key that in-flight journeys are pinned to.
58
+ *
59
+ * These three are the only `z.record` fields in the IR (see ir.ts). A new one
60
+ * has to be added here, or its contents become strippable by name again.
61
+ *
62
+ * It matters for every key above: a send_event payload may well carry a field
63
+ * called `reason` (subscription_cancelled does), and dropping it would hash two
64
+ * different sends the same.
65
+ */
66
+ const AUTHOR_KEYED_FIELDS = /* @__PURE__ */ new Set([
67
+ "props",
68
+ "payload",
69
+ "args"
70
+ ]);
71
+ /** Drop `keys` at the positions the IR defines them, never inside an author-keyed map. */
72
+ function stripKeys(value, keys) {
73
+ if (Array.isArray(value)) return value.map((item) => stripKeys(item, keys));
74
+ if (value !== null && typeof value === "object") {
75
+ const out = {};
76
+ for (const [key, item] of Object.entries(value)) {
77
+ if (keys.has(key)) continue;
78
+ out[key] = AUTHOR_KEYED_FIELDS.has(key) ? item : stripKeys(item, keys);
79
+ }
80
+ return out;
81
+ }
82
+ return value;
83
+ }
84
+ /** Drop metadata at the positions the IR defines it, leaving execution semantics. */
85
+ function stripMeta(value) {
86
+ return stripKeys(value, UNHASHED_KEYS);
87
+ }
88
+ /** Drop provenance, keeping the rest of the metadata — what plan compares. */
89
+ function stripProvenance(value) {
90
+ return stripKeys(value, PROVENANCE_KEYS);
91
+ }
92
+ /** Canonical JSON: sorted keys, no whitespace — a stable hash input. */
93
+ function canonicalJSON(value) {
94
+ if (value === void 0) return "null";
95
+ if (Array.isArray(value)) return `[${value.map(canonicalJSON).join(",")}]`;
96
+ if (value !== null && typeof value === "object") return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalJSON(value[key])}`).join(",")}}`;
97
+ return JSON.stringify(value);
98
+ }
99
+ const K = new Uint32Array([
100
+ 0x428a2f98,
101
+ 0x71374491,
102
+ 0xb5c0fbcf,
103
+ 0xe9b5dba5,
104
+ 961987163,
105
+ 0x59f111f1,
106
+ 0x923f82a4,
107
+ 0xab1c5ed5,
108
+ 0xd807aa98,
109
+ 310598401,
110
+ 607225278,
111
+ 0x550c7dc3,
112
+ 0x72be5d74,
113
+ 0x80deb1fe,
114
+ 0x9bdc06a7,
115
+ 0xc19bf174,
116
+ 0xe49b69c1,
117
+ 0xefbe4786,
118
+ 0xfc19dc6,
119
+ 604807628,
120
+ 770255983,
121
+ 0x4a7484aa,
122
+ 0x5cb0a9dc,
123
+ 0x76f988da,
124
+ 0x983e5152,
125
+ 0xa831c66d,
126
+ 0xb00327c8,
127
+ 0xbf597fc7,
128
+ 0xc6e00bf3,
129
+ 0xd5a79147,
130
+ 0x6ca6351,
131
+ 338241895,
132
+ 666307205,
133
+ 773529912,
134
+ 0x4d2c6dfc,
135
+ 0x53380d13,
136
+ 0x650a7354,
137
+ 0x766a0abb,
138
+ 0x81c2c92e,
139
+ 0x92722c85,
140
+ 0xa2bfe8a1,
141
+ 0xa81a664b,
142
+ 0xc24b8b70,
143
+ 0xc76c51a3,
144
+ 0xd192e819,
145
+ 0xd6990624,
146
+ 0xf40e3585,
147
+ 275423344,
148
+ 430227734,
149
+ 506948616,
150
+ 659060556,
151
+ 883997877,
152
+ 958139571,
153
+ 0x4ed8aa4a,
154
+ 0x5b9cca4f,
155
+ 0x682e6ff3,
156
+ 0x748f82ee,
157
+ 0x78a5636f,
158
+ 0x84c87814,
159
+ 0x8cc70208,
160
+ 0x90befffa,
161
+ 0xa4506ceb,
162
+ 0xbef9a3f7,
163
+ 0xc67178f2
164
+ ]);
165
+ const rotr = (x, n) => x >>> n | x << 32 - n;
166
+ const utf8 = new TextEncoder();
167
+ /** SHA-256 over the UTF-8 bytes of `input`, as 64 hex chars. */
168
+ function sha256Hex(input) {
169
+ const data = utf8.encode(input);
170
+ const bitLenLo = data.length << 3 >>> 0;
171
+ const bitLenHi = Math.floor(data.length / 536870912);
172
+ const padded = new Uint8Array((data.length + 8 >> 6) + 1 << 6);
173
+ padded.set(data);
174
+ padded[data.length] = 128;
175
+ const view = new DataView(padded.buffer);
176
+ view.setUint32(padded.length - 8, bitLenHi);
177
+ view.setUint32(padded.length - 4, bitLenLo);
178
+ const state = new Uint32Array([
179
+ 0x6a09e667,
180
+ 0xbb67ae85,
181
+ 0x3c6ef372,
182
+ 0xa54ff53a,
183
+ 0x510e527f,
184
+ 0x9b05688c,
185
+ 528734635,
186
+ 0x5be0cd19
187
+ ]);
188
+ const w = /* @__PURE__ */ new Uint32Array(64);
189
+ for (let offset = 0; offset < padded.length; offset += 64) {
190
+ for (let i = 0; i < 16; i++) w[i] = view.getUint32(offset + i * 4);
191
+ for (let i = 16; i < 64; i++) {
192
+ const w15 = w[i - 15];
193
+ const w2 = w[i - 2];
194
+ const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
195
+ const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
196
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
197
+ }
198
+ let [a, b, c, d, e, f, g, h] = state;
199
+ for (let i = 0; i < 64; i++) {
200
+ const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
201
+ const ch = e & f ^ ~e & g;
202
+ const t1 = h + s1 + ch + K[i] + w[i] >>> 0;
203
+ const t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
204
+ h = g;
205
+ g = f;
206
+ f = e;
207
+ e = d + t1 >>> 0;
208
+ d = c;
209
+ c = b;
210
+ b = a;
211
+ a = t1 + t2 >>> 0;
212
+ }
213
+ state[0] = state[0] + a >>> 0;
214
+ state[1] = state[1] + b >>> 0;
215
+ state[2] = state[2] + c >>> 0;
216
+ state[3] = state[3] + d >>> 0;
217
+ state[4] = state[4] + e >>> 0;
218
+ state[5] = state[5] + f >>> 0;
219
+ state[6] = state[6] + g >>> 0;
220
+ state[7] = state[7] + h >>> 0;
221
+ }
222
+ return [...state].map((word) => word.toString(16).padStart(8, "0")).join("");
223
+ }
224
+ /**
225
+ * Truncate to 128 bits (32 hex chars): collision-safe for content addressing at
226
+ * any realistic definition count, and short enough for KV keys and instance ids.
227
+ */
228
+ const contentHashOf = (input) => sha256Hex(input).slice(0, 32);
229
+ /** Content hash of execution semantics (strip metadata → canonical JSON → truncated SHA-256). */
230
+ function semanticHash(value) {
231
+ return contentHashOf(canonicalJSON(stripMeta(value)));
232
+ }
233
+ /** Canonical hash of the full content — used to tell "semantics unchanged, metadata edited" apart. */
234
+ function fullHash(value) {
235
+ return contentHashOf(canonicalJSON(value));
236
+ }
237
+ exports.canonicalJSON = canonicalJSON;
238
+ exports.fullHash = fullHash;
239
+ exports.semanticHash = semanticHash;
240
+ exports.sha256Hex = sha256Hex;
241
+ exports.stripMeta = stripMeta;
242
+ exports.stripProvenance = stripProvenance;
243
+
244
+ //# sourceMappingURL=hash.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.cjs","names":[],"sources":["../src/hash.ts"],"sourcesContent":["/**\n * Content hashing — contentHash covers execution semantics only.\n *\n * Human-facing metadata (name / description, node labels) is excluded,\n * because it cannot change which path a user takes:\n * - rewording a description must not invalidate the version an in-flight\n * journey is pinned to;\n * - nor should it surface as a change in `plan`.\n *\n * Storage, by contrast, always keeps the full IR (including the latest\n * description). contentHash carries exactly two responsibilities: deciding\n * whether semantics moved (plan / migration), and pinning a version for\n * in-flight instances. So after a description edit: the UI shows the new text,\n * plan reports no change, and in-flight users are untouched.\n */\n\n/**\n * Keys excluded from hashing.\n * - meta: metadata at any level — workflow (name / description) and\n * node/segment provenance (`loc`, the callsite source map)\n * - label: node and branch-arm names (UI titles / observability, never routing)\n * - reason: the exit / filter audit string. It is written into the audit log\n * and shown in the studio, but no user takes a different path because of it —\n * the same test as a description, so rewording one must not repin in-flight\n * journeys or report as a semantic change in plan.\n * - contentHash: the hash itself\n *\n * Note that a cohort arm's `name` IS hashed: it becomes part of the node id\n * (`{id}.{armName}.{j}`), and node ids are durable step names — renaming an arm\n * changes execution identity.\n */\nconst UNHASHED_KEYS = new Set(['meta', 'label', 'reason', 'contentHash']);\n\n/**\n * Provenance only. `loc` is a source map, not content: it moves with the\n * machine and with the directory the compile ran from, so plan compares full\n * content with it removed (see plan.ts) — otherwise CI, compiling from the\n * workspace root, reports every definition as metadata_only against a deploy\n * compiled from a package directory.\n */\nconst PROVENANCE_KEYS = new Set(['loc']);\n\n/**\n * Fields whose values are maps the *author* keys, not the IR: message props,\n * send_event payloads and action args. Everything inside them is execution\n * data and is hashed whole.\n *\n * This is what keeps the exclusion above positional: stripping by name at every\n * depth would reach inside these maps, and a prop or payload field that happens\n * to be called `label` (or `meta`) would vanish from the hash — two sends\n * carrying different values would hash identically, `plan` would report a real\n * change as metadata-only, and the deploy would write different content under\n * the same key that in-flight journeys are pinned to.\n *\n * These three are the only `z.record` fields in the IR (see ir.ts). A new one\n * has to be added here, or its contents become strippable by name again.\n *\n * It matters for every key above: a send_event payload may well carry a field\n * called `reason` (subscription_cancelled does), and dropping it would hash two\n * different sends the same.\n */\nconst AUTHOR_KEYED_FIELDS = new Set(['props', 'payload', 'args']);\n\n/** Drop `keys` at the positions the IR defines them, never inside an author-keyed map. */\nfunction stripKeys(value: unknown, keys: ReadonlySet<string>): unknown {\n if (Array.isArray(value)) return value.map((item) => stripKeys(item, keys));\n if (value !== null && typeof value === 'object') {\n const out: Record<string, unknown> = {};\n for (const [key, item] of Object.entries(value as Record<string, unknown>)) {\n if (keys.has(key)) continue;\n // Author-keyed: hashed verbatim, never walked into\n out[key] = AUTHOR_KEYED_FIELDS.has(key) ? item : stripKeys(item, keys);\n }\n return out;\n }\n return value;\n}\n\n/** Drop metadata at the positions the IR defines it, leaving execution semantics. */\nexport function stripMeta(value: unknown): unknown {\n return stripKeys(value, UNHASHED_KEYS);\n}\n\n/** Drop provenance, keeping the rest of the metadata — what plan compares. */\nexport function stripProvenance(value: unknown): unknown {\n return stripKeys(value, PROVENANCE_KEYS);\n}\n\n/** Canonical JSON: sorted keys, no whitespace — a stable hash input. */\nexport function canonicalJSON(value: unknown): string {\n // JSON.stringify(undefined) returns undefined, not a string; absent fields become null\n if (value === undefined) return 'null';\n if (Array.isArray(value)) return `[${value.map(canonicalJSON).join(',')}]`;\n if (value !== null && typeof value === 'object') {\n const entries = Object.keys(value as Record<string, unknown>)\n .sort()\n .map(\n (key) => `${JSON.stringify(key)}:${canonicalJSON((value as Record<string, unknown>)[key])}`\n );\n return `{${entries.join(',')}}`;\n }\n return JSON.stringify(value);\n}\n\n/*\n * SHA-256, hand-written and synchronous: crypto.subtle is async (and absent in\n * some embedders), node:crypto is Node-only — the compiler must stay sync and\n * portable. Like the Murmur3 bucketing hash, the known-answer tests pin this\n * implementation to the reference vectors. contentHash is a permanent contract\n * (it addresses stored versions and pins in-flight journeys), so the algorithm\n * must never change once production data exists.\n */\n\n// prettier-ignore\nconst K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\nconst rotr = (x: number, n: number): number => (x >>> n) | (x << (32 - n));\n\nconst utf8 = new TextEncoder();\n\n/** SHA-256 over the UTF-8 bytes of `input`, as 64 hex chars. */\nexport function sha256Hex(input: string): string {\n const data = utf8.encode(input);\n const bitLenLo = (data.length << 3) >>> 0;\n const bitLenHi = Math.floor(data.length / 0x20000000);\n\n // Pad to a multiple of 64 bytes: 0x80, zeros, then the 64-bit big-endian bit length\n const padded = new Uint8Array((((data.length + 8) >> 6) + 1) << 6);\n padded.set(data);\n padded[data.length] = 0x80;\n const view = new DataView(padded.buffer);\n view.setUint32(padded.length - 8, bitLenHi);\n view.setUint32(padded.length - 4, bitLenLo);\n\n // prettier-ignore\n const state = new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n ]);\n const w = new Uint32Array(64);\n\n for (let offset = 0; offset < padded.length; offset += 64) {\n for (let i = 0; i < 16; i++) w[i] = view.getUint32(offset + i * 4);\n for (let i = 16; i < 64; i++) {\n const w15 = w[i - 15];\n const w2 = w[i - 2];\n const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ (w15 >>> 3);\n const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ (w2 >>> 10);\n w[i] = (w[i - 16] + s0 + w[i - 7] + s1) >>> 0;\n }\n\n let [a, b, c, d, e, f, g, h] = state as unknown as [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n ];\n for (let i = 0; i < 64; i++) {\n const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);\n const ch = (e & f) ^ (~e & g);\n const t1 = (h + s1 + ch + K[i] + w[i]) >>> 0;\n const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);\n const maj = (a & b) ^ (a & c) ^ (b & c);\n const t2 = (s0 + maj) >>> 0;\n h = g;\n g = f;\n f = e;\n e = (d + t1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) >>> 0;\n }\n state[0] = (state[0] + a) >>> 0;\n state[1] = (state[1] + b) >>> 0;\n state[2] = (state[2] + c) >>> 0;\n state[3] = (state[3] + d) >>> 0;\n state[4] = (state[4] + e) >>> 0;\n state[5] = (state[5] + f) >>> 0;\n state[6] = (state[6] + g) >>> 0;\n state[7] = (state[7] + h) >>> 0;\n }\n\n return [...state].map((word) => word.toString(16).padStart(8, '0')).join('');\n}\n\n/**\n * Truncate to 128 bits (32 hex chars): collision-safe for content addressing at\n * any realistic definition count, and short enough for KV keys and instance ids.\n */\nconst contentHashOf = (input: string): string => sha256Hex(input).slice(0, 32);\n\n/** Content hash of execution semantics (strip metadata → canonical JSON → truncated SHA-256). */\nexport function semanticHash(value: unknown): string {\n return contentHashOf(canonicalJSON(stripMeta(value)));\n}\n\n/** Canonical hash of the full content — used to tell \"semantics unchanged, metadata edited\" apart. */\nexport function fullHash(value: unknown): string {\n return contentHashOf(canonicalJSON(value));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,gCAAgB,IAAI,IAAI;CAAC;CAAQ;CAAS;CAAU;AAAa,CAAC;;;;;;;;AASxE,MAAM,kCAAkB,IAAI,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;AAqBvC,MAAM,sCAAsB,IAAI,IAAI;CAAC;CAAS;CAAW;AAAM,CAAC;;AAGhE,SAAS,UAAU,OAAgB,MAAoC;CACrE,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO,MAAM,KAAK,SAAS,UAAU,MAAM,IAAI,CAAC;CAC1E,IAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;EAC/C,MAAM,MAA+B,CAAC;EACtC,KAAK,MAAM,CAAC,KAAK,SAAS,OAAO,QAAQ,KAAgC,GAAG;GAC1E,IAAI,KAAK,IAAI,GAAG,GAAG;GAEnB,IAAI,OAAO,oBAAoB,IAAI,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K,GAAG,CAAC,IAAI,KAAK,GAAG,EAAE,IAAI,KAAK,GAAG,EAAE,MACnC,IAAI,IAAM,IAAI,IAAM,IAAI,OACX;GAC1B,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAK,IAAI,OAAQ;GACjB,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAK,KAAK,OAAQ;EACpB;EACA,MAAM,KAAM,MAAM,KAAK,MAAO;EAC9B,MAAM,KAAM,MAAM,KAAK,MAAO;EAC9B,MAAM,KAAM,MAAM,KAAK,MAAO;EAC9B,MAAM,KAAM,MAAM,KAAK,MAAO;EAC9B,MAAM,KAAM,MAAM,KAAK,MAAO;EAC9B,MAAM,KAAM,MAAM,KAAK,MAAO;EAC9B,MAAM,KAAM,MAAM,KAAK,MAAO;EAC9B,MAAM,KAAM,MAAM,KAAK,MAAO;CAChC;CAEA,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,SAAS,KAAK,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE;AAC7E;;;;;AAMA,MAAM,iBAAiB,UAA0B,UAAU,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;;AAG7E,SAAgB,aAAa,OAAwB;CACnD,OAAO,cAAc,cAAc,UAAU,KAAK,CAAC,CAAC;AACtD;;AAGA,SAAgB,SAAS,OAAwB;CAC/C,OAAO,cAAc,cAAc,KAAK,CAAC;AAC3C"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Content hashing — contentHash covers execution semantics only.
3
+ *
4
+ * Human-facing metadata (name / description, node labels) is excluded,
5
+ * because it cannot change which path a user takes:
6
+ * - rewording a description must not invalidate the version an in-flight
7
+ * journey is pinned to;
8
+ * - nor should it surface as a change in `plan`.
9
+ *
10
+ * Storage, by contrast, always keeps the full IR (including the latest
11
+ * description). contentHash carries exactly two responsibilities: deciding
12
+ * whether semantics moved (plan / migration), and pinning a version for
13
+ * in-flight instances. So after a description edit: the UI shows the new text,
14
+ * plan reports no change, and in-flight users are untouched.
15
+ */
16
+ /** Drop metadata at the positions the IR defines it, leaving execution semantics. */
17
+ export declare function stripMeta(value: unknown): unknown;
18
+ /** Drop provenance, keeping the rest of the metadata — what plan compares. */
19
+ export declare function stripProvenance(value: unknown): unknown;
20
+ /** Canonical JSON: sorted keys, no whitespace — a stable hash input. */
21
+ export declare function canonicalJSON(value: unknown): string;
22
+ /** SHA-256 over the UTF-8 bytes of `input`, as 64 hex chars. */
23
+ export declare function sha256Hex(input: string): string;
24
+ /** Content hash of execution semantics (strip metadata → canonical JSON → truncated SHA-256). */
25
+ export declare function semanticHash(value: unknown): string;
26
+ /** Canonical hash of the full content — used to tell "semantics unchanged, metadata edited" apart. */
27
+ export declare function fullHash(value: unknown): string;
28
+ //# sourceMappingURL=hash.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.cts","names":[],"sources":["../src/hash.ts"],"mappings":";;;;;;;;;;;;;;;;wBA+EgB,UAAU;;wBAKV,gBAAgB;;wBAKhB,cAAc;;wBAyCd,UAAU;;wBA2EV,aAAa;;wBAKb,SAAS"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Content hashing — contentHash covers execution semantics only.
3
+ *
4
+ * Human-facing metadata (name / description, node labels) is excluded,
5
+ * because it cannot change which path a user takes:
6
+ * - rewording a description must not invalidate the version an in-flight
7
+ * journey is pinned to;
8
+ * - nor should it surface as a change in `plan`.
9
+ *
10
+ * Storage, by contrast, always keeps the full IR (including the latest
11
+ * description). contentHash carries exactly two responsibilities: deciding
12
+ * whether semantics moved (plan / migration), and pinning a version for
13
+ * in-flight instances. So after a description edit: the UI shows the new text,
14
+ * plan reports no change, and in-flight users are untouched.
15
+ */
16
+ /** Drop metadata at the positions the IR defines it, leaving execution semantics. */
17
+ export declare function stripMeta(value: unknown): unknown;
18
+ /** Drop provenance, keeping the rest of the metadata — what plan compares. */
19
+ export declare function stripProvenance(value: unknown): unknown;
20
+ /** Canonical JSON: sorted keys, no whitespace — a stable hash input. */
21
+ export declare function canonicalJSON(value: unknown): string;
22
+ /** SHA-256 over the UTF-8 bytes of `input`, as 64 hex chars. */
23
+ export declare function sha256Hex(input: string): string;
24
+ /** Content hash of execution semantics (strip metadata → canonical JSON → truncated SHA-256). */
25
+ export declare function semanticHash(value: unknown): string;
26
+ /** Canonical hash of the full content — used to tell "semantics unchanged, metadata edited" apart. */
27
+ export declare function fullHash(value: unknown): string;
28
+ //# sourceMappingURL=hash.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.mts","names":[],"sources":["../src/hash.ts"],"mappings":";;;;;;;;;;;;;;;;wBA+EgB,UAAU;;wBAKV,gBAAgB;;wBAKhB,cAAc;;wBAyCd,UAAU;;wBA2EV,aAAa;;wBAKb,SAAS"}
package/dist/hash.mjs ADDED
@@ -0,0 +1,238 @@
1
+ // src/hash.ts
2
+ /**
3
+ * Content hashing — contentHash covers execution semantics only.
4
+ *
5
+ * Human-facing metadata (name / description, node labels) is excluded,
6
+ * because it cannot change which path a user takes:
7
+ * - rewording a description must not invalidate the version an in-flight
8
+ * journey is pinned to;
9
+ * - nor should it surface as a change in `plan`.
10
+ *
11
+ * Storage, by contrast, always keeps the full IR (including the latest
12
+ * description). contentHash carries exactly two responsibilities: deciding
13
+ * whether semantics moved (plan / migration), and pinning a version for
14
+ * in-flight instances. So after a description edit: the UI shows the new text,
15
+ * plan reports no change, and in-flight users are untouched.
16
+ */
17
+ /**
18
+ * Keys excluded from hashing.
19
+ * - meta: metadata at any level — workflow (name / description) and
20
+ * node/segment provenance (`loc`, the callsite source map)
21
+ * - label: node and branch-arm names (UI titles / observability, never routing)
22
+ * - reason: the exit / filter audit string. It is written into the audit log
23
+ * and shown in the studio, but no user takes a different path because of it —
24
+ * the same test as a description, so rewording one must not repin in-flight
25
+ * journeys or report as a semantic change in plan.
26
+ * - contentHash: the hash itself
27
+ *
28
+ * Note that a cohort arm's `name` IS hashed: it becomes part of the node id
29
+ * (`{id}.{armName}.{j}`), and node ids are durable step names — renaming an arm
30
+ * changes execution identity.
31
+ */
32
+ const UNHASHED_KEYS = /* @__PURE__ */ new Set([
33
+ "meta",
34
+ "label",
35
+ "reason",
36
+ "contentHash"
37
+ ]);
38
+ /**
39
+ * Provenance only. `loc` is a source map, not content: it moves with the
40
+ * machine and with the directory the compile ran from, so plan compares full
41
+ * content with it removed (see plan.ts) — otherwise CI, compiling from the
42
+ * workspace root, reports every definition as metadata_only against a deploy
43
+ * compiled from a package directory.
44
+ */
45
+ const PROVENANCE_KEYS = /* @__PURE__ */ new Set(["loc"]);
46
+ /**
47
+ * Fields whose values are maps the *author* keys, not the IR: message props,
48
+ * send_event payloads and action args. Everything inside them is execution
49
+ * data and is hashed whole.
50
+ *
51
+ * This is what keeps the exclusion above positional: stripping by name at every
52
+ * depth would reach inside these maps, and a prop or payload field that happens
53
+ * to be called `label` (or `meta`) would vanish from the hash — two sends
54
+ * carrying different values would hash identically, `plan` would report a real
55
+ * change as metadata-only, and the deploy would write different content under
56
+ * the same key that in-flight journeys are pinned to.
57
+ *
58
+ * These three are the only `z.record` fields in the IR (see ir.ts). A new one
59
+ * has to be added here, or its contents become strippable by name again.
60
+ *
61
+ * It matters for every key above: a send_event payload may well carry a field
62
+ * called `reason` (subscription_cancelled does), and dropping it would hash two
63
+ * different sends the same.
64
+ */
65
+ const AUTHOR_KEYED_FIELDS = /* @__PURE__ */ new Set([
66
+ "props",
67
+ "payload",
68
+ "args"
69
+ ]);
70
+ /** Drop `keys` at the positions the IR defines them, never inside an author-keyed map. */
71
+ function stripKeys(value, keys) {
72
+ if (Array.isArray(value)) return value.map((item) => stripKeys(item, keys));
73
+ if (value !== null && typeof value === "object") {
74
+ const out = {};
75
+ for (const [key, item] of Object.entries(value)) {
76
+ if (keys.has(key)) continue;
77
+ out[key] = AUTHOR_KEYED_FIELDS.has(key) ? item : stripKeys(item, keys);
78
+ }
79
+ return out;
80
+ }
81
+ return value;
82
+ }
83
+ /** Drop metadata at the positions the IR defines it, leaving execution semantics. */
84
+ function stripMeta(value) {
85
+ return stripKeys(value, UNHASHED_KEYS);
86
+ }
87
+ /** Drop provenance, keeping the rest of the metadata — what plan compares. */
88
+ function stripProvenance(value) {
89
+ return stripKeys(value, PROVENANCE_KEYS);
90
+ }
91
+ /** Canonical JSON: sorted keys, no whitespace — a stable hash input. */
92
+ function canonicalJSON(value) {
93
+ if (value === void 0) return "null";
94
+ if (Array.isArray(value)) return `[${value.map(canonicalJSON).join(",")}]`;
95
+ if (value !== null && typeof value === "object") return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${canonicalJSON(value[key])}`).join(",")}}`;
96
+ return JSON.stringify(value);
97
+ }
98
+ const K = new Uint32Array([
99
+ 0x428a2f98,
100
+ 0x71374491,
101
+ 0xb5c0fbcf,
102
+ 0xe9b5dba5,
103
+ 961987163,
104
+ 0x59f111f1,
105
+ 0x923f82a4,
106
+ 0xab1c5ed5,
107
+ 0xd807aa98,
108
+ 310598401,
109
+ 607225278,
110
+ 0x550c7dc3,
111
+ 0x72be5d74,
112
+ 0x80deb1fe,
113
+ 0x9bdc06a7,
114
+ 0xc19bf174,
115
+ 0xe49b69c1,
116
+ 0xefbe4786,
117
+ 0xfc19dc6,
118
+ 604807628,
119
+ 770255983,
120
+ 0x4a7484aa,
121
+ 0x5cb0a9dc,
122
+ 0x76f988da,
123
+ 0x983e5152,
124
+ 0xa831c66d,
125
+ 0xb00327c8,
126
+ 0xbf597fc7,
127
+ 0xc6e00bf3,
128
+ 0xd5a79147,
129
+ 0x6ca6351,
130
+ 338241895,
131
+ 666307205,
132
+ 773529912,
133
+ 0x4d2c6dfc,
134
+ 0x53380d13,
135
+ 0x650a7354,
136
+ 0x766a0abb,
137
+ 0x81c2c92e,
138
+ 0x92722c85,
139
+ 0xa2bfe8a1,
140
+ 0xa81a664b,
141
+ 0xc24b8b70,
142
+ 0xc76c51a3,
143
+ 0xd192e819,
144
+ 0xd6990624,
145
+ 0xf40e3585,
146
+ 275423344,
147
+ 430227734,
148
+ 506948616,
149
+ 659060556,
150
+ 883997877,
151
+ 958139571,
152
+ 0x4ed8aa4a,
153
+ 0x5b9cca4f,
154
+ 0x682e6ff3,
155
+ 0x748f82ee,
156
+ 0x78a5636f,
157
+ 0x84c87814,
158
+ 0x8cc70208,
159
+ 0x90befffa,
160
+ 0xa4506ceb,
161
+ 0xbef9a3f7,
162
+ 0xc67178f2
163
+ ]);
164
+ const rotr = (x, n) => x >>> n | x << 32 - n;
165
+ const utf8 = new TextEncoder();
166
+ /** SHA-256 over the UTF-8 bytes of `input`, as 64 hex chars. */
167
+ function sha256Hex(input) {
168
+ const data = utf8.encode(input);
169
+ const bitLenLo = data.length << 3 >>> 0;
170
+ const bitLenHi = Math.floor(data.length / 536870912);
171
+ const padded = new Uint8Array((data.length + 8 >> 6) + 1 << 6);
172
+ padded.set(data);
173
+ padded[data.length] = 128;
174
+ const view = new DataView(padded.buffer);
175
+ view.setUint32(padded.length - 8, bitLenHi);
176
+ view.setUint32(padded.length - 4, bitLenLo);
177
+ const state = new Uint32Array([
178
+ 0x6a09e667,
179
+ 0xbb67ae85,
180
+ 0x3c6ef372,
181
+ 0xa54ff53a,
182
+ 0x510e527f,
183
+ 0x9b05688c,
184
+ 528734635,
185
+ 0x5be0cd19
186
+ ]);
187
+ const w = /* @__PURE__ */ new Uint32Array(64);
188
+ for (let offset = 0; offset < padded.length; offset += 64) {
189
+ for (let i = 0; i < 16; i++) w[i] = view.getUint32(offset + i * 4);
190
+ for (let i = 16; i < 64; i++) {
191
+ const w15 = w[i - 15];
192
+ const w2 = w[i - 2];
193
+ const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
194
+ const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
195
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
196
+ }
197
+ let [a, b, c, d, e, f, g, h] = state;
198
+ for (let i = 0; i < 64; i++) {
199
+ const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
200
+ const ch = e & f ^ ~e & g;
201
+ const t1 = h + s1 + ch + K[i] + w[i] >>> 0;
202
+ const t2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
203
+ h = g;
204
+ g = f;
205
+ f = e;
206
+ e = d + t1 >>> 0;
207
+ d = c;
208
+ c = b;
209
+ b = a;
210
+ a = t1 + t2 >>> 0;
211
+ }
212
+ state[0] = state[0] + a >>> 0;
213
+ state[1] = state[1] + b >>> 0;
214
+ state[2] = state[2] + c >>> 0;
215
+ state[3] = state[3] + d >>> 0;
216
+ state[4] = state[4] + e >>> 0;
217
+ state[5] = state[5] + f >>> 0;
218
+ state[6] = state[6] + g >>> 0;
219
+ state[7] = state[7] + h >>> 0;
220
+ }
221
+ return [...state].map((word) => word.toString(16).padStart(8, "0")).join("");
222
+ }
223
+ /**
224
+ * Truncate to 128 bits (32 hex chars): collision-safe for content addressing at
225
+ * any realistic definition count, and short enough for KV keys and instance ids.
226
+ */
227
+ const contentHashOf = (input) => sha256Hex(input).slice(0, 32);
228
+ /** Content hash of execution semantics (strip metadata → canonical JSON → truncated SHA-256). */
229
+ function semanticHash(value) {
230
+ return contentHashOf(canonicalJSON(stripMeta(value)));
231
+ }
232
+ /** Canonical hash of the full content — used to tell "semantics unchanged, metadata edited" apart. */
233
+ function fullHash(value) {
234
+ return contentHashOf(canonicalJSON(value));
235
+ }
236
+ export { canonicalJSON, fullHash, semanticHash, sha256Hex, stripMeta, stripProvenance };
237
+
238
+ //# sourceMappingURL=hash.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.mjs","names":[],"sources":["../src/hash.ts"],"sourcesContent":["/**\n * Content hashing — contentHash covers execution semantics only.\n *\n * Human-facing metadata (name / description, node labels) is excluded,\n * because it cannot change which path a user takes:\n * - rewording a description must not invalidate the version an in-flight\n * journey is pinned to;\n * - nor should it surface as a change in `plan`.\n *\n * Storage, by contrast, always keeps the full IR (including the latest\n * description). contentHash carries exactly two responsibilities: deciding\n * whether semantics moved (plan / migration), and pinning a version for\n * in-flight instances. So after a description edit: the UI shows the new text,\n * plan reports no change, and in-flight users are untouched.\n */\n\n/**\n * Keys excluded from hashing.\n * - meta: metadata at any level — workflow (name / description) and\n * node/segment provenance (`loc`, the callsite source map)\n * - label: node and branch-arm names (UI titles / observability, never routing)\n * - reason: the exit / filter audit string. It is written into the audit log\n * and shown in the studio, but no user takes a different path because of it —\n * the same test as a description, so rewording one must not repin in-flight\n * journeys or report as a semantic change in plan.\n * - contentHash: the hash itself\n *\n * Note that a cohort arm's `name` IS hashed: it becomes part of the node id\n * (`{id}.{armName}.{j}`), and node ids are durable step names — renaming an arm\n * changes execution identity.\n */\nconst UNHASHED_KEYS = new Set(['meta', 'label', 'reason', 'contentHash']);\n\n/**\n * Provenance only. `loc` is a source map, not content: it moves with the\n * machine and with the directory the compile ran from, so plan compares full\n * content with it removed (see plan.ts) — otherwise CI, compiling from the\n * workspace root, reports every definition as metadata_only against a deploy\n * compiled from a package directory.\n */\nconst PROVENANCE_KEYS = new Set(['loc']);\n\n/**\n * Fields whose values are maps the *author* keys, not the IR: message props,\n * send_event payloads and action args. Everything inside them is execution\n * data and is hashed whole.\n *\n * This is what keeps the exclusion above positional: stripping by name at every\n * depth would reach inside these maps, and a prop or payload field that happens\n * to be called `label` (or `meta`) would vanish from the hash — two sends\n * carrying different values would hash identically, `plan` would report a real\n * change as metadata-only, and the deploy would write different content under\n * the same key that in-flight journeys are pinned to.\n *\n * These three are the only `z.record` fields in the IR (see ir.ts). A new one\n * has to be added here, or its contents become strippable by name again.\n *\n * It matters for every key above: a send_event payload may well carry a field\n * called `reason` (subscription_cancelled does), and dropping it would hash two\n * different sends the same.\n */\nconst AUTHOR_KEYED_FIELDS = new Set(['props', 'payload', 'args']);\n\n/** Drop `keys` at the positions the IR defines them, never inside an author-keyed map. */\nfunction stripKeys(value: unknown, keys: ReadonlySet<string>): unknown {\n if (Array.isArray(value)) return value.map((item) => stripKeys(item, keys));\n if (value !== null && typeof value === 'object') {\n const out: Record<string, unknown> = {};\n for (const [key, item] of Object.entries(value as Record<string, unknown>)) {\n if (keys.has(key)) continue;\n // Author-keyed: hashed verbatim, never walked into\n out[key] = AUTHOR_KEYED_FIELDS.has(key) ? item : stripKeys(item, keys);\n }\n return out;\n }\n return value;\n}\n\n/** Drop metadata at the positions the IR defines it, leaving execution semantics. */\nexport function stripMeta(value: unknown): unknown {\n return stripKeys(value, UNHASHED_KEYS);\n}\n\n/** Drop provenance, keeping the rest of the metadata — what plan compares. */\nexport function stripProvenance(value: unknown): unknown {\n return stripKeys(value, PROVENANCE_KEYS);\n}\n\n/** Canonical JSON: sorted keys, no whitespace — a stable hash input. */\nexport function canonicalJSON(value: unknown): string {\n // JSON.stringify(undefined) returns undefined, not a string; absent fields become null\n if (value === undefined) return 'null';\n if (Array.isArray(value)) return `[${value.map(canonicalJSON).join(',')}]`;\n if (value !== null && typeof value === 'object') {\n const entries = Object.keys(value as Record<string, unknown>)\n .sort()\n .map(\n (key) => `${JSON.stringify(key)}:${canonicalJSON((value as Record<string, unknown>)[key])}`\n );\n return `{${entries.join(',')}}`;\n }\n return JSON.stringify(value);\n}\n\n/*\n * SHA-256, hand-written and synchronous: crypto.subtle is async (and absent in\n * some embedders), node:crypto is Node-only — the compiler must stay sync and\n * portable. Like the Murmur3 bucketing hash, the known-answer tests pin this\n * implementation to the reference vectors. contentHash is a permanent contract\n * (it addresses stored versions and pins in-flight journeys), so the algorithm\n * must never change once production data exists.\n */\n\n// prettier-ignore\nconst K = new Uint32Array([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,\n]);\n\nconst rotr = (x: number, n: number): number => (x >>> n) | (x << (32 - n));\n\nconst utf8 = new TextEncoder();\n\n/** SHA-256 over the UTF-8 bytes of `input`, as 64 hex chars. */\nexport function sha256Hex(input: string): string {\n const data = utf8.encode(input);\n const bitLenLo = (data.length << 3) >>> 0;\n const bitLenHi = Math.floor(data.length / 0x20000000);\n\n // Pad to a multiple of 64 bytes: 0x80, zeros, then the 64-bit big-endian bit length\n const padded = new Uint8Array((((data.length + 8) >> 6) + 1) << 6);\n padded.set(data);\n padded[data.length] = 0x80;\n const view = new DataView(padded.buffer);\n view.setUint32(padded.length - 8, bitLenHi);\n view.setUint32(padded.length - 4, bitLenLo);\n\n // prettier-ignore\n const state = new Uint32Array([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n ]);\n const w = new Uint32Array(64);\n\n for (let offset = 0; offset < padded.length; offset += 64) {\n for (let i = 0; i < 16; i++) w[i] = view.getUint32(offset + i * 4);\n for (let i = 16; i < 64; i++) {\n const w15 = w[i - 15];\n const w2 = w[i - 2];\n const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ (w15 >>> 3);\n const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ (w2 >>> 10);\n w[i] = (w[i - 16] + s0 + w[i - 7] + s1) >>> 0;\n }\n\n let [a, b, c, d, e, f, g, h] = state as unknown as [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n ];\n for (let i = 0; i < 64; i++) {\n const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);\n const ch = (e & f) ^ (~e & g);\n const t1 = (h + s1 + ch + K[i] + w[i]) >>> 0;\n const s0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);\n const maj = (a & b) ^ (a & c) ^ (b & c);\n const t2 = (s0 + maj) >>> 0;\n h = g;\n g = f;\n f = e;\n e = (d + t1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (t1 + t2) >>> 0;\n }\n state[0] = (state[0] + a) >>> 0;\n state[1] = (state[1] + b) >>> 0;\n state[2] = (state[2] + c) >>> 0;\n state[3] = (state[3] + d) >>> 0;\n state[4] = (state[4] + e) >>> 0;\n state[5] = (state[5] + f) >>> 0;\n state[6] = (state[6] + g) >>> 0;\n state[7] = (state[7] + h) >>> 0;\n }\n\n return [...state].map((word) => word.toString(16).padStart(8, '0')).join('');\n}\n\n/**\n * Truncate to 128 bits (32 hex chars): collision-safe for content addressing at\n * any realistic definition count, and short enough for KV keys and instance ids.\n */\nconst contentHashOf = (input: string): string => sha256Hex(input).slice(0, 32);\n\n/** Content hash of execution semantics (strip metadata → canonical JSON → truncated SHA-256). */\nexport function semanticHash(value: unknown): string {\n return contentHashOf(canonicalJSON(stripMeta(value)));\n}\n\n/** Canonical hash of the full content — used to tell \"semantics unchanged, metadata edited\" apart. */\nexport function fullHash(value: unknown): string {\n return contentHashOf(canonicalJSON(value));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,gCAAgB,IAAI,IAAI;CAAC;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