@keboola/api-client 49.0.0 → 51.0.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 (564) hide show
  1. package/AGENTS.md +109 -95
  2. package/API-SURFACE.md +13 -31
  3. package/CHANGELOG.md +54 -0
  4. package/README.md +33 -29
  5. package/dist/{ManagementSessionMintError-Cu9beG7j.cjs → ManagementSessionMintError-ByOulHQH.cjs} +4 -6
  6. package/dist/{ManagementSessionMintError-Cu9beG7j.cjs.map → ManagementSessionMintError-ByOulHQH.cjs.map} +1 -1
  7. package/dist/{ManagementSessionMintError-4Pkn5Oob.js → ManagementSessionMintError-DNMbYauw.js} +4 -6
  8. package/dist/{ManagementSessionMintError-4Pkn5Oob.js.map → ManagementSessionMintError-DNMbYauw.js.map} +1 -1
  9. package/dist/{QueryJobError-ZZZ043Nm.js → QueryJobError-Iq9O90Uh.js} +2 -3
  10. package/dist/{QueryJobError-ZZZ043Nm.js.map → QueryJobError-Iq9O90Uh.js.map} +1 -1
  11. package/dist/{QueryJobError-irGiP5zh.cjs → QueryJobError-Oy0fl4aw.cjs} +2 -3
  12. package/dist/{QueryJobError-irGiP5zh.cjs.map → QueryJobError-Oy0fl4aw.cjs.map} +1 -1
  13. package/dist/{QueueJobError-8bThS_Mc.js → QueueJobError-BJNUINXW.js} +2 -3
  14. package/dist/{QueueJobError-8bThS_Mc.js.map → QueueJobError-BJNUINXW.js.map} +1 -1
  15. package/dist/{QueueJobError-6qSEizWo.cjs → QueueJobError-DruZK3tc.cjs} +2 -3
  16. package/dist/{QueueJobError-6qSEizWo.cjs.map → QueueJobError-DruZK3tc.cjs.map} +1 -1
  17. package/dist/{SyncActionError-CoZFsdUk.js → SyncActionError-DuGcDbkd.js} +2 -3
  18. package/dist/{SyncActionError-CoZFsdUk.js.map → SyncActionError-DuGcDbkd.js.map} +1 -1
  19. package/dist/{SyncActionError-BG0zwchi.cjs → SyncActionError-mbpVg63X.cjs} +2 -3
  20. package/dist/{SyncActionError-BG0zwchi.cjs.map → SyncActionError-mbpVg63X.cjs.map} +1 -1
  21. package/dist/{UserError-By_Zckmc.js → UserError-BxoOJJ_u.js} +2 -3
  22. package/dist/{UserError-By_Zckmc.js.map → UserError-BxoOJJ_u.js.map} +1 -1
  23. package/dist/{UserError-CSGO1qII.cjs → UserError-D4P9Tbhf.cjs} +2 -3
  24. package/dist/{UserError-CSGO1qII.cjs.map → UserError-D4P9Tbhf.cjs.map} +1 -1
  25. package/dist/{ValidationError-D65QU0uq.cjs → ValidationError-BXcFX4nD.cjs} +2 -3
  26. package/dist/{ValidationError-D65QU0uq.cjs.map → ValidationError-BXcFX4nD.cjs.map} +1 -1
  27. package/dist/{ValidationError-DjhtNMfZ.js → ValidationError-BsdFDGY2.js} +2 -3
  28. package/dist/{ValidationError-DjhtNMfZ.js.map → ValidationError-BsdFDGY2.js.map} +1 -1
  29. package/dist/{configurations-CL0ouUMa.js → admin-CbMOsfgs.js} +5 -53
  30. package/dist/admin-CbMOsfgs.js.map +1 -0
  31. package/dist/{configurations-D9J3jh3g.cjs → admin-Di-MmGFP.cjs} +4 -124
  32. package/dist/admin-Di-MmGFP.cjs.map +1 -0
  33. package/dist/{adminRoles-BX1gk3At.d.ts → adminRoles-DAwl657q.d.ts} +2 -4
  34. package/dist/{adminRoles-CO7J5qAy.cjs → adminRoles-DnFpO_2W.cjs} +2 -3
  35. package/dist/{adminRoles-CO7J5qAy.cjs.map → adminRoles-DnFpO_2W.cjs.map} +1 -1
  36. package/dist/{adminRoles-BbxFgfX-.d.cts → adminRoles-FFyl7Dyx.d.cts} +2 -4
  37. package/dist/{adminRoles-B40yBcmq.js → adminRoles-asa-MhDD.js} +2 -3
  38. package/dist/{adminRoles-B40yBcmq.js.map → adminRoles-asa-MhDD.js.map} +1 -1
  39. package/dist/ai/index.cjs +3 -4
  40. package/dist/ai/index.d.cts +2 -4
  41. package/dist/ai/index.d.ts +2 -4
  42. package/dist/ai/index.js +3 -4
  43. package/dist/ai/types.d.cts +1 -1
  44. package/dist/ai/types.d.ts +1 -1
  45. package/dist/{appLogs-DI2Y4imY.d.ts → appLogs-CTvZAihm.d.ts} +2 -4
  46. package/dist/{appLogs-IhRA3xyv.d.cts → appLogs-CnLNMH7M.d.cts} +2 -4
  47. package/dist/{appLogs-Cix2KWra.cjs → appLogs-CoAWQGxs.cjs} +5 -6
  48. package/dist/{appLogs-Cix2KWra.cjs.map → appLogs-CoAWQGxs.cjs.map} +1 -1
  49. package/dist/{appLogs-KslK7qHr.js → appLogs-DFcPwVk8.js} +4 -5
  50. package/dist/{appLogs-KslK7qHr.js.map → appLogs-DFcPwVk8.js.map} +1 -1
  51. package/dist/apps/index.cjs +28 -5
  52. package/dist/apps/index.cjs.map +1 -1
  53. package/dist/apps/index.d.cts +22 -5
  54. package/dist/apps/index.d.ts +22 -5
  55. package/dist/apps/index.js +28 -5
  56. package/dist/apps/index.js.map +1 -1
  57. package/dist/apps/types.d.cts +3 -3
  58. package/dist/apps/types.d.ts +3 -3
  59. package/dist/assets/index.cjs +2 -3
  60. package/dist/assets/index.d.cts +1 -3
  61. package/dist/assets/index.d.ts +1 -3
  62. package/dist/assets/index.js +2 -3
  63. package/dist/assets/schema.cjs +2 -3
  64. package/dist/assets/schema.d.cts +0 -2
  65. package/dist/assets/schema.d.ts +0 -2
  66. package/dist/assets/schema.js +1 -2
  67. package/dist/auth/index.cjs +1 -1
  68. package/dist/auth/index.d.cts +1 -1
  69. package/dist/auth/index.d.ts +1 -1
  70. package/dist/auth/index.js +1 -2
  71. package/dist/auth/types.d.cts +1 -1
  72. package/dist/auth/types.d.ts +1 -1
  73. package/dist/{auth-C8Pjl0Mu.cjs → auth-CvB4MukT.cjs} +3 -4
  74. package/dist/{auth-C8Pjl0Mu.cjs.map → auth-CvB4MukT.cjs.map} +1 -1
  75. package/dist/{auth-4coY1uwo.js → auth-DYfQMQCs.js} +3 -4
  76. package/dist/{auth-4coY1uwo.js.map → auth-DYfQMQCs.js.map} +1 -1
  77. package/dist/{authClient-DfkKlc-2.cjs → authClient-DcKBpMcU.cjs} +66 -85
  78. package/dist/{authClient-DfkKlc-2.cjs.map → authClient-DcKBpMcU.cjs.map} +1 -1
  79. package/dist/{authClient-6Aau_4Zt.d.ts → authClient-Df3U4q_6.d.cts} +4 -16
  80. package/dist/{authClient-B3P6WtWW.d.cts → authClient-JtMVJWXY.d.ts} +4 -16
  81. package/dist/{authClient-2e8ZmzSP.js → authClient-oB5ydxWp.js} +66 -85
  82. package/dist/{authClient-2e8ZmzSP.js.map → authClient-oB5ydxWp.js.map} +1 -1
  83. package/dist/{backends-DKBz5OxE.d.ts → backends-BHotIdL0.d.cts} +1 -3
  84. package/dist/{backends-DKBz5OxE.d.cts → backends-BHotIdL0.d.ts} +1 -3
  85. package/dist/billing/index.cjs +3 -4
  86. package/dist/billing/index.d.cts +1 -3
  87. package/dist/billing/index.d.ts +1 -3
  88. package/dist/billing/index.js +3 -4
  89. package/dist/billing/types.d.cts +1 -5
  90. package/dist/billing/types.d.ts +1 -5
  91. package/dist/chat/index.cjs +4 -5
  92. package/dist/chat/index.d.cts +3 -5
  93. package/dist/chat/index.d.ts +3 -5
  94. package/dist/chat/index.js +4 -5
  95. package/dist/chat/suggestions.cjs +1 -2
  96. package/dist/chat/suggestions.d.cts +1 -1
  97. package/dist/chat/suggestions.d.ts +1 -1
  98. package/dist/chat/suggestions.js +1 -2
  99. package/dist/chat/types.cjs +1 -2
  100. package/dist/chat/types.d.cts +1 -1
  101. package/dist/chat/types.d.ts +1 -1
  102. package/dist/chat/types.js +1 -2
  103. package/dist/{collectByOffset-DQsqtmJg.cjs → collectByOffset-DgxJ3zT9.cjs} +3 -4
  104. package/dist/{collectByOffset-DQsqtmJg.cjs.map → collectByOffset-DgxJ3zT9.cjs.map} +1 -1
  105. package/dist/{collectByOffset-2XzJqmvr.js → collectByOffset-i8Tdoze7.js} +3 -4
  106. package/dist/{collectByOffset-2XzJqmvr.js.map → collectByOffset-i8Tdoze7.js.map} +1 -1
  107. package/dist/{componentId-D4jp6a13.cjs → componentId-C8ZTXXDo.cjs} +2 -3
  108. package/dist/{componentId-D4jp6a13.cjs.map → componentId-C8ZTXXDo.cjs.map} +1 -1
  109. package/dist/{componentId-DmHwHG5V.js → componentId-b_qBbJEM.js} +2 -3
  110. package/dist/{componentId-DmHwHG5V.js.map → componentId-b_qBbJEM.js.map} +1 -1
  111. package/dist/componentsMcp/index.cjs +1 -1
  112. package/dist/componentsMcp/index.d.cts +1 -1
  113. package/dist/componentsMcp/index.d.ts +1 -1
  114. package/dist/componentsMcp/index.js +1 -2
  115. package/dist/componentsMcp/types.d.cts +1 -1
  116. package/dist/componentsMcp/types.d.ts +1 -1
  117. package/dist/{componentsMcp-pG-PcQrg.cjs → componentsMcp-BaHy5iLr.cjs} +5 -7
  118. package/dist/{componentsMcp-pG-PcQrg.cjs.map → componentsMcp-BaHy5iLr.cjs.map} +1 -1
  119. package/dist/{componentsMcp-CHobIsuU.js → componentsMcp-BrB4js6b.js} +5 -7
  120. package/dist/{componentsMcp-CHobIsuU.js.map → componentsMcp-BrB4js6b.js.map} +1 -1
  121. package/dist/{concurrent-BacWxPwi.js → concurrent-BtsT10Xe.js} +2 -3
  122. package/dist/{concurrent-BacWxPwi.js.map → concurrent-BtsT10Xe.js.map} +1 -1
  123. package/dist/{concurrent-CdVfR1N5.cjs → concurrent-DnTV_ppY.cjs} +2 -3
  124. package/dist/{concurrent-CdVfR1N5.cjs.map → concurrent-DnTV_ppY.cjs.map} +1 -1
  125. package/dist/configurations-Cd6Nsox-.js +49 -0
  126. package/dist/configurations-Cd6Nsox-.js.map +1 -0
  127. package/dist/configurations-WI8H4zLk.cjs +120 -0
  128. package/dist/configurations-WI8H4zLk.cjs.map +1 -0
  129. package/dist/constants/index.cjs +3 -3
  130. package/dist/constants/index.d.cts +4 -4
  131. package/dist/constants/index.d.ts +4 -4
  132. package/dist/constants/index.js +3 -3
  133. package/dist/{constants-VpSwBtCb.js → constants-BMSHGwOR.js} +46 -52
  134. package/dist/constants-BMSHGwOR.js.map +1 -0
  135. package/dist/{constants-DErcRkWl.cjs → constants-DhFQWQgy.cjs} +45 -51
  136. package/dist/constants-DhFQWQgy.cjs.map +1 -0
  137. package/dist/{createAbortError-RendOpo7.cjs → createAbortError-Dzc9yObN.cjs} +2 -3
  138. package/dist/{createAbortError-RendOpo7.cjs.map → createAbortError-Dzc9yObN.cjs.map} +1 -1
  139. package/dist/{createAbortError-BxupOt-6.js → createAbortError-c6ekCpRy.js} +2 -3
  140. package/dist/{createAbortError-BxupOt-6.js.map → createAbortError-c6ekCpRy.js.map} +1 -1
  141. package/dist/{createFetchClient-lZ_93Yrb.cjs → createFetchClient-DEkUH662.cjs} +6 -10
  142. package/dist/{createFetchClient-lZ_93Yrb.cjs.map → createFetchClient-DEkUH662.cjs.map} +1 -1
  143. package/dist/{createFetchClient-CkHdS_IG.js → createFetchClient-DlGCbltR.js} +5 -9
  144. package/dist/{createFetchClient-CkHdS_IG.js.map → createFetchClient-DlGCbltR.js.map} +1 -1
  145. package/dist/{createGenericFetchClient-MOx97wi-.cjs → createGenericFetchClient-2oU-PXVo.cjs} +3 -4
  146. package/dist/{createGenericFetchClient-MOx97wi-.cjs.map → createGenericFetchClient-2oU-PXVo.cjs.map} +1 -1
  147. package/dist/createGenericFetchClient-wGxemBwR.js +6 -0
  148. package/dist/{createGenericFetchClient-CQdNcPC3.js.map → createGenericFetchClient-wGxemBwR.js.map} +1 -1
  149. package/dist/createOpenapiFetchClient-Bhz62MUE.js +6 -0
  150. package/dist/{createOpenapiFetchClient-DXiMv9WL.js.map → createOpenapiFetchClient-Bhz62MUE.js.map} +1 -1
  151. package/dist/{createOpenapiFetchClient-DHYo_k3t.cjs → createOpenapiFetchClient-DL9w7vU-.cjs} +3 -4
  152. package/dist/{createOpenapiFetchClient-DHYo_k3t.cjs.map → createOpenapiFetchClient-DL9w7vU-.cjs.map} +1 -1
  153. package/dist/dataScience/index.cjs +2 -2
  154. package/dist/dataScience/index.d.cts +2 -2
  155. package/dist/dataScience/index.d.ts +2 -2
  156. package/dist/dataScience/index.js +2 -2
  157. package/dist/dataScience/types.d.cts +2 -2
  158. package/dist/dataScience/types.d.ts +2 -2
  159. package/dist/{dataScience-AwPMeGfz.js → dataScience-CXmkEOAi.js} +7 -9
  160. package/dist/{dataScience-AwPMeGfz.js.map → dataScience-CXmkEOAi.js.map} +1 -1
  161. package/dist/{dataScience-BjS1p8WO.cjs → dataScience-CufjHPSd.cjs} +7 -9
  162. package/dist/{dataScience-BjS1p8WO.cjs.map → dataScience-CufjHPSd.cjs.map} +1 -1
  163. package/dist/{dedupe-OSnnst2u.cjs → dedupe-Bf0gl9TJ.cjs} +2 -3
  164. package/dist/{dedupe-OSnnst2u.cjs.map → dedupe-Bf0gl9TJ.cjs.map} +1 -1
  165. package/dist/{dedupe-Cky1gSUu.js → dedupe-Bu0d2i_w.js} +2 -3
  166. package/dist/{dedupe-Cky1gSUu.js.map → dedupe-Bu0d2i_w.js.map} +1 -1
  167. package/dist/developerPortal/index.cjs +1 -1
  168. package/dist/developerPortal/index.d.cts +2 -2
  169. package/dist/developerPortal/index.d.ts +2 -2
  170. package/dist/developerPortal/index.js +1 -2
  171. package/dist/developerPortal/types.d.cts +1 -1
  172. package/dist/developerPortal/types.d.ts +1 -1
  173. package/dist/{developerPortalClient-DUerKw-7.cjs → developerPortalClient-BfRxYrWj.cjs} +9 -15
  174. package/dist/{developerPortalClient-DUerKw-7.cjs.map → developerPortalClient-BfRxYrWj.cjs.map} +1 -1
  175. package/dist/{developerPortalClient-Bb2suezr.js → developerPortalClient-D9XOYwWF.js} +9 -15
  176. package/dist/{developerPortalClient-Bb2suezr.js.map → developerPortalClient-D9XOYwWF.js.map} +1 -1
  177. package/dist/domain/permissions/index.cjs +18 -17
  178. package/dist/domain/permissions/index.d.cts +1 -11
  179. package/dist/domain/permissions/index.d.ts +1 -11
  180. package/dist/domain/permissions/index.js +3 -2
  181. package/dist/domain/storageTable/index.cjs +403 -9
  182. package/dist/domain/storageTable/index.cjs.map +1 -0
  183. package/dist/domain/storageTable/index.d.cts +189 -2
  184. package/dist/domain/storageTable/index.d.ts +189 -2
  185. package/dist/domain/storageTable/index.js +395 -1
  186. package/dist/domain/storageTable/index.js.map +1 -0
  187. package/dist/editor/index.cjs +3 -4
  188. package/dist/editor/index.d.cts +2 -4
  189. package/dist/editor/index.d.ts +2 -4
  190. package/dist/editor/index.js +3 -4
  191. package/dist/editor/types.d.cts +1 -1
  192. package/dist/editor/types.d.ts +1 -1
  193. package/dist/{emitter-dLF1Fyfg.d.ts → emitter-raKkIqRp.d.cts} +1 -3
  194. package/dist/{emitter-dLF1Fyfg.d.cts → emitter-raKkIqRp.d.ts} +1 -3
  195. package/dist/encryption/index.cjs +2 -3
  196. package/dist/encryption/index.d.cts +1 -1
  197. package/dist/encryption/index.d.ts +1 -1
  198. package/dist/encryption/index.js +2 -3
  199. package/dist/encryption/types.d.cts +1 -1
  200. package/dist/encryption/types.d.ts +1 -1
  201. package/dist/generateUUID-DE9sNyJF.js +5 -0
  202. package/dist/{generateUUID-Dr8l-aoc.js.map → generateUUID-DE9sNyJF.js.map} +1 -1
  203. package/dist/{generateUUID-C6qKBPIv.cjs → generateUUID-DbSTmvVP.cjs} +2 -3
  204. package/dist/{generateUUID-C6qKBPIv.cjs.map → generateUUID-DbSTmvVP.cjs.map} +1 -1
  205. package/dist/import/index.cjs +1 -1
  206. package/dist/import/index.d.cts +3 -5
  207. package/dist/import/index.d.ts +3 -5
  208. package/dist/import/index.js +1 -2
  209. package/dist/{import-BahNYv91.cjs → import-CABlFMQX.cjs} +6 -9
  210. package/dist/{import-BahNYv91.cjs.map → import-CABlFMQX.cjs.map} +1 -1
  211. package/dist/{import-FWy_wQZ1.js → import-CT1Ce5Rp.js} +6 -9
  212. package/dist/{import-FWy_wQZ1.js.map → import-CT1Ce5Rp.js.map} +1 -1
  213. package/dist/index-24GpnYhn.d.cts +150 -0
  214. package/dist/{index-BT88-GpA.d.ts → index-AA3MRfRn.d.cts} +4 -16
  215. package/dist/{index-C6oPUTWZ.d.ts → index-BDPxm9qu.d.ts} +3 -7
  216. package/dist/index-BUZ-vTRt.d.ts +150 -0
  217. package/dist/{index-XcnkRVb0.d.ts → index-BZDxWvZW.d.ts} +5 -7
  218. package/dist/index-BfAcp7O2.d.ts +10 -0
  219. package/dist/index-BsT_cBJd.d.ts +15117 -0
  220. package/dist/index-C1ndNdrN.d.cts +10 -0
  221. package/dist/{index-BiZR9BjN.d.ts → index-CbSh3KFw.d.cts} +4 -12
  222. package/dist/{index-BM_fXKq5.d.cts → index-ClIV2Lch.d.cts} +5 -7
  223. package/dist/{index-DReKz9Zt.d.ts → index-CuI8OI9E.d.ts} +4 -13
  224. package/dist/{index-BPMr8PQJ.d.ts → index-D1mduJne.d.cts} +2 -52
  225. package/dist/{index-CL4iKFic.d.cts → index-D1mduJne.d.ts} +1 -51
  226. package/dist/{index-DorowSay.d.ts → index-DIPMzH--.d.ts} +5 -9
  227. package/dist/{index-CbZQCDkD.d.cts → index-DQagqTVa.d.cts} +3 -7
  228. package/dist/{index-dgu6udMy.d.ts → index-DVBQgFg0.d.ts} +4 -6
  229. package/dist/{index-CrrHvDiX.d.cts → index-Day1Yr5s.d.ts} +8 -7
  230. package/dist/{index-Dkb8CynB.d.cts → index-Db266tLz.d.cts} +5 -9
  231. package/dist/{index-BVjhAkXW.d.cts → index-DgGpQsAT.d.cts} +4 -6
  232. package/dist/{index-PqJGDHHl.d.cts → index-DjSthn8d.d.ts} +4 -16
  233. package/dist/{index-DhZTIejy.d.ts → index-lTrNMlj6.d.ts} +3 -5
  234. package/dist/{index-DYNVbgm8.d.cts → index-m9-mN8Gg.d.ts} +4 -12
  235. package/dist/index-qJ2IjXIM.d.cts +15117 -0
  236. package/dist/{index-CtQl-Iqw.d.cts → index-xX8-Stoq.d.cts} +4 -13
  237. package/dist/{index-D6JMbJ9b.d.ts → index-xhzuWloV.d.cts} +8 -7
  238. package/dist/{index-DGKCTQkb.d.cts → index-z-2okomN.d.cts} +3 -5
  239. package/dist/index.cjs +433 -1055
  240. package/dist/index.cjs.map +1 -1
  241. package/dist/index.d.cts +9 -8
  242. package/dist/index.d.ts +9 -8
  243. package/dist/index.js +429 -1052
  244. package/dist/index.js.map +1 -1
  245. package/dist/{isLoginPageRedirect-r0Opgc1n.cjs → isLoginPageRedirect-CoUxJi2x.cjs} +3 -4
  246. package/dist/{isLoginPageRedirect-r0Opgc1n.cjs.map → isLoginPageRedirect-CoUxJi2x.cjs.map} +1 -1
  247. package/dist/{isLoginPageRedirect-B4QKSiSa.js → isLoginPageRedirect-D-lqF_kZ.js} +3 -4
  248. package/dist/{isLoginPageRedirect-B4QKSiSa.js.map → isLoginPageRedirect-D-lqF_kZ.js.map} +1 -1
  249. package/dist/{isPlainObject-LYW-03uB.js → isPlainObject-BxsT8_t2.js} +2 -3
  250. package/dist/{isPlainObject-LYW-03uB.js.map → isPlainObject-BxsT8_t2.js.map} +1 -1
  251. package/dist/{isPlainObject-BB3iy87C.cjs → isPlainObject-CcvQt0qB.cjs} +2 -3
  252. package/dist/{isPlainObject-BB3iy87C.cjs.map → isPlainObject-CcvQt0qB.cjs.map} +1 -1
  253. package/dist/kaiAgent/index.cjs +1 -1
  254. package/dist/kaiAgent/index.d.cts +2 -2
  255. package/dist/kaiAgent/index.d.ts +2 -2
  256. package/dist/kaiAgent/index.js +1 -2
  257. package/dist/kaiAgent/types.d.cts +1 -1
  258. package/dist/kaiAgent/types.d.ts +1 -1
  259. package/dist/{kaiAgent-N2qbUFZm.cjs → kaiAgent-CDhg0MAw.cjs} +16 -7
  260. package/dist/kaiAgent-CDhg0MAw.cjs.map +1 -0
  261. package/dist/{kaiAgent-CYvrS8oZ.js → kaiAgent-CYU1Uda8.js} +16 -7
  262. package/dist/kaiAgent-CYU1Uda8.js.map +1 -0
  263. package/dist/{kaiMemory-Qch09f-m.cjs → kaiMemory-CkLQfJXD.cjs} +6 -9
  264. package/dist/{kaiMemory-Qch09f-m.cjs.map → kaiMemory-CkLQfJXD.cjs.map} +1 -1
  265. package/dist/{kaiMemory-C9di17bd.js → kaiMemory-oir_qCo_.js} +6 -9
  266. package/dist/{kaiMemory-C9di17bd.js.map → kaiMemory-oir_qCo_.js.map} +1 -1
  267. package/dist/management/index.cjs +1 -1
  268. package/dist/management/index.d.cts +1 -1
  269. package/dist/management/index.d.ts +1 -1
  270. package/dist/management/index.js +1 -2
  271. package/dist/management/types.cjs +1 -2
  272. package/dist/management/types.d.cts +2 -2
  273. package/dist/management/types.d.ts +2 -2
  274. package/dist/management/types.js +1 -2
  275. package/dist/{management-B1o6RpKF.cjs → management-BEGOEQxM.cjs} +26 -45
  276. package/dist/management-BEGOEQxM.cjs.map +1 -0
  277. package/dist/{management-C9w3DNhs.js → management-BcGHyxAP.js} +26 -45
  278. package/dist/management-BcGHyxAP.js.map +1 -0
  279. package/dist/metastore/index.cjs +1 -1
  280. package/dist/metastore/index.d.cts +1 -1
  281. package/dist/metastore/index.d.ts +1 -1
  282. package/dist/metastore/index.js +1 -2
  283. package/dist/metastore/types.d.cts +1 -1
  284. package/dist/metastore/types.d.ts +1 -1
  285. package/dist/{metastore-Ywq08DBz.js → metastore-CGsgxjng.js} +7 -10
  286. package/dist/{metastore-Ywq08DBz.js.map → metastore-CGsgxjng.js.map} +1 -1
  287. package/dist/{metastore-BXHg33ku.cjs → metastore-DeRQ2VIv.cjs} +7 -10
  288. package/dist/{metastore-BXHg33ku.cjs.map → metastore-DeRQ2VIv.cjs.map} +1 -1
  289. package/dist/microsoftGraph/index.cjs +5 -8
  290. package/dist/microsoftGraph/index.cjs.map +1 -1
  291. package/dist/microsoftGraph/index.d.cts +3 -7
  292. package/dist/microsoftGraph/index.d.ts +3 -7
  293. package/dist/microsoftGraph/index.js +5 -8
  294. package/dist/microsoftGraph/index.js.map +1 -1
  295. package/dist/microsoftGraph/types.d.cts +2 -4
  296. package/dist/microsoftGraph/types.d.ts +2 -4
  297. package/dist/{middleware-GOfx8Apu.js → middleware-8zaJWcyU.js} +3 -5
  298. package/dist/middleware-8zaJWcyU.js.map +1 -0
  299. package/dist/{middleware-CEP6uu_D.cjs → middleware-B9RNuLfD.cjs} +3 -5
  300. package/dist/middleware-B9RNuLfD.cjs.map +1 -0
  301. package/dist/notifications/index.cjs +5 -6
  302. package/dist/notifications/index.d.cts +2 -4
  303. package/dist/notifications/index.d.ts +2 -4
  304. package/dist/notifications/index.js +5 -6
  305. package/dist/notifications/types.d.cts +1 -1
  306. package/dist/notifications/types.d.ts +1 -1
  307. package/dist/oauth/index.cjs +1 -1
  308. package/dist/oauth/index.d.cts +2 -4
  309. package/dist/oauth/index.d.ts +2 -4
  310. package/dist/oauth/index.js +1 -2
  311. package/dist/oauth/types.d.cts +1 -1
  312. package/dist/oauth/types.d.ts +1 -1
  313. package/dist/{oauth-DKZPuUlt.cjs → oauth-B5Biqz21.cjs} +7 -9
  314. package/dist/{oauth-DKZPuUlt.cjs.map → oauth-B5Biqz21.cjs.map} +1 -1
  315. package/dist/{oauth-GXmZ9agP.js → oauth-ByCdISsV.js} +7 -9
  316. package/dist/{oauth-GXmZ9agP.js.map → oauth-ByCdISsV.js.map} +1 -1
  317. package/dist/omnisearch/index.cjs +3 -4
  318. package/dist/omnisearch/index.d.cts +2 -4
  319. package/dist/omnisearch/index.d.ts +2 -4
  320. package/dist/omnisearch/index.js +3 -4
  321. package/dist/omnisearch/types.d.cts +1 -1
  322. package/dist/omnisearch/types.d.ts +1 -1
  323. package/dist/{project-ClH22nzH.js → project-DmuC0bMK.js} +6 -9
  324. package/dist/{project-ClH22nzH.js.map → project-DmuC0bMK.js.map} +1 -1
  325. package/dist/{project-Rh4nXiWh.cjs → project-Onf-IcPW.cjs} +9 -12
  326. package/dist/{project-Rh4nXiWh.cjs.map → project-Onf-IcPW.cjs.map} +1 -1
  327. package/dist/{project-DTfBtIJs.d.ts → project-UHZGFmmG.d.cts} +5 -9
  328. package/dist/{project-vOnvjo80.d.cts → project-iBm4cIIR.d.ts} +5 -9
  329. package/dist/queryService/index.cjs +1 -1
  330. package/dist/queryService/index.d.cts +1 -1
  331. package/dist/queryService/index.d.ts +1 -1
  332. package/dist/queryService/index.js +1 -2
  333. package/dist/queryService/types.d.cts +1 -1
  334. package/dist/queryService/types.d.ts +1 -1
  335. package/dist/{queryService-CzK53q94.cjs → queryService-Cg-eMysa.cjs} +9 -11
  336. package/dist/{queryService-CzK53q94.cjs.map → queryService-Cg-eMysa.cjs.map} +1 -1
  337. package/dist/{queryService-C-pZha5p.js → queryService-x8kq8Z2-.js} +9 -11
  338. package/dist/{queryService-C-pZha5p.js.map → queryService-x8kq8Z2-.js.map} +1 -1
  339. package/dist/queue/index.cjs +1 -1
  340. package/dist/queue/index.d.cts +4 -5
  341. package/dist/queue/index.d.ts +4 -5
  342. package/dist/queue/index.js +1 -2
  343. package/dist/queue/types.d.cts +1 -1
  344. package/dist/queue/types.d.ts +1 -1
  345. package/dist/{queue-D6-x4OGF.js → queue-BiIs9fX4.js} +9 -11
  346. package/dist/{queue-D6-x4OGF.js.map → queue-BiIs9fX4.js.map} +1 -1
  347. package/dist/{queue-BJvDWriM.cjs → queue-CBi9Q8vp.cjs} +9 -11
  348. package/dist/{queue-BJvDWriM.cjs.map → queue-CBi9Q8vp.cjs.map} +1 -1
  349. package/dist/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
  350. package/dist/scheduler/index.cjs +5 -6
  351. package/dist/scheduler/index.d.cts +2 -4
  352. package/dist/scheduler/index.d.ts +2 -4
  353. package/dist/scheduler/index.js +5 -6
  354. package/dist/scheduler/types.d.cts +1 -1
  355. package/dist/scheduler/types.d.ts +1 -1
  356. package/dist/{schema-BUyMwQnM.d.cts → schema-DLmBEgPM.d.cts} +1 -3
  357. package/dist/{schema-BUyMwQnM.d.ts → schema-DLmBEgPM.d.ts} +1 -3
  358. package/dist/schemaGuidedMerge-C8CqrNGe.cjs +55 -0
  359. package/dist/schemaGuidedMerge-C8CqrNGe.cjs.map +1 -0
  360. package/dist/schemaGuidedMerge-DFNqj9Nz.js +44 -0
  361. package/dist/schemaGuidedMerge-DFNqj9Nz.js.map +1 -0
  362. package/dist/sdk/configurations/index.cjs +634 -2
  363. package/dist/sdk/configurations/index.cjs.map +1 -0
  364. package/dist/sdk/configurations/index.d.cts +1030 -4
  365. package/dist/sdk/configurations/index.d.ts +1030 -4
  366. package/dist/sdk/configurations/index.js +633 -1
  367. package/dist/sdk/configurations/index.js.map +1 -0
  368. package/dist/sdk/developerPortal/index.cjs +9 -13
  369. package/dist/sdk/developerPortal/index.cjs.map +1 -1
  370. package/dist/sdk/developerPortal/index.d.cts +4 -6
  371. package/dist/sdk/developerPortal/index.d.ts +4 -6
  372. package/dist/sdk/developerPortal/index.js +9 -13
  373. package/dist/sdk/developerPortal/index.js.map +1 -1
  374. package/dist/sdk/kaiMemory/index.cjs +1 -1
  375. package/dist/sdk/kaiMemory/index.d.cts +1 -3
  376. package/dist/sdk/kaiMemory/index.d.ts +1 -3
  377. package/dist/sdk/kaiMemory/index.js +1 -2
  378. package/dist/sdk/kaiMemory/types.d.cts +1 -1
  379. package/dist/sdk/kaiMemory/types.d.ts +1 -1
  380. package/dist/sdk/queryService/index.cjs +3 -4
  381. package/dist/sdk/queryService/index.d.cts +1 -1
  382. package/dist/sdk/queryService/index.d.ts +1 -1
  383. package/dist/sdk/queryService/index.js +3 -4
  384. package/dist/sdk/semanticLayer/index.cjs +1 -1
  385. package/dist/sdk/semanticLayer/index.d.cts +1 -7
  386. package/dist/sdk/semanticLayer/index.d.ts +1 -7
  387. package/dist/sdk/semanticLayer/index.js +1 -2
  388. package/dist/sdk/semanticLayer/types.d.cts +1 -1
  389. package/dist/sdk/semanticLayer/types.d.ts +1 -1
  390. package/dist/sdk/storage/index.cjs +3 -6
  391. package/dist/sdk/storage/index.cjs.map +1 -1
  392. package/dist/sdk/storage/index.d.cts +0 -6
  393. package/dist/sdk/storage/index.d.ts +0 -6
  394. package/dist/sdk/storage/index.js +3 -6
  395. package/dist/sdk/storage/index.js.map +1 -1
  396. package/dist/sdk/tag/index.cjs +1 -1
  397. package/dist/sdk/tag/index.d.cts +3 -5
  398. package/dist/sdk/tag/index.d.ts +3 -5
  399. package/dist/sdk/tag/index.js +1 -2
  400. package/dist/sdk/tag/types.d.cts +1 -1
  401. package/dist/sdk/tag/types.d.ts +1 -1
  402. package/dist/sdk/vault/index.cjs +3 -5
  403. package/dist/sdk/vault/index.cjs.map +1 -1
  404. package/dist/sdk/vault/index.d.cts +1 -1
  405. package/dist/sdk/vault/index.d.ts +1 -1
  406. package/dist/sdk/vault/index.js +3 -5
  407. package/dist/sdk/vault/index.js.map +1 -1
  408. package/dist/{semanticLayer-DvjS_nzo.js → semanticLayer-BdPW_wLo.js} +9 -14
  409. package/dist/{semanticLayer-DvjS_nzo.js.map → semanticLayer-BdPW_wLo.js.map} +1 -1
  410. package/dist/{semanticLayer-7BejcMj_.cjs → semanticLayer-djom-J78.cjs} +9 -14
  411. package/dist/{semanticLayer-7BejcMj_.cjs.map → semanticLayer-djom-J78.cjs.map} +1 -1
  412. package/dist/status/index.cjs +2 -3
  413. package/dist/status/index.d.cts +1 -3
  414. package/dist/status/index.d.ts +1 -3
  415. package/dist/status/index.js +2 -3
  416. package/dist/status/types.d.cts +0 -2
  417. package/dist/status/types.d.ts +0 -2
  418. package/dist/storage/index.cjs +9 -9
  419. package/dist/storage/index.d.cts +3 -2
  420. package/dist/storage/index.d.ts +3 -2
  421. package/dist/storage/index.js +9 -9
  422. package/dist/storage/types.d.cts +6 -6
  423. package/dist/storage/types.d.ts +6 -6
  424. package/dist/{storage-CChfKlrb.js → storage-BpOLWT6h.js} +54 -89
  425. package/dist/{storage-CChfKlrb.js.map → storage-BpOLWT6h.js.map} +1 -1
  426. package/dist/{storage-Ci9gXgcw.cjs → storage-KJ5Ki_ma.cjs} +53 -88
  427. package/dist/{storage-Ci9gXgcw.cjs.map → storage-KJ5Ki_ma.cjs.map} +1 -1
  428. package/dist/{store-xS-Cu_VS.cjs → store-2OyH1XOP.cjs} +3 -5
  429. package/dist/{store-xS-Cu_VS.cjs.map → store-2OyH1XOP.cjs.map} +1 -1
  430. package/dist/{store-C9FQCHGe.js → store-HP0zRcLz.js} +3 -5
  431. package/dist/{store-C9FQCHGe.js.map → store-HP0zRcLz.js.map} +1 -1
  432. package/dist/stream/index.cjs +4 -5
  433. package/dist/stream/index.d.cts +2 -4
  434. package/dist/stream/index.d.ts +2 -4
  435. package/dist/stream/index.js +4 -5
  436. package/dist/stream/types.d.cts +1 -1
  437. package/dist/stream/types.d.ts +1 -1
  438. package/dist/{suggestions-BH3x7xU7.d.ts → suggestions-xhIjrlvi.d.cts} +1 -3
  439. package/dist/{suggestions-BH3x7xU7.d.cts → suggestions-xhIjrlvi.d.ts} +1 -3
  440. package/dist/syncActions/index.cjs +1 -1
  441. package/dist/syncActions/index.d.cts +2 -2
  442. package/dist/syncActions/index.d.ts +2 -2
  443. package/dist/syncActions/index.js +1 -2
  444. package/dist/syncActions/types.d.cts +2 -2
  445. package/dist/syncActions/types.d.ts +2 -2
  446. package/dist/{syncActions-C1rE4R3f.cjs → syncActions-BcX3jm2E.cjs} +74 -187
  447. package/dist/syncActions-BcX3jm2E.cjs.map +1 -0
  448. package/dist/{syncActions-DM8vP7p3.js → syncActions-giPLTfje.js} +73 -186
  449. package/dist/syncActions-giPLTfje.js.map +1 -0
  450. package/dist/{tag-DHS_soa7.cjs → tag-A5z4tJn1.cjs} +5 -7
  451. package/dist/{tag-DHS_soa7.cjs.map → tag-A5z4tJn1.cjs.map} +1 -1
  452. package/dist/{tag-hh-1nhNr.js → tag-BwjbG3tT.js} +5 -7
  453. package/dist/{tag-hh-1nhNr.js.map → tag-BwjbG3tT.js.map} +1 -1
  454. package/dist/telemetry/index.cjs +4 -5
  455. package/dist/telemetry/index.d.cts +2 -4
  456. package/dist/telemetry/index.d.ts +2 -4
  457. package/dist/telemetry/index.js +4 -5
  458. package/dist/telemetry/types.d.cts +1 -1
  459. package/dist/telemetry/types.d.ts +1 -1
  460. package/dist/{transientRetries-B4iusp69.js → transientRetries-BKqmb85B.js} +13 -22
  461. package/dist/{transientRetries-B4iusp69.js.map → transientRetries-BKqmb85B.js.map} +1 -1
  462. package/dist/{transientRetries-DdJfH9QK.cjs → transientRetries-CM7rAEXQ.cjs} +13 -22
  463. package/dist/{transientRetries-DdJfH9QK.cjs.map → transientRetries-CM7rAEXQ.cjs.map} +1 -1
  464. package/dist/{types-DODAZKEm.d.ts → types--Rp5wvaz.d.ts} +2 -6
  465. package/dist/{types-JZ0Bdlpk.d.cts → types-1IBnjBVJ.d.cts} +2 -6
  466. package/dist/{types-BZ--6pIt.d.ts → types-37vwxse4.d.cts} +2 -6
  467. package/dist/{types-RogkWzOu.d.ts → types-6T04_qUf.d.ts} +2 -6
  468. package/dist/{types-TmrPVMhy.d.cts → types-B0e-no6u.d.ts} +18 -38
  469. package/dist/{types-ptynVnkv.d.cts → types-B1qe1etN.d.cts} +3 -7
  470. package/dist/{types-BXybSjn-.d.ts → types-B3ri-iiC.d.ts} +2 -26
  471. package/dist/{types-Duurgaqk.d.cts → types-B8k1DqlU.d.ts} +129 -10
  472. package/dist/{types-BOT6TgOS.d.ts → types-BE8abIig.d.cts} +2 -6
  473. package/dist/{types-BrpIEj_N.d.ts → types-BWMOK6eL.d.cts} +2 -6
  474. package/dist/{types-D53zBV25.d.ts → types-Bat0SIZA.d.cts} +16 -97
  475. package/dist/{types-Dy6EdWPG.d.ts → types-Bdl7EFMc.d.ts} +2 -6
  476. package/dist/{types-_zKX6JmD.d.ts → types-BiDdBXSm.d.ts} +2 -8
  477. package/dist/{types-dn6MHur3.d.cts → types-BrEVh0WE.d.cts} +253 -10
  478. package/dist/{types-BnmsuDfH.d.cts → types-BuclMPeY.d.cts} +2 -26
  479. package/dist/{types-302-NBaU.d.ts → types-C9okze_R.d.ts} +3 -7
  480. package/dist/{types-BT5e9TSQ.d.ts → types-CPWjRdnj.d.cts} +18 -38
  481. package/dist/{types-C614wC5h.d.cts → types-CRubbBcU.d.cts} +2 -6
  482. package/dist/{types-DlhNay1n.d.ts → types-CWcdaq-K.d.ts} +2 -6
  483. package/dist/{types-D9ZKJYZk.d.ts → types-CcGp6O3B.d.cts} +3 -7
  484. package/dist/{types-45O2dU2w.d.ts → types-Cr5lyI99.d.ts} +2 -6
  485. package/dist/{types-CY8X39qv.d.cts → types-CxEJ77m3.d.cts} +3 -7
  486. package/dist/{types-DmzSFOhK.d.cts → types-D-tJt0hQ.d.cts} +2 -6
  487. package/dist/{types-BjwbzqJd.d.ts → types-D6lre27s.d.ts} +2 -8
  488. package/dist/{types-0R9-osUJ.d.ts → types-DHMxPJZq.d.cts} +2 -6
  489. package/dist/{types-jN2KmMet.d.cts → types-DJzTVMu1.d.ts} +2 -6
  490. package/dist/{types-CfXqFz2e.d.ts → types-DKSUG2dZ.d.ts} +253 -10
  491. package/dist/{types-CpJhWBmH.d.cts → types-DNgazFnF.d.cts} +2 -8
  492. package/dist/{types-DjadPty5.d.ts → types-DRCttnIN.d.ts} +2 -6
  493. package/dist/{types-CeqZuOEC.d.ts → types-DUpVIuk7.d.ts} +2 -6
  494. package/dist/{types-DqOxIujY.d.ts → types-DeyXJzWz.d.cts} +2 -6
  495. package/dist/{types-O6XM48J8.d.cts → types-Dryq2GGE.d.cts} +2 -6
  496. package/dist/{types-CjNl7O7f.d.cts → types-DschSZHf.d.cts} +3 -5
  497. package/dist/{types-BUirSne-.d.ts → types-DtOfhDzz.d.ts} +3 -5
  498. package/dist/{types-CkJxMoTk.d.cts → types-Du5o-tud.d.ts} +16 -97
  499. package/dist/{types-ChLWY8aU.d.cts → types-DwbTiyhZ.d.cts} +2 -6
  500. package/dist/{types-HmK8iKp5.d.cts → types-E8tzafsk.d.cts} +3 -7
  501. package/dist/{types-DpbrGDRf.d.cts → types-LconaX98.d.cts} +2 -6
  502. package/dist/{types-tdIo5FpR.d.ts → types-PZzNANiS.d.cts} +129 -10
  503. package/dist/{types-CTS2NSIb.d.cts → types-YpOm4yXE.d.cts} +2 -8
  504. package/dist/{types-DbXV0g8U.d.cts → types-ZZwdKCBl.d.ts} +2 -6
  505. package/dist/{types-jfPoUlO8.d.cts → types-eFi8xJIM.d.cts} +2 -6
  506. package/dist/{types-DV7K07oX.d.cts → types-inG9y3dP.d.ts} +2 -6
  507. package/dist/{types-BM6rri7-.d.ts → types-ir7T2a9a.d.ts} +3 -7
  508. package/dist/{types-BAsYMltG.d.cts → types-jjOulnni.d.ts} +2 -6
  509. package/dist/{types-vvw_H7wp.d.cts → types-wYrC2boT.d.ts} +3 -7
  510. package/dist/{types-BWzt1ju_.d.ts → types-xzt_2H63.d.ts} +3 -7
  511. package/dist/{types-D2Pb_4FA.d.cts → types-zPY-XGnM.d.ts} +2 -6
  512. package/dist/{validateConnectionStatus-BalWEyRk.cjs → validateConnectionStatus-BjemGI1e.cjs} +5 -7
  513. package/dist/{validateConnectionStatus-BalWEyRk.cjs.map → validateConnectionStatus-BjemGI1e.cjs.map} +1 -1
  514. package/dist/{validateConnectionStatus-DyrYpn0G.js → validateConnectionStatus-DYwWeWVo.js} +5 -7
  515. package/dist/{validateConnectionStatus-DyrYpn0G.js.map → validateConnectionStatus-DYwWeWVo.js.map} +1 -1
  516. package/dist/vault/index.cjs +7 -8
  517. package/dist/vault/index.d.cts +1 -1
  518. package/dist/vault/index.d.ts +1 -1
  519. package/dist/vault/index.js +7 -8
  520. package/dist/vault/types.d.cts +1 -1
  521. package/dist/vault/types.d.ts +1 -1
  522. package/package.json +7 -7
  523. package/surface/apps.md +12 -10
  524. package/surface/chat.md +1 -1
  525. package/surface/dataScience.md +1 -1
  526. package/surface/editor.md +5 -5
  527. package/surface/kaiAgent.md +5 -4
  528. package/surface/management.md +1 -1
  529. package/surface/queue.md +3 -3
  530. package/surface/sdk.md +0 -6
  531. package/surface/stack.md +11 -0
  532. package/surface/storage.md +2 -2
  533. package/surface/stream.md +6 -6
  534. package/surface/syncActions.md +1 -2
  535. package/dist/configurations-B44z6BSO.js +0 -718
  536. package/dist/configurations-B44z6BSO.js.map +0 -1
  537. package/dist/configurations-CL0ouUMa.js.map +0 -1
  538. package/dist/configurations-D9J3jh3g.cjs.map +0 -1
  539. package/dist/configurations-Dkxsa3Uf.cjs +0 -735
  540. package/dist/configurations-Dkxsa3Uf.cjs.map +0 -1
  541. package/dist/constants-DErcRkWl.cjs.map +0 -1
  542. package/dist/constants-VpSwBtCb.js.map +0 -1
  543. package/dist/createGenericFetchClient-CQdNcPC3.js +0 -7
  544. package/dist/createOpenapiFetchClient-DXiMv9WL.js +0 -7
  545. package/dist/generateUUID-Dr8l-aoc.js +0 -6
  546. package/dist/index-Be2dNJ_N.d.cts +0 -23582
  547. package/dist/index-BfqkgPGI.d.cts +0 -34
  548. package/dist/index-BfqkgPGI.d.ts +0 -34
  549. package/dist/index-fMoM8SeH.d.cts +0 -199
  550. package/dist/index-fMoM8SeH.d.ts +0 -199
  551. package/dist/index-uGRdAORl.d.ts +0 -23582
  552. package/dist/kaiAgent-CYvrS8oZ.js.map +0 -1
  553. package/dist/kaiAgent-N2qbUFZm.cjs.map +0 -1
  554. package/dist/management-B1o6RpKF.cjs.map +0 -1
  555. package/dist/management-C9w3DNhs.js.map +0 -1
  556. package/dist/middleware-CEP6uu_D.cjs.map +0 -1
  557. package/dist/middleware-GOfx8Apu.js.map +0 -1
  558. package/dist/storageTable-BNOR2FCh.cjs +0 -442
  559. package/dist/storageTable-BNOR2FCh.cjs.map +0 -1
  560. package/dist/storageTable-BldTNyEk.js +0 -395
  561. package/dist/storageTable-BldTNyEk.js.map +0 -1
  562. package/dist/syncActions-C1rE4R3f.cjs.map +0 -1
  563. package/dist/syncActions-DM8vP7p3.js.map +0 -1
  564. package/surface/context.md +0 -40
@@ -1 +1 @@
1
- {"version":3,"file":"transientRetries-B4iusp69.js","names":[],"sources":["../src/utils/async/delay.ts","../src/utils/async/lazy.ts","../src/utils/async/result.ts","../src/utils/async/poll/utils.ts","../src/utils/async/poll/backoff.ts","../src/utils/async/poll/pollLoop.ts","../src/utils/async/poll/poll.ts","../src/domain/jobStatus.ts","../src/clients/transientRetries.ts"],"sourcesContent":["import { createAbortError } from '../createAbortError';\n\nexport const delay = (timeout: number, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal?.aborted) return reject(createAbortError(signal.reason));\n\n const onAbort = () => {\n clearTimeout(timeoutId);\n reject(createAbortError(signal?.reason));\n };\n\n // `once: true` only detaches the listener once the event fires, so the timeout path has to\n // detach it explicitly — a caller reusing one signal across many delays (`poll` does) would\n // otherwise pile up a listener per delay for as long as the signal is alive.\n const timeoutId = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n","import type { TaskFn } from './types';\n\n/**\n * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\n */\nexport const lazy = <T>(task: TaskFn<T>): (() => Promise<Awaited<T>>) => {\n let value: Promise<Awaited<T>> | null = null;\n\n // async wrapper so a synchronous throw from `task` rejects rather than throws.\n const runTask = async (): Promise<Awaited<T>> => await task();\n\n return () => {\n value ??= runTask().catch((error: unknown) => {\n value = null;\n throw error;\n });\n return value;\n };\n};\n","export type Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<R>) =>\n (...args: A): Result<R> =>\n tryCatch(() => fn(...args));\n\nconst fromThrowableAsync =\n <A extends unknown[], R>(fn: (...args: A) => R | PromiseLike<R>) =>\n (...args: A): Promise<Result<R>> =>\n tryCatchAsync(() => fn(...args));\n\nexport const Result = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\n","/**\n * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,\n * about 24.9 days.\n *\n * - Above it the delay wraps: Node warns and fires after 1 ms, so a long wait becomes a busy loop.\n * - It bounds a backoff curve and a poll's timeout alike, since both end up in a timer.\n */\nexport const MAX_TIMER_DELAY = 2 ** 31 - 1;\n\nexport const clamp = (value: number, min: number, max = Infinity) =>\n Math.min(Math.max(value, min), max);\n\nexport const finiteOr = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\n\n/** A signal that never aborts, so an input nobody gave costs no branch of its own. */\nexport const neverAborts = () => new AbortController().signal;\n","import { clamp, finiteOr, MAX_TIMER_DELAY } from './utils';\n\nexport type Jitter =\n | 'none' // delay\n | 'full' // [0, delay)\n | 'equal'; // [delay / 2, delay)\n\ntype Backoff =\n | { type: 'constant'; interval: number } // 3000, 3000, 3000, ...\n | { type: 'linear'; initialInterval: number; step: number } // 1000, 2000, 3000, …\n | { type: 'exponential'; initialInterval: number; factor?: number }; // 1000, 2000, 4000, 8000, …\n\ntype RandomFn = () => number;\ntype JitterFn = (delay: number) => number;\ntype BackoffFn = (attempt: number) => number;\n\nexport type BackoffDef = {\n jitter?: Jitter;\n maxInterval?: number;\n random?: RandomFn;\n} & Backoff;\n\nconst MIN_STEP = 500;\nconst MIN_FACTOR = 2;\nconst MIN_INTERVAL = 500;\n\nexport const createBackoff = ({\n jitter = 'none',\n maxInterval: _maxInterval = MAX_TIMER_DELAY,\n random = Math.random,\n ...backoff\n}: BackoffDef): BackoffFn => {\n const backoffFn: BackoffFn = (attempt) => {\n if (backoff.type === 'linear') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const step = clamp(finiteOr(backoff.step, MIN_STEP), MIN_STEP);\n\n return interval + step * (attempt - 1);\n }\n if (backoff.type === 'exponential') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const factor = clamp(finiteOr(backoff.factor ?? MIN_FACTOR, MIN_FACTOR), MIN_FACTOR);\n\n return interval * factor ** (attempt - 1);\n }\n\n return clamp(finiteOr(backoff.interval, MIN_INTERVAL), MIN_INTERVAL);\n };\n\n const jitterFn: JitterFn = (delay) => {\n if (jitter === 'none') return delay;\n if (jitter === 'full') return delay * random();\n return delay / 2 + (delay / 2) * random(); // equal\n };\n\n const maxInterval = clamp(finiteOr(_maxInterval, MAX_TIMER_DELAY), MIN_INTERVAL, MAX_TIMER_DELAY);\n return (_attempt) => {\n const attempt = clamp(finiteOr(Math.trunc(_attempt), 1), 1);\n const capped = Math.min(backoffFn(attempt), maxInterval);\n // Floored after the jitter, not before: `full` jitter multiplies by a random fraction, so a floor\n // applied to the curve alone leaves sub-millisecond gaps between attempts.\n return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);\n };\n};\n","import { delay } from '../delay';\nimport { Result } from '../result';\n\nimport { type BackoffDef, createBackoff } from './backoff';\nimport { clamp, finiteOr, MAX_TIMER_DELAY, neverAborts } from './utils';\n\ntype Clock = {\n wait: (ms: number, signal?: AbortSignal) => Promise<void>;\n now: () => number;\n};\n\nexport type PollContext = {\n attempt: number;\n elapsed: number;\n};\n\n/** The context plus the answer it is about: what `until` decides on, and what an ending reports. */\nexport type PollTick<T> = PollContext & { last: T | null };\n\nexport type PollResultState = 'done' | 'timedOut' | 'exhausted' | 'aborted' | 'errored';\n\nexport type PollResult<T> = PollTick<T> &\n (\n | { state: 'done'; data: T }\n | { state: 'timedOut' | 'exhausted'; error?: Error }\n | { state: 'aborted'; reason?: unknown }\n | { state: 'errored'; error: Error }\n );\n\nexport type PollOptions<T> = {\n pollFn: (context: PollContext & { signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T> & { data: T }) => boolean;\n signal?: AbortSignal;\n backoff?: BackoffDef;\n isRetryable?: (error: Error) => boolean;\n maxAttempts?: number;\n timeout?: number;\n clock?: Clock;\n};\n\n/** One constructor per ending, so a result is built the same way wherever a poll ends. */\nexport const pollResult = {\n done: <T>(data: T, context: PollTick<T>): PollResult<T> => ({\n state: 'done',\n data,\n ...context,\n last: data,\n }),\n errored: <T>(error: Error, context: PollTick<T>): PollResult<T> => ({\n state: 'errored',\n error,\n ...context,\n }),\n exhausted: <T>(context: PollTick<T>, error?: Error): PollResult<T> => ({\n state: 'exhausted',\n error,\n ...context,\n }),\n timedOut: <T>(context: PollTick<T>, error?: Error): PollResult<T> => ({\n state: 'timedOut',\n error,\n ...context,\n }),\n aborted: <T>(context: PollTick<T>, reason: unknown): PollResult<T> => ({\n state: 'aborted',\n reason,\n ...context,\n }),\n};\n\nexport const pollLoop = async <T>({\n pollFn: _pollFn,\n until: _until,\n signal: callerSignal = neverAborts(),\n backoff: backoffDef = { type: 'constant', interval: 3000 },\n clock = { wait: (ms, signal) => delay(ms, signal), now: () => performance.now() },\n isRetryable: _isRetryable = () => false,\n maxAttempts: _maxAttempts = Infinity,\n timeout: _timeout = Infinity,\n}: PollOptions<T>): Promise<PollResult<T>> => {\n // A deadline ends up in a timer, so a finite one is bounded by what a timer can hold. `Infinity`\n // is answered before the clamp: it means no deadline, and clamping would make it the longest one.\n const requested = finiteOr(_timeout, Infinity);\n const timeout = requested === Infinity ? Infinity : clamp(requested, 0, MAX_TIMER_DELAY);\n const maxAttempts = Math.trunc(clamp(finiteOr(_maxAttempts, Infinity), 0));\n\n const timeoutSignal = timeout === Infinity ? neverAborts() : AbortSignal.timeout(timeout);\n const anySignal = AbortSignal.any([callerSignal, timeoutSignal]);\n const anyAborted = Promise.withResolvers<never>();\n\n anySignal.addEventListener('abort', () => anyAborted.reject(anySignal.reason), {\n once: true,\n });\n void anyAborted.promise.catch(() => undefined);\n\n const backoffFn = createBackoff(backoffDef);\n const startedAt = clock.now();\n\n const until = Result.fromThrowable(_until);\n const isRetryable = Result.fromThrowable(_isRetryable);\n // Only what the context declares: a request is not handed the tick's `last` as well.\n const pollFn = ({ attempt: at, elapsed }: PollContext) =>\n Result.tryCatchAsync(() =>\n Promise.race([_pollFn({ attempt: at, elapsed, signal: anySignal }), anyAborted.promise]),\n );\n const sleep = Result.fromThrowableAsync((ms: number) => clock.wait(ms, anySignal));\n\n let attempt = 0;\n // What a retry swallowed: the poll carries it to whichever ending runs out first.\n let last: T | null = null;\n let lastError: Error | undefined;\n const context = (at = clock.now() - startedAt): PollTick<T> => ({\n attempt,\n elapsed: at,\n last,\n });\n\n if (attempt >= maxAttempts) return pollResult.exhausted<T>(context());\n\n while (true) {\n const before = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(before, lastError);\n if (callerSignal.aborted) return pollResult.aborted(before, callerSignal.reason);\n\n attempt++;\n // The attempt it is, not the one before it — `before` was read to decide whether to make it.\n const poll = await pollFn({ ...before, attempt });\n\n // What the attempt produced, recorded before the tick that reports it: on any ending but `done`\n // these two are the only account of what the poll saw, and reading them one attempt behind is\n // reading the wrong answer.\n if (poll.success) last = poll.data;\n else lastError = poll.error;\n\n const after = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(after, lastError);\n if (callerSignal.aborted) return pollResult.aborted(after, callerSignal.reason);\n\n if (!poll.success) {\n const canRetry = isRetryable(poll.error);\n\n // A predicate that throws cannot ask for a retry. The request's own failure stays the reported\n // one — it is the type a caller's guards expect — and the predicate's rides along as its cause.\n if (!canRetry.success) {\n poll.error.cause ??= canRetry.error;\n return pollResult.errored(poll.error, after);\n }\n if (!canRetry.data) return pollResult.errored(poll.error, after);\n }\n\n if (poll.success) {\n const isDone = until({ ...after, data: poll.data });\n if (!isDone.success) return pollResult.errored(isDone.error, after);\n if (isDone.data) return pollResult.done(poll.data, after);\n }\n\n // exhausted\n if (attempt >= maxAttempts) return pollResult.exhausted(after, lastError);\n\n // sleep\n const backoff = backoffFn(attempt);\n if (after.elapsed + backoff >= timeout) return pollResult.timedOut(after, lastError);\n\n const slept = await sleep(backoff);\n if (!slept.success) {\n const afterSleep = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(afterSleep, lastError);\n if (callerSignal.aborted) return pollResult.aborted(afterSleep, callerSignal.reason);\n\n return pollResult.errored(slept.error, afterSleep);\n }\n }\n};\n","import { createAbortError } from '../../createAbortError';\nimport { createEmitter, createStore } from '../../store';\nimport { lazy } from '../lazy';\nimport { Result } from '../result';\n\nimport {\n type PollContext,\n pollLoop,\n type PollOptions,\n type PollResult,\n pollResult,\n type PollResultState,\n type PollTick,\n} from './pollLoop';\nimport { neverAborts } from './utils';\n\nexport type PollKey = readonly unknown[];\n\n/** `requesting` is the request the poll starts from, before any attempt; `polling` is the attempts. */\nexport type PollState = 'idle' | 'requesting' | 'polling' | PollResultState;\nexport type PollSnapshot<T = unknown> = PollTick<T> & { pollKey: PollKey; state: PollState };\n\ntype OnFailure<T> = (result: PollResult<T>, error: Error) => Error | undefined;\n\nexport type Poller<T, S = T> = {\n readonly state: PollState;\n start: () => Promise<PollResult<T>>;\n wait: (onFailure?: OnFailure<T>) => Promise<S>;\n stop: (reason?: string) => void;\n subscribe: (listener: (snapshot: PollSnapshot<T>) => void) => () => void;\n debug: () => PollSnapshot<T>;\n};\n\ntype InitRequest<R> = (signal: AbortSignal) => Promise<R>;\n\nconst isRequest = <R>(init: R | InitRequest<R> | undefined): init is InitRequest<R> =>\n typeof init === 'function';\n\n/**\n * The loop's options plus what names the poll and what it starts from.\n *\n * - `pollKey` names the poll; the loop never sees it. Given as a function of `init`, it is what the\n * poll started from that names it, once that is known.\n * - `init` is a value or a request for it (an enqueue), handed to `pollFn`; a request runs first.\n * - `failed` reads a `done` value for `wait`: what it returns, `wait` throws. A client that\n * knows what gets through declares it as `Poller<T, S>` on its own return.\n */\nexport type PollerOptions<T, K extends PollKey = PollKey, R = undefined> = Omit<\n PollOptions<T>,\n 'pollFn' | 'until'\n> & {\n pollKey: K | ((init: R) => K);\n init?: R | InitRequest<R>;\n pollFn: (context: PollContext & { init: R; signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T> & { data: T }) => boolean;\n failed?: (data: T) => Error | undefined;\n};\n\nexport type ObservedPoller = Pick<Poller<unknown>, 'stop' | 'subscribe' | 'debug' | 'start'>;\n\nexport const emitter = createEmitter<ObservedPoller>();\n\nexport const failureOf = (result: PollResult<unknown>): Error => {\n if ('error' in result && result.error) return result.error;\n\n if (result.state === 'aborted') {\n if (result.reason instanceof Error) return result.reason;\n\n return createAbortError(\n typeof result.reason === 'string' ? result.reason : 'The poll was stopped.',\n );\n }\n\n return new Error(`The poll ${result.state} after ${result.attempt} attempts.`);\n};\n\nexport const poller = <T, K extends PollKey = PollKey, R = undefined>({\n pollKey,\n init,\n signal,\n pollFn,\n until,\n failed,\n ...pollLoopOptions\n}: PollerOptions<T, K, R>): Poller<T> => {\n const callerSignal = signal ?? neverAborts();\n const pollerSignal = new AbortController();\n const anySignal = AbortSignal.any([pollerSignal.signal, callerSignal]);\n\n const keyOf = (from: R) => (typeof pollKey === 'function' ? pollKey(from) : pollKey);\n // An absent `init` is the `undefined` that `R` defaults to, which the body cannot prove.\n const givenInit = (): R => init as R;\n\n // snapshoting; the key is unknown while a request for `init` is out, so it starts empty then\n const snapshot = createStore<PollSnapshot<T>>({\n pollKey: isRequest(init) ? [] : keyOf(givenInit()),\n state: 'idle',\n attempt: 0,\n elapsed: 0,\n last: null,\n });\n const updateSnapshot = (next: Partial<PollSnapshot<T>>) =>\n snapshot.set({ ...snapshot.get(), ...next });\n\n const handleUntil = (tick: PollTick<T> & { data: T }) => {\n updateSnapshot({ attempt: tick.attempt, elapsed: tick.elapsed, last: tick.data });\n return until(tick);\n };\n\n // The result knows what a tick cannot: attempts that failed, and the time the ending itself took.\n const settle = (result: PollResult<T>) => {\n updateSnapshot({\n state: result.state,\n attempt: result.attempt,\n elapsed: result.elapsed,\n last: result.last,\n });\n return result;\n };\n\n // The request runs under the poller's signal, before the first attempt. The poll's deadline\n // bounds the polling, not this request.\n const requestInit = (request: InitRequest<R>) => {\n updateSnapshot({ state: 'requesting' });\n\n return Result.tryCatchAsync(() => {\n anySignal.throwIfAborted();\n return request(anySignal);\n });\n };\n\n const now = () => pollLoopOptions.clock?.now() ?? performance.now();\n\n // How a poll ends when its request did: no attempt was made, and a stop reads as an abort.\n const endedBeforePolling = (error: Error, startedAt: number) => {\n const before: PollTick<T> = { attempt: 0, elapsed: now() - startedAt, last: null };\n\n return anySignal.aborted\n ? pollResult.aborted(before, anySignal.reason)\n : pollResult.errored(error, before);\n };\n\n const start = lazy(async (): Promise<PollResult<T>> => {\n let resolved = givenInit();\n if (isRequest(init)) {\n const startedAt = now();\n const requested = await requestInit(init);\n if (!requested.success) return settle(endedBeforePolling(requested.error, startedAt));\n resolved = requested.data;\n }\n updateSnapshot({ pollKey: keyOf(resolved), state: 'polling' });\n\n return settle(\n await pollLoop({\n ...pollLoopOptions,\n pollFn: (context) => pollFn({ ...context, init: resolved }),\n until: handleUntil,\n signal: anySignal,\n }),\n );\n });\n\n const stop = (reason?: string) => pollerSignal.abort(reason);\n const subscribe = (listener: (snapshot: PollSnapshot<T>) => void) =>\n snapshot.subscribe(() => listener(snapshot.get()));\n const debug = snapshot.get;\n\n const wait = async (onFailure?: OnFailure<T>) => {\n const result = await start();\n if (result.state === 'done') {\n const error = failed?.(result.data);\n if (!error) return result.data;\n throw onFailure?.(result, error) ?? error;\n }\n const error = failureOf(result);\n throw onFailure?.(result, error) ?? error;\n };\n\n const controls = {\n stop,\n subscribe,\n debug,\n start,\n };\n\n emitter.emit(controls);\n\n return {\n get state() {\n return snapshot.get().state;\n },\n wait,\n ...controls,\n };\n};\n","import type { QueryJobStatus } from '../clients/queryService/types';\nimport type { QueueJobStatus } from '../clients/queue/types';\nimport type { StorageJobStatus } from '../clients/storage/jobs/types';\n\n/**\n * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - The split mirrors the job's `isSuccess`; with a job in hand, read `job.isSuccess` instead.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\n */\nconst forService = <Status extends string>(groups: StatusGroups<Status>) => {\n const all = [...groups.running, ...groups.successful, ...groups.failed];\n\n const running: ReadonlySet<Status> = new Set(groups.running);\n const successful: ReadonlySet<Status> = new Set(groups.successful);\n const failed: ReadonlySet<Status> = new Set(groups.failed);\n const terminal: ReadonlySet<Status> = new Set([...groups.successful, ...groups.failed]);\n const known: ReadonlySet<string> = new Set<string>(all);\n\n return {\n isRunning: (status: Status) => running.has(status),\n isTerminal: (status: Status) => terminal.has(status),\n isSuccessful: (status: Status) => successful.has(status),\n isFailed: (status: Status) => failed.has(status),\n isKnown: (value: string): value is Status => known.has(value),\n describe: (status: Status) => ({\n isRunning: running.has(status),\n isTerminal: terminal.has(status),\n isSuccessful: successful.has(status),\n isFailed: failed.has(status),\n }),\n statuses: { running, successful, failed, terminal },\n named: Object.fromEntries(\n all.map((status) => [status.toUpperCase(), status]),\n ) as StatusNames<Status>,\n };\n};\n\n/**\n * Job statuses per service, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n","import { isApiError } from '../fetchClient';\n\nconst MAX_CONSECUTIVE_FAILURES = 5;\n\n// A read that failed in transit, or that the service answered with a 5xx or 429. The job runs\n// server-side either way, so a later read can still see it finish.\nconst isTransient = (error: Error) =>\n error instanceof TypeError ||\n (isApiError(error) && (error.response.status >= 500 || error.response.status === 429));\n\n/** A job poll's retry rule: a transient read is retried up to five times in a row; one that succeeds resets the count. */\nexport const transientRetries = () => {\n let failures = 0;\n\n return {\n reset: () => {\n failures = 0;\n },\n isRetryable: (error: Error) => isTransient(error) && ++failures < MAX_CONSECUTIVE_FAILURES,\n };\n};\n"],"mappings":";;;;AAEA,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAO,iBAAiB,OAAO,MAAM,CAAC;CAElE,MAAM,gBAAgB;EACpB,aAAa,SAAS;EACtB,OAAO,iBAAiB,QAAQ,MAAM,CAAC;CACzC;CAKA,MAAM,YAAY,iBAAiB;EACjC,QAAQ,oBAAoB,SAAS,OAAO;EAC5C,QAAQ;CACV,GAAG,OAAO;CAEV,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3D,CAAC;;;;;;;;;ACZH,MAAa,QAAW,SAAiD;CACvE,IAAI,QAAoC;CAGxC,MAAM,UAAU,YAAiC,MAAM,KAAK;CAE5D,aAAa;EACX,UAAU,QAAQ,CAAC,CAAC,OAAO,UAAmB;GAC5C,QAAQ;GACR,MAAM;EACR,CAAC;EACD,OAAO;CACT;AACF;;;ACbA,MAAa,WAAW,WACtB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AI,OAAO,UAAU;CACjE,MAAM,SAA8B,IAAI,IAAI,OAAO,MAAM;CACzD,MAAM,2BAAgC,IAAI,IAAI,CAAC,GAAG,OAAO,YAAY,GAAG,OAAO,MAAM,CAAC;CACtF,MAAM,QAA6B,IAAI,IAAY,GAAG;CAEtD,OAAO;EACL,YAAY,WAAmB,QAAQ,IAAI,MAAM;EACjD,aAAa,WAAmB,SAAS,IAAI,MAAM;EACnD,eAAe,WAAmB,WAAW,IAAI,MAAM;EACvD,WAAW,WAAmB,OAAO,IAAI,MAAM;EAC/C,UAAU,UAAmC,MAAM,IAAI,KAAK;EAC5D,WAAW,YAAoB;GAC7B,WAAW,QAAQ,IAAI,MAAM;GAC7B,YAAY,SAAS,IAAI,MAAM;GAC/B,cAAc,WAAW,IAAI,MAAM;GACnC,UAAU,OAAO,IAAI,MAAM;EAC7B;EACA,UAAU;GAAE;GAAS;GAAY;GAAQ;EAAS;EAClD,OAAO,OAAO,YACZ,IAAI,KAAK,WAAW,CAAC,OAAO,YAAY,GAAG,MAAM,CAAC,CACpD;CACF;AACF;;;;;;;AAQA,MAAa,YAAY;CACvB,SAAS,WAAW,OAAO;CAC3B,OAAO,WAAW,KAAK;CACvB,OAAO,WAAW,KAAK;AACzB;;;ACzFA,MAAM,2BAA2B;AAIjC,MAAM,eAAe,UACnB,iBAAiB,aAChB,WAAW,KAAK,MAAM,MAAM,SAAS,UAAU,OAAO,MAAM,SAAS,WAAW;;AAGnF,MAAa,yBAAyB;CACpC,IAAI,WAAW;CAEf,OAAO;EACL,aAAa;GACX,WAAW;EACb;EACA,cAAc,UAAiB,YAAY,KAAK,KAAK,EAAE,WAAW;CACpE;AACF"}
1
+ {"version":3,"file":"transientRetries-BKqmb85B.js","names":[],"sources":["../src/utils/async/delay.ts","../src/utils/async/lazy.ts","../src/utils/async/result.ts","../src/utils/async/poll/utils.ts","../src/utils/async/poll/backoff.ts","../src/utils/async/poll/pollLoop.ts","../src/utils/async/poll/poll.ts","../src/domain/jobStatus.ts","../src/clients/transientRetries.ts"],"sourcesContent":["import { createAbortError } from '../createAbortError';\n\nexport const delay = (timeout: number, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal?.aborted) return reject(createAbortError(signal.reason));\n\n const onAbort = () => {\n clearTimeout(timeoutId);\n reject(createAbortError(signal?.reason));\n };\n\n // `once: true` only detaches the listener once the event fires, so the timeout path has to\n // detach it explicitly — a caller reusing one signal across many delays (`poll` does) would\n // otherwise pile up a listener per delay for as long as the signal is alive.\n const timeoutId = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n","import type { TaskFn } from './types';\n\n/**\n * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\n */\nexport const lazy = <T>(task: TaskFn<T>): (() => Promise<Awaited<T>>) => {\n let value: Promise<Awaited<T>> | null = null;\n\n // async wrapper so a synchronous throw from `task` rejects rather than throws.\n const runTask = async (): Promise<Awaited<T>> => await task();\n\n return () => {\n value ??= runTask().catch((error: unknown) => {\n value = null;\n throw error;\n });\n return value;\n };\n};\n","export type Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<R>) =>\n (...args: A): Result<R> =>\n tryCatch(() => fn(...args));\n\nconst fromThrowableAsync =\n <A extends unknown[], R>(fn: (...args: A) => R | PromiseLike<R>) =>\n (...args: A): Promise<Result<R>> =>\n tryCatchAsync(() => fn(...args));\n\nexport const Result = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\n","/**\n * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,\n * about 24.9 days.\n *\n * - Above it the delay wraps: Node warns and fires after 1 ms, so a long wait becomes a busy loop.\n * - It bounds a backoff curve and a poll's timeout alike, since both end up in a timer.\n */\nexport const MAX_TIMER_DELAY = 2 ** 31 - 1;\n\nexport const clamp = (value: number, min: number, max = Infinity) =>\n Math.min(Math.max(value, min), max);\n\nexport const finiteOr = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\n\n/** A signal that never aborts, so an input nobody gave costs no branch of its own. */\nexport const neverAborts = () => new AbortController().signal;\n","import { clamp, finiteOr, MAX_TIMER_DELAY } from './utils';\n\nexport type Jitter =\n | 'none' // delay\n | 'full' // [0, delay)\n | 'equal'; // [delay / 2, delay)\n\ntype Backoff =\n | { type: 'constant'; interval: number } // 3000, 3000, 3000, ...\n | { type: 'linear'; initialInterval: number; step: number } // 1000, 2000, 3000, …\n | { type: 'exponential'; initialInterval: number; factor?: number }; // 1000, 2000, 4000, 8000, …\n\ntype RandomFn = () => number;\ntype JitterFn = (delay: number) => number;\ntype BackoffFn = (attempt: number) => number;\n\nexport type BackoffDef = {\n jitter?: Jitter;\n maxInterval?: number;\n random?: RandomFn;\n} & Backoff;\n\nconst MIN_STEP = 500;\nconst MIN_FACTOR = 2;\nconst MIN_INTERVAL = 500;\n\nexport const createBackoff = ({\n jitter = 'none',\n maxInterval: _maxInterval = MAX_TIMER_DELAY,\n random = Math.random,\n ...backoff\n}: BackoffDef): BackoffFn => {\n const backoffFn: BackoffFn = (attempt) => {\n if (backoff.type === 'linear') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const step = clamp(finiteOr(backoff.step, MIN_STEP), MIN_STEP);\n\n return interval + step * (attempt - 1);\n }\n if (backoff.type === 'exponential') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const factor = clamp(finiteOr(backoff.factor ?? MIN_FACTOR, MIN_FACTOR), MIN_FACTOR);\n\n return interval * factor ** (attempt - 1);\n }\n\n return clamp(finiteOr(backoff.interval, MIN_INTERVAL), MIN_INTERVAL);\n };\n\n const jitterFn: JitterFn = (delay) => {\n if (jitter === 'none') return delay;\n if (jitter === 'full') return delay * random();\n return delay / 2 + (delay / 2) * random(); // equal\n };\n\n const maxInterval = clamp(finiteOr(_maxInterval, MAX_TIMER_DELAY), MIN_INTERVAL, MAX_TIMER_DELAY);\n return (_attempt) => {\n const attempt = clamp(finiteOr(Math.trunc(_attempt), 1), 1);\n const capped = Math.min(backoffFn(attempt), maxInterval);\n // Floored after the jitter, not before: `full` jitter multiplies by a random fraction, so a floor\n // applied to the curve alone leaves sub-millisecond gaps between attempts.\n return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);\n };\n};\n","import { delay } from '../delay';\nimport { Result } from '../result';\n\nimport { type BackoffDef, createBackoff } from './backoff';\nimport { clamp, finiteOr, MAX_TIMER_DELAY, neverAborts } from './utils';\n\ntype Clock = {\n wait: (ms: number, signal?: AbortSignal) => Promise<void>;\n now: () => number;\n};\n\nexport type PollContext = {\n attempt: number;\n elapsed: number;\n};\n\n/** The context plus the answer it is about: what `until` decides on, and what an ending reports. */\nexport type PollTick<T> = PollContext & { last: T | null };\n\nexport type PollResultState = 'done' | 'timedOut' | 'exhausted' | 'aborted' | 'errored';\n\nexport type PollResult<T> = PollTick<T> &\n (\n | { state: 'done'; data: T }\n | { state: 'timedOut' | 'exhausted'; error?: Error }\n | { state: 'aborted'; reason?: unknown }\n | { state: 'errored'; error: Error }\n );\n\nexport type PollOptions<T> = {\n pollFn: (context: PollContext & { signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T> & { data: T }) => boolean;\n signal?: AbortSignal;\n backoff?: BackoffDef;\n isRetryable?: (error: Error) => boolean;\n maxAttempts?: number;\n timeout?: number;\n clock?: Clock;\n};\n\n/** One constructor per ending, so a result is built the same way wherever a poll ends. */\nexport const pollResult = {\n done: <T>(data: T, context: PollTick<T>): PollResult<T> => ({\n state: 'done',\n data,\n ...context,\n last: data,\n }),\n errored: <T>(error: Error, context: PollTick<T>): PollResult<T> => ({\n state: 'errored',\n error,\n ...context,\n }),\n exhausted: <T>(context: PollTick<T>, error?: Error): PollResult<T> => ({\n state: 'exhausted',\n error,\n ...context,\n }),\n timedOut: <T>(context: PollTick<T>, error?: Error): PollResult<T> => ({\n state: 'timedOut',\n error,\n ...context,\n }),\n aborted: <T>(context: PollTick<T>, reason: unknown): PollResult<T> => ({\n state: 'aborted',\n reason,\n ...context,\n }),\n};\n\nexport const pollLoop = async <T>({\n pollFn: _pollFn,\n until: _until,\n signal: callerSignal = neverAborts(),\n backoff: backoffDef = { type: 'constant', interval: 3000 },\n clock = { wait: (ms, signal) => delay(ms, signal), now: () => performance.now() },\n isRetryable: _isRetryable = () => false,\n maxAttempts: _maxAttempts = Infinity,\n timeout: _timeout = Infinity,\n}: PollOptions<T>): Promise<PollResult<T>> => {\n // A deadline ends up in a timer, so a finite one is bounded by what a timer can hold. `Infinity`\n // is answered before the clamp: it means no deadline, and clamping would make it the longest one.\n const requested = finiteOr(_timeout, Infinity);\n const timeout = requested === Infinity ? Infinity : clamp(requested, 0, MAX_TIMER_DELAY);\n const maxAttempts = Math.trunc(clamp(finiteOr(_maxAttempts, Infinity), 0));\n\n const timeoutSignal = timeout === Infinity ? neverAborts() : AbortSignal.timeout(timeout);\n const anySignal = AbortSignal.any([callerSignal, timeoutSignal]);\n const anyAborted = Promise.withResolvers<never>();\n\n anySignal.addEventListener('abort', () => anyAborted.reject(anySignal.reason), {\n once: true,\n });\n void anyAborted.promise.catch(() => undefined);\n\n const backoffFn = createBackoff(backoffDef);\n const startedAt = clock.now();\n\n const until = Result.fromThrowable(_until);\n const isRetryable = Result.fromThrowable(_isRetryable);\n // Only what the context declares: a request is not handed the tick's `last` as well.\n const pollFn = ({ attempt: at, elapsed }: PollContext) =>\n Result.tryCatchAsync(() =>\n Promise.race([_pollFn({ attempt: at, elapsed, signal: anySignal }), anyAborted.promise]),\n );\n const sleep = Result.fromThrowableAsync((ms: number) => clock.wait(ms, anySignal));\n\n let attempt = 0;\n // What a retry swallowed: the poll carries it to whichever ending runs out first.\n let last: T | null = null;\n let lastError: Error | undefined;\n const context = (at = clock.now() - startedAt): PollTick<T> => ({\n attempt,\n elapsed: at,\n last,\n });\n\n if (attempt >= maxAttempts) return pollResult.exhausted<T>(context());\n\n while (true) {\n const before = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(before, lastError);\n if (callerSignal.aborted) return pollResult.aborted(before, callerSignal.reason);\n\n attempt++;\n // The attempt it is, not the one before it — `before` was read to decide whether to make it.\n const poll = await pollFn({ ...before, attempt });\n\n // What the attempt produced, recorded before the tick that reports it: on any ending but `done`\n // these two are the only account of what the poll saw, and reading them one attempt behind is\n // reading the wrong answer.\n if (poll.success) last = poll.data;\n else lastError = poll.error;\n\n const after = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(after, lastError);\n if (callerSignal.aborted) return pollResult.aborted(after, callerSignal.reason);\n\n if (!poll.success) {\n const canRetry = isRetryable(poll.error);\n\n // A predicate that throws cannot ask for a retry. The request's own failure stays the reported\n // one — it is the type a caller's guards expect — and the predicate's rides along as its cause.\n if (!canRetry.success) {\n poll.error.cause ??= canRetry.error;\n return pollResult.errored(poll.error, after);\n }\n if (!canRetry.data) return pollResult.errored(poll.error, after);\n }\n\n if (poll.success) {\n const isDone = until({ ...after, data: poll.data });\n if (!isDone.success) return pollResult.errored(isDone.error, after);\n if (isDone.data) return pollResult.done(poll.data, after);\n }\n\n // exhausted\n if (attempt >= maxAttempts) return pollResult.exhausted(after, lastError);\n\n // sleep\n const backoff = backoffFn(attempt);\n if (after.elapsed + backoff >= timeout) return pollResult.timedOut(after, lastError);\n\n const slept = await sleep(backoff);\n if (!slept.success) {\n const afterSleep = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(afterSleep, lastError);\n if (callerSignal.aborted) return pollResult.aborted(afterSleep, callerSignal.reason);\n\n return pollResult.errored(slept.error, afterSleep);\n }\n }\n};\n","import { createAbortError } from '../../createAbortError';\nimport { createEmitter, createStore } from '../../store';\nimport { lazy } from '../lazy';\nimport { Result } from '../result';\n\nimport {\n type PollContext,\n pollLoop,\n type PollOptions,\n type PollResult,\n pollResult,\n type PollResultState,\n type PollTick,\n} from './pollLoop';\nimport { neverAborts } from './utils';\n\nexport type PollKey = readonly unknown[];\n\n/** `requesting` is the request the poll starts from, before any attempt; `polling` is the attempts. */\nexport type PollState = 'idle' | 'requesting' | 'polling' | PollResultState;\nexport type PollSnapshot<T = unknown> = PollTick<T> & { pollKey: PollKey; state: PollState };\n\ntype OnFailure<T> = (result: PollResult<T>, error: Error) => Error | undefined;\n\nexport type Poller<T, S = T> = {\n readonly state: PollState;\n start: () => Promise<PollResult<T>>;\n wait: (onFailure?: OnFailure<T>) => Promise<S>;\n stop: (reason?: string) => void;\n subscribe: (listener: (snapshot: PollSnapshot<T>) => void) => () => void;\n debug: () => PollSnapshot<T>;\n};\n\ntype InitRequest<R> = (signal: AbortSignal) => Promise<R>;\n\nconst isRequest = <R>(init: R | InitRequest<R> | undefined): init is InitRequest<R> =>\n typeof init === 'function';\n\n/**\n * The loop's options plus what names the poll and what it starts from.\n *\n * - `pollKey` names the poll; the loop never sees it. Given as a function of `init`, it is what the\n * poll started from that names it, once that is known.\n * - `init` is a value or a request for it (an enqueue), handed to `pollFn`; a request runs first.\n * - `failed` reads a `done` value for `wait`: what it returns, `wait` throws. A client that\n * knows what gets through declares it as `Poller<T, S>` on its own return.\n */\nexport type PollerOptions<T, K extends PollKey = PollKey, R = undefined> = Omit<\n PollOptions<T>,\n 'pollFn' | 'until'\n> & {\n pollKey: K | ((init: R) => K);\n init?: R | InitRequest<R>;\n pollFn: (context: PollContext & { init: R; signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T> & { data: T }) => boolean;\n failed?: (data: T) => Error | undefined;\n};\n\nexport type ObservedPoller = Pick<Poller<unknown>, 'stop' | 'subscribe' | 'debug' | 'start'>;\n\nexport const emitter = createEmitter<ObservedPoller>();\n\nexport const failureOf = (result: PollResult<unknown>): Error => {\n if ('error' in result && result.error) return result.error;\n\n if (result.state === 'aborted') {\n if (result.reason instanceof Error) return result.reason;\n\n return createAbortError(\n typeof result.reason === 'string' ? result.reason : 'The poll was stopped.',\n );\n }\n\n return new Error(`The poll ${result.state} after ${result.attempt} attempts.`);\n};\n\nexport const poller = <T, K extends PollKey = PollKey, R = undefined>({\n pollKey,\n init,\n signal,\n pollFn,\n until,\n failed,\n ...pollLoopOptions\n}: PollerOptions<T, K, R>): Poller<T> => {\n const callerSignal = signal ?? neverAborts();\n const pollerSignal = new AbortController();\n const anySignal = AbortSignal.any([pollerSignal.signal, callerSignal]);\n\n const keyOf = (from: R) => (typeof pollKey === 'function' ? pollKey(from) : pollKey);\n // An absent `init` is the `undefined` that `R` defaults to, which the body cannot prove.\n const givenInit = (): R => init as R;\n\n // snapshoting; the key is unknown while a request for `init` is out, so it starts empty then\n const snapshot = createStore<PollSnapshot<T>>({\n pollKey: isRequest(init) ? [] : keyOf(givenInit()),\n state: 'idle',\n attempt: 0,\n elapsed: 0,\n last: null,\n });\n const updateSnapshot = (next: Partial<PollSnapshot<T>>) =>\n snapshot.set({ ...snapshot.get(), ...next });\n\n const handleUntil = (tick: PollTick<T> & { data: T }) => {\n updateSnapshot({ attempt: tick.attempt, elapsed: tick.elapsed, last: tick.data });\n return until(tick);\n };\n\n // The result knows what a tick cannot: attempts that failed, and the time the ending itself took.\n const settle = (result: PollResult<T>) => {\n updateSnapshot({\n state: result.state,\n attempt: result.attempt,\n elapsed: result.elapsed,\n last: result.last,\n });\n return result;\n };\n\n // The request runs under the poller's signal, before the first attempt. The poll's deadline\n // bounds the polling, not this request.\n const requestInit = (request: InitRequest<R>) => {\n updateSnapshot({ state: 'requesting' });\n\n return Result.tryCatchAsync(() => {\n anySignal.throwIfAborted();\n return request(anySignal);\n });\n };\n\n const now = () => pollLoopOptions.clock?.now() ?? performance.now();\n\n // How a poll ends when its request did: no attempt was made, and a stop reads as an abort.\n const endedBeforePolling = (error: Error, startedAt: number) => {\n const before: PollTick<T> = { attempt: 0, elapsed: now() - startedAt, last: null };\n\n return anySignal.aborted\n ? pollResult.aborted(before, anySignal.reason)\n : pollResult.errored(error, before);\n };\n\n const start = lazy(async (): Promise<PollResult<T>> => {\n let resolved = givenInit();\n if (isRequest(init)) {\n const startedAt = now();\n const requested = await requestInit(init);\n if (!requested.success) return settle(endedBeforePolling(requested.error, startedAt));\n resolved = requested.data;\n }\n updateSnapshot({ pollKey: keyOf(resolved), state: 'polling' });\n\n return settle(\n await pollLoop({\n ...pollLoopOptions,\n pollFn: (context) => pollFn({ ...context, init: resolved }),\n until: handleUntil,\n signal: anySignal,\n }),\n );\n });\n\n const stop = (reason?: string) => pollerSignal.abort(reason);\n const subscribe = (listener: (snapshot: PollSnapshot<T>) => void) =>\n snapshot.subscribe(() => listener(snapshot.get()));\n const debug = snapshot.get;\n\n const wait = async (onFailure?: OnFailure<T>) => {\n const result = await start();\n if (result.state === 'done') {\n const error = failed?.(result.data);\n if (!error) return result.data;\n throw onFailure?.(result, error) ?? error;\n }\n const error = failureOf(result);\n throw onFailure?.(result, error) ?? error;\n };\n\n const controls = {\n stop,\n subscribe,\n debug,\n start,\n };\n\n emitter.emit(controls);\n\n return {\n get state() {\n return snapshot.get().state;\n },\n wait,\n ...controls,\n };\n};\n","import type { QueryJobStatus } from '../clients/queryService/types';\nimport type { QueueJobStatus } from '../clients/queue/types';\nimport type { StorageJobStatus } from '../clients/storage/jobs/types';\n\n/**\n * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - The split mirrors the job's `isSuccess`; with a job in hand, read `job.isSuccess` instead.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\n */\nconst forService = <Status extends string>(groups: StatusGroups<Status>) => {\n const all = [...groups.running, ...groups.successful, ...groups.failed];\n\n const running: ReadonlySet<Status> = new Set(groups.running);\n const successful: ReadonlySet<Status> = new Set(groups.successful);\n const failed: ReadonlySet<Status> = new Set(groups.failed);\n const terminal: ReadonlySet<Status> = new Set([...groups.successful, ...groups.failed]);\n const known: ReadonlySet<string> = new Set<string>(all);\n\n return {\n isRunning: (status: Status) => running.has(status),\n isTerminal: (status: Status) => terminal.has(status),\n isSuccessful: (status: Status) => successful.has(status),\n isFailed: (status: Status) => failed.has(status),\n isKnown: (value: string): value is Status => known.has(value),\n describe: (status: Status) => ({\n isRunning: running.has(status),\n isTerminal: terminal.has(status),\n isSuccessful: successful.has(status),\n isFailed: failed.has(status),\n }),\n statuses: { running, successful, failed, terminal },\n named: Object.fromEntries(\n all.map((status) => [status.toUpperCase(), status]),\n ) as StatusNames<Status>,\n };\n};\n\n/**\n * Job statuses per service, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n","import { isApiError } from '../fetchClient';\n\nconst MAX_CONSECUTIVE_FAILURES = 5;\n\n// A read that failed in transit, or that the service answered with a 5xx or 429. The job runs\n// server-side either way, so a later read can still see it finish.\nconst isTransient = (error: Error) =>\n error instanceof TypeError ||\n (isApiError(error) && (error.response.status >= 500 || error.response.status === 429));\n\n/** A job poll's retry rule: a transient read is retried up to five times in a row; one that succeeds resets the count. */\nexport const transientRetries = () => {\n let failures = 0;\n\n return {\n reset: () => {\n failures = 0;\n },\n isRetryable: (error: Error) => isTransient(error) && ++failures < MAX_CONSECUTIVE_FAILURES,\n };\n};\n"],"mappings":";;;;AAEA,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAO,iBAAiB,OAAO,MAAM,CAAC;CAElE,MAAM,gBAAgB;EACpB,aAAa,SAAS;EACtB,OAAO,iBAAiB,QAAQ,MAAM,CAAC;CACzC;CAKA,MAAM,YAAY,iBAAiB;EACjC,QAAQ,oBAAoB,SAAS,OAAO;EAC5C,QAAQ;CACV,GAAG,OAAO;CAEV,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3D,CAAC;;;;;;;;ACZH,MAAa,QAAW,SAAiD;CACvE,IAAI,QAAoC;CAGxC,MAAM,UAAU,YAAiC,MAAM,KAAK;CAE5D,aAAa;EACX,UAAU,QAAQ,CAAC,CAAC,OAAO,UAAmB;GAC5C,QAAQ;GACR,MAAM;EACR,CAAC;EACD,OAAO;CACT;AACF;;ACbA,MAAa,WAAW,WACtB,kBAAkB,QAAQ,SAAS,IAAI,MAAM,OAAO,MAAM,GAAG,EAAE,OAAO,OAAO,CA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IAAI,IAAI,CAAC,GAAG,OAAO,YAAY,GAAG,OAAO,MAAM,CAAC;CACtF,MAAM,QAA6B,IAAI,IAAY,GAAG;CAEtD,OAAO;EACL,YAAY,WAAmB,QAAQ,IAAI,MAAM;EACjD,aAAa,WAAmB,SAAS,IAAI,MAAM;EACnD,eAAe,WAAmB,WAAW,IAAI,MAAM;EACvD,WAAW,WAAmB,OAAO,IAAI,MAAM;EAC/C,UAAU,UAAmC,MAAM,IAAI,KAAK;EAC5D,WAAW,YAAoB;GAC7B,WAAW,QAAQ,IAAI,MAAM;GAC7B,YAAY,SAAS,IAAI,MAAM;GAC/B,cAAc,WAAW,IAAI,MAAM;GACnC,UAAU,OAAO,IAAI,MAAM;EAC7B;EACA,UAAU;GAAE;GAAS;GAAY;GAAQ;EAAS;EAClD,OAAO,OAAO,YACZ,IAAI,KAAK,WAAW,CAAC,OAAO,YAAY,GAAG,MAAM,CAAC,CACpD;CACF;AACF;;;;;;;AAQA,MAAa,YAAY;CACvB,SAAS,WAAW,OAAO;CAC3B,OAAO,WAAW,KAAK;CACvB,OAAO,WAAW,KAAK;AACzB;;ACzFA,MAAM,2BAA2B;AAIjC,MAAM,eAAe,UACnB,iBAAiB,aAChB,WAAW,KAAK,MAAM,MAAM,SAAS,UAAU,OAAO,MAAM,SAAS,WAAW;;AAGnF,MAAa,yBAAyB;CACpC,IAAI,WAAW;CAEf,OAAO;EACL,aAAa;GACX,WAAW;EACb;EACA,cAAc,UAAiB,YAAY,KAAK,KAAK,EAAE,WAAW;CACpE;AACF"}
@@ -1,7 +1,7 @@
1
- const require_createAbortError = require("./createAbortError-RendOpo7.cjs");
2
- const require_store = require("./store-xS-Cu_VS.cjs");
3
- const require_createFetchClient = require("./createFetchClient-lZ_93Yrb.cjs");
4
- //#region src/utils/async/delay.ts
1
+ const require_createFetchClient = require("./createFetchClient-DEkUH662.cjs");
2
+ const require_createAbortError = require("./createAbortError-Dzc9yObN.cjs");
3
+ const require_store = require("./store-2OyH1XOP.cjs");
4
+ // src/utils/async/delay.ts
5
5
  const delay = (timeout, signal) => new Promise((resolve, reject) => {
6
6
  if (signal?.aborted) return reject(require_createAbortError.createAbortError(signal.reason));
7
7
  const onAbort = () => {
@@ -14,8 +14,7 @@ const delay = (timeout, signal) => new Promise((resolve, reject) => {
14
14
  }, timeout);
15
15
  signal?.addEventListener("abort", onAbort, { once: true });
16
16
  });
17
- //#endregion
18
- //#region src/utils/async/lazy.ts
17
+ // src/utils/async/lazy.ts
19
18
  /**
20
19
  * Runs `task` once and replays its promise to every later caller.
21
20
  *
@@ -33,8 +32,7 @@ const lazy = (task) => {
33
32
  return value;
34
33
  };
35
34
  };
36
- //#endregion
37
- //#region src/utils/async/result.ts
35
+ // src/utils/async/result.ts
38
36
  const asError = (thrown) => thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });
39
37
  const success = (data) => ({
40
38
  success: true,
@@ -92,8 +90,7 @@ const Result = {
92
90
  fromThrowable,
93
91
  fromThrowableAsync
94
92
  };
95
- //#endregion
96
- //#region src/utils/async/poll/utils.ts
93
+ // src/utils/async/poll/utils.ts
97
94
  /**
98
95
  * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,
99
96
  * about 24.9 days.
@@ -106,8 +103,7 @@ const clamp = (value, min, max = Infinity) => Math.min(Math.max(value, min), max
106
103
  const finiteOr = (value, fallback) => Number.isFinite(value) ? value : fallback;
107
104
  /** A signal that never aborts, so an input nobody gave costs no branch of its own. */
108
105
  const neverAborts = () => new AbortController().signal;
109
- //#endregion
110
- //#region src/utils/async/poll/backoff.ts
106
+ // src/utils/async/poll/backoff.ts
111
107
  const MIN_STEP = 500;
112
108
  const MIN_FACTOR = 2;
113
109
  const MIN_INTERVAL = 500;
@@ -129,8 +125,7 @@ const createBackoff = ({ jitter = "none", maxInterval: _maxInterval = MAX_TIMER_
129
125
  return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);
130
126
  };
131
127
  };
132
- //#endregion
133
- //#region src/utils/async/poll/pollLoop.ts
128
+ // src/utils/async/poll/pollLoop.ts
134
129
  /** One constructor per ending, so a result is built the same way wherever a poll ends. */
135
130
  const pollResult = {
136
131
  done: (data, context) => ({
@@ -236,8 +231,7 @@ const pollLoop = async ({ pollFn: _pollFn, until: _until, signal: callerSignal =
236
231
  }
237
232
  }
238
233
  };
239
- //#endregion
240
- //#region src/utils/async/poll/poll.ts
234
+ // src/utils/async/poll/poll.ts
241
235
  const isRequest = (init) => typeof init === "function";
242
236
  const emitter = require_store.createEmitter();
243
237
  const failureOf = (result) => {
@@ -348,8 +342,7 @@ const poller = ({ pollKey, init, signal, pollFn, until, failed, ...pollLoopOptio
348
342
  ...controls
349
343
  };
350
344
  };
351
- //#endregion
352
- //#region src/domain/jobStatus.ts
345
+ // src/domain/jobStatus.ts
353
346
  const STORAGE = {
354
347
  running: ["waiting", "processing"],
355
348
  successful: ["success"],
@@ -434,8 +427,7 @@ const jobStatus = {
434
427
  queue: forService(QUEUE),
435
428
  query: forService(QUERY)
436
429
  };
437
- //#endregion
438
- //#region src/clients/transientRetries.ts
430
+ // src/clients/transientRetries.ts
439
431
  const MAX_CONSECUTIVE_FAILURES = 5;
440
432
  const isTransient = (error) => error instanceof TypeError || require_createFetchClient.isApiError(error) && (error.response.status >= 500 || error.response.status === 429);
441
433
  /** A job poll's retry rule: a transient read is retried up to five times in a row; one that succeeds resets the count. */
@@ -448,7 +440,6 @@ const transientRetries = () => {
448
440
  isRetryable: (error) => isTransient(error) && ++failures < MAX_CONSECUTIVE_FAILURES
449
441
  };
450
442
  };
451
- //#endregion
452
443
  Object.defineProperty(exports, "Result", {
453
444
  enumerable: true,
454
445
  get: function() {
@@ -516,4 +507,4 @@ Object.defineProperty(exports, "transientRetries", {
516
507
  }
517
508
  });
518
509
 
519
- //# sourceMappingURL=transientRetries-DdJfH9QK.cjs.map
510
+ //# sourceMappingURL=transientRetries-CM7rAEXQ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"transientRetries-DdJfH9QK.cjs","names":["createAbortError","createEmitter","createAbortError","createStore","isApiError"],"sources":["../src/utils/async/delay.ts","../src/utils/async/lazy.ts","../src/utils/async/result.ts","../src/utils/async/poll/utils.ts","../src/utils/async/poll/backoff.ts","../src/utils/async/poll/pollLoop.ts","../src/utils/async/poll/poll.ts","../src/domain/jobStatus.ts","../src/clients/transientRetries.ts"],"sourcesContent":["import { createAbortError } from '../createAbortError';\n\nexport const delay = (timeout: number, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal?.aborted) return reject(createAbortError(signal.reason));\n\n const onAbort = () => {\n clearTimeout(timeoutId);\n reject(createAbortError(signal?.reason));\n };\n\n // `once: true` only detaches the listener once the event fires, so the timeout path has to\n // detach it explicitly — a caller reusing one signal across many delays (`poll` does) would\n // otherwise pile up a listener per delay for as long as the signal is alive.\n const timeoutId = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n","import type { TaskFn } from './types';\n\n/**\n * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\n */\nexport const lazy = <T>(task: TaskFn<T>): (() => Promise<Awaited<T>>) => {\n let value: Promise<Awaited<T>> | null = null;\n\n // async wrapper so a synchronous throw from `task` rejects rather than throws.\n const runTask = async (): Promise<Awaited<T>> => await task();\n\n return () => {\n value ??= runTask().catch((error: unknown) => {\n value = null;\n throw error;\n });\n return value;\n };\n};\n","export type Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<R>) =>\n (...args: A): Result<R> =>\n tryCatch(() => fn(...args));\n\nconst fromThrowableAsync =\n <A extends unknown[], R>(fn: (...args: A) => R | PromiseLike<R>) =>\n (...args: A): Promise<Result<R>> =>\n tryCatchAsync(() => fn(...args));\n\nexport const Result = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\n","/**\n * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,\n * about 24.9 days.\n *\n * - Above it the delay wraps: Node warns and fires after 1 ms, so a long wait becomes a busy loop.\n * - It bounds a backoff curve and a poll's timeout alike, since both end up in a timer.\n */\nexport const MAX_TIMER_DELAY = 2 ** 31 - 1;\n\nexport const clamp = (value: number, min: number, max = Infinity) =>\n Math.min(Math.max(value, min), max);\n\nexport const finiteOr = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\n\n/** A signal that never aborts, so an input nobody gave costs no branch of its own. */\nexport const neverAborts = () => new AbortController().signal;\n","import { clamp, finiteOr, MAX_TIMER_DELAY } from './utils';\n\nexport type Jitter =\n | 'none' // delay\n | 'full' // [0, delay)\n | 'equal'; // [delay / 2, delay)\n\ntype Backoff =\n | { type: 'constant'; interval: number } // 3000, 3000, 3000, ...\n | { type: 'linear'; initialInterval: number; step: number } // 1000, 2000, 3000, …\n | { type: 'exponential'; initialInterval: number; factor?: number }; // 1000, 2000, 4000, 8000, …\n\ntype RandomFn = () => number;\ntype JitterFn = (delay: number) => number;\ntype BackoffFn = (attempt: number) => number;\n\nexport type BackoffDef = {\n jitter?: Jitter;\n maxInterval?: number;\n random?: RandomFn;\n} & Backoff;\n\nconst MIN_STEP = 500;\nconst MIN_FACTOR = 2;\nconst MIN_INTERVAL = 500;\n\nexport const createBackoff = ({\n jitter = 'none',\n maxInterval: _maxInterval = MAX_TIMER_DELAY,\n random = Math.random,\n ...backoff\n}: BackoffDef): BackoffFn => {\n const backoffFn: BackoffFn = (attempt) => {\n if (backoff.type === 'linear') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const step = clamp(finiteOr(backoff.step, MIN_STEP), MIN_STEP);\n\n return interval + step * (attempt - 1);\n }\n if (backoff.type === 'exponential') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const factor = clamp(finiteOr(backoff.factor ?? MIN_FACTOR, MIN_FACTOR), MIN_FACTOR);\n\n return interval * factor ** (attempt - 1);\n }\n\n return clamp(finiteOr(backoff.interval, MIN_INTERVAL), MIN_INTERVAL);\n };\n\n const jitterFn: JitterFn = (delay) => {\n if (jitter === 'none') return delay;\n if (jitter === 'full') return delay * random();\n return delay / 2 + (delay / 2) * random(); // equal\n };\n\n const maxInterval = clamp(finiteOr(_maxInterval, MAX_TIMER_DELAY), MIN_INTERVAL, MAX_TIMER_DELAY);\n return (_attempt) => {\n const attempt = clamp(finiteOr(Math.trunc(_attempt), 1), 1);\n const capped = Math.min(backoffFn(attempt), maxInterval);\n // Floored after the jitter, not before: `full` jitter multiplies by a random fraction, so a floor\n // applied to the curve alone leaves sub-millisecond gaps between attempts.\n return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);\n };\n};\n","import { delay } from '../delay';\nimport { Result } from '../result';\n\nimport { type BackoffDef, createBackoff } from './backoff';\nimport { clamp, finiteOr, MAX_TIMER_DELAY, neverAborts } from './utils';\n\ntype Clock = {\n wait: (ms: number, signal?: AbortSignal) => Promise<void>;\n now: () => number;\n};\n\nexport type PollContext = {\n attempt: number;\n elapsed: number;\n};\n\n/** The context plus the answer it is about: what `until` decides on, and what an ending reports. */\nexport type PollTick<T> = PollContext & { last: T | null };\n\nexport type PollResultState = 'done' | 'timedOut' | 'exhausted' | 'aborted' | 'errored';\n\nexport type PollResult<T> = PollTick<T> &\n (\n | { state: 'done'; data: T }\n | { state: 'timedOut' | 'exhausted'; error?: Error }\n | { state: 'aborted'; reason?: unknown }\n | { state: 'errored'; error: Error }\n );\n\nexport type PollOptions<T> = {\n pollFn: (context: PollContext & { signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T> & { data: T }) => boolean;\n signal?: AbortSignal;\n backoff?: BackoffDef;\n isRetryable?: (error: Error) => boolean;\n maxAttempts?: number;\n timeout?: number;\n clock?: Clock;\n};\n\n/** One constructor per ending, so a result is built the same way wherever a poll ends. */\nexport const pollResult = {\n done: <T>(data: T, context: PollTick<T>): PollResult<T> => ({\n state: 'done',\n data,\n ...context,\n last: data,\n }),\n errored: <T>(error: Error, context: PollTick<T>): PollResult<T> => ({\n state: 'errored',\n error,\n ...context,\n }),\n exhausted: <T>(context: PollTick<T>, error?: Error): PollResult<T> => ({\n state: 'exhausted',\n error,\n ...context,\n }),\n timedOut: <T>(context: PollTick<T>, error?: Error): PollResult<T> => ({\n state: 'timedOut',\n error,\n ...context,\n }),\n aborted: <T>(context: PollTick<T>, reason: unknown): PollResult<T> => ({\n state: 'aborted',\n reason,\n ...context,\n }),\n};\n\nexport const pollLoop = async <T>({\n pollFn: _pollFn,\n until: _until,\n signal: callerSignal = neverAborts(),\n backoff: backoffDef = { type: 'constant', interval: 3000 },\n clock = { wait: (ms, signal) => delay(ms, signal), now: () => performance.now() },\n isRetryable: _isRetryable = () => false,\n maxAttempts: _maxAttempts = Infinity,\n timeout: _timeout = Infinity,\n}: PollOptions<T>): Promise<PollResult<T>> => {\n // A deadline ends up in a timer, so a finite one is bounded by what a timer can hold. `Infinity`\n // is answered before the clamp: it means no deadline, and clamping would make it the longest one.\n const requested = finiteOr(_timeout, Infinity);\n const timeout = requested === Infinity ? Infinity : clamp(requested, 0, MAX_TIMER_DELAY);\n const maxAttempts = Math.trunc(clamp(finiteOr(_maxAttempts, Infinity), 0));\n\n const timeoutSignal = timeout === Infinity ? neverAborts() : AbortSignal.timeout(timeout);\n const anySignal = AbortSignal.any([callerSignal, timeoutSignal]);\n const anyAborted = Promise.withResolvers<never>();\n\n anySignal.addEventListener('abort', () => anyAborted.reject(anySignal.reason), {\n once: true,\n });\n void anyAborted.promise.catch(() => undefined);\n\n const backoffFn = createBackoff(backoffDef);\n const startedAt = clock.now();\n\n const until = Result.fromThrowable(_until);\n const isRetryable = Result.fromThrowable(_isRetryable);\n // Only what the context declares: a request is not handed the tick's `last` as well.\n const pollFn = ({ attempt: at, elapsed }: PollContext) =>\n Result.tryCatchAsync(() =>\n Promise.race([_pollFn({ attempt: at, elapsed, signal: anySignal }), anyAborted.promise]),\n );\n const sleep = Result.fromThrowableAsync((ms: number) => clock.wait(ms, anySignal));\n\n let attempt = 0;\n // What a retry swallowed: the poll carries it to whichever ending runs out first.\n let last: T | null = null;\n let lastError: Error | undefined;\n const context = (at = clock.now() - startedAt): PollTick<T> => ({\n attempt,\n elapsed: at,\n last,\n });\n\n if (attempt >= maxAttempts) return pollResult.exhausted<T>(context());\n\n while (true) {\n const before = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(before, lastError);\n if (callerSignal.aborted) return pollResult.aborted(before, callerSignal.reason);\n\n attempt++;\n // The attempt it is, not the one before it — `before` was read to decide whether to make it.\n const poll = await pollFn({ ...before, attempt });\n\n // What the attempt produced, recorded before the tick that reports it: on any ending but `done`\n // these two are the only account of what the poll saw, and reading them one attempt behind is\n // reading the wrong answer.\n if (poll.success) last = poll.data;\n else lastError = poll.error;\n\n const after = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(after, lastError);\n if (callerSignal.aborted) return pollResult.aborted(after, callerSignal.reason);\n\n if (!poll.success) {\n const canRetry = isRetryable(poll.error);\n\n // A predicate that throws cannot ask for a retry. The request's own failure stays the reported\n // one — it is the type a caller's guards expect — and the predicate's rides along as its cause.\n if (!canRetry.success) {\n poll.error.cause ??= canRetry.error;\n return pollResult.errored(poll.error, after);\n }\n if (!canRetry.data) return pollResult.errored(poll.error, after);\n }\n\n if (poll.success) {\n const isDone = until({ ...after, data: poll.data });\n if (!isDone.success) return pollResult.errored(isDone.error, after);\n if (isDone.data) return pollResult.done(poll.data, after);\n }\n\n // exhausted\n if (attempt >= maxAttempts) return pollResult.exhausted(after, lastError);\n\n // sleep\n const backoff = backoffFn(attempt);\n if (after.elapsed + backoff >= timeout) return pollResult.timedOut(after, lastError);\n\n const slept = await sleep(backoff);\n if (!slept.success) {\n const afterSleep = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(afterSleep, lastError);\n if (callerSignal.aborted) return pollResult.aborted(afterSleep, callerSignal.reason);\n\n return pollResult.errored(slept.error, afterSleep);\n }\n }\n};\n","import { createAbortError } from '../../createAbortError';\nimport { createEmitter, createStore } from '../../store';\nimport { lazy } from '../lazy';\nimport { Result } from '../result';\n\nimport {\n type PollContext,\n pollLoop,\n type PollOptions,\n type PollResult,\n pollResult,\n type PollResultState,\n type PollTick,\n} from './pollLoop';\nimport { neverAborts } from './utils';\n\nexport type PollKey = readonly unknown[];\n\n/** `requesting` is the request the poll starts from, before any attempt; `polling` is the attempts. */\nexport type PollState = 'idle' | 'requesting' | 'polling' | PollResultState;\nexport type PollSnapshot<T = unknown> = PollTick<T> & { pollKey: PollKey; state: PollState };\n\ntype OnFailure<T> = (result: PollResult<T>, error: Error) => Error | undefined;\n\nexport type Poller<T, S = T> = {\n readonly state: PollState;\n start: () => Promise<PollResult<T>>;\n wait: (onFailure?: OnFailure<T>) => Promise<S>;\n stop: (reason?: string) => void;\n subscribe: (listener: (snapshot: PollSnapshot<T>) => void) => () => void;\n debug: () => PollSnapshot<T>;\n};\n\ntype InitRequest<R> = (signal: AbortSignal) => Promise<R>;\n\nconst isRequest = <R>(init: R | InitRequest<R> | undefined): init is InitRequest<R> =>\n typeof init === 'function';\n\n/**\n * The loop's options plus what names the poll and what it starts from.\n *\n * - `pollKey` names the poll; the loop never sees it. Given as a function of `init`, it is what the\n * poll started from that names it, once that is known.\n * - `init` is a value or a request for it (an enqueue), handed to `pollFn`; a request runs first.\n * - `failed` reads a `done` value for `wait`: what it returns, `wait` throws. A client that\n * knows what gets through declares it as `Poller<T, S>` on its own return.\n */\nexport type PollerOptions<T, K extends PollKey = PollKey, R = undefined> = Omit<\n PollOptions<T>,\n 'pollFn' | 'until'\n> & {\n pollKey: K | ((init: R) => K);\n init?: R | InitRequest<R>;\n pollFn: (context: PollContext & { init: R; signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T> & { data: T }) => boolean;\n failed?: (data: T) => Error | undefined;\n};\n\nexport type ObservedPoller = Pick<Poller<unknown>, 'stop' | 'subscribe' | 'debug' | 'start'>;\n\nexport const emitter = createEmitter<ObservedPoller>();\n\nexport const failureOf = (result: PollResult<unknown>): Error => {\n if ('error' in result && result.error) return result.error;\n\n if (result.state === 'aborted') {\n if (result.reason instanceof Error) return result.reason;\n\n return createAbortError(\n typeof result.reason === 'string' ? result.reason : 'The poll was stopped.',\n );\n }\n\n return new Error(`The poll ${result.state} after ${result.attempt} attempts.`);\n};\n\nexport const poller = <T, K extends PollKey = PollKey, R = undefined>({\n pollKey,\n init,\n signal,\n pollFn,\n until,\n failed,\n ...pollLoopOptions\n}: PollerOptions<T, K, R>): Poller<T> => {\n const callerSignal = signal ?? neverAborts();\n const pollerSignal = new AbortController();\n const anySignal = AbortSignal.any([pollerSignal.signal, callerSignal]);\n\n const keyOf = (from: R) => (typeof pollKey === 'function' ? pollKey(from) : pollKey);\n // An absent `init` is the `undefined` that `R` defaults to, which the body cannot prove.\n const givenInit = (): R => init as R;\n\n // snapshoting; the key is unknown while a request for `init` is out, so it starts empty then\n const snapshot = createStore<PollSnapshot<T>>({\n pollKey: isRequest(init) ? [] : keyOf(givenInit()),\n state: 'idle',\n attempt: 0,\n elapsed: 0,\n last: null,\n });\n const updateSnapshot = (next: Partial<PollSnapshot<T>>) =>\n snapshot.set({ ...snapshot.get(), ...next });\n\n const handleUntil = (tick: PollTick<T> & { data: T }) => {\n updateSnapshot({ attempt: tick.attempt, elapsed: tick.elapsed, last: tick.data });\n return until(tick);\n };\n\n // The result knows what a tick cannot: attempts that failed, and the time the ending itself took.\n const settle = (result: PollResult<T>) => {\n updateSnapshot({\n state: result.state,\n attempt: result.attempt,\n elapsed: result.elapsed,\n last: result.last,\n });\n return result;\n };\n\n // The request runs under the poller's signal, before the first attempt. The poll's deadline\n // bounds the polling, not this request.\n const requestInit = (request: InitRequest<R>) => {\n updateSnapshot({ state: 'requesting' });\n\n return Result.tryCatchAsync(() => {\n anySignal.throwIfAborted();\n return request(anySignal);\n });\n };\n\n const now = () => pollLoopOptions.clock?.now() ?? performance.now();\n\n // How a poll ends when its request did: no attempt was made, and a stop reads as an abort.\n const endedBeforePolling = (error: Error, startedAt: number) => {\n const before: PollTick<T> = { attempt: 0, elapsed: now() - startedAt, last: null };\n\n return anySignal.aborted\n ? pollResult.aborted(before, anySignal.reason)\n : pollResult.errored(error, before);\n };\n\n const start = lazy(async (): Promise<PollResult<T>> => {\n let resolved = givenInit();\n if (isRequest(init)) {\n const startedAt = now();\n const requested = await requestInit(init);\n if (!requested.success) return settle(endedBeforePolling(requested.error, startedAt));\n resolved = requested.data;\n }\n updateSnapshot({ pollKey: keyOf(resolved), state: 'polling' });\n\n return settle(\n await pollLoop({\n ...pollLoopOptions,\n pollFn: (context) => pollFn({ ...context, init: resolved }),\n until: handleUntil,\n signal: anySignal,\n }),\n );\n });\n\n const stop = (reason?: string) => pollerSignal.abort(reason);\n const subscribe = (listener: (snapshot: PollSnapshot<T>) => void) =>\n snapshot.subscribe(() => listener(snapshot.get()));\n const debug = snapshot.get;\n\n const wait = async (onFailure?: OnFailure<T>) => {\n const result = await start();\n if (result.state === 'done') {\n const error = failed?.(result.data);\n if (!error) return result.data;\n throw onFailure?.(result, error) ?? error;\n }\n const error = failureOf(result);\n throw onFailure?.(result, error) ?? error;\n };\n\n const controls = {\n stop,\n subscribe,\n debug,\n start,\n };\n\n emitter.emit(controls);\n\n return {\n get state() {\n return snapshot.get().state;\n },\n wait,\n ...controls,\n };\n};\n","import type { QueryJobStatus } from '../clients/queryService/types';\nimport type { QueueJobStatus } from '../clients/queue/types';\nimport type { StorageJobStatus } from '../clients/storage/jobs/types';\n\n/**\n * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - The split mirrors the job's `isSuccess`; with a job in hand, read `job.isSuccess` instead.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\n */\nconst forService = <Status extends string>(groups: StatusGroups<Status>) => {\n const all = [...groups.running, ...groups.successful, ...groups.failed];\n\n const running: ReadonlySet<Status> = new Set(groups.running);\n const successful: ReadonlySet<Status> = new Set(groups.successful);\n const failed: ReadonlySet<Status> = new Set(groups.failed);\n const terminal: ReadonlySet<Status> = new Set([...groups.successful, ...groups.failed]);\n const known: ReadonlySet<string> = new Set<string>(all);\n\n return {\n isRunning: (status: Status) => running.has(status),\n isTerminal: (status: Status) => terminal.has(status),\n isSuccessful: (status: Status) => successful.has(status),\n isFailed: (status: Status) => failed.has(status),\n isKnown: (value: string): value is Status => known.has(value),\n describe: (status: Status) => ({\n isRunning: running.has(status),\n isTerminal: terminal.has(status),\n isSuccessful: successful.has(status),\n isFailed: failed.has(status),\n }),\n statuses: { running, successful, failed, terminal },\n named: Object.fromEntries(\n all.map((status) => [status.toUpperCase(), status]),\n ) as StatusNames<Status>,\n };\n};\n\n/**\n * Job statuses per service, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n","import { isApiError } from '../fetchClient';\n\nconst MAX_CONSECUTIVE_FAILURES = 5;\n\n// A read that failed in transit, or that the service answered with a 5xx or 429. The job runs\n// server-side either way, so a later read can still see it finish.\nconst isTransient = (error: Error) =>\n error instanceof TypeError ||\n (isApiError(error) && (error.response.status >= 500 || error.response.status === 429));\n\n/** A job poll's retry rule: a transient read is retried up to five times in a row; one that succeeds resets the count. */\nexport const transientRetries = () => {\n let failures = 0;\n\n return {\n reset: () => {\n failures = 0;\n },\n isRetryable: (error: Error) => isTransient(error) && ++failures < MAX_CONSECUTIVE_FAILURES,\n };\n};\n"],"mappings":";;;;AAEA,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAOA,yBAAAA,iBAAiB,OAAO,MAAM,CAAC;CAElE,MAAM,gBAAgB;EACpB,aAAa,SAAS;EACtB,OAAOA,yBAAAA,iBAAiB,QAAQ,MAAM,CAAC;CACzC;CAKA,MAAM,YAAY,iBAAiB;EACjC,QAAQ,oBAAoB,SAAS,OAAO;EAC5C,QAAQ;CACV,GAAG,OAAO;CAEV,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3D,CAAC;;;;;;;;;ACZH,MAAa,QAAW,SAAiD;CACvE,IAAI,QAAoC;CAGxC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pE;AACF"}
1
+ {"version":3,"file":"transientRetries-CM7rAEXQ.cjs","names":["createAbortError","createEmitter","createAbortError","createStore","isApiError"],"sources":["../src/utils/async/delay.ts","../src/utils/async/lazy.ts","../src/utils/async/result.ts","../src/utils/async/poll/utils.ts","../src/utils/async/poll/backoff.ts","../src/utils/async/poll/pollLoop.ts","../src/utils/async/poll/poll.ts","../src/domain/jobStatus.ts","../src/clients/transientRetries.ts"],"sourcesContent":["import { createAbortError } from '../createAbortError';\n\nexport const delay = (timeout: number, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal?.aborted) return reject(createAbortError(signal.reason));\n\n const onAbort = () => {\n clearTimeout(timeoutId);\n reject(createAbortError(signal?.reason));\n };\n\n // `once: true` only detaches the listener once the event fires, so the timeout path has to\n // detach it explicitly — a caller reusing one signal across many delays (`poll` does) would\n // otherwise pile up a listener per delay for as long as the signal is alive.\n const timeoutId = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n","import type { TaskFn } from './types';\n\n/**\n * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\n */\nexport const lazy = <T>(task: TaskFn<T>): (() => Promise<Awaited<T>>) => {\n let value: Promise<Awaited<T>> | null = null;\n\n // async wrapper so a synchronous throw from `task` rejects rather than throws.\n const runTask = async (): Promise<Awaited<T>> => await task();\n\n return () => {\n value ??= runTask().catch((error: unknown) => {\n value = null;\n throw error;\n });\n return value;\n };\n};\n","export type Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<R>) =>\n (...args: A): Result<R> =>\n tryCatch(() => fn(...args));\n\nconst fromThrowableAsync =\n <A extends unknown[], R>(fn: (...args: A) => R | PromiseLike<R>) =>\n (...args: A): Promise<Result<R>> =>\n tryCatchAsync(() => fn(...args));\n\nexport const Result = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\n","/**\n * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,\n * about 24.9 days.\n *\n * - Above it the delay wraps: Node warns and fires after 1 ms, so a long wait becomes a busy loop.\n * - It bounds a backoff curve and a poll's timeout alike, since both end up in a timer.\n */\nexport const MAX_TIMER_DELAY = 2 ** 31 - 1;\n\nexport const clamp = (value: number, min: number, max = Infinity) =>\n Math.min(Math.max(value, min), max);\n\nexport const finiteOr = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\n\n/** A signal that never aborts, so an input nobody gave costs no branch of its own. */\nexport const neverAborts = () => new AbortController().signal;\n","import { clamp, finiteOr, MAX_TIMER_DELAY } from './utils';\n\nexport type Jitter =\n | 'none' // delay\n | 'full' // [0, delay)\n | 'equal'; // [delay / 2, delay)\n\ntype Backoff =\n | { type: 'constant'; interval: number } // 3000, 3000, 3000, ...\n | { type: 'linear'; initialInterval: number; step: number } // 1000, 2000, 3000, …\n | { type: 'exponential'; initialInterval: number; factor?: number }; // 1000, 2000, 4000, 8000, …\n\ntype RandomFn = () => number;\ntype JitterFn = (delay: number) => number;\ntype BackoffFn = (attempt: number) => number;\n\nexport type BackoffDef = {\n jitter?: Jitter;\n maxInterval?: number;\n random?: RandomFn;\n} & Backoff;\n\nconst MIN_STEP = 500;\nconst MIN_FACTOR = 2;\nconst MIN_INTERVAL = 500;\n\nexport const createBackoff = ({\n jitter = 'none',\n maxInterval: _maxInterval = MAX_TIMER_DELAY,\n random = Math.random,\n ...backoff\n}: BackoffDef): BackoffFn => {\n const backoffFn: BackoffFn = (attempt) => {\n if (backoff.type === 'linear') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const step = clamp(finiteOr(backoff.step, MIN_STEP), MIN_STEP);\n\n return interval + step * (attempt - 1);\n }\n if (backoff.type === 'exponential') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const factor = clamp(finiteOr(backoff.factor ?? MIN_FACTOR, MIN_FACTOR), MIN_FACTOR);\n\n return interval * factor ** (attempt - 1);\n }\n\n return clamp(finiteOr(backoff.interval, MIN_INTERVAL), MIN_INTERVAL);\n };\n\n const jitterFn: JitterFn = (delay) => {\n if (jitter === 'none') return delay;\n if (jitter === 'full') return delay * random();\n return delay / 2 + (delay / 2) * random(); // equal\n };\n\n const maxInterval = clamp(finiteOr(_maxInterval, MAX_TIMER_DELAY), MIN_INTERVAL, MAX_TIMER_DELAY);\n return (_attempt) => {\n const attempt = clamp(finiteOr(Math.trunc(_attempt), 1), 1);\n const capped = Math.min(backoffFn(attempt), maxInterval);\n // Floored after the jitter, not before: `full` jitter multiplies by a random fraction, so a floor\n // applied to the curve alone leaves sub-millisecond gaps between attempts.\n return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);\n };\n};\n","import { delay } from '../delay';\nimport { Result } from '../result';\n\nimport { type BackoffDef, createBackoff } from './backoff';\nimport { clamp, finiteOr, MAX_TIMER_DELAY, neverAborts } from './utils';\n\ntype Clock = {\n wait: (ms: number, signal?: AbortSignal) => Promise<void>;\n now: () => number;\n};\n\nexport type PollContext = {\n attempt: number;\n elapsed: number;\n};\n\n/** The context plus the answer it is about: what `until` decides on, and what an ending reports. */\nexport type PollTick<T> = PollContext & { last: T | null };\n\nexport type PollResultState = 'done' | 'timedOut' | 'exhausted' | 'aborted' | 'errored';\n\nexport type PollResult<T> = PollTick<T> &\n (\n | { state: 'done'; data: T }\n | { state: 'timedOut' | 'exhausted'; error?: Error }\n | { state: 'aborted'; reason?: unknown }\n | { state: 'errored'; error: Error }\n );\n\nexport type PollOptions<T> = {\n pollFn: (context: PollContext & { signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T> & { data: T }) => boolean;\n signal?: AbortSignal;\n backoff?: BackoffDef;\n isRetryable?: (error: Error) => boolean;\n maxAttempts?: number;\n timeout?: number;\n clock?: Clock;\n};\n\n/** One constructor per ending, so a result is built the same way wherever a poll ends. */\nexport const pollResult = {\n done: <T>(data: T, context: PollTick<T>): PollResult<T> => ({\n state: 'done',\n data,\n ...context,\n last: data,\n }),\n errored: <T>(error: Error, context: PollTick<T>): PollResult<T> => ({\n state: 'errored',\n error,\n ...context,\n }),\n exhausted: <T>(context: PollTick<T>, error?: Error): PollResult<T> => ({\n state: 'exhausted',\n error,\n ...context,\n }),\n timedOut: <T>(context: PollTick<T>, error?: Error): PollResult<T> => ({\n state: 'timedOut',\n error,\n ...context,\n }),\n aborted: <T>(context: PollTick<T>, reason: unknown): PollResult<T> => ({\n state: 'aborted',\n reason,\n ...context,\n }),\n};\n\nexport const pollLoop = async <T>({\n pollFn: _pollFn,\n until: _until,\n signal: callerSignal = neverAborts(),\n backoff: backoffDef = { type: 'constant', interval: 3000 },\n clock = { wait: (ms, signal) => delay(ms, signal), now: () => performance.now() },\n isRetryable: _isRetryable = () => false,\n maxAttempts: _maxAttempts = Infinity,\n timeout: _timeout = Infinity,\n}: PollOptions<T>): Promise<PollResult<T>> => {\n // A deadline ends up in a timer, so a finite one is bounded by what a timer can hold. `Infinity`\n // is answered before the clamp: it means no deadline, and clamping would make it the longest one.\n const requested = finiteOr(_timeout, Infinity);\n const timeout = requested === Infinity ? Infinity : clamp(requested, 0, MAX_TIMER_DELAY);\n const maxAttempts = Math.trunc(clamp(finiteOr(_maxAttempts, Infinity), 0));\n\n const timeoutSignal = timeout === Infinity ? neverAborts() : AbortSignal.timeout(timeout);\n const anySignal = AbortSignal.any([callerSignal, timeoutSignal]);\n const anyAborted = Promise.withResolvers<never>();\n\n anySignal.addEventListener('abort', () => anyAborted.reject(anySignal.reason), {\n once: true,\n });\n void anyAborted.promise.catch(() => undefined);\n\n const backoffFn = createBackoff(backoffDef);\n const startedAt = clock.now();\n\n const until = Result.fromThrowable(_until);\n const isRetryable = Result.fromThrowable(_isRetryable);\n // Only what the context declares: a request is not handed the tick's `last` as well.\n const pollFn = ({ attempt: at, elapsed }: PollContext) =>\n Result.tryCatchAsync(() =>\n Promise.race([_pollFn({ attempt: at, elapsed, signal: anySignal }), anyAborted.promise]),\n );\n const sleep = Result.fromThrowableAsync((ms: number) => clock.wait(ms, anySignal));\n\n let attempt = 0;\n // What a retry swallowed: the poll carries it to whichever ending runs out first.\n let last: T | null = null;\n let lastError: Error | undefined;\n const context = (at = clock.now() - startedAt): PollTick<T> => ({\n attempt,\n elapsed: at,\n last,\n });\n\n if (attempt >= maxAttempts) return pollResult.exhausted<T>(context());\n\n while (true) {\n const before = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(before, lastError);\n if (callerSignal.aborted) return pollResult.aborted(before, callerSignal.reason);\n\n attempt++;\n // The attempt it is, not the one before it — `before` was read to decide whether to make it.\n const poll = await pollFn({ ...before, attempt });\n\n // What the attempt produced, recorded before the tick that reports it: on any ending but `done`\n // these two are the only account of what the poll saw, and reading them one attempt behind is\n // reading the wrong answer.\n if (poll.success) last = poll.data;\n else lastError = poll.error;\n\n const after = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(after, lastError);\n if (callerSignal.aborted) return pollResult.aborted(after, callerSignal.reason);\n\n if (!poll.success) {\n const canRetry = isRetryable(poll.error);\n\n // A predicate that throws cannot ask for a retry. The request's own failure stays the reported\n // one — it is the type a caller's guards expect — and the predicate's rides along as its cause.\n if (!canRetry.success) {\n poll.error.cause ??= canRetry.error;\n return pollResult.errored(poll.error, after);\n }\n if (!canRetry.data) return pollResult.errored(poll.error, after);\n }\n\n if (poll.success) {\n const isDone = until({ ...after, data: poll.data });\n if (!isDone.success) return pollResult.errored(isDone.error, after);\n if (isDone.data) return pollResult.done(poll.data, after);\n }\n\n // exhausted\n if (attempt >= maxAttempts) return pollResult.exhausted(after, lastError);\n\n // sleep\n const backoff = backoffFn(attempt);\n if (after.elapsed + backoff >= timeout) return pollResult.timedOut(after, lastError);\n\n const slept = await sleep(backoff);\n if (!slept.success) {\n const afterSleep = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(afterSleep, lastError);\n if (callerSignal.aborted) return pollResult.aborted(afterSleep, callerSignal.reason);\n\n return pollResult.errored(slept.error, afterSleep);\n }\n }\n};\n","import { createAbortError } from '../../createAbortError';\nimport { createEmitter, createStore } from '../../store';\nimport { lazy } from '../lazy';\nimport { Result } from '../result';\n\nimport {\n type PollContext,\n pollLoop,\n type PollOptions,\n type PollResult,\n pollResult,\n type PollResultState,\n type PollTick,\n} from './pollLoop';\nimport { neverAborts } from './utils';\n\nexport type PollKey = readonly unknown[];\n\n/** `requesting` is the request the poll starts from, before any attempt; `polling` is the attempts. */\nexport type PollState = 'idle' | 'requesting' | 'polling' | PollResultState;\nexport type PollSnapshot<T = unknown> = PollTick<T> & { pollKey: PollKey; state: PollState };\n\ntype OnFailure<T> = (result: PollResult<T>, error: Error) => Error | undefined;\n\nexport type Poller<T, S = T> = {\n readonly state: PollState;\n start: () => Promise<PollResult<T>>;\n wait: (onFailure?: OnFailure<T>) => Promise<S>;\n stop: (reason?: string) => void;\n subscribe: (listener: (snapshot: PollSnapshot<T>) => void) => () => void;\n debug: () => PollSnapshot<T>;\n};\n\ntype InitRequest<R> = (signal: AbortSignal) => Promise<R>;\n\nconst isRequest = <R>(init: R | InitRequest<R> | undefined): init is InitRequest<R> =>\n typeof init === 'function';\n\n/**\n * The loop's options plus what names the poll and what it starts from.\n *\n * - `pollKey` names the poll; the loop never sees it. Given as a function of `init`, it is what the\n * poll started from that names it, once that is known.\n * - `init` is a value or a request for it (an enqueue), handed to `pollFn`; a request runs first.\n * - `failed` reads a `done` value for `wait`: what it returns, `wait` throws. A client that\n * knows what gets through declares it as `Poller<T, S>` on its own return.\n */\nexport type PollerOptions<T, K extends PollKey = PollKey, R = undefined> = Omit<\n PollOptions<T>,\n 'pollFn' | 'until'\n> & {\n pollKey: K | ((init: R) => K);\n init?: R | InitRequest<R>;\n pollFn: (context: PollContext & { init: R; signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T> & { data: T }) => boolean;\n failed?: (data: T) => Error | undefined;\n};\n\nexport type ObservedPoller = Pick<Poller<unknown>, 'stop' | 'subscribe' | 'debug' | 'start'>;\n\nexport const emitter = createEmitter<ObservedPoller>();\n\nexport const failureOf = (result: PollResult<unknown>): Error => {\n if ('error' in result && result.error) return result.error;\n\n if (result.state === 'aborted') {\n if (result.reason instanceof Error) return result.reason;\n\n return createAbortError(\n typeof result.reason === 'string' ? result.reason : 'The poll was stopped.',\n );\n }\n\n return new Error(`The poll ${result.state} after ${result.attempt} attempts.`);\n};\n\nexport const poller = <T, K extends PollKey = PollKey, R = undefined>({\n pollKey,\n init,\n signal,\n pollFn,\n until,\n failed,\n ...pollLoopOptions\n}: PollerOptions<T, K, R>): Poller<T> => {\n const callerSignal = signal ?? neverAborts();\n const pollerSignal = new AbortController();\n const anySignal = AbortSignal.any([pollerSignal.signal, callerSignal]);\n\n const keyOf = (from: R) => (typeof pollKey === 'function' ? pollKey(from) : pollKey);\n // An absent `init` is the `undefined` that `R` defaults to, which the body cannot prove.\n const givenInit = (): R => init as R;\n\n // snapshoting; the key is unknown while a request for `init` is out, so it starts empty then\n const snapshot = createStore<PollSnapshot<T>>({\n pollKey: isRequest(init) ? [] : keyOf(givenInit()),\n state: 'idle',\n attempt: 0,\n elapsed: 0,\n last: null,\n });\n const updateSnapshot = (next: Partial<PollSnapshot<T>>) =>\n snapshot.set({ ...snapshot.get(), ...next });\n\n const handleUntil = (tick: PollTick<T> & { data: T }) => {\n updateSnapshot({ attempt: tick.attempt, elapsed: tick.elapsed, last: tick.data });\n return until(tick);\n };\n\n // The result knows what a tick cannot: attempts that failed, and the time the ending itself took.\n const settle = (result: PollResult<T>) => {\n updateSnapshot({\n state: result.state,\n attempt: result.attempt,\n elapsed: result.elapsed,\n last: result.last,\n });\n return result;\n };\n\n // The request runs under the poller's signal, before the first attempt. The poll's deadline\n // bounds the polling, not this request.\n const requestInit = (request: InitRequest<R>) => {\n updateSnapshot({ state: 'requesting' });\n\n return Result.tryCatchAsync(() => {\n anySignal.throwIfAborted();\n return request(anySignal);\n });\n };\n\n const now = () => pollLoopOptions.clock?.now() ?? performance.now();\n\n // How a poll ends when its request did: no attempt was made, and a stop reads as an abort.\n const endedBeforePolling = (error: Error, startedAt: number) => {\n const before: PollTick<T> = { attempt: 0, elapsed: now() - startedAt, last: null };\n\n return anySignal.aborted\n ? pollResult.aborted(before, anySignal.reason)\n : pollResult.errored(error, before);\n };\n\n const start = lazy(async (): Promise<PollResult<T>> => {\n let resolved = givenInit();\n if (isRequest(init)) {\n const startedAt = now();\n const requested = await requestInit(init);\n if (!requested.success) return settle(endedBeforePolling(requested.error, startedAt));\n resolved = requested.data;\n }\n updateSnapshot({ pollKey: keyOf(resolved), state: 'polling' });\n\n return settle(\n await pollLoop({\n ...pollLoopOptions,\n pollFn: (context) => pollFn({ ...context, init: resolved }),\n until: handleUntil,\n signal: anySignal,\n }),\n );\n });\n\n const stop = (reason?: string) => pollerSignal.abort(reason);\n const subscribe = (listener: (snapshot: PollSnapshot<T>) => void) =>\n snapshot.subscribe(() => listener(snapshot.get()));\n const debug = snapshot.get;\n\n const wait = async (onFailure?: OnFailure<T>) => {\n const result = await start();\n if (result.state === 'done') {\n const error = failed?.(result.data);\n if (!error) return result.data;\n throw onFailure?.(result, error) ?? error;\n }\n const error = failureOf(result);\n throw onFailure?.(result, error) ?? error;\n };\n\n const controls = {\n stop,\n subscribe,\n debug,\n start,\n };\n\n emitter.emit(controls);\n\n return {\n get state() {\n return snapshot.get().state;\n },\n wait,\n ...controls,\n };\n};\n","import type { QueryJobStatus } from '../clients/queryService/types';\nimport type { QueueJobStatus } from '../clients/queue/types';\nimport type { StorageJobStatus } from '../clients/storage/jobs/types';\n\n/**\n * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - The split mirrors the job's `isSuccess`; with a job in hand, read `job.isSuccess` instead.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\n */\nconst forService = <Status extends string>(groups: StatusGroups<Status>) => {\n const all = [...groups.running, ...groups.successful, ...groups.failed];\n\n const running: ReadonlySet<Status> = new Set(groups.running);\n const successful: ReadonlySet<Status> = new Set(groups.successful);\n const failed: ReadonlySet<Status> = new Set(groups.failed);\n const terminal: ReadonlySet<Status> = new Set([...groups.successful, ...groups.failed]);\n const known: ReadonlySet<string> = new Set<string>(all);\n\n return {\n isRunning: (status: Status) => running.has(status),\n isTerminal: (status: Status) => terminal.has(status),\n isSuccessful: (status: Status) => successful.has(status),\n isFailed: (status: Status) => failed.has(status),\n isKnown: (value: string): value is Status => known.has(value),\n describe: (status: Status) => ({\n isRunning: running.has(status),\n isTerminal: terminal.has(status),\n isSuccessful: successful.has(status),\n isFailed: failed.has(status),\n }),\n statuses: { running, successful, failed, terminal },\n named: Object.fromEntries(\n all.map((status) => [status.toUpperCase(), status]),\n ) as StatusNames<Status>,\n };\n};\n\n/**\n * Job statuses per service, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n","import { isApiError } from '../fetchClient';\n\nconst MAX_CONSECUTIVE_FAILURES = 5;\n\n// A read that failed in transit, or that the service answered with a 5xx or 429. The job runs\n// server-side either way, so a later read can still see it finish.\nconst isTransient = (error: Error) =>\n error instanceof TypeError ||\n (isApiError(error) && (error.response.status >= 500 || error.response.status === 429));\n\n/** A job poll's retry rule: a transient read is retried up to five times in a row; one that succeeds resets the count. */\nexport const transientRetries = () => {\n let failures = 0;\n\n return {\n reset: () => {\n failures = 0;\n },\n isRetryable: (error: Error) => isTransient(error) && ++failures < MAX_CONSECUTIVE_FAILURES,\n };\n};\n"],"mappings":";;;;AAEA,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAOA,yBAAAA,iBAAiB,OAAO,MAAM,CAAC;CAElE,MAAM,gBAAgB;EACpB,aAAa,SAAS;EACtB,OAAOA,yBAAAA,iBAAiB,QAAQ,MAAM,CAAC;CACzC;CAKA,MAAM,YAAY,iBAAiB;EACjC,QAAQ,oBAAoB,SAAS,OAAO;EAC5C,QAAQ;CACV,GAAG,OAAO;CAEV,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3D,CAAC;;;;;;;;ACZH,MAAa,QAAW,SAAiD;CACvE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AE,WAAW;CACpE;AACF"}
@@ -1,6 +1,5 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-BPMr8PQJ.js";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.js";
2
2
  import { z } from "zod";
3
- //#region src/clients/chat/__generated__/schema.d.ts
4
3
  /**
5
4
  * This file was auto-generated by openapi-typescript.
6
5
  * Do not make direct changes to the file.
@@ -1579,8 +1578,6 @@ type components = {
1579
1578
  headers: never;
1580
1579
  pathItems: never;
1581
1580
  };
1582
- //#endregion
1583
- //#region src/clients/chat/types.d.ts
1584
1581
  type ProjectToolPolicyValue = 'blocked' | 'always_ask';
1585
1582
  type ProjectToolPolicy = Record<string, ProjectToolPolicyValue>;
1586
1583
  declare const askUserQuestionAnswersSchema: z.ZodRecord<z.ZodString, z.ZodString>;
@@ -1629,6 +1626,5 @@ type UpdateUserAgentSettingsRequest = components['schemas']['UpdateUserAgentSett
1629
1626
  type ToolPermissionValue = components['schemas']['ToolPermissionValue'];
1630
1627
  type ToolInfo = components['schemas']['ToolInfo'];
1631
1628
  type ToolsListResponse = components['schemas']['ToolsListResponse'];
1632
- //#endregion
1633
1629
  export { components as A, UserAgentSettings as C, VotesResponse as D, VoteRequest as E, approvalGoneReasonSchema as O, UsageResponse as S, Vote as T, ToolInfo as _, ChatMessage as a, UpdateAgentSettingsRequest as b, ChatWithMessages as c, GetVotesQuery as d, HistoryResponse as f, TextPart as g, ProjectToolPolicyValue as h, Chat as i, askUserQuestionAnswersSchema as k, GetChatPath as l, ProjectToolPolicy as m, ApprovalGoneReason as n, ChatRequest as o, MessageStatus as p, AskUserQuestionAnswers as r, ChatWithMessage as s, AgentSettings as t, GetHistoryQuery as u, ToolPermissionValue as v, UserMessage as w, UpdateUserAgentSettingsRequest as x, ToolsListResponse as y };
1634
- //# sourceMappingURL=types-DODAZKEm.d.ts.map
1630
+ //# sourceMappingURL=types--Rp5wvaz.d.ts.map
@@ -1,5 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-CL4iKFic.cjs";
2
- //#region src/clients/editor/__generated__/schema.d.ts
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.cjs";
3
2
  /**
4
3
  * This file was auto-generated by openapi-typescript.
5
4
  * Do not make direct changes to the file.
@@ -1382,8 +1381,6 @@ interface operations {
1382
1381
  };
1383
1382
  };
1384
1383
  }
1385
- //#endregion
1386
- //#region src/clients/editor/types.d.ts
1387
1384
  type SqlSession = OpenapiReturnType<paths['/sql/sessions']['post']>;
1388
1385
  type CreateSqlSessionBody = OpenapiBodyType<paths['/sql/sessions']['post']>;
1389
1386
  type GetSqlSessionPath = OpenapiPathType<paths['/sql/sessions/{id}']['get']>;
@@ -1406,6 +1403,5 @@ type PostSqlSessionLoadPath = OpenapiPathType<paths['/sql/sessions/{id}/load']['
1406
1403
  type PostSqlSessionLoadBody = OpenapiBodyType<paths['/sql/sessions/{id}/load']['post']>;
1407
1404
  type PostSqlSessionUnloadPath = OpenapiPathType<paths['/sql/sessions/{id}/unload']['post']>;
1408
1405
  type PostSqlSessionUnloadBody = OpenapiBodyType<paths['/sql/sessions/{id}/unload']['post']>;
1409
- //#endregion
1410
1406
  export { components as C, SqlSession as S, SessionSchema as _, GetSqlSessionTableDdlPath as a, SessionSchemaDatabase as b, PostSqlRunQueryBody as c, PostSqlSessionLoadPath as d, PostSqlSessionUnloadBody as f, Session as g, PostSqlTablePreviewPath as h, GetSqlSessionSchemaQuery as i, PostSqlRunQueryPath as l, PostSqlTablePreviewBody as m, GetSqlSessionPath as n, GetSqlSessionTableDdlQuery as o, PostSqlSessionUnloadPath as p, GetSqlSessionSchemaPath as r, GetSqlSessionsQuery as s, CreateSqlSessionBody as t, PostSqlSessionLoadBody as u, SessionSchemaBucket as v, SessionSchemaTable as x, SessionSchemaColumn as y };
1411
- //# sourceMappingURL=types-JZ0Bdlpk.d.cts.map
1407
+ //# sourceMappingURL=types-1IBnjBVJ.d.cts.map
@@ -1,5 +1,4 @@
1
- import { c as OpenapiQueryType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-BPMr8PQJ.js";
2
- //#region src/clients/componentsMcp/__generated__/schema.d.ts
1
+ import { c as OpenapiQueryType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.cjs";
3
2
  /**
4
3
  * This file was auto-generated by openapi-typescript.
5
4
  * Do not make direct changes to the file.
@@ -2101,11 +2100,8 @@ interface operations {
2101
2100
  };
2102
2101
  };
2103
2102
  }
2104
- //#endregion
2105
- //#region src/clients/componentsMcp/types.d.ts
2106
2103
  type GetConnectorsQuery = NonNullable<OpenapiQueryType<paths['/connectors']['get']>>;
2107
2104
  type SetConnectorCredentialsPath = OpenapiPathType<paths['/connectors/{connector_id}/credentials']['put']>;
2108
2105
  type SetConnectorCredentialsBody = OpenapiBodyType<paths['/connectors/{connector_id}/credentials']['put']>;
2109
- //#endregion
2110
2106
  export { SetConnectorCredentialsBody as n, SetConnectorCredentialsPath as r, GetConnectorsQuery as t };
2111
- //# sourceMappingURL=types-BZ--6pIt.d.ts.map
2107
+ //# sourceMappingURL=types-37vwxse4.d.cts.map
@@ -1,5 +1,4 @@
1
- import { l as OpenapiReturnType, r as OpenapiBodyType } from "./index-BPMr8PQJ.js";
2
- //#region src/clients/telemetry/__generated__/schema.d.ts
1
+ import { l as OpenapiReturnType, r as OpenapiBodyType } from "./index-D1mduJne.js";
3
2
  /**
4
3
  * This file was auto-generated by openapi-typescript.
5
4
  * Do not make direct changes to the file.
@@ -279,11 +278,8 @@ type components = {
279
278
  headers: never;
280
279
  pathItems: never;
281
280
  };
282
- //#endregion
283
- //#region src/clients/telemetry/types.d.ts
284
281
  /** `project_type` is a free-form passthrough into the JWT claim — the service validates it nowhere. */
285
282
  type GetProvisioningTokenBody = NonNullable<OpenapiBodyType<paths['/token']['post']>>;
286
283
  type ProvisioningToken = OpenapiReturnType<paths['/token']['post']>;
287
- //#endregion
288
284
  export { ProvisioningToken as n, GetProvisioningTokenBody as t };
289
- //# sourceMappingURL=types-RogkWzOu.d.ts.map
285
+ //# sourceMappingURL=types-6T04_qUf.d.ts.map