@keboola/api-client 51.0.0 → 52.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 (422) hide show
  1. package/AGENTS.md +46 -8
  2. package/API-SURFACE.md +1 -10
  3. package/CHANGELOG.md +27 -0
  4. package/README.md +2 -2
  5. package/dist/{ManagementSessionMintError-DNMbYauw.js → ManagementSessionMintError-BMHDcEqV.js} +2 -2
  6. package/dist/{ManagementSessionMintError-DNMbYauw.js.map → ManagementSessionMintError-BMHDcEqV.js.map} +1 -1
  7. package/dist/{ManagementSessionMintError-ByOulHQH.cjs → ManagementSessionMintError-Bc9bc7Ai.cjs} +2 -2
  8. package/dist/{ManagementSessionMintError-ByOulHQH.cjs.map → ManagementSessionMintError-Bc9bc7Ai.cjs.map} +1 -1
  9. package/dist/RowLevelSecurityError-CObFqj3E.js +33 -0
  10. package/dist/RowLevelSecurityError-CObFqj3E.js.map +1 -0
  11. package/dist/RowLevelSecurityError-RK_NhhAx.cjs +56 -0
  12. package/dist/RowLevelSecurityError-RK_NhhAx.cjs.map +1 -0
  13. package/dist/{adminRoles-FFyl7Dyx.d.cts → adminRoles-BTKVwEy8.d.cts} +2 -2
  14. package/dist/{adminRoles-DAwl657q.d.ts → adminRoles-Cm513r1G.d.ts} +2 -2
  15. package/dist/ai/index.cjs +2 -2
  16. package/dist/ai/index.d.cts +2 -2
  17. package/dist/ai/index.d.ts +2 -2
  18. package/dist/ai/index.js +2 -2
  19. package/dist/ai/types.d.cts +1 -1
  20. package/dist/ai/types.d.ts +1 -1
  21. package/dist/apps/index.cjs +3 -234
  22. package/dist/apps/index.d.cts +3 -221
  23. package/dist/apps/index.d.ts +3 -221
  24. package/dist/apps/index.js +1 -234
  25. package/dist/apps/types.d.cts +1 -2
  26. package/dist/apps/types.d.ts +1 -2
  27. package/dist/apps-BN7fWtSm.js +361 -0
  28. package/dist/apps-BN7fWtSm.js.map +1 -0
  29. package/dist/apps-C1x5IKNQ.cjs +376 -0
  30. package/dist/apps-C1x5IKNQ.cjs.map +1 -0
  31. package/dist/assets/index.cjs +1 -1
  32. package/dist/assets/index.d.cts +1 -1
  33. package/dist/assets/index.d.ts +1 -1
  34. package/dist/assets/index.js +1 -1
  35. package/dist/auth/index.cjs +1 -1
  36. package/dist/auth/index.d.cts +1 -1
  37. package/dist/auth/index.d.ts +1 -1
  38. package/dist/auth/index.js +1 -1
  39. package/dist/auth/types.d.cts +1 -1
  40. package/dist/auth/types.d.ts +1 -1
  41. package/dist/{auth-CvB4MukT.cjs → auth-AehUDNRK.cjs} +2 -2
  42. package/dist/{auth-CvB4MukT.cjs.map → auth-AehUDNRK.cjs.map} +1 -1
  43. package/dist/{auth-DYfQMQCs.js → auth-ZBQWCJPM.js} +2 -2
  44. package/dist/{auth-DYfQMQCs.js.map → auth-ZBQWCJPM.js.map} +1 -1
  45. package/dist/{authClient-oB5ydxWp.js → authClient-BM4L8XEN.js} +5 -5
  46. package/dist/{authClient-oB5ydxWp.js.map → authClient-BM4L8XEN.js.map} +1 -1
  47. package/dist/{authClient-DcKBpMcU.cjs → authClient-DspK50e7.cjs} +5 -5
  48. package/dist/{authClient-DcKBpMcU.cjs.map → authClient-DspK50e7.cjs.map} +1 -1
  49. package/dist/{authClient-Df3U4q_6.d.cts → authClient-NBi0pqD5.d.cts} +4 -4
  50. package/dist/{authClient-JtMVJWXY.d.ts → authClient-ij_Rm2Yn.d.ts} +4 -4
  51. package/dist/billing/index.cjs +2 -2
  52. package/dist/billing/index.d.cts +1 -1
  53. package/dist/billing/index.d.ts +1 -1
  54. package/dist/billing/index.js +2 -2
  55. package/dist/billing/types.d.cts +1 -1
  56. package/dist/billing/types.d.ts +1 -1
  57. package/dist/chat/index.cjs +3 -3
  58. package/dist/chat/index.d.cts +2 -2
  59. package/dist/chat/index.d.ts +2 -2
  60. package/dist/chat/index.js +3 -3
  61. package/dist/chat/types.d.cts +1 -1
  62. package/dist/chat/types.d.ts +1 -1
  63. package/dist/{componentId-b_qBbJEM.js → componentId-DZP1rBix.js} +54 -2
  64. package/dist/componentId-DZP1rBix.js.map +1 -0
  65. package/dist/{componentId-C8ZTXXDo.cjs → componentId-olp0tltf.cjs} +54 -2
  66. package/dist/componentId-olp0tltf.cjs.map +1 -0
  67. package/dist/componentsMcp/index.cjs +1 -1
  68. package/dist/componentsMcp/index.d.cts +1 -1
  69. package/dist/componentsMcp/index.d.ts +1 -1
  70. package/dist/componentsMcp/index.js +1 -1
  71. package/dist/componentsMcp/types.d.cts +1 -1
  72. package/dist/componentsMcp/types.d.ts +1 -1
  73. package/dist/{componentsMcp-BrB4js6b.js → componentsMcp-CAmrCpzV.js} +3 -3
  74. package/dist/{componentsMcp-BrB4js6b.js.map → componentsMcp-CAmrCpzV.js.map} +1 -1
  75. package/dist/{componentsMcp-BaHy5iLr.cjs → componentsMcp-DXu-0Qt-.cjs} +3 -3
  76. package/dist/{componentsMcp-BaHy5iLr.cjs.map → componentsMcp-DXu-0Qt-.cjs.map} +1 -1
  77. package/dist/constants/index.cjs +2 -2
  78. package/dist/constants/index.d.cts +3 -3
  79. package/dist/constants/index.d.ts +3 -3
  80. package/dist/constants/index.js +2 -2
  81. package/dist/{constants-BMSHGwOR.js → constants-Dqi0ewGv.js} +3 -2
  82. package/dist/constants-Dqi0ewGv.js.map +1 -0
  83. package/dist/{constants-DhFQWQgy.cjs → constants-d0Do9NSN.cjs} +3 -2
  84. package/dist/constants-d0Do9NSN.cjs.map +1 -0
  85. package/dist/{createFetchClient-DEkUH662.cjs → createFetchClient-CDKSkd7i.cjs} +19 -1
  86. package/dist/{createFetchClient-DlGCbltR.js.map → createFetchClient-CDKSkd7i.cjs.map} +1 -1
  87. package/dist/{createFetchClient-DlGCbltR.js → createFetchClient-Dc_ZMuq7.js} +8 -2
  88. package/dist/createFetchClient-Dc_ZMuq7.js.map +1 -0
  89. package/dist/{createGenericFetchClient-wGxemBwR.js → createGenericFetchClient-Ba4E4T-Y.js} +2 -2
  90. package/dist/{createGenericFetchClient-wGxemBwR.js.map → createGenericFetchClient-Ba4E4T-Y.js.map} +1 -1
  91. package/dist/{createGenericFetchClient-2oU-PXVo.cjs → createGenericFetchClient-BuYzzV_D.cjs} +2 -2
  92. package/dist/{createGenericFetchClient-2oU-PXVo.cjs.map → createGenericFetchClient-BuYzzV_D.cjs.map} +1 -1
  93. package/dist/{createOpenapiFetchClient-Bhz62MUE.js → createOpenapiFetchClient-DSk29o_s.js} +2 -2
  94. package/dist/{createOpenapiFetchClient-Bhz62MUE.js.map → createOpenapiFetchClient-DSk29o_s.js.map} +1 -1
  95. package/dist/{createOpenapiFetchClient-DL9w7vU-.cjs → createOpenapiFetchClient-dkssExkU.cjs} +2 -2
  96. package/dist/{createOpenapiFetchClient-DL9w7vU-.cjs.map → createOpenapiFetchClient-dkssExkU.cjs.map} +1 -1
  97. package/dist/dataScience/index.cjs +60 -4
  98. package/dist/dataScience/index.cjs.map +1 -0
  99. package/dist/dataScience/index.d.cts +105 -3
  100. package/dist/dataScience/index.d.ts +105 -3
  101. package/dist/dataScience/index.js +60 -3
  102. package/dist/dataScience/index.js.map +1 -0
  103. package/dist/dataScience/types.d.cts +2 -3
  104. package/dist/dataScience/types.d.ts +2 -3
  105. package/dist/developerPortal/index.cjs +1 -1
  106. package/dist/developerPortal/index.d.cts +2 -2
  107. package/dist/developerPortal/index.d.ts +2 -2
  108. package/dist/developerPortal/index.js +1 -1
  109. package/dist/developerPortal/types.d.cts +1 -1
  110. package/dist/developerPortal/types.d.ts +1 -1
  111. package/dist/{developerPortalClient-BfRxYrWj.cjs → developerPortalClient-BcK9F-Fs.cjs} +3 -3
  112. package/dist/{developerPortalClient-BfRxYrWj.cjs.map → developerPortalClient-BcK9F-Fs.cjs.map} +1 -1
  113. package/dist/{developerPortalClient-D9XOYwWF.js → developerPortalClient-CzCJ5sE3.js} +3 -3
  114. package/dist/{developerPortalClient-D9XOYwWF.js.map → developerPortalClient-CzCJ5sE3.js.map} +1 -1
  115. package/dist/domain/permissions/index.d.cts +1 -1
  116. package/dist/domain/permissions/index.d.ts +1 -1
  117. package/dist/editor/index.cjs +2 -2
  118. package/dist/editor/index.d.cts +2 -2
  119. package/dist/editor/index.d.ts +2 -2
  120. package/dist/editor/index.js +2 -2
  121. package/dist/editor/types.d.cts +1 -1
  122. package/dist/editor/types.d.ts +1 -1
  123. package/dist/encryption/index.cjs +1 -1
  124. package/dist/encryption/index.d.cts +1 -1
  125. package/dist/encryption/index.d.ts +1 -1
  126. package/dist/encryption/index.js +1 -1
  127. package/dist/encryption/types.d.cts +1 -1
  128. package/dist/encryption/types.d.ts +1 -1
  129. package/dist/import/index.cjs +1 -1
  130. package/dist/import/index.d.cts +3 -3
  131. package/dist/import/index.d.ts +3 -3
  132. package/dist/import/index.js +1 -1
  133. package/dist/{import-CABlFMQX.cjs → import-DHq6q3Fm.cjs} +3 -3
  134. package/dist/{import-CABlFMQX.cjs.map → import-DHq6q3Fm.cjs.map} +1 -1
  135. package/dist/{import-CT1Ce5Rp.js → import-DxN6CJzJ.js} +3 -3
  136. package/dist/{import-CT1Ce5Rp.js.map → import-DxN6CJzJ.js.map} +1 -1
  137. package/dist/{index-Db266tLz.d.cts → index-81wn1jc3.d.cts} +4 -4
  138. package/dist/{index-xX8-Stoq.d.cts → index-8QhOqFLY.d.cts} +4 -4
  139. package/dist/{index-DjSthn8d.d.ts → index-B5rELADq.d.cts} +55 -2
  140. package/dist/{index-qJ2IjXIM.d.cts → index-B7el5pJU.d.cts} +71 -151
  141. package/dist/index-B8K-Bbdq.d.cts +220 -0
  142. package/dist/{index-DQagqTVa.d.cts → index-BGE3eZfd.d.cts} +3 -3
  143. package/dist/{index-DVBQgFg0.d.ts → index-BVe4S2CK.d.ts} +4 -4
  144. package/dist/{index-CbSh3KFw.d.cts → index-BXgjPlZN.d.cts} +4 -4
  145. package/dist/{index-BsT_cBJd.d.ts → index-C7JcNvbd.d.ts} +71 -151
  146. package/dist/{index-lTrNMlj6.d.ts → index-CEDjFidH.d.ts} +3 -3
  147. package/dist/{index-DgGpQsAT.d.cts → index-CNJBmCHM.d.cts} +4 -4
  148. package/dist/index-CQNwp6wX.d.ts +220 -0
  149. package/dist/{index-CuI8OI9E.d.ts → index-CZvBjQvl.d.ts} +4 -4
  150. package/dist/{index-Day1Yr5s.d.ts → index-CdeWTy8t.d.ts} +4 -4
  151. package/dist/{index-BfAcp7O2.d.ts → index-CveF5RFQ.d.ts} +3 -3
  152. package/dist/{index-m9-mN8Gg.d.ts → index-DLWMm1-T.d.ts} +4 -4
  153. package/dist/{index-BDPxm9qu.d.ts → index-DTGOEke4.d.ts} +3 -3
  154. package/dist/{index-C1ndNdrN.d.cts → index-Df8lZNSH.d.cts} +3 -3
  155. package/dist/{index-AA3MRfRn.d.cts → index-Dhyrg5zd.d.ts} +55 -2
  156. package/dist/{index-D1mduJne.d.cts → index-FrsEkDvX.d.cts} +7 -2
  157. package/dist/{index-D1mduJne.d.ts → index-FrsEkDvX.d.ts} +7 -2
  158. package/dist/{index-DIPMzH--.d.ts → index-JoKfPQND.d.ts} +4 -4
  159. package/dist/{index-xhzuWloV.d.cts → index-d9zxFmNI.d.cts} +4 -4
  160. package/dist/{index-z-2okomN.d.cts → index-iFCann29.d.cts} +3 -3
  161. package/dist/index.cjs +45 -38
  162. package/dist/index.cjs.map +1 -1
  163. package/dist/index.d.cts +7 -7
  164. package/dist/index.d.ts +7 -7
  165. package/dist/index.js +38 -33
  166. package/dist/index.js.map +1 -1
  167. package/dist/{isLoginPageRedirect-CoUxJi2x.cjs → isLoginPageRedirect-DUmsOC2o.cjs} +2 -2
  168. package/dist/{isLoginPageRedirect-CoUxJi2x.cjs.map → isLoginPageRedirect-DUmsOC2o.cjs.map} +1 -1
  169. package/dist/{isLoginPageRedirect-D-lqF_kZ.js → isLoginPageRedirect-lbeVmeB2.js} +2 -2
  170. package/dist/{isLoginPageRedirect-D-lqF_kZ.js.map → isLoginPageRedirect-lbeVmeB2.js.map} +1 -1
  171. package/dist/kaiAgent/index.cjs +1 -1
  172. package/dist/kaiAgent/index.d.cts +2 -2
  173. package/dist/kaiAgent/index.d.ts +2 -2
  174. package/dist/kaiAgent/index.js +1 -1
  175. package/dist/kaiAgent/types.d.cts +1 -1
  176. package/dist/kaiAgent/types.d.ts +1 -1
  177. package/dist/{kaiAgent-CYU1Uda8.js → kaiAgent-D0MoKqXe.js} +5 -5
  178. package/dist/{kaiAgent-CYU1Uda8.js.map → kaiAgent-D0MoKqXe.js.map} +1 -1
  179. package/dist/{kaiAgent-CDhg0MAw.cjs → kaiAgent-De2T6G4G.cjs} +5 -5
  180. package/dist/{kaiAgent-CDhg0MAw.cjs.map → kaiAgent-De2T6G4G.cjs.map} +1 -1
  181. package/dist/{kaiMemory-oir_qCo_.js → kaiMemory-B1wIwH8Y.js} +2 -2
  182. package/dist/{kaiMemory-oir_qCo_.js.map → kaiMemory-B1wIwH8Y.js.map} +1 -1
  183. package/dist/{kaiMemory-CkLQfJXD.cjs → kaiMemory-DZ6hXni_.cjs} +2 -2
  184. package/dist/{kaiMemory-CkLQfJXD.cjs.map → kaiMemory-DZ6hXni_.cjs.map} +1 -1
  185. package/dist/management/index.cjs +1 -1
  186. package/dist/management/index.d.cts +1 -1
  187. package/dist/management/index.d.ts +1 -1
  188. package/dist/management/index.js +1 -1
  189. package/dist/management/types.d.cts +2 -2
  190. package/dist/management/types.d.ts +2 -2
  191. package/dist/{management-BEGOEQxM.cjs → management-CUXgB2rb.cjs} +6 -6
  192. package/dist/{management-BEGOEQxM.cjs.map → management-CUXgB2rb.cjs.map} +1 -1
  193. package/dist/{management-BcGHyxAP.js → management-Cz5ut18k.js} +6 -6
  194. package/dist/{management-BcGHyxAP.js.map → management-Cz5ut18k.js.map} +1 -1
  195. package/dist/metastore/index.cjs +1 -1
  196. package/dist/metastore/index.d.cts +1 -1
  197. package/dist/metastore/index.d.ts +1 -1
  198. package/dist/metastore/index.js +1 -1
  199. package/dist/metastore/types.d.cts +1 -1
  200. package/dist/metastore/types.d.ts +1 -1
  201. package/dist/{metastore-DeRQ2VIv.cjs → metastore-CV4DUDxP.cjs} +4 -4
  202. package/dist/{metastore-DeRQ2VIv.cjs.map → metastore-CV4DUDxP.cjs.map} +1 -1
  203. package/dist/{metastore-CGsgxjng.js → metastore-CkqFnEfu.js} +4 -4
  204. package/dist/{metastore-CGsgxjng.js.map → metastore-CkqFnEfu.js.map} +1 -1
  205. package/dist/microsoftGraph/index.cjs +2 -2
  206. package/dist/microsoftGraph/index.d.cts +2 -2
  207. package/dist/microsoftGraph/index.d.ts +2 -2
  208. package/dist/microsoftGraph/index.js +2 -2
  209. package/dist/microsoftGraph/types.d.cts +1 -1
  210. package/dist/microsoftGraph/types.d.ts +1 -1
  211. package/dist/{middleware-8zaJWcyU.js → middleware-DxGv7DG8.js} +2 -2
  212. package/dist/{middleware-8zaJWcyU.js.map → middleware-DxGv7DG8.js.map} +1 -1
  213. package/dist/{middleware-B9RNuLfD.cjs → middleware-vIaPDtQI.cjs} +2 -2
  214. package/dist/{middleware-B9RNuLfD.cjs.map → middleware-vIaPDtQI.cjs.map} +1 -1
  215. package/dist/notifications/index.cjs +3 -3
  216. package/dist/notifications/index.d.cts +2 -2
  217. package/dist/notifications/index.d.ts +2 -2
  218. package/dist/notifications/index.js +3 -3
  219. package/dist/notifications/types.d.cts +1 -1
  220. package/dist/notifications/types.d.ts +1 -1
  221. package/dist/oauth/index.cjs +1 -1
  222. package/dist/oauth/index.d.cts +2 -2
  223. package/dist/oauth/index.d.ts +2 -2
  224. package/dist/oauth/index.js +1 -1
  225. package/dist/oauth/types.d.cts +1 -1
  226. package/dist/oauth/types.d.ts +1 -1
  227. package/dist/{oauth-B5Biqz21.cjs → oauth-CSBChWuf.cjs} +5 -5
  228. package/dist/{oauth-B5Biqz21.cjs.map → oauth-CSBChWuf.cjs.map} +1 -1
  229. package/dist/{oauth-ByCdISsV.js → oauth-DOveZKUv.js} +5 -5
  230. package/dist/{oauth-ByCdISsV.js.map → oauth-DOveZKUv.js.map} +1 -1
  231. package/dist/omnisearch/index.cjs +2 -2
  232. package/dist/omnisearch/index.d.cts +2 -2
  233. package/dist/omnisearch/index.d.ts +2 -2
  234. package/dist/omnisearch/index.js +2 -2
  235. package/dist/omnisearch/types.d.cts +1 -1
  236. package/dist/omnisearch/types.d.ts +1 -1
  237. package/dist/{project-UHZGFmmG.d.cts → project-BGk9CtOq.d.cts} +3 -3
  238. package/dist/{project-iBm4cIIR.d.ts → project-DS0HOV3M.d.ts} +3 -3
  239. package/dist/queryService/index.cjs +1 -1
  240. package/dist/queryService/index.d.cts +2 -2
  241. package/dist/queryService/index.d.ts +2 -2
  242. package/dist/queryService/index.js +1 -1
  243. package/dist/queryService/types.d.cts +1 -1
  244. package/dist/queryService/types.d.ts +1 -1
  245. package/dist/queryService-C3BQ6GKW.cjs +214 -0
  246. package/dist/queryService-C3BQ6GKW.cjs.map +1 -0
  247. package/dist/queryService-DQHtHy2-.js +209 -0
  248. package/dist/queryService-DQHtHy2-.js.map +1 -0
  249. package/dist/queue/index.cjs +1 -1
  250. package/dist/queue/index.d.cts +3 -3
  251. package/dist/queue/index.d.ts +3 -3
  252. package/dist/queue/index.js +1 -1
  253. package/dist/queue/types.d.cts +1 -1
  254. package/dist/queue/types.d.ts +1 -1
  255. package/dist/{queue-BiIs9fX4.js → queue-6cywDnA-.js} +5 -5
  256. package/dist/{queue-BiIs9fX4.js.map → queue-6cywDnA-.js.map} +1 -1
  257. package/dist/{queue-CBi9Q8vp.cjs → queue-J2uXzXR9.cjs} +5 -5
  258. package/dist/{queue-CBi9Q8vp.cjs.map → queue-J2uXzXR9.cjs.map} +1 -1
  259. package/dist/scheduler/index.cjs +3 -3
  260. package/dist/scheduler/index.d.cts +2 -2
  261. package/dist/scheduler/index.d.ts +2 -2
  262. package/dist/scheduler/index.js +3 -3
  263. package/dist/scheduler/types.d.cts +1 -1
  264. package/dist/scheduler/types.d.ts +1 -1
  265. package/dist/sdk/configurations/index.cjs +3 -3
  266. package/dist/sdk/configurations/index.cjs.map +1 -1
  267. package/dist/sdk/configurations/index.d.cts +4 -4
  268. package/dist/sdk/configurations/index.d.ts +4 -4
  269. package/dist/sdk/configurations/index.js +3 -3
  270. package/dist/sdk/configurations/index.js.map +1 -1
  271. package/dist/sdk/developerPortal/index.cjs +3 -3
  272. package/dist/sdk/developerPortal/index.d.cts +3 -3
  273. package/dist/sdk/developerPortal/index.d.ts +3 -3
  274. package/dist/sdk/developerPortal/index.js +3 -3
  275. package/dist/sdk/kaiMemory/index.cjs +1 -1
  276. package/dist/sdk/kaiMemory/index.d.cts +1 -1
  277. package/dist/sdk/kaiMemory/index.d.ts +1 -1
  278. package/dist/sdk/kaiMemory/index.js +1 -1
  279. package/dist/sdk/kaiMemory/types.d.cts +1 -1
  280. package/dist/sdk/kaiMemory/types.d.ts +1 -1
  281. package/dist/sdk/queryService/index.d.cts +1 -1
  282. package/dist/sdk/queryService/index.d.ts +1 -1
  283. package/dist/sdk/semanticLayer/index.d.cts +1 -1
  284. package/dist/sdk/semanticLayer/index.d.ts +1 -1
  285. package/dist/sdk/semanticLayer/types.d.cts +1 -1
  286. package/dist/sdk/semanticLayer/types.d.ts +1 -1
  287. package/dist/sdk/tag/index.d.cts +2 -2
  288. package/dist/sdk/tag/index.d.ts +2 -2
  289. package/dist/sdk/tag/types.d.cts +1 -1
  290. package/dist/sdk/tag/types.d.ts +1 -1
  291. package/dist/sdk/vault/index.d.cts +1 -1
  292. package/dist/sdk/vault/index.d.ts +1 -1
  293. package/dist/status/index.cjs +1 -1
  294. package/dist/status/index.d.cts +1 -1
  295. package/dist/status/index.d.ts +1 -1
  296. package/dist/status/index.js +1 -1
  297. package/dist/storage/index.cjs +9 -7
  298. package/dist/storage/index.d.cts +4 -4
  299. package/dist/storage/index.d.ts +4 -4
  300. package/dist/storage/index.js +6 -6
  301. package/dist/storage/types.d.cts +5 -5
  302. package/dist/storage/types.d.ts +5 -5
  303. package/dist/{storage-BpOLWT6h.js → storage--2FvvLAw.js} +7 -7
  304. package/dist/{storage-BpOLWT6h.js.map → storage--2FvvLAw.js.map} +1 -1
  305. package/dist/{storage-KJ5Ki_ma.cjs → storage-BMrYlyLB.cjs} +7 -7
  306. package/dist/{storage-KJ5Ki_ma.cjs.map → storage-BMrYlyLB.cjs.map} +1 -1
  307. package/dist/stream/index.cjs +3 -3
  308. package/dist/stream/index.d.cts +2 -2
  309. package/dist/stream/index.d.ts +2 -2
  310. package/dist/stream/index.js +3 -3
  311. package/dist/stream/types.d.cts +1 -1
  312. package/dist/stream/types.d.ts +1 -1
  313. package/dist/syncActions/index.cjs +1 -1
  314. package/dist/syncActions/index.d.cts +2 -2
  315. package/dist/syncActions/index.d.ts +2 -2
  316. package/dist/syncActions/index.js +1 -1
  317. package/dist/syncActions/types.d.cts +1 -1
  318. package/dist/syncActions/types.d.ts +1 -1
  319. package/dist/{syncActions-BcX3jm2E.cjs → syncActions-DToUhyP3.cjs} +6 -6
  320. package/dist/{syncActions-BcX3jm2E.cjs.map → syncActions-DToUhyP3.cjs.map} +1 -1
  321. package/dist/{syncActions-giPLTfje.js → syncActions-DV_aObTQ.js} +6 -6
  322. package/dist/{syncActions-giPLTfje.js.map → syncActions-DV_aObTQ.js.map} +1 -1
  323. package/dist/telemetry/index.cjs +3 -3
  324. package/dist/telemetry/index.d.cts +2 -2
  325. package/dist/telemetry/index.d.ts +2 -2
  326. package/dist/telemetry/index.js +3 -3
  327. package/dist/telemetry/types.d.cts +1 -1
  328. package/dist/telemetry/types.d.ts +1 -1
  329. package/dist/{transientRetries-BKqmb85B.js → transientRetries-BORv47mH.js} +2 -2
  330. package/dist/{transientRetries-BKqmb85B.js.map → transientRetries-BORv47mH.js.map} +1 -1
  331. package/dist/{transientRetries-CM7rAEXQ.cjs → transientRetries-CBorl4Ue.cjs} +2 -2
  332. package/dist/{transientRetries-CM7rAEXQ.cjs.map → transientRetries-CBorl4Ue.cjs.map} +1 -1
  333. package/dist/{types-BWMOK6eL.d.cts → types-B4Vwz45w.d.cts} +2 -2
  334. package/dist/{types-Dryq2GGE.d.cts → types-B4ezB18r.d.cts} +2 -2
  335. package/dist/{types-Bdl7EFMc.d.ts → types-B6JcEPEu.d.ts} +2 -2
  336. package/dist/{types-eFi8xJIM.d.cts → types-B6f6LpZ_.d.cts} +2 -2
  337. package/dist/{types-C9okze_R.d.ts → types-BD0B1KQ6.d.ts} +3 -26
  338. package/dist/{types-DeyXJzWz.d.cts → types-BEw98Dd2.d.cts} +2 -2
  339. package/dist/{types-1IBnjBVJ.d.cts → types-BVJmcoqA.d.cts} +2 -2
  340. package/dist/{types-B1qe1etN.d.cts → types-BljDxuWG.d.cts} +3 -3
  341. package/dist/{types-BiDdBXSm.d.ts → types-Bp8G9yta.d.ts} +2 -2
  342. package/dist/{types-PZzNANiS.d.cts → types-Bv2Ds1hL.d.cts} +2 -2
  343. package/dist/{types-D-tJt0hQ.d.cts → types-BynQKst1.d.cts} +2 -2
  344. package/dist/{types-BuclMPeY.d.cts → types-C5B3Pfob.d.cts} +2 -2
  345. package/dist/{types-DNgazFnF.d.cts → types-CIlBSV99.d.cts} +2 -2
  346. package/dist/{types-DschSZHf.d.cts → types-CKdNf_2k.d.cts} +3 -3
  347. package/dist/{types-B0e-no6u.d.ts → types-CLtYOszN.d.cts} +20 -3
  348. package/dist/{types-Du5o-tud.d.ts → types-CQYyULrw.d.ts} +2 -2
  349. package/dist/{types-BrEVh0WE.d.cts → types-CRC4lbPw.d.cts} +8 -4
  350. package/dist/{types-CxEJ77m3.d.cts → types-CSE8bHiq.d.cts} +3 -3
  351. package/dist/{types-DRCttnIN.d.ts → types-CTYTMXXj.d.ts} +2 -2
  352. package/dist/{types-6T04_qUf.d.ts → types-CepTvkfm.d.ts} +2 -2
  353. package/dist/{types-DHMxPJZq.d.cts → types-Cf0WE6qK.d.cts} +2 -2
  354. package/dist/{types-DwbTiyhZ.d.cts → types-ChOJ-Az7.d.cts} +2 -2
  355. package/dist/{types-wYrC2boT.d.ts → types-Cr6WA6CN.d.ts} +2 -2
  356. package/dist/{types-D6lre27s.d.ts → types-CsVRsObb.d.ts} +2 -2
  357. package/dist/{types-CcGp6O3B.d.cts → types-D-ufoskb.d.cts} +2 -2
  358. package/dist/{types-LconaX98.d.cts → types-D2hhEGem.d.cts} +2 -2
  359. package/dist/{types-inG9y3dP.d.ts → types-D5bxXqEU.d.ts} +2 -2
  360. package/dist/{types-BE8abIig.d.cts → types-DKKHKj19.d.cts} +2 -2
  361. package/dist/{types-E8tzafsk.d.cts → types-DNwIMEuB.d.cts} +3 -26
  362. package/dist/{types-DtOfhDzz.d.ts → types-DSWIIMdv.d.ts} +3 -3
  363. package/dist/{types-Bat0SIZA.d.cts → types-DU8aPTFW.d.cts} +2 -2
  364. package/dist/{types-B8k1DqlU.d.ts → types-DX1Dz0xK.d.ts} +2 -2
  365. package/dist/{types-ZZwdKCBl.d.ts → types-DbthI3r-.d.ts} +2 -2
  366. package/dist/{types-B3ri-iiC.d.ts → types-DjSjUKUl.d.ts} +2 -2
  367. package/dist/{types-YpOm4yXE.d.cts → types-DjWubjvP.d.cts} +2 -2
  368. package/dist/{types-CRubbBcU.d.cts → types-Do3__S4Q.d.cts} +2 -2
  369. package/dist/{types-DKSUG2dZ.d.ts → types-DoSZQ1Bi.d.ts} +8 -4
  370. package/dist/{types-CWcdaq-K.d.ts → types-Dsf7CYmm.d.ts} +2 -2
  371. package/dist/{types-CPWjRdnj.d.cts → types-Ey59ZILC.d.ts} +20 -3
  372. package/dist/{types--Rp5wvaz.d.ts → types-OHt0D_f2.d.ts} +2 -2
  373. package/dist/{types-Cr5lyI99.d.ts → types-Rrcx-8LM.d.ts} +2 -2
  374. package/dist/{types-DUpVIuk7.d.ts → types-Tg3euEN_.d.ts} +2 -2
  375. package/dist/{types-37vwxse4.d.cts → types-Y4e8GGa3.d.cts} +2 -2
  376. package/dist/{types-DJzTVMu1.d.ts → types-d5Bt8Mr3.d.ts} +2 -2
  377. package/dist/{types-jjOulnni.d.ts → types-dU3EA8gk.d.ts} +2 -2
  378. package/dist/{types-ir7T2a9a.d.ts → types-iU1Sc1IM.d.ts} +3 -3
  379. package/dist/{types-zPY-XGnM.d.ts → types-kGZQQcIK.d.ts} +2 -2
  380. package/dist/{types-xzt_2H63.d.ts → types-zlYUn0oi.d.ts} +3 -3
  381. package/dist/{validateConnectionStatus-DYwWeWVo.js → validateConnectionStatus-DV00sDmu.js} +3 -3
  382. package/dist/{validateConnectionStatus-DYwWeWVo.js.map → validateConnectionStatus-DV00sDmu.js.map} +1 -1
  383. package/dist/{validateConnectionStatus-BjemGI1e.cjs → validateConnectionStatus-ckaHcRx8.cjs} +3 -3
  384. package/dist/{validateConnectionStatus-BjemGI1e.cjs.map → validateConnectionStatus-ckaHcRx8.cjs.map} +1 -1
  385. package/dist/vault/index.cjs +4 -4
  386. package/dist/vault/index.d.cts +1 -1
  387. package/dist/vault/index.d.ts +1 -1
  388. package/dist/vault/index.js +4 -4
  389. package/dist/vault/types.d.cts +1 -1
  390. package/dist/vault/types.d.ts +1 -1
  391. package/package.json +2 -2
  392. package/surface/apps.md +3 -3
  393. package/surface/dataScience.md +2 -11
  394. package/surface/editor.md +5 -5
  395. package/surface/queue.md +1 -1
  396. package/dist/QueryJobError-Iq9O90Uh.js +0 -21
  397. package/dist/QueryJobError-Iq9O90Uh.js.map +0 -1
  398. package/dist/QueryJobError-Oy0fl4aw.cjs +0 -32
  399. package/dist/QueryJobError-Oy0fl4aw.cjs.map +0 -1
  400. package/dist/appLogs-CTvZAihm.d.ts +0 -8
  401. package/dist/appLogs-CnLNMH7M.d.cts +0 -8
  402. package/dist/appLogs-CoAWQGxs.cjs +0 -152
  403. package/dist/appLogs-CoAWQGxs.cjs.map +0 -1
  404. package/dist/appLogs-DFcPwVk8.js +0 -131
  405. package/dist/appLogs-DFcPwVk8.js.map +0 -1
  406. package/dist/apps/index.cjs.map +0 -1
  407. package/dist/apps/index.js.map +0 -1
  408. package/dist/componentId-C8ZTXXDo.cjs.map +0 -1
  409. package/dist/componentId-b_qBbJEM.js.map +0 -1
  410. package/dist/constants-BMSHGwOR.js.map +0 -1
  411. package/dist/constants-DhFQWQgy.cjs.map +0 -1
  412. package/dist/createFetchClient-DEkUH662.cjs.map +0 -1
  413. package/dist/dataScience-CXmkEOAi.js +0 -118
  414. package/dist/dataScience-CXmkEOAi.js.map +0 -1
  415. package/dist/dataScience-CufjHPSd.cjs +0 -123
  416. package/dist/dataScience-CufjHPSd.cjs.map +0 -1
  417. package/dist/index-BZDxWvZW.d.ts +0 -214
  418. package/dist/index-ClIV2Lch.d.cts +0 -214
  419. package/dist/queryService-Cg-eMysa.cjs +0 -126
  420. package/dist/queryService-Cg-eMysa.cjs.map +0 -1
  421. package/dist/queryService-x8kq8Z2-.js +0 -121
  422. package/dist/queryService-x8kq8Z2-.js.map +0 -1
@@ -1 +1 @@
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_FAIL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AC,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-BORv47mH.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;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AAS,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,4 +1,4 @@
1
- const require_createFetchClient = require("./createFetchClient-DEkUH662.cjs");
1
+ const require_createFetchClient = require("./createFetchClient-CDKSkd7i.cjs");
2
2
  const require_createAbortError = require("./createAbortError-Dzc9yObN.cjs");
3
3
  const require_store = require("./store-2OyH1XOP.cjs");
4
4
  // src/utils/async/delay.ts
@@ -507,4 +507,4 @@ Object.defineProperty(exports, "transientRetries", {
507
507
  }
508
508
  });
509
509
 
510
- //# sourceMappingURL=transientRetries-CM7rAEXQ.cjs.map
510
+ //# sourceMappingURL=transientRetries-CBorl4Ue.cjs.map
@@ -1 +1 @@
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,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,CAAC;AAEhF,MAAM,WAAc,UAA+B;CAAE,SAAS;CAAM;AAAK;AACzE,MAAM,WAA4B,WAAgC;CAAE,SAAS;CAAO;AAAM;AAC1F,MAAM,aAAiC,WACrC,OAAO;AACT,MAAM,aAAiC,WACrC,CAAC,OAAO;AAEV,MAAM,OAA8B,QAAsB,OACxD,OAAO,UAAU,QAAQ,GAAG,OAAO,IAAI,CAAC,IAAI;AAE9C,MAA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B,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,aAChBC,0BAAAA,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-CBorl4Ue.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,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,CAAC;AAEhF,MAAM,WAAc,UAA+B;CAAE,SAAS;CAAM;AAAK;AACzE,MAAM,WAA4B,WAAgC;CAAE,SAAS;CAAO;AAAM;AAC1F,MAAM,aAAiC,WACrC,OAAO;AACT,MAAM,aAAiC,WACrC,CAAC,OAAO;AAEV,MAAM,OAA8B,QAAsB,OACxD,OAAO,UAAU,QAAQ,GAAG,OAAO,IAAI,CAAC,IAAI;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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,aAChBC,0BAAAA,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,4 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, n as ArrayElement, r as OpenapiBodyType } from "./index-D1mduJne.cjs";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, n as ArrayElement, r as OpenapiBodyType } from "./index-FrsEkDvX.cjs";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -7517,4 +7517,4 @@ type DeleteSourceQuery = OpenapiQueryType<paths['/v1/branches/{branchId}/sources
7517
7517
  type SinkStatisticsFilesQuery = OpenapiQueryType<paths['/v1/branches/{branchId}/sources/{sourceId}/sinks/{sinkId}/statistics/files']['get']>;
7518
7518
  type TestSourceQuery = OpenapiQueryType<paths['/v1/branches/{branchId}/sources/{sourceId}/test']['post']>;
7519
7519
  export { UpdateSinkSettingsRequestBody as C, components as E, UpdateSinkRequestBody as S, UpdateSourceSettingsRequestBody as T, TableColumn as _, OTLPSource as a, TestResult as b, SettingsResult as c, SinkStatisticsFilesQuery as d, SinkStatisticsFilesResult as f, SourcesList as g, Source as h, OTLPSignal as i, Sink as l, SinksList as m, CreateSourceRequestBody as n, PaginationQuery as o, SinkStatisticsTotalResult as p, DeleteSourceQuery as r, SettingResult as s, CreateSinkRequestBody as t, SinkFile as u, TableSinkCreate as v, UpdateSourceRequestBody as w, TestSourceQuery as x, Task as y };
7520
- //# sourceMappingURL=types-BWMOK6eL.d.cts.map
7520
+ //# sourceMappingURL=types-B4Vwz45w.d.cts.map
@@ -1,4 +1,4 @@
1
- import { li as MiddlewareFn, si as BaseUrl } from "./index-D1mduJne.cjs";
1
+ import { di as MiddlewareFn, li as BaseUrl } from "./index-FrsEkDvX.cjs";
2
2
  type AuthStrategy = {
3
3
  type: 'sapi-token';
4
4
  token: string;
@@ -16,4 +16,4 @@ type ClientInitOptions = {
16
16
  middlewares: MiddlewareFn[];
17
17
  };
18
18
  export { ClientInitOptions as n, AuthStrategy as r, BaseClientOptions as t };
19
- //# sourceMappingURL=types-Dryq2GGE.d.cts.map
19
+ //# sourceMappingURL=types-B4ezB18r.d.cts.map
@@ -1,4 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.js";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-FrsEkDvX.js";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -1404,4 +1404,4 @@ type PostSqlSessionLoadBody = OpenapiBodyType<paths['/sql/sessions/{id}/load']['
1404
1404
  type PostSqlSessionUnloadPath = OpenapiPathType<paths['/sql/sessions/{id}/unload']['post']>;
1405
1405
  type PostSqlSessionUnloadBody = OpenapiBodyType<paths['/sql/sessions/{id}/unload']['post']>;
1406
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 };
1407
- //# sourceMappingURL=types-Bdl7EFMc.d.ts.map
1407
+ //# sourceMappingURL=types-B6JcEPEu.d.ts.map
@@ -1,4 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, n as ArrayElement, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.cjs";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, n as ArrayElement, r as OpenapiBodyType, s as OpenapiPathType } from "./index-FrsEkDvX.cjs";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -388,4 +388,4 @@ type VariableWithHash = Omit<VariableWithHashRaw, 'hash'> & {
388
388
  };
389
389
  type AnyVariable = VariableWithHash | CreateVariableBody;
390
390
  export { GetVariablesQuery as a, GetVariablesByBranchId as i, CreateVariableBody as n, VariableWithHash as o, DeleteVariablePath as r, AnyVariable as t };
391
- //# sourceMappingURL=types-eFi8xJIM.d.cts.map
391
+ //# sourceMappingURL=types-B6f6LpZ_.d.cts.map
@@ -1,5 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.js";
2
- import "./appLogs-CTvZAihm.js";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, s as OpenapiPathType } from "./index-FrsEkDvX.js";
3
2
  /**
4
3
  * This file was auto-generated by openapi-typescript.
5
4
  * Do not make direct changes to the file.
@@ -2364,36 +2363,14 @@ interface operations {
2364
2363
  };
2365
2364
  }
2366
2365
  type GetAppsQuery = OpenapiQueryType<paths['/apps']['get']>;
2367
- type CreateDataAppBody = OpenapiBodyType<paths['/apps']['post']>;
2368
2366
  type GetDataAppPath = OpenapiPathType<paths['/apps/{appId}']['get']>;
2369
- type DeleteDataAppPath = OpenapiPathType<paths['/apps/{appId}']['delete']>;
2370
- type GetDataAppPasswordPath = OpenapiPathType<paths['/apps/{appId}/password']['get']>;
2371
- type ResetDataAppPasswordPath = OpenapiPathType<paths['/apps/{appId}/reset-password']['post']>;
2372
2367
  type CreateDataAppPreviewLinkPath = OpenapiPathType<paths['/apps/{appId}/preview-link']['post']>;
2373
2368
  type DataAppPreviewLink = OpenapiReturnType<paths['/apps/{appId}/preview-link']['post']>;
2374
- type GetDataAppRunsPath = OpenapiPathType<paths['/apps/{appId}/runs']['get']>;
2375
- type GetDataAppRunsQuery = OpenapiQueryType<paths['/apps/{appId}/runs']['get']>;
2376
- type GetDataAppRunPath = OpenapiPathType<paths['/apps/{appId}/runs/{runId}']['get']>;
2377
- type RawAppRun = OpenapiReturnType<paths['/apps/{appId}/runs']['get']>[number];
2378
- type DataAppRun = Omit<RawAppRun, 'state'> & {
2379
- state: 'running' | 'failed' | 'starting' | 'finished';
2380
- };
2381
- type GetDataAppLogsDownloadPath = OpenapiPathType<paths['/apps/{appId}/logs/download']['get']>;
2382
- type GetDataAppLogsTailPath = OpenapiPathType<paths['/apps/{appId}/logs/tail']['get']>;
2383
- type GetDataAppLogsTailQuery = OpenapiQueryType<paths['/apps/{appId}/logs/tail']['get']>;
2384
2369
  type GetSandboxPath = OpenapiPathType<paths['/sandboxes/{appId}']['get']>;
2385
2370
  type DeleteSandboxPath = OpenapiPathType<paths['/sandboxes/{appId}']['delete']>;
2386
2371
  type DataApp = OpenapiReturnType<paths['/apps/{appId}']['get']>;
2387
2372
  type Sandbox = OpenapiReturnType<paths['/sandboxes/{appId}']['get']>;
2388
2373
  type Runtime = OpenapiReturnType<paths['/runtimes']['get']>[number];
2389
2374
  type RuntimeImageKey = Extract<keyof Runtime, 'imageTag' | 'sandboxImageTag' | 'transformationComponentTag'>;
2390
- type PatchDataAppPath = OpenapiPathType<paths['/apps/{appId}']['patch']>;
2391
- type PatchDataAppBodyRunning = {
2392
- desiredState: 'running';
2393
- } & Omit<OpenapiBodyType<paths['/apps/{appId}']['patch']>, 'desiredState'>;
2394
- type PatchDataAppBodyStopped = {
2395
- desiredState: 'stopped';
2396
- };
2397
- type PatchDataAppBody = PatchDataAppBodyRunning | PatchDataAppBodyStopped;
2398
- export { RuntimeImageKey as C, Runtime as S, GetSandboxPath as _, DataAppRun as a, RawAppRun as b, GetAppsQuery as c, GetDataAppLogsTailQuery as d, GetDataAppPasswordPath as f, GetDataAppRunsQuery as g, GetDataAppRunsPath as h, DataAppPreviewLink as i, GetDataAppLogsDownloadPath as l, GetDataAppRunPath as m, CreateDataAppPreviewLinkPath as n, DeleteDataAppPath as o, GetDataAppPath as p, DataApp as r, DeleteSandboxPath as s, CreateDataAppBody as t, GetDataAppLogsTailPath as u, PatchDataAppBody as v, Sandbox as w, ResetDataAppPasswordPath as x, PatchDataAppPath as y };
2399
- //# sourceMappingURL=types-C9okze_R.d.ts.map
2375
+ export { GetAppsQuery as a, Runtime as c, DeleteSandboxPath as i, RuntimeImageKey as l, DataApp as n, GetDataAppPath as o, DataAppPreviewLink as r, GetSandboxPath as s, CreateDataAppPreviewLinkPath as t, Sandbox as u };
2376
+ //# sourceMappingURL=types-BD0B1KQ6.d.ts.map
@@ -1,4 +1,4 @@
1
- import { a as OpenapiFormDataType } from "./index-D1mduJne.cjs";
1
+ import { a as OpenapiFormDataType } from "./index-FrsEkDvX.cjs";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -456,4 +456,4 @@ type WriteTableInput = Omit<WriteTableFormData, 'data'> & {
456
456
  file: File;
457
457
  };
458
458
  export { WriteTableInput as n, UploadFileInput as t };
459
- //# sourceMappingURL=types-DeyXJzWz.d.cts.map
459
+ //# sourceMappingURL=types-BEw98Dd2.d.cts.map
@@ -1,4 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.cjs";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-FrsEkDvX.cjs";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -1404,4 +1404,4 @@ type PostSqlSessionLoadBody = OpenapiBodyType<paths['/sql/sessions/{id}/load']['
1404
1404
  type PostSqlSessionUnloadPath = OpenapiPathType<paths['/sql/sessions/{id}/unload']['post']>;
1405
1405
  type PostSqlSessionUnloadBody = OpenapiBodyType<paths['/sql/sessions/{id}/unload']['post']>;
1406
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 };
1407
- //# sourceMappingURL=types-1IBnjBVJ.d.cts.map
1407
+ //# sourceMappingURL=types-BVJmcoqA.d.cts.map
@@ -1,5 +1,5 @@
1
- import { i as CreateMetaObjectInput } from "./types-DNgazFnF.cjs";
2
- import { n as createMetastoreClient } from "./index-DgGpQsAT.cjs";
1
+ import { i as CreateMetaObjectInput } from "./types-CIlBSV99.cjs";
2
+ import { n as createMetastoreClient } from "./index-CNJBmCHM.cjs";
3
3
  /**
4
4
  * The closed value sets the metastore accepts on a semantic object.
5
5
  *
@@ -195,4 +195,4 @@ type SemanticUnreadableObjectRef = {
195
195
  modelUUID: string | null;
196
196
  };
197
197
  export { CONSTRAINT_TYPES as A, SemanticRuleExpression as C, UpdateSemanticObjectMeta as D, SemanticValidationQuery as E, SQL_DIALECTS as F, RELATIONSHIP_JOIN_TYPES as M, RULE_OPERATORS as N, CONSTRAINT_SCOPES as O, SEMANTIC_OBJECT_SCOPES as P, SemanticRelationshipJoinType as S, SemanticUnreadableObjectRef as T, SemanticObject as _, SemanticChildObjectType as a, SemanticObjectType as b, SemanticConstraintSeverity as c, SemanticFieldData as d, SemanticFieldRole as f, SemanticModelData as g, SemanticModelChildRef as h, SemanticChildObjectDataMap as i, FIELD_ROLES as j, CONSTRAINT_SEVERITIES as k, SemanticConstraintType as l, SemanticMetricData as m, MetastoreClient as n, SemanticConstraintData as o, SemanticGlossaryData as p, SemanticAiMetadata as r, SemanticConstraintScope as s, CreateSemanticObjectMeta as t, SemanticDatasetData as u, SemanticObjectMeta as v, SemanticRuleOperator as w, SemanticRelationshipData as x, SemanticObjectScope as y };
198
- //# sourceMappingURL=types-B1qe1etN.d.cts.map
198
+ //# sourceMappingURL=types-BljDxuWG.d.cts.map
@@ -1,4 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.js";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-FrsEkDvX.js";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -1781,4 +1781,4 @@ type MetaStoreListResponse<TData extends Record<string, unknown>> = {
1781
1781
  type GetSchemaPath = OpenapiPathType<paths['/api/v1/schema/{objectType}']['get']>;
1782
1782
  type GetVersionedSchemaPath = OpenapiPathType<paths['/api/v1/schema/{objectType}/{version}']['get']>;
1783
1783
  export { ReplaceMetaObjectPath as A, MetaObjectMeta as C, RawMetaObject as D, MetaStoreObjectResponse as E, UpdateMetaObjectBody as F, UpdateMetaObjectInput as I, UpdateMetaObjectPath as L, ReplaceTargetProjectsInput as M, ReplaceTargetProjectsPath as N, ReplaceMetaObjectBody as O, ScopeElevationRequestPath as P, components as R, MetaObject as S, MetaStoreListResponse as T, GetMetaObjectsQuery as _, CreateMetaObjectPath as a, GetOrganizationMetaObjectsQuery as b, DeleteMetaObjectRevisionPath as c, GetMetaObjectRevisionsInput as d, GetMetaObjectRevisionsPath as f, GetMetaObjectsPath as g, GetMetaObjectsInput as h, CreateMetaObjectInput as i, ReplaceTargetProjectsBody as j, ReplaceMetaObjectInput as k, GetMetaObjectPath as l, GetMetaObjectRevisionsSchemaQuery as m, GetVersionedSchemaPath as n, CreateMetaObjectReturn as o, GetMetaObjectRevisionsQuery as p, CreateMetaObjectBody as r, DeleteMetaObjectPath as s, GetSchemaPath as t, GetMetaObjectRevisionPath as u, GetMetaObjectsSchemaQuery as v, MetaObjectScope as w, GetOrganizationMetaObjectsSchemaQuery as x, GetOrganizationMetaObjectsPath as y, paths as z };
1784
- //# sourceMappingURL=types-BiDdBXSm.d.ts.map
1784
+ //# sourceMappingURL=types-Bp8G9yta.d.ts.map
@@ -1,4 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.cjs";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-FrsEkDvX.cjs";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -4455,4 +4455,4 @@ type GetArtifactPath = OpenapiPathType<paths['/api/artifacts/{id}']['get']>;
4455
4455
  type ArtifactResponse = OpenapiReturnType<paths['/api/artifacts/{id}']['get']>;
4456
4456
  type ArtifactListResponse = OpenapiReturnType<paths['/api/artifacts']['get']>;
4457
4457
  export { ChatWithMessages as a, GetChatPath as c, PrepareChatRequest as d, UsageResponse as f, ChatRequest as i, GetHistoryQuery as l, ArtifactListResponse as n, GetArtifactPath as o, VoteRequest as p, ArtifactResponse as r, GetArtifactsQuery as s, ApprovalBody as t, GetVotesQuery as u };
4458
- //# sourceMappingURL=types-PZzNANiS.d.cts.map
4458
+ //# sourceMappingURL=types-Bv2Ds1hL.d.cts.map
@@ -1,4 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.cjs";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-FrsEkDvX.cjs";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -398,4 +398,4 @@ type SubscriptionId = OpenapiPathType<paths['/project-subscriptions/{subscriptio
398
398
  type SubscriptionRecipient = CreateSubscriptionBody['recipient'];
399
399
  type SubscriptionFilter = NonNullable<CreateSubscriptionBody['filters']>[number];
400
400
  export { SubscriptionId as a, SubscriptionFilter as i, ListSubscriptionsQuery as n, SubscriptionRecipient as o, ProjectSubscription as r, components as s, CreateSubscriptionBody as t };
401
- //# sourceMappingURL=types-D-tJt0hQ.d.cts.map
401
+ //# sourceMappingURL=types-BynQKst1.d.cts.map
@@ -1,4 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.cjs";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-FrsEkDvX.cjs";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -3856,4 +3856,4 @@ type RemoveWebauthnPath = OpenapiPathType<paths['/v1/auth/webauthn/{id}']['delet
3856
3856
  type RemoveWebauthnQuery = NonNullable<OpenapiQueryType<paths['/v1/auth/webauthn/{id}']['delete']>>;
3857
3857
  type RemoveWebauthnInput = RemoveWebauthnPath & RemoveWebauthnQuery;
3858
3858
  export { CreateDeviceAuthorizationBody as $, PatScopeInput as A, GetMeMaintainersResult as B, GetPkceTokenResult as C, ExchangePatBodyRaw as D, CreatePatResult as E, TotpVerifyResult as F, MeMaintainer as G, GetMeOrganizationsResult as H, VerifyMfaBody as I, MeResult as J, MeOrganization as K, VerifyMfaResult as L, DisableTotpPath as M, RegenerateRecoveryCodesResult as N, ExchangePatInput as O, TotpSetupResult as P, ApproveDeviceAuthorizationResult as Q, VerifyMfaType as R, GetPkceTokenBody as S, CreatePatInput as T, GetMeProjectsQuery as U, GetMeOrganizationsQuery as V, GetMeProjectsResult as W, LoginBody as X, MeUser as Y, ApproveDeviceAuthorizationBody as Z, RevokeSessionPath as _, RemoveWebauthnInput as a, InitiateSamlBody as b, IntrospectTokenResult as c, RefreshTokenResult as d, CreateDeviceAuthorizationResult as et, RevokeTokenBody as f, SudoResult as g, SudoChallengeResult as h, RegisterWebauthnResult as i, paths as it, RevokePatPath as j, ListPatsResult as k, RefreshTokenBody as l, SudoBodyRaw as m, RegisterWebauthnInput as n, GetDeviceAuthorizationTokenResult as nt, RemoveWebauthnPath as o, SudoBody as p, MeProject as q, RegisterWebauthnOptionsResult as r, components as rt, RemoveWebauthnQuery as s, ListWebauthnCredentialsResult as t, GetDeviceAuthorizationTokenBody as tt, RefreshTokenPartialBody as u, AssertSamlBody as v, CreatePatBodyRaw as w, InitiateSamlResult as x, AssertSamlResult as y, GetMeMaintainersQuery as z };
3859
- //# sourceMappingURL=types-BuclMPeY.d.cts.map
3859
+ //# sourceMappingURL=types-C5B3Pfob.d.cts.map
@@ -1,4 +1,4 @@
1
- import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-D1mduJne.cjs";
1
+ import { c as OpenapiQueryType, l as OpenapiReturnType, r as OpenapiBodyType, s as OpenapiPathType } from "./index-FrsEkDvX.cjs";
2
2
  /**
3
3
  * This file was auto-generated by openapi-typescript.
4
4
  * Do not make direct changes to the file.
@@ -1781,4 +1781,4 @@ type MetaStoreListResponse<TData extends Record<string, unknown>> = {
1781
1781
  type GetSchemaPath = OpenapiPathType<paths['/api/v1/schema/{objectType}']['get']>;
1782
1782
  type GetVersionedSchemaPath = OpenapiPathType<paths['/api/v1/schema/{objectType}/{version}']['get']>;
1783
1783
  export { ReplaceMetaObjectPath as A, MetaObjectMeta as C, RawMetaObject as D, MetaStoreObjectResponse as E, UpdateMetaObjectBody as F, UpdateMetaObjectInput as I, UpdateMetaObjectPath as L, ReplaceTargetProjectsInput as M, ReplaceTargetProjectsPath as N, ReplaceMetaObjectBody as O, ScopeElevationRequestPath as P, components as R, MetaObject as S, MetaStoreListResponse as T, GetMetaObjectsQuery as _, CreateMetaObjectPath as a, GetOrganizationMetaObjectsQuery as b, DeleteMetaObjectRevisionPath as c, GetMetaObjectRevisionsInput as d, GetMetaObjectRevisionsPath as f, GetMetaObjectsPath as g, GetMetaObjectsInput as h, CreateMetaObjectInput as i, ReplaceTargetProjectsBody as j, ReplaceMetaObjectInput as k, GetMetaObjectPath as l, GetMetaObjectRevisionsSchemaQuery as m, GetVersionedSchemaPath as n, CreateMetaObjectReturn as o, GetMetaObjectRevisionsQuery as p, CreateMetaObjectBody as r, DeleteMetaObjectPath as s, GetSchemaPath as t, GetMetaObjectRevisionPath as u, GetMetaObjectsSchemaQuery as v, MetaObjectScope as w, GetOrganizationMetaObjectsSchemaQuery as x, GetOrganizationMetaObjectsPath as y, paths as z };
1784
- //# sourceMappingURL=types-DNgazFnF.d.cts.map
1784
+ //# sourceMappingURL=types-CIlBSV99.d.cts.map
@@ -1,5 +1,5 @@
1
- import { S as MetaObject, i as CreateMetaObjectInput } from "./types-DNgazFnF.cjs";
2
- import { n as createMetastoreClient } from "./index-DgGpQsAT.cjs";
1
+ import { S as MetaObject, i as CreateMetaObjectInput } from "./types-CIlBSV99.cjs";
2
+ import { n as createMetastoreClient } from "./index-CNJBmCHM.cjs";
3
3
  type MetastoreClient = ReturnType<typeof createMetastoreClient>;
4
4
  type TagData = {
5
5
  name: string;
@@ -27,4 +27,4 @@ type UpdateMetaObjectMetaDataInput = {
27
27
  name?: string;
28
28
  };
29
29
  export { TagWithBindings as a, TagData as i, MetastoreClient as n, UpdateMetaObjectMetaDataInput as o, TagBindingData as r, CreateMetaObjectMetaDataInput as t };
30
- //# sourceMappingURL=types-DschSZHf.d.cts.map
30
+ //# sourceMappingURL=types-CKdNf_2k.d.cts.map