@keboola/api-client 31.0.0 → 33.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 (423) hide show
  1. package/AGENTS.md +91 -7
  2. package/API-SURFACE.md +5 -2
  3. package/CHANGELOG.md +327 -0
  4. package/README.md +45 -19
  5. package/dist/{ManagementClientAuthError-DFhi5yxe.cjs → ManagementClientAuthError-DqeXL8nv.cjs} +2 -2
  6. package/dist/{ManagementClientAuthError-DFhi5yxe.cjs.map → ManagementClientAuthError-DqeXL8nv.cjs.map} +1 -1
  7. package/dist/{ManagementClientAuthError-90pvsej0.js → ManagementClientAuthError-iKbBugKC.js} +2 -2
  8. package/dist/{ManagementClientAuthError-90pvsej0.js.map → ManagementClientAuthError-iKbBugKC.js.map} +1 -1
  9. package/dist/ai/index.cjs +2 -2
  10. package/dist/ai/index.d.cts +2 -2
  11. package/dist/ai/index.d.ts +2 -2
  12. package/dist/ai/index.js +2 -2
  13. package/dist/ai/types.d.cts +1 -1
  14. package/dist/ai/types.d.ts +1 -1
  15. package/dist/{appLogs-CLHhkQJn.js → appLogs-D72eD8vP.js} +2 -2
  16. package/dist/{appLogs-CLHhkQJn.js.map → appLogs-D72eD8vP.js.map} +1 -1
  17. package/dist/{appLogs-BCCi02w6.cjs → appLogs-D8K0VeNM.cjs} +2 -2
  18. package/dist/{appLogs-BCCi02w6.cjs.map → appLogs-D8K0VeNM.cjs.map} +1 -1
  19. package/dist/{appLogs-hQdKt_8J.d.cts → appLogs-Q4A7A_Fc.d.cts} +2 -2
  20. package/dist/{appLogs-BdMG6Cvn.d.ts → appLogs-u0XMZLjS.d.ts} +2 -2
  21. package/dist/apps/index.cjs +3 -3
  22. package/dist/apps/index.d.cts +3 -3
  23. package/dist/apps/index.d.ts +3 -3
  24. package/dist/apps/index.js +3 -3
  25. package/dist/apps/types.d.cts +2 -2
  26. package/dist/apps/types.d.ts +2 -2
  27. package/dist/assets/index.cjs +1 -1
  28. package/dist/assets/index.d.cts +1 -1
  29. package/dist/assets/index.d.ts +1 -1
  30. package/dist/assets/index.js +1 -1
  31. package/dist/auth/index.cjs +1 -1
  32. package/dist/auth/index.d.cts +1 -1
  33. package/dist/auth/index.d.ts +1 -1
  34. package/dist/auth/index.js +1 -1
  35. package/dist/auth/types.d.cts +2 -2
  36. package/dist/auth/types.d.ts +2 -2
  37. package/dist/{auth-DmgTH0uY.cjs → auth-C2_JLisH.cjs} +2 -2
  38. package/dist/{auth-DmgTH0uY.cjs.map → auth-C2_JLisH.cjs.map} +1 -1
  39. package/dist/{auth-CE6Hlc9W.js → auth-CE9rQV3-.js} +2 -2
  40. package/dist/{auth-CE6Hlc9W.js.map → auth-CE9rQV3-.js.map} +1 -1
  41. package/dist/{authClient-XBAUz9g-.js → authClient-DEyqR7GW.js} +43 -9
  42. package/dist/authClient-DEyqR7GW.js.map +1 -0
  43. package/dist/{authClient-BL6h78Q1.d.cts → authClient-DZ_8lvdJ.d.cts} +6 -6
  44. package/dist/{authClient-Bc_bDisO.d.ts → authClient-DwT6xdg5.d.ts} +6 -6
  45. package/dist/{authClient-Cixa8_L1.cjs → authClient-IwQ9Ti0J.cjs} +43 -9
  46. package/dist/authClient-IwQ9Ti0J.cjs.map +1 -0
  47. package/dist/chat/index.cjs +3 -3
  48. package/dist/chat/index.d.cts +2 -7
  49. package/dist/chat/index.d.ts +2 -7
  50. package/dist/chat/index.js +3 -3
  51. package/dist/chat/types.d.cts +1 -1
  52. package/dist/chat/types.d.ts +1 -1
  53. package/dist/{configurations-CujCwDcB.cjs → configurations-Ck-mNB_E.cjs} +2 -2
  54. package/dist/{configurations-CujCwDcB.cjs.map → configurations-Ck-mNB_E.cjs.map} +1 -1
  55. package/dist/{configurations-DCOJONZZ.cjs → configurations-CqwAxiQL.cjs} +5 -1
  56. package/dist/configurations-CqwAxiQL.cjs.map +1 -0
  57. package/dist/{configurations-Byt59bIa.js → configurations-ZwBXilW-.js} +2 -2
  58. package/dist/{configurations-Byt59bIa.js.map → configurations-ZwBXilW-.js.map} +1 -1
  59. package/dist/{configurations-iCbhe0tb.js → configurations-d7SZmw69.js} +5 -1
  60. package/dist/configurations-d7SZmw69.js.map +1 -0
  61. package/dist/constants/index.cjs +2 -1
  62. package/dist/constants/index.d.cts +3 -2
  63. package/dist/constants/index.d.ts +3 -2
  64. package/dist/constants/index.js +2 -2
  65. package/dist/{constants-qeWGfk_7.js → constants-ByEwVtGf.js} +38 -2
  66. package/dist/constants-ByEwVtGf.js.map +1 -0
  67. package/dist/{constants-CkAVvuUq.cjs → constants-lIfSdTzS.cjs} +43 -1
  68. package/dist/constants-lIfSdTzS.cjs.map +1 -0
  69. package/dist/{createFetchClient-B1h3-p65.js → createFetchClient-DdyZMhxO.js} +17 -11
  70. package/dist/createFetchClient-DdyZMhxO.js.map +1 -0
  71. package/dist/{createFetchClient-B9Cv0W9f.cjs → createFetchClient-DvZvD31l.cjs} +22 -10
  72. package/dist/createFetchClient-DvZvD31l.cjs.map +1 -0
  73. package/dist/{createGenericFetchClient-DhpvUSlX.js → createGenericFetchClient-MQeLRiNW.js} +2 -2
  74. package/dist/{createGenericFetchClient-DhpvUSlX.js.map → createGenericFetchClient-MQeLRiNW.js.map} +1 -1
  75. package/dist/{createGenericFetchClient-BWoSkTki.cjs → createGenericFetchClient-qfCZlCTv.cjs} +2 -2
  76. package/dist/{createGenericFetchClient-BWoSkTki.cjs.map → createGenericFetchClient-qfCZlCTv.cjs.map} +1 -1
  77. package/dist/{createOpenapiFetchClient-yirrW6Tg.cjs → createOpenapiFetchClient-C57Ljzi6.cjs} +2 -2
  78. package/dist/{createOpenapiFetchClient-yirrW6Tg.cjs.map → createOpenapiFetchClient-C57Ljzi6.cjs.map} +1 -1
  79. package/dist/{createOpenapiFetchClient-0_oqhdPv.js → createOpenapiFetchClient-E7OIVkYv.js} +2 -2
  80. package/dist/{createOpenapiFetchClient-0_oqhdPv.js.map → createOpenapiFetchClient-E7OIVkYv.js.map} +1 -1
  81. package/dist/{credential-dKxArMic.js → credential-Bxv7yxOZ.js} +7 -4
  82. package/dist/credential-Bxv7yxOZ.js.map +1 -0
  83. package/dist/{credential-D-tX9gP4.cjs → credential-D-X5QQrM.cjs} +7 -4
  84. package/dist/credential-D-X5QQrM.cjs.map +1 -0
  85. package/dist/dataScience/index.cjs +2 -2
  86. package/dist/dataScience/index.d.cts +2 -2
  87. package/dist/dataScience/index.d.ts +2 -2
  88. package/dist/dataScience/index.js +2 -2
  89. package/dist/dataScience/types.d.cts +2 -2
  90. package/dist/dataScience/types.d.ts +2 -2
  91. package/dist/{dataScience-BqNWX-Gr.cjs → dataScience-BPW993AG.cjs} +5 -5
  92. package/dist/{dataScience-BqNWX-Gr.cjs.map → dataScience-BPW993AG.cjs.map} +1 -1
  93. package/dist/{dataScience-jdbSSPYF.js → dataScience-B_TA7wCB.js} +5 -5
  94. package/dist/{dataScience-jdbSSPYF.js.map → dataScience-B_TA7wCB.js.map} +1 -1
  95. package/dist/developerPortal/index.cjs +1 -1
  96. package/dist/developerPortal/index.d.cts +2 -2
  97. package/dist/developerPortal/index.d.ts +2 -2
  98. package/dist/developerPortal/index.js +1 -1
  99. package/dist/developerPortal/types.d.cts +1 -1
  100. package/dist/developerPortal/types.d.ts +1 -1
  101. package/dist/{developerPortalClient-B7lNR5q0.cjs → developerPortalClient-Db2XVB_o.cjs} +3 -3
  102. package/dist/{developerPortalClient-B7lNR5q0.cjs.map → developerPortalClient-Db2XVB_o.cjs.map} +1 -1
  103. package/dist/{developerPortalClient-5ABcxz1U.js → developerPortalClient-jk46sjwP.js} +3 -3
  104. package/dist/{developerPortalClient-5ABcxz1U.js.map → developerPortalClient-jk46sjwP.js.map} +1 -1
  105. package/dist/domain/permissions/index.cjs +63 -1
  106. package/dist/domain/permissions/index.cjs.map +1 -0
  107. package/dist/domain/permissions/index.d.cts +52 -3
  108. package/dist/domain/permissions/index.d.ts +52 -3
  109. package/dist/domain/permissions/index.js +59 -2
  110. package/dist/domain/permissions/index.js.map +1 -0
  111. package/dist/editor/index.cjs +2 -2
  112. package/dist/editor/index.d.cts +2 -2
  113. package/dist/editor/index.d.ts +2 -2
  114. package/dist/editor/index.js +2 -2
  115. package/dist/editor/types.d.cts +1 -1
  116. package/dist/editor/types.d.ts +1 -1
  117. package/dist/emitter-dLF1Fyfg.d.cts +11 -0
  118. package/dist/emitter-dLF1Fyfg.d.ts +11 -0
  119. package/dist/encryption/index.cjs +1 -1
  120. package/dist/encryption/index.d.cts +1 -1
  121. package/dist/encryption/index.d.ts +1 -1
  122. package/dist/encryption/index.js +1 -1
  123. package/dist/encryption/types.d.cts +1 -1
  124. package/dist/encryption/types.d.ts +1 -1
  125. package/dist/import/index.cjs +1 -1
  126. package/dist/import/index.d.cts +3 -3
  127. package/dist/import/index.d.ts +3 -3
  128. package/dist/import/index.js +1 -1
  129. package/dist/{import-CExRbskw.js → import-2nqxQ9Rt.js} +3 -3
  130. package/dist/{import-CExRbskw.js.map → import-2nqxQ9Rt.js.map} +1 -1
  131. package/dist/{import-CXHppAxd.cjs → import-DJilJ6tq.cjs} +3 -3
  132. package/dist/{import-CXHppAxd.cjs.map → import-DJilJ6tq.cjs.map} +1 -1
  133. package/dist/{index-BR2Fu-Wo.d.ts → index-B0V1pJAa.d.ts} +618 -3103
  134. package/dist/{index-7RvXnXmd.d.ts → index-B2OGaUap.d.ts} +6 -6
  135. package/dist/{index-J1I2HlSm.d.ts → index-BjKjp3Rf.d.ts} +5 -5
  136. package/dist/{index-NicJZIzu.d.ts → index-C7gxKoDF.d.cts} +3 -3
  137. package/dist/{index-B6q7HxKJ.d.cts → index-CTd4YY8e.d.cts} +4 -4
  138. package/dist/{index-C9mAoXF6.d.cts → index-CUXEFQ7i.d.cts} +6 -6
  139. package/dist/{index-D_TnbEtp.d.cts → index-CVqk63at.d.ts} +3 -3
  140. package/dist/{index-CMb0ygwb.d.ts → index-C_cxKL1V.d.ts} +3 -3
  141. package/dist/{index-CYMAwD3E.d.ts → index-ChMtULt4.d.ts} +4 -4
  142. package/dist/{index-Cpjh05sx.d.cts → index-DCN2lH0v.d.cts} +4 -4
  143. package/dist/{index-cu8THqZV.d.cts → index-DIVvL54G.d.cts} +618 -3103
  144. package/dist/{index-CwJE18PJ.d.cts → index-DLYAvSWZ.d.cts} +3 -3
  145. package/dist/{index-CW4VC9oN.d.ts → index-DQef014j.d.ts} +4 -4
  146. package/dist/{index-Ds8e0l7-.d.ts → index-DVhTNwvu.d.ts} +7 -3
  147. package/dist/{index-B-frWtGW.d.cts → index-DhVFuQDv.d.cts} +7 -3
  148. package/dist/{index-DeMDxHTz.d.ts → index-GNKwr7EQ.d.ts} +4 -4
  149. package/dist/{index--pxLseaw.d.cts → index-NaYLwG_h.d.cts} +143 -2
  150. package/dist/{index--pxLseaw.d.ts → index-NaYLwG_h.d.ts} +143 -2
  151. package/dist/{index-Daks5CeX.d.ts → index-bB6wvw1f.d.ts} +4 -4
  152. package/dist/{index-BfVv8isU.d.cts → index-exNi3I2Q.d.cts} +4 -4
  153. package/dist/{index-CR9LsDaG.d.cts → index-qOK5FtAH.d.cts} +4 -4
  154. package/dist/{index-BSjfVDTr.d.cts → index-t-a7kYnx.d.cts} +5 -5
  155. package/dist/index.cjs +325 -257
  156. package/dist/index.cjs.map +1 -1
  157. package/dist/index.d.cts +7 -6
  158. package/dist/index.d.ts +7 -6
  159. package/dist/index.js +306 -240
  160. package/dist/index.js.map +1 -1
  161. package/dist/{jobStatus-kQ9JqF8t.cjs → jobStatus-0_Y3Sr4i.cjs} +37 -20
  162. package/dist/jobStatus-0_Y3Sr4i.cjs.map +1 -0
  163. package/dist/{jobStatus-DbMupQEK.js → jobStatus-PSZJMTiA.js} +35 -18
  164. package/dist/jobStatus-PSZJMTiA.js.map +1 -0
  165. package/dist/kaiAgent/index.cjs +3 -0
  166. package/dist/kaiAgent/index.d.cts +2 -0
  167. package/dist/kaiAgent/index.d.ts +2 -0
  168. package/dist/kaiAgent/index.js +2 -0
  169. package/dist/kaiAgent/types.cjs +0 -0
  170. package/dist/kaiAgent/types.d.cts +2 -0
  171. package/dist/kaiAgent/types.d.ts +2 -0
  172. package/dist/kaiAgent/types.js +1 -0
  173. package/dist/kaiAgent-CMVub6Sc.cjs +266 -0
  174. package/dist/kaiAgent-CMVub6Sc.cjs.map +1 -0
  175. package/dist/kaiAgent-CYYn0QJW.js +261 -0
  176. package/dist/kaiAgent-CYYn0QJW.js.map +1 -0
  177. package/dist/kaiAgentClient-B2O0DF4d.d.ts +249 -0
  178. package/dist/kaiAgentClient-iCFR2tRU.d.cts +249 -0
  179. package/dist/management/index.cjs +1 -1
  180. package/dist/management/index.d.cts +1 -1
  181. package/dist/management/index.d.ts +1 -1
  182. package/dist/management/index.js +1 -1
  183. package/dist/management/types.d.cts +1 -1
  184. package/dist/management/types.d.ts +1 -1
  185. package/dist/{management-DlVdxzPw.cjs → management-DGfgKsaA.cjs} +5 -5
  186. package/dist/{management-DlVdxzPw.cjs.map → management-DGfgKsaA.cjs.map} +1 -1
  187. package/dist/{management-Cc8mKfnf.js → management-DNEKhR6a.js} +5 -5
  188. package/dist/{management-Cc8mKfnf.js.map → management-DNEKhR6a.js.map} +1 -1
  189. package/dist/metastore/index.cjs +1 -1
  190. package/dist/metastore/index.d.cts +1 -1
  191. package/dist/metastore/index.d.ts +1 -1
  192. package/dist/metastore/index.js +1 -1
  193. package/dist/metastore/types.d.cts +1 -1
  194. package/dist/metastore/types.d.ts +1 -1
  195. package/dist/{metastore-CNf1412Z.js → metastore-CjwktHvw.js} +4 -4
  196. package/dist/{metastore-CNf1412Z.js.map → metastore-CjwktHvw.js.map} +1 -1
  197. package/dist/{metastore-DbsxqjhS.cjs → metastore-DksEte8P.cjs} +4 -4
  198. package/dist/{metastore-DbsxqjhS.cjs.map → metastore-DksEte8P.cjs.map} +1 -1
  199. package/dist/microsoftGraph/index.cjs +92 -0
  200. package/dist/microsoftGraph/index.cjs.map +1 -0
  201. package/dist/microsoftGraph/index.d.cts +305 -0
  202. package/dist/microsoftGraph/index.d.ts +305 -0
  203. package/dist/microsoftGraph/index.js +90 -0
  204. package/dist/microsoftGraph/index.js.map +1 -0
  205. package/dist/microsoftGraph/types.cjs +0 -0
  206. package/dist/microsoftGraph/types.d.cts +10 -0
  207. package/dist/microsoftGraph/types.d.ts +10 -0
  208. package/dist/microsoftGraph/types.js +1 -0
  209. package/dist/notifications/index.cjs +3 -3
  210. package/dist/notifications/index.d.cts +2 -2
  211. package/dist/notifications/index.d.ts +2 -2
  212. package/dist/notifications/index.js +3 -3
  213. package/dist/notifications/types.d.cts +1 -1
  214. package/dist/notifications/types.d.ts +1 -1
  215. package/dist/oauth/index.cjs +1 -1
  216. package/dist/oauth/index.d.cts +2 -2
  217. package/dist/oauth/index.d.ts +2 -2
  218. package/dist/oauth/index.js +1 -1
  219. package/dist/oauth/types.d.cts +1 -1
  220. package/dist/oauth/types.d.ts +1 -1
  221. package/dist/{oauth-ClksaYRY.js → oauth-Bg5zro5S.js} +5 -5
  222. package/dist/{oauth-ClksaYRY.js.map → oauth-Bg5zro5S.js.map} +1 -1
  223. package/dist/{oauth-DsZgmtPj.cjs → oauth-DFsI1TE5.cjs} +5 -5
  224. package/dist/{oauth-DsZgmtPj.cjs.map → oauth-DFsI1TE5.cjs.map} +1 -1
  225. package/dist/omnisearch/index.cjs +2 -2
  226. package/dist/omnisearch/index.d.cts +2 -2
  227. package/dist/omnisearch/index.d.ts +2 -2
  228. package/dist/omnisearch/index.js +2 -2
  229. package/dist/omnisearch/types.d.cts +1 -1
  230. package/dist/omnisearch/types.d.ts +1 -1
  231. package/dist/{project-5SLw86eZ.d.ts → project-Bh954iOA.d.ts} +2 -2
  232. package/dist/{project-CRrsxSAK.d.cts → project-D25GH8zK.d.cts} +2 -2
  233. package/dist/queryService/index.cjs +1 -1
  234. package/dist/queryService/index.d.cts +1 -1
  235. package/dist/queryService/index.d.ts +1 -1
  236. package/dist/queryService/index.js +1 -1
  237. package/dist/queryService/types.d.cts +1 -1
  238. package/dist/queryService/types.d.ts +1 -1
  239. package/dist/{queryService-DxUUkTcy.cjs → queryService--t_W9PSJ.cjs} +6 -6
  240. package/dist/{queryService-DxUUkTcy.cjs.map → queryService--t_W9PSJ.cjs.map} +1 -1
  241. package/dist/{queryService-BlyAcBxP.js → queryService-DX6zeAs_.js} +6 -6
  242. package/dist/{queryService-BlyAcBxP.js.map → queryService-DX6zeAs_.js.map} +1 -1
  243. package/dist/queue/index.cjs +1 -1
  244. package/dist/queue/index.d.cts +3 -3
  245. package/dist/queue/index.d.ts +3 -3
  246. package/dist/queue/index.js +1 -1
  247. package/dist/queue/types.d.cts +1 -1
  248. package/dist/queue/types.d.ts +1 -1
  249. package/dist/{queue-CpcqeMPz.cjs → queue-D1_TCe0z.cjs} +5 -5
  250. package/dist/{queue-CpcqeMPz.cjs.map → queue-D1_TCe0z.cjs.map} +1 -1
  251. package/dist/{queue-DpZTm7U7.js → queue-DrLUbk98.js} +5 -5
  252. package/dist/{queue-DpZTm7U7.js.map → queue-DrLUbk98.js.map} +1 -1
  253. package/dist/scheduler/index.cjs +3 -3
  254. package/dist/scheduler/index.d.cts +2 -2
  255. package/dist/scheduler/index.d.ts +2 -2
  256. package/dist/scheduler/index.js +3 -3
  257. package/dist/scheduler/types.d.cts +1 -1
  258. package/dist/scheduler/types.d.ts +1 -1
  259. package/dist/schema-D1oxyn1O.d.cts +8760 -0
  260. package/dist/schema-D1oxyn1O.d.ts +8760 -0
  261. package/dist/sdk/configurations/index.cjs +1 -1
  262. package/dist/sdk/configurations/index.d.cts +4 -4
  263. package/dist/sdk/configurations/index.d.ts +4 -4
  264. package/dist/sdk/configurations/index.js +1 -1
  265. package/dist/sdk/developerPortal/index.cjs +5 -5
  266. package/dist/sdk/developerPortal/index.cjs.map +1 -1
  267. package/dist/sdk/developerPortal/index.d.cts +5 -4
  268. package/dist/sdk/developerPortal/index.d.ts +5 -4
  269. package/dist/sdk/developerPortal/index.js +4 -4
  270. package/dist/sdk/queryService/index.cjs +1 -1
  271. package/dist/sdk/queryService/index.d.cts +1 -1
  272. package/dist/sdk/queryService/index.d.ts +1 -1
  273. package/dist/sdk/queryService/index.js +1 -1
  274. package/dist/sdk/semanticLayer/index.cjs +163 -74
  275. package/dist/sdk/semanticLayer/index.cjs.map +1 -1
  276. package/dist/sdk/semanticLayer/index.d.cts +16 -13
  277. package/dist/sdk/semanticLayer/index.d.ts +16 -13
  278. package/dist/sdk/semanticLayer/index.js +158 -75
  279. package/dist/sdk/semanticLayer/index.js.map +1 -1
  280. package/dist/sdk/semanticLayer/types.d.cts +2 -2
  281. package/dist/sdk/semanticLayer/types.d.ts +2 -2
  282. package/dist/sdk/storage/index.d.cts +1 -1
  283. package/dist/sdk/storage/index.d.ts +1 -1
  284. package/dist/sdk/tag/index.d.cts +2 -2
  285. package/dist/sdk/tag/index.d.ts +2 -2
  286. package/dist/sdk/tag/types.d.cts +1 -1
  287. package/dist/sdk/tag/types.d.ts +1 -1
  288. package/dist/sdk/vault/index.d.cts +1 -1
  289. package/dist/sdk/vault/index.d.ts +1 -1
  290. package/dist/serviceIds-fHLDwOg9.d.cts +31 -0
  291. package/dist/serviceIds-fHLDwOg9.d.ts +31 -0
  292. package/dist/status/index.cjs +1 -1
  293. package/dist/status/index.d.cts +1 -1
  294. package/dist/status/index.d.ts +1 -1
  295. package/dist/status/index.js +1 -1
  296. package/dist/storage/index.cjs +4 -4
  297. package/dist/storage/index.d.cts +2 -2
  298. package/dist/storage/index.d.ts +2 -2
  299. package/dist/storage/index.js +4 -4
  300. package/dist/storage/types.d.cts +4 -3
  301. package/dist/storage/types.d.ts +4 -3
  302. package/dist/{storage-CQxu0EY3.js → storage--cVaecFq.js} +150 -161
  303. package/dist/storage--cVaecFq.js.map +1 -0
  304. package/dist/{storage-vnH64B_Q.cjs → storage-DexWot8H.cjs} +150 -161
  305. package/dist/storage-DexWot8H.cjs.map +1 -0
  306. package/dist/store-C9FQCHGe.js +74 -0
  307. package/dist/store-C9FQCHGe.js.map +1 -0
  308. package/dist/store-xS-Cu_VS.cjs +85 -0
  309. package/dist/store-xS-Cu_VS.cjs.map +1 -0
  310. package/dist/stream/index.cjs +3 -3
  311. package/dist/stream/index.d.cts +2 -2
  312. package/dist/stream/index.d.ts +2 -2
  313. package/dist/stream/index.js +3 -3
  314. package/dist/stream/types.d.cts +1 -1
  315. package/dist/stream/types.d.ts +1 -1
  316. package/dist/syncActions/index.cjs +1 -1
  317. package/dist/syncActions/index.d.cts +1 -1
  318. package/dist/syncActions/index.d.ts +1 -1
  319. package/dist/syncActions/index.js +1 -1
  320. package/dist/syncActions/types.d.cts +1 -1
  321. package/dist/syncActions/types.d.ts +1 -1
  322. package/dist/{syncActions-AgFiMjRS.js → syncActions-CkMHM-jB.js} +5 -5
  323. package/dist/{syncActions-AgFiMjRS.js.map → syncActions-CkMHM-jB.js.map} +1 -1
  324. package/dist/{syncActions-DPcAPYgJ.cjs → syncActions-DQq_A9v6.cjs} +5 -5
  325. package/dist/{syncActions-DPcAPYgJ.cjs.map → syncActions-DQq_A9v6.cjs.map} +1 -1
  326. package/dist/telemetry/index.cjs +1 -1
  327. package/dist/telemetry/index.d.cts +2 -2
  328. package/dist/telemetry/index.d.ts +2 -2
  329. package/dist/telemetry/index.js +1 -1
  330. package/dist/{telemetry-BLgaYEvi.cjs → telemetry-CAu1Qt7B.cjs} +3 -3
  331. package/dist/{telemetry-BLgaYEvi.cjs.map → telemetry-CAu1Qt7B.cjs.map} +1 -1
  332. package/dist/{telemetry-CPiGWpLi.js → telemetry-Ca6j0i9w.js} +3 -3
  333. package/dist/{telemetry-CPiGWpLi.js.map → telemetry-Ca6j0i9w.js.map} +1 -1
  334. package/dist/{types-eP06LqcE.d.cts → types-0xa_7cgo.d.cts} +2 -16
  335. package/dist/{types-DLazCdFR.d.cts → types-3p0adMdd.d.cts} +3 -3
  336. package/dist/{types-DWUd__fe.d.ts → types-6ThDkaJw.d.ts} +2 -2
  337. package/dist/{types-Culr5v8R.d.ts → types-6hh_3SZs.d.ts} +3 -3
  338. package/dist/{types-DN7RWWBw.d.ts → types-6ku2LeX6.d.ts} +2 -2
  339. package/dist/{types-DSBNqF1J.d.cts → types-B42HhyB0.d.cts} +2 -2
  340. package/dist/{types-C2p7JYQ3.d.cts → types-B4_MM5Wf.d.cts} +2 -2
  341. package/dist/{types-B2El99VY.d.cts → types-B6JJCta-.d.cts} +2 -2
  342. package/dist/{types-BHCigZFc.d.ts → types-B6lOyHY_.d.ts} +3 -3
  343. package/dist/{types-Bc3-a3DT.d.cts → types-B7O5koJb.d.cts} +2 -2
  344. package/dist/{types-D5VvEdOv.d.ts → types-BHI8Lin9.d.ts} +2 -2
  345. package/dist/{types-DnOGCb-p.d.cts → types-BO3sCD0a.d.cts} +41 -10
  346. package/dist/{types-Bv5vw2dc.d.cts → types-BOnf68s5.d.cts} +2 -2
  347. package/dist/{types-CIybfUJ9.d.cts → types-BS5M67xm.d.cts} +3 -3
  348. package/dist/{types-C0bGZqFI.d.cts → types-BT46XIgn.d.cts} +2 -2
  349. package/dist/types-BUYqdN7B.d.ts +205 -0
  350. package/dist/{types-DdeZK3BO.d.ts → types-BYKHr5bR.d.ts} +2 -2
  351. package/dist/{types-BIAP4CYp.d.cts → types-Be3Wgn1U.d.cts} +2 -2
  352. package/dist/{types-B1S60aS2.d.ts → types-BgVKG4vg.d.ts} +2 -2
  353. package/dist/{types-BJLRgXw0.d.ts → types-C2gzqtjf.d.ts} +2 -2
  354. package/dist/{types-DQOOWgLt.d.cts → types-C35GWNmq.d.ts} +408 -24
  355. package/dist/{types-DMMMQuNt.d.ts → types-C4mr0lop.d.ts} +279 -430
  356. package/dist/{types-CFhAduFK.d.cts → types-CCr1-9Q6.d.cts} +3 -3
  357. package/dist/{types-Dirp9mni.d.ts → types-CHCM9oNk.d.ts} +3 -3
  358. package/dist/types-CNQdtffE.d.ts +3454 -0
  359. package/dist/{types-mXM8MrYS.d.cts → types-CPaluTW7.d.cts} +3 -3
  360. package/dist/{types-RmbvQimP.d.ts → types-CSc8NQCY.d.ts} +41 -10
  361. package/dist/{types-CgF9R0Na.d.ts → types-C_ilZZkQ.d.ts} +2 -2
  362. package/dist/{types-lVXf05pr.d.ts → types-CaMfshWX.d.ts} +2 -2
  363. package/dist/{types-BXnUqdBB.d.cts → types-Ccgbipp4.d.cts} +2 -2
  364. package/dist/types-Cpjk0-ta.d.ts +33557 -0
  365. package/dist/types-CrH4H8M4.d.cts +33557 -0
  366. package/dist/{types-CQd9PuKY.d.cts → types-Cu-0LT4f.d.cts} +2 -2
  367. package/dist/{types-D7YGPUsm.d.ts → types-CxmV36rp.d.cts} +408 -24
  368. package/dist/{types-SX78XZZ0.d.ts → types-D-98DirB.d.ts} +2 -2
  369. package/dist/{types-DG_FlLJt.d.cts → types-D6ocCyGh.d.cts} +279 -430
  370. package/dist/{types-DkoyCUqv.d.ts → types-D7Wgcp0u.d.ts} +2 -2
  371. package/dist/{types-COFrOmuO.d.ts → types-DAzmGzlb.d.ts} +2 -2
  372. package/dist/{types-BdKtW2Ml.d.cts → types-DHI0g51U.d.cts} +2 -2
  373. package/dist/{types-BMsK6T5k.d.ts → types-DHqIJKwx.d.ts} +2 -2
  374. package/dist/types-DONxb2-c.d.cts +205 -0
  375. package/dist/{types-DyIKgbGB.d.ts → types-DTTC70Ac.d.ts} +2 -2
  376. package/dist/{types-B2Al1BNh.d.ts → types-DlvZeert.d.ts} +2 -2
  377. package/dist/{types-uP64XthM.d.cts → types-DqniGeDJ.d.cts} +2 -2
  378. package/dist/types-E3VT-zYz.d.cts +3454 -0
  379. package/dist/{types-CuAoZH8w.d.cts → types-Jt0ipbSm.d.cts} +2 -2
  380. package/dist/{types-Co8WobOo.d.ts → types-Ur37iOqb.d.ts} +3 -3
  381. package/dist/{types-Drk7PEhk.d.ts → types-ZGAWRIBW.d.ts} +2 -2
  382. package/dist/{types-056giLrn.d.cts → types-bY6K3y0O.d.cts} +2 -2
  383. package/dist/{types-BvXODdf5.d.ts → types-k4R8gQ4U.d.ts} +2 -16
  384. package/dist/{types-sTH4KiPc.d.cts → types-sO52qIAA.d.cts} +2 -2
  385. package/dist/{types-By47HWwB.d.cts → types-sp1rJY9E.d.cts} +2 -2
  386. package/dist/{validateConnectionStatus-DVHXGTdi.cjs → validateConnectionStatus-24zqIQ0p.cjs} +2 -2
  387. package/dist/{validateConnectionStatus-DVHXGTdi.cjs.map → validateConnectionStatus-24zqIQ0p.cjs.map} +1 -1
  388. package/dist/{validateConnectionStatus-CBhXmvWC.js → validateConnectionStatus-DhkWg6Eq.js} +2 -2
  389. package/dist/{validateConnectionStatus-CBhXmvWC.js.map → validateConnectionStatus-DhkWg6Eq.js.map} +1 -1
  390. package/dist/vault/index.cjs +4 -4
  391. package/dist/vault/index.d.cts +1 -1
  392. package/dist/vault/index.d.ts +1 -1
  393. package/dist/vault/index.js +4 -4
  394. package/dist/vault/types.d.cts +1 -1
  395. package/dist/vault/types.d.ts +1 -1
  396. package/package.json +55 -3
  397. package/surface/auth.md +2 -2
  398. package/surface/chat.md +1 -1
  399. package/surface/kaiAgent.md +5 -2
  400. package/surface/sdk.md +4 -4
  401. package/surface/storage.md +44 -44
  402. package/dist/authClient-Cixa8_L1.cjs.map +0 -1
  403. package/dist/authClient-XBAUz9g-.js.map +0 -1
  404. package/dist/configurations-DCOJONZZ.cjs.map +0 -1
  405. package/dist/configurations-iCbhe0tb.js.map +0 -1
  406. package/dist/constants-CkAVvuUq.cjs.map +0 -1
  407. package/dist/constants-qeWGfk_7.js.map +0 -1
  408. package/dist/createFetchClient-B1h3-p65.js.map +0 -1
  409. package/dist/createFetchClient-B9Cv0W9f.cjs.map +0 -1
  410. package/dist/createStore-BNiCRQXa.js +0 -148
  411. package/dist/createStore-BNiCRQXa.js.map +0 -1
  412. package/dist/createStore-MQbboXcB.cjs +0 -177
  413. package/dist/createStore-MQbboXcB.cjs.map +0 -1
  414. package/dist/credential-D-tX9gP4.cjs.map +0 -1
  415. package/dist/credential-dKxArMic.js.map +0 -1
  416. package/dist/jobStatus-DbMupQEK.js.map +0 -1
  417. package/dist/jobStatus-kQ9JqF8t.cjs.map +0 -1
  418. package/dist/storage-CQxu0EY3.js.map +0 -1
  419. package/dist/storage-vnH64B_Q.cjs.map +0 -1
  420. package/dist/types-BV74LS5r.d.ts +0 -148
  421. package/dist/types-CIJAtX8q.d.cts +0 -18784
  422. package/dist/types-X-gQF8F8.d.ts +0 -18784
  423. package/dist/types-ca-YNg1r.d.cts +0 -148
package/AGENTS.md CHANGED
@@ -14,7 +14,9 @@ All commands run from monorepo root using `--filter`:
14
14
  pnpm build --filter=@keboola/api-client # Build with tsdown (ESM + CJS + .d.ts)
15
15
  pnpm test --filter=@keboola/api-client # Vitest
16
16
  pnpm type-check --filter=@keboola/api-client # tsc --noEmit
17
- pnpm --filter @keboola/api-client gen:types # Regenerate OpenAPI types from redocly.yaml
17
+ pnpm --filter @keboola/api-client gen:types --list # What can be regenerated
18
+ pnpm --filter @keboola/api-client gen:types storage # One service — leaves the rest alone
19
+ pnpm --filter @keboola/api-client gen:types # Every API in redocly.yaml
18
20
  ```
19
21
 
20
22
  ## Getting a client
@@ -34,6 +36,8 @@ const { data } = useQuery({
34
36
  - **`createStorageClient`** — Storage-only. Needs only `baseUrl` + `token`, skipping the stack-info round-trip. Start here when in doubt; upgrading later is mechanical, downgrading is not. (React apps still get their client via `ApiClientProvider` + `useApiClient()` — see above; this section is about the non-React/single-service case.)
35
37
  - **`createLegacyKeboola` / `createKeboola`** — full SDK across all stack services. Each returns `{ api, session }`; drive the `session` to ready, then use `api`. Bootstrap (`getStackInfo` + `tokens.verify()` to discover services against the actual stack) runs while the storage build resolves, after which `api.context` is synchronous. Every stack service — including `metastore` — is resolved from the stack's advertised service URLs. See the lifecycle section below for the per-flow `session` verbs. The token-less public clients `createAssetsClient` / `createStatusClient` are **not** part of this — import them directly from `@keboola/api-client/assets` and `@keboola/api-client/status`.
36
38
 
39
+ **`clients/` also holds clients for third-party APIs the platform talks to directly** (`microsoftGraph` today): a vendor API is still HTTP that must run through the shared fetch client, its middleware chain and its error guards, so it gets a client here rather than a hand-rolled `fetch` in the consuming app. They differ from stack clients in three ways, and a new one should follow the same rules: **never** registered in `createServiceClients.ts` (they are not stack services, so they must not appear on `api.*`), they default their own `baseUrl` (a vendor's host and version prefix are part of its API contract, not something we discover or configure), and they carry no `healthCheck` (we don't own the service's liveness). Consumers construct them directly from the sub-path, like the token-less clients above.
40
+
37
41
  ```ts
38
42
  // Storage-only — imports from the /storage sub-path
39
43
  import { createStorageClient } from '@keboola/api-client/storage';
@@ -73,7 +77,7 @@ Two flow-specific factories back the SDK, and **both return `{ api, session }`**
73
77
  `subscribe(cb)` (fires on config **and** storage-build transitions), and `debug()`. Then:
74
78
 
75
79
  - bearer: `authenticate(token)` → `setProject(projectId)` / `setProjectAsync(projectId)` (awaits the
76
- build) / `reset()`.
80
+ build) / `forProject(projectId)` (a second project alongside the first) / `reset()`.
77
81
  - legacy: `authenticateStorage(sapiToken)` / `authenticateStorageAsync(sapiToken)` (awaits the build),
78
82
  `authenticateManagement(manageToken)`.
79
83
 
@@ -94,6 +98,83 @@ session.setProject(otherId); // runtime re-scope (rebuilds against the new proje
94
98
  session.debug(); // { baseUrl, authReady, managementReady, storage, config }
95
99
  ```
96
100
 
101
+ ### Several projects at once (bearer)
102
+
103
+ One session can address any number of projects. The credential is a **user** token — project scope is
104
+ one header, `X-KBC-ProjectId` — so `session.forProject(projectId)` builds a `ProjectClients` set for
105
+ any project the user can reach, off the session already in hand:
106
+
107
+ ```ts
108
+ const { api, session } = createKeboola({ baseUrl });
109
+ const result = await api.auth.login.withPassword({ email, password });
110
+ if (!result.mfaRequired) session.authenticate(result); // a TokenSet, not a token string
111
+ await session.setProjectAsync(42); // the session's scope — this is what `api.*` addresses
112
+
113
+ const other = await session.forProject(7); // a second project, alongside the first
114
+ const [mine, theirs] = await Promise.all([
115
+ api.storage.buckets.getBuckets({ branchId: 'default' }), // project 42
116
+ other.storage.buckets.getBuckets({ branchId: 'default' }), // project 7
117
+ ]);
118
+ ```
119
+
120
+ `setProjectAsync` **moves** the session (and `api`) to another project; `forProject` **adds** one. Use
121
+ `setProjectAsync` for the project the app is centred on, and `forProject` for every other project it
122
+ reads alongside — the returned clients are yours to hold and never appear on `api`.
123
+
124
+ - **One credential, one refresh loop.** Every set shares the session's auth middleware, so a token
125
+ rotation happens once and serves all of them.
126
+ - **Repeat calls are cheap** — a project is bootstrapped once and concurrent callers share that one
127
+ build. A failed build is retryable.
128
+ - **A project you cannot reach fails the build, not the session.** Connection answers a denied or
129
+ nonexistent project with the same `invalid_token` 401 as a revoked token — bearer failures are
130
+ collapsed deliberately, so scope cannot be probed. `forProject` is the only surface taking a
131
+ caller-supplied id, so it reads a 401 that survives a token rotation as being about the project:
132
+ the build rejects with the underlying `ApiError` and the session stays signed in. A credential that
133
+ really is dead still signs you out — the refresh itself 401s, which is unambiguous.
134
+ - **Independent of the scope**, in both directions: re-scoping the session never redirects a set
135
+ someone holds, and `forProject(scopedProject)` builds a _second_ set rather than reusing `api`'s.
136
+ For the project the app is centred on, use `api.*`.
137
+ - **Nothing extra is persisted.** Storage still holds one entry, `{ baseUrl, projectId, refreshToken }`
138
+ — and that `projectId` is the _scope_. The extra projects are runtime state; re-add them on startup.
139
+ - **`reset()` really is a teardown.** Every set is pinned to the sign-in that built it, so one held
140
+ across a sign-out throws `KeboolaError` (`NotAuthenticated`) on its next request instead of quietly
141
+ acting as whoever signed in after. Ask again for a fresh one. `clearProject()` drops the scope, not
142
+ the credential, so it leaves the extra projects alone.
143
+
144
+ The pin is not specific to `forProject`: **anything that emits this session's credential is bound to
145
+ the sign-in it was built on** — `api.storage`, `api.context`, `api.management`,
146
+ `session.getAuthHeaders()` and `session.restore()` included. The auth middleware holds no token, it
147
+ reads the credential live, so rebuilding a store on sign-out only stops new reads; a request already
148
+ in flight would otherwise complete as the next user, still stamped with the previous project.
149
+ `api.auth` is built once per stack and serves every session, so it pins each _request_ to the sign-in
150
+ that started it rather than to its build — enough to stop a 401 recovery from replaying as the next
151
+ user, and the next session's `login` runs unstamped either way. The guard wraps the **credential**,
152
+ not just the outgoing request: the 401 path rotates the token by calling the credential directly, and
153
+ a straggler from a dead session would otherwise spend the live session's single-use refresh token —
154
+ and sign that session out if the rotation itself came back 401. Anything new that takes the auth
155
+ middleware, or hands the credential to a transport we don't own, needs the same pin — see
156
+ `createPinnedAuthMiddleware` / `pinToSession` in `bearer/keboola.ts`.
157
+
158
+ **The pin has to cover the failure branches, not only the happy path** — that is where it keeps being
159
+ missed. Two shapes:
160
+
161
+ - **Anything that re-invokes `next` goes _inside_ the pin**, via `createPinnedAuthMiddleware`'s
162
+ `inner`, never beside it in the middleware array. The array's first element is the outermost one,
163
+ so a retry placed there re-enters the pin per attempt — and where the epoch is read per request
164
+ (`api.auth`) every attempt re-pins to whoever is signed in by then. A 503 backoff is long enough
165
+ for a sign-out to land in.
166
+ - **A rotation or a restore that _fails_ after its session ended must be re-labelled before the
167
+ error travels on.** A raw 401 is read as "this credential is dead" by `credential.ts` and as "the
168
+ stored token is dead" by `restore()`, and both then act on the session that replaced it — signing
169
+ it out, or clearing the storage entry it just wrote. Compare the epoch in the `catch` as well as
170
+ after the `await`.
171
+
172
+ ⚠️ **A second `createKeboola()` is not the way to reach a second project — it signs you out of both.**
173
+ Both instances hold the same single-use refresh token, and refresh _rotates_ it, with two-phase
174
+ rotation and replay detection on the server. Whichever instance rotates first invalidates the other's
175
+ token, whose next refresh 401s and signs it out. This is a functional break, not a style preference,
176
+ and it does not depend on a `storage` adapter being configured.
177
+
97
178
  In React, `useApiClient()` returns `api`; `AuthProvider` (bearer) / `LegacyAuthProvider` (legacy) own
98
179
  driving the `session` to ready and gate on a `fallback`. See
99
180
  [`@keboola/api-client-react`](../api-client-react/AGENTS.md).
@@ -108,7 +189,8 @@ const { api, session } = createKeboola({ baseUrl, storage: createLocalStorage()
108
189
  // On startup, call `session.restore()` to rehydrate: it exchanges the persisted refresh token for a
109
190
  // fresh credential eagerly (before any request), then re-scopes to the stored project. It resolves
110
191
  // `{ status: 'restored' | 'empty' | 'expired' }` — `expired` means the refresh token was dead and the
111
- // stored session was cleared; route to login. `session.reset()` clears the stored session.
192
+ // stored session was cleared; route to login. `session.reset()` clears the stored session — and one
193
+ // landing mid-restore wins: the restore resolves `empty` rather than signing the user back in.
112
194
  const result = await session.restore();
113
195
  ```
114
196
 
@@ -323,7 +405,7 @@ Surfacing — toast vs inline:
323
405
 
324
406
  `@keboola/api-client/domain/permissions` holds token-only capability predicates: `canX` (boolean, safe in any UI condition) paired with `assertCanX` (throws `PermissionDeniedError` before any HTTP round-trip). Catch the error to gate UI without a network call; let it propagate from `useQuery` to surface a "no access" empty state.
325
407
 
326
- Implemented today: `admin.ts` (`isAdmin`, `isProductionManager`, … + matching `assertCan*`, all `(token)`-only) and `configurations.ts` (`canCreate/canCopy/canMigrateFromTemplate/canPurge/canAssignFolder` + `assertCan*`, taking a trailing `ctx: ConfigurationCtx`). `storage.ts`, `devBranches.ts`, `sandboxes.ts`, `organization.ts` are still `export {}` placeholders.
408
+ Implemented today: `admin.ts` (`isAdmin`, `isProductionManager`, … + matching `assertCan*`, all `(token)`-only), `configurations.ts` (`canCreate/canCopy/canMigrateFromTemplate/canPurge/canAssignFolder` + `assertCan*`, taking a trailing `ctx: ConfigurationCtx`), and `organization.ts` (`isOrganizationMember`, `isOrganizationAdmin`, `canWriteKaiSpendCaps`, all `(token)`-only — reads `StorageToken.admin.isOrganizationMember` rather than the project role string; `assertCanAdministerOrganization`/`assertCanWriteKaiSpendCaps` pair with the latter two, `isOrganizationMember` is a raw signal with no assert). `storage.ts`, `devBranches.ts`, `sandboxes.ts` are still `export {}` placeholders.
327
409
 
328
410
  ```ts
329
411
  import { PermissionDeniedError } from '@keboola/api-client/domain/permissions';
@@ -424,7 +506,7 @@ owns the store, `credential.ts`, `middleware.ts` and `tokenExpiry.ts` — the an
424
506
  Three things about it are unusual:
425
507
 
426
508
  - **Generated from the spec, like every other client.** `https://apps-api.keboola.com/docs/openapi.yaml`
427
- is registered in `redocly.yaml`, so `pnpm gen:types` refreshes
509
+ is registered in `redocly.yaml`, so `pnpm gen:types developerPortal` refreshes
428
510
  `developerPortal/__generated__/schema.d.ts` and `types.ts` derives from it. **The spec is the source of
429
511
  truth** — if it is wrong, fix it in `keboola/developer-portal` and regenerate, rather than
430
512
  hand-writing a parallel shape here.
@@ -441,7 +523,9 @@ Three things about it are unusual:
441
523
 
442
524
  ## Testing with `@keboola/api-fixtures`
443
525
 
444
- `@keboola/api-fixtures` provides typed, endpoint-keyed fixtures so tests don't hand-roll response shapes. Early today (storage tables only); extend it as more services need coverage.
526
+ `@keboola/api-fixtures` provides typed, endpoint-keyed fixtures so tests don't hand-roll response shapes. It covers the storage bootstrap and tables, apps, and the developer portal; extend it as more services need coverage.
527
+
528
+ **This package's own tests cannot use it** — `api-fixtures` depends on `api-client`, so the reverse edge is a build cycle. Tests here keep hand-rolled bodies; consumers get the fixtures.
445
529
 
446
530
  ```ts
447
531
  import { fixtures, getTable, listTables, tableFixtures } from '@keboola/api-fixtures';
@@ -609,7 +693,7 @@ A new client/namespace means touching four places that must stay in lock-step
609
693
  3. `package.json` `typesVersions` — add `<x>` and `<x>/types`
610
694
  4. `src/keboola/createServiceClients.ts` — register the client in the registry with `.add({ serviceId, clientName, clientFn })` (+ `src/keboola/createMiddlewareFor.ts` for its `ServiceClientName` entry and any bespoke middleware)
611
695
 
612
- Full mechanical steps (redocly registration, `pnpm gen:types`, file templates) live in [`README.md` → Adding a New OpenAPI Client](./README.md#adding-a-new-openapi-client). Add typed fixtures to `@keboola/api-fixtures` alongside the client so consumers can test against it.
696
+ Full mechanical steps (redocly registration, `gen:types`, file templates) live in [`README.md` → Adding a New OpenAPI Client](./README.md#adding-a-new-openapi-client). Add typed fixtures to `@keboola/api-fixtures` alongside the client so consumers can test against it.
613
697
 
614
698
  **Worked example — the `auth` client.** `packages/api-client/src/clients/auth/*` (`authClient.ts`, `pkce.ts`, `index.ts`, `types.ts`) is a self-contained new service added this way: it exposes `./auth` + `./auth/types` sub-paths and is surfaced by `src/keboola/createApi.ts`. Read it as the reference shape for a new client rather than copying boilerplate. **Bearer auth lives in `keboola/bearer/`, not the auth client**, since it's specific to the bearer engine: `credential.ts` is a token provider (`getAccessToken({ forceRefresh })` returns a valid token, refreshing — deduped — when near expiry or forced), and `middleware.ts` is a thin policy that on every request asks the credential for a token and stamps the `Authorization` header, and on 401 force-refreshes and replays once. Session-expiry is latched (fire-once, re-armed per session) in `createConfig.notifyExpired`, not the credential — the credential and middleware are long-lived singletons. The middleware holds no token and reads no config — all token state is in the credential, whose `getToken` reads live from `config` so a rotation is picked up without rebuilding. See `keboola/bearer/keboola.ts` for the wiring.
615
699
 
package/API-SURFACE.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Every namespace and method reachable from a ready `KeboolaApi` — the `api` half of a keboola client (`createKeboola(...).api` / `createLegacyKeboola(...).api`, or `useApiClient()`). Generated from the TypeScript type checker — see `scripts/gen-surface.mjs`.
6
6
 
7
- 24 top-level namespaces, 621 methods. This index lists method **names** only — full signatures live per namespace under [`surface/`](./surface). Open `surface/<namespace>.md` for the one you need.
7
+ 24 top-level namespaces, 624 methods. This index lists method **names** only — full signatures live per namespace under [`surface/`](./surface). Open `surface/<namespace>.md` for the one you need.
8
8
 
9
9
  ## [`api.ai`](./surface/ai.md)
10
10
 
@@ -184,6 +184,7 @@ Every namespace and method reachable from a ready `KeboolaApi` — the `api` hal
184
184
  - `getHistory`
185
185
  - `getSandboxGitBranch`
186
186
  - `getSkillsList`
187
+ - `getSpendCaps`
187
188
  - `getSuggestions`
188
189
  - `getToolsList`
189
190
  - `getUsage`
@@ -192,10 +193,12 @@ Every namespace and method reachable from a ready `KeboolaApi` — the `api` hal
192
193
  - `healthCheck`
193
194
  - `listSandboxFiles`
194
195
  - `readSandboxFile`
196
+ - `setUserSpendLimit`
195
197
  - `stopChat`
196
198
  - `submitToolOutput`
197
199
  - `submitVote`
198
200
  - `updateAgentSettings`
201
+ - `updateSpendCaps`
199
202
  - `updateUserAgentSettings`
200
203
 
201
204
  ## [`api.management`](./surface/management.md)
@@ -621,7 +624,7 @@ Every namespace and method reachable from a ready `KeboolaApi` — the `api` hal
621
624
  - `triggers.getTriggers`
622
625
  - `triggers.updateTrigger`
623
626
  - `workspaces.deleteWorkspace`
624
- - `workspaces.deleteWorkspaceJob`
627
+ - `workspaces.deleteWorkspaceAsync`
625
628
  - `workspaces.deleteWorkspaceObjectsAsync`
626
629
  - `workspaces.deleteWorkspaces`
627
630
  - `workspaces.getWorkspace`
package/CHANGELOG.md CHANGED
@@ -1,5 +1,332 @@
1
1
  # @keboola/api-client
2
2
 
3
+ ## 33.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - `createEmitter` delivers events in emission order, never nested, and `Store` gains `asReadable()`.
8
+ - An `emit` from inside a listener is queued until the current pass has reached every listener, so
9
+ no listener hears event N+1 before event N. For a store this means a subscriber that writes back
10
+ can no longer leave a later subscriber on stale state — the last notification is always the
11
+ latest value.
12
+ - A listener's own emit is handled after it returns; a throwing listener is logged and does not
13
+ stall the queue behind it. Nothing is coalesced: every event is delivered.
14
+ - A pass reaches the listeners present when it began. Subscribing from inside a listener no longer
15
+ delivers the event in flight to the new listener — it hears the next one, as it would have had it
16
+ subscribed a moment earlier. Unsubscribing (or `clear()`) from inside a listener still takes
17
+ effect immediately for the rest of that pass.
18
+ - `store.asReadable()` returns the same store without `set` — the read-only view consumers were
19
+ building by hand from `get` / `subscribe` / `dispose`.
20
+
21
+ - `auth.pat.create` / `auth.pat.exchange` take a `CreatePatInput` / `ExchangePatInput` whose optional
22
+ fields may be left out, and drop the keys a caller passes as `null` instead of putting them on the
23
+ wire. The spec documents every optional PAT field as "omit, do not send `null`", but the generated
24
+ bodies demand each of them, so a caller holding a nullable — an empty expiry picker, an untouched
25
+ read-only switch — had no way to express the default. `scope` gains the same treatment: a
26
+ `{ projects, readOnly }` that narrows nothing is sent as no `scope` at all.
27
+
28
+ Existing calls keep compiling and keep their behaviour, since the previously required
29
+ `expiresIn: null` / `scope: null` is what the normaliser now drops.
30
+
31
+ - The semantic layer's closed value sets ship as runtime lists, so an authoring surface no longer
32
+ writes them out by hand. `FIELD_ROLES`, `CONSTRAINT_SEVERITIES`, `CONSTRAINT_SCOPES`,
33
+ `RULE_OPERATORS` and `RELATIONSHIP_JOIN_TYPES` join `SQL_DIALECTS` and `CONSTRAINT_TYPES`, which
34
+ move to the same module and keep their existing import paths.
35
+
36
+ ```ts
37
+ import {
38
+ CONSTRAINT_SCOPES,
39
+ metastoreErrorMessage,
40
+ } from "@keboola/api-client/sdk/semanticLayer";
41
+ import type { SemanticConstraintScope } from "@keboola/api-client/sdk/semanticLayer/types";
42
+
43
+ // a total label map, so a scope the metastore adds is a compile error rather than a missing option
44
+ const SCOPE_LABELS: Record<SemanticConstraintScope, string> = {
45
+ global: "Global" /* … */,
46
+ };
47
+ const options = CONSTRAINT_SCOPES.map((value) => ({
48
+ value,
49
+ label: SCOPE_LABELS[value],
50
+ }));
51
+ ```
52
+
53
+ - Each union in `./types` is now derived from its list rather than spelled out again, so the type
54
+ and the list a validator or a dropdown is built from cannot disagree. `SemanticConstraintSeverity`
55
+ and `SemanticRelationshipJoinType` are named for the first time; they were inline unions on
56
+ `SemanticConstraintData.severity` and `SemanticRelationshipData.type`.
57
+ - The `./sdk/semanticLayer/types` entry point stays free of runtime code — the derivation reads the
58
+ lists through an `import type`.
59
+ - `metastoreErrorMessage(body)` reads the one field that says what is actually wrong with a
60
+ rejected write (`errors[0].message`, e.g. `missing property 'fqn'`). The status and the
61
+ response's own message say no more than "Validation failed". Any other shape returns `undefined`,
62
+ so a caller keeps its own fallback.
63
+
64
+ - Reach several projects from one bearer session with `session.forProject(projectId)`
65
+
66
+ A bearer access token is a user token — project scope is a single `X-KBC-ProjectId` header — so one
67
+ session can legitimately address many projects. Until now only the scoped project had clients, and
68
+ the obvious workaround was a second `createKeboola()`, which signs both instances out: they hold the
69
+ same single-use refresh token, and the first to rotate invalidates the other's.
70
+
71
+ `session.forProject(projectId)` returns that project's `ProjectClients` off the session in hand,
72
+ reusing its credential and auth middleware, so a token rotation happens once for every project rather
73
+ than once each. `setProjectAsync` moves the session (and `api`); `forProject` adds a project alongside
74
+ it. A project is bootstrapped once and concurrent callers share that build; a failed build is
75
+ retryable.
76
+
77
+ Every client set is pinned to the sign-in that built it, so `reset()` is a teardown rather than a
78
+ cache eviction — a set held across a sign-out throws `NotAuthenticated` on its next request, the 401
79
+ replay included, instead of quietly acting as whoever signed in after. `clearProject()` drops the
80
+ scope, not the credential, and leaves the extra projects alone. Nothing extra is persisted.
81
+
82
+ The same pin covers every other surface that emits this session's credential.
83
+ `api.storage`/`api.context` and `api.management` rebuild on sign-out, but that could not stop a
84
+ request already in flight from completing as the next user, with the previous project's
85
+ `X-KBC-ProjectId` still on it. `session.getAuthHeaders()` resolved to the dead session's token and
86
+ project, because the proactive rotation swallows its own refusal. A token rotation is pinned to the
87
+ sign-in that spent the refresh token, so one resolving after its own session ended is dropped rather
88
+ than written over the credential of whoever signed in since, and a sign-out abandons the in-flight
89
+ rotation so the next session starts its own. `api.auth` is built once per stack and serves every
90
+ session, so it pins each _request_ to the sign-in that started it: a 401 recovery no longer replays
91
+ as the next user, while `login` still goes out unstamped. `session.restore()` is pinned too — a
92
+ sign-out landing while the stored token is being exchanged resolves `empty` instead of signing the
93
+ user back in.
94
+
95
+ The guard wraps the **credential**, not only the outgoing request, because the 401 path rotates the
96
+ token by calling the credential directly: a straggler from a dead session would otherwise spend the
97
+ live session's single-use refresh token, and sign that session out if the rotation itself came back 401.
98
+
99
+ The pin covers the failure branches too, which is where it was missed. A retry re-invokes `next`,
100
+ so `retryContention` is composed _inside_ the pin rather than beside it in the auth client's
101
+ middleware array — outside it, an `api.auth` request that hit a 503 re-pinned per attempt and the
102
+ retry went out as whoever signed in during the backoff. And a rotation or a restore that _fails_
103
+ after its session ended is re-labelled `NotAuthenticated` before the error travels on: a raw 401
104
+ reads as "this credential is dead" to the credential and as "the stored token is dead" to
105
+ `restore()`, so a straggler used to sign out the session that replaced it, and a losing concurrent
106
+ restore used to clear the winner's stored session — leaving it alive in memory and gone on the next
107
+ reload.
108
+
109
+ A project the session cannot reach now fails its own build and nothing else. Connection answers a
110
+ denied or nonexistent project with the same `invalid_token` 401 as a revoked token, so `forProject`
111
+ reads a 401 that survives a token rotation as being about the project rather than the credential —
112
+ a mistyped project id used to sign the whole session out.
113
+
114
+ `ProjectClients` is now exported as a type.
115
+
116
+ ### Patch Changes
117
+
118
+ - `kaiAgent`'s spend-caps response gains `defaultProjectCapPpu` — the bare platform default project
119
+ cap, independent of what's persisted. Previously only `effectiveProjectCapPpu` (the server's
120
+ resolution of the _persisted_ cap) was exposed, which a consumer could not use to validate a
121
+ cleared-but-unsaved project-cap field against the true default.
122
+
123
+ - `kaiAgent`'s generated schema is regenerated against the deployed spec, so `getUsage` reports the
124
+ spend-cap scope and the one project-level figure a plain member is shown.
125
+ - `getUsage` gains `ppuLimitScope: 'user' | 'project' | null` — which ceiling stops the caller next.
126
+ A label, never a figure: the project's absolute budget stays admin-only.
127
+ - `getUsage` gains `projectPpuPercentage: number | null` — how much of the project's cap is spent.
128
+ It is the fallback a caller with no personal `ppuLimit` is measured against, and `null` only
129
+ where no project cap applies at all.
130
+ - `getChat` gains `ppuPercentage: number | null`, the same figure alongside a conversation.
131
+ - The `rate_limit` error `subtype` splits `monthly_credits` into `monthly_credits_user` and
132
+ `monthly_credits_project`.
133
+ - Additive drift the same regeneration picked up: the `/api/settings/spend-caps` pair, the
134
+ `/api/chat/{id}/sandbox/file/download` path, and a `payload_too_large` error type with its 413.
135
+
136
+ - `Result` gains constructors, guards and combinators, so code that returns a `Result` of its own no
137
+ longer writes the object literal, and code that consumes one no longer branches on `success` by
138
+ hand.
139
+
140
+ ```ts
141
+ import { Result } from "@keboola/api-client";
142
+
143
+ const getStack = (id: string): Result<Stack> =>
144
+ stacks.has(id)
145
+ ? Result.success(stacks.get(id))
146
+ : Result.failure(new Error(`No stack "${id}"`));
147
+
148
+ // handle both branches in one expression, Rust-match style
149
+ const label = Result.match(
150
+ getStack(id),
151
+ (stack) => stack.name,
152
+ (error) => error.message,
153
+ );
154
+
155
+ // at a layer boundary, relabel the failure as the error this layer speaks, then throw it
156
+ const stack = Result.unwrap(
157
+ Result.mapError(
158
+ getStack(id),
159
+ () => new KeboolaError(KeboolaErrorType.Unconfigured),
160
+ ),
161
+ );
162
+ ```
163
+
164
+ - `success` is `Result<T, never>` and `failure` is `Result<never, E>`, so either widens into any
165
+ `Result<T, E>` without an annotation. `Success<T>` and `Failure<E>` name the two branches.
166
+ - `isSuccess` / `isFailure` are type guards; `map`, `mapError` and `andThen` rewrite one branch
167
+ and pass the other through untouched.
168
+ - `match(result, onSuccess, onFailure)` returns whichever callback ran, so the two must agree on a
169
+ type; `void` works. `unwrap` throws the error as-is; `unwrapOr` returns a fallback instead.
170
+ - `tryCatch` and `fromThrowable` reject a task that returns a promise at the type level, since they
171
+ would report success before it settles. Use `tryCatchAsync` / `fromThrowableAsync` for those.
172
+
173
+ - `TableDetail` declares the three freshness fields the detail response carries: `lastImportDate`,
174
+ `lastChangeDate` and `rowsCount`.
175
+
176
+ ```ts
177
+ const table = await api.storage.tables.getTable({ branchId, id });
178
+ // `null` is the table's own answer — nothing has ever been written into it.
179
+ if (table.lastImportDate === null) return "Nothing loaded yet";
180
+ ```
181
+
182
+ - Declared required, where `TableDetailResponse` in the generated schema marks them optional. That
183
+ node marks `?` on every nullable field it has, so the marker conflates "nullable" with
184
+ "optional"; `TableCreateResponse` — which the table list reuses — and `AliasFilterSetResponse`
185
+ declare the same fields required-and-nullable. `Table` and `TableDetail` now agree on all three.
186
+ - `null` means different things per field, and each one says so: never written into
187
+ (`lastImportDate`), and Storage declining to count rather than a count of zero (`rowsCount`).
188
+
189
+ - `isTimeoutError` joins `isAbortError` in the fetch-client error taxonomy, exported from both
190
+ `@keboola/api-client` and `@keboola/api-client/fetchClient`.
191
+
192
+ ```ts
193
+ import { isTimeoutError } from "@keboola/api-client";
194
+
195
+ // `DOMException('signal timed out', 'TimeoutError')` — what an `AbortSignal.timeout` rejects with.
196
+ if (isTimeoutError(error)) return null;
197
+ ```
198
+
199
+ - Matches on `DOMException.name`, since the message is a browser string rather than a contract.
200
+ - Distinct from `isAbortError`: a timeout is the deadline expiring, an abort is someone cancelling.
201
+ - `xhrFetch` is not covered — its `handleAbort` builds an `AbortError` without reading
202
+ `signal.reason`, so a timeout on that transport reports as a cancel.
203
+
204
+ `@keboola/sentry`'s shared `beforeSend` is the first caller: a request that never got a response
205
+ measures the network, not the code, and reports with no stacktrace.
206
+
207
+ - Security patches for transitive dependencies: qs 6.16.0 in api-client, mermaid 11.17.2 and dompurify
208
+ 3.4.14 in design.
209
+
210
+ No API or behaviour change in either package.
211
+
212
+ - Interpret the org-admin `kai-assistant.monthlyCreditsLimitPerUser` Storage key as PPU (the same
213
+ unit an admin sees and sets everywhere else, per AI-3628), converting it to the internal
214
+ Kai-credits ceiling at the read boundary. `@keboola/api-client`'s kai-agent schema regenerated to
215
+ pick up `ppuUsed`/`ppuLimit` on `GET /api/usage`; `@keboola/kai-fake-agent`'s stub updated to match.
216
+ `@keboola/kai-agent` and `@keboola/kbc-ui` are private, nothing to release for them — acknowledged
217
+ so `changeset status` doesn't choke on them alongside the real `@keboola/api-client` release.
218
+
219
+ - Show Kai spend caps in project settings and scope-aware chat copy (AI-3738).
220
+
221
+ `@keboola/api-client`'s kai-agent client/surface-docs regenerated for the spend-caps endpoints;
222
+ `@keboola/constants`, `@keboola/kai-fake-agent`, `@keboola/kai-agent` and `@keboola/kbc-ui` are
223
+ private, nothing to release for them — acknowledged so `changeset status` doesn't choke on them.
224
+
225
+ ## 32.0.0
226
+
227
+ ### Major Changes
228
+
229
+ - Adopt Connection's OpenAPI spec fixes across the storage, management and auth clients.
230
+
231
+ Breaking changes to the storage surface:
232
+ - `workspaceId` is a `number` on all nine workspace operations, and `versionId` a `number` on the
233
+ configuration-version ones — both were `string` on some and `number` on others.
234
+ - `branchId` is the `string` the spec declares, and is now required: `configurations`,
235
+ `configurationRows`, `configurationVersions`, `configurationMetadata`, `components` and `events`
236
+ no longer default it to `'default'`. `components.getComponents` and
237
+ `configurations.searchComponentConfigurations` therefore take an argument.
238
+ - `metadataId` is the spec's integer on all nine metadata deletes; the `MetadataId` alias is gone.
239
+ - `DevBranch` is a union discriminated on `isDefault`, since the default branch carries no
240
+ `creatorToken`.
241
+ - `deleteWorkspaceJob` is renamed `deleteWorkspaceAsync`.
242
+ - `File.sizeBytes` is nullable, as the serializer returns.
243
+ - `BranchMetadataEntry`, `BranchMetadataRaw` and `PreparedFile` are removed — all three unused.
244
+
245
+ New: a per-call `parseAs` option on every client method (`'auto' | 'text' | 'json' | 'blob'`),
246
+ defaulting to the existing content-type dispatch. `storage.files.getFileContent` uses it to return
247
+ a file's exact bytes instead of re-serialising JSON files.
248
+
249
+ - `STACKS` is typed by its own key set instead of `Record<string, …>`. A name the registry does not
250
+ carry is now a compile error at the call site, so code can read `STACKS.US_EAST_1_AWS.host` without
251
+ an `undefined` to fall back from. The entries and their `KeboolaStack` value type are unchanged.
252
+
253
+ Breaking for typed consumers: a lookup by a non-literal key — `STACKS[someRuntimeString]` — stops
254
+ type-checking. Narrow the key first (`if (key in STACKS)`), or iterate `Object.values(STACKS)` when
255
+ the name itself does not matter.
256
+
257
+ ### Minor Changes
258
+
259
+ - Let a bearer session hand out the headers for a request the client does not make itself.
260
+
261
+ `session.getAuthHeaders()` resolves `Authorization: Bearer <token>` plus `X-KBC-ProjectId`, going through the credential on every call — so a near-expiry token rotates and a revoked one is never re-sent. It exists for transports this package does not own, chiefly the chat SSE stream whose `fetch` the AI SDK holds; anything with a service client on `api` should keep using that.
262
+
263
+ It returns the assembled bag rather than the access token, so no caller handles the credential as a bare string and the project header is composed in one place. An anonymous or unscoped session throws instead of emitting a half-formed `Bearer null`.
264
+
265
+ - Microsoft Graph joins the SDK as a standalone client on two new sub-paths, `@keboola/api-client/microsoftGraph` and `@keboola/api-client/microsoftGraph/types`.
266
+
267
+ ```ts
268
+ import {
269
+ createMicrosoftGraphAuthMiddleware,
270
+ createMicrosoftGraphClient,
271
+ } from "@keboola/api-client/microsoftGraph";
272
+
273
+ // The client holds no credential — auth arrives as a middleware. Not a singleton either: a Graph
274
+ // token is minted per user interaction by your own OAuth flow (MSAL in the browser) and is scoped
275
+ // to one account, so build a client where you hold it. There is no `sdks/microsoftGraph/` because
276
+ // MSAL owns refresh; this package has no token state to manage.
277
+ const graph = createMicrosoftGraphClient({
278
+ middlewares: [createMicrosoftGraphAuthMiddleware(accessToken)],
279
+ });
280
+ const item = await graph.getFile(driveId, fileId, signal);
281
+ ```
282
+
283
+ It exposes `getMySite`, `getMyDrive`, `getFile` and `getDriveItemBySharingUrl` (which redeems a sharing URL into the real `DriveItem`, for "Shared with me" SharePoint files the picker returns with empty ids). Graph is not a Keboola service, so — like `assets` and `status` — it is **not** on `api.*` and is never registered in `createServiceClients.ts`; it also defaults its own `baseUrl`, since a vendor's host and version prefix are part of its API contract rather than something we discover, and it carries no `healthCheck`.
284
+
285
+ Types come from Microsoft's own OpenAPI document, but **vendored as a slice** rather than fetched whole: the published v1.0 description covers all of Graph at ~41MB and generates 35MB of `.d.ts`, which this package's declaration emit crashes on (`rolldown-plugin-dts` throws; the previous tsup build hit `ERR_WORKER_OUT_OF_MEMORY` on the same file) and which would ship in the tarball. A `gen:types` run that selects `microsoftGraph` vendors a slice of only the operations the client calls, then generates from it (~650KB of declarations); runs that don't select it never touch the slice. Adding an operation means listing its path in `scripts/vendor-microsoft-graph-spec.mjs`; see `docs/regenerate-api-types.md`.
286
+
287
+ The client wires **no transport-level retry**, matching every other client here — where superagent
288
+ applied 3 attempts (network errors, and 5xx on GET), a transient Graph 503 now surfaces to the caller
289
+ on the first failure. Consumers that want retry choose it per call site: TanStack Query's `retry` for
290
+ a query, or `createRetryMiddleware` in `middlewares` for a client whose every call should retry. The
291
+ OneDrive pickers deliberately take neither — they run inside an interactive MSAL flow where a silent
292
+ multi-second retry is worse than a prompt failure the user can act on.
293
+
294
+ One fix reaches beyond this client: `OpenapiSuccessType` now understands OpenAPI 3 **range** response codes (`2XX`). Operations declaring a range instead of an explicit status previously resolved to `unknown`; ranges are checked after the explicit codes, so a spec declaring both still resolves to the precise one.
295
+
296
+ - Consumers can now import the kai-agent client directly from `@keboola/api-client/kaiAgent` instead of going through the main barrel.
297
+
298
+ - `@keboola/api-client/kaiAgent/types` is now its own subpath, exporting `ChatWithMessages` for the `/api/chat/{id}` response — so consumers can derive the chat-detail shape from kai-agent's spec instead of transcribing it.
299
+
300
+ ### Patch Changes
301
+
302
+ - Add organization-admin permission predicates (AI-3738).
303
+
304
+ `domain/permissions/organization.ts` (previously an empty placeholder) now exports
305
+ `isOrganizationMember`, `isOrganizationAdmin`, `canWriteKaiSpendCaps`, plus
306
+ `assertCanAdministerOrganization`/`assertCanWriteKaiSpendCaps` (`isOrganizationMember` is a raw
307
+ signal with no assert pair), mirroring `admin.ts`'s conventions — `canWriteKaiSpendCaps` is
308
+ strictly stricter than the existing `canWriteKaiSettings` (admin/share only vs. organization-admin
309
+ only).
310
+
311
+ - Shrink the permission tests' `StorageToken` fixture to the fields they read.
312
+
313
+ `buildStorageToken` transcribed all ~40 fields of the contract shape so it could be annotated `: StorageToken`. Its consumers read three of them — `isMasterToken`, `admin.{role,isOrganizationMember}` — plus `owner.{features,hasSnowflake,hasBigquery}` via `createProject()`, and its `features` / `adminFeatures` options were passed by no caller. The fixture now builds only that, cast at the boundary; the contract-typed `StorageToken` fixtures live in `@keboola/api-fixtures`, which is where a field the backend adds should fail to compile. No published behaviour changes.
314
+
315
+ - Add a `storage.bootstrap` fixture slice — the three responses a client's ready gate needs before
316
+ it is usable (`GET /v2/storage`, `/v2/storage/tokens/verify`, `/v2/storage/dev-branches`).
317
+
318
+ `getStackInfo()`, `verifyStorageToken()` and `getDevBranches()` are typed by
319
+ `@keboola/api-client/storage/types`, so a field the backend adds arrives with `pnpm gen:types`
320
+ rather than being transcribed into every MSW test that bootstraps a client. `getStackInfo()`
321
+ announces every service by default, which is what keeps a test's queue / data-science / vault
322
+ client from being a dummy that throws `ServiceUnavailableError`; pass `services` to narrow it.
323
+
324
+ `@keboola/api-client` gains a runtime `ServiceId` const in `@keboola/api-client/constants`, with
325
+ the `ServiceId` type now derived from it. Announcing every service is exhaustive by construction:
326
+ a service added to the client flows into the fixture without an edit.
327
+
328
+ `@keboola/api-client-react`'s test fixtures now come from the slice; its published output is unchanged.
329
+
3
330
  ## 31.0.0
4
331
 
5
332
  ### Minor Changes
package/README.md CHANGED
@@ -522,24 +522,20 @@ apis:
522
522
 
523
523
  #### Step 2: Generate Types
524
524
 
525
- Run the type generation command:
525
+ Name the service you just registered, so the other schemas stay untouched:
526
526
 
527
527
  ```bash
528
- pnpm gen:types
528
+ pnpm --filter @keboola/api-client gen:types yourNewService
529
529
  ```
530
530
 
531
- This will create the TypeScript definitions at the specified output path. Leave the generated file's
532
- contents alone — `oxlint.config.ts` turns `consistent-type-definitions` off for
531
+ This will create the TypeScript definitions at the specified output path, already formatted. Leave
532
+ the generated file's contents alone — `oxlint.config.ts` turns `consistent-type-definitions` off for
533
533
  `src/clients/*/__generated__/*.d.ts`, so the `export interface operations` the generator emits
534
- despite `--export-type` is fine as it stands. Two mechanical steps do follow: run `oxfmt` on the new
535
- file (the raw output is 4-space), and revert the other schemas the command regenerated — it rewrites
536
- all of them, mostly reformatting. See
537
- [`docs/regenerate-api-types.md`](./docs/regenerate-api-types.md).
534
+ despite `--export-type` is fine as it stands.
538
535
 
539
- `gen:types` regenerates every source in `redocly.yaml`, so to generate only the new one, run
540
- `openapi-typescript` directly against its URL from a directory without a `redocly.yaml` (it
541
- auto-discovers the file up the tree and ignores a positional URL when it finds one) with an absolute
542
- `--output`.
536
+ Passing no service regenerates every source in `redocly.yaml`, which is a full refresh, not what
537
+ adding one client calls for. See [`docs/regenerate-api-types.md`](./docs/regenerate-api-types.md)
538
+ for the local-backend workflow and for services with no `redocly.yaml` entry.
543
539
 
544
540
  #### Step 3: Create the Client Implementation
545
541
 
@@ -624,15 +620,42 @@ import { createYourNewServiceClient } from './clients/yourNewService';
624
620
 
625
621
  ### Adding a New Generic Client
626
622
 
627
- Follow the same steps but use `createGenericFetchClient` instead of `createOpenapiFetchClient`. No `redocly.yaml` registration or `pnpm gen:types` step is needed. Define request/response types manually.
623
+ Follow the same steps but use `createGenericFetchClient` instead of `createOpenapiFetchClient`. No `redocly.yaml` registration or `gen:types` step is needed. Define request/response types manually.
624
+
625
+ ### `gen:types` — regenerating OpenAPI types
626
+
627
+ Every `__generated__/schema.d.ts` comes out of one command, scoped to the services you name:
628
+
629
+ ```bash
630
+ pnpm --filter @keboola/api-client gen:types --list # what can be regenerated
631
+ pnpm --filter @keboola/api-client gen:types storage # one service — leaves the rest alone
632
+ pnpm --filter @keboola/api-client gen:types chat queue # several
633
+ pnpm --filter @keboola/api-client gen:types # every API in redocly.yaml
634
+
635
+ # One service's spec from a local dev server instead of its registered URL:
636
+ pnpm --filter @keboola/api-client gen:types chat --url http://localhost:3001/api/docs
628
637
 
629
- ### OpenAPI Type Generation Workflow
638
+ ```
630
639
 
631
- 1. Update API specifications (if needed, edit `redocly.yaml`)
632
- 2. Run `pnpm gen:types` to regenerate TypeScript definitions
633
- 3. Review generated files in `__generated__/` directories
634
- 4. Update client implementation if the API surface changed
635
- 5. Always commit generated files to version control
640
+ A service is named by its `redocly.yaml` key. Local-backend ports for `chat` and `kaiAgent` are in
641
+ [`docs/regenerate-api-types.md`](./docs/regenerate-api-types.md).
642
+
643
+ How it behaves:
644
+
645
+ - **Only the named services' `schema.d.ts` files are rewritten**; every other schema is untouched.
646
+ (`openapi-typescript` has no per-API flag, so the script hands it a filtered copy of
647
+ `redocly.yaml` in a temp directory.)
648
+ - **Output is committable as generated** — the script runs `oxfmt` over it, so a diff is the spec
649
+ change, not whitespace. Commit the generated files.
650
+ - **Bad invocations exit non-zero** with the service listing appended: an unknown service name, or
651
+ `--url` with anything but exactly one service.
652
+ - **`microsoftGraph` is the one local `root`** — a committed slice of Microsoft's ~41MB Graph
653
+ document. A run that selects it re-vendors the slice from upstream first, so naming the service
654
+ fetches its current spec exactly as every URL root does; a run that doesn't select it can never
655
+ re-pin the slice. If the download fails, or an operation in the slice no longer exists upstream
656
+ (a Microsoft rename), the run warns, keeps the committed slice, and carries on — it only
657
+ hard-fails when there is no committed slice to fall back on. Why a slice at all:
658
+ [`scripts/vendor-microsoft-graph-spec.mjs`](./scripts/vendor-microsoft-graph-spec.mjs).
636
659
 
637
660
  ### redocly.yaml Configuration Reference
638
661
 
@@ -643,3 +666,6 @@ apis:
643
666
  x-openapi-ts:
644
667
  output: ./src/clients/serviceName/__generated__/schema.d.ts
645
668
  ```
669
+
670
+ `root` is normally a URL the generator fetches; the one local-file `root` (`microsoftGraph`) is the
671
+ vendored slice described in the [`gen:types` section](#gentypes--regenerating-openapi-types) above.
@@ -1,4 +1,4 @@
1
- const require_createFetchClient = require("./createFetchClient-B9Cv0W9f.cjs");
1
+ const require_createFetchClient = require("./createFetchClient-DvZvD31l.cjs");
2
2
  //#region src/errors/ManagementClientAuthError.ts
3
3
  var ManagementClientAuthError = class extends require_createFetchClient.ApiError {
4
4
  title;
@@ -17,4 +17,4 @@ Object.defineProperty(exports, "ManagementClientAuthError", {
17
17
  }
18
18
  });
19
19
 
20
- //# sourceMappingURL=ManagementClientAuthError-DFhi5yxe.cjs.map
20
+ //# sourceMappingURL=ManagementClientAuthError-DqeXL8nv.cjs.map