@keboola/api-client 36.0.0 → 40.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 (529) hide show
  1. package/AGENTS.md +133 -103
  2. package/API-SURFACE.md +36 -2
  3. package/CHANGELOG.md +194 -0
  4. package/README.md +22 -20
  5. package/dist/{ManagementClientAuthError-DD4u0EU7.cjs → ManagementClientAuthError-DE7lNGZQ.cjs} +3 -2
  6. package/dist/{ManagementClientAuthError-DD4u0EU7.cjs.map → ManagementClientAuthError-DE7lNGZQ.cjs.map} +1 -1
  7. package/dist/{ManagementClientAuthError-ey-f03vy.js → ManagementClientAuthError-H30lti_Q.js} +3 -2
  8. package/dist/{ManagementClientAuthError-ey-f03vy.js.map → ManagementClientAuthError-H30lti_Q.js.map} +1 -1
  9. package/dist/{ValidationError-CLVJCCwH.cjs → ValidationError-D65QU0uq.cjs} +10 -16
  10. package/dist/ValidationError-D65QU0uq.cjs.map +1 -0
  11. package/dist/ValidationError-DjhtNMfZ.js +42 -0
  12. package/dist/ValidationError-DjhtNMfZ.js.map +1 -0
  13. package/dist/ai/index.cjs +2 -2
  14. package/dist/ai/index.d.cts +2 -2
  15. package/dist/ai/index.d.ts +2 -2
  16. package/dist/ai/index.js +2 -2
  17. package/dist/ai/types.d.cts +1 -1
  18. package/dist/ai/types.d.ts +1 -1
  19. package/dist/{appLogs-BjfUoWzs.cjs → appLogs-B9zFJIuy.cjs} +2 -2
  20. package/dist/{appLogs-BjfUoWzs.cjs.map → appLogs-B9zFJIuy.cjs.map} +1 -1
  21. package/dist/{appLogs-xsVkTriU.js → appLogs-BBkkUOW1.js} +2 -2
  22. package/dist/{appLogs-xsVkTriU.js.map → appLogs-BBkkUOW1.js.map} +1 -1
  23. package/dist/{appLogs-Ch7DYpzx.d.ts → appLogs-BS6ViVGR.d.ts} +2 -2
  24. package/dist/{appLogs-D5A13Y0y.d.cts → appLogs-C9YlJ2g8.d.cts} +2 -2
  25. package/dist/apps/index.cjs +30 -56
  26. package/dist/apps/index.cjs.map +1 -1
  27. package/dist/apps/index.d.cts +8 -13
  28. package/dist/apps/index.d.ts +8 -13
  29. package/dist/apps/index.js +30 -56
  30. package/dist/apps/index.js.map +1 -1
  31. package/dist/apps/types.d.cts +2 -2
  32. package/dist/apps/types.d.ts +2 -2
  33. package/dist/assets/index.cjs +1 -1
  34. package/dist/assets/index.d.cts +1 -1
  35. package/dist/assets/index.d.ts +1 -1
  36. package/dist/assets/index.js +1 -1
  37. package/dist/auth/index.cjs +8 -4
  38. package/dist/auth/index.d.cts +2 -2
  39. package/dist/auth/index.d.ts +2 -2
  40. package/dist/auth/index.js +2 -2
  41. package/dist/auth/types.d.cts +2 -2
  42. package/dist/auth/types.d.ts +2 -2
  43. package/dist/{auth-JQ33o3nU.cjs → auth-Dm0F2rOh.cjs} +2 -2
  44. package/dist/{auth-JQ33o3nU.cjs.map → auth-Dm0F2rOh.cjs.map} +1 -1
  45. package/dist/{auth-aItmDu45.js → auth-DworfoPy.js} +2 -2
  46. package/dist/{auth-aItmDu45.js.map → auth-DworfoPy.js.map} +1 -1
  47. package/dist/{authClient-_PpvGgZJ.cjs → authClient-BmuUo0J4.cjs} +141 -48
  48. package/dist/authClient-BmuUo0J4.cjs.map +1 -0
  49. package/dist/{authClient-D8i3JTM-.d.ts → authClient-CHXWJ9x3.d.ts} +109 -76
  50. package/dist/{authClient-D7W9vWPR.js → authClient-CgcDGd30.js} +108 -39
  51. package/dist/authClient-CgcDGd30.js.map +1 -0
  52. package/dist/{authClient-CTHNs6Tq.d.cts → authClient-vEt_7_uk.d.cts} +109 -76
  53. package/dist/billing/index.cjs +2 -2
  54. package/dist/billing/index.d.cts +1 -1
  55. package/dist/billing/index.d.ts +1 -1
  56. package/dist/billing/index.js +2 -2
  57. package/dist/billing/types.d.cts +1 -1
  58. package/dist/billing/types.d.ts +1 -1
  59. package/dist/businessWorkspaceApi/index.cjs +3 -0
  60. package/dist/businessWorkspaceApi/index.d.cts +2 -0
  61. package/dist/businessWorkspaceApi/index.d.ts +2 -0
  62. package/dist/businessWorkspaceApi/index.js +2 -0
  63. package/dist/businessWorkspaceApi/types.cjs +0 -0
  64. package/dist/businessWorkspaceApi/types.d.cts +2 -0
  65. package/dist/businessWorkspaceApi/types.d.ts +2 -0
  66. package/dist/businessWorkspaceApi/types.js +1 -0
  67. package/dist/businessWorkspaceApi-6tCDdpnY.cjs +66 -0
  68. package/dist/businessWorkspaceApi-6tCDdpnY.cjs.map +1 -0
  69. package/dist/businessWorkspaceApi-BLUdefRF.js +61 -0
  70. package/dist/businessWorkspaceApi-BLUdefRF.js.map +1 -0
  71. package/dist/businessWorkspaceApiClient-BHDJlHFo.d.cts +529 -0
  72. package/dist/businessWorkspaceApiClient-DI-z1VIH.d.ts +529 -0
  73. package/dist/chat/index.cjs +9 -5
  74. package/dist/chat/index.cjs.map +1 -1
  75. package/dist/chat/index.d.cts +3 -3
  76. package/dist/chat/index.d.ts +3 -3
  77. package/dist/chat/index.js +9 -5
  78. package/dist/chat/index.js.map +1 -1
  79. package/dist/chat/types.cjs +1 -3
  80. package/dist/chat/types.cjs.map +1 -1
  81. package/dist/chat/types.d.cts +2 -2
  82. package/dist/chat/types.d.ts +2 -2
  83. package/dist/chat/types.js +1 -3
  84. package/dist/chat/types.js.map +1 -1
  85. package/dist/{componentId-DkyQ8PM0.cjs → componentId-57vjsa2i.cjs} +4 -2
  86. package/dist/{componentId-DkyQ8PM0.cjs.map → componentId-57vjsa2i.cjs.map} +1 -1
  87. package/dist/{componentId-vJz-kWs6.js → componentId-C6WZa_R1.js} +4 -2
  88. package/dist/{componentId-vJz-kWs6.js.map → componentId-C6WZa_R1.js.map} +1 -1
  89. package/dist/{concurrent-CH9fbNr3.js → concurrent-BacWxPwi.js} +5 -7
  90. package/dist/concurrent-BacWxPwi.js.map +1 -0
  91. package/dist/{concurrent-tbiIa0UL.cjs → concurrent-CdVfR1N5.cjs} +5 -7
  92. package/dist/concurrent-CdVfR1N5.cjs.map +1 -0
  93. package/dist/{configurations-VtNE0nrT.js → configurations-BPKGGy-M.js} +14 -22
  94. package/dist/configurations-BPKGGy-M.js.map +1 -0
  95. package/dist/{configurations-CyFF9Dtu.cjs → configurations-BTRHVSRq.cjs} +20 -53
  96. package/dist/configurations-BTRHVSRq.cjs.map +1 -0
  97. package/dist/{configurations-BVvcimzo.js → configurations-Chg_JwJ1.js} +20 -53
  98. package/dist/configurations-Chg_JwJ1.js.map +1 -0
  99. package/dist/{configurations-zkNjr73Q.cjs → configurations-IYyOvhI3.cjs} +14 -22
  100. package/dist/configurations-IYyOvhI3.cjs.map +1 -0
  101. package/dist/constants/index.cjs +2 -2
  102. package/dist/constants/index.d.cts +2 -2
  103. package/dist/constants/index.d.ts +2 -2
  104. package/dist/constants/index.js +2 -2
  105. package/dist/{constants-wfbFsqqN.js → constants-C2tYAJSj.js} +10 -1
  106. package/dist/constants-C2tYAJSj.js.map +1 -0
  107. package/dist/{constants-C4DlsF_M.cjs → constants-C6xku_Vx.cjs} +10 -1
  108. package/dist/constants-C6xku_Vx.cjs.map +1 -0
  109. package/dist/{createFetchClient-DgMiqTJ8.cjs → createFetchClient-Cwp8max9.cjs} +24 -5
  110. package/dist/createFetchClient-Cwp8max9.cjs.map +1 -0
  111. package/dist/{createFetchClient-U-ZrwPl2.js → createFetchClient-DXHQK63w.js} +24 -5
  112. package/dist/createFetchClient-DXHQK63w.js.map +1 -0
  113. package/dist/{createGenericFetchClient-rxvUUbap.js → createGenericFetchClient-Dg1rgzmG.js} +2 -2
  114. package/dist/{createGenericFetchClient-rxvUUbap.js.map → createGenericFetchClient-Dg1rgzmG.js.map} +1 -1
  115. package/dist/{createGenericFetchClient-o3cPJeRn.cjs → createGenericFetchClient-Dl9cqTvR.cjs} +2 -2
  116. package/dist/{createGenericFetchClient-o3cPJeRn.cjs.map → createGenericFetchClient-Dl9cqTvR.cjs.map} +1 -1
  117. package/dist/{createOpenapiFetchClient-DhUU3M1W.cjs → createOpenapiFetchClient-BYqW-9tm.cjs} +2 -2
  118. package/dist/{createOpenapiFetchClient-DhUU3M1W.cjs.map → createOpenapiFetchClient-BYqW-9tm.cjs.map} +1 -1
  119. package/dist/{createOpenapiFetchClient-BVSc9ibR.js → createOpenapiFetchClient-DZUOVupy.js} +2 -2
  120. package/dist/{createOpenapiFetchClient-BVSc9ibR.js.map → createOpenapiFetchClient-DZUOVupy.js.map} +1 -1
  121. package/dist/dataScience/index.cjs +2 -2
  122. package/dist/dataScience/index.d.cts +2 -2
  123. package/dist/dataScience/index.d.ts +2 -2
  124. package/dist/dataScience/index.js +2 -2
  125. package/dist/dataScience/types.d.cts +2 -2
  126. package/dist/dataScience/types.d.ts +2 -2
  127. package/dist/{dataScience-0Rl_EuV_.cjs → dataScience-B5QxZnvW.cjs} +5 -5
  128. package/dist/{dataScience-0Rl_EuV_.cjs.map → dataScience-B5QxZnvW.cjs.map} +1 -1
  129. package/dist/{dataScience-C1gO5zUn.js → dataScience-OXcwdk1p.js} +5 -5
  130. package/dist/{dataScience-C1gO5zUn.js.map → dataScience-OXcwdk1p.js.map} +1 -1
  131. package/dist/dedupe-Cky1gSUu.js +21 -0
  132. package/dist/dedupe-Cky1gSUu.js.map +1 -0
  133. package/dist/dedupe-OSnnst2u.cjs +26 -0
  134. package/dist/dedupe-OSnnst2u.cjs.map +1 -0
  135. package/dist/developerPortal/index.cjs +1 -1
  136. package/dist/developerPortal/index.d.cts +2 -2
  137. package/dist/developerPortal/index.d.ts +2 -2
  138. package/dist/developerPortal/index.js +1 -1
  139. package/dist/developerPortal/types.d.cts +1 -1
  140. package/dist/developerPortal/types.d.ts +1 -1
  141. package/dist/{developerPortalClient-C_48z8BN.js → developerPortalClient-B1QZ1rYi.js} +6 -8
  142. package/dist/{developerPortalClient-C_48z8BN.js.map → developerPortalClient-B1QZ1rYi.js.map} +1 -1
  143. package/dist/{developerPortalClient-ki0XS_OD.cjs → developerPortalClient-CLPpBksD.cjs} +6 -8
  144. package/dist/{developerPortalClient-ki0XS_OD.cjs.map → developerPortalClient-CLPpBksD.cjs.map} +1 -1
  145. package/dist/domain/permissions/index.cjs +9 -30
  146. package/dist/domain/permissions/index.cjs.map +1 -1
  147. package/dist/domain/permissions/index.d.cts +29 -102
  148. package/dist/domain/permissions/index.d.ts +29 -102
  149. package/dist/domain/permissions/index.js +9 -30
  150. package/dist/domain/permissions/index.js.map +1 -1
  151. package/dist/domain/storageTable/index.d.cts +1 -1
  152. package/dist/domain/storageTable/index.d.ts +1 -1
  153. package/dist/editor/index.cjs +2 -2
  154. package/dist/editor/index.cjs.map +1 -1
  155. package/dist/editor/index.d.cts +2 -2
  156. package/dist/editor/index.d.ts +2 -2
  157. package/dist/editor/index.js +2 -2
  158. package/dist/editor/index.js.map +1 -1
  159. package/dist/editor/types.d.cts +1 -1
  160. package/dist/editor/types.d.ts +1 -1
  161. package/dist/encryption/index.cjs +2 -22
  162. package/dist/encryption/index.cjs.map +1 -1
  163. package/dist/encryption/index.d.cts +1 -1
  164. package/dist/encryption/index.d.ts +1 -1
  165. package/dist/encryption/index.js +2 -22
  166. package/dist/encryption/index.js.map +1 -1
  167. package/dist/encryption/types.d.cts +1 -1
  168. package/dist/encryption/types.d.ts +1 -1
  169. package/dist/import/index.cjs +1 -1
  170. package/dist/import/index.d.cts +3 -3
  171. package/dist/import/index.d.ts +3 -3
  172. package/dist/import/index.js +1 -1
  173. package/dist/{import-C83w7BKz.cjs → import-CNk89mqy.cjs} +3 -3
  174. package/dist/{import-C83w7BKz.cjs.map → import-CNk89mqy.cjs.map} +1 -1
  175. package/dist/{import-CROEK82b.js → import-DiMQCzLa.js} +3 -3
  176. package/dist/{import-CROEK82b.js.map → import-DiMQCzLa.js.map} +1 -1
  177. package/dist/{index-DR4QqItd.d.cts → index--ZpnE3YT.d.cts} +3 -3
  178. package/dist/{index-C77vTm2K.d.ts → index-BDZvaRud.d.ts} +6 -6
  179. package/dist/{index-KuQ79Mnz.d.ts → index-BVhHt5lx.d.cts} +18 -26
  180. package/dist/{index-NC1dXRTD.d.ts → index-BfqkgPGI.d.cts} +7 -13
  181. package/dist/{index-NC1dXRTD.d.cts → index-BfqkgPGI.d.ts} +7 -13
  182. package/dist/{index-V7XKUQm9.d.cts → index-BgR5zcjJ.d.ts} +18 -26
  183. package/dist/{index-2JM0gyAf.d.ts → index-BkqackZf.d.ts} +439 -289
  184. package/dist/{index-BDG-LKXj.d.cts → index-ByRpNVcs.d.cts} +88 -18
  185. package/dist/{index-pXN4LWUX.d.ts → index-C11JSxBY.d.ts} +8 -11
  186. package/dist/{index-GjcJTCbz.d.cts → index-C4TNAA8-.d.cts} +8 -11
  187. package/dist/{index-NaYLwG_h.d.cts → index-C8gRRWHL.d.cts} +11 -1
  188. package/dist/{index-NaYLwG_h.d.ts → index-C8gRRWHL.d.ts} +11 -1
  189. package/dist/{index-3LUk2rpD.d.ts → index-CPu4Nezo.d.cts} +34 -9
  190. package/dist/{index-BMqLPS6S.d.ts → index-CXcWpZQ2.d.cts} +4 -12
  191. package/dist/{index-BMqLPS6S.d.cts → index-CXcWpZQ2.d.ts} +4 -12
  192. package/dist/{index-Dx52hNLP.d.cts → index-CcMHJcuP.d.cts} +3 -3
  193. package/dist/{index-BgLnWTZU.d.cts → index-Cvbjp3jx.d.cts} +6 -6
  194. package/dist/{index-DppA4k3b.d.cts → index-Cz0MXhzs.d.cts} +5 -5
  195. package/dist/{index-6Xe81qN3.d.ts → index-D-VMgpGc.d.ts} +5 -5
  196. package/dist/{index-D8rcUbnk.d.ts → index-D7-o-oGa.d.ts} +3 -3
  197. package/dist/{index-BXF-bs2d.d.ts → index-DCRKjihs.d.ts} +88 -18
  198. package/dist/{kaiAgentClient-DhTaM3GC.d.cts → index-DNThyEej.d.cts} +19 -5
  199. package/dist/{index-DXSmFkol.d.cts → index-DOAZmWvh.d.cts} +6 -6
  200. package/dist/{index-DIAyi-EZ.d.cts → index-DXYASsPP.d.cts} +439 -289
  201. package/dist/{index-BuegqrS1.d.ts → index-D_-4uQF8.d.ts} +3 -3
  202. package/dist/{index-CW3Pj7DY.d.cts → index-Dazy-meb.d.ts} +34 -9
  203. package/dist/{index-CqgtL2NU.d.ts → index-DnQTuc6t.d.ts} +6 -6
  204. package/dist/{kaiAgentClient-BJj_2aqt.d.ts → index-Qb7X6-ph.d.ts} +19 -5
  205. package/dist/index.cjs +1503 -895
  206. package/dist/index.cjs.map +1 -1
  207. package/dist/index.d.cts +7 -7
  208. package/dist/index.d.ts +7 -7
  209. package/dist/index.js +1501 -896
  210. package/dist/index.js.map +1 -1
  211. package/dist/isLoginPageRedirect-XPwAOKK3.js +14 -0
  212. package/dist/isLoginPageRedirect-XPwAOKK3.js.map +1 -0
  213. package/dist/isLoginPageRedirect-jQHiLrG7.cjs +19 -0
  214. package/dist/isLoginPageRedirect-jQHiLrG7.cjs.map +1 -0
  215. package/dist/{jobStatus-0_Y3Sr4i.cjs → jobStatus-BMlsyXWI.cjs} +19 -45
  216. package/dist/jobStatus-BMlsyXWI.cjs.map +1 -0
  217. package/dist/{jobStatus-PSZJMTiA.js → jobStatus-CfRtsIpv.js} +19 -45
  218. package/dist/jobStatus-CfRtsIpv.js.map +1 -0
  219. package/dist/kaiAgent/index.cjs +1 -1
  220. package/dist/kaiAgent/index.d.cts +3 -2
  221. package/dist/kaiAgent/index.d.ts +3 -2
  222. package/dist/kaiAgent/index.js +1 -1
  223. package/dist/kaiAgent/types.d.cts +2 -2
  224. package/dist/kaiAgent/types.d.ts +2 -2
  225. package/dist/{kaiAgent-8LNzGhZc.js → kaiAgent-Dp20HLTh.js} +63 -7
  226. package/dist/kaiAgent-Dp20HLTh.js.map +1 -0
  227. package/dist/{kaiAgent-B_TaUPRt.cjs → kaiAgent-QNoeVKPs.cjs} +63 -7
  228. package/dist/kaiAgent-QNoeVKPs.cjs.map +1 -0
  229. package/dist/kaiMemory-CClSPInt.cjs +289 -0
  230. package/dist/kaiMemory-CClSPInt.cjs.map +1 -0
  231. package/dist/kaiMemory-D0Y_16U4.js +260 -0
  232. package/dist/kaiMemory-D0Y_16U4.js.map +1 -0
  233. package/dist/management/index.cjs +1 -1
  234. package/dist/management/index.d.cts +2 -2
  235. package/dist/management/index.d.ts +2 -2
  236. package/dist/management/index.js +1 -1
  237. package/dist/management/types.d.cts +2 -2
  238. package/dist/management/types.d.ts +2 -2
  239. package/dist/{management-BoxlRNg2.cjs → management-CCY0IYnq.cjs} +93 -25
  240. package/dist/management-CCY0IYnq.cjs.map +1 -0
  241. package/dist/{management-Bp440RsV.js → management-DvmPiG64.js} +93 -25
  242. package/dist/management-DvmPiG64.js.map +1 -0
  243. package/dist/metastore/index.cjs +1 -1
  244. package/dist/metastore/index.d.cts +1 -1
  245. package/dist/metastore/index.d.ts +1 -1
  246. package/dist/metastore/index.js +1 -1
  247. package/dist/metastore/types.d.cts +2 -2
  248. package/dist/metastore/types.d.ts +2 -2
  249. package/dist/{metastore-VCDRVhUT.js → metastore-BycJxe7A.js} +14 -8
  250. package/dist/metastore-BycJxe7A.js.map +1 -0
  251. package/dist/{metastore-BYYWTb3m.cjs → metastore-XtWciCZT.cjs} +14 -8
  252. package/dist/metastore-XtWciCZT.cjs.map +1 -0
  253. package/dist/microsoftGraph/index.cjs +2 -2
  254. package/dist/microsoftGraph/index.d.cts +2 -2
  255. package/dist/microsoftGraph/index.d.ts +2 -2
  256. package/dist/microsoftGraph/index.js +2 -2
  257. package/dist/microsoftGraph/types.d.cts +1 -1
  258. package/dist/microsoftGraph/types.d.ts +1 -1
  259. package/dist/middleware-CBwrtgQd.js +34 -0
  260. package/dist/middleware-CBwrtgQd.js.map +1 -0
  261. package/dist/middleware-IjYx3d5u.cjs +45 -0
  262. package/dist/middleware-IjYx3d5u.cjs.map +1 -0
  263. package/dist/notifications/index.cjs +4 -4
  264. package/dist/notifications/index.d.cts +2 -2
  265. package/dist/notifications/index.d.ts +2 -2
  266. package/dist/notifications/index.js +4 -4
  267. package/dist/notifications/types.d.cts +1 -1
  268. package/dist/notifications/types.d.ts +1 -1
  269. package/dist/oauth/index.cjs +1 -1
  270. package/dist/oauth/index.d.cts +2 -2
  271. package/dist/oauth/index.d.ts +2 -2
  272. package/dist/oauth/index.js +1 -1
  273. package/dist/oauth/types.d.cts +1 -1
  274. package/dist/oauth/types.d.ts +1 -1
  275. package/dist/{oauth-B8yqG6Sy.cjs → oauth--2p8jkJf.cjs} +5 -5
  276. package/dist/{oauth-B8yqG6Sy.cjs.map → oauth--2p8jkJf.cjs.map} +1 -1
  277. package/dist/{oauth--asfePw-.js → oauth-l5zE39cD.js} +5 -5
  278. package/dist/{oauth--asfePw-.js.map → oauth-l5zE39cD.js.map} +1 -1
  279. package/dist/omnisearch/index.cjs +6 -14
  280. package/dist/omnisearch/index.cjs.map +1 -1
  281. package/dist/omnisearch/index.d.cts +6 -14
  282. package/dist/omnisearch/index.d.ts +6 -14
  283. package/dist/omnisearch/index.js +6 -14
  284. package/dist/omnisearch/index.js.map +1 -1
  285. package/dist/omnisearch/types.d.cts +1 -1
  286. package/dist/omnisearch/types.d.ts +1 -1
  287. package/dist/{project-C2wvX0xZ.d.ts → project-B15gStbM.d.ts} +2 -2
  288. package/dist/{project-hePfzUY0.d.cts → project-cHKuGvqJ.d.cts} +2 -2
  289. package/dist/queryService/index.cjs +1 -1
  290. package/dist/queryService/index.d.cts +1 -1
  291. package/dist/queryService/index.d.ts +1 -1
  292. package/dist/queryService/index.js +1 -1
  293. package/dist/queryService/types.d.cts +1 -1
  294. package/dist/queryService/types.d.ts +1 -1
  295. package/dist/{queryService-Ca65E5KH.js → queryService-CCOYbRbw.js} +6 -6
  296. package/dist/{queryService-Ca65E5KH.js.map → queryService-CCOYbRbw.js.map} +1 -1
  297. package/dist/{queryService-BVtjkXy1.cjs → queryService-CQzclHdL.cjs} +6 -6
  298. package/dist/{queryService-BVtjkXy1.cjs.map → queryService-CQzclHdL.cjs.map} +1 -1
  299. package/dist/queue/index.cjs +1 -1
  300. package/dist/queue/index.d.cts +3 -3
  301. package/dist/queue/index.d.ts +3 -3
  302. package/dist/queue/index.js +1 -1
  303. package/dist/queue/types.d.cts +1 -1
  304. package/dist/queue/types.d.ts +1 -1
  305. package/dist/{queue-DyotLFJi.js → queue-Cowbg6bR.js} +8 -11
  306. package/dist/queue-Cowbg6bR.js.map +1 -0
  307. package/dist/{queue-OJJUUqc2.cjs → queue-UG_BWKIC.cjs} +8 -11
  308. package/dist/queue-UG_BWKIC.cjs.map +1 -0
  309. package/dist/scheduler/index.cjs +4 -4
  310. package/dist/scheduler/index.d.cts +2 -2
  311. package/dist/scheduler/index.d.ts +2 -2
  312. package/dist/scheduler/index.js +4 -4
  313. package/dist/scheduler/types.d.cts +1 -1
  314. package/dist/scheduler/types.d.ts +1 -1
  315. package/dist/sdk/configurations/index.cjs +1 -1
  316. package/dist/sdk/configurations/index.d.cts +11 -11
  317. package/dist/sdk/configurations/index.d.ts +11 -11
  318. package/dist/sdk/configurations/index.js +1 -1
  319. package/dist/sdk/developerPortal/index.cjs +10 -18
  320. package/dist/sdk/developerPortal/index.cjs.map +1 -1
  321. package/dist/sdk/developerPortal/index.d.cts +7 -15
  322. package/dist/sdk/developerPortal/index.d.ts +7 -15
  323. package/dist/sdk/developerPortal/index.js +7 -15
  324. package/dist/sdk/developerPortal/index.js.map +1 -1
  325. package/dist/sdk/kaiMemory/index.cjs +7 -0
  326. package/dist/sdk/kaiMemory/index.d.cts +41 -0
  327. package/dist/sdk/kaiMemory/index.d.ts +41 -0
  328. package/dist/sdk/kaiMemory/index.js +2 -0
  329. package/dist/sdk/kaiMemory/types.cjs +0 -0
  330. package/dist/sdk/kaiMemory/types.d.cts +2 -0
  331. package/dist/sdk/kaiMemory/types.d.ts +2 -0
  332. package/dist/sdk/kaiMemory/types.js +1 -0
  333. package/dist/sdk/queryService/index.cjs +2 -2
  334. package/dist/sdk/queryService/index.d.cts +1 -1
  335. package/dist/sdk/queryService/index.d.ts +1 -1
  336. package/dist/sdk/queryService/index.js +2 -2
  337. package/dist/sdk/semanticLayer/index.cjs +1 -1
  338. package/dist/sdk/semanticLayer/index.d.cts +16 -40
  339. package/dist/sdk/semanticLayer/index.d.ts +16 -40
  340. package/dist/sdk/semanticLayer/index.js +1 -1
  341. package/dist/sdk/semanticLayer/types.d.cts +1 -1
  342. package/dist/sdk/semanticLayer/types.d.ts +1 -1
  343. package/dist/sdk/storage/index.cjs +0 -5
  344. package/dist/sdk/storage/index.cjs.map +1 -1
  345. package/dist/sdk/storage/index.d.cts +2 -2
  346. package/dist/sdk/storage/index.d.ts +2 -2
  347. package/dist/sdk/storage/index.js +1 -5
  348. package/dist/sdk/storage/index.js.map +1 -1
  349. package/dist/sdk/tag/index.cjs +1 -1
  350. package/dist/sdk/tag/index.d.cts +3 -3
  351. package/dist/sdk/tag/index.d.ts +3 -3
  352. package/dist/sdk/tag/index.js +1 -1
  353. package/dist/sdk/tag/types.d.cts +1 -1
  354. package/dist/sdk/tag/types.d.ts +1 -1
  355. package/dist/sdk/vault/index.cjs +1 -1
  356. package/dist/sdk/vault/index.d.cts +1 -1
  357. package/dist/sdk/vault/index.d.ts +1 -1
  358. package/dist/sdk/vault/index.js +1 -1
  359. package/dist/{semanticLayer-E0Vilu8u.cjs → semanticLayer-CKDVkU56.cjs} +78 -166
  360. package/dist/semanticLayer-CKDVkU56.cjs.map +1 -0
  361. package/dist/{semanticLayer-CSqmtHRo.js → semanticLayer-pYy082Ju.js} +78 -166
  362. package/dist/semanticLayer-pYy082Ju.js.map +1 -0
  363. package/dist/{serviceIds-DRcoTnSd.d.cts → serviceIds-DC-H6ZD9.d.cts} +2 -1
  364. package/dist/{serviceIds-DRcoTnSd.d.ts → serviceIds-DC-H6ZD9.d.ts} +2 -1
  365. package/dist/status/index.cjs +1 -1
  366. package/dist/status/index.d.cts +1 -1
  367. package/dist/status/index.d.ts +1 -1
  368. package/dist/status/index.js +1 -1
  369. package/dist/storage/index.cjs +6 -5
  370. package/dist/storage/index.d.cts +3 -3
  371. package/dist/storage/index.d.ts +3 -3
  372. package/dist/storage/index.js +6 -6
  373. package/dist/storage/types.d.cts +3 -3
  374. package/dist/storage/types.d.ts +3 -3
  375. package/dist/{storage-LYwFQPNO.js → storage-CZQHZcXG.js} +127 -289
  376. package/dist/storage-CZQHZcXG.js.map +1 -0
  377. package/dist/{storage-BKm7cztt.cjs → storage-JinL1y1s.cjs} +132 -288
  378. package/dist/storage-JinL1y1s.cjs.map +1 -0
  379. package/dist/stream/index.cjs +3 -3
  380. package/dist/stream/index.d.cts +2 -2
  381. package/dist/stream/index.d.ts +2 -2
  382. package/dist/stream/index.js +3 -3
  383. package/dist/stream/types.d.cts +1 -1
  384. package/dist/stream/types.d.ts +1 -1
  385. package/dist/syncActions/index.cjs +1 -1
  386. package/dist/syncActions/index.d.cts +1 -1
  387. package/dist/syncActions/index.d.ts +1 -1
  388. package/dist/syncActions/index.js +1 -1
  389. package/dist/syncActions/types.d.cts +2 -2
  390. package/dist/syncActions/types.d.ts +2 -2
  391. package/dist/{syncActions-QeBhIVhG.js → syncActions-BmmoqZO_.js} +130 -111
  392. package/dist/syncActions-BmmoqZO_.js.map +1 -0
  393. package/dist/{syncActions-OEZdVffK.cjs → syncActions-CtcLGQiy.cjs} +130 -111
  394. package/dist/syncActions-CtcLGQiy.cjs.map +1 -0
  395. package/dist/{tag-CsoOZWB_.cjs → tag-DHS_soa7.cjs} +2 -2
  396. package/dist/{tag-CsoOZWB_.cjs.map → tag-DHS_soa7.cjs.map} +1 -1
  397. package/dist/{tag-DCsoewjL.js → tag-hh-1nhNr.js} +2 -2
  398. package/dist/{tag-DCsoewjL.js.map → tag-hh-1nhNr.js.map} +1 -1
  399. package/dist/telemetry/index.cjs +7 -11
  400. package/dist/telemetry/index.cjs.map +1 -1
  401. package/dist/telemetry/index.d.cts +5 -9
  402. package/dist/telemetry/index.d.ts +5 -9
  403. package/dist/telemetry/index.js +7 -11
  404. package/dist/telemetry/index.js.map +1 -1
  405. package/dist/telemetry/types.d.cts +1 -1
  406. package/dist/telemetry/types.d.ts +1 -1
  407. package/dist/{types-DqxIx9Pi.d.cts → types-6kuMW4JW.d.cts} +2 -2
  408. package/dist/{types-Ct0YPy2w.d.ts → types-B2w2TtSA.d.ts} +3 -3
  409. package/dist/{types-M46WuBSm.d.cts → types-B61aCifg.d.cts} +2 -2
  410. package/dist/{types-COL1kVEB.d.cts → types-B8N_k79M.d.cts} +2 -2
  411. package/dist/{types-Jw10xuOW.d.cts → types-BIECJYun.d.ts} +171 -44
  412. package/dist/{types-DZk3XHiN.d.cts → types-BLNB882w.d.cts} +3 -3
  413. package/dist/{types-BEe50G2r.d.cts → types-BPy5Ozee.d.cts} +2 -2
  414. package/dist/{types-DBOSvWtD.d.ts → types-BS4jwuMi.d.ts} +8 -15
  415. package/dist/{types-BrYkBQo4.d.ts → types-BTK7Bv3n.d.cts} +171 -44
  416. package/dist/{types-CW6lCqrC.d.cts → types-BYM9Ptz5.d.ts} +93 -43
  417. package/dist/{types-D6UmMa6E.d.ts → types-BZDV8DZk.d.ts} +3 -3
  418. package/dist/{types-Cz83RiVu.d.cts → types-B_iLJlp4.d.ts} +255 -12
  419. package/dist/{types-DjrRmQUe.d.cts → types-BiMahEK8.d.cts} +92 -238
  420. package/dist/{types-BH5LLeJy.d.ts → types-Bl03Cg2n.d.cts} +255 -12
  421. package/dist/{types-bGQb4Jtl.d.cts → types-ByLH46Dt.d.cts} +13 -8
  422. package/dist/{types-g3vU7hcg.d.cts → types-Bydx6ga_.d.cts} +2 -2
  423. package/dist/{types-DYzJ6K2e.d.ts → types-CFeZCQ9p.d.cts} +93 -43
  424. package/dist/{types-DEc55spK.d.ts → types-CKmTZSPG.d.ts} +92 -238
  425. package/dist/{types-CaYtinmA.d.cts → types-CMzQSHAQ.d.cts} +3 -3
  426. package/dist/{types-N3EChotg.d.cts → types-CP_LBmw3.d.cts} +2 -2
  427. package/dist/{types-zZBxJ0P-.d.ts → types-CWyXTMwy.d.ts} +2 -2
  428. package/dist/{types-CPB-eF82.d.ts → types-CZJlLCbA.d.ts} +2 -2
  429. package/dist/{types-l9o4gFsI.d.ts → types-CZXPu3gn.d.ts} +2 -2
  430. package/dist/{types-BztF4HeB.d.ts → types-CaOtNjSZ.d.ts} +6 -13
  431. package/dist/{types-BTWIPEiU.d.ts → types-CfwqVkEA.d.ts} +2 -2
  432. package/dist/types-Cg14ncdV.d.ts +63 -0
  433. package/dist/{types-Bxhh2SJr.d.ts → types-CoJVrRAD.d.ts} +2 -2
  434. package/dist/{types-CKiW3n6v.d.ts → types-D3wcs4tp.d.ts} +2 -2
  435. package/dist/{types-DPS8nwkV.d.cts → types-DDOa07rU.d.cts} +8 -15
  436. package/dist/{types-BW2BXUB4.d.cts → types-DE9hgr7i.d.cts} +2 -2
  437. package/dist/{types-BOqD3Hqy.d.cts → types-DEzW1CfI.d.cts} +3 -3
  438. package/dist/{types-OaD-cbbl.d.ts → types-DIiOMV-t.d.ts} +3 -3
  439. package/dist/{types-BuqxXXYP.d.ts → types-DKc1gmd9.d.ts} +949 -190
  440. package/dist/{types-BQsOHNI0.d.ts → types-DRCMBt89.d.ts} +3 -3
  441. package/dist/{types-BQvv4RaI.d.cts → types-DUMal2E-.d.cts} +5 -8
  442. package/dist/types-DWiLcrxt.d.cts +63 -0
  443. package/dist/{types-DNxOHnZI.d.cts → types-Dd31Lw4S.d.cts} +2 -2
  444. package/dist/{types-Dmu-8g4O.d.ts → types-DekYAlA-.d.ts} +3 -3
  445. package/dist/{types-B2U9cFcx.d.ts → types-DgJeO9Nd.d.ts} +2 -2
  446. package/dist/{types-nrviNdzZ.d.ts → types-DicSaNwq.d.ts} +2 -2
  447. package/dist/{types-f8W_j6qD.d.cts → types-DinIJ1D_.d.cts} +688 -201
  448. package/dist/{types-DhDNS-5B.d.ts → types-DlQw6FCi.d.ts} +13 -8
  449. package/dist/{types-_RhBCj4_.d.cts → types-DoZtE9tz.d.cts} +3 -3
  450. package/dist/{types-BsxLGDoC.d.cts → types-DrvKfXXd.d.cts} +2 -2
  451. package/dist/{types-CzsnuPFh.d.cts → types-Dtuvhm3K.d.cts} +949 -190
  452. package/dist/{types-CcrvrAJX.d.ts → types-DwVSj-Da.d.ts} +5 -8
  453. package/dist/{types-C2vefB4D.d.ts → types-FwRmjsNN.d.ts} +10 -34
  454. package/dist/{types-C0_2KZ-A.d.ts → types-RbrfiY8T.d.ts} +2 -2
  455. package/dist/{types-DfvdbRPL.d.ts → types-WZBztugL.d.ts} +2 -2
  456. package/dist/{types-52irAt99.d.cts → types-YHUEArkR.d.cts} +2 -2
  457. package/dist/{types-fX4gbxfV.d.cts → types-bc-4z_gc.d.cts} +10 -34
  458. package/dist/{types-3eUgOA7I.d.cts → types-ePSqbXRr.d.cts} +6 -13
  459. package/dist/{types-BupPADSm.d.ts → types-n4PTnLii.d.ts} +688 -201
  460. package/dist/{types-DXskkNp8.d.cts → types-pvQzbgNE.d.cts} +3 -3
  461. package/dist/{types-DajzGOKB.d.ts → types-q-1r_9d1.d.ts} +2 -2
  462. package/dist/{types-D8Rrz51O.d.cts → types-tKkeLa2B.d.cts} +2 -2
  463. package/dist/{validateConnectionStatus-olE2sQ3U.js → validateConnectionStatus-BEGu8wXT.js} +7 -10
  464. package/dist/validateConnectionStatus-BEGu8wXT.js.map +1 -0
  465. package/dist/{validateConnectionStatus-CsvYmCOI.cjs → validateConnectionStatus-BEYkQpu9.cjs} +7 -10
  466. package/dist/validateConnectionStatus-BEYkQpu9.cjs.map +1 -0
  467. package/dist/vault/index.cjs +4 -4
  468. package/dist/vault/index.d.cts +1 -1
  469. package/dist/vault/index.d.ts +1 -1
  470. package/dist/vault/index.js +4 -4
  471. package/dist/vault/types.d.cts +1 -1
  472. package/dist/vault/types.d.ts +1 -1
  473. package/package.json +58 -4
  474. package/surface/apps.md +3 -3
  475. package/surface/auth.md +13 -6
  476. package/surface/businessWorkspaceApi.md +12 -0
  477. package/surface/chat.md +7 -7
  478. package/surface/kaiAgent.md +13 -9
  479. package/surface/management.md +18 -5
  480. package/surface/metastore.md +2 -2
  481. package/surface/queue.md +3 -3
  482. package/surface/sdk.md +13 -3
  483. package/surface/storage.md +6 -6
  484. package/surface/syncActions.md +9 -0
  485. package/dist/ValidationError-BekhphAq.js +0 -48
  486. package/dist/ValidationError-BekhphAq.js.map +0 -1
  487. package/dist/ValidationError-CLVJCCwH.cjs.map +0 -1
  488. package/dist/authClient-D7W9vWPR.js.map +0 -1
  489. package/dist/authClient-_PpvGgZJ.cjs.map +0 -1
  490. package/dist/concurrent-CH9fbNr3.js.map +0 -1
  491. package/dist/concurrent-tbiIa0UL.cjs.map +0 -1
  492. package/dist/configurations-BVvcimzo.js.map +0 -1
  493. package/dist/configurations-CyFF9Dtu.cjs.map +0 -1
  494. package/dist/configurations-VtNE0nrT.js.map +0 -1
  495. package/dist/configurations-zkNjr73Q.cjs.map +0 -1
  496. package/dist/constants-C4DlsF_M.cjs.map +0 -1
  497. package/dist/constants-wfbFsqqN.js.map +0 -1
  498. package/dist/createFetchClient-DgMiqTJ8.cjs.map +0 -1
  499. package/dist/createFetchClient-U-ZrwPl2.js.map +0 -1
  500. package/dist/credential-CihSf_xs.js +0 -36
  501. package/dist/credential-CihSf_xs.js.map +0 -1
  502. package/dist/credential-DVWvJFJs.cjs +0 -47
  503. package/dist/credential-DVWvJFJs.cjs.map +0 -1
  504. package/dist/dedupe-CiskLkGR.cjs +0 -30
  505. package/dist/dedupe-CiskLkGR.cjs.map +0 -1
  506. package/dist/dedupe-DYIHgZoG.js +0 -25
  507. package/dist/dedupe-DYIHgZoG.js.map +0 -1
  508. package/dist/isLoginPageRedirect-B0EmRsHr.cjs +0 -25
  509. package/dist/isLoginPageRedirect-B0EmRsHr.cjs.map +0 -1
  510. package/dist/isLoginPageRedirect-BTTAedW-.js +0 -20
  511. package/dist/isLoginPageRedirect-BTTAedW-.js.map +0 -1
  512. package/dist/jobStatus-0_Y3Sr4i.cjs.map +0 -1
  513. package/dist/jobStatus-PSZJMTiA.js.map +0 -1
  514. package/dist/kaiAgent-8LNzGhZc.js.map +0 -1
  515. package/dist/kaiAgent-B_TaUPRt.cjs.map +0 -1
  516. package/dist/management-BoxlRNg2.cjs.map +0 -1
  517. package/dist/management-Bp440RsV.js.map +0 -1
  518. package/dist/metastore-BYYWTb3m.cjs.map +0 -1
  519. package/dist/metastore-VCDRVhUT.js.map +0 -1
  520. package/dist/queue-DyotLFJi.js.map +0 -1
  521. package/dist/queue-OJJUUqc2.cjs.map +0 -1
  522. package/dist/semanticLayer-CSqmtHRo.js.map +0 -1
  523. package/dist/semanticLayer-E0Vilu8u.cjs.map +0 -1
  524. package/dist/storage-BKm7cztt.cjs.map +0 -1
  525. package/dist/storage-LYwFQPNO.js.map +0 -1
  526. package/dist/syncActions-OEZdVffK.cjs.map +0 -1
  527. package/dist/syncActions-QeBhIVhG.js.map +0 -1
  528. package/dist/validateConnectionStatus-CsvYmCOI.cjs.map +0 -1
  529. package/dist/validateConnectionStatus-olE2sQ3U.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,199 @@
1
1
  # @keboola/api-client
2
2
 
3
+ ## 40.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Cookie (browser-mode) credentials on the bearer client.
8
+ - `createKeboola({ credentials: 'cookie' })` renews its credential through `auth.token.refreshWithSession`. The refresh token stays server-side, bound to the session cookie. A refused session signs the stack out, the same way a refused refresh token does. The default stays `'token'`.
9
+ - **Breaking:** a `cookie` credential carries `sessionId`, and `session.auth.authenticate` requires it.
10
+ - `authenticate` refuses a rotating credential of the kind the client was not built for, with `KeboolaErrorType.CredentialKindMismatch`. A restore reads a stored one of that kind as nothing stored.
11
+ - A cookie credential persists its session id, so a reload restores it through the session cookie.
12
+ - `CredentialMode` is exported.
13
+
14
+ - Remove `removeBranchFromUrl` from `@keboola/api-client/sdk/storage`
15
+
16
+ It stripped the `/branch/{id}/` segment from a project URL. Project URLs now always name a branch — production is the default branch, not the absence of one — so a URL with the segment removed is not a production URL, it is an old link that gets rewritten back on arrival. Its last caller is gone.
17
+
18
+ Replace a call with the branch you actually want: build the URL at the default branch id rather than stripping the segment.
19
+
20
+ - Browser/cookie mode on the auth client.
21
+ - `auth.login.withPassword` / `withOidc` take `browserMode` (default `false`), which also mints a browser session cookie for the issued session. The backend requires an `Origin` matching the stack app URL for it. The result type follows the flag: browser mode carries no `refreshToken`, API mode guarantees one.
22
+ - **Breaking:** `auth.token.refresh` is replaced by `refreshWithToken({ refreshToken })` (API mode) and `refreshWithSession({ sessionId })` (browser mode, sending `X-KBC-CSRF`).
23
+ - **Breaking:** the bearer credential kinds are renamed for what renews them — `browser` → `token`, `mediated` → `cookie`. A session stored under the old names is not read, so it signs in again.
24
+ - **Breaking:** `LoginSuccess` / `LoginResult` / `loginSuccessSchema` / `loginResultSchema` are replaced by `Api*` and `Browser*` pairs; `loginInputSchema` is no longer exported (use `passwordInputSchema`).
25
+ - **Breaking:** `saml.assert` takes the regenerated body, which now carries `browserMode`.
26
+
27
+ - replace MANAGE_TOKEN_SCOPES with management.applicationTokens.getApplicationTokenScopes
28
+
29
+ The constant mirrored the stack's scope list by hand and had to be edited in lockstep with the
30
+ backend; the Manage API now publishes the list, so the copy is gone.
31
+
32
+ - The bearer client always has an active stack, and restores only when asked.
33
+ - `createKeboola({ defaultBaseUrl })` is required. That stack is active from construction until `session.resume()` or `stack.select` moves it; `baseUrl` is gone.
34
+ - `session.stack.getActive()` returns `Stack`, never `null`. `stack.close` refuses the active stack (`KeboolaErrorType.StackActive`); `stack.deactivate()` is removed.
35
+ - `session.restored` is replaced by `session.resume()`, called once on startup and resolving with the same `RestoreStatus`. It rebuilds the stored stacks, credentials and projects and makes the stored stack and project active again; with nothing stored, or on a failed restore, the default stays active. A caller that selected a stack or project, or signed in or out, first keeps its scope, and a stack it signed in or out of keeps that sign-in. Persistence starts only after it settles.
36
+ - `session.auth.isAuthenticated()` reports whether the active stack holds a credential; `isAuthenticatedAsync()` answers once the stored session has resumed.
37
+ - `session.auth.replace(credential)` signs the active stack out and in with `credential`, winning over a restore still in flight.
38
+ - `session.auth.adoptInjected(credential)` (deprecated on arrival) adopts a server-injected `token` credential even in cookie mode. Temporary, for the agent-project claim page, until Connection stops injecting `UiConfig.programmaticAuth`.
39
+ - `createLegacyKeboola` keeps `baseUrl` (`LegacyKeboolaOptions`).
40
+
41
+ - rework management.uiApps around the application's `stringId`
42
+ - **New:** `getUiApp(stringId)` returns the application with every registered version.
43
+ - **New:** `renameUiApp({ stringId, name })`.
44
+ - **New:** `getUiApps({ includeInactive })` also lists applications with no active version.
45
+ - **Breaking:** `activateUiAppVersion` and `deleteUiApp` take the `stringId` instead of `id`.
46
+ - **Breaking:** `UiApp` carries `stringId`, and its version fields are nullable; `ActivateUiAppVersionPath` is no longer exported.
47
+
48
+ - Rebuild the bearer (OAuth) flow around a session-state table addressed by stack and project.
49
+ - **`createKeboola` is the factory's only public name.** The `createSessionClient` alias and the `SessionClient` type are gone — import `createKeboola`, and type a session as `BearerSession`.
50
+ - **It returns `{ session, getActiveApi, getApi }`, not `{ api, session }`.** `getActiveApi()` follows `session.project.select`; `getApi(projectId)` opens that project and stays pinned to it, so one signed-in client reaches several projects at once. Close a pinned project with `session.project.close(projectId)`.
51
+ - **The bearer `session` is regrouped** into `stack.*`, `project.*` and `auth.*`, plus `getState()` / `subscribe()` over the stack-and-project table and a `restored` promise resolving `RestoreStatus` (`'restored' | 'expired' | 'unreachable' | 'empty'`, where `expired` means the server refused the refresh token and `unreachable` means the exchange never got an answer — retry, never a login). Every verb is synchronous — a product namespace throws `NotReady` until that entry's context fetch lands, and `stack.getContextAsync` / `project.getContextAsync` await it.
52
+
53
+ | Was | Now |
54
+ | -------------------------------- | ------------------------------------------ |
55
+ | `setBaseUrl(url)` | `stack.select(url)` |
56
+ | `authenticate(tokens)` | `auth.authenticate(credential)` |
57
+ | `setProject(id)` | `project.select(id)` |
58
+ | `clearProject()` | `project.deactivate()` |
59
+ | `reset()` | `auth.signOut()` |
60
+ | `getAuthHeaders(projectId?)` | `auth.getHeaders(projectId?)` |
61
+ | `api` (the scoped surface) | `getActiveApi()` |
62
+ | `forProject(id)` | `getApi(id)` |
63
+ | `restore()` | the `restored` promise |
64
+ | `subscribe(cb)` (debug snapshot) | `subscribe(cb)` + `getState()` (the table) |
65
+
66
+ Removed with no replacement: `setProjectAsync`, `isStorageReady`, `hasPersistedValue`, `debug`, `debugForceRefresh`.
67
+
68
+ - **`baseUrl` is now the stack to start on, not the stack to talk to.** The bearer factory scopes it once `restored` settles, and only if the restore scoped nothing — so a stored session keeps its own stack. Any stack still enters the table through `session.stack.select(baseUrl)`.
69
+ - **The bearer engine no longer carries the legacy SAPI flow.** Use `createLegacyKeboola` for SAPI tokens.
70
+ - New type exports: `RestoreStatus`, `SessionState`, `AuthPhase`, `FetchStatus`, `ActiveLocation`, `StackEntry`, `ProjectEntry`, `BearerCredentialEntry`.
71
+
72
+ ### Minor Changes
73
+
74
+ - Project-level Kai tool policy: `kaiAgent.updateProjectToolPolicy`, `toolPermissions`/`canWriteToolPolicy` on agent settings and `projectToolPermissions` on user agent settings; org-admin Tool permissions card in Project Settings.
75
+
76
+ - AI-3943: `kaiAgent.getUsage` exposes the organization's one-time free Kai allowance (`freeAllowance.grantedPpu`/`remainingPpu`); kbc-ui shows a one-time dismissible info notice in the Kai chat surfaces until dismissed or spent.
77
+
78
+ - Deprecate `createModelTree` in the semantic layer SDK (`@keboola/api-client/sdk/semanticLayer`); it is removed in the next major
79
+
80
+ It creates a model, then its children, one request each, and rejects on the first failed child, leaving behind whatever it had already written. Nothing in this repository calls it.
81
+
82
+ Create the model with `createModel`, then its children with `createObject` or `createObjects`. To delete a model that failed partway through, use `deleteModel`.
83
+
84
+ - `api.syncActions.flowMigration.validate` and `.preview` run `keboola.flow-migration-tool`'s sync
85
+ actions for a list of orchestrations and return one parsed result per orchestration. `preview` is a
86
+ dry run: its results carry the status (`dry-run`, `skipped` or `failed`), the structural changes,
87
+ and the flow configuration the orchestration would become.
88
+
89
+ - `api.syncActions.sshKeys.generate` generates an SSH key pair via `keboola.ssh-keygen-v2` and
90
+ returns its `public` and `private` keys.
91
+
92
+ - Deleted project detail exposes storage backend `backends` (like project detail) so the UI can show the backend ID as a link to `/control/storage-backends/<id>`; control-ui renders ID + type badge, gated by `canReadStorageBackends`.
93
+
94
+ - Support per-chat model tier selection and optional Fast preparation context. Chat detail responses include requested and effective tier labels plus the fixed effort. Existing callers may omit the additive request fields.
95
+
96
+ - Adds the `kaiMemory` SDK (`api.sdk.kaiMemory`) over the metastore client for Kai's org-wide knowledge-base notes, and a `canManageKaiMemory` permission predicate.
97
+
98
+ - add management.applicationTokens service, including the stack-published scope list
99
+
100
+ - `createManagementClient` takes `mintSessionToken` on a `management-token` auth strategy.
101
+ - The client authenticates every call with a session token minted from `token` (`POST /manage/current-user/session-token`), not with `token` itself.
102
+ - When that session token expires, the next one is minted from `token` again.
103
+ - Without `mintSessionToken`, an invalid token is replaced from the browser's login session (`POST /admin/account/session-token`) in every environment.
104
+
105
+ ### Patch Changes
106
+
107
+ - `canWriteSemanticLayer` now mirrors the metastore's role rule: only the `admin` and `productionManager` project roles may write the semantic layer, and the metastore answers every other role (and a limited token) with a 403. kbc-ui's semantic-layer editor stops offering write actions to those callers, and Kai hides its semantic-layer write tools from them. Tool Permissions lists those tools for every caller, a project block hides them from Kai, and Kai reports a metastore 403 in the metastore's own words (AI-3742).
108
+
109
+ - Messages the UI sends on its own (data-app preview error forwards, job-finished nudges) are tagged `autoForwarded` and no longer count toward the monthly Kai message limit; the burst limiter still counts them. kai-agent honors the flag only when the text matches one of the UI's fixed auto-forward templates and strips it otherwise (AI-3887)
110
+
111
+ - Accept an optional `AbortSignal` in `chat.getHistory` and `kaiAgent.getHistory`, matching the other read methods on both clients. Callers that cancel a query now abort the request it started.
112
+
113
+ - Add `auth.manageTokens` — list, create and revoke Manage API tokens. The list keeps hand-made tokens and session tokens in separate arrays, and creating one needs an active sudo window.
114
+
115
+ - Add the optional `continueOnFailure` boolean to the `keboola.ex-google-ads` configuration schema, alongside the existing `onlyEnabledCustomers` flag.
116
+
117
+ - The generated Manage API types match the live document.
118
+ - A deleted project's `backends` entries are `{ id }`, the only field the endpoint returns for each backend.
119
+ - The schema carries `PATCH` and `DELETE /manage/file-storage/{fileStorageId}`.
120
+
121
+ - Accept an optional `query` filter on `metastore.repository.getMetaObjects` and `getMetaObjectRevisions` (AI-3975). The metastore already filters these list endpoints server-side on any object field (`{ status: 'pending' }`, `{ 'field[in]': 'a|b' }`, ...) — the SDK just wasn't forwarding it. Callers no longer have to page every object of a type and filter client-side.
122
+
123
+ ## 39.0.0
124
+
125
+ ### Minor Changes
126
+
127
+ - Add `management.programmaticProjects` namespace with `confirm({ claimToken? }, signal?)` — redeems an agent project's claim token, making the bearer's account its owner. `claimToken` is optional: Connection also accepts the claim from the `HttpOnly` cookie its confirmation page sets, which is the only copy left after a sign-up or SSO round trip.
128
+
129
+ - Add `businessWorkspaceApi` service client (`@keboola/api-client/businessWorkspaceApi`) for the Business Workspace dashboards backend.
130
+
131
+ - `api.kaiAgent.getArtifacts(chatId)` and `api.kaiAgent.getArtifact(id)`: the two read routes kai-agent now serves for the artifacts it derives at the end of a turn. Both are typed off the regenerated kai-agent schema, and the chat is the authorization — a chat the caller cannot read has no artifacts. There is no write pair, because nothing but the agent creates an artifact.
132
+
133
+ `spec` and `recipe` come back as open maps. The routes document them as passthrough objects, so the generated types carry no shape for either; `ArtifactSpec` / `ArtifactRecipe` in `@keboola/kai-chat/artifacts` are the shapes behind them, and the narrowing belongs in that package — it already depends on this one, and the reverse edge would close a workspace cycle.
134
+
135
+ ### Patch Changes
136
+
137
+ - `readableReason` keeps the message an `ApiError` subclass authored for a reader.
138
+
139
+ It discarded the message of every error matching `isApiError`, but `HtmlResponseError` and `ManagementClientAuthError` overwrite theirs with wording written for exactly this spot — so an expired session surfaced as "Unknown error" rather than saying the session had expired. Only the base class builds its message from the response status, so only the base class is read as carrying a status line.
140
+
141
+ ## 38.0.0
142
+
143
+ ### Minor Changes
144
+
145
+ - Expose the optional organization creation timestamp in Storage token verification responses.
146
+ The ISO-8601 `organization.created` field is nullable when the creation time is unavailable.
147
+
148
+ ## 37.0.0
149
+
150
+ ### Major Changes
151
+
152
+ - **Breaking:** `ApiError.message` is a status line rather than the HTTP reason phrase, and every error class now reports its own `name`.
153
+
154
+ `message` was `response.statusText`, which HTTP/2 leaves empty — so over every production response an error reached a reporter as `Error:` with no message and no status. It is now `"404 Not Found"`, or `"404"` where no reason phrase was sent.
155
+
156
+ **What breaks.** A status line is never empty, so the two ways consumers detected "no reason was reported" both stop working:
157
+
158
+ ```ts
159
+ // Before: `message` was '' over HTTP/2, so the written wording always won.
160
+ // After: `message` is '502', so the written wording never wins.
161
+ toast.error(err.message || "Saving the token failed.");
162
+ if (err.message === "") return "No reason was reported.";
163
+ ```
164
+
165
+ Use `readableReason(err)`, new in this release. It returns the service's own sentence from the parsed response body, and `undefined` when the failure carries none — the cue to render your own wording. It never returns the status line:
166
+
167
+ ```ts
168
+ toast.error(readableReason(err) ?? "Saving the token failed.");
169
+ ```
170
+
171
+ `HtmlResponseError` and `ManagementClientAuthError` previously inherited `ApiError`'s constructor without setting `name`, so they reported as plain `Error`; each now names itself. Anything grouping errors by `name` — Sentry's exception type included — will see the new values.
172
+
173
+ `deleteModel` counts a child object a concurrent cascade already deleted (`404`) as deleted rather than as a failure that keeps the model alive. The model's own delete is tolerant of a `404` only once a child has actually been deleted, so deleting a model that never existed still rejects.
174
+
175
+ ### Minor Changes
176
+
177
+ - `kaiAgentClient` gains `prepareChat(chatId, signal?)`, for the engine's new `POST /api/chat/{id}/prepare`.
178
+
179
+ It asks the engine to build a chat's sandbox — container, workspace, agent process and its MCP connects — before a turn needs one, on a signal from the host's UI that a message is coming. The work continues after the response resolves, and a deployment whose host does not implement the pre-warm port answers `404`, which callers should read as "not supported here" rather than as an error.
180
+
181
+ ### Patch Changes
182
+
183
+ - Refresh an expired management session token when token verification responds with HTTP 401.
184
+
185
+ - `kaiAgentClient.prepareChat` folds a `404` into `{ started: false }` rather than throwing.
186
+
187
+ 404 is the documented "this deployment does not pre-warm", so every caller had to remember to catch it to tell that apart from a real failure.
188
+
189
+ ## 36.0.1
190
+
191
+ ### Patch Changes
192
+
193
+ - `approveToolCall` accepts an optional `dismissed` flag on the approval body. The Kai plan card sends
194
+ it when the user dismisses a plan, so the backend can tell that apart from Request Changes without
195
+ inspecting the user's own text. Additive and optional — existing callers are unaffected.
196
+
3
197
  ## 36.0.0
4
198
 
5
199
  ### Major Changes
package/README.md CHANGED
@@ -78,9 +78,9 @@ Interactive login, then scope to a project:
78
78
  ```typescript
79
79
  import { createKeboola } from '@keboola/api-client';
80
80
 
81
- const { api, session } = createKeboola({ baseUrl });
81
+ const { api, session } = createKeboola({ defaultBaseUrl: baseUrl });
82
82
 
83
- // api.auth is live as soon as baseUrl is configured
83
+ // api.auth is live from construction: a stack is always active
84
84
  const result = await api.auth.login.withPassword({ email, password });
85
85
  if (result.mfaRequired) {
86
86
  // result is an MFA challenge — verify via api.auth.mfa.* to obtain the LoginSuccess
@@ -103,7 +103,7 @@ credential, hand a `LoginSuccess`-shaped object straight to `session.authenticat
103
103
  ```typescript
104
104
  import { createKeboola } from '@keboola/api-client';
105
105
 
106
- const { api, session } = createKeboola({ baseUrl: process.env.KEBOOLA_STACK_URL! });
106
+ const { api, session } = createKeboola({ defaultBaseUrl: process.env.KEBOOLA_STACK_URL! });
107
107
 
108
108
  session.authenticate({
109
109
  mfaRequired: false,
@@ -176,6 +176,7 @@ src/
176
176
  oauth/ # OAuth credentials
177
177
  chat/ # Kai Assistant chat
178
178
  kaiAgent/ # Kai Agent (agentic assistant)
179
+ businessWorkspaceApi/ # Business Workspace dashboards
179
180
  ai/ # AI describe/explain/suggest
180
181
  queue/ # Job Queue
181
182
  queryService/ # SQL query service
@@ -211,23 +212,24 @@ src/
211
212
  On the `api` object returned by `createKeboola()` / `createLegacyKeboola()` — once the session reaches `ready` — the following clients are available.
212
213
  Clients backed by OpenAPI specs are marked with (OpenAPI); the rest use the generic fetch client.
213
214
 
214
- | Accessor | Service | Key methods |
215
- | ------------------ | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
216
- | `api.storage` | Storage API | `buckets.*`, `tables.*`, `files.*`, `branches.*`, `workspaces.*`, `mergeRequests.*`, `jobs.*`, `components.*`, `configurations.*`, `configurationRows.*`, `configurationWorkspaces.*`, `tokens.*`, `getStackInfo()` |
217
- | `api.management` | Management API | `projects.*`, `features.*`, `users.*` |
218
- | `api.vault` | Vault (OpenAPI) | `getVariables()`, `createVariable()`, `deleteVariable()`, `getVariablesByBranchId()`, `getProjectWideVariables()` |
219
- | `api.oauth` | OAuth | `getCredentials()`, `getCredential()`, `createCredential()`, `deleteCredential()` |
220
- | `api.dataScience` | Data Science (OpenAPI) | `getApps()`, `getApp()`, `createApp()`, `patchApp()`, `deleteApp()`, `getAppRuns()`, `getAppRun()`, `getAppLogsTail()`, `getAppLogsDownload()`, `getRuntimes()`, `getSandbox()` |
221
- | `api.editor` | SQL Editor (OpenAPI) | `createSession()`, `getSession()`, `getSessions()`, `getSessionSchema()`, `createQueryJob()`, `tablePreview()`, `tableDefinition()`, `load()`, `unload()` |
222
- | `api.encryption` | Encryption | `encrypt()`, `encryptSecrets()` |
223
- | `api.chat` | Kai Assistant (OpenAPI) | `getHistory()`, `getChat()`, `createChat()`, `deleteChat()`, `getVotes()`, `submitVote()`, `getUsage()`, `getSuggestions()`, `getAgentSettings()`, `getToolsList()` |
224
- | `api.kaiAgent` | Kai Agent (OpenAPI) | `getHistory()`, `getChat()`, `createChat()`, `deleteChat()`, `approveToolCall()`, `submitToolOutput()`, `getSuggestions()`, `getAgentSettings()` |
225
- | `api.ai` | AI Service (OpenAPI) | `describeConfiguration()`, `describeConfigurationVersion()`, `describeConfigurationMerge()`, `explainError()`, `suggestComponent()`, `feedback()` |
226
- | `api.queue` | Job Queue (OpenAPI) | `getJob()`, `searchJobs()` |
227
- | `api.queryService` | Query Service (OpenAPI) | `createQueryJob()`, `cancelQueryJob()`, `getQueryJob()`, `getQueryResults()`, `getQueryHistory()`, `exportResults()` |
228
- | `api.syncActions` | Sync Actions (OpenAPI) | `enrollMFA()`, `gitRepository.*` |
229
- | `api.telemetry` | Telemetry | `provisioning.*` |
230
- | `api.import` | Import (OpenAPI) | `uploadFile()`, `writeTable()` |
215
+ | Accessor | Service | Key methods |
216
+ | -------------------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
217
+ | `api.storage` | Storage API | `buckets.*`, `tables.*`, `files.*`, `branches.*`, `workspaces.*`, `mergeRequests.*`, `jobs.*`, `components.*`, `configurations.*`, `configurationRows.*`, `configurationWorkspaces.*`, `tokens.*`, `getStackInfo()` |
218
+ | `api.management` | Management API | `projects.*`, `features.*`, `users.*` |
219
+ | `api.vault` | Vault (OpenAPI) | `getVariables()`, `createVariable()`, `deleteVariable()`, `getVariablesByBranchId()`, `getProjectWideVariables()` |
220
+ | `api.oauth` | OAuth | `getCredentials()`, `getCredential()`, `createCredential()`, `deleteCredential()` |
221
+ | `api.dataScience` | Data Science (OpenAPI) | `getApps()`, `getApp()`, `createApp()`, `patchApp()`, `deleteApp()`, `getAppRuns()`, `getAppRun()`, `getAppLogsTail()`, `getAppLogsDownload()`, `getRuntimes()`, `getSandbox()` |
222
+ | `api.editor` | SQL Editor (OpenAPI) | `createSession()`, `getSession()`, `getSessions()`, `getSessionSchema()`, `createQueryJob()`, `tablePreview()`, `tableDefinition()`, `load()`, `unload()` |
223
+ | `api.encryption` | Encryption | `encrypt()`, `encryptSecrets()` |
224
+ | `api.chat` | Kai Assistant (OpenAPI) | `getHistory()`, `getChat()`, `createChat()`, `deleteChat()`, `getVotes()`, `submitVote()`, `getUsage()`, `getSuggestions()`, `getAgentSettings()`, `getToolsList()` |
225
+ | `api.kaiAgent` | Kai Agent (OpenAPI) | `getHistory()`, `getChat()`, `createChat()`, `deleteChat()`, `approveToolCall()`, `submitToolOutput()`, `getSuggestions()`, `getAgentSettings()` |
226
+ | `api.businessWorkspaceApi` | Business Workspace (OpenAPI) | `healthCheck()`, `getDashboards()`, `getDashboard()`, `createDashboard()`, `updateDashboard()`, `deleteDashboard()` |
227
+ | `api.ai` | AI Service (OpenAPI) | `describeConfiguration()`, `describeConfigurationVersion()`, `describeConfigurationMerge()`, `explainError()`, `suggestComponent()`, `feedback()` |
228
+ | `api.queue` | Job Queue (OpenAPI) | `getJob()`, `searchJobs()` |
229
+ | `api.queryService` | Query Service (OpenAPI) | `createQueryJob()`, `cancelQueryJob()`, `getQueryJob()`, `getQueryResults()`, `getQueryHistory()`, `exportResults()` |
230
+ | `api.syncActions` | Sync Actions (OpenAPI) | `enrollMFA()`, `gitRepository.*` |
231
+ | `api.telemetry` | Telemetry | `provisioning.*` |
232
+ | `api.import` | Import (OpenAPI) | `uploadFile()`, `writeTable()` |
231
233
 
232
234
  Additional accessors on the ready client:
233
235
 
@@ -1,10 +1,11 @@
1
- const require_createFetchClient = require("./createFetchClient-DgMiqTJ8.cjs");
1
+ const require_createFetchClient = require("./createFetchClient-Cwp8max9.cjs");
2
2
  //#region src/errors/ManagementClientAuthError.ts
3
3
  var ManagementClientAuthError = class extends require_createFetchClient.ApiError {
4
4
  title;
5
5
  message;
6
6
  constructor(title, message, res) {
7
7
  super(res);
8
+ this.name = "ManagementClientAuthError";
8
9
  this.title = title;
9
10
  this.message = message;
10
11
  }
@@ -17,4 +18,4 @@ Object.defineProperty(exports, "ManagementClientAuthError", {
17
18
  }
18
19
  });
19
20
 
20
- //# sourceMappingURL=ManagementClientAuthError-DD4u0EU7.cjs.map
21
+ //# sourceMappingURL=ManagementClientAuthError-DE7lNGZQ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ManagementClientAuthError-DD4u0EU7.cjs","names":["ApiError"],"sources":["../src/errors/ManagementClientAuthError.ts"],"sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nimport { ApiError } from './ApiError';\n\nexport class ManagementClientAuthError extends ApiError {\n title: string;\n message: string;\n constructor(title: string, message: string, res: ApiResponse) {\n super(res);\n this.title = title;\n this.message = message;\n }\n}\n"],"mappings":";;AAIA,IAAa,4BAAb,cAA+CA,0BAAAA,SAAS;CACtD;CACA;CACA,YAAY,OAAe,SAAiB,KAAkB;EAC5D,MAAM,GAAG;EACT,KAAK,QAAQ;EACb,KAAK,UAAU;CACjB;AACF"}
1
+ {"version":3,"file":"ManagementClientAuthError-DE7lNGZQ.cjs","names":["ApiError"],"sources":["../src/errors/ManagementClientAuthError.ts"],"sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nimport { ApiError } from './ApiError';\n\nexport class ManagementClientAuthError extends ApiError {\n title: string;\n message: string;\n constructor(title: string, message: string, res: ApiResponse) {\n super(res);\n this.name = 'ManagementClientAuthError';\n this.title = title;\n this.message = message;\n }\n}\n"],"mappings":";;AAIA,IAAa,4BAAb,cAA+CA,0BAAAA,SAAS;CACtD;CACA;CACA,YAAY,OAAe,SAAiB,KAAkB;EAC5D,MAAM,GAAG;EACT,KAAK,OAAO;EACZ,KAAK,QAAQ;EACb,KAAK,UAAU;CACjB;AACF"}
@@ -1,10 +1,11 @@
1
- import { g as ApiError } from "./createFetchClient-U-ZrwPl2.js";
1
+ import { g as ApiError } from "./createFetchClient-DXHQK63w.js";
2
2
  //#region src/errors/ManagementClientAuthError.ts
3
3
  var ManagementClientAuthError = class extends ApiError {
4
4
  title;
5
5
  message;
6
6
  constructor(title, message, res) {
7
7
  super(res);
8
+ this.name = "ManagementClientAuthError";
8
9
  this.title = title;
9
10
  this.message = message;
10
11
  }
@@ -12,4 +13,4 @@ var ManagementClientAuthError = class extends ApiError {
12
13
  //#endregion
13
14
  export { ManagementClientAuthError as t };
14
15
 
15
- //# sourceMappingURL=ManagementClientAuthError-ey-f03vy.js.map
16
+ //# sourceMappingURL=ManagementClientAuthError-H30lti_Q.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ManagementClientAuthError-ey-f03vy.js","names":[],"sources":["../src/errors/ManagementClientAuthError.ts"],"sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nimport { ApiError } from './ApiError';\n\nexport class ManagementClientAuthError extends ApiError {\n title: string;\n message: string;\n constructor(title: string, message: string, res: ApiResponse) {\n super(res);\n this.title = title;\n this.message = message;\n }\n}\n"],"mappings":";;AAIA,IAAa,4BAAb,cAA+C,SAAS;CACtD;CACA;CACA,YAAY,OAAe,SAAiB,KAAkB;EAC5D,MAAM,GAAG;EACT,KAAK,QAAQ;EACb,KAAK,UAAU;CACjB;AACF"}
1
+ {"version":3,"file":"ManagementClientAuthError-H30lti_Q.js","names":[],"sources":["../src/errors/ManagementClientAuthError.ts"],"sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nimport { ApiError } from './ApiError';\n\nexport class ManagementClientAuthError extends ApiError {\n title: string;\n message: string;\n constructor(title: string, message: string, res: ApiResponse) {\n super(res);\n this.name = 'ManagementClientAuthError';\n this.title = title;\n this.message = message;\n }\n}\n"],"mappings":";;AAIA,IAAa,4BAAb,cAA+C,SAAS;CACtD;CACA;CACA,YAAY,OAAe,SAAiB,KAAkB;EAC5D,MAAM,GAAG;EACT,KAAK,OAAO;EACZ,KAAK,QAAQ;EACb,KAAK,UAAU;CACjB;AACF"}
@@ -1,13 +1,9 @@
1
1
  //#region src/errors/ValidationError.ts
2
2
  /**
3
- * A payload the SDK refused to accept — an input a caller assembled wrongly, or a response that did
4
- * not match the shape the endpoint is documented to return.
3
+ * A rejected SDK input or a response not matching its documented shape.
5
4
  *
6
- * It exists so a `ZodError` never leaves the package. `ZodError.message` is `JSON.stringify` of its
7
- * issue list — over a kilobyte for two problems — and a consumer that renders a caught error's
8
- * message puts that blob in front of a user. `message` here is a single line built for exactly that
9
- * rendering, while `issues` keeps the structured detail for anyone inspecting the failure rather
10
- * than displaying it.
5
+ * - Replaces `ZodError`, whose `message` is a JSON blob; `message` here is one user-facing line.
6
+ * - `issues` keeps the structured detail.
11
7
  */
12
8
  var ValidationError = class ValidationError extends Error {
13
9
  issues;
@@ -22,20 +18,18 @@ const isValidationError = (error) => error instanceof ValidationError;
22
18
  /**
23
19
  * One line per issue, prefixed by the field it belongs to.
24
20
  *
25
- * - Not `z.prettifyError`, which formats for a terminal — its `✖`/`→` glyphs and newlines survive a
26
- * log but collapse into one run-on line in HTML, where most of these end up.
27
- * - Exported for the boundaries that degrade instead of throwing: a read that drops one malformed
28
- * element still owes a reason, and it needs the same one line without a `ValidationError`.
29
- * - Says which field and what is wrong with it, never the value — so it is safe to log.
21
+ * - Not `z.prettifyError`: its terminal glyphs and newlines collapse in HTML.
22
+ * - Exported for boundaries that drop malformed elements instead of throwing.
23
+ * - Never includes the value, so it is safe to log.
30
24
  */
31
25
  const formatValidationIssues = (issues) => issues.map((issue) => {
32
26
  const path = issue.path.join(".");
33
27
  return path ? `${path}: ${issue.message}` : issue.message;
34
28
  }).join("; ");
35
29
  /**
36
- * Parses with `schema`, converting a `ZodError` into a {@link ValidationError}. Use it instead of a
37
- * bare `schema.parse()` anywhere the value crosses the package boundary — every client input and
38
- * every response body.
30
+ * Parses with `schema`, throwing a {@link ValidationError} instead of a `ZodError`.
31
+ *
32
+ * - Use instead of `schema.parse()` for every client input and response body.
39
33
  */
40
34
  const parseOrThrow = (schema, value) => {
41
35
  const result = schema.safeParse(value);
@@ -68,4 +62,4 @@ Object.defineProperty(exports, "parseOrThrow", {
68
62
  }
69
63
  });
70
64
 
71
- //# sourceMappingURL=ValidationError-CLVJCCwH.cjs.map
65
+ //# sourceMappingURL=ValidationError-D65QU0uq.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationError-D65QU0uq.cjs","names":[],"sources":["../src/errors/ValidationError.ts"],"sourcesContent":["import type * as z from 'zod';\n\n/**\n * A rejected SDK input or a response not matching its documented shape.\n *\n * - Replaces `ZodError`, whose `message` is a JSON blob; `message` here is one user-facing line.\n * - `issues` keeps the structured detail.\n */\nexport class ValidationError extends Error {\n issues: z.core.$ZodIssue[];\n\n constructor(message: string, issues: z.core.$ZodIssue[] = []) {\n super(message);\n this.name = 'ValidationError';\n this.issues = issues;\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\nexport const isValidationError = (error: unknown): error is ValidationError =>\n error instanceof ValidationError;\n\n/**\n * One line per issue, prefixed by the field it belongs to.\n *\n * - Not `z.prettifyError`: its terminal glyphs and newlines collapse in HTML.\n * - Exported for boundaries that drop malformed elements instead of throwing.\n * - Never includes the value, so it is safe to log.\n */\nexport const formatValidationIssues = (issues: readonly z.core.$ZodIssue[]) =>\n issues\n .map((issue) => {\n const path = issue.path.join('.');\n\n // A root-level issue's message already names the whole payload.\n return path ? `${path}: ${issue.message}` : issue.message;\n })\n .join('; ');\n\n/**\n * Parses with `schema`, throwing a {@link ValidationError} instead of a `ZodError`.\n *\n * - Use instead of `schema.parse()` for every client input and response body.\n */\nexport const parseOrThrow = <T extends z.ZodType>(schema: T, value: unknown): z.output<T> => {\n const result = schema.safeParse(value);\n\n if (result.success) return result.data;\n\n throw new ValidationError(formatValidationIssues(result.error.issues), result.error.issues);\n};\n"],"mappings":";;;;;;;AAQA,IAAa,kBAAb,MAAa,wBAAwB,MAAM;CACzC;CAEA,YAAY,SAAiB,SAA6B,CAAC,GAAG;EAC5D,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,OAAO,eAAe,MAAM,gBAAgB,SAAS;CACvD;AACF;AAEA,MAAa,qBAAqB,UAChC,iBAAiB;;;;;;;;AASnB,MAAa,0BAA0B,WACrC,OACG,KAAK,UAAU;CACd,MAAM,OAAO,MAAM,KAAK,KAAK,GAAG;CAGhC,OAAO,OAAO,GAAG,KAAK,IAAI,MAAM,YAAY,MAAM;AACpD,CAAC,CAAC,CACD,KAAK,IAAI;;;;;;AAOd,MAAa,gBAAqC,QAAW,UAAgC;CAC3F,MAAM,SAAS,OAAO,UAAU,KAAK;CAErC,IAAI,OAAO,SAAS,OAAO,OAAO;CAElC,MAAM,IAAI,gBAAgB,uBAAuB,OAAO,MAAM,MAAM,GAAG,OAAO,MAAM,MAAM;AAC5F"}
@@ -0,0 +1,42 @@
1
+ //#region src/errors/ValidationError.ts
2
+ /**
3
+ * A rejected SDK input or a response not matching its documented shape.
4
+ *
5
+ * - Replaces `ZodError`, whose `message` is a JSON blob; `message` here is one user-facing line.
6
+ * - `issues` keeps the structured detail.
7
+ */
8
+ var ValidationError = class ValidationError extends Error {
9
+ issues;
10
+ constructor(message, issues = []) {
11
+ super(message);
12
+ this.name = "ValidationError";
13
+ this.issues = issues;
14
+ Object.setPrototypeOf(this, ValidationError.prototype);
15
+ }
16
+ };
17
+ const isValidationError = (error) => error instanceof ValidationError;
18
+ /**
19
+ * One line per issue, prefixed by the field it belongs to.
20
+ *
21
+ * - Not `z.prettifyError`: its terminal glyphs and newlines collapse in HTML.
22
+ * - Exported for boundaries that drop malformed elements instead of throwing.
23
+ * - Never includes the value, so it is safe to log.
24
+ */
25
+ const formatValidationIssues = (issues) => issues.map((issue) => {
26
+ const path = issue.path.join(".");
27
+ return path ? `${path}: ${issue.message}` : issue.message;
28
+ }).join("; ");
29
+ /**
30
+ * Parses with `schema`, throwing a {@link ValidationError} instead of a `ZodError`.
31
+ *
32
+ * - Use instead of `schema.parse()` for every client input and response body.
33
+ */
34
+ const parseOrThrow = (schema, value) => {
35
+ const result = schema.safeParse(value);
36
+ if (result.success) return result.data;
37
+ throw new ValidationError(formatValidationIssues(result.error.issues), result.error.issues);
38
+ };
39
+ //#endregion
40
+ export { parseOrThrow as i, formatValidationIssues as n, isValidationError as r, ValidationError as t };
41
+
42
+ //# sourceMappingURL=ValidationError-DjhtNMfZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ValidationError-DjhtNMfZ.js","names":[],"sources":["../src/errors/ValidationError.ts"],"sourcesContent":["import type * as z from 'zod';\n\n/**\n * A rejected SDK input or a response not matching its documented shape.\n *\n * - Replaces `ZodError`, whose `message` is a JSON blob; `message` here is one user-facing line.\n * - `issues` keeps the structured detail.\n */\nexport class ValidationError extends Error {\n issues: z.core.$ZodIssue[];\n\n constructor(message: string, issues: z.core.$ZodIssue[] = []) {\n super(message);\n this.name = 'ValidationError';\n this.issues = issues;\n Object.setPrototypeOf(this, ValidationError.prototype);\n }\n}\n\nexport const isValidationError = (error: unknown): error is ValidationError =>\n error instanceof ValidationError;\n\n/**\n * One line per issue, prefixed by the field it belongs to.\n *\n * - Not `z.prettifyError`: its terminal glyphs and newlines collapse in HTML.\n * - Exported for boundaries that drop malformed elements instead of throwing.\n * - Never includes the value, so it is safe to log.\n */\nexport const formatValidationIssues = (issues: readonly z.core.$ZodIssue[]) =>\n issues\n .map((issue) => {\n const path = issue.path.join('.');\n\n // A root-level issue's message already names the whole payload.\n return path ? `${path}: ${issue.message}` : issue.message;\n })\n .join('; ');\n\n/**\n * Parses with `schema`, throwing a {@link ValidationError} instead of a `ZodError`.\n *\n * - Use instead of `schema.parse()` for every client input and response body.\n */\nexport const parseOrThrow = <T extends z.ZodType>(schema: T, value: unknown): z.output<T> => {\n const result = schema.safeParse(value);\n\n if (result.success) return result.data;\n\n throw new ValidationError(formatValidationIssues(result.error.issues), result.error.issues);\n};\n"],"mappings":";;;;;;;AAQA,IAAa,kBAAb,MAAa,wBAAwB,MAAM;CACzC;CAEA,YAAY,SAAiB,SAA6B,CAAC,GAAG;EAC5D,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,SAAS;EACd,OAAO,eAAe,MAAM,gBAAgB,SAAS;CACvD;AACF;AAEA,MAAa,qBAAqB,UAChC,iBAAiB;;;;;;;;AASnB,MAAa,0BAA0B,WACrC,OACG,KAAK,UAAU;CACd,MAAM,OAAO,MAAM,KAAK,KAAK,GAAG;CAGhC,OAAO,OAAO,GAAG,KAAK,IAAI,MAAM,YAAY,MAAM;AACpD,CAAC,CAAC,CACD,KAAK,IAAI;;;;;;AAOd,MAAa,gBAAqC,QAAW,UAAgC;CAC3F,MAAM,SAAS,OAAO,UAAU,KAAK;CAErC,IAAI,OAAO,SAAS,OAAO,OAAO;CAElC,MAAM,IAAI,gBAAgB,uBAAuB,OAAO,MAAM,MAAM,GAAG,OAAO,MAAM,MAAM;AAC5F"}
package/dist/ai/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_createOpenapiFetchClient = require("../createOpenapiFetchClient-DhUU3M1W.cjs");
3
- const require_auth = require("../auth-JQ33o3nU.cjs");
2
+ const require_createOpenapiFetchClient = require("../createOpenapiFetchClient-BYqW-9tm.cjs");
3
+ const require_auth = require("../auth-Dm0F2rOh.cjs");
4
4
  //#region src/clients/ai/aiClient.ts
5
5
  const createAiClient = ({ baseUrl, middlewares, auth }) => {
6
6
  const client = require_createOpenapiFetchClient.createOpenapiFetchClient({
@@ -1,5 +1,5 @@
1
- import { a as DescribeConfigurationVersionBody, f as SuggestComponentBody, i as DescribeConfigurationMergeBody, l as ExplainErrorBody, p as components, r as DescribeConfigurationBody, s as DocsQuestionBody, u as FeedbackBody } from "../types-52irAt99.cjs";
2
- import { n as ClientInitOptions } from "../types-_RhBCj4_.cjs";
1
+ import { a as DescribeConfigurationVersionBody, f as SuggestComponentBody, i as DescribeConfigurationMergeBody, l as ExplainErrorBody, p as components, r as DescribeConfigurationBody, s as DocsQuestionBody, u as FeedbackBody } from "../types-YHUEArkR.cjs";
2
+ import { n as ClientInitOptions } from "../types-DoZtE9tz.cjs";
3
3
  //#region src/clients/ai/aiClient.d.ts
4
4
  declare const createAiClient: ({ baseUrl, middlewares, auth }: ClientInitOptions) => {
5
5
  healthCheck: (signal?: AbortSignal) => Promise<{
@@ -1,5 +1,5 @@
1
- import { a as DescribeConfigurationVersionBody, f as SuggestComponentBody, i as DescribeConfigurationMergeBody, l as ExplainErrorBody, p as components, r as DescribeConfigurationBody, s as DocsQuestionBody, u as FeedbackBody } from "../types-BTWIPEiU.js";
2
- import { n as ClientInitOptions } from "../types-Ct0YPy2w.js";
1
+ import { a as DescribeConfigurationVersionBody, f as SuggestComponentBody, i as DescribeConfigurationMergeBody, l as ExplainErrorBody, p as components, r as DescribeConfigurationBody, s as DocsQuestionBody, u as FeedbackBody } from "../types-CfwqVkEA.js";
2
+ import { n as ClientInitOptions } from "../types-B2w2TtSA.js";
3
3
  //#region src/clients/ai/aiClient.d.ts
4
4
  declare const createAiClient: ({ baseUrl, middlewares, auth }: ClientInitOptions) => {
5
5
  healthCheck: (signal?: AbortSignal) => Promise<{
package/dist/ai/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as createOpenapiFetchClient } from "../createOpenapiFetchClient-BVSc9ibR.js";
2
- import { t as createAuthHeaders } from "../auth-aItmDu45.js";
1
+ import { t as createOpenapiFetchClient } from "../createOpenapiFetchClient-DZUOVupy.js";
2
+ import { t as createAuthHeaders } from "../auth-DworfoPy.js";
3
3
  //#region src/clients/ai/aiClient.ts
4
4
  const createAiClient = ({ baseUrl, middlewares, auth }) => {
5
5
  const client = createOpenapiFetchClient({
@@ -1,2 +1,2 @@
1
- import { a as DescribeConfigurationVersionBody, c as ErrorExplanation, d as ObjectDescription, f as SuggestComponentBody, i as DescribeConfigurationMergeBody, l as ExplainErrorBody, n as ComponentSuggestion, o as DocsAnswer, r as DescribeConfigurationBody, s as DocsQuestionBody, t as ComponentDocsDetail, u as FeedbackBody } from "../types-52irAt99.cjs";
1
+ import { a as DescribeConfigurationVersionBody, c as ErrorExplanation, d as ObjectDescription, f as SuggestComponentBody, i as DescribeConfigurationMergeBody, l as ExplainErrorBody, n as ComponentSuggestion, o as DocsAnswer, r as DescribeConfigurationBody, s as DocsQuestionBody, t as ComponentDocsDetail, u as FeedbackBody } from "../types-YHUEArkR.cjs";
2
2
  export { ComponentDocsDetail, ComponentSuggestion, DescribeConfigurationBody, DescribeConfigurationMergeBody, DescribeConfigurationVersionBody, DocsAnswer, DocsQuestionBody, ErrorExplanation, ExplainErrorBody, FeedbackBody, ObjectDescription, SuggestComponentBody };
@@ -1,2 +1,2 @@
1
- import { a as DescribeConfigurationVersionBody, c as ErrorExplanation, d as ObjectDescription, f as SuggestComponentBody, i as DescribeConfigurationMergeBody, l as ExplainErrorBody, n as ComponentSuggestion, o as DocsAnswer, r as DescribeConfigurationBody, s as DocsQuestionBody, t as ComponentDocsDetail, u as FeedbackBody } from "../types-BTWIPEiU.js";
1
+ import { a as DescribeConfigurationVersionBody, c as ErrorExplanation, d as ObjectDescription, f as SuggestComponentBody, i as DescribeConfigurationMergeBody, l as ExplainErrorBody, n as ComponentSuggestion, o as DocsAnswer, r as DescribeConfigurationBody, s as DocsQuestionBody, t as ComponentDocsDetail, u as FeedbackBody } from "../types-CfwqVkEA.js";
2
2
  export { ComponentDocsDetail, ComponentSuggestion, DescribeConfigurationBody, DescribeConfigurationMergeBody, DescribeConfigurationVersionBody, DocsAnswer, DocsQuestionBody, ErrorExplanation, ExplainErrorBody, FeedbackBody, ObjectDescription, SuggestComponentBody };
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
2
2
  const require_isPlainObject = require("./isPlainObject-BB3iy87C.cjs");
3
- const require_createFetchClient = require("./createFetchClient-DgMiqTJ8.cjs");
3
+ const require_createFetchClient = require("./createFetchClient-Cwp8max9.cjs");
4
4
  let zod = require("zod");
5
5
  zod = require_rolldown_runtime.__toESM(zod, 1);
6
6
  let dayjs = require("dayjs");
@@ -150,4 +150,4 @@ Object.defineProperty(exports, "readAppLogsTail", {
150
150
  }
151
151
  });
152
152
 
153
- //# sourceMappingURL=appLogs-BjfUoWzs.cjs.map
153
+ //# sourceMappingURL=appLogs-B9zFJIuy.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"appLogs-BjfUoWzs.cjs","names":["utc","z","record","isPlainObject","isApiError","HttpStatus","parseContentDispositionHeader","HttpHeader"],"sources":["../src/domain/appLogs.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport utc from 'dayjs/plugin/utc.js';\nimport * as z from 'zod';\n\nimport {\n type ApiResponse,\n HttpHeader,\n isApiError,\n parseContentDispositionHeader,\n} from '../fetchClient';\nimport { HttpStatus } from '../internal';\nimport { isPlainObject } from '../utils/isPlainObject';\n\n/**\n * Reading a data app's container output. Shared by the two clients wrapping sandboxes-service —\n * `dataScience` (`/v1`) and `apps` (`/v2`) — which serve the same logs under different paths, so the\n * tail contract (how a line is parsed, where the next poll resumes, and that an idle app is not an\n * error) is defined once here rather than per surface.\n */\n\ndayjs.extend(utc);\n\nexport type LogEntry = {\n timestamp: string | null;\n message: string;\n};\n\nconst DEFAULT_LOGS_FILE_NAME = 'logs.txt';\n\nconst ISO_TIMESTAMP_REGEX = /\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z/;\nconst LEADING_ISO_TIMESTAMP_REGEX = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z)\\s?/;\n\n/** The error envelope sandboxes-service returns; the tail branches on its `code`. */\nconst TailError = z.object({\n context: z.object({\n code: z.string(),\n }),\n});\n\n/**\n * There is nothing to read right now, reported per scope: an app whose serving member is asleep\n * answers `apps.appNotRunning`, a deployment that isn't running answers `apps.deploymentNotRunning` —\n * the normal state of a staged or retired one, since a deployment only runs while it is production.\n */\nconst NOTHING_RUNNING_CODES = new Set(['apps.appNotRunning', 'apps.deploymentNotRunning']);\n\nconst tryParseJsonl = (line: string): LogEntry | null => {\n if (!line.startsWith('{')) return null;\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(line);\n } catch {\n return null;\n }\n\n if (typeof parsed !== 'object' || parsed === null) return null;\n\n const record = parsed as Record<string, unknown>;\n const { timestamp, message } = record;\n\n if (typeof timestamp !== 'string' || typeof message !== 'string') return null;\n\n return {\n timestamp,\n message,\n };\n};\n\nconst parsePlainTextLine = (line: string): LogEntry => {\n const match = line.match(LEADING_ISO_TIMESTAMP_REGEX);\n if (match) {\n return { timestamp: match[1]!, message: line.slice(match[0].length) };\n }\n return { timestamp: null, message: line };\n};\n\nexport const parseLogLine = (line: string): LogEntry =>\n tryParseJsonl(line) ?? parsePlainTextLine(line);\n\nconst toLogEntryFromObject = (raw: Record<string, unknown>): LogEntry | null => {\n if (typeof raw.message !== 'string') return null;\n return {\n timestamp: typeof raw.timestamp === 'string' ? raw.timestamp : null,\n message: raw.message,\n };\n};\n\nexport const parseLogLines = (raw: unknown): LogEntry[] => {\n if (raw === null || raw === undefined || raw === '') return [];\n\n if (Array.isArray(raw)) {\n return raw.flatMap((item) => {\n if (typeof item === 'string') return item === '' ? [] : [parseLogLine(item)];\n if (isPlainObject(item)) {\n const entry = toLogEntryFromObject(item);\n return entry ? [entry] : [];\n }\n return [];\n });\n }\n\n if (isPlainObject(raw)) {\n const entry = toLogEntryFromObject(raw);\n return entry ? [entry] : [];\n }\n\n if (typeof raw !== 'string') return [];\n\n const lines = raw.split('\\n');\n const entries: LogEntry[] = [];\n for (const line of lines) {\n if (line === '') continue;\n entries.push(parseLogLine(line));\n }\n return entries;\n};\n\nexport const lastLogTimestamp = (entries: LogEntry[]) => {\n for (let i = entries.length - 1; i >= 0; i--) {\n const entry = entries[i];\n if (!entry) continue;\n if (entry.timestamp) return entry.timestamp;\n\n // A plain-text line may carry a timestamp embedded mid-line (legacy format).\n const match = entry.message.match(ISO_TIMESTAMP_REGEX);\n if (match) return match[0];\n }\n return null;\n};\n\nconst calculateNextLogTimestamp = (timestamp: string | null) => {\n if (timestamp === null) return null;\n return dayjs(timestamp).utc().add(1, 'second').utc().format();\n};\n\n/**\n * The tail plus the timestamp a follow-up poll resumes from. A {@link NOTHING_RUNNING_CODES} `400`\n * reads as an empty tail rather than an error — an idle app between visits, or a deployment that is\n * not the one currently serving, has no logs to stream and that is its normal condition.\n */\nexport const readAppLogsTail = async (fetchTail: () => Promise<ApiResponse<string>>) => {\n try {\n const { data } = await fetchTail();\n const entries = parseLogLines(data);\n\n return {\n entries,\n nextLogTimestamp: calculateNextLogTimestamp(lastLogTimestamp(entries)),\n };\n } catch (error) {\n if (isApiError(error) && error.response.status === HttpStatus.BAD_REQUEST) {\n const code = TailError.safeParse(error.data).data?.context?.code;\n if (code !== undefined && NOTHING_RUNNING_CODES.has(code)) {\n return { entries: [], nextLogTimestamp: null };\n }\n }\n throw error;\n }\n};\n\n/** The whole log as a file download, named by the service's `Content-Disposition` where it sets one. */\nexport const readAppLogsDownload = async (fetchLogs: () => Promise<ApiResponse<string>>) => {\n const { data, response } = await fetchLogs();\n const contentDisposition = parseContentDispositionHeader(\n response.headers.get(HttpHeader.CONTENT_DISPOSITION),\n );\n\n return {\n logs: data,\n fileName: contentDisposition.filename ?? DEFAULT_LOGS_FILE_NAME,\n };\n};\n"],"mappings":"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"}
1
+ {"version":3,"file":"appLogs-B9zFJIuy.cjs","names":["utc","z","record","isPlainObject","isApiError","HttpStatus","parseContentDispositionHeader","HttpHeader"],"sources":["../src/domain/appLogs.ts"],"sourcesContent":["import dayjs from 'dayjs';\nimport utc from 'dayjs/plugin/utc.js';\nimport * as z from 'zod';\n\nimport {\n type ApiResponse,\n HttpHeader,\n isApiError,\n parseContentDispositionHeader,\n} from '../fetchClient';\nimport { HttpStatus } from '../internal';\nimport { isPlainObject } from '../utils/isPlainObject';\n\n/**\n * Reading a data app's container output. Shared by the two clients wrapping sandboxes-service —\n * `dataScience` (`/v1`) and `apps` (`/v2`) — which serve the same logs under different paths, so the\n * tail contract (how a line is parsed, where the next poll resumes, and that an idle app is not an\n * error) is defined once here rather than per surface.\n */\n\ndayjs.extend(utc);\n\nexport type LogEntry = {\n timestamp: string | null;\n message: string;\n};\n\nconst DEFAULT_LOGS_FILE_NAME = 'logs.txt';\n\nconst ISO_TIMESTAMP_REGEX = /\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z/;\nconst LEADING_ISO_TIMESTAMP_REGEX = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?Z)\\s?/;\n\n/** The error envelope sandboxes-service returns; the tail branches on its `code`. */\nconst TailError = z.object({\n context: z.object({\n code: z.string(),\n }),\n});\n\n/**\n * There is nothing to read right now, reported per scope: an app whose serving member is asleep\n * answers `apps.appNotRunning`, a deployment that isn't running answers `apps.deploymentNotRunning` —\n * the normal state of a staged or retired one, since a deployment only runs while it is production.\n */\nconst NOTHING_RUNNING_CODES = new Set(['apps.appNotRunning', 'apps.deploymentNotRunning']);\n\nconst tryParseJsonl = (line: string): LogEntry | null => {\n if (!line.startsWith('{')) return null;\n\n let parsed: unknown;\n try {\n parsed = JSON.parse(line);\n } catch {\n return null;\n }\n\n if (typeof parsed !== 'object' || parsed === null) return null;\n\n const record = parsed as Record<string, unknown>;\n const { timestamp, message } = record;\n\n if (typeof timestamp !== 'string' || typeof message !== 'string') return null;\n\n return {\n timestamp,\n message,\n };\n};\n\nconst parsePlainTextLine = (line: string): LogEntry => {\n const match = line.match(LEADING_ISO_TIMESTAMP_REGEX);\n if (match) {\n return { timestamp: match[1]!, message: line.slice(match[0].length) };\n }\n return { timestamp: null, message: line };\n};\n\nexport const parseLogLine = (line: string): LogEntry =>\n tryParseJsonl(line) ?? parsePlainTextLine(line);\n\nconst toLogEntryFromObject = (raw: Record<string, unknown>): LogEntry | null => {\n if (typeof raw.message !== 'string') return null;\n return {\n timestamp: typeof raw.timestamp === 'string' ? raw.timestamp : null,\n message: raw.message,\n };\n};\n\nexport const parseLogLines = (raw: unknown): LogEntry[] => {\n if (raw === null || raw === undefined || raw === '') return [];\n\n if (Array.isArray(raw)) {\n return raw.flatMap((item) => {\n if (typeof item === 'string') return item === '' ? [] : [parseLogLine(item)];\n if (isPlainObject(item)) {\n const entry = toLogEntryFromObject(item);\n return entry ? [entry] : [];\n }\n return [];\n });\n }\n\n if (isPlainObject(raw)) {\n const entry = toLogEntryFromObject(raw);\n return entry ? [entry] : [];\n }\n\n if (typeof raw !== 'string') return [];\n\n const lines = raw.split('\\n');\n const entries: LogEntry[] = [];\n for (const line of lines) {\n if (line === '') continue;\n entries.push(parseLogLine(line));\n }\n return entries;\n};\n\nexport const lastLogTimestamp = (entries: LogEntry[]) => {\n for (let i = entries.length - 1; i >= 0; i--) {\n const entry = entries[i];\n if (!entry) continue;\n if (entry.timestamp) return entry.timestamp;\n\n // A plain-text line may carry a timestamp embedded mid-line (legacy format).\n const match = entry.message.match(ISO_TIMESTAMP_REGEX);\n if (match) return match[0];\n }\n return null;\n};\n\nconst calculateNextLogTimestamp = (timestamp: string | null) => {\n if (timestamp === null) return null;\n return dayjs(timestamp).utc().add(1, 'second').utc().format();\n};\n\n/**\n * The tail plus the timestamp a follow-up poll resumes from. A {@link NOTHING_RUNNING_CODES} `400`\n * reads as an empty tail rather than an error — an idle app between visits, or a deployment that is\n * not the one currently serving, has no logs to stream and that is its normal condition.\n */\nexport const readAppLogsTail = async (fetchTail: () => Promise<ApiResponse<string>>) => {\n try {\n const { data } = await fetchTail();\n const entries = parseLogLines(data);\n\n return {\n entries,\n nextLogTimestamp: calculateNextLogTimestamp(lastLogTimestamp(entries)),\n };\n } catch (error) {\n if (isApiError(error) && error.response.status === HttpStatus.BAD_REQUEST) {\n const code = TailError.safeParse(error.data).data?.context?.code;\n if (code !== undefined && NOTHING_RUNNING_CODES.has(code)) {\n return { entries: [], nextLogTimestamp: null };\n }\n }\n throw error;\n }\n};\n\n/** The whole log as a file download, named by the service's `Content-Disposition` where it sets one. */\nexport const readAppLogsDownload = async (fetchLogs: () => Promise<ApiResponse<string>>) => {\n const { data, response } = await fetchLogs();\n const contentDisposition = parseContentDispositionHeader(\n response.headers.get(HttpHeader.CONTENT_DISPOSITION),\n );\n\n return {\n logs: data,\n fileName: contentDisposition.filename ?? DEFAULT_LOGS_FILE_NAME,\n };\n};\n"],"mappings":"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"}
@@ -1,5 +1,5 @@
1
1
  import { t as isPlainObject } from "./isPlainObject-LYW-03uB.js";
2
- import { f as parseContentDispositionHeader, m as HttpStatus, r as isApiError, s as HttpHeader } from "./createFetchClient-U-ZrwPl2.js";
2
+ import { f as parseContentDispositionHeader, m as HttpStatus, r as isApiError, s as HttpHeader } from "./createFetchClient-DXHQK63w.js";
3
3
  import * as z$1 from "zod";
4
4
  import dayjs from "dayjs";
5
5
  import utc from "dayjs/plugin/utc.js";
@@ -129,4 +129,4 @@ const readAppLogsDownload = async (fetchLogs) => {
129
129
  //#endregion
130
130
  export { readAppLogsDownload as n, readAppLogsTail as r, parseLogLines as t };
131
131
 
132
- //# sourceMappingURL=appLogs-xsVkTriU.js.map
132
+ //# sourceMappingURL=appLogs-BBkkUOW1.js.map