@demlik/tea 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/README.md +11 -9
  2. package/dist/agent/index.d.ts +638 -45
  3. package/dist/agent/index.js +9 -19
  4. package/dist/{chunk-25LBDCBC.js → chunk-6IQPODUF.js} +2 -2
  5. package/dist/{chunk-25LBDCBC.js.map → chunk-6IQPODUF.js.map} +1 -1
  6. package/dist/chunk-AQ6ZIMEA.js +421 -0
  7. package/dist/chunk-AQ6ZIMEA.js.map +1 -0
  8. package/dist/{chunk-MUUROGIH.js → chunk-BLJ2JQSH.js} +62 -12
  9. package/dist/chunk-BLJ2JQSH.js.map +1 -0
  10. package/dist/{chunk-7SVIRMC6.js → chunk-F2US5BW6.js} +25 -5
  11. package/dist/chunk-F2US5BW6.js.map +1 -0
  12. package/dist/{batch-window/index.js → chunk-F7FMAWLA.js} +4 -8
  13. package/dist/chunk-F7FMAWLA.js.map +1 -0
  14. package/dist/{chunk-7V4EVLZA.js → chunk-HUKZQX6U.js} +20 -16
  15. package/dist/chunk-HUKZQX6U.js.map +1 -0
  16. package/dist/{chunk-EWJP3YYP.js → chunk-HWVW4AXC.js} +3 -3
  17. package/dist/chunk-HWVW4AXC.js.map +1 -0
  18. package/dist/{chunk-WLGO64WC.js → chunk-HYDWG35Q.js} +23 -6
  19. package/dist/chunk-HYDWG35Q.js.map +1 -0
  20. package/dist/{chunk-I5OV65MS.js → chunk-I5MQMJDW.js} +57 -7
  21. package/dist/chunk-I5MQMJDW.js.map +1 -0
  22. package/dist/{chunk-J6527VRQ.js → chunk-LFZUK6J2.js} +3 -3
  23. package/dist/chunk-LFZUK6J2.js.map +1 -0
  24. package/dist/{chunk-ZVJZ72HY.js → chunk-LYLTKJWM.js} +25 -11
  25. package/dist/chunk-LYLTKJWM.js.map +1 -0
  26. package/dist/{chunk-D736QUGF.js → chunk-MYXFNWAJ.js} +4 -5
  27. package/dist/chunk-MYXFNWAJ.js.map +1 -0
  28. package/dist/{chunk-K575PT4S.js → chunk-PR6TB3BL.js} +15 -4
  29. package/dist/chunk-PR6TB3BL.js.map +1 -0
  30. package/dist/chunk-RQULHGYH.js +1804 -0
  31. package/dist/chunk-RQULHGYH.js.map +1 -0
  32. package/dist/{chunk-FV3Z5MBE.js → chunk-TXN2KFHF.js} +14 -4
  33. package/dist/chunk-TXN2KFHF.js.map +1 -0
  34. package/dist/{chunk-Q2UM7BXU.js → chunk-VBDU4JL6.js} +2 -2
  35. package/dist/chunk-VBDU4JL6.js.map +1 -0
  36. package/dist/chunk-Z2L3LSNV.js +1470 -0
  37. package/dist/chunk-Z2L3LSNV.js.map +1 -0
  38. package/dist/core-CTzMJ82M.d.ts +562 -0
  39. package/dist/devtools/index.d.ts +2 -2
  40. package/dist/devtools/index.js +207 -2
  41. package/dist/devtools/index.js.map +1 -1
  42. package/dist/do/index.d.ts +48 -31
  43. package/dist/do/index.js +36 -25
  44. package/dist/do/index.js.map +1 -1
  45. package/dist/{durable-effects-D8SqU_if.d.ts → durable-effects-B0-qGQDy.d.ts} +2 -2
  46. package/dist/extension/index.d.ts +301 -3
  47. package/dist/extension/index.js +596 -5
  48. package/dist/extension/index.js.map +1 -1
  49. package/dist/flow/index.d.ts +1295 -0
  50. package/dist/flow/index.js +732 -0
  51. package/dist/flow/index.js.map +1 -0
  52. package/dist/idempotency/index.d.ts +90 -116
  53. package/dist/idempotency/index.js +4 -1
  54. package/dist/{batch-window/index.d.ts → index-4vZzljCD.d.ts} +7 -11
  55. package/dist/{fan-out/index.d.ts → index-6A7dB8f6.d.ts} +7 -8
  56. package/dist/index-B5BZ-_cT.d.ts +616 -0
  57. package/dist/index-Bc40JWVl.d.ts +131 -0
  58. package/dist/{debounce/index.d.ts → index-DHSUmQTR.d.ts} +7 -7
  59. package/dist/index-DJWIER_3.d.ts +69 -0
  60. package/dist/{snapshot/index.d.ts → index-DMCeMPMJ.d.ts} +15 -77
  61. package/dist/{monitored-run/index.d.ts → index-NjrT3fL2.d.ts} +37 -12
  62. package/dist/{recorder/index.d.ts → index-TvRb1KVf.d.ts} +4 -6
  63. package/dist/{deadline/index.d.ts → index-q0hXFeZ0.d.ts} +155 -8
  64. package/dist/index.d.ts +719 -6
  65. package/dist/index.js +1 -2
  66. package/dist/jev/index.d.ts +634 -0
  67. package/dist/jev/index.js +433 -0
  68. package/dist/jev/index.js.map +1 -0
  69. package/dist/machine-CdIcN2Xm.d.ts +1773 -0
  70. package/dist/machine-viz/index.d.ts +2 -1
  71. package/dist/machine-viz/index.js +12 -5
  72. package/dist/machine-viz/index.js.map +1 -1
  73. package/dist/mem/index.d.ts +19 -3
  74. package/dist/mem/index.js +22 -2
  75. package/dist/mem/index.js.map +1 -1
  76. package/dist/node/index.d.ts +130 -4
  77. package/dist/node/index.js +222 -10
  78. package/dist/node/index.js.map +1 -1
  79. package/dist/{paginator → paginate}/index.d.ts +151 -6
  80. package/dist/paginate/index.js +7 -0
  81. package/dist/parity/index.d.ts +5 -10
  82. package/dist/parity/index.js +4 -7
  83. package/dist/parity/index.js.map +1 -1
  84. package/dist/pbt/index.d.ts +248 -5
  85. package/dist/pbt/index.js +124 -5
  86. package/dist/pbt/index.js.map +1 -1
  87. package/dist/{trace-replay → persistence}/index.d.ts +7 -4
  88. package/dist/persistence/index.js +6 -0
  89. package/dist/react/index.d.ts +4 -3
  90. package/dist/react/index.js +1 -2
  91. package/dist/react/index.js.map +1 -1
  92. package/dist/resilience/index.d.ts +743 -0
  93. package/dist/resilience/index.js +657 -0
  94. package/dist/resilience/index.js.map +1 -0
  95. package/dist/retry-backoff/index.d.ts +3 -2
  96. package/dist/retry-backoff/index.js +1 -1
  97. package/dist/runtime-types-LWDoi943.d.ts +998 -0
  98. package/dist/testing/index.d.ts +3 -2
  99. package/dist/testing/index.js +1 -2
  100. package/dist/testing/index.js.map +1 -1
  101. package/dist/{throttled-input → timing}/index.d.ts +144 -12
  102. package/dist/{throttled-input → timing}/index.js +57 -12
  103. package/dist/timing/index.js.map +1 -0
  104. package/dist/{types-D7u9DkH7.d.ts → types-DP3f5NIl.d.ts} +1 -1
  105. package/dist/work-queue/index.d.ts +131 -54
  106. package/dist/work-queue/index.js +3 -2
  107. package/dist/work-queue/index.js.map +1 -1
  108. package/package.json +50 -216
  109. package/dist/authed-call/index.d.ts +0 -119
  110. package/dist/authed-call/index.js +0 -134
  111. package/dist/authed-call/index.js.map +0 -1
  112. package/dist/await-terminal/index.d.ts +0 -100
  113. package/dist/await-terminal/index.js +0 -76
  114. package/dist/await-terminal/index.js.map +0 -1
  115. package/dist/batch-window/index.js.map +0 -1
  116. package/dist/cache/index.d.ts +0 -151
  117. package/dist/cache/index.js +0 -8
  118. package/dist/chart/index.d.ts +0 -217
  119. package/dist/chart/index.js +0 -16
  120. package/dist/chart/index.js.map +0 -1
  121. package/dist/chart/inspect/index.d.ts +0 -85
  122. package/dist/chart/inspect/index.js +0 -5
  123. package/dist/chart/inspect/react.d.ts +0 -112
  124. package/dist/chart/inspect/react.js +0 -11
  125. package/dist/chart/inspect/react.js.map +0 -1
  126. package/dist/chart/inspect/styles.css +0 -286
  127. package/dist/chart/lane/index.d.ts +0 -361
  128. package/dist/chart/lane/index.js +0 -9
  129. package/dist/chart/lane/index.js.map +0 -1
  130. package/dist/chart/lane/react.d.ts +0 -83
  131. package/dist/chart/lane/react.js +0 -559
  132. package/dist/chart/lane/react.js.map +0 -1
  133. package/dist/chart/lane/server.d.ts +0 -148
  134. package/dist/chart/lane/server.js +0 -209
  135. package/dist/chart/lane/server.js.map +0 -1
  136. package/dist/chart/lane/styles.css +0 -498
  137. package/dist/chart/lane/viewer/assets/abnfDiagram-N423BO3Z-C729LI31.js +0 -1
  138. package/dist/chart/lane/viewer/assets/architectureDiagram-T3A2C74G-C729LI31.js +0 -1
  139. package/dist/chart/lane/viewer/assets/blockDiagram-VBNYF7ZC-C729LI31.js +0 -1
  140. package/dist/chart/lane/viewer/assets/c4Diagram-5PPSVZJV-C729LI31.js +0 -1
  141. package/dist/chart/lane/viewer/assets/chunk-2GRJ4B5K-HdDf8SI3.js +0 -1
  142. package/dist/chart/lane/viewer/assets/chunk-5RXB4S5H-CcNtpUd7.js +0 -231
  143. package/dist/chart/lane/viewer/assets/chunk-5VM5RSS4-BP4fRS_5.js +0 -15
  144. package/dist/chart/lane/viewer/assets/chunk-KBJHAD2P-DZOw7xU6.js +0 -1
  145. package/dist/chart/lane/viewer/assets/chunk-NSK5VX7P-CBCyTZMs.js +0 -128
  146. package/dist/chart/lane/viewer/assets/classDiagram-JCYQIIEL-C729LI31.js +0 -1
  147. package/dist/chart/lane/viewer/assets/classDiagram-v2-OCEON4UE-D4uAiFr8.js +0 -206
  148. package/dist/chart/lane/viewer/assets/cose-bilkent-JH36ORCC-DOwCrGXH.js +0 -1
  149. package/dist/chart/lane/viewer/assets/cynefinDiagram-MW4NZA55-C729LI31.js +0 -1
  150. package/dist/chart/lane/viewer/assets/dagre-K_PewWfS.js +0 -1
  151. package/dist/chart/lane/viewer/assets/dagre-VZM6K2ZE-831qZcA8.js +0 -4
  152. package/dist/chart/lane/viewer/assets/diagram-7IWD3JNH-C729LI31.js +0 -1
  153. package/dist/chart/lane/viewer/assets/diagram-B4RE2ZJO-C729LI31.js +0 -1
  154. package/dist/chart/lane/viewer/assets/diagram-LBJQPF4R-C729LI31.js +0 -1
  155. package/dist/chart/lane/viewer/assets/diagram-Q27KOJAE-C729LI31.js +0 -1
  156. package/dist/chart/lane/viewer/assets/diagram-UB23O5K3-C729LI31.js +0 -1
  157. package/dist/chart/lane/viewer/assets/ebnfDiagram-BXEA7PRR-C729LI31.js +0 -1
  158. package/dist/chart/lane/viewer/assets/erDiagram-JOGREHBK-C729LI31.js +0 -1
  159. package/dist/chart/lane/viewer/assets/flowDiagram-UKHOOZJN-C729LI31.js +0 -1
  160. package/dist/chart/lane/viewer/assets/ganttDiagram-PKOTCBZU-C729LI31.js +0 -1
  161. package/dist/chart/lane/viewer/assets/gitGraphDiagram-DS77QQ5N-C729LI31.js +0 -1
  162. package/dist/chart/lane/viewer/assets/index-9SkH5NA3.css +0 -1
  163. package/dist/chart/lane/viewer/assets/index-Bgt4sXpW.js +0 -195
  164. package/dist/chart/lane/viewer/assets/infoDiagram-6WML65LV-C729LI31.js +0 -1
  165. package/dist/chart/lane/viewer/assets/ishikawaDiagram-WSZJBQD7-C729LI31.js +0 -1
  166. package/dist/chart/lane/viewer/assets/journeyDiagram-NVQOT4AX-C729LI31.js +0 -1
  167. package/dist/chart/lane/viewer/assets/kanban-definition-27J2QSJJ-G7PaPzy-.js +0 -89
  168. package/dist/chart/lane/viewer/assets/katex-DOwCrGXH.js +0 -1
  169. package/dist/chart/lane/viewer/assets/mindmap-definition-FAOFIHXS-CGj9nrVk.js +0 -96
  170. package/dist/chart/lane/viewer/assets/path-fybaL0A-.js +0 -1
  171. package/dist/chart/lane/viewer/assets/pegDiagram-VL7TDLO6-C729LI31.js +0 -1
  172. package/dist/chart/lane/viewer/assets/pieDiagram-7S7Q4E2Y-C729LI31.js +0 -1
  173. package/dist/chart/lane/viewer/assets/quadrantDiagram-CIZ2JOQS-C729LI31.js +0 -1
  174. package/dist/chart/lane/viewer/assets/railroadDiagram-AXF67PYL-C729LI31.js +0 -1
  175. package/dist/chart/lane/viewer/assets/requirementDiagram-LRYGKXZP-C729LI31.js +0 -1
  176. package/dist/chart/lane/viewer/assets/sankeyDiagram-W5VNT64P-C729LI31.js +0 -1
  177. package/dist/chart/lane/viewer/assets/sequenceDiagram-SI44F4Z6-C729LI31.js +0 -1
  178. package/dist/chart/lane/viewer/assets/stateDiagram-OKZ733FA-B_88AzBS.js +0 -1
  179. package/dist/chart/lane/viewer/assets/stateDiagram-v2-UEYNNEHI-CR5gcgq6.js +0 -1
  180. package/dist/chart/lane/viewer/assets/swimlanes-SLNWSIFB-B4xK-rwg.js +0 -1
  181. package/dist/chart/lane/viewer/assets/swimlanesDiagram-ULZ7WXOC-C729LI31.js +0 -1
  182. package/dist/chart/lane/viewer/assets/timeline-definition-Z64GVDOM-CCv52MfY.js +0 -120
  183. package/dist/chart/lane/viewer/assets/vennDiagram-T6HMQDX7-C729LI31.js +0 -1
  184. package/dist/chart/lane/viewer/assets/wardleyDiagram-T6FBY63Y-C729LI31.js +0 -1
  185. package/dist/chart/lane/viewer/assets/xychartDiagram-ELKLHX3M-C729LI31.js +0 -1
  186. package/dist/chart/lane/viewer/index.html +0 -15
  187. package/dist/chart/report/index.d.ts +0 -116
  188. package/dist/chart/report/index.js +0 -32
  189. package/dist/chart/report/index.js.map +0 -1
  190. package/dist/chunk-2YFLOCWX.js +0 -15
  191. package/dist/chunk-2YFLOCWX.js.map +0 -1
  192. package/dist/chunk-3JU6657S.js +0 -372
  193. package/dist/chunk-3JU6657S.js.map +0 -1
  194. package/dist/chunk-4KTWLPL5.js +0 -33
  195. package/dist/chunk-4KTWLPL5.js.map +0 -1
  196. package/dist/chunk-5EHLEUTL.js +0 -686
  197. package/dist/chunk-5EHLEUTL.js.map +0 -1
  198. package/dist/chunk-5KJKJOFC.js +0 -758
  199. package/dist/chunk-5KJKJOFC.js.map +0 -1
  200. package/dist/chunk-7SVIRMC6.js.map +0 -1
  201. package/dist/chunk-7V4EVLZA.js.map +0 -1
  202. package/dist/chunk-A56OR5RF.js +0 -184
  203. package/dist/chunk-A56OR5RF.js.map +0 -1
  204. package/dist/chunk-AZZLE7XR.js +0 -62
  205. package/dist/chunk-AZZLE7XR.js.map +0 -1
  206. package/dist/chunk-B5VXOFMZ.js +0 -266
  207. package/dist/chunk-B5VXOFMZ.js.map +0 -1
  208. package/dist/chunk-BYQUGDD3.js +0 -16
  209. package/dist/chunk-BYQUGDD3.js.map +0 -1
  210. package/dist/chunk-D736QUGF.js.map +0 -1
  211. package/dist/chunk-E6GEDSF4.js +0 -307
  212. package/dist/chunk-E6GEDSF4.js.map +0 -1
  213. package/dist/chunk-EUF7XOEE.js +0 -223
  214. package/dist/chunk-EUF7XOEE.js.map +0 -1
  215. package/dist/chunk-EWJP3YYP.js.map +0 -1
  216. package/dist/chunk-FV3Z5MBE.js.map +0 -1
  217. package/dist/chunk-HCEVHFJ7.js +0 -54
  218. package/dist/chunk-HCEVHFJ7.js.map +0 -1
  219. package/dist/chunk-I5OV65MS.js.map +0 -1
  220. package/dist/chunk-J6527VRQ.js.map +0 -1
  221. package/dist/chunk-JELSZN25.js +0 -47
  222. package/dist/chunk-JELSZN25.js.map +0 -1
  223. package/dist/chunk-JER5O7PQ.js +0 -416
  224. package/dist/chunk-JER5O7PQ.js.map +0 -1
  225. package/dist/chunk-JGVL3WPL.js +0 -26
  226. package/dist/chunk-JGVL3WPL.js.map +0 -1
  227. package/dist/chunk-JP5D6GSL.js +0 -71
  228. package/dist/chunk-JP5D6GSL.js.map +0 -1
  229. package/dist/chunk-K575PT4S.js.map +0 -1
  230. package/dist/chunk-MU6MCIAC.js +0 -15
  231. package/dist/chunk-MU6MCIAC.js.map +0 -1
  232. package/dist/chunk-MUUROGIH.js.map +0 -1
  233. package/dist/chunk-ND3DH6KM.js +0 -88
  234. package/dist/chunk-ND3DH6KM.js.map +0 -1
  235. package/dist/chunk-Q2UM7BXU.js.map +0 -1
  236. package/dist/chunk-S2EGRPCM.js +0 -47
  237. package/dist/chunk-S2EGRPCM.js.map +0 -1
  238. package/dist/chunk-SINXE47Y.js +0 -55
  239. package/dist/chunk-SINXE47Y.js.map +0 -1
  240. package/dist/chunk-SUST46KO.js +0 -53
  241. package/dist/chunk-SUST46KO.js.map +0 -1
  242. package/dist/chunk-TP5UPGLY.js +0 -61
  243. package/dist/chunk-TP5UPGLY.js.map +0 -1
  244. package/dist/chunk-UF4MZSLT.js +0 -53
  245. package/dist/chunk-UF4MZSLT.js.map +0 -1
  246. package/dist/chunk-UOC2PL46.js +0 -13
  247. package/dist/chunk-UOC2PL46.js.map +0 -1
  248. package/dist/chunk-WLGO64WC.js.map +0 -1
  249. package/dist/chunk-WRAA7GVZ.js +0 -209
  250. package/dist/chunk-WRAA7GVZ.js.map +0 -1
  251. package/dist/chunk-ZCL7SCBK.js +0 -685
  252. package/dist/chunk-ZCL7SCBK.js.map +0 -1
  253. package/dist/chunk-ZD6PNZBK.js +0 -457
  254. package/dist/chunk-ZD6PNZBK.js.map +0 -1
  255. package/dist/chunk-ZF6WDK2D.js +0 -519
  256. package/dist/chunk-ZF6WDK2D.js.map +0 -1
  257. package/dist/chunk-ZJ5AOYBH.js +0 -8
  258. package/dist/chunk-ZJ5AOYBH.js.map +0 -1
  259. package/dist/chunk-ZVJZ72HY.js.map +0 -1
  260. package/dist/circuit-breaker/index.d.ts +0 -197
  261. package/dist/circuit-breaker/index.js +0 -3
  262. package/dist/circuit-breaker/index.js.map +0 -1
  263. package/dist/core-Bjc0bS8j.d.ts +0 -326
  264. package/dist/deadline/index.js +0 -6
  265. package/dist/deadline/index.js.map +0 -1
  266. package/dist/debounce/index.js +0 -3
  267. package/dist/debounce/index.js.map +0 -1
  268. package/dist/extension/react.d.ts +0 -121
  269. package/dist/extension/react.js +0 -75
  270. package/dist/extension/react.js.map +0 -1
  271. package/dist/extension/subs/index.d.ts +0 -44
  272. package/dist/extension/subs/index.js +0 -80
  273. package/dist/extension/subs/index.js.map +0 -1
  274. package/dist/extension/test-utils.d.ts +0 -128
  275. package/dist/extension/test-utils.js +0 -277
  276. package/dist/extension/test-utils.js.map +0 -1
  277. package/dist/fan-out/index.js +0 -5
  278. package/dist/fan-out/index.js.map +0 -1
  279. package/dist/fold-Blbhru48.d.ts +0 -435
  280. package/dist/graph-CcjWZVrd.d.ts +0 -923
  281. package/dist/idempotency/adapter.d.ts +0 -62
  282. package/dist/idempotency/adapter.js +0 -4
  283. package/dist/idempotency/adapter.js.map +0 -1
  284. package/dist/idempotent-intake/index.d.ts +0 -187
  285. package/dist/idempotent-intake/index.js +0 -7
  286. package/dist/idempotent-intake/index.js.map +0 -1
  287. package/dist/llm-call/index.d.ts +0 -310
  288. package/dist/llm-call/index.js +0 -16
  289. package/dist/llm-call/index.js.map +0 -1
  290. package/dist/machine-0OmPvsy_.d.ts +0 -804
  291. package/dist/monitored-run/index.js +0 -10
  292. package/dist/monitored-run/index.js.map +0 -1
  293. package/dist/paginated-walk/index.d.ts +0 -234
  294. package/dist/paginated-walk/index.js +0 -16
  295. package/dist/paginated-walk/index.js.map +0 -1
  296. package/dist/paginator/index.js +0 -3
  297. package/dist/paginator/index.js.map +0 -1
  298. package/dist/pbt/arbitraries/index.d.ts +0 -135
  299. package/dist/pbt/arbitraries/index.js +0 -3
  300. package/dist/pbt/arbitraries/index.js.map +0 -1
  301. package/dist/pbt/runners/index.d.ts +0 -117
  302. package/dist/pbt/runners/index.js +0 -5
  303. package/dist/pbt/runners/index.js.map +0 -1
  304. package/dist/poller/index.d.ts +0 -351
  305. package/dist/poller/index.js +0 -115
  306. package/dist/poller/index.js.map +0 -1
  307. package/dist/prediction/index.d.ts +0 -130
  308. package/dist/prediction/index.js +0 -4
  309. package/dist/prediction/index.js.map +0 -1
  310. package/dist/protocol-B5YmJr0d.d.ts +0 -45
  311. package/dist/pure/index.d.ts +0 -2
  312. package/dist/pure/index.js +0 -4
  313. package/dist/pure/index.js.map +0 -1
  314. package/dist/rate-limit/index.d.ts +0 -115
  315. package/dist/rate-limit/index.js +0 -3
  316. package/dist/rate-limit/index.js.map +0 -1
  317. package/dist/reconciler/index.d.ts +0 -192
  318. package/dist/reconciler/index.js +0 -164
  319. package/dist/reconciler/index.js.map +0 -1
  320. package/dist/recorder/index.js +0 -3
  321. package/dist/recorder/index.js.map +0 -1
  322. package/dist/reducer-BqyoVyBG.d.ts +0 -447
  323. package/dist/resilient-call/index.d.ts +0 -319
  324. package/dist/resilient-call/index.js +0 -14
  325. package/dist/resilient-call/index.js.map +0 -1
  326. package/dist/retry-to-success/index.d.ts +0 -109
  327. package/dist/retry-to-success/index.js +0 -37
  328. package/dist/retry-to-success/index.js.map +0 -1
  329. package/dist/run-BVeqJDBF.d.ts +0 -713
  330. package/dist/runtime-types-Bxc637bp.d.ts +0 -502
  331. package/dist/saga/index.d.ts +0 -240
  332. package/dist/saga/index.js +0 -150
  333. package/dist/saga/index.js.map +0 -1
  334. package/dist/samples-DCt6nF8H.d.ts +0 -59
  335. package/dist/snapshot/index.js +0 -5
  336. package/dist/snapshot/index.js.map +0 -1
  337. package/dist/subs/index.d.ts +0 -471
  338. package/dist/subs/index.js +0 -7
  339. package/dist/subs/index.js.map +0 -1
  340. package/dist/throttle/index.d.ts +0 -134
  341. package/dist/throttle/index.js +0 -3
  342. package/dist/throttle/index.js.map +0 -1
  343. package/dist/throttled-input/index.js.map +0 -1
  344. package/dist/token-refresh/index.d.ts +0 -215
  345. package/dist/token-refresh/index.js +0 -6
  346. package/dist/token-refresh/index.js.map +0 -1
  347. package/dist/trace-replay/index.js +0 -6
  348. package/dist/trace-replay/index.js.map +0 -1
  349. package/dist/with-deadline/index.d.ts +0 -196
  350. package/dist/with-deadline/index.js +0 -111
  351. package/dist/with-deadline/index.js.map +0 -1
  352. package/dist/with-resilience/index.d.ts +0 -224
  353. package/dist/with-resilience/index.js +0 -240
  354. package/dist/with-resilience/index.js.map +0 -1
  355. package/dist/with-telemetry/index.d.ts +0 -149
  356. package/dist/with-telemetry/index.js +0 -70
  357. package/dist/with-telemetry/index.js.map +0 -1
  358. package/dist/work-queue/adapter.d.ts +0 -83
  359. package/dist/work-queue/adapter.js +0 -4
  360. package/dist/work-queue/adapter.js.map +0 -1
  361. package/dist/work-queue/ops.d.ts +0 -70
  362. package/dist/work-queue/ops.js +0 -3
  363. package/dist/work-queue/ops.js.map +0 -1
  364. package/dist/workflow/index.d.ts +0 -484
  365. package/dist/workflow/index.js +0 -244
  366. package/dist/workflow/index.js.map +0 -1
  367. /package/dist/{cache → paginate}/index.js.map +0 -0
  368. /package/dist/{chart/inspect → persistence}/index.js.map +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@demlik/tea",
3
- "version": "0.12.0",
4
- "description": "TEA-faithful state machine substrate — one package, every host adapter. Core + subs + testing, plus React, Durable Object, Chrome extension, Node, in-memory, work-queue, devtools, and property-testing modules as subpaths.",
3
+ "version": "0.14.0",
4
+ "description": "TEA-faithful state machine substrate — one package, every host adapter. Core + subs + testing, plus React, Durable Object, Chrome extension, Node, in-memory, devtools, and property-testing modules as subpaths.",
5
5
  "keywords": [
6
6
  "tea",
7
7
  "elm-architecture",
@@ -31,18 +31,14 @@
31
31
  "types": "./dist/index.d.ts",
32
32
  "import": "./dist/index.js"
33
33
  },
34
- "./subs": {
35
- "types": "./dist/subs/index.d.ts",
36
- "import": "./dist/subs/index.js"
37
- },
38
- "./testing": {
39
- "types": "./dist/testing/index.d.ts",
40
- "import": "./dist/testing/index.js"
41
- },
42
34
  "./do": {
43
35
  "types": "./dist/do/index.d.ts",
44
36
  "import": "./dist/do/index.js"
45
37
  },
38
+ "./node": {
39
+ "types": "./dist/node/index.d.ts",
40
+ "import": "./dist/node/index.js"
41
+ },
46
42
  "./mem": {
47
43
  "types": "./dist/mem/index.d.ts",
48
44
  "import": "./dist/mem/index.js"
@@ -51,237 +47,76 @@
51
47
  "types": "./dist/react/index.d.ts",
52
48
  "import": "./dist/react/index.js"
53
49
  },
54
- "./devtools": {
55
- "types": "./dist/devtools/index.d.ts",
56
- "import": "./dist/devtools/index.js"
57
- },
58
- "./devtools/styles.css": "./dist/devtools/styles.css",
59
50
  "./extension": {
60
51
  "types": "./dist/extension/index.d.ts",
61
52
  "import": "./dist/extension/index.js"
62
53
  },
63
- "./extension/react": {
64
- "types": "./dist/extension/react.d.ts",
65
- "import": "./dist/extension/react.js"
66
- },
67
- "./extension/subs": {
68
- "types": "./dist/extension/subs/index.d.ts",
69
- "import": "./dist/extension/subs/index.js"
70
- },
71
- "./extension/test-utils": {
72
- "types": "./dist/extension/test-utils.d.ts",
73
- "import": "./dist/extension/test-utils.js"
74
- },
75
- "./work-queue": {
76
- "types": "./dist/work-queue/index.d.ts",
77
- "import": "./dist/work-queue/index.js"
78
- },
79
- "./work-queue/ops": {
80
- "types": "./dist/work-queue/ops.d.ts",
81
- "import": "./dist/work-queue/ops.js"
82
- },
83
- "./work-queue/adapter": {
84
- "types": "./dist/work-queue/adapter.d.ts",
85
- "import": "./dist/work-queue/adapter.js"
86
- },
87
- "./node": {
88
- "types": "./dist/node/index.d.ts",
89
- "import": "./dist/node/index.js"
54
+ "./testing": {
55
+ "types": "./dist/testing/index.d.ts",
56
+ "import": "./dist/testing/index.js"
90
57
  },
91
58
  "./pbt": {
92
59
  "types": "./dist/pbt/index.d.ts",
93
60
  "import": "./dist/pbt/index.js"
94
61
  },
95
- "./pbt/arbitraries": {
96
- "types": "./dist/pbt/arbitraries/index.d.ts",
97
- "import": "./dist/pbt/arbitraries/index.js"
98
- },
99
- "./pbt/runners": {
100
- "types": "./dist/pbt/runners/index.d.ts",
101
- "import": "./dist/pbt/runners/index.js"
62
+ "./agent": {
63
+ "types": "./dist/agent/index.d.ts",
64
+ "import": "./dist/agent/index.js"
102
65
  },
103
66
  "./retry-backoff": {
104
67
  "types": "./dist/retry-backoff/index.d.ts",
105
68
  "import": "./dist/retry-backoff/index.js"
106
69
  },
107
- "./rate-limit": {
108
- "types": "./dist/rate-limit/index.d.ts",
109
- "import": "./dist/rate-limit/index.js"
110
- },
111
70
  "./idempotency": {
112
71
  "types": "./dist/idempotency/index.d.ts",
113
72
  "import": "./dist/idempotency/index.js"
114
73
  },
115
- "./idempotency/adapter": {
116
- "types": "./dist/idempotency/adapter.d.ts",
117
- "import": "./dist/idempotency/adapter.js"
74
+ "./flow": {
75
+ "types": "./dist/flow/index.d.ts",
76
+ "import": "./dist/flow/index.js"
77
+ },
78
+ "./resilience": {
79
+ "types": "./dist/resilience/index.d.ts",
80
+ "import": "./dist/resilience/index.js"
118
81
  },
119
- "./circuit-breaker": {
120
- "types": "./dist/circuit-breaker/index.d.ts",
121
- "import": "./dist/circuit-breaker/index.js"
82
+ "./timing": {
83
+ "types": "./dist/timing/index.d.ts",
84
+ "import": "./dist/timing/index.js"
122
85
  },
123
- "./cache": {
124
- "types": "./dist/cache/index.d.ts",
125
- "import": "./dist/cache/index.js"
86
+ "./persistence": {
87
+ "types": "./dist/persistence/index.d.ts",
88
+ "import": "./dist/persistence/index.js"
126
89
  },
127
- "./deadline": {
128
- "types": "./dist/deadline/index.d.ts",
129
- "import": "./dist/deadline/index.js"
90
+ "./paginate": {
91
+ "types": "./dist/paginate/index.d.ts",
92
+ "import": "./dist/paginate/index.js"
130
93
  },
131
- "./await-terminal": {
132
- "types": "./dist/await-terminal/index.d.ts",
133
- "import": "./dist/await-terminal/index.js"
94
+ "./work-queue": {
95
+ "types": "./dist/work-queue/index.d.ts",
96
+ "import": "./dist/work-queue/index.js"
134
97
  },
135
- "./retry-to-success": {
136
- "types": "./dist/retry-to-success/index.d.ts",
137
- "import": "./dist/retry-to-success/index.js"
98
+ "./jev": {
99
+ "types": "./dist/jev/index.d.ts",
100
+ "import": "./dist/jev/index.js"
101
+ },
102
+ "./devtools": {
103
+ "types": "./dist/devtools/index.d.ts",
104
+ "import": "./dist/devtools/index.js"
138
105
  },
139
106
  "./machine-viz": {
140
107
  "types": "./dist/machine-viz/index.d.ts",
141
108
  "import": "./dist/machine-viz/index.js"
142
109
  },
143
- "./debounce": {
144
- "types": "./dist/debounce/index.d.ts",
145
- "import": "./dist/debounce/index.js"
146
- },
147
- "./throttle": {
148
- "types": "./dist/throttle/index.d.ts",
149
- "import": "./dist/throttle/index.js"
150
- },
151
- "./recorder": {
152
- "types": "./dist/recorder/index.d.ts",
153
- "import": "./dist/recorder/index.js"
154
- },
155
- "./trace-replay": {
156
- "types": "./dist/trace-replay/index.d.ts",
157
- "import": "./dist/trace-replay/index.js"
158
- },
159
- "./paginator": {
160
- "types": "./dist/paginator/index.d.ts",
161
- "import": "./dist/paginator/index.js"
162
- },
163
- "./snapshot": {
164
- "types": "./dist/snapshot/index.d.ts",
165
- "import": "./dist/snapshot/index.js"
166
- },
167
- "./token-refresh": {
168
- "types": "./dist/token-refresh/index.d.ts",
169
- "import": "./dist/token-refresh/index.js"
170
- },
171
- "./resilient-call": {
172
- "types": "./dist/resilient-call/index.d.ts",
173
- "import": "./dist/resilient-call/index.js"
174
- },
175
- "./with-telemetry": {
176
- "types": "./dist/with-telemetry/index.d.ts",
177
- "import": "./dist/with-telemetry/index.js"
178
- },
179
- "./fan-out": {
180
- "types": "./dist/fan-out/index.d.ts",
181
- "import": "./dist/fan-out/index.js"
182
- },
183
- "./idempotent-intake": {
184
- "types": "./dist/idempotent-intake/index.d.ts",
185
- "import": "./dist/idempotent-intake/index.js"
186
- },
187
- "./poller": {
188
- "types": "./dist/poller/index.d.ts",
189
- "import": "./dist/poller/index.js"
190
- },
191
- "./workflow": {
192
- "types": "./dist/workflow/index.d.ts",
193
- "import": "./dist/workflow/index.js"
194
- },
195
- "./batch-window": {
196
- "types": "./dist/batch-window/index.d.ts",
197
- "import": "./dist/batch-window/index.js"
198
- },
199
- "./saga": {
200
- "types": "./dist/saga/index.d.ts",
201
- "import": "./dist/saga/index.js"
202
- },
203
- "./throttled-input": {
204
- "types": "./dist/throttled-input/index.d.ts",
205
- "import": "./dist/throttled-input/index.js"
206
- },
207
- "./monitored-run": {
208
- "types": "./dist/monitored-run/index.d.ts",
209
- "import": "./dist/monitored-run/index.js"
210
- },
211
- "./llm-call": {
212
- "types": "./dist/llm-call/index.d.ts",
213
- "import": "./dist/llm-call/index.js"
214
- },
215
- "./paginated-walk": {
216
- "types": "./dist/paginated-walk/index.d.ts",
217
- "import": "./dist/paginated-walk/index.js"
218
- },
219
- "./authed-call": {
220
- "types": "./dist/authed-call/index.d.ts",
221
- "import": "./dist/authed-call/index.js"
222
- },
223
- "./reconciler": {
224
- "types": "./dist/reconciler/index.d.ts",
225
- "import": "./dist/reconciler/index.js"
226
- },
227
- "./agent": {
228
- "types": "./dist/agent/index.d.ts",
229
- "import": "./dist/agent/index.js"
230
- },
231
- "./with-deadline": {
232
- "types": "./dist/with-deadline/index.d.ts",
233
- "import": "./dist/with-deadline/index.js"
234
- },
235
- "./with-resilience": {
236
- "types": "./dist/with-resilience/index.d.ts",
237
- "import": "./dist/with-resilience/index.js"
238
- },
239
- "./prediction": {
240
- "types": "./dist/prediction/index.d.ts",
241
- "import": "./dist/prediction/index.js"
242
- },
243
- "./pure": {
244
- "types": "./dist/pure/index.d.ts",
245
- "import": "./dist/pure/index.js"
246
- },
247
110
  "./parity": {
248
111
  "types": "./dist/parity/index.d.ts",
249
112
  "import": "./dist/parity/index.js"
250
113
  },
251
- "./chart": {
252
- "types": "./dist/chart/index.d.ts",
253
- "import": "./dist/chart/index.js"
254
- },
255
- "./chart/inspect": {
256
- "types": "./dist/chart/inspect/index.d.ts",
257
- "import": "./dist/chart/inspect/index.js"
258
- },
259
- "./chart/inspect/react": {
260
- "types": "./dist/chart/inspect/react.d.ts",
261
- "import": "./dist/chart/inspect/react.js"
262
- },
263
- "./chart/inspect/styles.css": "./dist/chart/inspect/styles.css",
264
- "./chart/report": {
265
- "types": "./dist/chart/report/index.d.ts",
266
- "import": "./dist/chart/report/index.js"
267
- },
268
- "./chart/lane": {
269
- "types": "./dist/chart/lane/index.d.ts",
270
- "import": "./dist/chart/lane/index.js"
271
- },
272
- "./chart/lane/react": {
273
- "types": "./dist/chart/lane/react.d.ts",
274
- "import": "./dist/chart/lane/react.js"
275
- },
276
- "./chart/lane/server": {
277
- "types": "./dist/chart/lane/server.d.ts",
278
- "import": "./dist/chart/lane/server.js"
279
- },
280
- "./chart/lane/styles.css": "./dist/chart/lane/styles.css",
114
+ "./devtools/styles.css": "./dist/devtools/styles.css",
281
115
  "./package.json": "./package.json"
282
116
  },
283
117
  "dependencies": {
284
- "better-result": "^2.5.2"
118
+ "better-result": "^2.5.2",
119
+ "zod": "^4.5.4"
285
120
  },
286
121
  "peerDependencies": {
287
122
  "fast-check": "^3 || ^4",
@@ -308,19 +143,19 @@
308
143
  }
309
144
  },
310
145
  "devDependencies": {
146
+ "@anthropic-ai/sdk": "0.124.0",
311
147
  "@biomejs/biome": "2.3.14",
312
148
  "@changesets/cli": "^2.27.11",
313
149
  "@cloudflare/workers-types": "4.20260312.1",
314
- "@kampus/fabrika-cli": "0.3.0",
150
+ "@kampus/fabrika-cli": "0.5.0",
315
151
  "@types/chrome": "^0.1.42",
316
152
  "@types/node": "^22",
317
153
  "@types/react": "19.0.8",
318
154
  "@types/react-dom": "19.0.3",
319
155
  "@types/ws": "8.5.14",
320
- "@vitejs/plugin-react": "^6.0.5",
156
+ "ai": "^7.0.93",
321
157
  "fast-check": "^3.23.0",
322
158
  "happy-dom": "^20.9.0",
323
- "mermaid": "^11.16.1",
324
159
  "react": "19.0.0",
325
160
  "react-dom": "19.0.0",
326
161
  "tsup": "^8.3.5",
@@ -340,20 +175,19 @@
340
175
  "node": "23.7.0"
341
176
  },
342
177
  "scripts": {
343
- "build": "NODE_OPTIONS=--max-old-space-size=8192 tsup && node build-viewer.mjs",
178
+ "build": "NODE_OPTIONS=--max-old-space-size=8192 tsup",
344
179
  "lint": "biome check src package.json",
180
+ "lint:worktree": "biome check src package.json",
345
181
  "test": "vitest run",
346
- "demo:saga": "vitest run src/workflow/demo.test.ts",
347
- "lane:view": "vite --config demo/lane-view/vite.config.ts",
182
+ "demo:saga": "vitest run src/internal/flow/workflow/demo.test.ts",
348
183
  "typecheck": "tsc --noEmit",
349
184
  "typecheck:test": "tsc --noEmit -p tsconfig.test.json",
350
- "typecheck:examples": "tsc -p examples/tsconfig.json",
185
+ "typecheck:consumers": "tsc -p tsconfig.consumers.json",
351
186
  "docs:reference": "TEA_DOCS_WRITE=1 vitest run src/docs/reference/generate-reference.test.ts",
352
187
  "docs:reference:check": "pnpm run docs:reference && git diff --exit-code -- docs/reference",
353
188
  "verify-exports": "node scripts/verify-exports.mjs",
354
- "check:chart-probes": "node scripts/check-chart-probes.mjs",
189
+ "verify-optional-peer-install": "node scripts/verify-optional-peer-install.mjs",
355
190
  "check:merge-markers": "node scripts/check-merge-markers.mjs",
356
- "release": "changeset",
357
- "build:viewer": "node build-viewer.mjs"
191
+ "release": "changeset"
358
192
  }
359
193
  }
@@ -1,119 +0,0 @@
1
- import { P as PortEmitter, C as Cmd } from '../core-Bjc0bS8j.js';
2
- import { M as MsgType } from '../protocol-B5YmJr0d.js';
3
- import { ResilientConfig, ResilientState, RunCmd, SucceedMsg, FailMsg, ResilientTimerMsg, ResilientPorts } from '../resilient-call/index.js';
4
- import { TokenRefreshConfig, Token, TokenState, RefreshTokenCmd, TokenRefreshMsg } from '../token-refresh/index.js';
5
- import { DeadlineSub } from '../deadline/index.js';
6
- export { DeadlineExceeded, deadlineSub, subscribeDeadline } from '../deadline/index.js';
7
- import '../cache/index.js';
8
- import '../types-D7u9DkH7.js';
9
- import '../circuit-breaker/index.js';
10
- import '../rate-limit/index.js';
11
- import '../retry-backoff/index.js';
12
-
13
- /**
14
- * The authed-call knob. It is `ResilientConfig` widened by the token dimension:
15
- *
16
- * - `refresh` — the ONLY required field: the port that mints a fresh `Token`.
17
- * Identical to token-refresh's `TokenRefreshPorts.refresh`; it is hoisted
18
- * onto the config (not the ports) so the consumer spells the credential
19
- * source once, the same way `rng` is curried onto the factory.
20
- * - `skewMs` — token-refresh's refresh-ahead skew (optional, defaults to 0).
21
- * - every `ResilientConfig` field (`retry` / `circuit` / `rateLimit` /
22
- * `cache` / `deadline`) — passed straight through to the resilient-call
23
- * knob, each still optional, each still "omit a brick → omit its gate".
24
- */
25
- interface AuthedConfig extends ResilientConfig, TokenRefreshConfig {
26
- /** Mint a fresh credential. The single DI seam the auth dimension adds. */
27
- readonly refresh: () => Promise<Token>;
28
- }
29
- /**
30
- * The composed slice. Three plain-data fields, no closures:
31
- *
32
- * - `resilience` — resilient-call's entire slice (circuit, bucket, retry,
33
- * cache, calls). Owned and mutated only via resilient-call's verbs.
34
- * - `auth` — token-refresh's `{ token, stale }` slice. Owned and mutated only
35
- * via token-refresh's verbs.
36
- * - `authRetry` — per-key count of auth-retries (401 → refresh → retry) spent
37
- * on a call. Caps the dance at one retry per call so a credential the server
38
- * keeps rejecting cannot spin forever. A key absent from the record has
39
- * spent zero. Cleared when a call settles or a fresh `attempt` starts.
40
- *
41
- * `pendingAuthRetry` carries the inputs of calls parked waiting for the refresh
42
- * to land, keyed so `onRefreshed` can re-issue exactly those calls. Plain data —
43
- * `input` is the same payload the call was issued with.
44
- */
45
- interface AuthedState<I, R> {
46
- readonly resilience: ResilientState<I, R>;
47
- readonly auth: TokenState;
48
- readonly authRetry: Readonly<Record<string, number>>;
49
- readonly pendingAuthRetry: Readonly<Record<string, I>>;
50
- }
51
- /** The two effects this knob emits: resilient-call's run, token-refresh's mint. */
52
- type AuthedCmd<I> = RunCmd<I> | RefreshTokenCmd;
53
- /**
54
- * Every Msg the knob's verbs fold. Resilient-call's settle + timer Msgs, token-
55
- * refresh's refresh-result Msgs, and the 401 trigger the consumer dispatches
56
- * when a guarded call comes back unauthorized.
57
- */
58
- type Unauthorized = {
59
- readonly type: typeof MsgType.Unauthorized;
60
- readonly key: string;
61
- readonly at: number;
62
- };
63
- /**
64
- * The plain-data error a 401 we cannot fix settles with. A `{_tag, ...}`
65
- * sentinel — NEVER a `new Error(...)` — so the slice stays JSON-serializable
66
- * (an Error object round-trips to `{}` under JSON and carries a stack trace,
67
- * both of which break the slice's durability invariant once it is persisted
68
- * into a `Store<S>` and reloaded). Mirrors resilient-call's `DeadlineExceededError`
69
- * sentinel discipline. `key` echoes the call that was rejected so a consumer can
70
- * attribute the failure.
71
- */
72
- type UnauthorizedError = {
73
- readonly _tag: "unauthorized";
74
- readonly key: string;
75
- };
76
- /** Ports `handlers` needs — resilient-call's run port AND token-refresh's refresh port. */
77
- interface AuthedPorts<I, R> extends ResilientPorts<I, R> {
78
- /** Mint a fresh credential. Mirrors `AuthedConfig.refresh` for symmetry at the splice site. */
79
- readonly refresh: () => Promise<Token>;
80
- }
81
- /**
82
- * Build an authed-call knob from `config`. `rng` is injected for retry jitter
83
- * and threaded straight into the underlying resilient-call knob — pass a fixed
84
- * `() => 0.5` in tests to pin backoff; defaults to `Math.random` (read only at
85
- * the verb boundary inside resilient-call, never in a brick op).
86
- *
87
- * Returns the uniform L2 knob contract, widened by the auth verbs (`on401`,
88
- * `onRefreshed`, `installToken`). `I` is the port input type, `R` the result.
89
- */
90
- declare function createAuthedCall<I, R>(config: AuthedConfig, rng?: () => number): {
91
- init: () => AuthedState<I, R>;
92
- attempt: (s: AuthedState<I, R>, key: string, input: I, at: number) => readonly [AuthedState<I, R>, readonly AuthedCmd<I>[]];
93
- succeed: (s: AuthedState<I, R>, key: string, msg: SucceedMsg<R>) => readonly [AuthedState<I, R>, readonly AuthedCmd<I>[]];
94
- fail: (s: AuthedState<I, R>, key: string, msg: FailMsg) => readonly [AuthedState<I, R>, readonly AuthedCmd<I>[]];
95
- on401: (s: AuthedState<I, R>, key: string, at: number) => readonly [AuthedState<I, R>, readonly AuthedCmd<I>[]];
96
- installToken: (s: AuthedState<I, R>, token: Token) => AuthedState<I, R>;
97
- onRefreshed: (s: AuthedState<I, R>, at: number) => readonly [AuthedState<I, R>, readonly AuthedCmd<I>[]];
98
- onTimer: (s: AuthedState<I, R>, msg: ResilientTimerMsg) => readonly [AuthedState<I, R>, readonly AuthedCmd<I>[]];
99
- /** token-refresh's call-boundary verb, re-exposed for proactive expiry refresh. */
100
- needsRefresh: (s: AuthedState<I, R>, at: number) => boolean;
101
- subs: (s: AuthedState<I, R>) => readonly DeadlineSub[];
102
- handlers: (ports: AuthedPorts<I, R>) => {
103
- refresh_token: (cmd: RefreshTokenCmd, ctx: PortEmitter, dispatch?: ((msg: TokenRefreshMsg) => void) | undefined) => Promise<void | TokenRefreshMsg>;
104
- resilient_run: (cmd: RunCmd<I>, ctx: Readonly<Record<never, never>>) => Promise<FailMsg | SucceedMsg<R>>;
105
- };
106
- };
107
- /** The shape `createAuthedCall` returns — useful for typing a held knob. */
108
- type AuthedCall<I, R> = ReturnType<typeof createAuthedCall<I, R>>;
109
- /**
110
- * Lift a knob result `[slice, cmds]` into a host `[State, cmds]` where the slice
111
- * lives at `state.authed`. A convenience for the common single-slice host;
112
- * consumers with a differently-named field spread by hand. Pure — a thin record
113
- * rebuild, no clock / RNG.
114
- */
115
- declare function liftAuthed<S extends {
116
- authed: AuthedState<I, R>;
117
- }, I, R, C extends Cmd>(state: S, [slice, cmds]: readonly [AuthedState<I, R>, readonly C[]]): readonly [S, readonly C[]];
118
-
119
- export { type AuthedCall, type AuthedCmd, type AuthedConfig, type AuthedPorts, type AuthedState, DeadlineSub, FailMsg, ResilientState, ResilientTimerMsg, RunCmd, SucceedMsg, Token, TokenRefreshMsg, TokenState, type Unauthorized, type UnauthorizedError, createAuthedCall, liftAuthed };
@@ -1,134 +0,0 @@
1
- import { createTokenRefresh, refreshTokenCmd } from '../chunk-TP5UPGLY.js';
2
- import { createResilientCall } from '../chunk-EUF7XOEE.js';
3
- import '../chunk-JELSZN25.js';
4
- export { deadlineSub, subscribeDeadline } from '../chunk-JGVL3WPL.js';
5
- import '../chunk-Q2UM7BXU.js';
6
- import '../chunk-S2EGRPCM.js';
7
- import '../chunk-UF4MZSLT.js';
8
- import '../chunk-7SVIRMC6.js';
9
- import '../chunk-3JU6657S.js';
10
- import '../chunk-2YFLOCWX.js';
11
- import '../chunk-ZJ5AOYBH.js';
12
- import '../chunk-5EHLEUTL.js';
13
- import { without } from '../chunk-B5VXOFMZ.js';
14
-
15
- // src/authed-call/index.ts
16
- function createAuthedCall(config, rng = Math.random) {
17
- const rc = createResilientCall(config, rng);
18
- const tr = createTokenRefresh({ skewMs: config.skewMs });
19
- function init() {
20
- return {
21
- resilience: rc.init(),
22
- auth: tr.init(),
23
- authRetry: {},
24
- pendingAuthRetry: {}
25
- };
26
- }
27
- function liftResilient(s, [resilience, cmds]) {
28
- return [{ ...s, resilience }, cmds];
29
- }
30
- function clearAuthKey(s, key) {
31
- return {
32
- ...s,
33
- authRetry: without(s.authRetry, key),
34
- pendingAuthRetry: without(s.pendingAuthRetry, key)
35
- };
36
- }
37
- function attempt(s, key, input, at) {
38
- const cleared = clearAuthKey(s, key);
39
- return liftResilient(
40
- cleared,
41
- rc.attempt(cleared.resilience, key, input, at)
42
- );
43
- }
44
- function succeed(s, key, msg) {
45
- const settled = clearAuthKey(s, key);
46
- return liftResilient(settled, rc.succeed(settled.resilience, key, msg));
47
- }
48
- function fail(s, key, msg) {
49
- const [resilience, cmds] = rc.fail(s.resilience, key, msg);
50
- const next = settleAuthIfDone({ ...s, resilience }, key, resilience);
51
- return [next, cmds];
52
- }
53
- function on401(s, key, at) {
54
- const spent = s.authRetry[key] ?? 0;
55
- const call = s.resilience.calls[key];
56
- const input = call?.phase === "running" || call?.phase === "waiting_retry" ? call.input : void 0;
57
- if (spent >= 1 || input === void 0) {
58
- const error = { _tag: "unauthorized", key };
59
- const [settled] = rc.settleFailed(s.resilience, key, error);
60
- return [{ ...clearAuthKey(s, key), resilience: settled }, []];
61
- }
62
- return [
63
- {
64
- ...s,
65
- auth: tr.on401(s.auth),
66
- authRetry: { ...s.authRetry, [key]: spent + 1 },
67
- pendingAuthRetry: { ...s.pendingAuthRetry, [key]: input }
68
- },
69
- [refreshTokenCmd()]
70
- ];
71
- }
72
- function installToken(s, token) {
73
- return { ...s, auth: tr.refreshed(s.auth, token) };
74
- }
75
- function onRefreshed(s, at) {
76
- const parked = Object.entries(s.pendingAuthRetry);
77
- if (parked.length === 0) return [s, []];
78
- let resilience = s.resilience;
79
- const cmds = [];
80
- for (const [key, input] of parked) {
81
- const [next, runCmds] = rc.attempt(resilience, key, input, at);
82
- resilience = next;
83
- cmds.push(...runCmds);
84
- }
85
- return [{ ...s, resilience, pendingAuthRetry: {} }, cmds];
86
- }
87
- function onTimer(s, msg) {
88
- const [resilience, cmds] = rc.onTimer(s.resilience, msg);
89
- const next = settleAuthIfDone({ ...s, resilience }, void 0, resilience);
90
- return [next, cmds];
91
- }
92
- function settleAuthIfDone(s, onlyKey, resilience) {
93
- const keys = onlyKey !== void 0 ? [onlyKey] : Object.keys(s.authRetry);
94
- let next = s;
95
- for (const key of keys) {
96
- const phase = resilience.calls[key]?.phase;
97
- if (phase === "succeeded" || phase === "failed") {
98
- next = clearAuthKey(next, key);
99
- }
100
- }
101
- return next;
102
- }
103
- function subs(s) {
104
- return rc.subs(s.resilience);
105
- }
106
- function handlers(ports) {
107
- const trPorts = { refresh: ports.refresh };
108
- return {
109
- ...rc.handlers({ run: ports.run }),
110
- ...tr.handlers(trPorts)
111
- };
112
- }
113
- return {
114
- init,
115
- attempt,
116
- succeed,
117
- fail,
118
- on401,
119
- installToken,
120
- onRefreshed,
121
- onTimer,
122
- /** token-refresh's call-boundary verb, re-exposed for proactive expiry refresh. */
123
- needsRefresh: (s, at) => tr.needsRefresh(s.auth, at),
124
- subs,
125
- handlers
126
- };
127
- }
128
- function liftAuthed(state, [slice, cmds]) {
129
- return [{ ...state, authed: slice }, cmds];
130
- }
131
-
132
- export { createAuthedCall, liftAuthed };
133
- //# sourceMappingURL=index.js.map
134
- //# sourceMappingURL=index.js.map