@keboola/api-client 32.0.0 → 34.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 (447) hide show
  1. package/AGENTS.md +82 -4
  2. package/API-SURFACE.md +19 -2
  3. package/CHANGELOG.md +465 -0
  4. package/dist/{ManagementClientAuthError-B-tyPlyG.cjs → ManagementClientAuthError-DD4u0EU7.cjs} +2 -2
  5. package/dist/{ManagementClientAuthError-B-tyPlyG.cjs.map → ManagementClientAuthError-DD4u0EU7.cjs.map} +1 -1
  6. package/dist/{ManagementClientAuthError-BAFNvOdf.js → ManagementClientAuthError-ey-f03vy.js} +2 -2
  7. package/dist/{ManagementClientAuthError-BAFNvOdf.js.map → ManagementClientAuthError-ey-f03vy.js.map} +1 -1
  8. package/dist/{ValidationError-CzPWydEb.js → ValidationError-BekhphAq.js} +11 -7
  9. package/dist/ValidationError-BekhphAq.js.map +1 -0
  10. package/dist/{ValidationError-h5qvwahi.cjs → ValidationError-CLVJCCwH.cjs} +16 -6
  11. package/dist/ValidationError-CLVJCCwH.cjs.map +1 -0
  12. package/dist/ai/index.cjs +2 -2
  13. package/dist/ai/index.d.cts +2 -2
  14. package/dist/ai/index.d.ts +2 -2
  15. package/dist/ai/index.js +2 -2
  16. package/dist/ai/types.d.cts +1 -1
  17. package/dist/ai/types.d.ts +1 -1
  18. package/dist/{appLogs-NIEDTDHf.cjs → appLogs-BjfUoWzs.cjs} +2 -2
  19. package/dist/{appLogs-NIEDTDHf.cjs.map → appLogs-BjfUoWzs.cjs.map} +1 -1
  20. package/dist/{appLogs-DX_WTBCa.d.ts → appLogs-Ch7DYpzx.d.ts} +2 -2
  21. package/dist/{appLogs-BAaaGYKg.d.cts → appLogs-D5A13Y0y.d.cts} +2 -2
  22. package/dist/{appLogs-DTLE6HTy.js → appLogs-xsVkTriU.js} +2 -2
  23. package/dist/{appLogs-DTLE6HTy.js.map → appLogs-xsVkTriU.js.map} +1 -1
  24. package/dist/apps/index.cjs +3 -3
  25. package/dist/apps/index.d.cts +3 -3
  26. package/dist/apps/index.d.ts +3 -3
  27. package/dist/apps/index.js +3 -3
  28. package/dist/apps/types.d.cts +2 -2
  29. package/dist/apps/types.d.ts +2 -2
  30. package/dist/assets/index.cjs +1 -1
  31. package/dist/assets/index.d.cts +1 -1
  32. package/dist/assets/index.d.ts +1 -1
  33. package/dist/assets/index.js +1 -1
  34. package/dist/auth/index.cjs +1 -1
  35. package/dist/auth/index.d.cts +1 -1
  36. package/dist/auth/index.d.ts +1 -1
  37. package/dist/auth/index.js +1 -1
  38. package/dist/auth/types.d.cts +2 -2
  39. package/dist/auth/types.d.ts +2 -2
  40. package/dist/{auth-DP-6TFiM.cjs → auth-JQ33o3nU.cjs} +2 -2
  41. package/dist/{auth-DP-6TFiM.cjs.map → auth-JQ33o3nU.cjs.map} +1 -1
  42. package/dist/{auth-DtbQaeDj.js → auth-aItmDu45.js} +2 -2
  43. package/dist/{auth-DtbQaeDj.js.map → auth-aItmDu45.js.map} +1 -1
  44. package/dist/{authClient-DhfzOUaa.d.cts → authClient-CTHNs6Tq.d.cts} +6 -6
  45. package/dist/{authClient--BtZgjIc.js → authClient-D7W9vWPR.js} +43 -9
  46. package/dist/authClient-D7W9vWPR.js.map +1 -0
  47. package/dist/{authClient-CtfyVHRD.d.ts → authClient-D8i3JTM-.d.ts} +6 -6
  48. package/dist/{authClient-b7uec7sw.cjs → authClient-_PpvGgZJ.cjs} +43 -9
  49. package/dist/authClient-_PpvGgZJ.cjs.map +1 -0
  50. package/dist/billing/index.cjs +46 -0
  51. package/dist/billing/index.cjs.map +1 -0
  52. package/dist/billing/index.d.cts +48 -0
  53. package/dist/billing/index.d.ts +48 -0
  54. package/dist/billing/index.js +45 -0
  55. package/dist/billing/index.js.map +1 -0
  56. package/dist/billing/types.cjs +0 -0
  57. package/dist/billing/types.d.cts +635 -0
  58. package/dist/billing/types.d.ts +635 -0
  59. package/dist/billing/types.js +1 -0
  60. package/dist/chat/index.cjs +3 -3
  61. package/dist/chat/index.d.cts +2 -2
  62. package/dist/chat/index.d.ts +2 -2
  63. package/dist/chat/index.js +3 -3
  64. package/dist/chat/types.cjs +18 -0
  65. package/dist/chat/types.cjs.map +1 -1
  66. package/dist/chat/types.d.cts +2 -2
  67. package/dist/chat/types.d.ts +2 -2
  68. package/dist/chat/types.js +18 -1
  69. package/dist/chat/types.js.map +1 -1
  70. package/dist/{configurations-d7SZmw69.js → configurations-BVvcimzo.js} +17 -2
  71. package/dist/configurations-BVvcimzo.js.map +1 -0
  72. package/dist/{configurations-CqwAxiQL.cjs → configurations-CyFF9Dtu.cjs} +22 -1
  73. package/dist/configurations-CyFF9Dtu.cjs.map +1 -0
  74. package/dist/{configurations-ZwBXilW-.js → configurations-VtNE0nrT.js} +2 -2
  75. package/dist/{configurations-ZwBXilW-.js.map → configurations-VtNE0nrT.js.map} +1 -1
  76. package/dist/{configurations-Ck-mNB_E.cjs → configurations-zkNjr73Q.cjs} +2 -2
  77. package/dist/{configurations-Ck-mNB_E.cjs.map → configurations-zkNjr73Q.cjs.map} +1 -1
  78. package/dist/constants/index.cjs +1 -1
  79. package/dist/constants/index.d.cts +1 -1
  80. package/dist/constants/index.d.ts +1 -1
  81. package/dist/constants/index.js +1 -1
  82. package/dist/{constants-lIfSdTzS.cjs → constants-C4DlsF_M.cjs} +3 -2
  83. package/dist/constants-C4DlsF_M.cjs.map +1 -0
  84. package/dist/{constants-ByEwVtGf.js → constants-wfbFsqqN.js} +3 -2
  85. package/dist/constants-wfbFsqqN.js.map +1 -0
  86. package/dist/{createFetchClient-BRfTjBLV.cjs → createFetchClient-DgMiqTJ8.cjs} +26 -4
  87. package/dist/createFetchClient-DgMiqTJ8.cjs.map +1 -0
  88. package/dist/{createFetchClient-BbG46bL0.js → createFetchClient-U-ZrwPl2.js} +15 -5
  89. package/dist/createFetchClient-U-ZrwPl2.js.map +1 -0
  90. package/dist/{createGenericFetchClient-DHs-i7_O.cjs → createGenericFetchClient-o3cPJeRn.cjs} +2 -2
  91. package/dist/{createGenericFetchClient-DHs-i7_O.cjs.map → createGenericFetchClient-o3cPJeRn.cjs.map} +1 -1
  92. package/dist/{createGenericFetchClient-BHYQLZhe.js → createGenericFetchClient-rxvUUbap.js} +2 -2
  93. package/dist/{createGenericFetchClient-BHYQLZhe.js.map → createGenericFetchClient-rxvUUbap.js.map} +1 -1
  94. package/dist/{createOpenapiFetchClient-Bn6_Pn0H.js → createOpenapiFetchClient-BVSc9ibR.js} +2 -2
  95. package/dist/{createOpenapiFetchClient-Bn6_Pn0H.js.map → createOpenapiFetchClient-BVSc9ibR.js.map} +1 -1
  96. package/dist/{createOpenapiFetchClient-CyDUFxHB.cjs → createOpenapiFetchClient-DhUU3M1W.cjs} +2 -2
  97. package/dist/{createOpenapiFetchClient-CyDUFxHB.cjs.map → createOpenapiFetchClient-DhUU3M1W.cjs.map} +1 -1
  98. package/dist/{credential-d2RDcXRB.js → credential-CihSf_xs.js} +7 -4
  99. package/dist/credential-CihSf_xs.js.map +1 -0
  100. package/dist/{credential-DOXH7XRS.cjs → credential-DVWvJFJs.cjs} +7 -4
  101. package/dist/credential-DVWvJFJs.cjs.map +1 -0
  102. package/dist/dataScience/index.cjs +2 -2
  103. package/dist/dataScience/index.d.cts +2 -2
  104. package/dist/dataScience/index.d.ts +2 -2
  105. package/dist/dataScience/index.js +2 -2
  106. package/dist/dataScience/types.d.cts +2 -2
  107. package/dist/dataScience/types.d.ts +2 -2
  108. package/dist/{dataScience-wexHEIue.cjs → dataScience-0Rl_EuV_.cjs} +5 -5
  109. package/dist/{dataScience-wexHEIue.cjs.map → dataScience-0Rl_EuV_.cjs.map} +1 -1
  110. package/dist/{dataScience-Sm8iONhP.js → dataScience-C1gO5zUn.js} +5 -5
  111. package/dist/{dataScience-Sm8iONhP.js.map → dataScience-C1gO5zUn.js.map} +1 -1
  112. package/dist/developerPortal/index.cjs +1 -1
  113. package/dist/developerPortal/index.d.cts +2 -2
  114. package/dist/developerPortal/index.d.ts +2 -2
  115. package/dist/developerPortal/index.js +1 -1
  116. package/dist/developerPortal/types.d.cts +1 -1
  117. package/dist/developerPortal/types.d.ts +1 -1
  118. package/dist/{developerPortalClient-DywKpDlW.js → developerPortalClient-C_48z8BN.js} +3 -3
  119. package/dist/{developerPortalClient-DywKpDlW.js.map → developerPortalClient-C_48z8BN.js.map} +1 -1
  120. package/dist/{developerPortalClient-CgTSzLoG.cjs → developerPortalClient-ki0XS_OD.cjs} +3 -3
  121. package/dist/{developerPortalClient-CgTSzLoG.cjs.map → developerPortalClient-ki0XS_OD.cjs.map} +1 -1
  122. package/dist/domain/permissions/index.cjs +2 -1
  123. package/dist/domain/permissions/index.d.cts +18 -3
  124. package/dist/domain/permissions/index.d.ts +18 -3
  125. package/dist/domain/permissions/index.js +2 -2
  126. package/dist/editor/index.cjs +2 -2
  127. package/dist/editor/index.d.cts +2 -2
  128. package/dist/editor/index.d.ts +2 -2
  129. package/dist/editor/index.js +2 -2
  130. package/dist/editor/types.d.cts +1 -1
  131. package/dist/editor/types.d.ts +1 -1
  132. package/dist/emitter-dLF1Fyfg.d.cts +11 -0
  133. package/dist/emitter-dLF1Fyfg.d.ts +11 -0
  134. package/dist/encryption/index.cjs +1 -1
  135. package/dist/encryption/index.d.cts +1 -1
  136. package/dist/encryption/index.d.ts +1 -1
  137. package/dist/encryption/index.js +1 -1
  138. package/dist/encryption/types.d.cts +1 -1
  139. package/dist/encryption/types.d.ts +1 -1
  140. package/dist/import/index.cjs +1 -1
  141. package/dist/import/index.d.cts +3 -3
  142. package/dist/import/index.d.ts +3 -3
  143. package/dist/import/index.js +1 -1
  144. package/dist/{import-C0-y1GQK.cjs → import-C83w7BKz.cjs} +3 -3
  145. package/dist/{import-C0-y1GQK.cjs.map → import-C83w7BKz.cjs.map} +1 -1
  146. package/dist/{import-SQuurg1G.js → import-CROEK82b.js} +3 -3
  147. package/dist/{import-SQuurg1G.js.map → import-CROEK82b.js.map} +1 -1
  148. package/dist/{index-fHfc_VqS.d.ts → index-3LUk2rpD.d.ts} +4 -4
  149. package/dist/{index-Dbzjvy5h.d.ts → index-6Xe81qN3.d.ts} +5 -5
  150. package/dist/{index-Bjk-tCpG.d.cts → index-BLx14ZI4.d.cts} +306 -205
  151. package/dist/{index-DiHHyMEo.d.cts → index-BgLnWTZU.d.cts} +6 -6
  152. package/dist/{index-Bc_hXWae.d.ts → index-BuegqrS1.d.ts} +3 -3
  153. package/dist/{index-GDdFZCXp.d.ts → index-C77vTm2K.d.ts} +4 -4
  154. package/dist/{index-CXtdQ7be.d.cts → index-CW3Pj7DY.d.cts} +4 -4
  155. package/dist/{index-Bg1P6Bb2.d.ts → index-CqgtL2NU.d.ts} +6 -6
  156. package/dist/{index-DeKPpYQy.d.ts → index-D8rcUbnk.d.ts} +3 -3
  157. package/dist/{index-FhKX7Cv1.d.ts → index-DFBFa3SS.d.ts} +306 -205
  158. package/dist/{index-eAlN694c.d.cts → index-DR4QqItd.d.cts} +3 -3
  159. package/dist/{index-Gn1H63Hk.d.cts → index-DXSmFkol.d.cts} +4 -4
  160. package/dist/{index-D_7yCRKy.d.cts → index-Dodwl64k.d.cts} +69 -36
  161. package/dist/{index-DqOAjqxN.d.cts → index-DppA4k3b.d.cts} +5 -5
  162. package/dist/{index-C7e3wBt9.d.cts → index-Dx52hNLP.d.cts} +3 -3
  163. package/dist/{index-BKh0prif.d.cts → index-GjcJTCbz.d.cts} +4 -4
  164. package/dist/{index-CQrKS7PV.d.cts → index-KuQ79Mnz.d.ts} +14 -3
  165. package/dist/{index-Ctqkm3Fx.d.ts → index-P-iT5THa.d.ts} +69 -36
  166. package/dist/{index-CeJOmN-P.d.ts → index-V7XKUQm9.d.cts} +14 -3
  167. package/dist/{index-tKsiUarj.d.ts → index-pXN4LWUX.d.ts} +4 -4
  168. package/dist/index.cjs +353 -57
  169. package/dist/index.cjs.map +1 -1
  170. package/dist/index.d.cts +7 -6
  171. package/dist/index.d.ts +7 -6
  172. package/dist/index.js +331 -37
  173. package/dist/index.js.map +1 -1
  174. package/dist/isLoginPageRedirect-B0EmRsHr.cjs +25 -0
  175. package/dist/isLoginPageRedirect-B0EmRsHr.cjs.map +1 -0
  176. package/dist/isLoginPageRedirect-BTTAedW-.js +20 -0
  177. package/dist/isLoginPageRedirect-BTTAedW-.js.map +1 -0
  178. package/dist/{jobStatus-kQ9JqF8t.cjs → jobStatus-0_Y3Sr4i.cjs} +37 -20
  179. package/dist/jobStatus-0_Y3Sr4i.cjs.map +1 -0
  180. package/dist/{jobStatus-DbMupQEK.js → jobStatus-PSZJMTiA.js} +35 -18
  181. package/dist/jobStatus-PSZJMTiA.js.map +1 -0
  182. package/dist/kaiAgent/index.cjs +1 -1
  183. package/dist/kaiAgent/index.d.cts +2 -210
  184. package/dist/kaiAgent/index.d.ts +2 -210
  185. package/dist/kaiAgent/index.js +1 -1
  186. package/dist/kaiAgent/types.d.cts +1 -1
  187. package/dist/kaiAgent/types.d.ts +1 -1
  188. package/dist/{kaiAgent-HDaFS9BR.js → kaiAgent-8LNzGhZc.js} +48 -4
  189. package/dist/kaiAgent-8LNzGhZc.js.map +1 -0
  190. package/dist/{kaiAgent-4OiIK1C2.cjs → kaiAgent-B_TaUPRt.cjs} +48 -4
  191. package/dist/kaiAgent-B_TaUPRt.cjs.map +1 -0
  192. package/dist/kaiAgentClient-BJj_2aqt.d.ts +250 -0
  193. package/dist/kaiAgentClient-DhTaM3GC.d.cts +250 -0
  194. package/dist/management/index.cjs +1 -1
  195. package/dist/management/index.d.cts +1 -1
  196. package/dist/management/index.d.ts +1 -1
  197. package/dist/management/index.js +1 -1
  198. package/dist/management/types.d.cts +2 -2
  199. package/dist/management/types.d.ts +2 -2
  200. package/dist/{management-DfjwQo7z.cjs → management-BoxlRNg2.cjs} +53 -10
  201. package/dist/management-BoxlRNg2.cjs.map +1 -0
  202. package/dist/{management-CIFhu1Nm.js → management-Bp440RsV.js} +53 -10
  203. package/dist/management-Bp440RsV.js.map +1 -0
  204. package/dist/metastore/index.cjs +1 -1
  205. package/dist/metastore/index.d.cts +1 -1
  206. package/dist/metastore/index.d.ts +1 -1
  207. package/dist/metastore/index.js +1 -1
  208. package/dist/metastore/types.d.cts +1 -1
  209. package/dist/metastore/types.d.ts +1 -1
  210. package/dist/{metastore-Dq2NS6jb.cjs → metastore-BYYWTb3m.cjs} +4 -4
  211. package/dist/{metastore-Dq2NS6jb.cjs.map → metastore-BYYWTb3m.cjs.map} +1 -1
  212. package/dist/{metastore-CrXkKufo.js → metastore-VCDRVhUT.js} +4 -4
  213. package/dist/{metastore-CrXkKufo.js.map → metastore-VCDRVhUT.js.map} +1 -1
  214. package/dist/microsoftGraph/index.cjs +2 -2
  215. package/dist/microsoftGraph/index.d.cts +2 -2
  216. package/dist/microsoftGraph/index.d.ts +2 -2
  217. package/dist/microsoftGraph/index.js +2 -2
  218. package/dist/microsoftGraph/types.d.cts +1 -1
  219. package/dist/microsoftGraph/types.d.ts +1 -1
  220. package/dist/notifications/index.cjs +3 -3
  221. package/dist/notifications/index.d.cts +2 -2
  222. package/dist/notifications/index.d.ts +2 -2
  223. package/dist/notifications/index.js +3 -3
  224. package/dist/notifications/types.d.cts +1 -1
  225. package/dist/notifications/types.d.ts +1 -1
  226. package/dist/oauth/index.cjs +1 -1
  227. package/dist/oauth/index.d.cts +2 -2
  228. package/dist/oauth/index.d.ts +2 -2
  229. package/dist/oauth/index.js +1 -1
  230. package/dist/oauth/types.d.cts +1 -1
  231. package/dist/oauth/types.d.ts +1 -1
  232. package/dist/{oauth-CFwSNz37.js → oauth--asfePw-.js} +5 -5
  233. package/dist/{oauth-CFwSNz37.js.map → oauth--asfePw-.js.map} +1 -1
  234. package/dist/{oauth-CkW5gln-.cjs → oauth-B8yqG6Sy.cjs} +5 -5
  235. package/dist/{oauth-CkW5gln-.cjs.map → oauth-B8yqG6Sy.cjs.map} +1 -1
  236. package/dist/omnisearch/index.cjs +2 -2
  237. package/dist/omnisearch/index.d.cts +2 -2
  238. package/dist/omnisearch/index.d.ts +2 -2
  239. package/dist/omnisearch/index.js +2 -2
  240. package/dist/omnisearch/types.d.cts +1 -1
  241. package/dist/omnisearch/types.d.ts +1 -1
  242. package/dist/{project-BOGaVs-q.d.ts → project-C2wvX0xZ.d.ts} +2 -2
  243. package/dist/{project-BnQkL8cb.d.cts → project-hePfzUY0.d.cts} +2 -2
  244. package/dist/queryService/index.cjs +1 -1
  245. package/dist/queryService/index.d.cts +1 -1
  246. package/dist/queryService/index.d.ts +1 -1
  247. package/dist/queryService/index.js +1 -1
  248. package/dist/queryService/types.d.cts +1 -1
  249. package/dist/queryService/types.d.ts +1 -1
  250. package/dist/{queryService-BLaGbpm-.cjs → queryService-BVtjkXy1.cjs} +6 -6
  251. package/dist/{queryService-BLaGbpm-.cjs.map → queryService-BVtjkXy1.cjs.map} +1 -1
  252. package/dist/{queryService-DK-jUnET.js → queryService-Ca65E5KH.js} +6 -6
  253. package/dist/{queryService-DK-jUnET.js.map → queryService-Ca65E5KH.js.map} +1 -1
  254. package/dist/queue/index.cjs +1 -1
  255. package/dist/queue/index.d.cts +3 -3
  256. package/dist/queue/index.d.ts +3 -3
  257. package/dist/queue/index.js +1 -1
  258. package/dist/queue/types.d.cts +1 -1
  259. package/dist/queue/types.d.ts +1 -1
  260. package/dist/{queue-DViSQ-eq.js → queue-DyotLFJi.js} +5 -5
  261. package/dist/{queue-DViSQ-eq.js.map → queue-DyotLFJi.js.map} +1 -1
  262. package/dist/{queue-B7TY4JLf.cjs → queue-OJJUUqc2.cjs} +5 -5
  263. package/dist/{queue-B7TY4JLf.cjs.map → queue-OJJUUqc2.cjs.map} +1 -1
  264. package/dist/scheduler/index.cjs +3 -3
  265. package/dist/scheduler/index.d.cts +2 -2
  266. package/dist/scheduler/index.d.ts +2 -2
  267. package/dist/scheduler/index.js +3 -3
  268. package/dist/scheduler/types.d.cts +1 -1
  269. package/dist/scheduler/types.d.ts +1 -1
  270. package/dist/sdk/configurations/index.cjs +1 -1
  271. package/dist/sdk/configurations/index.d.cts +4 -4
  272. package/dist/sdk/configurations/index.d.ts +4 -4
  273. package/dist/sdk/configurations/index.js +1 -1
  274. package/dist/sdk/developerPortal/index.cjs +5 -5
  275. package/dist/sdk/developerPortal/index.cjs.map +1 -1
  276. package/dist/sdk/developerPortal/index.d.cts +5 -4
  277. package/dist/sdk/developerPortal/index.d.ts +5 -4
  278. package/dist/sdk/developerPortal/index.js +4 -4
  279. package/dist/sdk/queryService/index.cjs +2 -2
  280. package/dist/sdk/queryService/index.d.cts +1 -1
  281. package/dist/sdk/queryService/index.d.ts +1 -1
  282. package/dist/sdk/queryService/index.js +2 -2
  283. package/dist/sdk/semanticLayer/index.cjs +21 -359
  284. package/dist/sdk/semanticLayer/index.d.cts +35 -13
  285. package/dist/sdk/semanticLayer/index.d.ts +35 -13
  286. package/dist/sdk/semanticLayer/index.js +2 -347
  287. package/dist/sdk/semanticLayer/types.d.cts +2 -2
  288. package/dist/sdk/semanticLayer/types.d.ts +2 -2
  289. package/dist/sdk/storage/index.d.cts +1 -1
  290. package/dist/sdk/storage/index.d.ts +1 -1
  291. package/dist/sdk/tag/index.d.cts +2 -2
  292. package/dist/sdk/tag/index.d.ts +2 -2
  293. package/dist/sdk/tag/types.d.cts +1 -1
  294. package/dist/sdk/tag/types.d.ts +1 -1
  295. package/dist/sdk/vault/index.d.cts +1 -1
  296. package/dist/sdk/vault/index.d.ts +1 -1
  297. package/dist/semanticLayer-CSqmtHRo.js +692 -0
  298. package/dist/semanticLayer-CSqmtHRo.js.map +1 -0
  299. package/dist/semanticLayer-E0Vilu8u.cjs +811 -0
  300. package/dist/semanticLayer-E0Vilu8u.cjs.map +1 -0
  301. package/dist/{serviceIds-fHLDwOg9.d.ts → serviceIds-DRcoTnSd.d.cts} +2 -1
  302. package/dist/{serviceIds-fHLDwOg9.d.cts → serviceIds-DRcoTnSd.d.ts} +2 -1
  303. package/dist/status/index.cjs +1 -1
  304. package/dist/status/index.d.cts +1 -1
  305. package/dist/status/index.d.ts +1 -1
  306. package/dist/status/index.js +1 -1
  307. package/dist/storage/index.cjs +6 -5
  308. package/dist/storage/index.d.cts +3 -3
  309. package/dist/storage/index.d.ts +3 -3
  310. package/dist/storage/index.js +6 -6
  311. package/dist/storage/types.d.cts +3 -3
  312. package/dist/storage/types.d.ts +3 -3
  313. package/dist/{storage-CihHwZ7z.cjs → storage-BKm7cztt.cjs} +7 -7
  314. package/dist/{storage-CihHwZ7z.cjs.map → storage-BKm7cztt.cjs.map} +1 -1
  315. package/dist/{storage-kgxscFEg.js → storage-LYwFQPNO.js} +7 -7
  316. package/dist/{storage-kgxscFEg.js.map → storage-LYwFQPNO.js.map} +1 -1
  317. package/dist/store-C9FQCHGe.js +74 -0
  318. package/dist/store-C9FQCHGe.js.map +1 -0
  319. package/dist/store-xS-Cu_VS.cjs +85 -0
  320. package/dist/store-xS-Cu_VS.cjs.map +1 -0
  321. package/dist/stream/index.cjs +3 -3
  322. package/dist/stream/index.d.cts +2 -2
  323. package/dist/stream/index.d.ts +2 -2
  324. package/dist/stream/index.js +3 -3
  325. package/dist/stream/types.d.cts +1 -1
  326. package/dist/stream/types.d.ts +1 -1
  327. package/dist/syncActions/index.cjs +1 -1
  328. package/dist/syncActions/index.d.cts +1 -1
  329. package/dist/syncActions/index.d.ts +1 -1
  330. package/dist/syncActions/index.js +1 -1
  331. package/dist/syncActions/types.d.cts +1 -1
  332. package/dist/syncActions/types.d.ts +1 -1
  333. package/dist/{syncActions-CevF_TEb.cjs → syncActions-OEZdVffK.cjs} +6 -6
  334. package/dist/{syncActions-CevF_TEb.cjs.map → syncActions-OEZdVffK.cjs.map} +1 -1
  335. package/dist/{syncActions-B75t0NwP.js → syncActions-QeBhIVhG.js} +6 -6
  336. package/dist/{syncActions-B75t0NwP.js.map → syncActions-QeBhIVhG.js.map} +1 -1
  337. package/dist/telemetry/index.cjs +38 -2
  338. package/dist/telemetry/index.cjs.map +1 -0
  339. package/dist/telemetry/index.d.cts +15 -8
  340. package/dist/telemetry/index.d.ts +15 -8
  341. package/dist/telemetry/index.js +37 -1
  342. package/dist/telemetry/index.js.map +1 -0
  343. package/dist/telemetry/types.d.cts +2 -2
  344. package/dist/telemetry/types.d.ts +2 -2
  345. package/dist/{types-D1uloiuY.d.cts → types-3eUgOA7I.d.cts} +2 -2
  346. package/dist/{types-CvkqEvhv.d.cts → types-52irAt99.d.cts} +2 -2
  347. package/dist/{types-CyHZ1ZQe.d.ts → types-B2U9cFcx.d.ts} +2 -2
  348. package/dist/{types-Av2egS_l.d.ts → types-B3GOGUJ7.d.cts} +753 -45
  349. package/dist/{types-BH9ljNmj.d.cts → types-BEe50G2r.d.cts} +2 -2
  350. package/dist/{types-BlCoTm7n.d.ts → types-BH5LLeJy.d.ts} +2 -2
  351. package/dist/{types-BptQ7jpP.d.cts → types-BMeDOB_D.d.ts} +753 -45
  352. package/dist/{types-MbcIiKDI.d.cts → types-BOqD3Hqy.d.cts} +3 -3
  353. package/dist/{types-DeSd3gqW.d.ts → types-BQsOHNI0.d.ts} +3 -3
  354. package/dist/{types-DNXC_-fA.d.cts → types-BQvv4RaI.d.cts} +2 -2
  355. package/dist/{types-BnaAo7xn.d.ts → types-BTWIPEiU.d.ts} +2 -2
  356. package/dist/{types-C1vhYcic.d.cts → types-BW2BXUB4.d.cts} +2 -2
  357. package/dist/{types-CXTqFYah.d.ts → types-BrYkBQo4.d.ts} +37 -6
  358. package/dist/{types-BZBdLUpH.d.ts → types-BsxLGDoC.d.cts} +2 -2
  359. package/dist/{types-BMQW-2Yw.d.ts → types-BupPADSm.d.ts} +737 -80
  360. package/dist/{types-COc-nind.d.cts → types-Bxhh2SJr.d.ts} +2 -2
  361. package/dist/{types-ByWD2oeV.d.ts → types-BztF4HeB.d.ts} +2 -2
  362. package/dist/{types-dybUhlU2.d.ts → types-C0_2KZ-A.d.ts} +2 -2
  363. package/dist/types-C2vefB4D.d.ts +218 -0
  364. package/dist/{types-CkcMoXRk.d.ts → types-CBgLCkYe.d.ts} +3 -3
  365. package/dist/{types-Cz1dj_TM.d.ts → types-CKiW3n6v.d.ts} +2 -2
  366. package/dist/{types-CcuG9cid.d.cts → types-COL1kVEB.d.cts} +2 -2
  367. package/dist/types-CPB-eF82.d.ts +289 -0
  368. package/dist/{types-BoV9M5Xg.d.cts → types-CW6lCqrC.d.cts} +2 -2
  369. package/dist/{types-CPanB0p7.d.cts → types-CaYtinmA.d.cts} +3 -3
  370. package/dist/{types-De_DA2ga.d.ts → types-CcrvrAJX.d.ts} +2 -2
  371. package/dist/{types-DwpRt3e9.d.ts → types-Ct0YPy2w.d.ts} +2 -2
  372. package/dist/{types-B4jdPHoL.d.cts → types-Cz83RiVu.d.cts} +2 -2
  373. package/dist/{types-DlbiVsVo.d.cts → types-D8Rrz51O.d.cts} +2 -2
  374. package/dist/{types-CyiRYRVq.d.cts → types-DARv_P6O.d.cts} +3 -3
  375. package/dist/{types-DuiUN0h8.d.ts → types-DBOSvWtD.d.ts} +2 -2
  376. package/dist/{types-D6jKxUv_.d.ts → types-DEc55spK.d.ts} +45 -4
  377. package/dist/{types-cDU_J45_.d.cts → types-DNxOHnZI.d.cts} +2 -2
  378. package/dist/{types-GuWtMCMn.d.cts → types-DPS8nwkV.d.cts} +2 -2
  379. package/dist/{types-Di8VIZwQ.d.ts → types-DYzJ6K2e.d.ts} +2 -2
  380. package/dist/{types-BI2jI-3-.d.cts → types-DZk3XHiN.d.cts} +3 -3
  381. package/dist/{types-Dfc58bPE.d.ts → types-DajzGOKB.d.ts} +2 -2
  382. package/dist/{types-C2CLlR4i.d.ts → types-DfvdbRPL.d.ts} +2 -2
  383. package/dist/{types-CpALS017.d.ts → types-DhDNS-5B.d.ts} +21 -3
  384. package/dist/{types-BV2BDccJ.d.cts → types-DjrRmQUe.d.cts} +45 -4
  385. package/dist/{types-sVYo0o9_.d.ts → types-Dmu-8g4O.d.ts} +3 -3
  386. package/dist/{types-COIsNoTQ.d.cts → types-DqxIx9Pi.d.cts} +2 -2
  387. package/dist/{types-Cj4bLPp5.d.cts → types-Jw10xuOW.d.cts} +37 -6
  388. package/dist/{types-CJHi0zdD.d.cts → types-M46WuBSm.d.cts} +2 -2
  389. package/dist/{types-zA3H84SM.d.cts → types-N3EChotg.d.cts} +2 -2
  390. package/dist/{types-Bpnpa2Wt.d.ts → types-OaD-cbbl.d.ts} +3 -3
  391. package/dist/{types-BREGN3qo.d.cts → types-_RhBCj4_.d.cts} +2 -2
  392. package/dist/{types-CGH_lfxS.d.cts → types-bGQb4Jtl.d.cts} +21 -3
  393. package/dist/{types-iNlsdRkx.d.cts → types-f8W_j6qD.d.cts} +737 -80
  394. package/dist/types-fX4gbxfV.d.cts +218 -0
  395. package/dist/types-g3vU7hcg.d.cts +289 -0
  396. package/dist/{types-D-qI9ne4.d.ts → types-l9o4gFsI.d.ts} +2 -2
  397. package/dist/{types-EJEoI3ZK.d.ts → types-nrviNdzZ.d.ts} +2 -2
  398. package/dist/{types-BTbczawY.d.ts → types-zZBxJ0P-.d.ts} +2 -2
  399. package/dist/{validateConnectionStatus-V9q6Nl6u.cjs → validateConnectionStatus-CsvYmCOI.cjs} +5 -4
  400. package/dist/validateConnectionStatus-CsvYmCOI.cjs.map +1 -0
  401. package/dist/{validateConnectionStatus-BrLXkoSI.js → validateConnectionStatus-olE2sQ3U.js} +5 -4
  402. package/dist/{validateConnectionStatus-BrLXkoSI.js.map → validateConnectionStatus-olE2sQ3U.js.map} +1 -1
  403. package/dist/vault/index.cjs +4 -4
  404. package/dist/vault/index.d.cts +1 -1
  405. package/dist/vault/index.d.ts +1 -1
  406. package/dist/vault/index.js +4 -4
  407. package/dist/vault/types.d.cts +1 -1
  408. package/dist/vault/types.d.ts +1 -1
  409. package/package.json +30 -4
  410. package/surface/auth.md +2 -2
  411. package/surface/billing.md +9 -0
  412. package/surface/kaiAgent.md +7 -4
  413. package/surface/management.md +13 -3
  414. package/surface/telemetry.md +2 -4
  415. package/dist/ValidationError-CzPWydEb.js.map +0 -1
  416. package/dist/ValidationError-h5qvwahi.cjs.map +0 -1
  417. package/dist/authClient--BtZgjIc.js.map +0 -1
  418. package/dist/authClient-b7uec7sw.cjs.map +0 -1
  419. package/dist/configurations-CqwAxiQL.cjs.map +0 -1
  420. package/dist/configurations-d7SZmw69.js.map +0 -1
  421. package/dist/constants-ByEwVtGf.js.map +0 -1
  422. package/dist/constants-lIfSdTzS.cjs.map +0 -1
  423. package/dist/createFetchClient-BRfTjBLV.cjs.map +0 -1
  424. package/dist/createFetchClient-BbG46bL0.js.map +0 -1
  425. package/dist/createStore-BNiCRQXa.js +0 -148
  426. package/dist/createStore-BNiCRQXa.js.map +0 -1
  427. package/dist/createStore-MQbboXcB.cjs +0 -177
  428. package/dist/createStore-MQbboXcB.cjs.map +0 -1
  429. package/dist/credential-DOXH7XRS.cjs.map +0 -1
  430. package/dist/credential-d2RDcXRB.js.map +0 -1
  431. package/dist/jobStatus-DbMupQEK.js.map +0 -1
  432. package/dist/jobStatus-kQ9JqF8t.cjs.map +0 -1
  433. package/dist/kaiAgent-4OiIK1C2.cjs.map +0 -1
  434. package/dist/kaiAgent-HDaFS9BR.js.map +0 -1
  435. package/dist/management-CIFhu1Nm.js.map +0 -1
  436. package/dist/management-DfjwQo7z.cjs.map +0 -1
  437. package/dist/sdk/semanticLayer/index.cjs.map +0 -1
  438. package/dist/sdk/semanticLayer/index.js.map +0 -1
  439. package/dist/telemetry-DwlSLVAU.cjs +0 -29
  440. package/dist/telemetry-DwlSLVAU.cjs.map +0 -1
  441. package/dist/telemetry-FXpodtJN.js +0 -24
  442. package/dist/telemetry-FXpodtJN.js.map +0 -1
  443. package/dist/types-B2vmg_UF.d.cts +0 -148
  444. package/dist/types-RfaldD4P.d.ts +0 -148
  445. package/dist/types-lFsTSkhe.d.cts +0 -14
  446. package/dist/types-lFsTSkhe.d.ts +0 -14
  447. package/dist/validateConnectionStatus-V9q6Nl6u.cjs.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,7 +1,8 @@
1
- import { D as ApiError, S as isHtmlResponseError, T as MiddlewareFn, _ as ValidationError, b as ManagementClientAuthError, d as HttpContentType, f as HttpHeader, g as isFetchClientError, h as isApiError, m as isAbortError, p as FetchClientError, u as createGenericFetchClient, v as isValidationError, x as HtmlResponseError, y as parseOrThrow } from "./index-CQrKS7PV.cjs";
2
- import { $ as generateUUID, A as LegacySession, At as TaskFn, B as createPersistor, Bt as isKeboolaError, C as LogLevel, Ct as delay, D as ResponseLog, Dt as CollectOptions, E as RequestLog, Et as concurrent, Ft as createMemoryStorage, G as Emitter, Gt as isSyncActionError, H as isEmptyDeep, Ht as isStorageTokenMutatingRequest, It as createNullStorage, J as createDerivedAsyncStore, Jt as isQueryJobTimeoutError, K as ReadableStore, Kt as ServiceUnavailableError, L as createLegacyKeboola, Lt as createSessionStorage, Mt as KeboolaOptions, Nt as StorageAdapter, O as createLoggingMiddleware, Ot as collect, Pt as createLocalStorage, Q as shallowEqual, R as createKeboola, Rt as KeboolaError, S as Log, St as lazy, T as LoggingOptions, Tt as ConcurrentOptions, U as isPlainObject, V as deepMerge, Vt as ClientContext, W as AsyncState, Wt as SyncActionError, X as createEmitter, Xt as isQueryJobError, Y as createDerivedStore, Yt as QueryJobError, Z as createStore, Zt as UserError, _t as PollContext, at as createPollRegistry, b as RetryOptions, bt as PollResult, ct as PollState, dt as PollerStartFn, et as Result, ft as PollerStopFn, gt as poller, h as createStorageSdk, ht as poll, i as createQueryServiceSdk, it as PollRegistry, j as KeboolaApi, jt as assert, k as BearerSession, kt as coalesce, lt as PollTask, mt as failureOf, nt as series, ot as ObservedPoller, pt as emitter, q as Store, qt as QueryJobTimeoutError, rt as PollEntry, st as PollSnapshot, tt as asError, ut as Poller, v as jobStatus, vt as PollKey, w as Logger, wt as dedupe, x as createRetryMiddleware, xt as PollTick, y as KeboolaHttpHeader, yt as PollOptions, z as Persistor, zt as KeboolaErrorType } from "./index-Bjk-tCpG.cjs";
3
- import { r as AuthStrategy, t as BaseClientOptions } from "./types-BREGN3qo.cjs";
4
- import { n as parseLogLines } from "./appLogs-BAaaGYKg.cjs";
5
- import { t as isManagementClientAuthError } from "./index-D_7yCRKy.cjs";
1
+ import { C as HtmlResponseError, D as MiddlewareFn, S as ManagementClientAuthError, _ as isTimeoutError, b as isValidationError, d as HttpContentType, f as HttpHeader, g as isFetchClientError, h as isApiError, k as ApiError, m as isAbortError, p as FetchClientError, u as createGenericFetchClient, v as ValidationError, w as isHtmlResponseError, x as parseOrThrow, y as formatValidationIssues } from "./index-V7XKUQm9.cjs";
2
+ import { $ as createDerivedStore, A as LegacySession, At as delay, Bt as KeboolaErrorType, C as LogLevel, Ct as poller, D as ResponseLog, Dt as PollResult, E as RequestLog, Et as PollOptions, F as ProjectClients, Ft as collect, G as createMemoryStorage, Gt as SyncActionError, H as createPersistor, Ht as ClientContext, It as coalesce, J as deepMerge, Jt as QueryJobTimeoutError, K as createNullStorage, Kt as isSyncActionError, Lt as TaskFn, M as createKeboola, Mt as ConcurrentOptions, N as KeboolaOptions, Nt as concurrent, O as createLoggingMiddleware, Ot as PollTick, P as KeboolaApi, Pt as CollectOptions, Q as createDerivedAsyncStore, Qt as UserError, Rt as assert, S as Log, St as poll, T as LoggingOptions, Tt as PollKey, U as StorageAdapter, Ut as isStorageTokenMutatingRequest, V as Persistor, Vt as isKeboolaError, W as createLocalStorage, X as isPlainObject, Xt as QueryJobError, Y as isEmptyDeep, Yt as isQueryJobTimeoutError, Z as AsyncState, Zt as isQueryJobError, _t as Poller, at as Failure, b as RetryOptions, bt as emitter, ct as asError, dt as PollRegistry, et as shallowEqual, ft as createPollRegistry, gt as PollTask, h as createStorageSdk, ht as PollState, i as createQueryServiceSdk, it as generateUUID, j as createLegacyKeboola, jt as dedupe, k as BearerSession, kt as lazy, lt as series, mt as PollSnapshot, nt as Store, ot as Result, pt as ObservedPoller, q as createSessionStorage, qt as ServiceUnavailableError, rt as createStore, st as Success, tt as ReadableStore, ut as PollEntry, v as jobStatus, vt as PollerStartFn, w as Logger, wt as PollContext, x as createRetryMiddleware, xt as failureOf, y as KeboolaHttpHeader, yt as PollerStopFn, zt as KeboolaError } from "./index-BLx14ZI4.cjs";
3
+ import { r as AuthStrategy, t as BaseClientOptions } from "./types-_RhBCj4_.cjs";
4
+ import { n as parseLogLines } from "./appLogs-D5A13Y0y.cjs";
5
+ import { t as isManagementClientAuthError } from "./index-Dodwl64k.cjs";
6
+ import { r as createEmitter, t as Emitter } from "./emitter-dLF1Fyfg.cjs";
6
7
  import { n as KeboolaObjectId, r as keboolaUID, t as schemaGuidedMerge } from "./index-NC1dXRTD.cjs";
7
- export { ApiError, AsyncState, type AuthStrategy, type BaseClientOptions, BearerSession, type ClientContext, CollectOptions, ConcurrentOptions, Emitter, type FetchClientError, HtmlResponseError, HttpContentType, HttpHeader, type KeboolaApi, KeboolaError, KeboolaErrorType, KeboolaHttpHeader, KeboolaObjectId, type KeboolaOptions, LegacySession, Log, LogLevel, Logger, LoggingOptions, ManagementClientAuthError, MiddlewareFn, ObservedPoller, Persistor, type PollContext, PollEntry, type PollKey, type PollOptions, PollRegistry, type PollResult, PollSnapshot, PollState, PollTask, type PollTick, Poller, PollerStartFn, PollerStopFn, QueryJobError, QueryJobTimeoutError, ReadableStore, RequestLog, ResponseLog, Result, RetryOptions, ServiceUnavailableError, type StorageAdapter, Store, SyncActionError, TaskFn, UserError, ValidationError, asError, assert, coalesce, collect, concurrent, createDerivedAsyncStore, createDerivedStore, createEmitter, createGenericFetchClient, createKeboola, createLegacyKeboola, createLocalStorage, createLoggingMiddleware, createMemoryStorage, createNullStorage, createPersistor, createPollRegistry, createQueryServiceSdk, createRetryMiddleware, createSessionStorage, createStorageSdk, createStore, dedupe, deepMerge, delay, emitter, failureOf, generateUUID, isAbortError, isApiError, isEmptyDeep, isFetchClientError, isHtmlResponseError, isKeboolaError, isManagementClientAuthError, isPlainObject, isQueryJobError, isQueryJobTimeoutError, isStorageTokenMutatingRequest, isSyncActionError, isValidationError, jobStatus, keboolaUID, lazy, parseLogLines, parseOrThrow, poll, poller, schemaGuidedMerge, series, shallowEqual };
8
+ export { ApiError, type AsyncState, type AuthStrategy, type BaseClientOptions, BearerSession, type ClientContext, CollectOptions, ConcurrentOptions, type Emitter, Failure, type FetchClientError, HtmlResponseError, HttpContentType, HttpHeader, type KeboolaApi, KeboolaError, KeboolaErrorType, KeboolaHttpHeader, KeboolaObjectId, type KeboolaOptions, LegacySession, Log, LogLevel, Logger, LoggingOptions, ManagementClientAuthError, MiddlewareFn, ObservedPoller, Persistor, type PollContext, PollEntry, type PollKey, type PollOptions, PollRegistry, type PollResult, PollSnapshot, PollState, PollTask, type PollTick, Poller, PollerStartFn, PollerStopFn, type ProjectClients, QueryJobError, QueryJobTimeoutError, type ReadableStore, RequestLog, ResponseLog, Result, RetryOptions, ServiceUnavailableError, type StorageAdapter, type Store, Success, SyncActionError, TaskFn, UserError, ValidationError, asError, assert, coalesce, collect, concurrent, createDerivedAsyncStore, createDerivedStore, createEmitter, createGenericFetchClient, createKeboola, createLegacyKeboola, createLocalStorage, createLoggingMiddleware, createMemoryStorage, createNullStorage, createPersistor, createPollRegistry, createQueryServiceSdk, createRetryMiddleware, createSessionStorage, createStorageSdk, createStore, dedupe, deepMerge, delay, emitter, failureOf, formatValidationIssues, generateUUID, isAbortError, isApiError, isEmptyDeep, isFetchClientError, isHtmlResponseError, isKeboolaError, isManagementClientAuthError, isPlainObject, isQueryJobError, isQueryJobTimeoutError, isStorageTokenMutatingRequest, isSyncActionError, isTimeoutError, isValidationError, jobStatus, keboolaUID, lazy, parseLogLines, parseOrThrow, poll, poller, schemaGuidedMerge, series, shallowEqual };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { D as ApiError, S as isHtmlResponseError, T as MiddlewareFn, _ as ValidationError, b as ManagementClientAuthError, d as HttpContentType, f as HttpHeader, g as isFetchClientError, h as isApiError, m as isAbortError, p as FetchClientError, u as createGenericFetchClient, v as isValidationError, x as HtmlResponseError, y as parseOrThrow } from "./index-CeJOmN-P.js";
2
- import { $ as generateUUID, A as LegacySession, At as TaskFn, B as createPersistor, Bt as isKeboolaError, C as LogLevel, Ct as delay, D as ResponseLog, Dt as CollectOptions, E as RequestLog, Et as concurrent, Ft as createMemoryStorage, G as Emitter, Gt as isSyncActionError, H as isEmptyDeep, Ht as isStorageTokenMutatingRequest, It as createNullStorage, J as createDerivedAsyncStore, Jt as isQueryJobTimeoutError, K as ReadableStore, Kt as ServiceUnavailableError, L as createLegacyKeboola, Lt as createSessionStorage, Mt as KeboolaOptions, Nt as StorageAdapter, O as createLoggingMiddleware, Ot as collect, Pt as createLocalStorage, Q as shallowEqual, R as createKeboola, Rt as KeboolaError, S as Log, St as lazy, T as LoggingOptions, Tt as ConcurrentOptions, U as isPlainObject, V as deepMerge, Vt as ClientContext, W as AsyncState, Wt as SyncActionError, X as createEmitter, Xt as isQueryJobError, Y as createDerivedStore, Yt as QueryJobError, Z as createStore, Zt as UserError, _t as PollContext, at as createPollRegistry, b as RetryOptions, bt as PollResult, ct as PollState, dt as PollerStartFn, et as Result, ft as PollerStopFn, gt as poller, h as createStorageSdk, ht as poll, i as createQueryServiceSdk, it as PollRegistry, j as KeboolaApi, jt as assert, k as BearerSession, kt as coalesce, lt as PollTask, mt as failureOf, nt as series, ot as ObservedPoller, pt as emitter, q as Store, qt as QueryJobTimeoutError, rt as PollEntry, st as PollSnapshot, tt as asError, ut as Poller, v as jobStatus, vt as PollKey, w as Logger, wt as dedupe, x as createRetryMiddleware, xt as PollTick, y as KeboolaHttpHeader, yt as PollOptions, z as Persistor, zt as KeboolaErrorType } from "./index-FhKX7Cv1.js";
3
- import { r as AuthStrategy, t as BaseClientOptions } from "./types-DwpRt3e9.js";
4
- import { n as parseLogLines } from "./appLogs-DX_WTBCa.js";
5
- import { t as isManagementClientAuthError } from "./index-Ctqkm3Fx.js";
1
+ import { C as HtmlResponseError, D as MiddlewareFn, S as ManagementClientAuthError, _ as isTimeoutError, b as isValidationError, d as HttpContentType, f as HttpHeader, g as isFetchClientError, h as isApiError, k as ApiError, m as isAbortError, p as FetchClientError, u as createGenericFetchClient, v as ValidationError, w as isHtmlResponseError, x as parseOrThrow, y as formatValidationIssues } from "./index-KuQ79Mnz.js";
2
+ import { $ as createDerivedStore, A as LegacySession, At as delay, Bt as KeboolaErrorType, C as LogLevel, Ct as poller, D as ResponseLog, Dt as PollResult, E as RequestLog, Et as PollOptions, F as ProjectClients, Ft as collect, G as createMemoryStorage, Gt as SyncActionError, H as createPersistor, Ht as ClientContext, It as coalesce, J as deepMerge, Jt as QueryJobTimeoutError, K as createNullStorage, Kt as isSyncActionError, Lt as TaskFn, M as createKeboola, Mt as ConcurrentOptions, N as KeboolaOptions, Nt as concurrent, O as createLoggingMiddleware, Ot as PollTick, P as KeboolaApi, Pt as CollectOptions, Q as createDerivedAsyncStore, Qt as UserError, Rt as assert, S as Log, St as poll, T as LoggingOptions, Tt as PollKey, U as StorageAdapter, Ut as isStorageTokenMutatingRequest, V as Persistor, Vt as isKeboolaError, W as createLocalStorage, X as isPlainObject, Xt as QueryJobError, Y as isEmptyDeep, Yt as isQueryJobTimeoutError, Z as AsyncState, Zt as isQueryJobError, _t as Poller, at as Failure, b as RetryOptions, bt as emitter, ct as asError, dt as PollRegistry, et as shallowEqual, ft as createPollRegistry, gt as PollTask, h as createStorageSdk, ht as PollState, i as createQueryServiceSdk, it as generateUUID, j as createLegacyKeboola, jt as dedupe, k as BearerSession, kt as lazy, lt as series, mt as PollSnapshot, nt as Store, ot as Result, pt as ObservedPoller, q as createSessionStorage, qt as ServiceUnavailableError, rt as createStore, st as Success, tt as ReadableStore, ut as PollEntry, v as jobStatus, vt as PollerStartFn, w as Logger, wt as PollContext, x as createRetryMiddleware, xt as failureOf, y as KeboolaHttpHeader, yt as PollerStopFn, zt as KeboolaError } from "./index-DFBFa3SS.js";
3
+ import { r as AuthStrategy, t as BaseClientOptions } from "./types-Ct0YPy2w.js";
4
+ import { n as parseLogLines } from "./appLogs-Ch7DYpzx.js";
5
+ import { t as isManagementClientAuthError } from "./index-P-iT5THa.js";
6
+ import { r as createEmitter, t as Emitter } from "./emitter-dLF1Fyfg.js";
6
7
  import { n as KeboolaObjectId, r as keboolaUID, t as schemaGuidedMerge } from "./index-NC1dXRTD.js";
7
- export { ApiError, AsyncState, type AuthStrategy, type BaseClientOptions, BearerSession, type ClientContext, CollectOptions, ConcurrentOptions, Emitter, type FetchClientError, HtmlResponseError, HttpContentType, HttpHeader, type KeboolaApi, KeboolaError, KeboolaErrorType, KeboolaHttpHeader, KeboolaObjectId, type KeboolaOptions, LegacySession, Log, LogLevel, Logger, LoggingOptions, ManagementClientAuthError, MiddlewareFn, ObservedPoller, Persistor, type PollContext, PollEntry, type PollKey, type PollOptions, PollRegistry, type PollResult, PollSnapshot, PollState, PollTask, type PollTick, Poller, PollerStartFn, PollerStopFn, QueryJobError, QueryJobTimeoutError, ReadableStore, RequestLog, ResponseLog, Result, RetryOptions, ServiceUnavailableError, type StorageAdapter, Store, SyncActionError, TaskFn, UserError, ValidationError, asError, assert, coalesce, collect, concurrent, createDerivedAsyncStore, createDerivedStore, createEmitter, createGenericFetchClient, createKeboola, createLegacyKeboola, createLocalStorage, createLoggingMiddleware, createMemoryStorage, createNullStorage, createPersistor, createPollRegistry, createQueryServiceSdk, createRetryMiddleware, createSessionStorage, createStorageSdk, createStore, dedupe, deepMerge, delay, emitter, failureOf, generateUUID, isAbortError, isApiError, isEmptyDeep, isFetchClientError, isHtmlResponseError, isKeboolaError, isManagementClientAuthError, isPlainObject, isQueryJobError, isQueryJobTimeoutError, isStorageTokenMutatingRequest, isSyncActionError, isValidationError, jobStatus, keboolaUID, lazy, parseLogLines, parseOrThrow, poll, poller, schemaGuidedMerge, series, shallowEqual };
8
+ export { ApiError, type AsyncState, type AuthStrategy, type BaseClientOptions, BearerSession, type ClientContext, CollectOptions, ConcurrentOptions, type Emitter, Failure, type FetchClientError, HtmlResponseError, HttpContentType, HttpHeader, type KeboolaApi, KeboolaError, KeboolaErrorType, KeboolaHttpHeader, KeboolaObjectId, type KeboolaOptions, LegacySession, Log, LogLevel, Logger, LoggingOptions, ManagementClientAuthError, MiddlewareFn, ObservedPoller, Persistor, type PollContext, PollEntry, type PollKey, type PollOptions, PollRegistry, type PollResult, PollSnapshot, PollState, PollTask, type PollTick, Poller, PollerStartFn, PollerStopFn, type ProjectClients, QueryJobError, QueryJobTimeoutError, type ReadableStore, RequestLog, ResponseLog, Result, RetryOptions, ServiceUnavailableError, type StorageAdapter, type Store, Success, SyncActionError, TaskFn, UserError, ValidationError, asError, assert, coalesce, collect, concurrent, createDerivedAsyncStore, createDerivedStore, createEmitter, createGenericFetchClient, createKeboola, createLegacyKeboola, createLocalStorage, createLoggingMiddleware, createMemoryStorage, createNullStorage, createPersistor, createPollRegistry, createQueryServiceSdk, createRetryMiddleware, createSessionStorage, createStorageSdk, createStore, dedupe, deepMerge, delay, emitter, failureOf, formatValidationIssues, generateUUID, isAbortError, isApiError, isEmptyDeep, isFetchClientError, isHtmlResponseError, isKeboolaError, isManagementClientAuthError, isPlainObject, isQueryJobError, isQueryJobTimeoutError, isStorageTokenMutatingRequest, isSyncActionError, isTimeoutError, isValidationError, jobStatus, keboolaUID, lazy, parseLogLines, parseOrThrow, poll, poller, schemaGuidedMerge, series, shallowEqual };
package/dist/index.js CHANGED
@@ -1,49 +1,50 @@
1
1
  import { t as createProject } from "./project-DWwZv66D.js";
2
- import { a as poller, c as Result, d as delay, i as poll, l as asError, n as emitter, o as clamp, r as failureOf, s as finiteOr, t as jobStatus, u as lazy } from "./jobStatus-DbMupQEK.js";
3
- import { n as collect, t as createQueueClient } from "./queue-DViSQ-eq.js";
2
+ import { a as poller, c as Result, d as delay, i as poll, l as asError, n as emitter, o as clamp, r as failureOf, s as finiteOr, t as jobStatus, u as lazy } from "./jobStatus-PSZJMTiA.js";
3
+ import { n as collect, t as createQueueClient } from "./queue-DyotLFJi.js";
4
4
  import { t as concurrent } from "./concurrent-CH9fbNr3.js";
5
5
  import { t as dedupe } from "./dedupe-DYIHgZoG.js";
6
- import { a as shallowEqual, i as createStore, n as createDerivedStore, r as createEmitter, t as createDerivedAsyncStore } from "./createStore-BNiCRQXa.js";
7
- import { a as series, i as ServiceUnavailableError, t as createStorageClient } from "./storage-kgxscFEg.js";
6
+ import { n as createEmitter, t as createStore } from "./store-C9FQCHGe.js";
7
+ import { a as series, i as ServiceUnavailableError, t as createStorageClient } from "./storage-LYwFQPNO.js";
8
8
  import { n as keboolaUID, t as createTagSdk } from "./tag-DCsoewjL.js";
9
9
  import { t as generateUUID } from "./generateUUID-Dr8l-aoc.js";
10
10
  import { t as isPlainObject } from "./isPlainObject-LYW-03uB.js";
11
- import { n as schemaGuidedMerge, r as isEmptyDeep, t as createConfigurationSdk } from "./configurations-ZwBXilW-.js";
11
+ import { n as schemaGuidedMerge, r as isEmptyDeep, t as createConfigurationSdk } from "./configurations-VtNE0nrT.js";
12
12
  import { t as UserError } from "./UserError-By_Zckmc.js";
13
- import { a as HttpContentType, f as HttpStatus, i as isFetchClientError, l as normalizeBaseUrl, m as ApiError, n as isAbortError, o as HttpHeader, p as KeboolaHttpHeader, r as isApiError } from "./createFetchClient-BbG46bL0.js";
14
- import { n as HtmlResponseError, r as isHtmlResponseError } from "./validateConnectionStatus-BrLXkoSI.js";
15
- import { t as ManagementClientAuthError } from "./ManagementClientAuthError-BAFNvOdf.js";
13
+ import { a as isTimeoutError, d as normalizeBaseUrl, g as ApiError, h as KeboolaHttpHeader, i as isFetchClientError, m as HttpStatus, n as isAbortError, o as HttpContentType, r as isApiError, s as HttpHeader } from "./createFetchClient-U-ZrwPl2.js";
14
+ import { n as HtmlResponseError, r as isHtmlResponseError } from "./validateConnectionStatus-olE2sQ3U.js";
15
+ import { t as ManagementClientAuthError } from "./ManagementClientAuthError-ey-f03vy.js";
16
16
  import { i as isQueryJobError, n as isQueryJobTimeoutError, r as QueryJobError, t as QueryJobTimeoutError } from "./QueryJobTimeoutError-C7JbNGOM.js";
17
17
  import { n as isSyncActionError, t as SyncActionError } from "./SyncActionError-CoZFsdUk.js";
18
- import { n as isValidationError, r as parseOrThrow, t as ValidationError } from "./ValidationError-CzPWydEb.js";
19
- import { t as createGenericFetchClient } from "./createGenericFetchClient-BHYQLZhe.js";
20
- import { t as createImportClient } from "./import-SQuurg1G.js";
21
- import { t as createAuthClient } from "./authClient--BtZgjIc.js";
22
- import { n as isManagementClientAuthError, t as createManagementClient } from "./management-CIFhu1Nm.js";
23
- import { s as ProjectFeature } from "./constants-ByEwVtGf.js";
18
+ import { i as parseOrThrow, n as formatValidationIssues, r as isValidationError, t as ValidationError } from "./ValidationError-BekhphAq.js";
19
+ import { t as createGenericFetchClient } from "./createGenericFetchClient-rxvUUbap.js";
20
+ import { t as createImportClient } from "./import-CROEK82b.js";
21
+ import { t as createAuthClient } from "./authClient-D7W9vWPR.js";
22
+ import { n as isManagementClientAuthError, t as createManagementClient } from "./management-Bp440RsV.js";
23
+ import { s as ProjectFeature } from "./constants-wfbFsqqN.js";
24
24
  import { t as createStorageTable } from "./storageTable-DslXtqNL.js";
25
- import { createSemanticLayerSdk } from "./sdk/semanticLayer/index.js";
25
+ import { a as createSemanticLayerSdk } from "./semanticLayer-CSqmtHRo.js";
26
26
  import { createStorageSdk } from "./sdk/storage/index.js";
27
27
  import { createVaultSdk } from "./sdk/vault/index.js";
28
28
  import { createAiClient } from "./ai/index.js";
29
- import { t as parseLogLines } from "./appLogs-DTLE6HTy.js";
29
+ import { t as parseLogLines } from "./appLogs-xsVkTriU.js";
30
30
  import { createAppsClient } from "./apps/index.js";
31
+ import { createBillingClient } from "./billing/index.js";
31
32
  import { createChatClient } from "./chat/index.js";
32
- import { t as createDataScienceClient } from "./dataScience-Sm8iONhP.js";
33
+ import { t as createDataScienceClient } from "./dataScience-C1gO5zUn.js";
33
34
  import { createEditorClient } from "./editor/index.js";
34
35
  import { createEncryptionClient } from "./encryption/index.js";
35
- import { t as createKaiAgentClient } from "./kaiAgent-HDaFS9BR.js";
36
- import { t as createMetastoreClient } from "./metastore-CrXkKufo.js";
36
+ import { t as createKaiAgentClient } from "./kaiAgent-8LNzGhZc.js";
37
+ import { t as createMetastoreClient } from "./metastore-VCDRVhUT.js";
37
38
  import { createNotificationsClient } from "./notifications/index.js";
38
- import { t as createOauthClient } from "./oauth-CFwSNz37.js";
39
+ import { t as createOauthClient } from "./oauth--asfePw-.js";
39
40
  import { createOmnisearchClient } from "./omnisearch/index.js";
40
- import { t as createQueryServiceClient } from "./queryService-DK-jUnET.js";
41
+ import { t as createQueryServiceClient } from "./queryService-Ca65E5KH.js";
41
42
  import { createSchedulerClient } from "./scheduler/index.js";
42
43
  import { createStreamClient } from "./stream/index.js";
43
- import { t as createSyncActionsClient } from "./syncActions-B75t0NwP.js";
44
- import { t as createTelemetryClient } from "./telemetry-FXpodtJN.js";
44
+ import { t as createSyncActionsClient } from "./syncActions-QeBhIVhG.js";
45
+ import { createTelemetryClient } from "./telemetry/index.js";
45
46
  import { createVaultClient } from "./vault/index.js";
46
- import { n as isUnauthorized, t as createBearerCredential } from "./credential-d2RDcXRB.js";
47
+ import { n as isUnauthorized, t as createBearerCredential } from "./credential-CihSf_xs.js";
47
48
  import { createQueryServiceSdk } from "./sdk/queryService/index.js";
48
49
  import * as z$1 from "zod";
49
50
  //#region src/utils/assert.ts
@@ -91,6 +92,111 @@ const coalesce = (task) => {
91
92
  };
92
93
  };
93
94
  //#endregion
95
+ //#region src/utils/store/derivedStore.ts
96
+ const isPlainObjectOrArray = (value) => {
97
+ if (Array.isArray(value)) return true;
98
+ const proto = Object.getPrototypeOf(value);
99
+ return proto === Object.prototype || proto === null;
100
+ };
101
+ const shallowEqual = (a, b) => {
102
+ if (Object.is(a, b)) return true;
103
+ if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) return false;
104
+ if (!isPlainObjectOrArray(a) || !isPlainObjectOrArray(b)) return false;
105
+ const aKeys = Object.keys(a);
106
+ const bKeys = Object.keys(b);
107
+ return aKeys.length === bKeys.length && aKeys.every((key) => Object.is(a[key], b[key]));
108
+ };
109
+ const createDerivedStore = ({ source, dependsOn, build, keyEquals = shallowEqual }) => {
110
+ let key = dependsOn(source.get());
111
+ const store = createStore(build(key));
112
+ const unsubscribe = source.subscribe((state) => {
113
+ const next = dependsOn(state);
114
+ if (keyEquals(key, next)) return;
115
+ key = next;
116
+ store.set(build(next));
117
+ });
118
+ const get = store.get;
119
+ const subscribe = store.subscribe;
120
+ const dispose = () => {
121
+ unsubscribe();
122
+ store.dispose();
123
+ };
124
+ return {
125
+ get,
126
+ subscribe,
127
+ dispose
128
+ };
129
+ };
130
+ //#endregion
131
+ //#region src/utils/store/derivedAsyncStore.ts
132
+ const createDerivedAsyncStore = ({ source, dependsOn, build, keyEquals = shallowEqual }) => {
133
+ const store = createStore({ state: "idle" });
134
+ let currentKey = null;
135
+ let generation = 0;
136
+ let controller = null;
137
+ const run = (key) => {
138
+ controller?.abort();
139
+ controller = new AbortController();
140
+ const runGeneration = ++generation;
141
+ store.set({ state: "pending" });
142
+ build(key, controller.signal).then((value) => {
143
+ if (runGeneration === generation) store.set({
144
+ state: "ready",
145
+ value
146
+ });
147
+ }, (error) => {
148
+ if (runGeneration === generation) store.set({
149
+ state: "errored",
150
+ error
151
+ });
152
+ });
153
+ };
154
+ const sync = (state) => {
155
+ const next = dependsOn(state);
156
+ if (next === null) {
157
+ if (currentKey === null) return;
158
+ controller?.abort();
159
+ controller = null;
160
+ generation += 1;
161
+ currentKey = null;
162
+ store.set({ state: "idle" });
163
+ return;
164
+ }
165
+ if (currentKey !== null && keyEquals(currentKey, next)) return;
166
+ currentKey = next;
167
+ run(next);
168
+ };
169
+ sync(source.get());
170
+ const unsubscribe = source.subscribe(sync);
171
+ const get = store.get;
172
+ const subscribe = store.subscribe;
173
+ const dispose = () => {
174
+ controller?.abort();
175
+ unsubscribe();
176
+ store.dispose();
177
+ };
178
+ const readable = {
179
+ get,
180
+ subscribe,
181
+ dispose
182
+ };
183
+ const settled = () => new Promise((resolve) => {
184
+ let unsubscribeSettled = () => {};
185
+ const check = (state) => {
186
+ if (state.state === "ready" || state.state === "errored") {
187
+ unsubscribeSettled();
188
+ resolve(state);
189
+ }
190
+ };
191
+ unsubscribeSettled = store.subscribe(check);
192
+ check(store.get());
193
+ });
194
+ return {
195
+ store: readable,
196
+ settled
197
+ };
198
+ };
199
+ //#endregion
94
200
  //#region src/utils/async/poll/registry.ts
95
201
  const DEFAULT_LIMIT = 50;
96
202
  const isFinished = ({ snapshot }) => snapshot.state !== "idle" && snapshot.state !== "polling";
@@ -601,6 +707,7 @@ const stamp = (tokens) => ({
601
707
  const createConfig$1 = (initial = INITIAL) => {
602
708
  const store = createStore(initial);
603
709
  let expiredNotified = false;
710
+ let epoch = 0;
604
711
  const setBaseUrl = (baseUrl) => {
605
712
  if (store.get().status !== "anonymous") throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
606
713
  store.set({
@@ -613,6 +720,7 @@ const createConfig$1 = (initial = INITIAL) => {
613
720
  if (state.status !== "anonymous") throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
614
721
  if (!state.baseUrl) throw new KeboolaError(KeboolaErrorType.Unconfigured);
615
722
  expiredNotified = false;
723
+ epoch += 1;
616
724
  store.set({
617
725
  status: "authenticated",
618
726
  baseUrl: state.baseUrl,
@@ -646,6 +754,7 @@ const createConfig$1 = (initial = INITIAL) => {
646
754
  };
647
755
  /** Drop the credential (sign out); keeps the configured baseUrl. */
648
756
  const reset = () => {
757
+ epoch += 1;
649
758
  store.set({
650
759
  status: "anonymous",
651
760
  baseUrl: store.get().baseUrl
@@ -687,6 +796,15 @@ const createConfig$1 = (initial = INITIAL) => {
687
796
  };
688
797
  const getBaseUrl = () => store.get().baseUrl;
689
798
  /**
799
+ * Which sign-in this is — a counter, bumped by `authenticate` and `reset`.
800
+ *
801
+ * - For anything long-lived that must not outlive the credential it was built against: capture it,
802
+ * compare it later. A rotation does not move it; only a new session or a sign-out does.
803
+ * - Distinct from `notifyExpired`'s latch, which answers "report this death once" rather than
804
+ * "which session are we in".
805
+ */
806
+ const getEpoch = () => epoch;
807
+ /**
690
808
  * Session-expiry latch (fire-once):
691
809
  * - why: concurrent 401s all report expiry, but the app must sign out once; and the credential /
692
810
  * auth middleware are long-lived singletons, so the latch can't live in them — it must reset
@@ -715,6 +833,7 @@ const createConfig$1 = (initial = INITIAL) => {
715
833
  forceExpire,
716
834
  requireCredential,
717
835
  getBaseUrl,
836
+ getEpoch,
718
837
  notifyExpired,
719
838
  debug
720
839
  };
@@ -1005,6 +1124,14 @@ const createServiceClients = ({ baseUrl, auth, getServiceBaseUrl, middlewareFor,
1005
1124
  middlewares: middlewareFor("notifications", [attachTokenMiddleware]),
1006
1125
  auth
1007
1126
  })
1127
+ }).add({
1128
+ serviceId: "billing",
1129
+ clientName: "billing",
1130
+ clientFn: (serviceBaseUrl) => createBillingClient({
1131
+ baseUrl: serviceBaseUrl,
1132
+ middlewares: middlewareFor("billing", [attachTokenMiddleware]),
1133
+ auth
1134
+ })
1008
1135
  }).add({
1009
1136
  serviceId: "metastore",
1010
1137
  clientName: "metastore",
@@ -1185,7 +1312,12 @@ const createKeboola = (options = {}) => {
1185
1312
  const refresh = async () => {
1186
1313
  const client = authClientBare.get();
1187
1314
  assert$1(client, KeboolaErrorType.NotReady);
1188
- const refreshed = await client.token.refresh(config.requireCredential().refreshToken);
1315
+ const epoch = config.getEpoch();
1316
+ const refreshed = await client.token.refresh(config.requireCredential().refreshToken).catch((error) => {
1317
+ if (config.getEpoch() !== epoch) throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
1318
+ throw error;
1319
+ });
1320
+ if (config.getEpoch() !== epoch) throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
1189
1321
  config.applyRefresh(refreshed);
1190
1322
  return refreshed.accessToken;
1191
1323
  };
@@ -1201,8 +1333,49 @@ const createKeboola = (options = {}) => {
1201
1333
  }
1202
1334
  };
1203
1335
  };
1336
+ /**
1337
+ * The session's state, once it is known to carry a credential.
1338
+ *
1339
+ * - Returns the state rather than nothing, so the caller reads `baseUrl` and `credential` off a
1340
+ * narrowed union instead of re-checking the status to get at them.
1341
+ * - `NotAuthenticated`, the same refusal `requireScopedProject` opens with. The two differ only in
1342
+ * how far they go: this one stops at "somebody is signed in", which is all a request naming its
1343
+ * own project needs.
1344
+ */
1345
+ const requireAuthenticated = () => {
1346
+ const state = config.store.get();
1347
+ if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
1348
+ return state;
1349
+ };
1350
+ /**
1351
+ * The project this session is scoped to, right now.
1352
+ *
1353
+ * - Read at every point that stamps a project, never snapshotted across an `await`: the scope moves
1354
+ * with `setProject`/`clearProject`, and neither ends the session, so it is not in the epoch and
1355
+ * `assertSameSession` cannot see it change.
1356
+ * - `NotReady` rather than `NotAuthenticated` when merely unscoped — the credential is fine, the
1357
+ * project is what is missing. A credential alone does not authorize a project request: kai-agent
1358
+ * reads the project from the header, not the token, and cannot attribute a call that omits it.
1359
+ */
1360
+ const requireScopedProject = () => {
1361
+ const state = requireAuthenticated();
1362
+ if (state.status !== "scoped") throw new KeboolaError(KeboolaErrorType.NotReady);
1363
+ return state.projectId;
1364
+ };
1365
+ /**
1366
+ * The project client sets `forProject` has handed out, keyed by project id.
1367
+ *
1368
+ * - Not keyed by stack: `setBaseUrl` throws once authenticated and `signOut` empties this, so one
1369
+ * entry can never belong to a different `baseUrl` than the live session.
1370
+ * - A `lazy` per key, not a bare promise: concurrent callers share one bootstrap, later ones replay
1371
+ * the resolved set, and a rejected build clears only its own slot — so a build orphaned by a
1372
+ * sign-out cannot evict the entry that replaced it.
1373
+ */
1374
+ const extraProjects = /* @__PURE__ */ new Map();
1204
1375
  const signOut = () => {
1205
1376
  config.reset();
1377
+ credential.abandonRefresh();
1378
+ extraProjects.clear();
1206
1379
  persistor.clear();
1207
1380
  };
1208
1381
  const onSessionExpired = () => {
@@ -1213,13 +1386,75 @@ const createKeboola = (options = {}) => {
1213
1386
  getToken,
1214
1387
  onSessionExpired
1215
1388
  });
1216
- const authMiddleware = createBearerAuthMiddleware(credential);
1389
+ const sessionGuard = (epoch) => () => {
1390
+ if (config.getEpoch() !== epoch) throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
1391
+ };
1392
+ /**
1393
+ * The auth middleware, refusing to carry a request across a change of session.
1394
+ *
1395
+ * - The middleware holds no token — it reads the credential live — so anything built on it acts as
1396
+ * whoever is signed in *at request time*, not whoever built it. Rebuilding a store on sign-out
1397
+ * only stops new reads; a request already in flight completes as the next user, still stamped
1398
+ * with the old project. `config`'s epoch moves on `authenticate` and `reset` and never on a
1399
+ * rotation, so it is exactly "which sign-in is this".
1400
+ * - `epochFor` says which sign-in a request answers to, resolved per request:
1401
+ * 1. a client set pins to the sign-in that *built* it (`pinToSession`) — a set the caller still
1402
+ * holds must not ride the session that replaced it;
1403
+ * 2. `api.auth` pins to the sign-in the request *started* on, because its store is keyed on
1404
+ * `baseUrl` alone: it is built once, while anonymous, so a build-time pin would freeze at that
1405
+ * epoch and refuse every authenticated call.
1406
+ * - The guard covers every credential read, not only the wire request, so it wraps the credential
1407
+ * rather than sitting beside it. The 401 path rotates the token by calling the credential
1408
+ * directly: a straggler from a dead session would otherwise spend the *live* session's
1409
+ * single-use refresh token, and sign that session out if the rotation itself came back 401.
1410
+ * - `expiresSession` decides whether a 401 that survives a rotation means the session is dead.
1411
+ * True for this session's own realms; false where the 401 may be about the project instead of
1412
+ * the credential (see `forProject`).
1413
+ * - `inner` is for middleware that **re-invokes `next`** — a retry. Composed outside the pin it
1414
+ * would re-enter it per attempt, and with a per-request `epochFor` each attempt would re-pin to
1415
+ * whoever is signed in by then: a 503 backoff is exactly long enough for a sign-out to land, and
1416
+ * the retry then goes out as the next user. Inside, one epoch covers every attempt and each
1417
+ * attempt still passes the guard. Anything new that retries belongs here, not in the array.
1418
+ */
1419
+ const createPinnedAuthMiddleware = (epochFor, { expiresSession = true, inner = [] } = {}) => {
1420
+ return (next) => (request) => {
1421
+ const assertSameSession = sessionGuard(epochFor());
1422
+ const pinnedCredential = {
1423
+ ...credential,
1424
+ getAccessToken: async (options) => {
1425
+ assertSameSession();
1426
+ return credential.getAccessToken(options);
1427
+ },
1428
+ notifyExpired: expiresSession ? credential.notifyExpired : () => {}
1429
+ };
1430
+ const guarded = (wire) => (repeated) => {
1431
+ assertSameSession();
1432
+ return wire(repeated);
1433
+ };
1434
+ const chain = inner.reduceRight((acc, middleware) => middleware(acc), guarded(next));
1435
+ return createBearerAuthMiddleware(pinnedCredential)(chain)(request);
1436
+ };
1437
+ };
1438
+ /**
1439
+ * Pin something long-lived to the sign-in live right now.
1440
+ *
1441
+ * - `assertSameSession` is for whatever no middleware chain covers: a bootstrap whose every
1442
+ * request passed the guard before the sign-out resolves anyway and must not be handed back, and
1443
+ * `getAuthHeaders`, which emits the credential by hand.
1444
+ */
1445
+ const pinToSession = (options) => {
1446
+ const epoch = config.getEpoch();
1447
+ return {
1448
+ assertSameSession: sessionGuard(epoch),
1449
+ pinnedAuthMiddleware: createPinnedAuthMiddleware(() => epoch, options)
1450
+ };
1451
+ };
1217
1452
  const authClient = createDerivedStore({
1218
1453
  source: config.store,
1219
1454
  dependsOn: (state) => state.baseUrl,
1220
1455
  build: (baseUrl) => baseUrl ? createAuthClient({
1221
1456
  baseUrl,
1222
- middlewares: middlewareFor("auth", [retryContention, authMiddleware])
1457
+ middlewares: middlewareFor("auth", [createPinnedAuthMiddleware(config.getEpoch, { inner: [retryContention] })])
1223
1458
  }) : null
1224
1459
  });
1225
1460
  const management = createDerivedStore({
@@ -1231,7 +1466,7 @@ const createKeboola = (options = {}) => {
1231
1466
  type: "bearer",
1232
1467
  token: ""
1233
1468
  },
1234
- middlewares: middlewareFor("management", [authMiddleware])
1469
+ middlewares: middlewareFor("management", [pinToSession().pinnedAuthMiddleware])
1235
1470
  }) : null
1236
1471
  });
1237
1472
  const projectClientsAsync = createDerivedAsyncStore({
@@ -1243,13 +1478,32 @@ const createKeboola = (options = {}) => {
1243
1478
  build: ({ baseUrl, projectId }) => {
1244
1479
  return createProjectClients$1({
1245
1480
  baseUrl,
1246
- authMiddleware,
1481
+ authMiddleware: pinToSession().pinnedAuthMiddleware,
1247
1482
  projectId,
1248
1483
  middlewareFor,
1249
1484
  clientServiceUrls: options.clientServiceUrls
1250
1485
  });
1251
1486
  }
1252
1487
  });
1488
+ const forProject = async (projectId) => {
1489
+ const state = requireAuthenticated();
1490
+ const cached = extraProjects.get(projectId);
1491
+ if (cached) return cached();
1492
+ const { assertSameSession, pinnedAuthMiddleware } = pinToSession({ expiresSession: false });
1493
+ const build = lazy(async () => {
1494
+ const clients = await createProjectClients$1({
1495
+ baseUrl: state.baseUrl,
1496
+ authMiddleware: pinnedAuthMiddleware,
1497
+ projectId,
1498
+ middlewareFor,
1499
+ clientServiceUrls: options.clientServiceUrls
1500
+ });
1501
+ assertSameSession();
1502
+ return clients;
1503
+ });
1504
+ extraProjects.set(projectId, build);
1505
+ return build();
1506
+ };
1253
1507
  if (options.baseUrl) config.setBaseUrl(options.baseUrl);
1254
1508
  config.store.subscribe((state) => {
1255
1509
  if (state.status === "anonymous") return;
@@ -1283,6 +1537,19 @@ const createKeboola = (options = {}) => {
1283
1537
  * re-entering the project. Use `reset` to sign out instead.
1284
1538
  */
1285
1539
  clearProject: config.clearProjectId,
1540
+ /**
1541
+ * The clients for one project, off this session — for reaching a second project without leaving
1542
+ * the first.
1543
+ *
1544
+ * - `setProjectAsync` *moves* the session (and `api`) to another project; this *adds* one. The
1545
+ * returned set is the caller's to hold and never appears on `api`.
1546
+ * - Every set shares this session's auth middleware, so one rotation serves all of them. A second
1547
+ * `createKeboola()` does not: both hold the same single-use refresh token, and the first to
1548
+ * rotate invalidates the other's, whose next refresh 401s and signs it out.
1549
+ * - Independent of the scope, including for the scoped project itself — asking for that one
1550
+ * builds a second set with its own `liveProject`, so prefer `api.*` there.
1551
+ */
1552
+ forProject,
1286
1553
  reset: signOut,
1287
1554
  /**
1288
1555
  * Dev/test only: mark the current access token as expired so the bearer credential rotates it on
@@ -1299,18 +1566,42 @@ const createKeboola = (options = {}) => {
1299
1566
  * string, and `X-KBC-ProjectId` is composed here rather than in every consuming app.
1300
1567
  * - Resolved per call, through the credential — so a near-expiry token rotates and a revoked
1301
1568
  * one is never re-sent. A snapshot held by the caller would do neither.
1302
- * - Throws rather than emitting a half-formed `Bearer null`: an unauthenticated or unscoped
1303
- * session has nothing to authorize with.
1569
+ * - Throws rather than emitting a half-formed `Bearer null`: a session with no credential has
1570
+ * nothing to authorize with.
1571
+ * - Pinned to the sign-in it was called on, like every client here. This is the one
1572
+ * credential-emitting surface with no middleware chain for the guard to sit in, so the check
1573
+ * is written out around the `await` that rotates the token.
1574
+ *
1575
+ * `projectId` names the project the headers authorize, for a caller reaching a project the
1576
+ * session is not scoped to:
1577
+ *
1578
+ * - **Omitted**, the session's own scope answers — unchanged, and re-read *after* the rotation
1579
+ * rather than carried across it. The epoch the pin compares moves on a sign-in and a sign-out
1580
+ * only, so a project switch mid-rotation is invisible to it.
1581
+ * - **Given**, it is what the header says, and the scope is not consulted at all. A caller that
1582
+ * names a project has said everything the request needs: the credential is user-level and the
1583
+ * project is a header on top of it, so an authenticated session suffices where an unnamed call
1584
+ * requires a scoped one. Nothing about the session can change the answer, so there is nothing
1585
+ * to re-read after the `await`.
1586
+ * - **Not checked against an access set**, because this session cannot acquire one:
1587
+ * `forProject` — the only other surface taking a caller-supplied project id — records that
1588
+ * connection collapses every bearer failure into a single `invalid_token` 401, so "no access
1589
+ * to this project" and "revoked token" are the same response. Whether the caller may reach a
1590
+ * project is the caller's own knowledge, from `token.introspect`. What is guaranteed here is
1591
+ * that the header names what was asked for and never something else — which is the failure
1592
+ * worth preventing: a turn sent somewhere the transcript above it did not come from.
1304
1593
  */
1305
- getAuthHeaders: async () => {
1306
- const state = config.store.get();
1307
- if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
1308
- if (state.status !== "scoped") throw new KeboolaError(KeboolaErrorType.NotReady);
1594
+ getAuthHeaders: async (projectId) => {
1595
+ const { assertSameSession } = pinToSession();
1596
+ if (projectId === void 0) requireScopedProject();
1597
+ else requireAuthenticated();
1309
1598
  const accessToken = await credential.getAccessToken();
1599
+ assertSameSession();
1600
+ const authorizedProjectId = projectId ?? requireScopedProject();
1310
1601
  assert$1(accessToken, KeboolaErrorType.NotAuthenticated);
1311
1602
  return {
1312
1603
  [HttpHeader.AUTHORIZATION]: `Bearer ${accessToken}`,
1313
- [KeboolaHttpHeader.PROJECT_ID]: String(state.projectId)
1604
+ [KeboolaHttpHeader.PROJECT_ID]: String(authorizedProjectId)
1314
1605
  };
1315
1606
  },
1316
1607
  restore: async () => {
@@ -1324,8 +1615,10 @@ const createKeboola = (options = {}) => {
1324
1615
  if (!configured) config.setBaseUrl(persisted.baseUrl);
1325
1616
  const client = authClientBare.get();
1326
1617
  assert$1(client, KeboolaErrorType.NotReady);
1618
+ const startedOn = config.getEpoch();
1327
1619
  try {
1328
1620
  const refreshed = await client.token.refresh(persisted.refreshToken);
1621
+ if (config.getEpoch() !== startedOn) return { status: "empty" };
1329
1622
  config.authenticate(refreshed);
1330
1623
  if (persisted.projectId !== null) {
1331
1624
  config.setProjectId(persisted.projectId);
@@ -1333,6 +1626,7 @@ const createKeboola = (options = {}) => {
1333
1626
  }
1334
1627
  return { status: "restored" };
1335
1628
  } catch (err) {
1629
+ if (config.getEpoch() !== startedOn) return { status: "empty" };
1336
1630
  if (isUnauthorized(err)) {
1337
1631
  persistor.clear();
1338
1632
  return { status: "expired" };
@@ -1569,6 +1863,6 @@ const createLegacyKeboola = (options = {}) => {
1569
1863
  };
1570
1864
  };
1571
1865
  //#endregion
1572
- export { ApiError, HtmlResponseError, HttpContentType, HttpHeader, KeboolaError, KeboolaErrorType, KeboolaHttpHeader, ManagementClientAuthError, QueryJobError, QueryJobTimeoutError, Result, ServiceUnavailableError, SyncActionError, UserError, ValidationError, asError, assert, coalesce, collect, concurrent, createDerivedAsyncStore, createDerivedStore, createEmitter, createGenericFetchClient, createKeboola, createLegacyKeboola, createLocalStorage, createLoggingMiddleware, createMemoryStorage, createNullStorage, createPersistor, createPollRegistry, createQueryServiceSdk, createRetryMiddleware, createSessionStorage, createStorageSdk, createStore, dedupe, deepMerge, delay, emitter, failureOf, generateUUID, isAbortError, isApiError, isEmptyDeep, isFetchClientError, isHtmlResponseError, isKeboolaError, isManagementClientAuthError, isPlainObject, isQueryJobError, isQueryJobTimeoutError, isStorageTokenMutatingRequest, isSyncActionError, isValidationError, jobStatus, keboolaUID, lazy, parseLogLines, parseOrThrow, poll, poller, schemaGuidedMerge, series, shallowEqual };
1866
+ export { ApiError, HtmlResponseError, HttpContentType, HttpHeader, KeboolaError, KeboolaErrorType, KeboolaHttpHeader, ManagementClientAuthError, QueryJobError, QueryJobTimeoutError, Result, ServiceUnavailableError, SyncActionError, UserError, ValidationError, asError, assert, coalesce, collect, concurrent, createDerivedAsyncStore, createDerivedStore, createEmitter, createGenericFetchClient, createKeboola, createLegacyKeboola, createLocalStorage, createLoggingMiddleware, createMemoryStorage, createNullStorage, createPersistor, createPollRegistry, createQueryServiceSdk, createRetryMiddleware, createSessionStorage, createStorageSdk, createStore, dedupe, deepMerge, delay, emitter, failureOf, formatValidationIssues, generateUUID, isAbortError, isApiError, isEmptyDeep, isFetchClientError, isHtmlResponseError, isKeboolaError, isManagementClientAuthError, isPlainObject, isQueryJobError, isQueryJobTimeoutError, isStorageTokenMutatingRequest, isSyncActionError, isTimeoutError, isValidationError, jobStatus, keboolaUID, lazy, parseLogLines, parseOrThrow, poll, poller, schemaGuidedMerge, series, shallowEqual };
1573
1867
 
1574
1868
  //# sourceMappingURL=index.js.map