@keboola/api-client 25.0.0 → 29.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 (812) hide show
  1. package/AGENTS.md +623 -0
  2. package/API-SURFACE.md +133 -57
  3. package/README.md +81 -42
  4. package/dist/ManagementClientAuthError-B97OtOQ7.js +15 -0
  5. package/dist/ManagementClientAuthError-B97OtOQ7.js.map +1 -0
  6. package/dist/ManagementClientAuthError-ZJ2-RoKT.cjs +20 -0
  7. package/dist/ManagementClientAuthError-ZJ2-RoKT.cjs.map +1 -0
  8. package/dist/QueryJobTimeoutError-C7JbNGOM.js +38 -0
  9. package/dist/QueryJobTimeoutError-C7JbNGOM.js.map +1 -0
  10. package/dist/QueryJobTimeoutError-CVNPdCWX.cjs +61 -0
  11. package/dist/QueryJobTimeoutError-CVNPdCWX.cjs.map +1 -0
  12. package/dist/SyncActionError-BG0zwchi.cjs +35 -0
  13. package/dist/SyncActionError-BG0zwchi.cjs.map +1 -0
  14. package/dist/SyncActionError-CoZFsdUk.js +24 -0
  15. package/dist/SyncActionError-CoZFsdUk.js.map +1 -0
  16. package/dist/UserError-By_Zckmc.js +10 -0
  17. package/dist/UserError-By_Zckmc.js.map +1 -0
  18. package/dist/UserError-CSGO1qII.cjs +15 -0
  19. package/dist/UserError-CSGO1qII.cjs.map +1 -0
  20. package/dist/ValidationError-CzPWydEb.js +44 -0
  21. package/dist/ValidationError-CzPWydEb.js.map +1 -0
  22. package/dist/ValidationError-h5qvwahi.cjs +61 -0
  23. package/dist/ValidationError-h5qvwahi.cjs.map +1 -0
  24. package/dist/adminRoles-B40yBcmq.js +14 -0
  25. package/dist/adminRoles-B40yBcmq.js.map +1 -0
  26. package/dist/adminRoles-C696kD_U.d.cts +14 -0
  27. package/dist/adminRoles-C696kD_U.d.ts +14 -0
  28. package/dist/adminRoles-CO7J5qAy.cjs +19 -0
  29. package/dist/adminRoles-CO7J5qAy.cjs.map +1 -0
  30. package/dist/ai/index.cjs +62 -12
  31. package/dist/ai/index.cjs.map +1 -1
  32. package/dist/ai/index.d.cts +52 -50
  33. package/dist/ai/index.d.ts +52 -50
  34. package/dist/ai/index.js +62 -4
  35. package/dist/ai/index.js.map +1 -1
  36. package/dist/ai/types.cjs +0 -4
  37. package/dist/ai/types.d.cts +2 -2
  38. package/dist/ai/types.d.ts +2 -2
  39. package/dist/ai/types.js +1 -3
  40. package/dist/appLogs-CNG3yby-.cjs +153 -0
  41. package/dist/appLogs-CNG3yby-.cjs.map +1 -0
  42. package/dist/appLogs-Dl5BcCSD.d.cts +10 -0
  43. package/dist/appLogs-VdgP08aX.d.ts +10 -0
  44. package/dist/appLogs-enL9XR9r.js +132 -0
  45. package/dist/appLogs-enL9XR9r.js.map +1 -0
  46. package/dist/apps/index.cjs +231 -0
  47. package/dist/apps/index.cjs.map +1 -0
  48. package/dist/apps/index.d.cts +248 -0
  49. package/dist/apps/index.d.ts +248 -0
  50. package/dist/apps/index.js +230 -0
  51. package/dist/apps/index.js.map +1 -0
  52. package/dist/apps/types.cjs +0 -0
  53. package/dist/apps/types.d.cts +3 -0
  54. package/dist/apps/types.d.ts +3 -0
  55. package/dist/apps/types.js +1 -0
  56. package/dist/assets/index.cjs +33 -38
  57. package/dist/assets/index.cjs.map +1 -1
  58. package/dist/assets/index.d.cts +22 -22
  59. package/dist/assets/index.d.ts +22 -22
  60. package/dist/assets/index.js +32 -36
  61. package/dist/assets/index.js.map +1 -1
  62. package/dist/assets/schema.cjs +23 -13
  63. package/dist/assets/schema.cjs.map +1 -1
  64. package/dist/assets/schema.d.cts +29 -28
  65. package/dist/assets/schema.d.ts +29 -28
  66. package/dist/assets/schema.js +21 -2
  67. package/dist/assets/schema.js.map +1 -1
  68. package/dist/auth/index.cjs +14 -53
  69. package/dist/auth/index.d.cts +2 -305
  70. package/dist/auth/index.d.ts +2 -305
  71. package/dist/auth/index.js +2 -4
  72. package/dist/auth/types.cjs +0 -4
  73. package/dist/auth/types.d.cts +2 -7
  74. package/dist/auth/types.d.ts +2 -7
  75. package/dist/auth/types.js +1 -3
  76. package/dist/auth-5HCvCsZO.cjs +18 -0
  77. package/dist/auth-5HCvCsZO.cjs.map +1 -0
  78. package/dist/auth-D2jfNlpX.js +13 -0
  79. package/dist/{chunk-EDX5D6UY.js.map → auth-D2jfNlpX.js.map} +1 -1
  80. package/dist/authClient-Bgj2Ay7h.d.cts +320 -0
  81. package/dist/authClient-DOk6VKdV.js +332 -0
  82. package/dist/authClient-DOk6VKdV.js.map +1 -0
  83. package/dist/authClient-Dsd7W99W.d.ts +320 -0
  84. package/dist/authClient-Z8Eg8rlN.cjs +405 -0
  85. package/dist/authClient-Z8Eg8rlN.cjs.map +1 -0
  86. package/dist/backends-DKBz5OxE.d.cts +9 -0
  87. package/dist/backends-DKBz5OxE.d.ts +9 -0
  88. package/dist/chat/index.cjs +134 -13
  89. package/dist/chat/index.cjs.map +1 -1
  90. package/dist/chat/index.d.cts +49 -48
  91. package/dist/chat/index.d.ts +49 -48
  92. package/dist/chat/index.js +134 -5
  93. package/dist/chat/index.js.map +1 -1
  94. package/dist/chat/suggestions.cjs +152 -74
  95. package/dist/chat/suggestions.cjs.map +1 -1
  96. package/dist/chat/suggestions.d.cts +2 -437
  97. package/dist/chat/suggestions.d.ts +2 -437
  98. package/dist/chat/suggestions.js +136 -2
  99. package/dist/chat/suggestions.js.map +1 -1
  100. package/dist/chat/types.cjs +6 -8
  101. package/dist/chat/types.cjs.map +1 -1
  102. package/dist/chat/types.d.cts +2 -3
  103. package/dist/chat/types.d.ts +2 -3
  104. package/dist/chat/types.js +5 -6
  105. package/dist/chat/types.js.map +1 -1
  106. package/dist/componentId-DkyQ8PM0.cjs +73 -0
  107. package/dist/componentId-DkyQ8PM0.cjs.map +1 -0
  108. package/dist/componentId-vJz-kWs6.js +68 -0
  109. package/dist/componentId-vJz-kWs6.js.map +1 -0
  110. package/dist/concurrent-CH9fbNr3.js +34 -0
  111. package/dist/concurrent-CH9fbNr3.js.map +1 -0
  112. package/dist/concurrent-tbiIa0UL.cjs +39 -0
  113. package/dist/concurrent-tbiIa0UL.cjs.map +1 -0
  114. package/dist/configurations-Byt59bIa.js +726 -0
  115. package/dist/{chunk-IAYPOSMM.cjs.map → configurations-Byt59bIa.js.map} +1 -1
  116. package/dist/configurations-CujCwDcB.cjs +743 -0
  117. package/dist/configurations-CujCwDcB.cjs.map +1 -0
  118. package/dist/configurations-DCOJONZZ.cjs +313 -0
  119. package/dist/configurations-DCOJONZZ.cjs.map +1 -0
  120. package/dist/configurations-iCbhe0tb.js +158 -0
  121. package/dist/configurations-iCbhe0tb.js.map +1 -0
  122. package/dist/constants/index.cjs +10 -34
  123. package/dist/constants/index.d.cts +4 -92
  124. package/dist/constants/index.d.ts +4 -92
  125. package/dist/constants/index.js +4 -5
  126. package/dist/constants-CqyyBkXW.cjs +197 -0
  127. package/dist/constants-CqyyBkXW.cjs.map +1 -0
  128. package/dist/constants-_HhqKvBg.js +174 -0
  129. package/dist/constants-_HhqKvBg.js.map +1 -0
  130. package/dist/createFetchClient-BK0TZK-U.js +184 -0
  131. package/dist/createFetchClient-BK0TZK-U.js.map +1 -0
  132. package/dist/createFetchClient-BsG719K1.cjs +263 -0
  133. package/dist/createFetchClient-BsG719K1.cjs.map +1 -0
  134. package/dist/createGenericFetchClient-CVZYekDk.js +7 -0
  135. package/dist/createGenericFetchClient-CVZYekDk.js.map +1 -0
  136. package/dist/createGenericFetchClient-DLbjX0eM.cjs +12 -0
  137. package/dist/createGenericFetchClient-DLbjX0eM.cjs.map +1 -0
  138. package/dist/createOpenapiFetchClient-B5U1fCHS.js +7 -0
  139. package/dist/createOpenapiFetchClient-B5U1fCHS.js.map +1 -0
  140. package/dist/createOpenapiFetchClient-Cr90VXY4.cjs +12 -0
  141. package/dist/createOpenapiFetchClient-Cr90VXY4.cjs.map +1 -0
  142. package/dist/createStore-BNiCRQXa.js +148 -0
  143. package/dist/createStore-BNiCRQXa.js.map +1 -0
  144. package/dist/createStore-MQbboXcB.cjs +177 -0
  145. package/dist/createStore-MQbboXcB.cjs.map +1 -0
  146. package/dist/credential-0c6yFwtp.cjs +44 -0
  147. package/dist/credential-0c6yFwtp.cjs.map +1 -0
  148. package/dist/credential-kEGLnVez.js +33 -0
  149. package/dist/credential-kEGLnVez.js.map +1 -0
  150. package/dist/dataScience/index.cjs +5 -19
  151. package/dist/dataScience/index.d.cts +3 -207
  152. package/dist/dataScience/index.d.ts +3 -207
  153. package/dist/dataScience/index.js +3 -6
  154. package/dist/dataScience/types.cjs +0 -4
  155. package/dist/dataScience/types.d.cts +3 -2
  156. package/dist/dataScience/types.d.ts +3 -2
  157. package/dist/dataScience/types.js +1 -3
  158. package/dist/dataScience-C-JrA0Uk.cjs +114 -0
  159. package/dist/dataScience-C-JrA0Uk.cjs.map +1 -0
  160. package/dist/dataScience-CE0pSWbl.js +109 -0
  161. package/dist/dataScience-CE0pSWbl.js.map +1 -0
  162. package/dist/dedupe-CiskLkGR.cjs +30 -0
  163. package/dist/dedupe-CiskLkGR.cjs.map +1 -0
  164. package/dist/dedupe-DYIHgZoG.js +25 -0
  165. package/dist/dedupe-DYIHgZoG.js.map +1 -0
  166. package/dist/developerPortal/index.cjs +6 -0
  167. package/dist/developerPortal/index.d.cts +3 -0
  168. package/dist/developerPortal/index.d.ts +3 -0
  169. package/dist/developerPortal/index.js +2 -0
  170. package/dist/developerPortal/types.cjs +0 -0
  171. package/dist/developerPortal/types.d.cts +2 -0
  172. package/dist/developerPortal/types.d.ts +2 -0
  173. package/dist/developerPortal/types.js +1 -0
  174. package/dist/developerPortalClient-BPPEAdJW.js +485 -0
  175. package/dist/developerPortalClient-BPPEAdJW.js.map +1 -0
  176. package/dist/developerPortalClient-C8oq48xW.cjs +508 -0
  177. package/dist/developerPortalClient-C8oq48xW.cjs.map +1 -0
  178. package/dist/domain/permissions/index.cjs +31 -122
  179. package/dist/domain/permissions/index.d.cts +19 -51
  180. package/dist/domain/permissions/index.d.ts +19 -51
  181. package/dist/domain/permissions/index.js +3 -5
  182. package/dist/domain/storageTable/index.cjs +4 -16
  183. package/dist/domain/storageTable/index.d.cts +2 -131
  184. package/dist/domain/storageTable/index.d.ts +2 -131
  185. package/dist/domain/storageTable/index.js +2 -3
  186. package/dist/editor/index.cjs +96 -12
  187. package/dist/editor/index.cjs.map +1 -1
  188. package/dist/editor/index.d.cts +163 -161
  189. package/dist/editor/index.d.ts +163 -161
  190. package/dist/editor/index.js +96 -4
  191. package/dist/editor/index.js.map +1 -1
  192. package/dist/editor/types.cjs +0 -4
  193. package/dist/editor/types.d.cts +2 -2
  194. package/dist/editor/types.d.ts +2 -2
  195. package/dist/editor/types.js +1 -3
  196. package/dist/encryption/index.cjs +58 -11
  197. package/dist/encryption/index.cjs.map +1 -1
  198. package/dist/encryption/index.d.cts +2 -18
  199. package/dist/encryption/index.d.ts +2 -18
  200. package/dist/encryption/index.js +58 -3
  201. package/dist/encryption/index.js.map +1 -1
  202. package/dist/encryption/types.cjs +0 -4
  203. package/dist/encryption/types.d.cts +2 -68
  204. package/dist/encryption/types.d.ts +2 -68
  205. package/dist/encryption/types.js +1 -3
  206. package/dist/generateUUID-C6qKBPIv.cjs +11 -0
  207. package/dist/generateUUID-C6qKBPIv.cjs.map +1 -0
  208. package/dist/generateUUID-Dr8l-aoc.js +6 -0
  209. package/dist/generateUUID-Dr8l-aoc.js.map +1 -0
  210. package/dist/import/index.cjs +3 -14
  211. package/dist/import/index.d.cts +41 -38
  212. package/dist/import/index.d.ts +41 -38
  213. package/dist/import/index.js +2 -5
  214. package/dist/import-Cf0W-7YD.js +116 -0
  215. package/dist/import-Cf0W-7YD.js.map +1 -0
  216. package/dist/import-KLH1uRtx.cjs +121 -0
  217. package/dist/import-KLH1uRtx.cjs.map +1 -0
  218. package/dist/index-8pN6Emos.d.ts +218 -0
  219. package/dist/index-BEKaJ7Cc.d.cts +1388 -0
  220. package/dist/index-BMqLPS6S.d.cts +135 -0
  221. package/dist/index-BMqLPS6S.d.ts +135 -0
  222. package/dist/index-BWBScAYc.d.cts +16 -0
  223. package/dist/index-BmjeNd9u.d.ts +1075 -0
  224. package/dist/index-BthgbVdd.d.ts +31 -0
  225. package/dist/index-CLPrlyIz.d.cts +218 -0
  226. package/dist/index-CXQRvZ-f.d.cts +31 -0
  227. package/dist/index-CeistZnj.d.ts +1388 -0
  228. package/dist/index-Cfrl7sd5.d.ts +65 -0
  229. package/dist/index-DIM8KZly.d.ts +16 -0
  230. package/dist/index-DNlX-H1V.d.ts +208 -0
  231. package/dist/index-DVsnxZap.d.cts +65 -0
  232. package/dist/index-DXi6wsr5.d.cts +77 -0
  233. package/dist/index-DYQt4zxC.d.ts +77 -0
  234. package/dist/index-DplMbm9E.d.cts +19882 -0
  235. package/dist/index-Dwp8tF6O.d.ts +19882 -0
  236. package/dist/index-IN0qzs52.d.cts +208 -0
  237. package/dist/index-KKJkrxjx.d.ts +26 -0
  238. package/dist/index-NC1dXRTD.d.cts +40 -0
  239. package/dist/index-NC1dXRTD.d.ts +40 -0
  240. package/dist/index-WQkVzx5e.d.cts +1075 -0
  241. package/dist/index-eEBVG5s3.d.cts +26 -0
  242. package/dist/index-vb9Rfqca.d.cts +115 -0
  243. package/dist/index-vb9Rfqca.d.ts +115 -0
  244. package/dist/index.cjs +1728 -1802
  245. package/dist/index.cjs.map +1 -1
  246. package/dist/index.d.cts +7 -15301
  247. package/dist/index.d.ts +7 -15301
  248. package/dist/index.js +1678 -1675
  249. package/dist/index.js.map +1 -1
  250. package/dist/isPlainObject-BB3iy87C.cjs +16 -0
  251. package/dist/isPlainObject-BB3iy87C.cjs.map +1 -0
  252. package/dist/isPlainObject-LYW-03uB.js +11 -0
  253. package/dist/isPlainObject-LYW-03uB.js.map +1 -0
  254. package/dist/jobStatus-DbMupQEK.js +423 -0
  255. package/dist/jobStatus-DbMupQEK.js.map +1 -0
  256. package/dist/jobStatus-kQ9JqF8t.cjs +494 -0
  257. package/dist/jobStatus-kQ9JqF8t.cjs.map +1 -0
  258. package/dist/management/index.cjs +4 -18
  259. package/dist/management/index.d.cts +2 -1083
  260. package/dist/management/index.d.ts +2 -1083
  261. package/dist/management/index.js +2 -5
  262. package/dist/management/types.cjs +0 -4
  263. package/dist/management/types.d.cts +2 -12
  264. package/dist/management/types.d.ts +2 -12
  265. package/dist/management/types.js +1 -3
  266. package/dist/management-DqwQcDCx.js +1065 -0
  267. package/dist/management-DqwQcDCx.js.map +1 -0
  268. package/dist/management-WOmlBt6H.cjs +1076 -0
  269. package/dist/management-WOmlBt6H.cjs.map +1 -0
  270. package/dist/metastore/index.cjs +3 -14
  271. package/dist/metastore/index.d.cts +2 -33
  272. package/dist/metastore/index.d.ts +2 -33
  273. package/dist/metastore/index.js +2 -5
  274. package/dist/metastore/types.cjs +0 -4
  275. package/dist/metastore/types.d.cts +2 -2
  276. package/dist/metastore/types.d.ts +2 -2
  277. package/dist/metastore/types.js +1 -3
  278. package/dist/metastore-CNEhL66f.js +134 -0
  279. package/dist/metastore-CNEhL66f.js.map +1 -0
  280. package/dist/metastore-CkQluyX1.cjs +139 -0
  281. package/dist/metastore-CkQluyX1.cjs.map +1 -0
  282. package/dist/notifications/index.cjs +67 -13
  283. package/dist/notifications/index.cjs.map +1 -1
  284. package/dist/notifications/index.d.cts +56 -56
  285. package/dist/notifications/index.d.ts +56 -56
  286. package/dist/notifications/index.js +67 -5
  287. package/dist/notifications/index.js.map +1 -1
  288. package/dist/notifications/types.cjs +0 -4
  289. package/dist/notifications/types.d.cts +2 -2
  290. package/dist/notifications/types.d.ts +2 -2
  291. package/dist/notifications/types.js +1 -3
  292. package/dist/oauth/index.cjs +3 -14
  293. package/dist/oauth/index.d.cts +49 -49
  294. package/dist/oauth/index.d.ts +49 -49
  295. package/dist/oauth/index.js +2 -5
  296. package/dist/oauth/types.cjs +0 -4
  297. package/dist/oauth/types.d.cts +2 -725
  298. package/dist/oauth/types.d.ts +2 -725
  299. package/dist/oauth/types.js +1 -3
  300. package/dist/oauth-DTvrqe6P.cjs +88 -0
  301. package/dist/oauth-DTvrqe6P.cjs.map +1 -0
  302. package/dist/oauth-DYDObUX9.js +83 -0
  303. package/dist/oauth-DYDObUX9.js.map +1 -0
  304. package/dist/omnisearch/index.cjs +49 -0
  305. package/dist/omnisearch/index.cjs.map +1 -0
  306. package/dist/omnisearch/index.d.cts +30 -0
  307. package/dist/omnisearch/index.d.ts +30 -0
  308. package/dist/omnisearch/index.js +48 -0
  309. package/dist/omnisearch/index.js.map +1 -0
  310. package/dist/omnisearch/types.cjs +0 -0
  311. package/dist/omnisearch/types.d.cts +2 -0
  312. package/dist/omnisearch/types.d.ts +2 -0
  313. package/dist/omnisearch/types.js +1 -0
  314. package/dist/project-BvFi19K_.cjs +56 -0
  315. package/dist/project-BvFi19K_.cjs.map +1 -0
  316. package/dist/project-CcGxXIW_.d.cts +18 -0
  317. package/dist/project-DWwZv66D.js +39 -0
  318. package/dist/project-DWwZv66D.js.map +1 -0
  319. package/dist/project-io1pY-hW.d.ts +18 -0
  320. package/dist/queryService/index.cjs +3 -14
  321. package/dist/queryService/index.d.cts +2 -39
  322. package/dist/queryService/index.d.ts +2 -39
  323. package/dist/queryService/index.js +2 -5
  324. package/dist/queryService/types.cjs +0 -4
  325. package/dist/queryService/types.d.cts +2 -2
  326. package/dist/queryService/types.d.ts +2 -2
  327. package/dist/queryService/types.js +1 -3
  328. package/dist/queryService-BHV_OZI2.js +114 -0
  329. package/dist/queryService-BHV_OZI2.js.map +1 -0
  330. package/dist/queryService-CvqDqigW.cjs +119 -0
  331. package/dist/queryService-CvqDqigW.cjs.map +1 -0
  332. package/dist/queue/index.cjs +3 -15
  333. package/dist/queue/index.d.cts +411 -334
  334. package/dist/queue/index.d.ts +411 -334
  335. package/dist/queue/index.js +2 -6
  336. package/dist/queue/types.cjs +0 -4
  337. package/dist/queue/types.d.cts +2 -2
  338. package/dist/queue/types.d.ts +2 -2
  339. package/dist/queue/types.js +1 -3
  340. package/dist/queue-CUHKupTA.cjs +137 -0
  341. package/dist/queue-CUHKupTA.cjs.map +1 -0
  342. package/dist/queue-uofE4Eu6.js +126 -0
  343. package/dist/queue-uofE4Eu6.js.map +1 -0
  344. package/dist/rolldown-runtime-VH7oDXx4.cjs +28 -0
  345. package/dist/scheduler/index.cjs +61 -13
  346. package/dist/scheduler/index.cjs.map +1 -1
  347. package/dist/scheduler/index.d.cts +73 -73
  348. package/dist/scheduler/index.d.ts +73 -73
  349. package/dist/scheduler/index.js +61 -5
  350. package/dist/scheduler/index.js.map +1 -1
  351. package/dist/scheduler/types.cjs +0 -4
  352. package/dist/scheduler/types.d.cts +2 -372
  353. package/dist/scheduler/types.d.ts +2 -372
  354. package/dist/scheduler/types.js +1 -3
  355. package/dist/sdk/configurations/index.cjs +3 -16
  356. package/dist/sdk/configurations/index.d.cts +3066 -3077
  357. package/dist/sdk/configurations/index.d.ts +3066 -3077
  358. package/dist/sdk/configurations/index.js +2 -7
  359. package/dist/sdk/developerPortal/index.cjs +203 -0
  360. package/dist/sdk/developerPortal/index.cjs.map +1 -0
  361. package/dist/sdk/developerPortal/index.d.cts +1371 -0
  362. package/dist/sdk/developerPortal/index.d.ts +1371 -0
  363. package/dist/sdk/developerPortal/index.js +202 -0
  364. package/dist/sdk/developerPortal/index.js.map +1 -0
  365. package/dist/sdk/queryService/index.cjs +93 -0
  366. package/dist/sdk/queryService/index.cjs.map +1 -0
  367. package/dist/sdk/queryService/index.d.cts +2 -0
  368. package/dist/sdk/queryService/index.d.ts +2 -0
  369. package/dist/sdk/queryService/index.js +92 -0
  370. package/dist/sdk/queryService/index.js.map +1 -0
  371. package/dist/sdk/semanticLayer/index.cjs +352 -50
  372. package/dist/sdk/semanticLayer/index.cjs.map +1 -1
  373. package/dist/sdk/semanticLayer/index.d.cts +105 -94
  374. package/dist/sdk/semanticLayer/index.d.ts +105 -94
  375. package/dist/sdk/semanticLayer/index.js +346 -4
  376. package/dist/sdk/semanticLayer/index.js.map +1 -1
  377. package/dist/sdk/semanticLayer/types.cjs +0 -4
  378. package/dist/sdk/semanticLayer/types.d.cts +2 -132
  379. package/dist/sdk/semanticLayer/types.d.ts +2 -132
  380. package/dist/sdk/semanticLayer/types.js +1 -3
  381. package/dist/sdk/storage/index.cjs +267 -47
  382. package/dist/sdk/storage/index.cjs.map +1 -1
  383. package/dist/sdk/storage/index.d.cts +2 -119
  384. package/dist/sdk/storage/index.d.ts +2 -119
  385. package/dist/sdk/storage/index.js +258 -3
  386. package/dist/sdk/storage/index.js.map +1 -1
  387. package/dist/sdk/tag/index.cjs +3 -14
  388. package/dist/sdk/tag/index.d.cts +16 -20
  389. package/dist/sdk/tag/index.d.ts +16 -20
  390. package/dist/sdk/tag/index.js +2 -5
  391. package/dist/sdk/tag/types.cjs +0 -4
  392. package/dist/sdk/tag/types.d.cts +2 -30
  393. package/dist/sdk/tag/types.d.ts +2 -30
  394. package/dist/sdk/tag/types.js +1 -3
  395. package/dist/sdk/vault/index.cjs +93 -31
  396. package/dist/sdk/vault/index.cjs.map +1 -1
  397. package/dist/sdk/vault/index.d.cts +2 -72
  398. package/dist/sdk/vault/index.d.ts +2 -72
  399. package/dist/sdk/vault/index.js +88 -3
  400. package/dist/sdk/vault/index.js.map +1 -1
  401. package/dist/status/index.cjs +16 -20
  402. package/dist/status/index.cjs.map +1 -1
  403. package/dist/status/index.d.cts +8 -9
  404. package/dist/status/index.d.ts +8 -9
  405. package/dist/status/index.js +15 -18
  406. package/dist/status/index.js.map +1 -1
  407. package/dist/status/types.cjs +0 -6
  408. package/dist/status/types.d.cts +17 -15
  409. package/dist/status/types.d.ts +17 -15
  410. package/dist/status/types.js +1 -3
  411. package/dist/storage/index.cjs +27 -54
  412. package/dist/storage/index.d.cts +3 -43
  413. package/dist/storage/index.d.ts +3 -43
  414. package/dist/storage/index.js +8 -9
  415. package/dist/storage/types.cjs +0 -4
  416. package/dist/storage/types.d.cts +5 -1654
  417. package/dist/storage/types.d.ts +5 -1654
  418. package/dist/storage/types.js +1 -3
  419. package/dist/storage-DbyNnkIJ.cjs +2458 -0
  420. package/dist/storage-DbyNnkIJ.cjs.map +1 -0
  421. package/dist/storage-luq7YBZF.js +2429 -0
  422. package/dist/storage-luq7YBZF.js.map +1 -0
  423. package/dist/storageTable-C9crh4Ef.cjs +310 -0
  424. package/dist/storageTable-C9crh4Ef.cjs.map +1 -0
  425. package/dist/storageTable-DslXtqNL.js +299 -0
  426. package/dist/storageTable-DslXtqNL.js.map +1 -0
  427. package/dist/stream/index.cjs +363 -12
  428. package/dist/stream/index.cjs.map +1 -1
  429. package/dist/stream/index.d.cts +345 -345
  430. package/dist/stream/index.d.ts +345 -345
  431. package/dist/stream/index.js +363 -4
  432. package/dist/stream/index.js.map +1 -1
  433. package/dist/stream/types.cjs +0 -4
  434. package/dist/stream/types.d.cts +2 -2
  435. package/dist/stream/types.d.ts +2 -2
  436. package/dist/stream/types.js +1 -3
  437. package/dist/suggestions-BH3x7xU7.d.cts +438 -0
  438. package/dist/suggestions-BH3x7xU7.d.ts +438 -0
  439. package/dist/syncActions/index.cjs +3 -18
  440. package/dist/syncActions/index.d.cts +2 -112
  441. package/dist/syncActions/index.d.ts +2 -112
  442. package/dist/syncActions/index.js +2 -9
  443. package/dist/syncActions/types.cjs +0 -4
  444. package/dist/syncActions/types.d.cts +2 -298
  445. package/dist/syncActions/types.d.ts +2 -298
  446. package/dist/syncActions/types.js +1 -3
  447. package/dist/syncActions-DKWeJ8GH.cjs +504 -0
  448. package/dist/syncActions-DKWeJ8GH.cjs.map +1 -0
  449. package/dist/syncActions-ssWWVN_4.js +497 -0
  450. package/dist/syncActions-ssWWVN_4.js.map +1 -0
  451. package/dist/tag-CsoOZWB_.cjs +175 -0
  452. package/dist/tag-CsoOZWB_.cjs.map +1 -0
  453. package/dist/tag-DCsoewjL.js +164 -0
  454. package/dist/{chunk-DHOVQ2TW.js.map → tag-DCsoewjL.js.map} +1 -1
  455. package/dist/telemetry/index.cjs +3 -14
  456. package/dist/telemetry/index.d.cts +10 -10
  457. package/dist/telemetry/index.d.ts +10 -10
  458. package/dist/telemetry/index.js +2 -5
  459. package/dist/telemetry/types.cjs +0 -4
  460. package/dist/telemetry/types.d.cts +2 -12
  461. package/dist/telemetry/types.d.ts +2 -12
  462. package/dist/telemetry/types.js +1 -3
  463. package/dist/telemetry-2IrE8HaZ.cjs +29 -0
  464. package/dist/telemetry-2IrE8HaZ.cjs.map +1 -0
  465. package/dist/telemetry-yQfQxBBI.js +24 -0
  466. package/dist/telemetry-yQfQxBBI.js.map +1 -0
  467. package/dist/types--T-vBqdd.d.cts +2835 -0
  468. package/dist/{types-CM1zHzgm.d.ts → types-2mHlPakp.d.cts} +893 -69
  469. package/dist/types-7H6Dnz0Y.d.ts +23 -0
  470. package/dist/types-B06L4-WE.d.cts +2124 -0
  471. package/dist/types-B1S2H7q1.d.ts +373 -0
  472. package/dist/types-B1glyy_Q.d.ts +726 -0
  473. package/dist/{utils-DK7uJcmR.d.cts → types-BCt0EMiO.d.ts} +16 -905
  474. package/dist/{types-BX1xr4CX.d.cts → types-BD6czYPH.d.ts} +43 -108
  475. package/dist/{types-BEnE7LHB.d.cts → types-BO-mTxKb.d.cts} +57 -81
  476. package/dist/{types-BieLFMW1.d.cts → types-BREBK0xX.d.ts} +9 -8
  477. package/dist/types-BRQAKEC1.d.cts +32 -0
  478. package/dist/types-BXK6Ebtm.d.ts +32 -0
  479. package/dist/types-BefwoXik.d.cts +373 -0
  480. package/dist/{types-DeoA45gz.d.cts → types-BhBvnvqe.d.ts} +632 -464
  481. package/dist/{types-Cgh3jqrV.d.cts → types-BmFyDKe6.d.ts} +893 -69
  482. package/dist/types-BpWqpMkL.d.ts +66 -0
  483. package/dist/types-C8XiTXxi.d.cts +23 -0
  484. package/dist/{types-BfuVN8Pk.d.cts → types-CAOvDtMC.d.cts} +11 -16
  485. package/dist/types-CC0wymfG.d.ts +2088 -0
  486. package/dist/{types-YzkNUuYo.d.ts → types-CI1mW2lA.d.ts} +11 -16
  487. package/dist/{types-00IaLn3S.d.ts → types-CRYtdj5w.d.ts} +876 -374
  488. package/dist/{types-CrLjE5xf.d.ts → types-CSmttcZ_.d.ts} +10 -12
  489. package/dist/{types-DgSyBwP3.d.cts → types-CbZ8aMKW.d.cts} +11 -14
  490. package/dist/{types-DwMezEHT.d.ts → types-CexuN7Mw.d.cts} +43 -108
  491. package/dist/types-CjAia48k.d.ts +386 -0
  492. package/dist/{types-D-MuJHwl.d.cts → types-CtdyAkzI.d.cts} +28 -16
  493. package/dist/{types-DpUcInCX.d.ts → types-CvADp-x-.d.ts} +11 -14
  494. package/dist/types-CwvOcTOm.d.cts +2088 -0
  495. package/dist/types-CyRK5z-E.d.cts +386 -0
  496. package/dist/{types-DbAO-Tgk.d.ts → types-D2n3h1gp.d.ts} +57 -81
  497. package/dist/types-DBOEA7l0.d.cts +148 -0
  498. package/dist/{types-DYnHIm7m.d.cts → types-DCBKso0t.d.cts} +10 -12
  499. package/dist/{types-Hj1CaKtV.d.ts → types-DEKF5pbg.d.cts} +632 -464
  500. package/dist/{types-B30y9Lhc.d.ts → types-DMvU4kZ2.d.cts} +208 -24
  501. package/dist/{types-B-vmDlWB.d.cts → types-DS8uFAeq.d.cts} +10 -15
  502. package/dist/types-DeApSCzx.d.cts +602 -0
  503. package/dist/types-DebL68-g.d.ts +148 -0
  504. package/dist/types-DgaYUtu_.d.cts +726 -0
  505. package/dist/{types-CiJ5ULtS.d.ts → types-DkbfBOBr.d.cts} +9 -8
  506. package/dist/types-DvsGS8By.d.cts +66 -0
  507. package/dist/{types-DHXZZKb3.d.ts → types-DwX1uxp_.d.ts} +10 -15
  508. package/dist/{types-sVyfECai.d.cts → types-ISUNM_BR.d.cts} +876 -374
  509. package/dist/{utils-B_SOM1XR.d.ts → types-QOIQ-dZU.d.cts} +16 -905
  510. package/dist/types-SGuvOEV8.d.ts +2124 -0
  511. package/dist/types-V8rC5if7.d.cts +621 -0
  512. package/dist/{types-CSZoV4lM.d.cts → types-Z-vUwgym.d.ts} +208 -24
  513. package/dist/types-bws2RtKq.d.ts +602 -0
  514. package/dist/types-h9TTimS_.d.ts +2835 -0
  515. package/dist/types-lFsTSkhe.d.cts +14 -0
  516. package/dist/types-lFsTSkhe.d.ts +14 -0
  517. package/dist/types-n4FFKqa4.d.ts +621 -0
  518. package/dist/{types-DeS-oVdn.d.ts → types-x4xPlrr0.d.ts} +28 -16
  519. package/dist/vault/index.cjs +49 -13
  520. package/dist/vault/index.cjs.map +1 -1
  521. package/dist/vault/index.d.cts +2 -26
  522. package/dist/vault/index.d.ts +2 -26
  523. package/dist/vault/index.js +49 -5
  524. package/dist/vault/index.js.map +1 -1
  525. package/dist/vault/types.cjs +0 -4
  526. package/dist/vault/types.d.cts +2 -385
  527. package/dist/vault/types.d.ts +2 -385
  528. package/dist/vault/types.js +1 -3
  529. package/package.json +113 -7
  530. package/surface/ai.md +1 -0
  531. package/surface/apps.md +32 -0
  532. package/surface/auth.md +6 -4
  533. package/surface/chat.md +3 -2
  534. package/surface/dataScience.md +3 -2
  535. package/surface/editor.md +1 -0
  536. package/surface/encryption.md +1 -0
  537. package/surface/import.md +1 -0
  538. package/surface/kaiAgent.md +2 -1
  539. package/surface/management.md +17 -16
  540. package/surface/metastore.md +2 -1
  541. package/surface/notifications.md +1 -0
  542. package/surface/oauth.md +1 -0
  543. package/surface/omnisearch.md +9 -0
  544. package/surface/queryService.md +5 -3
  545. package/surface/queue.md +8 -6
  546. package/surface/scheduler.md +1 -0
  547. package/surface/sdk.md +22 -22
  548. package/surface/storage.md +147 -106
  549. package/surface/stream.md +1 -0
  550. package/surface/syncActions.md +13 -6
  551. package/surface/vault.md +1 -0
  552. package/dist/ManagementClientAuthError-4J0S5tV-.d.ts +0 -9
  553. package/dist/ManagementClientAuthError-CyDpa4NS.d.cts +0 -9
  554. package/dist/adminRoles-Cil1lavB.d.cts +0 -18
  555. package/dist/adminRoles-Cil1lavB.d.ts +0 -18
  556. package/dist/ai/types.cjs.map +0 -1
  557. package/dist/ai/types.js.map +0 -1
  558. package/dist/auth/index.cjs.map +0 -1
  559. package/dist/auth/index.js.map +0 -1
  560. package/dist/auth/types.cjs.map +0 -1
  561. package/dist/auth/types.js.map +0 -1
  562. package/dist/chunk-22E6IGXR.js +0 -6
  563. package/dist/chunk-22E6IGXR.js.map +0 -1
  564. package/dist/chunk-2BOG5U7C.js +0 -75
  565. package/dist/chunk-2BOG5U7C.js.map +0 -1
  566. package/dist/chunk-2CFM7K4U.cjs +0 -55
  567. package/dist/chunk-2CFM7K4U.cjs.map +0 -1
  568. package/dist/chunk-34GM6NXB.js +0 -77
  569. package/dist/chunk-34GM6NXB.js.map +0 -1
  570. package/dist/chunk-3BFPNM2J.js +0 -61
  571. package/dist/chunk-3BFPNM2J.js.map +0 -1
  572. package/dist/chunk-3PVERYSF.js +0 -16
  573. package/dist/chunk-3PVERYSF.js.map +0 -1
  574. package/dist/chunk-3YWQQ3OG.cjs +0 -79
  575. package/dist/chunk-3YWQQ3OG.cjs.map +0 -1
  576. package/dist/chunk-4RC5E3SL.js +0 -140
  577. package/dist/chunk-4RC5E3SL.js.map +0 -1
  578. package/dist/chunk-4VVF2PIX.js +0 -110
  579. package/dist/chunk-4VVF2PIX.js.map +0 -1
  580. package/dist/chunk-552FC4ZV.js +0 -14
  581. package/dist/chunk-552FC4ZV.js.map +0 -1
  582. package/dist/chunk-5XWVWFTC.js +0 -33
  583. package/dist/chunk-5XWVWFTC.js.map +0 -1
  584. package/dist/chunk-6YZQIMML.cjs +0 -163
  585. package/dist/chunk-6YZQIMML.cjs.map +0 -1
  586. package/dist/chunk-77LILJYX.js +0 -110
  587. package/dist/chunk-77LILJYX.js.map +0 -1
  588. package/dist/chunk-7J2R6XHB.js +0 -3
  589. package/dist/chunk-7J2R6XHB.js.map +0 -1
  590. package/dist/chunk-7R22VKV7.cjs +0 -62
  591. package/dist/chunk-7R22VKV7.cjs.map +0 -1
  592. package/dist/chunk-7RO6PKZ4.cjs +0 -16
  593. package/dist/chunk-7RO6PKZ4.cjs.map +0 -1
  594. package/dist/chunk-7YXL4FKN.cjs +0 -340
  595. package/dist/chunk-7YXL4FKN.cjs.map +0 -1
  596. package/dist/chunk-7Z4MU7ZB.js +0 -1294
  597. package/dist/chunk-7Z4MU7ZB.js.map +0 -1
  598. package/dist/chunk-AFJGNBVM.cjs +0 -63
  599. package/dist/chunk-AFJGNBVM.cjs.map +0 -1
  600. package/dist/chunk-AVH6F5LB.js +0 -1492
  601. package/dist/chunk-AVH6F5LB.js.map +0 -1
  602. package/dist/chunk-AXEANGGK.js +0 -226
  603. package/dist/chunk-AXEANGGK.js.map +0 -1
  604. package/dist/chunk-BCZPCMGL.cjs +0 -49
  605. package/dist/chunk-BCZPCMGL.cjs.map +0 -1
  606. package/dist/chunk-BR6WZE3O.cjs +0 -42
  607. package/dist/chunk-BR6WZE3O.cjs.map +0 -1
  608. package/dist/chunk-BZA3FGO6.js +0 -40
  609. package/dist/chunk-BZA3FGO6.js.map +0 -1
  610. package/dist/chunk-CV2JGHBN.js +0 -183
  611. package/dist/chunk-CV2JGHBN.js.map +0 -1
  612. package/dist/chunk-CWCUQACX.cjs +0 -18
  613. package/dist/chunk-CWCUQACX.cjs.map +0 -1
  614. package/dist/chunk-CWUQ6ZAO.cjs +0 -185
  615. package/dist/chunk-CWUQ6ZAO.cjs.map +0 -1
  616. package/dist/chunk-D4WOOKMI.js +0 -350
  617. package/dist/chunk-D4WOOKMI.js.map +0 -1
  618. package/dist/chunk-DHOVQ2TW.js +0 -177
  619. package/dist/chunk-DRNOCC6W.cjs +0 -295
  620. package/dist/chunk-DRNOCC6W.cjs.map +0 -1
  621. package/dist/chunk-EDX5D6UY.js +0 -14
  622. package/dist/chunk-EWMXK3EI.cjs +0 -8
  623. package/dist/chunk-EWMXK3EI.cjs.map +0 -1
  624. package/dist/chunk-EYIPM2XB.cjs +0 -82
  625. package/dist/chunk-EYIPM2XB.cjs.map +0 -1
  626. package/dist/chunk-F6ZAYTBX.cjs +0 -364
  627. package/dist/chunk-F6ZAYTBX.cjs.map +0 -1
  628. package/dist/chunk-FJBP3MRI.cjs +0 -63
  629. package/dist/chunk-FJBP3MRI.cjs.map +0 -1
  630. package/dist/chunk-FMS5PNM2.cjs +0 -37
  631. package/dist/chunk-FMS5PNM2.cjs.map +0 -1
  632. package/dist/chunk-FPB6OGTV.js +0 -26
  633. package/dist/chunk-FPB6OGTV.js.map +0 -1
  634. package/dist/chunk-FRLSKIUI.cjs +0 -180
  635. package/dist/chunk-FRLSKIUI.cjs.map +0 -1
  636. package/dist/chunk-G3N5KDEY.js +0 -10
  637. package/dist/chunk-G3N5KDEY.js.map +0 -1
  638. package/dist/chunk-G66EP527.js +0 -59
  639. package/dist/chunk-G66EP527.js.map +0 -1
  640. package/dist/chunk-GF4XZK5N.cjs +0 -43
  641. package/dist/chunk-GF4XZK5N.cjs.map +0 -1
  642. package/dist/chunk-HITKHHWN.cjs +0 -174
  643. package/dist/chunk-HITKHHWN.cjs.map +0 -1
  644. package/dist/chunk-HMCZUHR7.js +0 -53
  645. package/dist/chunk-HMCZUHR7.js.map +0 -1
  646. package/dist/chunk-HTVJR5WS.cjs +0 -305
  647. package/dist/chunk-HTVJR5WS.cjs.map +0 -1
  648. package/dist/chunk-HY7J3OD3.cjs +0 -1298
  649. package/dist/chunk-HY7J3OD3.cjs.map +0 -1
  650. package/dist/chunk-IAYPOSMM.cjs +0 -472
  651. package/dist/chunk-IDWGBCSB.cjs +0 -61
  652. package/dist/chunk-IDWGBCSB.cjs.map +0 -1
  653. package/dist/chunk-J3NLKXQ5.cjs +0 -79
  654. package/dist/chunk-J3NLKXQ5.cjs.map +0 -1
  655. package/dist/chunk-KEFXOJD7.js +0 -61
  656. package/dist/chunk-KEFXOJD7.js.map +0 -1
  657. package/dist/chunk-KUYVBCUM.cjs +0 -231
  658. package/dist/chunk-KUYVBCUM.cjs.map +0 -1
  659. package/dist/chunk-L262THNK.cjs +0 -253
  660. package/dist/chunk-L262THNK.cjs.map +0 -1
  661. package/dist/chunk-LD3JERYP.js +0 -77
  662. package/dist/chunk-LD3JERYP.js.map +0 -1
  663. package/dist/chunk-LIXSIM3H.cjs +0 -113
  664. package/dist/chunk-LIXSIM3H.cjs.map +0 -1
  665. package/dist/chunk-LNZP2O4P.js +0 -169
  666. package/dist/chunk-LNZP2O4P.js.map +0 -1
  667. package/dist/chunk-MMOAH3EH.cjs +0 -288
  668. package/dist/chunk-MMOAH3EH.cjs.map +0 -1
  669. package/dist/chunk-MRHQJNWF.cjs +0 -8
  670. package/dist/chunk-MRHQJNWF.cjs.map +0 -1
  671. package/dist/chunk-MSI6FVGG.js +0 -6
  672. package/dist/chunk-MSI6FVGG.js.map +0 -1
  673. package/dist/chunk-N4COL54U.cjs +0 -22
  674. package/dist/chunk-N4COL54U.cjs.map +0 -1
  675. package/dist/chunk-NVQ6LGDO.cjs +0 -35
  676. package/dist/chunk-NVQ6LGDO.cjs.map +0 -1
  677. package/dist/chunk-NVRVPWNY.js +0 -148
  678. package/dist/chunk-NVRVPWNY.js.map +0 -1
  679. package/dist/chunk-OUSPQ55W.js +0 -263
  680. package/dist/chunk-OUSPQ55W.js.map +0 -1
  681. package/dist/chunk-PPQF7LTS.cjs +0 -63
  682. package/dist/chunk-PPQF7LTS.cjs.map +0 -1
  683. package/dist/chunk-PSR3N4NC.js +0 -136
  684. package/dist/chunk-PSR3N4NC.js.map +0 -1
  685. package/dist/chunk-QHD4LPAQ.cjs +0 -8
  686. package/dist/chunk-QHD4LPAQ.cjs.map +0 -1
  687. package/dist/chunk-RRC5RKF7.cjs +0 -12
  688. package/dist/chunk-RRC5RKF7.cjs.map +0 -1
  689. package/dist/chunk-RVBGE2Z4.js +0 -468
  690. package/dist/chunk-RVBGE2Z4.js.map +0 -1
  691. package/dist/chunk-S4JK7DKM.js +0 -61
  692. package/dist/chunk-S4JK7DKM.js.map +0 -1
  693. package/dist/chunk-SJZ66FD5.js +0 -35
  694. package/dist/chunk-SJZ66FD5.js.map +0 -1
  695. package/dist/chunk-T242YFMT.cjs +0 -150
  696. package/dist/chunk-T242YFMT.cjs.map +0 -1
  697. package/dist/chunk-T526LPBK.js +0 -6
  698. package/dist/chunk-T526LPBK.js.map +0 -1
  699. package/dist/chunk-U5SE6W5M.cjs +0 -158
  700. package/dist/chunk-U5SE6W5M.cjs.map +0 -1
  701. package/dist/chunk-UABYNGBZ.js +0 -39
  702. package/dist/chunk-UABYNGBZ.js.map +0 -1
  703. package/dist/chunk-UP5SEEYZ.js +0 -218
  704. package/dist/chunk-UP5SEEYZ.js.map +0 -1
  705. package/dist/chunk-UQ5CACMW.js +0 -283
  706. package/dist/chunk-UQ5CACMW.js.map +0 -1
  707. package/dist/chunk-UUY6LQT6.cjs +0 -267
  708. package/dist/chunk-UUY6LQT6.cjs.map +0 -1
  709. package/dist/chunk-UWQUHP3T.cjs +0 -112
  710. package/dist/chunk-UWQUHP3T.cjs.map +0 -1
  711. package/dist/chunk-XHDYLUM4.js +0 -268
  712. package/dist/chunk-XHDYLUM4.js.map +0 -1
  713. package/dist/chunk-XIIER7QQ.js +0 -60
  714. package/dist/chunk-XIIER7QQ.js.map +0 -1
  715. package/dist/chunk-XKIENBIE.js +0 -338
  716. package/dist/chunk-XKIENBIE.js.map +0 -1
  717. package/dist/chunk-XPDEQND7.cjs +0 -4
  718. package/dist/chunk-XPDEQND7.cjs.map +0 -1
  719. package/dist/chunk-YGEJDWGG.js +0 -19
  720. package/dist/chunk-YGEJDWGG.js.map +0 -1
  721. package/dist/chunk-YXGBD4WP.cjs +0 -16
  722. package/dist/chunk-YXGBD4WP.cjs.map +0 -1
  723. package/dist/chunk-Z3HZ4MP4.cjs +0 -1496
  724. package/dist/chunk-Z3HZ4MP4.cjs.map +0 -1
  725. package/dist/chunk-ZOREOLGE.js +0 -264
  726. package/dist/chunk-ZOREOLGE.js.map +0 -1
  727. package/dist/constants/index.cjs.map +0 -1
  728. package/dist/constants/index.js.map +0 -1
  729. package/dist/createGenericFetchClient-JcbIIqwF.d.cts +0 -18
  730. package/dist/createGenericFetchClient-ZGG5wbAC.d.ts +0 -18
  731. package/dist/createOpenapiFetchClient-6RX67Hws.d.ts +0 -24
  732. package/dist/createOpenapiFetchClient-BFmiJ9C5.d.cts +0 -24
  733. package/dist/dataScience/index.cjs.map +0 -1
  734. package/dist/dataScience/index.js.map +0 -1
  735. package/dist/dataScience/types.cjs.map +0 -1
  736. package/dist/dataScience/types.js.map +0 -1
  737. package/dist/domain/permissions/index.cjs.map +0 -1
  738. package/dist/domain/permissions/index.js.map +0 -1
  739. package/dist/domain/storageTable/index.cjs.map +0 -1
  740. package/dist/domain/storageTable/index.js.map +0 -1
  741. package/dist/editor/types.cjs.map +0 -1
  742. package/dist/editor/types.js.map +0 -1
  743. package/dist/encryption/types.cjs.map +0 -1
  744. package/dist/encryption/types.js.map +0 -1
  745. package/dist/import/index.cjs.map +0 -1
  746. package/dist/import/index.js.map +0 -1
  747. package/dist/keboolaUID-D1DGSbge.d.cts +0 -19
  748. package/dist/keboolaUID-D1DGSbge.d.ts +0 -19
  749. package/dist/management/index.cjs.map +0 -1
  750. package/dist/management/index.js.map +0 -1
  751. package/dist/management/types.cjs.map +0 -1
  752. package/dist/management/types.js.map +0 -1
  753. package/dist/metastore/index.cjs.map +0 -1
  754. package/dist/metastore/index.js.map +0 -1
  755. package/dist/metastore/types.cjs.map +0 -1
  756. package/dist/metastore/types.js.map +0 -1
  757. package/dist/notifications/types.cjs.map +0 -1
  758. package/dist/notifications/types.js.map +0 -1
  759. package/dist/oauth/index.cjs.map +0 -1
  760. package/dist/oauth/index.js.map +0 -1
  761. package/dist/oauth/types.cjs.map +0 -1
  762. package/dist/oauth/types.js.map +0 -1
  763. package/dist/project-CXqPYo4T.d.ts +0 -17
  764. package/dist/project-CZPvcxRW.d.cts +0 -17
  765. package/dist/queryService/index.cjs.map +0 -1
  766. package/dist/queryService/index.js.map +0 -1
  767. package/dist/queryService/types.cjs.map +0 -1
  768. package/dist/queryService/types.js.map +0 -1
  769. package/dist/queue/index.cjs.map +0 -1
  770. package/dist/queue/index.js.map +0 -1
  771. package/dist/queue/types.cjs.map +0 -1
  772. package/dist/queue/types.js.map +0 -1
  773. package/dist/registry-CcKlB-yY.d.ts +0 -1046
  774. package/dist/registry-Cg0Yng1z.d.cts +0 -1046
  775. package/dist/scheduler/types.cjs.map +0 -1
  776. package/dist/scheduler/types.js.map +0 -1
  777. package/dist/sdk/configurations/index.cjs.map +0 -1
  778. package/dist/sdk/configurations/index.js.map +0 -1
  779. package/dist/sdk/semanticLayer/types.cjs.map +0 -1
  780. package/dist/sdk/semanticLayer/types.js.map +0 -1
  781. package/dist/sdk/tag/index.cjs.map +0 -1
  782. package/dist/sdk/tag/index.js.map +0 -1
  783. package/dist/sdk/tag/types.cjs.map +0 -1
  784. package/dist/sdk/tag/types.js.map +0 -1
  785. package/dist/status/types.cjs.map +0 -1
  786. package/dist/status/types.js.map +0 -1
  787. package/dist/storage/index.cjs.map +0 -1
  788. package/dist/storage/index.js.map +0 -1
  789. package/dist/storage/types.cjs.map +0 -1
  790. package/dist/storage/types.js.map +0 -1
  791. package/dist/storageClient-Cd4jVt58.d.ts +0 -1519
  792. package/dist/storageClient-Dkcg7hKa.d.cts +0 -1519
  793. package/dist/storageSdk-15_Fbucc.d.cts +0 -746
  794. package/dist/storageSdk-L6NOdgSJ.d.ts +0 -746
  795. package/dist/stream/types.cjs.map +0 -1
  796. package/dist/stream/types.js.map +0 -1
  797. package/dist/syncActions/index.cjs.map +0 -1
  798. package/dist/syncActions/index.js.map +0 -1
  799. package/dist/syncActions/types.cjs.map +0 -1
  800. package/dist/syncActions/types.js.map +0 -1
  801. package/dist/telemetry/index.cjs.map +0 -1
  802. package/dist/telemetry/index.js.map +0 -1
  803. package/dist/telemetry/types.cjs.map +0 -1
  804. package/dist/telemetry/types.js.map +0 -1
  805. package/dist/types-BqC3U0k0.d.cts +0 -12
  806. package/dist/types-Dkipk6NN.d.ts +0 -12
  807. package/dist/types-UwuKN9Kx.d.cts +0 -60
  808. package/dist/types-UwuKN9Kx.d.ts +0 -60
  809. package/dist/types-gcShAmmi.d.cts +0 -90
  810. package/dist/types-gcShAmmi.d.ts +0 -90
  811. package/dist/vault/types.cjs.map +0 -1
  812. package/dist/vault/types.js.map +0 -1
@@ -0,0 +1,2429 @@
1
+ import { a as poller, t as jobStatus } from "./jobStatus-DbMupQEK.js";
2
+ import { t as concurrent } from "./concurrent-CH9fbNr3.js";
3
+ import { f as KeboolaHttpHeader, o as HttpHeader, r as isApiError } from "./createFetchClient-BK0TZK-U.js";
4
+ import { t as createGenericFetchClient } from "./createGenericFetchClient-CVZYekDk.js";
5
+ import { t as createOpenapiFetchClient } from "./createOpenapiFetchClient-B5U1fCHS.js";
6
+ import { t as createAuthHeaders } from "./auth-D2jfNlpX.js";
7
+ //#region src/utils/async/series.ts
8
+ /**
9
+ * Executes a callback function on an array of items in series (one at a time).
10
+ * It behaves similarly to Promise.all(), failing on the first rejected promise.
11
+ * The order of the results matches the order of the promises.
12
+ * Resolves with the mapped results, not with the original items.
13
+ */
14
+ const series = async (options) => concurrent({
15
+ ...options,
16
+ concurrency: 1
17
+ });
18
+ //#endregion
19
+ //#region src/errors/ServiceUnavailableError.ts
20
+ var ServiceUnavailableError = class ServiceUnavailableError extends Error {
21
+ constructor(serviceId, path, clientName) {
22
+ super(`Service "${serviceId}" is not available in this stack. Caused by: ${clientName}.${path.join(".")}()`);
23
+ this.name = "ServiceUnavailableError";
24
+ Object.setPrototypeOf(this, ServiceUnavailableError.prototype);
25
+ }
26
+ };
27
+ //#endregion
28
+ //#region src/clients/storage/mergeRequests/mergeRequests.ts
29
+ /**
30
+ * Both write bodies are asserted in: the spec declares every field of them required and nullable,
31
+ * while the API defaults the ones a caller omits — and an explicit `null` is not the same request as
32
+ * an absent key. `./types` narrows each body to what a caller really has to send.
33
+ */
34
+ const createMergeRequests = (client) => {
35
+ const getMergeRequests = async (signal) => {
36
+ const { data } = await client.get("/v2/storage/merge-request", {}, { signal });
37
+ return data;
38
+ };
39
+ const getMergeRequest = async (id, signal) => {
40
+ const { data } = await client.get("/v2/storage/merge-request/{id}", { path: { id } }, { signal });
41
+ return data;
42
+ };
43
+ const getMergeRequestWithActivityLog = async (id, signal) => {
44
+ const { data } = await client.get("/v2/storage/merge-request/{id}", {
45
+ path: { id },
46
+ query: { include: "activityLog" }
47
+ }, { signal });
48
+ return data;
49
+ };
50
+ const createMergeRequest = async (body) => {
51
+ const { data } = await client.post("/v2/storage/merge-request", { body });
52
+ return data;
53
+ };
54
+ const updateMergeRequest = async ({ id, ...body }) => {
55
+ const { data } = await client.put("/v2/storage/merge-request/{id}", {
56
+ path: { id },
57
+ body
58
+ });
59
+ return data;
60
+ };
61
+ const requestReview = async (id) => {
62
+ const { data } = await client.put("/v2/storage/merge-request/{id}/request-review", { path: { id } });
63
+ return data;
64
+ };
65
+ const approveMergeRequest = async (id) => {
66
+ const { data } = await client.put("/v2/storage/merge-request/{id}/approve", { path: { id } });
67
+ return data;
68
+ };
69
+ const requestChangesMergeRequest = async (id, reason) => {
70
+ const { data } = await client.put("/v2/storage/merge-request/{id}/request-changes", {
71
+ path: { id },
72
+ body: reason ? { reason } : void 0
73
+ });
74
+ return data;
75
+ };
76
+ /**
77
+ * Merges an approved merge request. The endpoint is async — it returns the created merge job.
78
+ *
79
+ * @link https://api.keboola.com/?service=storage#storage/tag/merge-requests/PUT/v2/storage/merge-request/{id}/merge
80
+ */
81
+ const mergeMergeRequest = async (id) => {
82
+ const { data } = await client.put("/v2/storage/merge-request/{id}/merge", { path: { id } });
83
+ return data;
84
+ };
85
+ const getMergeRequestConflicts = async (id, signal) => {
86
+ const { data } = await client.get("/v2/storage/merge-request/{id}/conflicts", { path: { id } }, { signal });
87
+ return data;
88
+ };
89
+ return {
90
+ getMergeRequests,
91
+ getMergeRequest,
92
+ getMergeRequestWithActivityLog,
93
+ createMergeRequest,
94
+ updateMergeRequest,
95
+ requestReview,
96
+ approveMergeRequest,
97
+ requestChangesMergeRequest,
98
+ mergeMergeRequest,
99
+ getMergeRequestConflicts
100
+ };
101
+ };
102
+ //#endregion
103
+ //#region src/clients/storage/branches/branches.ts
104
+ /**
105
+ * Every `/v2/storage/dev-branches` type below is asserted in, because the spec models none of this
106
+ * contract. What it needs, per operation:
107
+ *
108
+ * - `GET /dev-branches` (`DevBranchesListAction`)
109
+ * - response: contentless `default` → really `DevBranch[]`
110
+ * - `POST /dev-branches` (`DevBranchCreateAction`)
111
+ * - body: `CreateDevBranchRequest` is `Record<string, never>` → really `{ name, description? }`
112
+ * - response: contentless `default` → really a `devBranchCreate` job
113
+ * - duplicate: also declared on `/dev-branches/` (trailing slash); drop it
114
+ * - `PUT /dev-branches/{id}` (`DevBranchUpdateAction`)
115
+ * - body: `UpdateDevBranchRequest` is `Record<string, never>` → really `{ name, description? }`
116
+ * - response: contentless `default` → really a `DevBranch`
117
+ * - path: `id` is a `string` → really a number
118
+ * - `DELETE /dev-branches/{id}` (`DevBranchDeleteAction`)
119
+ * - response: contentless `default` → really a `devBranchDelete` job
120
+ * - path: `id` is a `string` → really a number
121
+ *
122
+ * A contentless `default` response makes the generated return type the response envelope
123
+ * (`{ headers, content?: never }`) instead of a payload, which is why all four returns are asserted.
124
+ * The `{id}` deviation is the one that needs no assertion — the id goes into the URL, so `String`
125
+ * converts it and the wire is identical.
126
+ */
127
+ const createBranches = (client, poller) => {
128
+ /**
129
+ * @link https://api.keboola.com/?service=storage#storage/tag/dev-branches/GET/v2/storage/dev-branches
130
+ */
131
+ const getDevBranches = async (signal) => {
132
+ const { data } = await client.get("/v2/storage/dev-branches", {}, { signal });
133
+ return data;
134
+ };
135
+ /**
136
+ * Creates a development branch. Async — returns a job to poll.
137
+ *
138
+ * @link https://api.keboola.com/?service=storage#storage/tag/dev-branches/POST/v2/storage/dev-branches
139
+ */
140
+ const createDevBranchAsync = async (body) => {
141
+ const { data } = await client.post("/v2/storage/dev-branches", { body });
142
+ return data;
143
+ };
144
+ /**
145
+ * Creates a development branch and waits for the job to finish.
146
+ *
147
+ * @link https://api.keboola.com/?service=storage#storage/tag/dev-branches/POST/v2/storage/dev-branches
148
+ */
149
+ const createDevBranchAndWait = async (body, options) => {
150
+ return poller(await createDevBranchAsync(body), options).start();
151
+ };
152
+ /**
153
+ * Renames a development branch or changes its description.
154
+ *
155
+ * @link https://api.keboola.com/?service=storage#storage/tag/dev-branches/PUT/v2/storage/dev-branches/{id}
156
+ */
157
+ const updateDevBranch = async ({ id, name, description }) => {
158
+ const { data } = await client.put("/v2/storage/dev-branches/{id}", {
159
+ path: { id: String(id) },
160
+ body: {
161
+ name,
162
+ description
163
+ }
164
+ });
165
+ return data;
166
+ };
167
+ /**
168
+ * Deletes a development branch. Async — returns a job to poll.
169
+ *
170
+ * @link https://api.keboola.com/?service=storage#storage/tag/dev-branches/DELETE/v2/storage/dev-branches/{id}
171
+ */
172
+ const deleteDevBranchAsync = async (id) => {
173
+ const { data } = await client.delete("/v2/storage/dev-branches/{id}", { path: { id: String(id) } });
174
+ return data;
175
+ };
176
+ /**
177
+ * Deletes a development branch and waits for the job to finish.
178
+ *
179
+ * - Resolves with how the wait ended, so nothing throws: `done` carries the finished
180
+ * `devBranchDelete` job.
181
+ * - A job that ended as `error` is a `done` wait carrying a failed job — it finished. `timedOut`,
182
+ * `exhausted`, `aborted` and `errored` are the endings with no job to read.
183
+ *
184
+ * @link https://api.keboola.com/?service=storage#storage/tag/dev-branches/DELETE/v2/storage/dev-branches/{id}
185
+ */
186
+ const deleteDevBranchAndWait = async (id, options) => {
187
+ return poller(await deleteDevBranchAsync(id), options).start();
188
+ };
189
+ /**
190
+ * Returns every metadata record on a branch. The branch is the object here, so `branchId` is the
191
+ * thing being addressed rather than the branch a request is scoped to.
192
+ *
193
+ * @link https://api.keboola.com/?service=storage#storage/tag/metadata/GET/v2/storage/branch/{branchId}/metadata
194
+ */
195
+ const getDevBranchMetadata = async (branchId, signal) => {
196
+ const { data } = await client.get("/v2/storage/branch/{branchId}/metadata", { path: { branchId } }, { signal });
197
+ return data;
198
+ };
199
+ /**
200
+ * Adds or updates metadata on a branch.
201
+ *
202
+ * @link https://api.keboola.com/?service=storage#storage/tag/metadata/POST/v2/storage/branch/{branchId}/metadata
203
+ */
204
+ const saveDevBranchMetadata = async ({ branchId, metadata }, signal) => {
205
+ const { data } = await client.post("/v2/storage/branch/{branchId}/metadata", {
206
+ path: { branchId },
207
+ body: { metadata }
208
+ }, { signal });
209
+ return data;
210
+ };
211
+ /**
212
+ * Deletes a single metadata entry from a branch.
213
+ *
214
+ * @link https://api.keboola.com/?service=storage#storage/tag/metadata/DELETE/v2/storage/branch/{branchId}/metadata/{metadataId}
215
+ */
216
+ const deleteDevBranchMetadata = async ({ branchId, metadataId }, signal) => {
217
+ await client.delete("/v2/storage/branch/{branchId}/metadata/{metadataId}", { path: {
218
+ branchId,
219
+ metadataId
220
+ } }, { signal });
221
+ };
222
+ return {
223
+ getDevBranches,
224
+ updateDevBranch,
225
+ createDevBranchAsync,
226
+ createDevBranchAndWait,
227
+ deleteDevBranchAsync,
228
+ deleteDevBranchAndWait,
229
+ getDevBranchMetadata,
230
+ saveDevBranchMetadata,
231
+ deleteDevBranchMetadata
232
+ };
233
+ };
234
+ //#endregion
235
+ //#region src/clients/storage/bucketExternal/bucketExternal.ts
236
+ /**
237
+ * An external bucket wraps a schema that already exists in the project's backend (Snowflake or
238
+ * BigQuery) rather than one Keboola created. Registering it is what makes the rest of this namespace
239
+ * apply: only an external bucket needs its table metadata refreshed, manually or on a cron.
240
+ *
241
+ * Two spec mismatches recur and account for the assertions below:
242
+ * - **jobs** — the spec's `JobResponse` is a flat shape with `status: string`, while `Job<T>` is a
243
+ * discriminated union over `status` carrying typed `results`. Every job return is asserted, whether
244
+ * the operation declares a `JobResponse` or no body at all.
245
+ * - **`async` query** — `registerBucketAsync` is invoked with `async: true` but declares
246
+ * `query: never`.
247
+ *
248
+ * What the Storage spec needs, per operation:
249
+ *
250
+ * - `POST /buckets/register` (`BucketRegisterAction`)
251
+ * - body: `RegisterExistingBucketRequest` is stubbed → really `RegisterBucketBody`
252
+ * - query: `never` → really accepts `async`
253
+ * - response: contentless `default` → really a `bucketRegister` job
254
+ * - `PUT /buckets/{bucketId}/refresh` (`BucketRefreshAction`)
255
+ * - response: 202 `JobResponse` → really a `bucketRefresh` job
256
+ * - `POST /branch/{branchId}/buckets/{bucketId}/scheduled-tasks/refresh` (`ScheduleRefreshAction`)
257
+ * - response: contentless `default` → really a `ScheduledTask`
258
+ *
259
+ * `GET /buckets/register-guide` is the one operation whose spec is already right — its query and
260
+ * response types are generated, not asserted.
261
+ */
262
+ const createBucketExternal = (openApiClient) => {
263
+ /**
264
+ * Registers an external bucket. Async — returns a job to poll.
265
+ *
266
+ * @link https://api.keboola.com/?service=storage#storage/POST/v2/storage/buckets/register
267
+ */
268
+ const registerBucketAsync = async (body, signal) => {
269
+ const { data } = await openApiClient.post("/v2/storage/buckets/register", {
270
+ query: { async: true },
271
+ body
272
+ }, { signal });
273
+ return data;
274
+ };
275
+ /**
276
+ * Returns a markdown guide for registering an external bucket.
277
+ *
278
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/GET/v2/storage/buckets/register-guide
279
+ */
280
+ const getBucketRegistrationGuide = async (query, signal) => {
281
+ const { data } = await openApiClient.get("/v2/storage/buckets/register-guide", { query }, {
282
+ signal,
283
+ queryArrayFormat: "brackets"
284
+ });
285
+ return data;
286
+ };
287
+ /**
288
+ * Refreshes an external bucket's table metadata. Async — returns a job to poll.
289
+ *
290
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/PUT/v2/storage/buckets/{bucketId}/refresh
291
+ */
292
+ const refreshExternalBucketAsync = async ({ bucketId, ...query }, signal) => {
293
+ const { data } = await openApiClient.put("/v2/storage/buckets/{bucketId}/refresh", {
294
+ path: { bucketId },
295
+ query
296
+ }, { signal });
297
+ return data;
298
+ };
299
+ const createScheduledRefresh = async ({ branchId, bucketId, ...body }) => {
300
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/buckets/{bucketId}/scheduled-tasks/refresh", {
301
+ path: {
302
+ branchId,
303
+ bucketId
304
+ },
305
+ body
306
+ });
307
+ return data;
308
+ };
309
+ const deleteScheduledTask = async (taskId) => {
310
+ await openApiClient.delete("/v2/storage/scheduled-tasks/{taskId}", { path: { taskId } });
311
+ };
312
+ return {
313
+ registerBucketAsync,
314
+ getBucketRegistrationGuide,
315
+ refreshExternalBucketAsync,
316
+ createScheduledRefresh,
317
+ deleteScheduledTask
318
+ };
319
+ };
320
+ //#endregion
321
+ //#region src/clients/storage/bucketListings/utils.ts
322
+ /**
323
+ * The two halves of the `bigquery.subscribers` wire format: a GCP IAM principal, which the Storage
324
+ * spec documents as "prefixed with `user:` or `group:`". The write path uses `toBackendSubscribers`;
325
+ * reads hand back the raw `string[]`, so a consumer that renders or edits subscribers decodes with
326
+ * `fromBackendSubscribers` rather than re-deriving the prefix rule.
327
+ */
328
+ const toBackendSubscribers = (subscribers) => subscribers.map((s) => `${s.type}:${s.email}`);
329
+ const fromBackendSubscribers = (raw) => {
330
+ const result = [];
331
+ for (const entry of raw) {
332
+ const colon = entry.indexOf(":");
333
+ if (colon === -1) continue;
334
+ const prefix = entry.slice(0, colon);
335
+ const email = entry.slice(colon + 1);
336
+ if (prefix !== "user" && prefix !== "group") continue;
337
+ if (email.length === 0) continue;
338
+ result.push({
339
+ type: prefix,
340
+ email
341
+ });
342
+ }
343
+ return result;
344
+ };
345
+ /**
346
+ * Builds the PATCH body for a listing update.
347
+ *
348
+ * Every field is copied only when the caller actually supplied it, because `description` carries
349
+ * three distinct meanings: absent means "leave it alone", `null` means "clear it", and a string
350
+ * means "set it". Evaluating the coercion unconditionally would turn an omitted description into a
351
+ * `null` and silently clear it.
352
+ *
353
+ * Throws when nothing was supplied: the backend answers an empty PATCH with a job that lands in
354
+ * `success` without changing anything, so a caller would poll it and report a save that never
355
+ * happened. Gate the call on the form's "dirty" state rather than relying on this.
356
+ *
357
+ * Do not "normalize" the `exposure*` names without coordinating with the bucket-listing backend
358
+ * owner.
359
+ */
360
+ const toUpdateListingBody = (input) => {
361
+ const body = {};
362
+ if (input.name !== void 0) body.exposureName = input.name;
363
+ if (input.description !== void 0) body.exposureDescription = input.description?.trim() || null;
364
+ if (input.subscribers !== void 0) body.bigquery = { subscribers: toBackendSubscribers(input.subscribers) };
365
+ if (Object.keys(body).length === 0) throw new Error("updateListingAsync requires at least one field");
366
+ return body;
367
+ };
368
+ //#endregion
369
+ //#region src/clients/storage/bucketListings/bucketListings.ts
370
+ /**
371
+ * A bucket listing (exposure) publishes a bucket to a marketplace — BigQuery Analytics Hub is the
372
+ * only backend today, which is why every write carries a `bigquery` key.
373
+ *
374
+ * What the Storage spec needs, per operation:
375
+ *
376
+ * - `POST` / `PATCH` / `DELETE /buckets/{bucketId}/listing`
377
+ * - response: 202 `JobResponse` → really `bucketListingCreate` / `bucketListingUpdate` /
378
+ * `bucketListingDelete` jobs. The spec's `JobResponse` is a flat shape with `status: string`,
379
+ * while `Job<T>` is a discriminated union over `status` carrying typed `results`, so each is
380
+ * asserted.
381
+ *
382
+ * `GET /buckets/{bucketId}/listing` and `GET /listings` are the operations whose specs are already
383
+ * right — their query and response types are generated, not asserted.
384
+ */
385
+ const createBucketListings = (openApiClient) => {
386
+ /**
387
+ * Reads a bucket's listing, or `null` when the bucket has none (the endpoint 404s for both "no
388
+ * bucket" and "no listing"). The response is the spec shape: `bigquery` is optional there — it is
389
+ * present only for a BigQuery bucket, the only backend today — and `subscribers` inside it are the
390
+ * raw `user:`/`group:`-prefixed principals, which `fromBackendSubscribers` decodes.
391
+ */
392
+ const getListing = async (bucketId, signal) => {
393
+ try {
394
+ const { data } = await openApiClient.get("/v2/storage/buckets/{bucketId}/listing", { path: { bucketId } }, { signal });
395
+ return data;
396
+ } catch (error) {
397
+ if (isApiError(error) && error.response.status === 404) return null;
398
+ throw error;
399
+ }
400
+ };
401
+ const createListingAsync = async ({ bucketId, ...input }, signal) => {
402
+ const { data } = await openApiClient.post("/v2/storage/buckets/{bucketId}/listing", {
403
+ path: { bucketId },
404
+ body: {
405
+ listingName: input.name,
406
+ listingDescription: input.description?.trim() || null,
407
+ bigquery: {
408
+ listingId: input.listingId,
409
+ subscribers: toBackendSubscribers(input.subscribers)
410
+ }
411
+ }
412
+ }, { signal });
413
+ return data;
414
+ };
415
+ /**
416
+ * Update a bucket exposure. At least one of `name`, `description`, or
417
+ * `subscribers` must be provided — the SDK throws synchronously if all three
418
+ * are absent, since the backend would otherwise no-op a PATCH with an empty
419
+ * body and we'd return a job that's already in `success` with no actual
420
+ * change. Callers should gate the call against the form's "dirty" state.
421
+ */
422
+ const updateListingAsync = async ({ bucketId, ...input }, signal) => {
423
+ const { data } = await openApiClient.patch("/v2/storage/buckets/{bucketId}/listing", {
424
+ path: { bucketId },
425
+ body: toUpdateListingBody(input)
426
+ }, { signal });
427
+ return data;
428
+ };
429
+ const deleteListingAsync = async (bucketId, signal) => {
430
+ const { data } = await openApiClient.delete("/v2/storage/buckets/{bucketId}/listing", { path: { bucketId } }, { signal });
431
+ return data;
432
+ };
433
+ /** Every listing the token can manage. Rows carry `bucketId`, unlike the detail response. */
434
+ const getListings = async (signal) => {
435
+ const { data } = await openApiClient.get("/v2/storage/listings", {}, { signal });
436
+ return data;
437
+ };
438
+ return {
439
+ getListing,
440
+ createListingAsync,
441
+ updateListingAsync,
442
+ deleteListingAsync,
443
+ getListings
444
+ };
445
+ };
446
+ //#endregion
447
+ //#region src/clients/storage/buckets/buckets.ts
448
+ /**
449
+ * Everything here runs through the OpenAPI client except `updateBucket`, which cannot: the spec
450
+ * declares no `put` on `/v2/storage/buckets/{bucketId}` (nor on the branch variant), so the operation
451
+ * is missing outright rather than mistyped. That one keeps the generic client, which is why this
452
+ * factory still takes both.
453
+ *
454
+ * One mismatch recurs: the spec's `JobResponse` is a flat shape with `status: string`, while `Job<T>`
455
+ * is a discriminated union over `status` carrying typed `results`, so every job return is asserted.
456
+ *
457
+ * What the Storage spec needs, per operation:
458
+ *
459
+ * - `PUT /buckets/{bucketId}` — **operation missing entirely**; really takes `UpdateBucketBody`
460
+ * (`displayName` / `description` / `color`) and answers a bucket detail
461
+ * - `GET /branch/{branchId}/buckets` (`BucketsListAction`)
462
+ * - query: `include` is a `string` → really a repeatable list, sent comma-joined
463
+ * - response: `BucketCreateResponse[]` → really `Bucket[]` (a listing row, not a create result)
464
+ * - `POST /buckets` (`BucketCreateAction`)
465
+ * - response: 201 `BucketCreateResponse` → really a bucket detail
466
+ * - `DELETE /buckets/{bucketId}` (`BucketDeleteAction`)
467
+ * - response: 204 wins over the 202 `JobResponse` in success-code precedence, so the async variant's
468
+ * job is asserted
469
+ * - `POST /buckets/{bucketId}/owner` (`BucketOwnerUpdateAction`)
470
+ * - body: `BucketOwnerUpdateRequest` is stubbed → really `{ email } | { id }`
471
+ * */
472
+ const createBuckets = (openApiClient, client) => {
473
+ const getBuckets = async ({ branchId, ...query }, signal) => {
474
+ const { data } = await openApiClient.get("/v2/storage/branch/{branchId}/buckets", {
475
+ path: { branchId },
476
+ query
477
+ }, {
478
+ signal,
479
+ queryArrayFormat: "comma"
480
+ });
481
+ return data;
482
+ };
483
+ /**
484
+ * Returns a bucket from the given branch. A dev branch only contains the buckets created or
485
+ * pulled into it, so a production bucket must be read with the default branch id.
486
+ *
487
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/GET/v2/storage/branch/{branchId}/buckets/{bucketId}
488
+ */
489
+ const getBucket = async ({ branchId, bucketId, include }, signal) => {
490
+ const { data } = await openApiClient.get("/v2/storage/branch/{branchId}/buckets/{bucketId}", {
491
+ path: {
492
+ branchId,
493
+ bucketId
494
+ },
495
+ query: { include: include?.join(",") }
496
+ }, { signal });
497
+ return data;
498
+ };
499
+ const createBucket = async (body) => {
500
+ const { data } = await openApiClient.post("/v2/storage/buckets", { body });
501
+ return data;
502
+ };
503
+ const updateBucket = async ({ bucketId, ...body }) => {
504
+ const { data } = await client.put(`/v2/storage/buckets/{id}`, {
505
+ path: { id: bucketId },
506
+ body
507
+ });
508
+ return data;
509
+ };
510
+ /**
511
+ * Deletes a bucket synchronously.
512
+ *
513
+ * Refused outright on the stacks we test against (`400 storage.buckets.syncDeleteDisabled`,
514
+ * "Synchronous drop is not supported, use async call") — prefer `deleteBucketAsync` below.
515
+ *
516
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/DELETE/v2/storage/buckets/{bucketId}
517
+ */
518
+ const deleteBucket = async (id) => {
519
+ await openApiClient.delete("/v2/storage/buckets/{bucketId}", { path: { bucketId: id } });
520
+ };
521
+ /**
522
+ * Deletes a bucket asynchronously and returns a job to poll.
523
+ * Required on GCP stacks where synchronous bucket deletion is not supported.
524
+ *
525
+ * `force` deletes all tables inside the bucket before removing it.
526
+ *
527
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/DELETE/v2/storage/buckets/{bucketId}
528
+ */
529
+ const deleteBucketAsync = async ({ bucketId, ...query }) => {
530
+ const { data } = await openApiClient.delete("/v2/storage/buckets/{bucketId}", {
531
+ path: { bucketId },
532
+ query: {
533
+ async: true,
534
+ ...query
535
+ }
536
+ });
537
+ return data;
538
+ };
539
+ /**
540
+ * Returns the owner of a bucket in the given branch.
541
+ *
542
+ * A bucket has no owner until one is assigned — reading it on a fresh bucket answers
543
+ * `404 storage.bucket.ownerNotFound`, so call `updateBucketOwner` first (or handle the 404 as
544
+ * "unassigned" rather than as a missing bucket).
545
+ *
546
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/GET/v2/storage/branch/{branchId}/buckets/{bucketId}/owner
547
+ */
548
+ const getBucketOwner = async ({ branchId, bucketId }, signal) => {
549
+ const { data } = await openApiClient.get("/v2/storage/branch/{branchId}/buckets/{bucketId}/owner", { path: {
550
+ branchId,
551
+ bucketId
552
+ } }, { signal });
553
+ return data;
554
+ };
555
+ /**
556
+ * Changes the owner of a bucket (by `id` or `email`).
557
+ *
558
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/POST/v2/storage/buckets/{bucketId}/owner
559
+ */
560
+ const updateBucketOwner = async ({ bucketId, ...body }, signal) => {
561
+ await openApiClient.post("/v2/storage/buckets/{bucketId}/owner", {
562
+ path: { bucketId },
563
+ body
564
+ }, { signal });
565
+ };
566
+ /**
567
+ * Adds or updates metadata on a bucket in the given branch.
568
+ *
569
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/POST/v2/storage/branch/{branchId}/buckets/{bucketId}/metadata
570
+ */
571
+ const saveBucketMetadata = async ({ branchId, bucketId, ...body }, signal) => {
572
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/buckets/{bucketId}/metadata", {
573
+ path: {
574
+ branchId,
575
+ bucketId
576
+ },
577
+ body
578
+ }, { signal });
579
+ return data;
580
+ };
581
+ /**
582
+ * Deletes a single metadata entry from a bucket in the given branch.
583
+ *
584
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/DELETE/v2/storage/branch/{branchId}/buckets/{bucketId}/metadata/{metadataId}
585
+ */
586
+ const deleteBucketMetadata = async ({ branchId, bucketId, metadataId }, signal) => {
587
+ await openApiClient.delete("/v2/storage/branch/{branchId}/buckets/{bucketId}/metadata/{metadataId}", { path: {
588
+ branchId,
589
+ bucketId,
590
+ metadataId
591
+ } }, { signal });
592
+ };
593
+ return {
594
+ getBuckets,
595
+ getBucket,
596
+ createBucket,
597
+ updateBucket,
598
+ deleteBucket,
599
+ deleteBucketAsync,
600
+ getBucketOwner,
601
+ updateBucketOwner,
602
+ saveBucketMetadata,
603
+ deleteBucketMetadata
604
+ };
605
+ };
606
+ //#endregion
607
+ //#region src/clients/storage/bucketSharing/bucketSharing.ts
608
+ /**
609
+ * Two spec mismatches recur here and account for every assertion below:
610
+ * - **jobs** — the spec's `JobResponse` is a flat shape with `status: string`, while `Job<T>` is a
611
+ * discriminated union over `status` carrying typed `results`. Every job return is asserted, whether
612
+ * the operation declares a `JobResponse` or no body at all.
613
+ * - **`async` query** — all six share/unshare operations are invoked with `async: true` but declare
614
+ * `query: never`.
615
+ *
616
+ * What the Storage spec needs, per operation:
617
+ *
618
+ * - `POST /branch/{branchId}/buckets/{bucketId}/share-organization` / `-organization-project`
619
+ * - query: `never` → really accepts `async`
620
+ * - response: `BucketShareOrganizationResponse` / `…ProjectResponse` → really share jobs
621
+ * - `POST /branch/{branchId}/buckets/{bucketId}/share-to-projects` / `-to-users`
622
+ * - query: `never` → really accepts `async`
623
+ * - body: `CreateBucketSharingToProjectsRequest` / `…ToUsersRequest` are stubbed
624
+ * (`Record<string, never>`) → really `{ targetProjectIds }` / `{ targetUsers }`
625
+ * - response: contentless `default` → really `bucketShareToProjects` / `bucketShareToAdmins` jobs
626
+ * - `DELETE /branch/{branchId}/buckets/{bucketId}/share` (`BucketShareDeleteAction`)
627
+ * - query: `never` → really accepts `async`
628
+ * - response: `BucketShareDeleteResponse` → really a `bucketRemoveShare` job
629
+ * - `DELETE /branch/{branchId}/buckets/{bucketId}/links/{linkedProjectId}` (`BucketForceUnlinkAction`)
630
+ * - query: `never` → really accepts `async`
631
+ * - path: `linkedProjectId` is a `number` → really a string
632
+ * - response: 202 `JobResponse` → really a `bucketForceUnlink` job
633
+ * - `POST /buckets` (`BucketCreateAction`) — the link half of a create-or-link endpoint
634
+ * - response: the 201 "created or linked synchronously" wins over the 202 in success-code
635
+ * precedence, so the async variant's `bucketLink` job is asserted
636
+ * - `GET /shared-buckets` (`SharedBucketsListAction`)
637
+ * - response: `Record<string, never>[]` → really a shared-bucket listing. This one is *not*
638
+ * asserted, so `SharedBuckets` is currently an empty-object array and callers get nothing useful.
639
+ */
640
+ const createBucketSharing = (openApiClient) => {
641
+ /**
642
+ * Shares a bucket with everyone in the organization. Async — returns a job to poll.
643
+ *
644
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/POST/v2/storage/branch/{branchId}/buckets/{bucketId}/share-organization
645
+ */
646
+ const shareBucketToOrganizationAsync = async ({ branchId, bucketId }, signal) => {
647
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/buckets/{bucketId}/share-organization", {
648
+ path: {
649
+ branchId,
650
+ bucketId
651
+ },
652
+ query: { async: true }
653
+ }, { signal });
654
+ return data;
655
+ };
656
+ /**
657
+ * Shares a bucket with every project in the organization. Async — returns a job to poll.
658
+ *
659
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/POST/v2/storage/branch/{branchId}/buckets/{bucketId}/share-organization-project
660
+ */
661
+ const shareBucketToOrganizationProjectAsync = async ({ branchId, bucketId }, signal) => {
662
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/buckets/{bucketId}/share-organization-project", {
663
+ path: {
664
+ branchId,
665
+ bucketId
666
+ },
667
+ query: { async: true }
668
+ }, { signal });
669
+ return data;
670
+ };
671
+ /**
672
+ * Shares a bucket with specific projects. Async — returns a job to poll.
673
+ *
674
+ * @link https://api.keboola.com/?service=storage#storage/POST/v2/storage/branch/{branchId}/buckets/{bucketId}/share-to-projects
675
+ */
676
+ const shareBucketToProjectsAsync = async ({ branchId, bucketId, ...body }, signal) => {
677
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/buckets/{bucketId}/share-to-projects", {
678
+ path: {
679
+ branchId,
680
+ bucketId
681
+ },
682
+ query: { async: true },
683
+ body
684
+ }, { signal });
685
+ return data;
686
+ };
687
+ /**
688
+ * Shares a bucket with specific users (by ID or e-mail). Async — returns a job to poll.
689
+ *
690
+ * @link https://api.keboola.com/?service=storage#storage/POST/v2/storage/branch/{branchId}/buckets/{bucketId}/share-to-users
691
+ */
692
+ const shareBucketToUsersAsync = async ({ branchId, bucketId, ...body }, signal) => {
693
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/buckets/{bucketId}/share-to-users", {
694
+ path: {
695
+ branchId,
696
+ bucketId
697
+ },
698
+ query: { async: true },
699
+ body
700
+ }, { signal });
701
+ return data;
702
+ };
703
+ /**
704
+ * Stops sharing a bucket. Async — returns a job to poll.
705
+ *
706
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/DELETE/v2/storage/branch/{branchId}/buckets/{bucketId}/share
707
+ */
708
+ const unshareBucketAsync = async ({ branchId, bucketId }, signal) => {
709
+ const { data } = await openApiClient.delete("/v2/storage/branch/{branchId}/buckets/{bucketId}/share", {
710
+ path: {
711
+ branchId,
712
+ bucketId
713
+ },
714
+ query: { async: true }
715
+ }, { signal });
716
+ return data;
717
+ };
718
+ /**
719
+ * Force-unlinks a bucket from a linked project. Async — returns a job to poll.
720
+ *
721
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/DELETE/v2/storage/branch/{branchId}/buckets/{bucketId}/links/{linkedProjectId}
722
+ */
723
+ const forceUnlinkBucketAsync = async ({ branchId, bucketId, linkedProjectId }, signal) => {
724
+ const { data } = await openApiClient.delete("/v2/storage/branch/{branchId}/buckets/{bucketId}/links/{linkedProjectId}", {
725
+ path: {
726
+ branchId,
727
+ bucketId,
728
+ linkedProjectId
729
+ },
730
+ query: { async: true }
731
+ }, { signal });
732
+ return data;
733
+ };
734
+ /**
735
+ * Links a bucket shared with this project into it. Async — returns a job to poll, whose `results`
736
+ * is the new bucket.
737
+ *
738
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/POST/v2/storage/buckets
739
+ */
740
+ const linkBucketAsync = async (body, signal) => {
741
+ const { data } = await openApiClient.post("/v2/storage/buckets", {
742
+ query: { async: true },
743
+ body
744
+ }, { signal });
745
+ return data;
746
+ };
747
+ /**
748
+ * Lists buckets shared with the current project.
749
+ *
750
+ * @link https://api.keboola.com/?service=storage#storage/tag/shared-buckets/GET/v2/storage/shared-buckets
751
+ */
752
+ const sharedBuckets = async (query, signal) => {
753
+ const { data } = await openApiClient.get("/v2/storage/shared-buckets", { query }, { signal });
754
+ return data;
755
+ };
756
+ return {
757
+ shareBucketToOrganizationAsync,
758
+ shareBucketToOrganizationProjectAsync,
759
+ shareBucketToProjectsAsync,
760
+ shareBucketToUsersAsync,
761
+ unshareBucketAsync,
762
+ forceUnlinkBucketAsync,
763
+ linkBucketAsync,
764
+ sharedBuckets
765
+ };
766
+ };
767
+ //#endregion
768
+ //#region src/clients/storage/columns/columns.ts
769
+ /**
770
+ * Every job return below is asserted in: the spec's `JobResponse` is a flat shape with
771
+ * `status: string`, while `Job<T>` is a discriminated union over `status` carrying typed `results`.
772
+ * That mismatch applies to both operations that declare a `JobResponse` and those that declare no
773
+ * response body at all. What the Storage spec needs, per operation:
774
+ *
775
+ * - `POST /branch/{branchId}/tables/{id}/columns` (`ColumnCreateAction`)
776
+ * - body: none of `ColumnCreateRequest` / `SnowflakeAddColumnToTableRequest` /
777
+ * `BigqueryAddColumnToTableRequest` declares `basetype`, and they type `definition.length` as a
778
+ * `number` → really a string (a decimal length is sent as `'38,0'`)
779
+ * - response: 202 is contentless → really a `tableColumnAdd` job
780
+ * - `DELETE /branch/{branchId}/tables/{tableId}/columns/{columnName}` (`ColumnDeleteAction`)
781
+ * - response: 202 declares `JobResponse` → really a `tableColumnDelete` job
782
+ * - `POST /branch/{branchId}/tables/{tableId}/primary-key` (`PrimaryKeyCreateAction`)
783
+ * - body: `CreatePrimaryKeyRequest.skipDuplicatesCheck` is required → really optional (it has a
784
+ * documented `@default false`, so a caller omitting it is valid)
785
+ * - response: 202 is contentless → really a `tablePrimaryKeyAdd` job
786
+ * - `DELETE /branch/{branchId}/tables/{tableId}/primary-key` (`PrimaryKeyDeleteAction`)
787
+ * - response: 202 declares `JobResponse` → really a `tablePrimaryKeyDelete` job
788
+ */
789
+ const createColumns = (client) => {
790
+ /**
791
+ * Adds a column to a table. Async — returns a job.
792
+ *
793
+ * @link https://api.keboola.com/?service=storage#storage/tag/columns/POST/v2/storage/branch/{branchId}/tables/{id}/columns
794
+ */
795
+ const addTableColumnAsync = async ({ branchId, id, ...body }, signal) => {
796
+ const { data } = await client.post("/v2/storage/branch/{branchId}/tables/{id}/columns", {
797
+ path: {
798
+ branchId,
799
+ id
800
+ },
801
+ body
802
+ }, { signal });
803
+ return data;
804
+ };
805
+ /**
806
+ * Drops a column from a table. Async — returns a job.
807
+ *
808
+ * @link https://api.keboola.com/?service=storage#storage/tag/columns/DELETE/v2/storage/branch/{branchId}/tables/{tableId}/columns/{columnName}
809
+ */
810
+ const deleteTableColumnAsync = async ({ branchId, tableId, columnName, ...query }, signal) => {
811
+ const { data } = await client.delete("/v2/storage/branch/{branchId}/tables/{tableId}/columns/{columnName}", {
812
+ path: {
813
+ branchId,
814
+ tableId,
815
+ columnName
816
+ },
817
+ query
818
+ }, { signal });
819
+ return data;
820
+ };
821
+ /**
822
+ * Sets the primary key of a table. Async — returns a job.
823
+ *
824
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/POST/v2/storage/branch/{branchId}/tables/{tableId}/primary-key
825
+ */
826
+ const createTablePrimaryKeyAsync = async ({ branchId, tableId, ...body }, signal) => {
827
+ const { data } = await client.post("/v2/storage/branch/{branchId}/tables/{tableId}/primary-key", {
828
+ path: {
829
+ branchId,
830
+ tableId
831
+ },
832
+ body
833
+ }, { signal });
834
+ return data;
835
+ };
836
+ /**
837
+ * Removes the primary key of a table. Async — returns a job.
838
+ *
839
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/DELETE/v2/storage/branch/{branchId}/tables/{tableId}/primary-key
840
+ */
841
+ const removeTablePrimaryKeyAsync = async ({ branchId, tableId }, signal) => {
842
+ const { data } = await client.delete("/v2/storage/branch/{branchId}/tables/{tableId}/primary-key", { path: {
843
+ branchId,
844
+ tableId
845
+ } }, { signal });
846
+ return data;
847
+ };
848
+ /**
849
+ * Adds or updates metadata on a column in the given branch.
850
+ *
851
+ * @link https://api.keboola.com/?service=storage#storage/tag/columns/POST/v2/storage/branch/{branchId}/columns/{id}/metadata
852
+ */
853
+ const saveColumnMetadata = async ({ branchId, columnId, ...body }, signal) => {
854
+ const { data } = await client.post("/v2/storage/branch/{branchId}/columns/{id}/metadata", {
855
+ path: {
856
+ branchId,
857
+ id: columnId
858
+ },
859
+ body
860
+ }, { signal });
861
+ return data;
862
+ };
863
+ /**
864
+ * Deletes a single metadata entry from a column in the given branch.
865
+ *
866
+ * @link https://api.keboola.com/?service=storage#storage/tag/columns/DELETE/v2/storage/branch/{branchId}/columns/{id}/metadata/{metadataId}
867
+ */
868
+ const deleteColumnMetadata = async ({ branchId, columnId, metadataId }, signal) => {
869
+ await client.delete("/v2/storage/branch/{branchId}/columns/{id}/metadata/{metadataId}", { path: {
870
+ branchId,
871
+ id: columnId,
872
+ metadataId
873
+ } }, { signal });
874
+ };
875
+ return {
876
+ addTableColumnAsync,
877
+ deleteTableColumnAsync,
878
+ createTablePrimaryKeyAsync,
879
+ removeTablePrimaryKeyAsync,
880
+ saveColumnMetadata,
881
+ deleteColumnMetadata
882
+ };
883
+ };
884
+ //#endregion
885
+ //#region src/clients/storage/components/components.ts
886
+ const createComponents = (client) => {
887
+ const getComponent = async ({ componentId, branchId = "default" }, signal) => {
888
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}", { path: {
889
+ componentId,
890
+ branchId
891
+ } }, { signal });
892
+ return data;
893
+ };
894
+ const getComponents = async ({ branchId = "default", ...query } = {}, signal) => {
895
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components", {
896
+ path: { branchId: String(branchId) },
897
+ query
898
+ }, {
899
+ signal,
900
+ queryArrayFormat: "comma"
901
+ });
902
+ return data;
903
+ };
904
+ return {
905
+ getComponent,
906
+ getComponents
907
+ };
908
+ };
909
+ //#endregion
910
+ //#region src/clients/storage/configurationMetadata/configurationMetadata.ts
911
+ const createConfigurationMetadata = (client) => {
912
+ const getConfigurationMetadata = async ({ branchId = "default", componentId, configurationId }, signal) => {
913
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/metadata", { path: {
914
+ branchId,
915
+ componentId,
916
+ configurationId
917
+ } }, { signal });
918
+ return data;
919
+ };
920
+ /** Create or update configuration metadata (e.g. `KBC.configuration.folderName`). */
921
+ const saveConfigurationMetadata = async ({ branchId = "default", componentId, configurationId, ...body }) => {
922
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/metadata", {
923
+ path: {
924
+ branchId,
925
+ componentId,
926
+ configurationId
927
+ },
928
+ body
929
+ });
930
+ return data;
931
+ };
932
+ /** Only available on the default branch — a dev branch answers 501. */
933
+ const deleteConfigurationMetadata = async ({ branchId = "default", componentId, configurationId, metadataId }, signal) => {
934
+ await client.delete("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/metadata/{metadataId}", { path: {
935
+ branchId,
936
+ componentId,
937
+ configurationId,
938
+ metadataId
939
+ } }, { signal });
940
+ };
941
+ return {
942
+ getConfigurationMetadata,
943
+ saveConfigurationMetadata,
944
+ deleteConfigurationMetadata
945
+ };
946
+ };
947
+ //#endregion
948
+ //#region src/clients/storage/configurationRows/configurationRows.ts
949
+ const createConfigurationRows = (client) => {
950
+ /**
951
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configuration-rows/POST/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows
952
+ */
953
+ const createConfigurationRow = async ({ branchId = "default", componentId, configurationId, ...body }) => {
954
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows", {
955
+ path: {
956
+ branchId,
957
+ componentId,
958
+ configurationId
959
+ },
960
+ body
961
+ });
962
+ return data;
963
+ };
964
+ /**
965
+ * NOTE: Do not run this method concurrently; BE will return 500 server errors under load due to a BE bottleneck with IDs allocation.
966
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configuration-rows/POST/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows
967
+ */
968
+ const createConfigurationRows = async ({ branchId = "default", componentId, configurationId, data }, options) => {
969
+ return series({
970
+ items: data,
971
+ process: (rowBody) => {
972
+ return createConfigurationRow({
973
+ branchId,
974
+ componentId,
975
+ configurationId,
976
+ ...rowBody
977
+ });
978
+ },
979
+ middlewares: options?.middlewares
980
+ });
981
+ };
982
+ /**
983
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configuration-rows/GET/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}
984
+ */
985
+ const getConfigurationRow = async ({ branchId = "default", ...path }, signal) => {
986
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}", { path: {
987
+ branchId,
988
+ ...path
989
+ } }, { signal });
990
+ return data;
991
+ };
992
+ /**
993
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configuration-rows/PUT/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}
994
+ */
995
+ const updateConfigurationRow = async ({ branchId = "default", componentId, configurationId, rowId, ...body }, signal) => {
996
+ const { data } = await client.put("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}", {
997
+ path: {
998
+ branchId,
999
+ componentId,
1000
+ configurationId,
1001
+ rowId
1002
+ },
1003
+ body
1004
+ }, { signal });
1005
+ return data;
1006
+ };
1007
+ /**
1008
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configuration-rows/PUT/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}/state
1009
+ */
1010
+ const updateConfigurationRowState = async ({ branchId = "default", componentId, configurationId, rowId, ...body }, signal) => {
1011
+ const { data } = await client.put("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}/state", {
1012
+ path: {
1013
+ branchId,
1014
+ componentId,
1015
+ configurationId,
1016
+ rowId
1017
+ },
1018
+ body
1019
+ }, { signal });
1020
+ return data;
1021
+ };
1022
+ /**
1023
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configuration-rows/DELETE/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}
1024
+ */
1025
+ const deleteConfigurationRow = async ({ changeDescription, ...path }) => {
1026
+ await client.delete("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}", {
1027
+ path,
1028
+ body: { changeDescription }
1029
+ });
1030
+ };
1031
+ /**
1032
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configuration-rows/DELETE/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}
1033
+ */
1034
+ const deleteConfigurationRows = async ({ rowIds, changeDescription, ...input }, options) => {
1035
+ await concurrent({
1036
+ items: rowIds,
1037
+ process: (rowId) => {
1038
+ const resolvedDescription = typeof changeDescription === "string" ? changeDescription : changeDescription?.(rowId);
1039
+ return deleteConfigurationRow({
1040
+ rowId,
1041
+ changeDescription: resolvedDescription,
1042
+ ...input
1043
+ });
1044
+ },
1045
+ concurrency: 5,
1046
+ middlewares: options?.middlewares
1047
+ });
1048
+ };
1049
+ return {
1050
+ createConfigurationRow,
1051
+ createConfigurationRows,
1052
+ getConfigurationRow,
1053
+ updateConfigurationRow,
1054
+ updateConfigurationRowState,
1055
+ deleteConfigurationRow,
1056
+ deleteConfigurationRows
1057
+ };
1058
+ };
1059
+ //#endregion
1060
+ //#region src/clients/storage/configurations/utils.ts
1061
+ /**
1062
+ * `expectedVersion` is the `version` field of the configuration the caller read, sent back as the
1063
+ * `If-Match` header so the write is conditional on nothing having changed since. What Storage does
1064
+ * with it:
1065
+ *
1066
+ * 1. Header omitted (`{}`) — no precondition, the write applies whatever the current version is.
1067
+ * `purgeConfiguration` is the exception and answers 428, which is why its `expectedVersion` is
1068
+ * required rather than optional.
1069
+ * 2. Version still current — the write applies.
1070
+ * 3. Version moved on since it was read — 412, and nothing is written.
1071
+ * 4. Value unusable — 400. Storage wants a strong entity tag, so the quotes are part of the value;
1072
+ * a bare number, a weak validator or a tag list are all rejected.
1073
+ */
1074
+ const createVersionPrecondition = (expectedVersion) => expectedVersion === void 0 ? {} : { [HttpHeader.IF_MATCH]: `"${expectedVersion}"` };
1075
+ /**
1076
+ * The `workspaceOutputMappingSync` job a configuration update enqueued.
1077
+ *
1078
+ * - Storage reports it in a header, not in the response body.
1079
+ * - `null` means there is no job to wait for, not that the write failed.
1080
+ * - Components outside Storage's allow-list get no job — `workspaceId` is ignored for them.
1081
+ */
1082
+ const parseSyncJobId = (headers) => {
1083
+ const jobId = Number(headers.get(KeboolaHttpHeader.STORAGE_API_JOB_ID));
1084
+ return Number.isInteger(jobId) && jobId > 0 ? jobId : null;
1085
+ };
1086
+ //#endregion
1087
+ //#region src/clients/storage/configurations/configurations.ts
1088
+ const createConfigurations = (client) => {
1089
+ const getConfiguration = async ({ componentId, configId, branchId = "default" }, signal) => {
1090
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}", { path: {
1091
+ componentId,
1092
+ configurationId: configId,
1093
+ branchId: String(branchId)
1094
+ } }, { signal });
1095
+ return data;
1096
+ };
1097
+ const getConfigurationDiff = async ({ componentId, configId, branchId }, signal) => {
1098
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/diff", { path: {
1099
+ componentId,
1100
+ configurationId: configId,
1101
+ branchId: String(branchId)
1102
+ } }, { signal });
1103
+ return data;
1104
+ };
1105
+ const rebaseConfiguration = async ({ branchId, componentId, configId, ...body }) => {
1106
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rebase", {
1107
+ path: {
1108
+ branchId: String(branchId),
1109
+ componentId,
1110
+ configurationId: configId
1111
+ },
1112
+ body
1113
+ });
1114
+ return data;
1115
+ };
1116
+ /**
1117
+ * Resolve a merge conflict by deleting the configuration — the same rebase
1118
+ * endpoint as `rebaseConfiguration`, but with an empty `diff` envelope. The
1119
+ * dev-branch configuration is re-anchored onto the given default-branch
1120
+ * `version` and its head version becomes a tombstone (soft delete). Returns
1121
+ * the deleted configuration.
1122
+ */
1123
+ const rebaseConfigurationToDeleted = async ({ branchId, componentId, configId, version }) => {
1124
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rebase", {
1125
+ path: {
1126
+ branchId: String(branchId),
1127
+ componentId,
1128
+ configurationId: configId
1129
+ },
1130
+ body: {
1131
+ version,
1132
+ diff: {}
1133
+ }
1134
+ });
1135
+ return data;
1136
+ };
1137
+ const createConfiguration = async ({ branchId = "default", componentId, ...body }) => {
1138
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs", {
1139
+ path: {
1140
+ branchId: String(branchId),
1141
+ componentId
1142
+ },
1143
+ body
1144
+ });
1145
+ return data;
1146
+ };
1147
+ /**
1148
+ * Updates an existing configuration. Only the fields provided are sent.
1149
+ *
1150
+ * - Resolves once the configuration is written.
1151
+ * - Sending `workspaceId` also asks Storage to sync that workspace's output mapping against the
1152
+ * saved configuration. That part runs as a job: poll `syncJobId` through `jobs.getJob` when it
1153
+ * has to land before the caller reports success.
1154
+ * - A `workspaceId` not linked to this component and configuration is rejected with 400, before
1155
+ * the configuration is written.
1156
+ *
1157
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configurations/PUT/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}
1158
+ */
1159
+ const updateConfiguration = async ({ branchId = "default", componentId, configId, configuration, workspaceId, ...rest }, signal) => {
1160
+ const body = {
1161
+ ...rest,
1162
+ configuration
1163
+ };
1164
+ const { data, response } = await client.put("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}", {
1165
+ path: {
1166
+ branchId: String(branchId),
1167
+ componentId,
1168
+ configurationId: configId
1169
+ },
1170
+ query: { workspaceId },
1171
+ body
1172
+ }, { signal });
1173
+ return {
1174
+ configuration: data,
1175
+ syncJobId: parseSyncJobId(response.headers)
1176
+ };
1177
+ };
1178
+ /**
1179
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configurations/PUT/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/state
1180
+ */
1181
+ const updateConfigurationState = async ({ branchId = "default", componentId, configId, ...body }, signal) => {
1182
+ const { data } = await client.put("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/state", {
1183
+ path: {
1184
+ branchId: String(branchId),
1185
+ componentId,
1186
+ configurationId: configId
1187
+ },
1188
+ body
1189
+ }, { signal });
1190
+ return data;
1191
+ };
1192
+ /**
1193
+ * Move a configuration to the trash — or, when it is in the trash already, purge it
1194
+ * permanently. Pass `expectedVersion` to pin the version the delete was decided on;
1195
+ * prefer `purgeConfiguration` when the permanent removal is the intent.
1196
+ */
1197
+ const deleteConfiguration = async ({ branchId, componentId, configId, expectedVersion }) => {
1198
+ await client.delete("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}", { path: {
1199
+ branchId: String(branchId),
1200
+ componentId,
1201
+ configurationId: configId
1202
+ } }, { headers: { ...createVersionPrecondition(expectedVersion) } });
1203
+ };
1204
+ /**
1205
+ * Permanently remove a trashed configuration, including its versions, rows and metadata.
1206
+ * Unlike a second `deleteConfiguration`, this never falls back to a soft delete: purging a
1207
+ * live configuration is rejected (400 `notInTrash`) rather than trashing it. Default branch
1208
+ * only, and the token needs `canPurgeTrash`.
1209
+ */
1210
+ const purgeConfiguration = async ({ branchId = "default", componentId, configId, expectedVersion }) => {
1211
+ await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/purge", { path: {
1212
+ branchId: String(branchId),
1213
+ componentId,
1214
+ configurationId: configId
1215
+ } }, { headers: { ...createVersionPrecondition(expectedVersion) } });
1216
+ };
1217
+ /**
1218
+ * Purge configurations across components in one bounded fan-out. Like every `concurrent` caller
1219
+ * it stops at the first rejection, and here that is a case to plan for rather than an edge: a
1220
+ * stale `expectedVersion` (412) abandons the rest of the queue, so re-read the trash before
1221
+ * offering another attempt.
1222
+ *
1223
+ * Emptying a trash is the whole-collection case this exists for, which `concurrent`'s default of
1224
+ * 2 would walk through two configurations at a time.
1225
+ */
1226
+ const purgeConfigurations = async ({ branchId, configs }) => {
1227
+ await concurrent({
1228
+ items: configs,
1229
+ concurrency: 10,
1230
+ process: (config) => purgeConfiguration({
1231
+ branchId,
1232
+ ...config
1233
+ })
1234
+ });
1235
+ };
1236
+ /** Restore a trashed configuration. */
1237
+ const restoreConfiguration = async ({ branchId = "default", componentId, configId }) => {
1238
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/restore", { path: {
1239
+ branchId: String(branchId),
1240
+ componentId,
1241
+ configurationId: configId
1242
+ } });
1243
+ return data;
1244
+ };
1245
+ /**
1246
+ * Reset a dev-branch configuration back to its default-branch (production) version.
1247
+ *
1248
+ * The spec is right: the endpoint answers with an empty body, confirmed against the live API by
1249
+ * the nightly smoke (`integration/storageConfigurationLifecycle.smoke.ts`). It used to be typed as
1250
+ * resolving to the configuration, so every caller reading a field off the result was reading
1251
+ * `undefined`. Re-read the configuration to observe the reset.
1252
+ *
1253
+ * Dev-branch only — the API answers 501 on `default`.
1254
+ */
1255
+ const resetConfigurationToDefault = async ({ branchId = "default", componentId, configId }) => {
1256
+ await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/reset-to-default", { path: {
1257
+ branchId: String(branchId),
1258
+ componentId,
1259
+ configurationId: configId
1260
+ } });
1261
+ };
1262
+ const deleteConfigurations = async ({ configIds, ...rest }) => {
1263
+ await concurrent({
1264
+ items: configIds,
1265
+ process: async (configId) => deleteConfiguration({
1266
+ ...rest,
1267
+ configId
1268
+ })
1269
+ });
1270
+ };
1271
+ const getConfigurations = async ({ componentId, branchId = "default" }, signal) => {
1272
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs", { path: {
1273
+ componentId,
1274
+ branchId: String(branchId)
1275
+ } }, { signal });
1276
+ return data;
1277
+ };
1278
+ const searchComponentConfigurations = async ({ branchId = "default", include, ...query } = {}, signal) => {
1279
+ const { data } = await client.get("/v2/storage/branch/{branchId}/search/component-configurations", {
1280
+ path: { branchId: String(branchId) },
1281
+ query: {
1282
+ ...query,
1283
+ ...include?.length && { include: include.join(",") }
1284
+ }
1285
+ }, { signal });
1286
+ return data;
1287
+ };
1288
+ return {
1289
+ createConfiguration,
1290
+ updateConfiguration,
1291
+ updateConfigurationState,
1292
+ getConfiguration,
1293
+ getConfigurationDiff,
1294
+ rebaseConfiguration,
1295
+ rebaseConfigurationToDeleted,
1296
+ deleteConfiguration,
1297
+ deleteConfigurations,
1298
+ purgeConfiguration,
1299
+ purgeConfigurations,
1300
+ getConfigurations,
1301
+ restoreConfiguration,
1302
+ resetConfigurationToDefault,
1303
+ searchComponentConfigurations
1304
+ };
1305
+ };
1306
+ //#endregion
1307
+ //#region src/clients/storage/configurationVersions/configurationVersions.ts
1308
+ const createConfigurationVersions = (client) => {
1309
+ const getConfigurationVersions = async ({ branchId, componentId, configurationId }, signal) => {
1310
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/versions", { path: {
1311
+ branchId: String(branchId),
1312
+ componentId,
1313
+ configurationId
1314
+ } }, { signal });
1315
+ return data;
1316
+ };
1317
+ const getConfigurationVersion = async ({ branchId, componentId, configurationId, versionId }, signal) => {
1318
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/versions/{versionId}", { path: {
1319
+ branchId: String(branchId),
1320
+ componentId,
1321
+ configurationId,
1322
+ versionId: String(versionId)
1323
+ } }, { signal });
1324
+ return data;
1325
+ };
1326
+ /**
1327
+ * Roll a configuration back to one of its versions.
1328
+ *
1329
+ * A rollback is itself a new version, not a rewind of the history, and the endpoint answers with
1330
+ * only that number — no configuration body. Re-read the configuration to observe the result.
1331
+ */
1332
+ const rollbackConfigurationToVersion = async ({ branchId = "default", componentId, configurationId, versionId }) => {
1333
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/versions/{versionId}/rollback", {
1334
+ path: {
1335
+ branchId: String(branchId),
1336
+ componentId,
1337
+ configurationId,
1338
+ versionId: String(versionId)
1339
+ },
1340
+ body: {}
1341
+ });
1342
+ return data;
1343
+ };
1344
+ /**
1345
+ * Server-side copy of a configuration from one of its versions. Preserves the
1346
+ * full configuration including rows — unlike a read-then-create, which would
1347
+ * only carry the top-level config body.
1348
+ *
1349
+ * The endpoint answers with only the new configuration's id; read it back for the body.
1350
+ */
1351
+ const copyConfigurationFromVersion = async ({ branchId = "default", componentId, configurationId, versionId, ...body }) => {
1352
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/versions/{versionId}/create", {
1353
+ path: {
1354
+ branchId: String(branchId),
1355
+ componentId,
1356
+ configurationId,
1357
+ versionId: String(versionId)
1358
+ },
1359
+ body
1360
+ });
1361
+ return data;
1362
+ };
1363
+ const getConfigurationRowVersions = async ({ branchId, componentId, configurationId, rowId }, signal) => {
1364
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}/versions", { path: {
1365
+ branchId: String(branchId),
1366
+ componentId,
1367
+ configurationId,
1368
+ rowId
1369
+ } }, { signal });
1370
+ return data;
1371
+ };
1372
+ const getConfigurationRowVersion = async ({ branchId, componentId, configurationId, rowId, versionId }, signal) => {
1373
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}/versions/{versionId}", { path: {
1374
+ branchId: String(branchId),
1375
+ componentId,
1376
+ configurationId,
1377
+ rowId,
1378
+ versionId: String(versionId)
1379
+ } }, { signal });
1380
+ return data;
1381
+ };
1382
+ /** Roll a configuration row back to one of its versions. */
1383
+ const rollbackConfigurationRowToVersion = async ({ branchId = "default", componentId, configurationId, rowId, versionId }) => {
1384
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}/versions/{versionId}/rollback", {
1385
+ path: {
1386
+ branchId: String(branchId),
1387
+ componentId,
1388
+ configurationId,
1389
+ rowId,
1390
+ versionId: String(versionId)
1391
+ },
1392
+ body: {}
1393
+ });
1394
+ return data;
1395
+ };
1396
+ /**
1397
+ * Server-side copy of a row from one of its versions into the same configuration.
1398
+ * The endpoint takes no body, so the copy's name is the backend's to choose — a
1399
+ * caller that wants a specific one follows up with a row update.
1400
+ */
1401
+ const copyConfigurationRowFromVersion = async ({ branchId = "default", componentId, configurationId, rowId, versionId }) => {
1402
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/rows/{rowId}/versions/{versionId}/create", {
1403
+ path: {
1404
+ branchId: String(branchId),
1405
+ componentId,
1406
+ configurationId,
1407
+ rowId,
1408
+ versionId: String(versionId)
1409
+ },
1410
+ body: {}
1411
+ });
1412
+ return data;
1413
+ };
1414
+ return {
1415
+ getConfigurationVersions,
1416
+ getConfigurationVersion,
1417
+ rollbackConfigurationToVersion,
1418
+ copyConfigurationFromVersion,
1419
+ getConfigurationRowVersions,
1420
+ getConfigurationRowVersion,
1421
+ rollbackConfigurationRowToVersion,
1422
+ copyConfigurationRowFromVersion
1423
+ };
1424
+ };
1425
+ //#endregion
1426
+ //#region src/clients/storage/configurationWorkspaces/configurationWorkspaces.ts
1427
+ const createConfigurationWorkspaces = (client) => {
1428
+ /**
1429
+ * @link https://api.keboola.com/?service=storage#storage/tag/component-configurations/GET/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/workspaces
1430
+ */
1431
+ const getConfigurationWorkspaces = async ({ componentId, branchId, configurationId }) => {
1432
+ const { data } = await client.get("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/workspaces", { path: {
1433
+ componentId,
1434
+ branchId,
1435
+ configurationId
1436
+ } });
1437
+ return data;
1438
+ };
1439
+ const createConfigurationWorkspace = async ({ componentId, branchId, configurationId, ...body }) => {
1440
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/workspaces", {
1441
+ path: {
1442
+ componentId,
1443
+ branchId,
1444
+ configurationId
1445
+ },
1446
+ body
1447
+ });
1448
+ return data;
1449
+ };
1450
+ const createConfigurationWorkspaceJob = async ({ componentId, branchId, configurationId, ...body }) => {
1451
+ const { data } = await client.post("/v2/storage/branch/{branchId}/components/{componentId}/configs/{configurationId}/workspaces", {
1452
+ path: {
1453
+ componentId,
1454
+ branchId,
1455
+ configurationId
1456
+ },
1457
+ body,
1458
+ query: { async: true }
1459
+ });
1460
+ return data;
1461
+ };
1462
+ return {
1463
+ createConfigurationWorkspace,
1464
+ createConfigurationWorkspaceJob,
1465
+ getConfigurationWorkspaces
1466
+ };
1467
+ };
1468
+ //#endregion
1469
+ //#region src/clients/storage/events/events.ts
1470
+ /**
1471
+ * Every endpoint here is the branched variant, and `branchId` falls back to `default`.
1472
+ *
1473
+ * - The unbranched twins (`/v2/storage/events`, `/v2/storage/events/{eventId}`) answer the same
1474
+ * payloads; addressing one branch is the narrower request and the one every caller wants.
1475
+ * - Each response is asserted in: the spec declares `content?: never` on all four event operations,
1476
+ * and types `params`, `results` and `performance` as bare `Record<string, never>` where it does not.
1477
+ */
1478
+ const createEvents = (client) => {
1479
+ /**
1480
+ * Event feed of a branch.
1481
+ *
1482
+ * @link https://api.keboola.com/?service=storage#storage/tag/events/GET/v2/storage/branch/{branchId}/events
1483
+ */
1484
+ const getEvents = async ({ branchId, ...query }, signal) => {
1485
+ const { data } = await client.get("/v2/storage/branch/{branchId}/events", {
1486
+ path: { branchId },
1487
+ query
1488
+ }, { signal });
1489
+ return data;
1490
+ };
1491
+ /**
1492
+ * A single event. Ids are `uuid`s — the `id` a create answers with does not resolve here.
1493
+ *
1494
+ * @link https://api.keboola.com/?service=storage#storage/tag/events/GET/v2/storage/branch/{branchId}/events/{eventId}
1495
+ */
1496
+ const getEvent = async ({ branchId, eventId }, signal) => {
1497
+ const { data } = await client.get("/v2/storage/branch/{branchId}/events/{eventId}", { path: {
1498
+ branchId,
1499
+ eventId
1500
+ } }, { signal });
1501
+ return data;
1502
+ };
1503
+ /**
1504
+ * Event feed of a table in the given branch. A dev branch only contains the tables created or
1505
+ * pulled into it, so a production table's events must be read with the default branch id.
1506
+ *
1507
+ * @link https://api.keboola.com/?service=storage#storage/tag/events/GET/v2/storage/branch/{branchId}/tables/{tableId}/events
1508
+ */
1509
+ const getTableEvents = async ({ branchId, tableId, ...query }, signal) => {
1510
+ const { data } = await client.get("/v2/storage/branch/{branchId}/tables/{tableId}/events", {
1511
+ path: {
1512
+ branchId,
1513
+ tableId
1514
+ },
1515
+ query
1516
+ }, { signal });
1517
+ return data;
1518
+ };
1519
+ /**
1520
+ * Event feed of a bucket in the given branch. Same payload as the table feed.
1521
+ *
1522
+ * @link https://api.keboola.com/?service=storage#storage/tag/events/GET/v2/storage/branch/{branchId}/buckets/{bucketId}/events
1523
+ */
1524
+ const getBucketEvents = async ({ branchId, bucketId, ...query }, signal) => {
1525
+ const { data } = await client.get("/v2/storage/branch/{branchId}/buckets/{bucketId}/events", {
1526
+ path: {
1527
+ branchId,
1528
+ bucketId
1529
+ },
1530
+ query
1531
+ }, { signal });
1532
+ return data;
1533
+ };
1534
+ /**
1535
+ * Writes an event into a branch's feed.
1536
+ *
1537
+ * @link https://api.keboola.com/?service=storage#storage/tag/events/POST/v2/storage/branch/{branchId}/events
1538
+ */
1539
+ const createEvent = async ({ branchId = "default", ...body }, signal) => {
1540
+ const { data } = await client.post("/v2/storage/branch/{branchId}/events", {
1541
+ path: { branchId },
1542
+ body
1543
+ }, { signal });
1544
+ return data;
1545
+ };
1546
+ return {
1547
+ getEvents,
1548
+ getEvent,
1549
+ getTableEvents,
1550
+ getBucketEvents,
1551
+ createEvent
1552
+ };
1553
+ };
1554
+ //#endregion
1555
+ //#region src/clients/storage/files/files.ts
1556
+ /**
1557
+ * Two spec defects account for every assertion below:
1558
+ *
1559
+ * - Only the delete declares a response body; the other six answer a contentless `default`, so each
1560
+ * return is asserted in from `./types`.
1561
+ * - `fileId` is a `number` on the delete and the content read, a `string` on the other four — one id,
1562
+ * typed both ways, so the string arms take `String(fileId)`.
1563
+ */
1564
+ const createFiles = (openApiClient) => {
1565
+ const getFile = async (fileId, signal) => {
1566
+ const { data } = await openApiClient.get("/v2/storage/files/{fileId}", { path: { fileId: String(fileId) } }, { signal });
1567
+ return data;
1568
+ };
1569
+ const getFiles = async (query, signal) => {
1570
+ const { data } = await openApiClient.get("/v2/storage/files", { query }, {
1571
+ signal,
1572
+ queryArrayFormat: "brackets"
1573
+ });
1574
+ return data;
1575
+ };
1576
+ const deleteFile = async (fileId) => {
1577
+ await openApiClient.delete("/v2/storage/files/{fileId}", { path: { fileId } });
1578
+ };
1579
+ const addFileTag = async (fileId, tag) => {
1580
+ await openApiClient.post("/v2/storage/files/{fileId}/tags", {
1581
+ path: { fileId: String(fileId) },
1582
+ body: { tag }
1583
+ });
1584
+ };
1585
+ const getFileContent = async (fileId, signal) => {
1586
+ const { data } = await openApiClient.get("/v2/storage/files/{fileId}/content", { path: { fileId } }, { signal });
1587
+ const content = data;
1588
+ return typeof content === "string" ? content : JSON.stringify(content, null, 2);
1589
+ };
1590
+ const deleteFileTag = async (fileId, tagName) => {
1591
+ await openApiClient.delete("/v2/storage/files/{fileId}/tags/{tagName}", { path: {
1592
+ fileId: String(fileId),
1593
+ tagName
1594
+ } });
1595
+ };
1596
+ const prepareFile = async (body, signal) => {
1597
+ const { data } = await openApiClient.post("/v2/storage/files/prepare", { body }, { signal });
1598
+ return data;
1599
+ };
1600
+ return {
1601
+ getFile,
1602
+ getFileContent,
1603
+ getFiles,
1604
+ deleteFile,
1605
+ addFileTag,
1606
+ deleteFileTag,
1607
+ prepareFile
1608
+ };
1609
+ };
1610
+ //#endregion
1611
+ //#region src/clients/storage/jobs/jobs.ts
1612
+ /**
1613
+ * Both returns are asserted in, and `Job<T>` is the contract to trust.
1614
+ *
1615
+ * - The spec's `JobResponse` is a flat shape with `status: string`; `Job<T>` is a discriminated union
1616
+ * over `status` whose `results` is typed per operation.
1617
+ * - The detail operation declares a contentless `default` response, so its `data` is not a job at all
1618
+ * as far as the schema is concerned.
1619
+ */
1620
+ const createJobs = (openApiClient) => {
1621
+ const getJob = async (jobId, signal) => {
1622
+ const { data } = await openApiClient.get("/v2/storage/jobs/{jobId}", { path: { jobId: String(jobId) } }, { signal });
1623
+ return data;
1624
+ };
1625
+ const getJobs = async (query, signal) => {
1626
+ const { data } = await openApiClient.get("/v2/storage/jobs", { query }, {
1627
+ signal,
1628
+ queryArrayFormat: "brackets"
1629
+ });
1630
+ return data;
1631
+ };
1632
+ return {
1633
+ getJob,
1634
+ getJobs
1635
+ };
1636
+ };
1637
+ //#endregion
1638
+ //#region src/clients/storage/poller.ts
1639
+ const DEFAULT_POLL_INTERVAL = 2e3;
1640
+ const createJobPoller = ({ getJob }) => ({ id, operationName }, { interval, maxAttempts, timeout, signal } = {}) => poller({
1641
+ pollKey: ["storage.job", {
1642
+ jobId: id,
1643
+ operation: operationName
1644
+ }],
1645
+ pollFn: ({ pollKey: [, params], signal: pollSignal }) => getJob(params.jobId, pollSignal),
1646
+ until: ({ data }) => jobStatus.storage.isTerminal(data.status),
1647
+ backoff: {
1648
+ type: "constant",
1649
+ interval: interval ?? DEFAULT_POLL_INTERVAL
1650
+ },
1651
+ maxAttempts,
1652
+ timeout,
1653
+ signal
1654
+ });
1655
+ //#endregion
1656
+ //#region src/clients/storage/refreshTokenMiddleware.ts
1657
+ const isTokenRefreshEndpoint = (request) => {
1658
+ const url = new URL(request.url);
1659
+ return request.method === "POST" && /\/tokens\/[^/]+\/refresh$/.test(url.pathname);
1660
+ };
1661
+ const tryParseNewToken = (data) => {
1662
+ if (data === null || typeof data !== "object") return null;
1663
+ const token = data.token;
1664
+ return typeof token === "string" ? token : null;
1665
+ };
1666
+ const createRefreshTokenMiddlware = ({ accessToken, onRefresh }) => {
1667
+ let current = accessToken;
1668
+ return (next) => async (request) => {
1669
+ request.request.headers.set(KeboolaHttpHeader.STORAGE_API_TOKEN, current);
1670
+ if (!isTokenRefreshEndpoint(request.request)) return next(request);
1671
+ const response = await next(request);
1672
+ const newToken = tryParseNewToken(response.data);
1673
+ if (newToken === null) return response;
1674
+ current = newToken;
1675
+ onRefresh?.(current);
1676
+ return response;
1677
+ };
1678
+ };
1679
+ //#endregion
1680
+ //#region src/clients/storage/search/search.ts
1681
+ /**
1682
+ * Both responses are asserted in, because the spec stubs them:
1683
+ *
1684
+ * - `GET /v2/storage/global-search` (`SearchAction`) declares its 200 as `Record<string, never>` →
1685
+ * really `{ all, items, byType, byProject }`
1686
+ * - `GET /v2/storage/search/tables` (`SearchTablesAction`) declares a contentless 200 → really
1687
+ * `Table[]`
1688
+ *
1689
+ * Both query casts are type-only, so each query object reaches the wire exactly as the caller wrote
1690
+ * it. That matters for `global-search`: the spec names its repeatable filters `types[]` / `projectIds[]`
1691
+ * / `branchTypes[]` / `branchIds[]`, but this endpoint has always been called with the bare names,
1692
+ * which `qs` serializes as `types[0]=bucket&types[1]=table` — also an array to the backend. Renaming
1693
+ * the fields to satisfy the document would change what Storage receives, and no test would catch it.
1694
+ */
1695
+ const createSearch = (client) => {
1696
+ /**
1697
+ * Project- and organization-wide search across buckets, tables, configurations, flows, ….
1698
+ *
1699
+ * @link https://api.keboola.com/?service=storage#storage/tag/global-search/GET/v2/storage/global-search
1700
+ */
1701
+ const globalSearch = async (query, signal) => {
1702
+ const { data } = await client.get("/v2/storage/global-search", { query }, { signal });
1703
+ return data;
1704
+ };
1705
+ /**
1706
+ * Finds tables by a metadata key, value or provider, across the whole project.
1707
+ *
1708
+ * @link https://api.keboola.com/?service=storage#storage/tag/search/GET/v2/storage/search/tables
1709
+ */
1710
+ const searchTables = async (query, signal) => {
1711
+ const { data } = await client.get("/v2/storage/search/tables", { query }, {
1712
+ signal,
1713
+ queryArrayFormat: "comma"
1714
+ });
1715
+ return data;
1716
+ };
1717
+ return {
1718
+ globalSearch,
1719
+ searchTables
1720
+ };
1721
+ };
1722
+ //#endregion
1723
+ //#region src/clients/storage/snapshots/snapshots.ts
1724
+ const createSnapshots = (client) => {
1725
+ /**
1726
+ * Creates a snapshot of a table in the given branch. Async — returns a job.
1727
+ *
1728
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/POST/v2/storage/branch/{branchId}/tables/{id}/snapshots
1729
+ */
1730
+ const createSnapshotAsync = async ({ branchId, tableId, ...body }, signal) => {
1731
+ const { data } = await client.post("/v2/storage/branch/{branchId}/tables/{id}/snapshots", {
1732
+ path: {
1733
+ branchId,
1734
+ id: tableId
1735
+ },
1736
+ body
1737
+ }, { signal });
1738
+ return data;
1739
+ };
1740
+ /**
1741
+ * Reads a single snapshot. Not branch-scoped — a snapshot id is unique across branches.
1742
+ *
1743
+ * The swagger stubs the operation (a single `default` response with no body), so the shape is
1744
+ * asserted in; it is the same `Snapshot` the table listing returns.
1745
+ *
1746
+ * @link https://api.keboola.com/?service=storage#storage/GET/v2/storage/snapshots/{snapshotId}
1747
+ */
1748
+ const getSnapshot = async (snapshotId, signal) => {
1749
+ const { data } = await client.get("/v2/storage/snapshots/{snapshotId}", { path: { snapshotId } }, { signal });
1750
+ return data;
1751
+ };
1752
+ /**
1753
+ * Deletes a snapshot, returning the storage job that performs it (`null` when the backend answers
1754
+ * with no content). The endpoint is not branch-scoped — a snapshot id is unique across branches, so
1755
+ * there is no `/branch/{branchId}/snapshots/{snapshotId}` variant.
1756
+ *
1757
+ * The swagger documents a single bodyless `default` response, so the job is asserted in.
1758
+ *
1759
+ * @link https://api.keboola.com/?service=storage#storage/DELETE/v2/storage/snapshots/{snapshotId}
1760
+ */
1761
+ const deleteSnapshotAsync = async (snapshotId, signal) => {
1762
+ const { data } = await client.delete("/v2/storage/snapshots/{snapshotId}", { path: { snapshotId } }, { signal });
1763
+ return data;
1764
+ };
1765
+ /**
1766
+ * Lists the snapshots of a table in the given branch.
1767
+ *
1768
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/GET/v2/storage/branch/{branchId}/tables/{id}/snapshots
1769
+ */
1770
+ const getTableSnapshots = async ({ branchId, tableId, ...query }, signal) => {
1771
+ const { data } = await client.get("/v2/storage/branch/{branchId}/tables/{id}/snapshots", {
1772
+ path: {
1773
+ branchId,
1774
+ id: tableId
1775
+ },
1776
+ query
1777
+ }, { signal });
1778
+ return data;
1779
+ };
1780
+ return {
1781
+ createSnapshotAsync,
1782
+ deleteSnapshotAsync,
1783
+ getSnapshot,
1784
+ getTableSnapshots
1785
+ };
1786
+ };
1787
+ //#endregion
1788
+ //#region src/clients/storage/stats/stats.ts
1789
+ /**
1790
+ * `GET /v2/storage/stats` (`StatsListAction`) declares a single contentless `default` response, so the
1791
+ * generated return type is the response envelope (`{ headers, content?: never }`) rather than a
1792
+ * payload — hence the assertion to the hand-authored `RunIdStats`. The `runId` query is spec-derived.
1793
+ */
1794
+ const createStats = (client) => {
1795
+ /**
1796
+ * Returns import/export table stats for a job run, identified by its runId.
1797
+ *
1798
+ * @link https://api.keboola.com/?service=storage#storage/GET/v2/storage/stats
1799
+ */
1800
+ const getRunIdStats = async (runId, signal) => {
1801
+ const { data } = await client.get("/v2/storage/stats", { query: { runId } }, { signal });
1802
+ return data;
1803
+ };
1804
+ return { getRunIdStats };
1805
+ };
1806
+ //#endregion
1807
+ //#region src/clients/storage/tables/tables.ts
1808
+ const createTables = (openApiClient, client) => {
1809
+ /**
1810
+ * Returns every table in the given branch. Filter client-side by
1811
+ * `table.bucket?.id` (requires `include: ['buckets']`) or by the
1812
+ * `{bucketId}.` prefix in `table.id` (IDs use `{bucketId}.{tableName}`,
1813
+ * e.g. `in.c-main.users`).
1814
+ *
1815
+ * @link https://api.keboola.com/?service=storage#storage/GET/v2/storage/branch/{branchId}/tables
1816
+ */
1817
+ const getTables = async ({ branchId, include = [], ...query }, signal) => {
1818
+ const { data } = await openApiClient.get("/v2/storage/branch/{branchId}/tables", {
1819
+ path: { branchId },
1820
+ query: {
1821
+ include,
1822
+ ...query
1823
+ }
1824
+ }, {
1825
+ signal,
1826
+ queryArrayFormat: "comma"
1827
+ });
1828
+ return data;
1829
+ };
1830
+ /**
1831
+ * Returns a table from the given branch. A dev branch only contains the tables created or pulled
1832
+ * into it, so a production table must be read with the default branch id.
1833
+ *
1834
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/GET/v2/storage/branch/{branchId}/tables/{id}
1835
+ */
1836
+ const getTable = async ({ branchId, id }, signal) => {
1837
+ const { data } = await openApiClient.get("/v2/storage/branch/{branchId}/tables/{id}", { path: {
1838
+ branchId,
1839
+ id
1840
+ } }, { signal });
1841
+ return data;
1842
+ };
1843
+ /**
1844
+ * Deletes a table (synchronous). `force` also drops the aliases and links pointing at it, which
1845
+ * the API otherwise refuses.
1846
+ *
1847
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/DELETE/v2/storage/branch/{branchId}/tables/{id}
1848
+ */
1849
+ const deleteTable = async ({ branchId, id, ...query }, signal) => {
1850
+ await openApiClient.delete("/v2/storage/branch/{branchId}/tables/{id}", {
1851
+ path: {
1852
+ branchId,
1853
+ id
1854
+ },
1855
+ query
1856
+ }, { signal });
1857
+ };
1858
+ const deleteTables = async ({ branchId, ids, force }) => {
1859
+ await concurrent({
1860
+ items: ids,
1861
+ process: (id) => deleteTable({
1862
+ branchId,
1863
+ id,
1864
+ force
1865
+ })
1866
+ });
1867
+ };
1868
+ const deleteTableRows = async ({ branchId, id, ...query }, signal) => {
1869
+ const { data } = await openApiClient.delete("/v2/storage/branch/{branchId}/tables/{id}/rows", {
1870
+ path: {
1871
+ branchId,
1872
+ id
1873
+ },
1874
+ query
1875
+ }, { signal });
1876
+ return data;
1877
+ };
1878
+ /**
1879
+ * Returns the first rows of a table in the given branch.
1880
+ *
1881
+ * The swagger declares `query?: never` here, so it cannot express `limit` / `whereFilters` /
1882
+ * `orderBy` / `fulltextSearch`, all of which the endpoint accepts — hence the hand-authored
1883
+ * `GetDataPreviewQuery` and the asserted query.
1884
+ *
1885
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/GET/v2/storage/branch/{branchId}/tables/{tableId}/data-preview
1886
+ */
1887
+ const getDataPreview = async ({ branchId, tableId, ...query }, signal) => {
1888
+ const { data } = await openApiClient.get("/v2/storage/branch/{branchId}/tables/{tableId}/data-preview", {
1889
+ path: {
1890
+ branchId,
1891
+ tableId
1892
+ },
1893
+ query: {
1894
+ format: "json",
1895
+ ...query
1896
+ }
1897
+ }, { signal });
1898
+ return data;
1899
+ };
1900
+ /**
1901
+ * Exports a table to a file. Async — returns a job.
1902
+ *
1903
+ * Unbranched, though the document also declares
1904
+ * `/v2/storage/branch/{branchId}/tables/{tableId}/export-async`: export was outside the scope of
1905
+ * the table migration (UT-4785), so switching it would change behaviour for a flow that migration
1906
+ * did not touch. It is the one remaining branch-capable method here that does not take a
1907
+ * `branchId`, and moving it is a clean follow-up.
1908
+ *
1909
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/POST/v2/storage/tables/{tableId}/export-async
1910
+ */
1911
+ const exportAsync = async ({ tableId, ...body }, signal) => {
1912
+ const { data } = await openApiClient.post("/v2/storage/tables/{tableId}/export-async", {
1913
+ path: { tableId },
1914
+ body
1915
+ }, { signal });
1916
+ return data;
1917
+ };
1918
+ const createTableAsync = async ({ branchId, id, ...body }, signal) => {
1919
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/buckets/{id}/tables-async", {
1920
+ path: {
1921
+ branchId,
1922
+ id
1923
+ },
1924
+ body
1925
+ }, { signal });
1926
+ return data;
1927
+ };
1928
+ /**
1929
+ * Creates a typed table from an explicit column definition (no data) in the given bucket.
1930
+ * The endpoint is async: it returns a `tableDefinitionCreate` storage job the caller can poll.
1931
+ *
1932
+ * @link https://api.keboola.com/?service=storage#storage/tag/buckets/POST/v2/storage/branch/{branchId}/buckets/{bucketId}/tables-definition
1933
+ */
1934
+ const createTableDefinitionAsync = async ({ branchId, bucketId, ...body }, signal) => {
1935
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/buckets/{bucketId}/tables-definition", {
1936
+ path: {
1937
+ branchId,
1938
+ bucketId
1939
+ },
1940
+ body
1941
+ }, { signal });
1942
+ return data;
1943
+ };
1944
+ const importAsync = async ({ branchId, id, ...body }, signal) => {
1945
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/tables/{id}/import-async", {
1946
+ path: {
1947
+ branchId,
1948
+ id
1949
+ },
1950
+ body
1951
+ }, { signal });
1952
+ return data;
1953
+ };
1954
+ /**
1955
+ * Updates a table's definition in place — `displayName`, `description`,
1956
+ * `isDescriptionSystemManaged`, and per-column
1957
+ * `length`/`nullable`/`default`/`description`. The endpoint is async: it
1958
+ * returns a `tableDefinitionUpdate` storage job that the caller can poll.
1959
+ *
1960
+ * Send only the fields being changed; at least one is required. Description
1961
+ * patches apply to non-typed tables too, so a description-only edit needs
1962
+ * neither `displayName` nor `columns`.
1963
+ *
1964
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/PUT/v2/storage/branch/{branchId}/tables/{tableId}/definition
1965
+ */
1966
+ const updateTableDefinition = async ({ branchId, tableId, ...body }, signal) => {
1967
+ const { data } = await openApiClient.put("/v2/storage/branch/{branchId}/tables/{tableId}/definition", {
1968
+ path: {
1969
+ branchId,
1970
+ tableId
1971
+ },
1972
+ body
1973
+ }, { signal });
1974
+ return data;
1975
+ };
1976
+ /**
1977
+ * Updates a table's display name (synchronous). For typed-table column/definition changes use
1978
+ * `updateTableDefinition` instead.
1979
+ *
1980
+ * On the generic client and unbranched, unlike its siblings — but only because of where the
1981
+ * endpoint lives, not because of what it supports. It is still `Storage_TablesController::putAction`
1982
+ * in connection's legacy Zend app, and the Storage document is generated from the `#[OA\...]`
1983
+ * attributes on the migrated Symfony controllers, so no annotation fix closes this gap; the
1984
+ * controller has to move first. The action does take a `DevBranch`, and `put` is in the
1985
+ * branch-implemented route list, so `/branch/{branchId}/tables/{id}` works — there is simply no
1986
+ * `paths` entry to derive it from, and the branch prefix is left to the caller's middleware.
1987
+ *
1988
+ * The synchronous form this calls is deprecated backend-side (`DEPRECATION_SYNC_UPDATE_TABLE` is
1989
+ * logged per request); `?async=true` returns a `tableUpdate` job instead. Switching means polling,
1990
+ * so it belongs with the caller that renames tables, not here.
1991
+ *
1992
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables
1993
+ */
1994
+ const updateTable = async ({ tableId, ...body }, signal) => {
1995
+ const { data } = await client.put("/v2/storage/tables/{id}", {
1996
+ path: { id: tableId },
1997
+ body
1998
+ }, { signal });
1999
+ return data;
2000
+ };
2001
+ /**
2002
+ * Pulls a table from the default branch into the given dev branch.
2003
+ *
2004
+ * The path is branch-scoped: the unbranched `/v2/storage/tables/{id}/pull` this used to call is
2005
+ * absent from the Storage document and 404s for every table (the live nightly caught it), because
2006
+ * nothing in it says which branch to pull into.
2007
+ *
2008
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables
2009
+ */
2010
+ const pullTableAsync = async ({ branchId, id }, signal) => {
2011
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/tables/{id}/pull", { path: {
2012
+ branchId,
2013
+ id
2014
+ } }, { signal });
2015
+ return data;
2016
+ };
2017
+ /**
2018
+ * Creates an alias table in the given bucket. Usually returns the created alias `Table`
2019
+ * synchronously; for BigQuery VIEW-persisted aliases the API instead returns an `aliasCreate`
2020
+ * storage job, so the response is typed as a union — narrow on `operationName` before use.
2021
+ *
2022
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables
2023
+ */
2024
+ const createAliasTable = async ({ bucketId, ...body }, signal) => {
2025
+ const { data } = await client.post("/v2/storage/buckets/{bucketId}/table-aliases", {
2026
+ path: { bucketId },
2027
+ body
2028
+ }, { signal });
2029
+ return data;
2030
+ };
2031
+ /**
2032
+ * Sets (replaces) the filter of an alias table (synchronous).
2033
+ *
2034
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables
2035
+ */
2036
+ const setAliasTableFilter = async ({ tableId, ...body }, signal) => {
2037
+ const { data } = await openApiClient.post("/v2/storage/tables/{tableId}/alias-filter", {
2038
+ path: { tableId },
2039
+ body
2040
+ }, { signal });
2041
+ return data;
2042
+ };
2043
+ /**
2044
+ * Removes the filter of an alias table (synchronous).
2045
+ *
2046
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables
2047
+ */
2048
+ const removeAliasTableFilter = async (tableId, signal) => {
2049
+ await openApiClient.delete("/v2/storage/tables/{tableId}/alias-filter", { path: { tableId } }, { signal });
2050
+ };
2051
+ /**
2052
+ * Adds or updates metadata on a table in the given branch, and on its columns when the payload
2053
+ * names any — which is why the response carries `columnsMetadata` alongside `metadata`.
2054
+ *
2055
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/POST/v2/storage/branch/{branchId}/tables/{id}/metadata
2056
+ */
2057
+ const saveTableMetadata = async ({ branchId, id, ...body }, signal) => {
2058
+ const { data } = await openApiClient.post("/v2/storage/branch/{branchId}/tables/{id}/metadata", {
2059
+ path: {
2060
+ branchId,
2061
+ id
2062
+ },
2063
+ body
2064
+ }, { signal });
2065
+ return data;
2066
+ };
2067
+ /**
2068
+ * Deletes a single metadata entry from a table in the given branch.
2069
+ *
2070
+ * @link https://api.keboola.com/?service=storage#storage/tag/tables/DELETE/v2/storage/branch/{branchId}/tables/{id}/metadata/{metadataId}
2071
+ */
2072
+ const deleteTableMetadata = async ({ branchId, id, metadataId }, signal) => {
2073
+ await openApiClient.delete("/v2/storage/branch/{branchId}/tables/{id}/metadata/{metadataId}", { path: {
2074
+ branchId,
2075
+ id,
2076
+ metadataId
2077
+ } }, { signal });
2078
+ };
2079
+ return {
2080
+ getTables,
2081
+ getTable,
2082
+ getDataPreview,
2083
+ deleteTable,
2084
+ deleteTables,
2085
+ deleteTableRows,
2086
+ exportAsync,
2087
+ createTableAsync,
2088
+ createTableDefinitionAsync,
2089
+ importAsync,
2090
+ updateTableDefinition,
2091
+ updateTable,
2092
+ pullTableAsync,
2093
+ createAliasTable,
2094
+ setAliasTableFilter,
2095
+ removeAliasTableFilter,
2096
+ saveTableMetadata,
2097
+ deleteTableMetadata
2098
+ };
2099
+ };
2100
+ //#endregion
2101
+ //#region src/clients/storage/tokens/tokens.ts
2102
+ /**
2103
+ * The `as` casts below work around a broken generated schema, not our own types:
2104
+ *
2105
+ * - id path params typed `number`; every id the API returns is a `string`
2106
+ * - `UpdateTokenRequest` / `ShareTokenRequest` modelled as empty objects
2107
+ * - update `200` declares no body, but returns the updated token
2108
+ * - create body marks fields required that the API defaults
2109
+ *
2110
+ * `./types` holds the real contracts. Drop each cast as the backend fixes the schema.
2111
+ */
2112
+ const createTokens = (client) => {
2113
+ const verify = async (signal) => {
2114
+ const { data } = await client.get("/v2/storage/tokens/verify", {}, { signal });
2115
+ return data;
2116
+ };
2117
+ const refresh = async (id, signal) => {
2118
+ const { data } = await client.post("/v2/storage/tokens/{id}/refresh", { path: { id } }, { signal });
2119
+ return data;
2120
+ };
2121
+ /**
2122
+ * Lists storage tokens accessible by the current token.
2123
+ *
2124
+ * @link https://api.keboola.com/?service=storage#storage/tag/tokens/GET/v2/storage/tokens
2125
+ */
2126
+ const getTokens = async (signal) => {
2127
+ const { data } = await client.get("/v2/storage/tokens", {}, { signal });
2128
+ return data;
2129
+ };
2130
+ /**
2131
+ * Creates a new storage token. The response includes the freshly issued `token` secret.
2132
+ *
2133
+ * @link https://api.keboola.com/?service=storage#storage/tag/tokens/POST/v2/storage/tokens
2134
+ */
2135
+ const createToken = async (body, signal) => {
2136
+ const { data } = await client.post("/v2/storage/tokens", { body }, { signal });
2137
+ return data;
2138
+ };
2139
+ /**
2140
+ * Updates an existing storage token (description, permissions, expiration, …).
2141
+ *
2142
+ * @link https://api.keboola.com/?service=storage#storage/tag/tokens/PUT/v2/storage/tokens/{id}
2143
+ */
2144
+ const updateToken = async ({ id, ...body }, signal) => {
2145
+ const { data } = await client.put("/v2/storage/tokens/{id}", {
2146
+ path: { id },
2147
+ body
2148
+ }, { signal });
2149
+ return data;
2150
+ };
2151
+ /**
2152
+ * Deletes a storage token.
2153
+ *
2154
+ * @link https://api.keboola.com/?service=storage#storage/tag/tokens/DELETE/v2/storage/tokens/{id}
2155
+ */
2156
+ const deleteToken = async (id, signal) => {
2157
+ await client.delete("/v2/storage/tokens/{id}", { path: { id } }, { signal });
2158
+ };
2159
+ /**
2160
+ * Shares a storage token with another user by email.
2161
+ *
2162
+ * @link https://api.keboola.com/?service=storage#storage/tag/tokens/POST/v2/storage/tokens/{id}/share
2163
+ */
2164
+ const shareToken = async ({ id, ...body }, signal) => {
2165
+ await client.post("/v2/storage/tokens/{id}/share", {
2166
+ path: { id },
2167
+ body
2168
+ }, { signal });
2169
+ };
2170
+ /**
2171
+ * Event feed of a single token — what that token did, not what happened to it.
2172
+ *
2173
+ * @link https://api.keboola.com/?service=storage#storage/tag/tokens/GET/v2/storage/tokens/{id}/events
2174
+ */
2175
+ const getTokenEvents = async ({ id, ...query }, signal) => {
2176
+ const { data } = await client.get("/v2/storage/tokens/{id}/events", {
2177
+ path: { id },
2178
+ query
2179
+ }, { signal });
2180
+ return data;
2181
+ };
2182
+ return {
2183
+ verify,
2184
+ refresh,
2185
+ getTokens,
2186
+ createToken,
2187
+ updateToken,
2188
+ deleteToken,
2189
+ shareToken,
2190
+ getTokenEvents
2191
+ };
2192
+ };
2193
+ //#endregion
2194
+ //#region src/clients/storage/triggers/triggers.ts
2195
+ const createTriggers = (client) => {
2196
+ /**
2197
+ * Lists triggers in the project, optionally filtered by component / configuration.
2198
+ *
2199
+ * @link https://api.keboola.com/?service=storage#storage/tag/triggers/GET/v2/storage/triggers
2200
+ */
2201
+ const getTriggers = async (query, signal) => {
2202
+ const { data } = await client.get("/v2/storage/triggers", { query }, { signal });
2203
+ return data;
2204
+ };
2205
+ /**
2206
+ * Creates a new trigger for a component configuration.
2207
+ *
2208
+ * @link https://api.keboola.com/?service=storage#storage/tag/triggers/POST/v2/storage/triggers
2209
+ */
2210
+ const createTrigger = async (body, signal) => {
2211
+ const { data } = await client.post("/v2/storage/triggers", { body }, { signal });
2212
+ return data;
2213
+ };
2214
+ /**
2215
+ * Updates an existing trigger, patching only the fields the input carries.
2216
+ *
2217
+ * @link https://api.keboola.com/?service=storage#storage/tag/triggers/PUT/v2/storage/triggers/{triggerId}
2218
+ */
2219
+ const updateTrigger = async ({ triggerId, ...body }, signal) => {
2220
+ const { data } = await client.put("/v2/storage/triggers/{triggerId}", {
2221
+ path: { triggerId },
2222
+ body
2223
+ }, { signal });
2224
+ return data;
2225
+ };
2226
+ /**
2227
+ * Deletes a trigger.
2228
+ *
2229
+ * @link https://api.keboola.com/?service=storage#storage/tag/triggers/DELETE/v2/storage/triggers/{triggerId}
2230
+ */
2231
+ const deleteTrigger = async (triggerId, signal) => {
2232
+ await client.delete("/v2/storage/triggers/{triggerId}", { path: { triggerId } }, { signal });
2233
+ };
2234
+ return {
2235
+ getTriggers,
2236
+ createTrigger,
2237
+ updateTrigger,
2238
+ deleteTrigger
2239
+ };
2240
+ };
2241
+ //#endregion
2242
+ //#region src/clients/storage/workspaces/workspaces.ts
2243
+ /**
2244
+ * Paths, queries and bodies come from the spec; only the returns are asserted in.
2245
+ *
2246
+ * - `WorkspaceDetailResponse` describes a narrower connection than callers get, so `Workspace` is
2247
+ * hand-authored (see `./types`) — that covers the list, detail and public-key returns.
2248
+ * - The password, SSO and delete operations answer a contentless `default`.
2249
+ * - `JobResponse` is a flat shape with `status: string`, while `Job<T>` is a discriminated union over
2250
+ * `status` carrying typed `results`.
2251
+ *
2252
+ * `workspaceId` is a `number` in every input; the operations whose spec segment is a `string` take
2253
+ * `String(workspaceId)` here rather than pushing the spec's inconsistency onto callers.
2254
+ */
2255
+ const createWorkspaces = (client) => {
2256
+ const getWorkspaces = async (path, signal) => {
2257
+ const { data } = await client.get("/v2/storage/branch/{branchId}/workspaces", { path }, { signal });
2258
+ return data;
2259
+ };
2260
+ const getWorkspace = async (path, signal) => {
2261
+ const { data } = await client.get("/v2/storage/branch/{branchId}/workspaces/{workspaceId}", { path }, { signal });
2262
+ return data;
2263
+ };
2264
+ const deleteWorkspace = async ({ branchId, workspaceId }) => {
2265
+ await client.delete("/v2/storage/branch/{branchId}/workspaces/{workspaceId}", { path: {
2266
+ branchId,
2267
+ workspaceId: String(workspaceId)
2268
+ } });
2269
+ };
2270
+ const deleteWorkspaces = async ({ workspaceIds, branchId }) => {
2271
+ await concurrent({
2272
+ items: workspaceIds,
2273
+ process: async (workspaceId) => deleteWorkspace({
2274
+ branchId,
2275
+ workspaceId
2276
+ }),
2277
+ concurrency: 5
2278
+ });
2279
+ };
2280
+ const deleteWorkspaceJob = async ({ branchId, workspaceId }) => {
2281
+ const { data } = await client.delete("/v2/storage/branch/{branchId}/workspaces/{workspaceId}", {
2282
+ path: {
2283
+ branchId,
2284
+ workspaceId: String(workspaceId)
2285
+ },
2286
+ query: { async: true }
2287
+ });
2288
+ return data;
2289
+ };
2290
+ const resetWorkspacePassword = async ({ branchId, workspaceId }) => {
2291
+ const { data } = await client.post("/v2/storage/branch/{branchId}/workspaces/{workspaceId}/password", { path: {
2292
+ branchId,
2293
+ workspaceId: String(workspaceId)
2294
+ } });
2295
+ return data;
2296
+ };
2297
+ const getWorkspaceSaml2Login = async (path, signal) => {
2298
+ const { data } = await client.get("/v2/storage/branch/{branchId}/workspaces/{workspaceId}/saml2-login", { path }, { signal });
2299
+ return data;
2300
+ };
2301
+ /**
2302
+ * Set the public key for the workspace user, or migrate workspace from password to key auth.
2303
+ * Supported only on Snowflake.
2304
+ * When called, either a new key is created, or the older one is replaced.
2305
+ */
2306
+ const setWorkspacePublicKey = async ({ branchId, workspaceId, ...body }) => {
2307
+ const { data } = await client.post("/v2/storage/branch/{branchId}/workspaces/{workspaceId}/public-key", {
2308
+ path: {
2309
+ branchId,
2310
+ workspaceId: String(workspaceId)
2311
+ },
2312
+ body
2313
+ });
2314
+ return data;
2315
+ };
2316
+ const getWorkspaceObjects = async (path, signal) => {
2317
+ const { data } = await client.get("/v2/storage/branch/{branchId}/workspaces/{workspaceId}/objects", { path }, { signal });
2318
+ return data;
2319
+ };
2320
+ const deleteWorkspaceObjectsAsync = async ({ branchId, workspaceId, ...body }) => {
2321
+ const { data } = await client.post("/v2/storage/branch/{branchId}/workspaces/{workspaceId}/objects/batch-delete", {
2322
+ path: {
2323
+ branchId,
2324
+ workspaceId
2325
+ },
2326
+ body
2327
+ });
2328
+ return data;
2329
+ };
2330
+ const unloadWorkspace = async ({ branchId, workspaceId, ...query }) => {
2331
+ const { data } = await client.post("/v2/storage/branch/{branchId}/workspaces/{workspaceId}/unload", {
2332
+ path: {
2333
+ branchId,
2334
+ workspaceId
2335
+ },
2336
+ query
2337
+ });
2338
+ return data;
2339
+ };
2340
+ /**
2341
+ * Preview the resolved load types for a component-style input-mapping config without a workspace.
2342
+ * Returns the preferred load type plus the possible load types per table for the resolved backend,
2343
+ * without creating a job. The backend is resolved per item from the item `backend` field, then the
2344
+ * `backend` argument, then the project default.
2345
+ */
2346
+ const inputMappingLoadPreview = async ({ branchId, body, backend }, signal) => {
2347
+ const { data } = await client.post("/v2/storage/branch/{branchId}/input-mapping-load/preview", {
2348
+ path: { branchId },
2349
+ query: backend ? { backend } : void 0,
2350
+ body
2351
+ }, { signal });
2352
+ return data;
2353
+ };
2354
+ return {
2355
+ getWorkspace,
2356
+ getWorkspaces,
2357
+ deleteWorkspace,
2358
+ resetWorkspacePassword,
2359
+ deleteWorkspaces,
2360
+ deleteWorkspaceJob,
2361
+ setWorkspacePublicKey,
2362
+ getWorkspaceSaml2Login,
2363
+ getWorkspaceObjects,
2364
+ deleteWorkspaceObjectsAsync,
2365
+ unloadWorkspace,
2366
+ inputMappingLoadPreview
2367
+ };
2368
+ };
2369
+ //#endregion
2370
+ //#region src/clients/storage/storageClient.ts
2371
+ const createStorageClient = ({ baseUrl, auth, middlewares = [], onRefreshToken }) => {
2372
+ const headers = createAuthHeaders(auth);
2373
+ const allMiddlewares = onRefreshToken && auth.type === "sapi-token" ? [...middlewares, createRefreshTokenMiddlware({
2374
+ accessToken: auth.token,
2375
+ onRefresh: onRefreshToken
2376
+ })] : middlewares;
2377
+ const genericClient = createGenericFetchClient({
2378
+ baseUrl,
2379
+ middlewares: allMiddlewares,
2380
+ headers
2381
+ });
2382
+ const client = createOpenapiFetchClient({
2383
+ baseUrl,
2384
+ middlewares: allMiddlewares,
2385
+ headers
2386
+ });
2387
+ const getStackInfo = async (query, signal) => {
2388
+ const { data } = await client.get("/v2/storage", { query }, { signal });
2389
+ return data;
2390
+ };
2391
+ const healthCheck = async (signal) => {
2392
+ const { data } = await genericClient.get("/health-check", {}, { signal });
2393
+ return data;
2394
+ };
2395
+ const jobs = createJobs(client);
2396
+ const poller = createJobPoller({ getJob: jobs.getJob });
2397
+ return {
2398
+ poller,
2399
+ healthCheck,
2400
+ getStackInfo,
2401
+ jobs,
2402
+ buckets: createBuckets(client, genericClient),
2403
+ bucketSharing: createBucketSharing(client),
2404
+ bucketListings: createBucketListings(client),
2405
+ bucketExternal: createBucketExternal(client),
2406
+ tables: createTables(client, genericClient),
2407
+ columns: createColumns(client),
2408
+ snapshots: createSnapshots(client),
2409
+ branches: createBranches(client, poller),
2410
+ mergeRequests: createMergeRequests(client),
2411
+ events: createEvents(client),
2412
+ files: createFiles(client),
2413
+ workspaces: createWorkspaces(client),
2414
+ tokens: createTokens(client),
2415
+ triggers: createTriggers(client),
2416
+ search: createSearch(client),
2417
+ stats: createStats(client),
2418
+ components: createComponents(client),
2419
+ configurations: createConfigurations(client),
2420
+ configurationRows: createConfigurationRows(client),
2421
+ configurationWorkspaces: createConfigurationWorkspaces(client),
2422
+ configurationMetadata: createConfigurationMetadata(client),
2423
+ configurationVersions: createConfigurationVersions(client)
2424
+ };
2425
+ };
2426
+ //#endregion
2427
+ export { series as a, ServiceUnavailableError as i, fromBackendSubscribers as n, toBackendSubscribers as r, createStorageClient as t };
2428
+
2429
+ //# sourceMappingURL=storage-luq7YBZF.js.map