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