@keboola/api-client 31.0.0 → 33.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +91 -7
- package/API-SURFACE.md +5 -2
- package/CHANGELOG.md +327 -0
- package/README.md +45 -19
- package/dist/{ManagementClientAuthError-DFhi5yxe.cjs → ManagementClientAuthError-DqeXL8nv.cjs} +2 -2
- package/dist/{ManagementClientAuthError-DFhi5yxe.cjs.map → ManagementClientAuthError-DqeXL8nv.cjs.map} +1 -1
- package/dist/{ManagementClientAuthError-90pvsej0.js → ManagementClientAuthError-iKbBugKC.js} +2 -2
- package/dist/{ManagementClientAuthError-90pvsej0.js.map → ManagementClientAuthError-iKbBugKC.js.map} +1 -1
- package/dist/ai/index.cjs +2 -2
- package/dist/ai/index.d.cts +2 -2
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.js +2 -2
- package/dist/ai/types.d.cts +1 -1
- package/dist/ai/types.d.ts +1 -1
- package/dist/{appLogs-CLHhkQJn.js → appLogs-D72eD8vP.js} +2 -2
- package/dist/{appLogs-CLHhkQJn.js.map → appLogs-D72eD8vP.js.map} +1 -1
- package/dist/{appLogs-BCCi02w6.cjs → appLogs-D8K0VeNM.cjs} +2 -2
- package/dist/{appLogs-BCCi02w6.cjs.map → appLogs-D8K0VeNM.cjs.map} +1 -1
- package/dist/{appLogs-hQdKt_8J.d.cts → appLogs-Q4A7A_Fc.d.cts} +2 -2
- package/dist/{appLogs-BdMG6Cvn.d.ts → appLogs-u0XMZLjS.d.ts} +2 -2
- package/dist/apps/index.cjs +3 -3
- package/dist/apps/index.d.cts +3 -3
- package/dist/apps/index.d.ts +3 -3
- package/dist/apps/index.js +3 -3
- package/dist/apps/types.d.cts +2 -2
- package/dist/apps/types.d.ts +2 -2
- package/dist/assets/index.cjs +1 -1
- package/dist/assets/index.d.cts +1 -1
- package/dist/assets/index.d.ts +1 -1
- package/dist/assets/index.js +1 -1
- package/dist/auth/index.cjs +1 -1
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/types.d.cts +2 -2
- package/dist/auth/types.d.ts +2 -2
- package/dist/{auth-DmgTH0uY.cjs → auth-C2_JLisH.cjs} +2 -2
- package/dist/{auth-DmgTH0uY.cjs.map → auth-C2_JLisH.cjs.map} +1 -1
- package/dist/{auth-CE6Hlc9W.js → auth-CE9rQV3-.js} +2 -2
- package/dist/{auth-CE6Hlc9W.js.map → auth-CE9rQV3-.js.map} +1 -1
- package/dist/{authClient-XBAUz9g-.js → authClient-DEyqR7GW.js} +43 -9
- package/dist/authClient-DEyqR7GW.js.map +1 -0
- package/dist/{authClient-BL6h78Q1.d.cts → authClient-DZ_8lvdJ.d.cts} +6 -6
- package/dist/{authClient-Bc_bDisO.d.ts → authClient-DwT6xdg5.d.ts} +6 -6
- package/dist/{authClient-Cixa8_L1.cjs → authClient-IwQ9Ti0J.cjs} +43 -9
- package/dist/authClient-IwQ9Ti0J.cjs.map +1 -0
- package/dist/chat/index.cjs +3 -3
- package/dist/chat/index.d.cts +2 -7
- package/dist/chat/index.d.ts +2 -7
- package/dist/chat/index.js +3 -3
- package/dist/chat/types.d.cts +1 -1
- package/dist/chat/types.d.ts +1 -1
- package/dist/{configurations-CujCwDcB.cjs → configurations-Ck-mNB_E.cjs} +2 -2
- package/dist/{configurations-CujCwDcB.cjs.map → configurations-Ck-mNB_E.cjs.map} +1 -1
- package/dist/{configurations-DCOJONZZ.cjs → configurations-CqwAxiQL.cjs} +5 -1
- package/dist/configurations-CqwAxiQL.cjs.map +1 -0
- package/dist/{configurations-Byt59bIa.js → configurations-ZwBXilW-.js} +2 -2
- package/dist/{configurations-Byt59bIa.js.map → configurations-ZwBXilW-.js.map} +1 -1
- package/dist/{configurations-iCbhe0tb.js → configurations-d7SZmw69.js} +5 -1
- package/dist/configurations-d7SZmw69.js.map +1 -0
- package/dist/constants/index.cjs +2 -1
- package/dist/constants/index.d.cts +3 -2
- package/dist/constants/index.d.ts +3 -2
- package/dist/constants/index.js +2 -2
- package/dist/{constants-qeWGfk_7.js → constants-ByEwVtGf.js} +38 -2
- package/dist/constants-ByEwVtGf.js.map +1 -0
- package/dist/{constants-CkAVvuUq.cjs → constants-lIfSdTzS.cjs} +43 -1
- package/dist/constants-lIfSdTzS.cjs.map +1 -0
- package/dist/{createFetchClient-B1h3-p65.js → createFetchClient-DdyZMhxO.js} +17 -11
- package/dist/createFetchClient-DdyZMhxO.js.map +1 -0
- package/dist/{createFetchClient-B9Cv0W9f.cjs → createFetchClient-DvZvD31l.cjs} +22 -10
- package/dist/createFetchClient-DvZvD31l.cjs.map +1 -0
- package/dist/{createGenericFetchClient-DhpvUSlX.js → createGenericFetchClient-MQeLRiNW.js} +2 -2
- package/dist/{createGenericFetchClient-DhpvUSlX.js.map → createGenericFetchClient-MQeLRiNW.js.map} +1 -1
- package/dist/{createGenericFetchClient-BWoSkTki.cjs → createGenericFetchClient-qfCZlCTv.cjs} +2 -2
- package/dist/{createGenericFetchClient-BWoSkTki.cjs.map → createGenericFetchClient-qfCZlCTv.cjs.map} +1 -1
- package/dist/{createOpenapiFetchClient-yirrW6Tg.cjs → createOpenapiFetchClient-C57Ljzi6.cjs} +2 -2
- package/dist/{createOpenapiFetchClient-yirrW6Tg.cjs.map → createOpenapiFetchClient-C57Ljzi6.cjs.map} +1 -1
- package/dist/{createOpenapiFetchClient-0_oqhdPv.js → createOpenapiFetchClient-E7OIVkYv.js} +2 -2
- package/dist/{createOpenapiFetchClient-0_oqhdPv.js.map → createOpenapiFetchClient-E7OIVkYv.js.map} +1 -1
- package/dist/{credential-dKxArMic.js → credential-Bxv7yxOZ.js} +7 -4
- package/dist/credential-Bxv7yxOZ.js.map +1 -0
- package/dist/{credential-D-tX9gP4.cjs → credential-D-X5QQrM.cjs} +7 -4
- package/dist/credential-D-X5QQrM.cjs.map +1 -0
- package/dist/dataScience/index.cjs +2 -2
- package/dist/dataScience/index.d.cts +2 -2
- package/dist/dataScience/index.d.ts +2 -2
- package/dist/dataScience/index.js +2 -2
- package/dist/dataScience/types.d.cts +2 -2
- package/dist/dataScience/types.d.ts +2 -2
- package/dist/{dataScience-BqNWX-Gr.cjs → dataScience-BPW993AG.cjs} +5 -5
- package/dist/{dataScience-BqNWX-Gr.cjs.map → dataScience-BPW993AG.cjs.map} +1 -1
- package/dist/{dataScience-jdbSSPYF.js → dataScience-B_TA7wCB.js} +5 -5
- package/dist/{dataScience-jdbSSPYF.js.map → dataScience-B_TA7wCB.js.map} +1 -1
- package/dist/developerPortal/index.cjs +1 -1
- package/dist/developerPortal/index.d.cts +2 -2
- package/dist/developerPortal/index.d.ts +2 -2
- package/dist/developerPortal/index.js +1 -1
- package/dist/developerPortal/types.d.cts +1 -1
- package/dist/developerPortal/types.d.ts +1 -1
- package/dist/{developerPortalClient-B7lNR5q0.cjs → developerPortalClient-Db2XVB_o.cjs} +3 -3
- package/dist/{developerPortalClient-B7lNR5q0.cjs.map → developerPortalClient-Db2XVB_o.cjs.map} +1 -1
- package/dist/{developerPortalClient-5ABcxz1U.js → developerPortalClient-jk46sjwP.js} +3 -3
- package/dist/{developerPortalClient-5ABcxz1U.js.map → developerPortalClient-jk46sjwP.js.map} +1 -1
- package/dist/domain/permissions/index.cjs +63 -1
- package/dist/domain/permissions/index.cjs.map +1 -0
- package/dist/domain/permissions/index.d.cts +52 -3
- package/dist/domain/permissions/index.d.ts +52 -3
- package/dist/domain/permissions/index.js +59 -2
- package/dist/domain/permissions/index.js.map +1 -0
- package/dist/editor/index.cjs +2 -2
- package/dist/editor/index.d.cts +2 -2
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +2 -2
- package/dist/editor/types.d.cts +1 -1
- package/dist/editor/types.d.ts +1 -1
- package/dist/emitter-dLF1Fyfg.d.cts +11 -0
- package/dist/emitter-dLF1Fyfg.d.ts +11 -0
- package/dist/encryption/index.cjs +1 -1
- package/dist/encryption/index.d.cts +1 -1
- package/dist/encryption/index.d.ts +1 -1
- package/dist/encryption/index.js +1 -1
- package/dist/encryption/types.d.cts +1 -1
- package/dist/encryption/types.d.ts +1 -1
- package/dist/import/index.cjs +1 -1
- package/dist/import/index.d.cts +3 -3
- package/dist/import/index.d.ts +3 -3
- package/dist/import/index.js +1 -1
- package/dist/{import-CExRbskw.js → import-2nqxQ9Rt.js} +3 -3
- package/dist/{import-CExRbskw.js.map → import-2nqxQ9Rt.js.map} +1 -1
- package/dist/{import-CXHppAxd.cjs → import-DJilJ6tq.cjs} +3 -3
- package/dist/{import-CXHppAxd.cjs.map → import-DJilJ6tq.cjs.map} +1 -1
- package/dist/{index-BR2Fu-Wo.d.ts → index-B0V1pJAa.d.ts} +618 -3103
- package/dist/{index-7RvXnXmd.d.ts → index-B2OGaUap.d.ts} +6 -6
- package/dist/{index-J1I2HlSm.d.ts → index-BjKjp3Rf.d.ts} +5 -5
- package/dist/{index-NicJZIzu.d.ts → index-C7gxKoDF.d.cts} +3 -3
- package/dist/{index-B6q7HxKJ.d.cts → index-CTd4YY8e.d.cts} +4 -4
- package/dist/{index-C9mAoXF6.d.cts → index-CUXEFQ7i.d.cts} +6 -6
- package/dist/{index-D_TnbEtp.d.cts → index-CVqk63at.d.ts} +3 -3
- package/dist/{index-CMb0ygwb.d.ts → index-C_cxKL1V.d.ts} +3 -3
- package/dist/{index-CYMAwD3E.d.ts → index-ChMtULt4.d.ts} +4 -4
- package/dist/{index-Cpjh05sx.d.cts → index-DCN2lH0v.d.cts} +4 -4
- package/dist/{index-cu8THqZV.d.cts → index-DIVvL54G.d.cts} +618 -3103
- package/dist/{index-CwJE18PJ.d.cts → index-DLYAvSWZ.d.cts} +3 -3
- package/dist/{index-CW4VC9oN.d.ts → index-DQef014j.d.ts} +4 -4
- package/dist/{index-Ds8e0l7-.d.ts → index-DVhTNwvu.d.ts} +7 -3
- package/dist/{index-B-frWtGW.d.cts → index-DhVFuQDv.d.cts} +7 -3
- package/dist/{index-DeMDxHTz.d.ts → index-GNKwr7EQ.d.ts} +4 -4
- package/dist/{index--pxLseaw.d.cts → index-NaYLwG_h.d.cts} +143 -2
- package/dist/{index--pxLseaw.d.ts → index-NaYLwG_h.d.ts} +143 -2
- package/dist/{index-Daks5CeX.d.ts → index-bB6wvw1f.d.ts} +4 -4
- package/dist/{index-BfVv8isU.d.cts → index-exNi3I2Q.d.cts} +4 -4
- package/dist/{index-CR9LsDaG.d.cts → index-qOK5FtAH.d.cts} +4 -4
- package/dist/{index-BSjfVDTr.d.cts → index-t-a7kYnx.d.cts} +5 -5
- package/dist/index.cjs +325 -257
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +306 -240
- package/dist/index.js.map +1 -1
- package/dist/{jobStatus-kQ9JqF8t.cjs → jobStatus-0_Y3Sr4i.cjs} +37 -20
- package/dist/jobStatus-0_Y3Sr4i.cjs.map +1 -0
- package/dist/{jobStatus-DbMupQEK.js → jobStatus-PSZJMTiA.js} +35 -18
- package/dist/jobStatus-PSZJMTiA.js.map +1 -0
- package/dist/kaiAgent/index.cjs +3 -0
- package/dist/kaiAgent/index.d.cts +2 -0
- package/dist/kaiAgent/index.d.ts +2 -0
- package/dist/kaiAgent/index.js +2 -0
- package/dist/kaiAgent/types.cjs +0 -0
- package/dist/kaiAgent/types.d.cts +2 -0
- package/dist/kaiAgent/types.d.ts +2 -0
- package/dist/kaiAgent/types.js +1 -0
- package/dist/kaiAgent-CMVub6Sc.cjs +266 -0
- package/dist/kaiAgent-CMVub6Sc.cjs.map +1 -0
- package/dist/kaiAgent-CYYn0QJW.js +261 -0
- package/dist/kaiAgent-CYYn0QJW.js.map +1 -0
- package/dist/kaiAgentClient-B2O0DF4d.d.ts +249 -0
- package/dist/kaiAgentClient-iCFR2tRU.d.cts +249 -0
- package/dist/management/index.cjs +1 -1
- package/dist/management/index.d.cts +1 -1
- package/dist/management/index.d.ts +1 -1
- package/dist/management/index.js +1 -1
- package/dist/management/types.d.cts +1 -1
- package/dist/management/types.d.ts +1 -1
- package/dist/{management-DlVdxzPw.cjs → management-DGfgKsaA.cjs} +5 -5
- package/dist/{management-DlVdxzPw.cjs.map → management-DGfgKsaA.cjs.map} +1 -1
- package/dist/{management-Cc8mKfnf.js → management-DNEKhR6a.js} +5 -5
- package/dist/{management-Cc8mKfnf.js.map → management-DNEKhR6a.js.map} +1 -1
- package/dist/metastore/index.cjs +1 -1
- package/dist/metastore/index.d.cts +1 -1
- package/dist/metastore/index.d.ts +1 -1
- package/dist/metastore/index.js +1 -1
- package/dist/metastore/types.d.cts +1 -1
- package/dist/metastore/types.d.ts +1 -1
- package/dist/{metastore-CNf1412Z.js → metastore-CjwktHvw.js} +4 -4
- package/dist/{metastore-CNf1412Z.js.map → metastore-CjwktHvw.js.map} +1 -1
- package/dist/{metastore-DbsxqjhS.cjs → metastore-DksEte8P.cjs} +4 -4
- package/dist/{metastore-DbsxqjhS.cjs.map → metastore-DksEte8P.cjs.map} +1 -1
- package/dist/microsoftGraph/index.cjs +92 -0
- package/dist/microsoftGraph/index.cjs.map +1 -0
- package/dist/microsoftGraph/index.d.cts +305 -0
- package/dist/microsoftGraph/index.d.ts +305 -0
- package/dist/microsoftGraph/index.js +90 -0
- package/dist/microsoftGraph/index.js.map +1 -0
- package/dist/microsoftGraph/types.cjs +0 -0
- package/dist/microsoftGraph/types.d.cts +10 -0
- package/dist/microsoftGraph/types.d.ts +10 -0
- package/dist/microsoftGraph/types.js +1 -0
- package/dist/notifications/index.cjs +3 -3
- package/dist/notifications/index.d.cts +2 -2
- package/dist/notifications/index.d.ts +2 -2
- package/dist/notifications/index.js +3 -3
- package/dist/notifications/types.d.cts +1 -1
- package/dist/notifications/types.d.ts +1 -1
- package/dist/oauth/index.cjs +1 -1
- package/dist/oauth/index.d.cts +2 -2
- package/dist/oauth/index.d.ts +2 -2
- package/dist/oauth/index.js +1 -1
- package/dist/oauth/types.d.cts +1 -1
- package/dist/oauth/types.d.ts +1 -1
- package/dist/{oauth-ClksaYRY.js → oauth-Bg5zro5S.js} +5 -5
- package/dist/{oauth-ClksaYRY.js.map → oauth-Bg5zro5S.js.map} +1 -1
- package/dist/{oauth-DsZgmtPj.cjs → oauth-DFsI1TE5.cjs} +5 -5
- package/dist/{oauth-DsZgmtPj.cjs.map → oauth-DFsI1TE5.cjs.map} +1 -1
- package/dist/omnisearch/index.cjs +2 -2
- package/dist/omnisearch/index.d.cts +2 -2
- package/dist/omnisearch/index.d.ts +2 -2
- package/dist/omnisearch/index.js +2 -2
- package/dist/omnisearch/types.d.cts +1 -1
- package/dist/omnisearch/types.d.ts +1 -1
- package/dist/{project-5SLw86eZ.d.ts → project-Bh954iOA.d.ts} +2 -2
- package/dist/{project-CRrsxSAK.d.cts → project-D25GH8zK.d.cts} +2 -2
- package/dist/queryService/index.cjs +1 -1
- package/dist/queryService/index.d.cts +1 -1
- package/dist/queryService/index.d.ts +1 -1
- package/dist/queryService/index.js +1 -1
- package/dist/queryService/types.d.cts +1 -1
- package/dist/queryService/types.d.ts +1 -1
- package/dist/{queryService-DxUUkTcy.cjs → queryService--t_W9PSJ.cjs} +6 -6
- package/dist/{queryService-DxUUkTcy.cjs.map → queryService--t_W9PSJ.cjs.map} +1 -1
- package/dist/{queryService-BlyAcBxP.js → queryService-DX6zeAs_.js} +6 -6
- package/dist/{queryService-BlyAcBxP.js.map → queryService-DX6zeAs_.js.map} +1 -1
- package/dist/queue/index.cjs +1 -1
- package/dist/queue/index.d.cts +3 -3
- package/dist/queue/index.d.ts +3 -3
- package/dist/queue/index.js +1 -1
- package/dist/queue/types.d.cts +1 -1
- package/dist/queue/types.d.ts +1 -1
- package/dist/{queue-CpcqeMPz.cjs → queue-D1_TCe0z.cjs} +5 -5
- package/dist/{queue-CpcqeMPz.cjs.map → queue-D1_TCe0z.cjs.map} +1 -1
- package/dist/{queue-DpZTm7U7.js → queue-DrLUbk98.js} +5 -5
- package/dist/{queue-DpZTm7U7.js.map → queue-DrLUbk98.js.map} +1 -1
- package/dist/scheduler/index.cjs +3 -3
- package/dist/scheduler/index.d.cts +2 -2
- package/dist/scheduler/index.d.ts +2 -2
- package/dist/scheduler/index.js +3 -3
- package/dist/scheduler/types.d.cts +1 -1
- package/dist/scheduler/types.d.ts +1 -1
- package/dist/schema-D1oxyn1O.d.cts +8760 -0
- package/dist/schema-D1oxyn1O.d.ts +8760 -0
- package/dist/sdk/configurations/index.cjs +1 -1
- package/dist/sdk/configurations/index.d.cts +4 -4
- package/dist/sdk/configurations/index.d.ts +4 -4
- package/dist/sdk/configurations/index.js +1 -1
- package/dist/sdk/developerPortal/index.cjs +5 -5
- package/dist/sdk/developerPortal/index.cjs.map +1 -1
- package/dist/sdk/developerPortal/index.d.cts +5 -4
- package/dist/sdk/developerPortal/index.d.ts +5 -4
- package/dist/sdk/developerPortal/index.js +4 -4
- package/dist/sdk/queryService/index.cjs +1 -1
- package/dist/sdk/queryService/index.d.cts +1 -1
- package/dist/sdk/queryService/index.d.ts +1 -1
- package/dist/sdk/queryService/index.js +1 -1
- package/dist/sdk/semanticLayer/index.cjs +163 -74
- package/dist/sdk/semanticLayer/index.cjs.map +1 -1
- package/dist/sdk/semanticLayer/index.d.cts +16 -13
- package/dist/sdk/semanticLayer/index.d.ts +16 -13
- package/dist/sdk/semanticLayer/index.js +158 -75
- package/dist/sdk/semanticLayer/index.js.map +1 -1
- package/dist/sdk/semanticLayer/types.d.cts +2 -2
- package/dist/sdk/semanticLayer/types.d.ts +2 -2
- package/dist/sdk/storage/index.d.cts +1 -1
- package/dist/sdk/storage/index.d.ts +1 -1
- package/dist/sdk/tag/index.d.cts +2 -2
- package/dist/sdk/tag/index.d.ts +2 -2
- package/dist/sdk/tag/types.d.cts +1 -1
- package/dist/sdk/tag/types.d.ts +1 -1
- package/dist/sdk/vault/index.d.cts +1 -1
- package/dist/sdk/vault/index.d.ts +1 -1
- package/dist/serviceIds-fHLDwOg9.d.cts +31 -0
- package/dist/serviceIds-fHLDwOg9.d.ts +31 -0
- package/dist/status/index.cjs +1 -1
- package/dist/status/index.d.cts +1 -1
- package/dist/status/index.d.ts +1 -1
- package/dist/status/index.js +1 -1
- package/dist/storage/index.cjs +4 -4
- package/dist/storage/index.d.cts +2 -2
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +4 -4
- package/dist/storage/types.d.cts +4 -3
- package/dist/storage/types.d.ts +4 -3
- package/dist/{storage-CQxu0EY3.js → storage--cVaecFq.js} +150 -161
- package/dist/storage--cVaecFq.js.map +1 -0
- package/dist/{storage-vnH64B_Q.cjs → storage-DexWot8H.cjs} +150 -161
- package/dist/storage-DexWot8H.cjs.map +1 -0
- package/dist/store-C9FQCHGe.js +74 -0
- package/dist/store-C9FQCHGe.js.map +1 -0
- package/dist/store-xS-Cu_VS.cjs +85 -0
- package/dist/store-xS-Cu_VS.cjs.map +1 -0
- package/dist/stream/index.cjs +3 -3
- package/dist/stream/index.d.cts +2 -2
- package/dist/stream/index.d.ts +2 -2
- package/dist/stream/index.js +3 -3
- package/dist/stream/types.d.cts +1 -1
- package/dist/stream/types.d.ts +1 -1
- package/dist/syncActions/index.cjs +1 -1
- package/dist/syncActions/index.d.cts +1 -1
- package/dist/syncActions/index.d.ts +1 -1
- package/dist/syncActions/index.js +1 -1
- package/dist/syncActions/types.d.cts +1 -1
- package/dist/syncActions/types.d.ts +1 -1
- package/dist/{syncActions-AgFiMjRS.js → syncActions-CkMHM-jB.js} +5 -5
- package/dist/{syncActions-AgFiMjRS.js.map → syncActions-CkMHM-jB.js.map} +1 -1
- package/dist/{syncActions-DPcAPYgJ.cjs → syncActions-DQq_A9v6.cjs} +5 -5
- package/dist/{syncActions-DPcAPYgJ.cjs.map → syncActions-DQq_A9v6.cjs.map} +1 -1
- package/dist/telemetry/index.cjs +1 -1
- package/dist/telemetry/index.d.cts +2 -2
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/index.js +1 -1
- package/dist/{telemetry-BLgaYEvi.cjs → telemetry-CAu1Qt7B.cjs} +3 -3
- package/dist/{telemetry-BLgaYEvi.cjs.map → telemetry-CAu1Qt7B.cjs.map} +1 -1
- package/dist/{telemetry-CPiGWpLi.js → telemetry-Ca6j0i9w.js} +3 -3
- package/dist/{telemetry-CPiGWpLi.js.map → telemetry-Ca6j0i9w.js.map} +1 -1
- package/dist/{types-eP06LqcE.d.cts → types-0xa_7cgo.d.cts} +2 -16
- package/dist/{types-DLazCdFR.d.cts → types-3p0adMdd.d.cts} +3 -3
- package/dist/{types-DWUd__fe.d.ts → types-6ThDkaJw.d.ts} +2 -2
- package/dist/{types-Culr5v8R.d.ts → types-6hh_3SZs.d.ts} +3 -3
- package/dist/{types-DN7RWWBw.d.ts → types-6ku2LeX6.d.ts} +2 -2
- package/dist/{types-DSBNqF1J.d.cts → types-B42HhyB0.d.cts} +2 -2
- package/dist/{types-C2p7JYQ3.d.cts → types-B4_MM5Wf.d.cts} +2 -2
- package/dist/{types-B2El99VY.d.cts → types-B6JJCta-.d.cts} +2 -2
- package/dist/{types-BHCigZFc.d.ts → types-B6lOyHY_.d.ts} +3 -3
- package/dist/{types-Bc3-a3DT.d.cts → types-B7O5koJb.d.cts} +2 -2
- package/dist/{types-D5VvEdOv.d.ts → types-BHI8Lin9.d.ts} +2 -2
- package/dist/{types-DnOGCb-p.d.cts → types-BO3sCD0a.d.cts} +41 -10
- package/dist/{types-Bv5vw2dc.d.cts → types-BOnf68s5.d.cts} +2 -2
- package/dist/{types-CIybfUJ9.d.cts → types-BS5M67xm.d.cts} +3 -3
- package/dist/{types-C0bGZqFI.d.cts → types-BT46XIgn.d.cts} +2 -2
- package/dist/types-BUYqdN7B.d.ts +205 -0
- package/dist/{types-DdeZK3BO.d.ts → types-BYKHr5bR.d.ts} +2 -2
- package/dist/{types-BIAP4CYp.d.cts → types-Be3Wgn1U.d.cts} +2 -2
- package/dist/{types-B1S60aS2.d.ts → types-BgVKG4vg.d.ts} +2 -2
- package/dist/{types-BJLRgXw0.d.ts → types-C2gzqtjf.d.ts} +2 -2
- package/dist/{types-DQOOWgLt.d.cts → types-C35GWNmq.d.ts} +408 -24
- package/dist/{types-DMMMQuNt.d.ts → types-C4mr0lop.d.ts} +279 -430
- package/dist/{types-CFhAduFK.d.cts → types-CCr1-9Q6.d.cts} +3 -3
- package/dist/{types-Dirp9mni.d.ts → types-CHCM9oNk.d.ts} +3 -3
- package/dist/types-CNQdtffE.d.ts +3454 -0
- package/dist/{types-mXM8MrYS.d.cts → types-CPaluTW7.d.cts} +3 -3
- package/dist/{types-RmbvQimP.d.ts → types-CSc8NQCY.d.ts} +41 -10
- package/dist/{types-CgF9R0Na.d.ts → types-C_ilZZkQ.d.ts} +2 -2
- package/dist/{types-lVXf05pr.d.ts → types-CaMfshWX.d.ts} +2 -2
- package/dist/{types-BXnUqdBB.d.cts → types-Ccgbipp4.d.cts} +2 -2
- package/dist/types-Cpjk0-ta.d.ts +33557 -0
- package/dist/types-CrH4H8M4.d.cts +33557 -0
- package/dist/{types-CQd9PuKY.d.cts → types-Cu-0LT4f.d.cts} +2 -2
- package/dist/{types-D7YGPUsm.d.ts → types-CxmV36rp.d.cts} +408 -24
- package/dist/{types-SX78XZZ0.d.ts → types-D-98DirB.d.ts} +2 -2
- package/dist/{types-DG_FlLJt.d.cts → types-D6ocCyGh.d.cts} +279 -430
- package/dist/{types-DkoyCUqv.d.ts → types-D7Wgcp0u.d.ts} +2 -2
- package/dist/{types-COFrOmuO.d.ts → types-DAzmGzlb.d.ts} +2 -2
- package/dist/{types-BdKtW2Ml.d.cts → types-DHI0g51U.d.cts} +2 -2
- package/dist/{types-BMsK6T5k.d.ts → types-DHqIJKwx.d.ts} +2 -2
- package/dist/types-DONxb2-c.d.cts +205 -0
- package/dist/{types-DyIKgbGB.d.ts → types-DTTC70Ac.d.ts} +2 -2
- package/dist/{types-B2Al1BNh.d.ts → types-DlvZeert.d.ts} +2 -2
- package/dist/{types-uP64XthM.d.cts → types-DqniGeDJ.d.cts} +2 -2
- package/dist/types-E3VT-zYz.d.cts +3454 -0
- package/dist/{types-CuAoZH8w.d.cts → types-Jt0ipbSm.d.cts} +2 -2
- package/dist/{types-Co8WobOo.d.ts → types-Ur37iOqb.d.ts} +3 -3
- package/dist/{types-Drk7PEhk.d.ts → types-ZGAWRIBW.d.ts} +2 -2
- package/dist/{types-056giLrn.d.cts → types-bY6K3y0O.d.cts} +2 -2
- package/dist/{types-BvXODdf5.d.ts → types-k4R8gQ4U.d.ts} +2 -16
- package/dist/{types-sTH4KiPc.d.cts → types-sO52qIAA.d.cts} +2 -2
- package/dist/{types-By47HWwB.d.cts → types-sp1rJY9E.d.cts} +2 -2
- package/dist/{validateConnectionStatus-DVHXGTdi.cjs → validateConnectionStatus-24zqIQ0p.cjs} +2 -2
- package/dist/{validateConnectionStatus-DVHXGTdi.cjs.map → validateConnectionStatus-24zqIQ0p.cjs.map} +1 -1
- package/dist/{validateConnectionStatus-CBhXmvWC.js → validateConnectionStatus-DhkWg6Eq.js} +2 -2
- package/dist/{validateConnectionStatus-CBhXmvWC.js.map → validateConnectionStatus-DhkWg6Eq.js.map} +1 -1
- package/dist/vault/index.cjs +4 -4
- package/dist/vault/index.d.cts +1 -1
- package/dist/vault/index.d.ts +1 -1
- package/dist/vault/index.js +4 -4
- package/dist/vault/types.d.cts +1 -1
- package/dist/vault/types.d.ts +1 -1
- package/package.json +55 -3
- package/surface/auth.md +2 -2
- package/surface/chat.md +1 -1
- package/surface/kaiAgent.md +5 -2
- package/surface/sdk.md +4 -4
- package/surface/storage.md +44 -44
- package/dist/authClient-Cixa8_L1.cjs.map +0 -1
- package/dist/authClient-XBAUz9g-.js.map +0 -1
- package/dist/configurations-DCOJONZZ.cjs.map +0 -1
- package/dist/configurations-iCbhe0tb.js.map +0 -1
- package/dist/constants-CkAVvuUq.cjs.map +0 -1
- package/dist/constants-qeWGfk_7.js.map +0 -1
- package/dist/createFetchClient-B1h3-p65.js.map +0 -1
- package/dist/createFetchClient-B9Cv0W9f.cjs.map +0 -1
- package/dist/createStore-BNiCRQXa.js +0 -148
- package/dist/createStore-BNiCRQXa.js.map +0 -1
- package/dist/createStore-MQbboXcB.cjs +0 -177
- package/dist/createStore-MQbboXcB.cjs.map +0 -1
- package/dist/credential-D-tX9gP4.cjs.map +0 -1
- package/dist/credential-dKxArMic.js.map +0 -1
- package/dist/jobStatus-DbMupQEK.js.map +0 -1
- package/dist/jobStatus-kQ9JqF8t.cjs.map +0 -1
- package/dist/storage-CQxu0EY3.js.map +0 -1
- package/dist/storage-vnH64B_Q.cjs.map +0 -1
- package/dist/types-BV74LS5r.d.ts +0 -148
- package/dist/types-CIJAtX8q.d.cts +0 -18784
- package/dist/types-X-gQF8F8.d.ts +0 -18784
- package/dist/types-ca-YNg1r.d.cts +0 -148
package/dist/index.js
CHANGED
|
@@ -1,53 +1,51 @@
|
|
|
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-
|
|
3
|
-
import { n as collect, t as createQueueClient } from "./queue-
|
|
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-DrLUbk98.js";
|
|
4
4
|
import { t as concurrent } from "./concurrent-CH9fbNr3.js";
|
|
5
5
|
import { t as dedupe } from "./dedupe-DYIHgZoG.js";
|
|
6
|
-
import {
|
|
7
|
-
import { a as series, i as ServiceUnavailableError, t as createStorageClient } from "./storage
|
|
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--cVaecFq.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-
|
|
11
|
+
import { n as schemaGuidedMerge, r as isEmptyDeep, t as createConfigurationSdk } from "./configurations-ZwBXilW-.js";
|
|
12
12
|
import { t as UserError } from "./UserError-By_Zckmc.js";
|
|
13
|
-
import { a as
|
|
14
|
-
import { n as HtmlResponseError, r as isHtmlResponseError } from "./validateConnectionStatus-
|
|
15
|
-
import { t as ManagementClientAuthError } from "./ManagementClientAuthError-
|
|
13
|
+
import { a as isTimeoutError, h as ApiError, i as isFetchClientError, m as KeboolaHttpHeader, n as isAbortError, o as HttpContentType, p as HttpStatus, r as isApiError, s as HttpHeader, u as normalizeBaseUrl } from "./createFetchClient-DdyZMhxO.js";
|
|
14
|
+
import { n as HtmlResponseError, r as isHtmlResponseError } from "./validateConnectionStatus-DhkWg6Eq.js";
|
|
15
|
+
import { t as ManagementClientAuthError } from "./ManagementClientAuthError-iKbBugKC.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
18
|
import { n as isValidationError, r as parseOrThrow, t as ValidationError } from "./ValidationError-CzPWydEb.js";
|
|
19
|
-
import { t as createGenericFetchClient } from "./createGenericFetchClient-
|
|
20
|
-
import { t as createImportClient } from "./import-
|
|
21
|
-
import { t as
|
|
22
|
-
import { t as
|
|
23
|
-
import {
|
|
24
|
-
import { t as createAuthHeaders } from "./auth-CE6Hlc9W.js";
|
|
25
|
-
import { o as ProjectFeature } from "./constants-qeWGfk_7.js";
|
|
19
|
+
import { t as createGenericFetchClient } from "./createGenericFetchClient-MQeLRiNW.js";
|
|
20
|
+
import { t as createImportClient } from "./import-2nqxQ9Rt.js";
|
|
21
|
+
import { t as createAuthClient } from "./authClient-DEyqR7GW.js";
|
|
22
|
+
import { n as isManagementClientAuthError, t as createManagementClient } from "./management-DNEKhR6a.js";
|
|
23
|
+
import { s as ProjectFeature } from "./constants-ByEwVtGf.js";
|
|
26
24
|
import { t as createStorageTable } from "./storageTable-DslXtqNL.js";
|
|
27
25
|
import { createSemanticLayerSdk } from "./sdk/semanticLayer/index.js";
|
|
28
26
|
import { createStorageSdk } from "./sdk/storage/index.js";
|
|
29
27
|
import { createVaultSdk } from "./sdk/vault/index.js";
|
|
30
28
|
import { createAiClient } from "./ai/index.js";
|
|
31
|
-
import { t as parseLogLines } from "./appLogs-
|
|
29
|
+
import { t as parseLogLines } from "./appLogs-D72eD8vP.js";
|
|
32
30
|
import { createAppsClient } from "./apps/index.js";
|
|
33
31
|
import { createChatClient } from "./chat/index.js";
|
|
34
|
-
import { t as createDataScienceClient } from "./dataScience-
|
|
32
|
+
import { t as createDataScienceClient } from "./dataScience-B_TA7wCB.js";
|
|
35
33
|
import { createEditorClient } from "./editor/index.js";
|
|
36
34
|
import { createEncryptionClient } from "./encryption/index.js";
|
|
37
|
-
import { t as
|
|
35
|
+
import { t as createKaiAgentClient } from "./kaiAgent-CYYn0QJW.js";
|
|
36
|
+
import { t as createMetastoreClient } from "./metastore-CjwktHvw.js";
|
|
38
37
|
import { createNotificationsClient } from "./notifications/index.js";
|
|
39
|
-
import { t as createOauthClient } from "./oauth-
|
|
38
|
+
import { t as createOauthClient } from "./oauth-Bg5zro5S.js";
|
|
40
39
|
import { createOmnisearchClient } from "./omnisearch/index.js";
|
|
41
|
-
import { t as createQueryServiceClient } from "./queryService-
|
|
40
|
+
import { t as createQueryServiceClient } from "./queryService-DX6zeAs_.js";
|
|
42
41
|
import { createSchedulerClient } from "./scheduler/index.js";
|
|
43
42
|
import { createStreamClient } from "./stream/index.js";
|
|
44
|
-
import { t as createSyncActionsClient } from "./syncActions-
|
|
45
|
-
import { t as createTelemetryClient } from "./telemetry-
|
|
43
|
+
import { t as createSyncActionsClient } from "./syncActions-CkMHM-jB.js";
|
|
44
|
+
import { t as createTelemetryClient } from "./telemetry-Ca6j0i9w.js";
|
|
46
45
|
import { createVaultClient } from "./vault/index.js";
|
|
47
|
-
import { n as isUnauthorized, t as createBearerCredential } from "./credential-
|
|
46
|
+
import { n as isUnauthorized, t as createBearerCredential } from "./credential-Bxv7yxOZ.js";
|
|
48
47
|
import { createQueryServiceSdk } from "./sdk/queryService/index.js";
|
|
49
48
|
import * as z$1 from "zod";
|
|
50
|
-
import { z } from "zod";
|
|
51
49
|
//#region src/utils/assert.ts
|
|
52
50
|
function assert(value, message) {
|
|
53
51
|
if (value == null) throw new Error(message);
|
|
@@ -93,6 +91,111 @@ const coalesce = (task) => {
|
|
|
93
91
|
};
|
|
94
92
|
};
|
|
95
93
|
//#endregion
|
|
94
|
+
//#region src/utils/store/derivedStore.ts
|
|
95
|
+
const isPlainObjectOrArray = (value) => {
|
|
96
|
+
if (Array.isArray(value)) return true;
|
|
97
|
+
const proto = Object.getPrototypeOf(value);
|
|
98
|
+
return proto === Object.prototype || proto === null;
|
|
99
|
+
};
|
|
100
|
+
const shallowEqual = (a, b) => {
|
|
101
|
+
if (Object.is(a, b)) return true;
|
|
102
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) return false;
|
|
103
|
+
if (!isPlainObjectOrArray(a) || !isPlainObjectOrArray(b)) return false;
|
|
104
|
+
const aKeys = Object.keys(a);
|
|
105
|
+
const bKeys = Object.keys(b);
|
|
106
|
+
return aKeys.length === bKeys.length && aKeys.every((key) => Object.is(a[key], b[key]));
|
|
107
|
+
};
|
|
108
|
+
const createDerivedStore = ({ source, dependsOn, build, keyEquals = shallowEqual }) => {
|
|
109
|
+
let key = dependsOn(source.get());
|
|
110
|
+
const store = createStore(build(key));
|
|
111
|
+
const unsubscribe = source.subscribe((state) => {
|
|
112
|
+
const next = dependsOn(state);
|
|
113
|
+
if (keyEquals(key, next)) return;
|
|
114
|
+
key = next;
|
|
115
|
+
store.set(build(next));
|
|
116
|
+
});
|
|
117
|
+
const get = store.get;
|
|
118
|
+
const subscribe = store.subscribe;
|
|
119
|
+
const dispose = () => {
|
|
120
|
+
unsubscribe();
|
|
121
|
+
store.dispose();
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
get,
|
|
125
|
+
subscribe,
|
|
126
|
+
dispose
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/utils/store/derivedAsyncStore.ts
|
|
131
|
+
const createDerivedAsyncStore = ({ source, dependsOn, build, keyEquals = shallowEqual }) => {
|
|
132
|
+
const store = createStore({ state: "idle" });
|
|
133
|
+
let currentKey = null;
|
|
134
|
+
let generation = 0;
|
|
135
|
+
let controller = null;
|
|
136
|
+
const run = (key) => {
|
|
137
|
+
controller?.abort();
|
|
138
|
+
controller = new AbortController();
|
|
139
|
+
const runGeneration = ++generation;
|
|
140
|
+
store.set({ state: "pending" });
|
|
141
|
+
build(key, controller.signal).then((value) => {
|
|
142
|
+
if (runGeneration === generation) store.set({
|
|
143
|
+
state: "ready",
|
|
144
|
+
value
|
|
145
|
+
});
|
|
146
|
+
}, (error) => {
|
|
147
|
+
if (runGeneration === generation) store.set({
|
|
148
|
+
state: "errored",
|
|
149
|
+
error
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
const sync = (state) => {
|
|
154
|
+
const next = dependsOn(state);
|
|
155
|
+
if (next === null) {
|
|
156
|
+
if (currentKey === null) return;
|
|
157
|
+
controller?.abort();
|
|
158
|
+
controller = null;
|
|
159
|
+
generation += 1;
|
|
160
|
+
currentKey = null;
|
|
161
|
+
store.set({ state: "idle" });
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (currentKey !== null && keyEquals(currentKey, next)) return;
|
|
165
|
+
currentKey = next;
|
|
166
|
+
run(next);
|
|
167
|
+
};
|
|
168
|
+
sync(source.get());
|
|
169
|
+
const unsubscribe = source.subscribe(sync);
|
|
170
|
+
const get = store.get;
|
|
171
|
+
const subscribe = store.subscribe;
|
|
172
|
+
const dispose = () => {
|
|
173
|
+
controller?.abort();
|
|
174
|
+
unsubscribe();
|
|
175
|
+
store.dispose();
|
|
176
|
+
};
|
|
177
|
+
const readable = {
|
|
178
|
+
get,
|
|
179
|
+
subscribe,
|
|
180
|
+
dispose
|
|
181
|
+
};
|
|
182
|
+
const settled = () => new Promise((resolve) => {
|
|
183
|
+
let unsubscribeSettled = () => {};
|
|
184
|
+
const check = (state) => {
|
|
185
|
+
if (state.state === "ready" || state.state === "errored") {
|
|
186
|
+
unsubscribeSettled();
|
|
187
|
+
resolve(state);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
unsubscribeSettled = store.subscribe(check);
|
|
191
|
+
check(store.get());
|
|
192
|
+
});
|
|
193
|
+
return {
|
|
194
|
+
store: readable,
|
|
195
|
+
settled
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
//#endregion
|
|
96
199
|
//#region src/utils/async/poll/registry.ts
|
|
97
200
|
const DEFAULT_LIMIT = 50;
|
|
98
201
|
const isFinished = ({ snapshot }) => snapshot.state !== "idle" && snapshot.state !== "polling";
|
|
@@ -603,6 +706,7 @@ const stamp = (tokens) => ({
|
|
|
603
706
|
const createConfig$1 = (initial = INITIAL) => {
|
|
604
707
|
const store = createStore(initial);
|
|
605
708
|
let expiredNotified = false;
|
|
709
|
+
let epoch = 0;
|
|
606
710
|
const setBaseUrl = (baseUrl) => {
|
|
607
711
|
if (store.get().status !== "anonymous") throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
|
|
608
712
|
store.set({
|
|
@@ -615,6 +719,7 @@ const createConfig$1 = (initial = INITIAL) => {
|
|
|
615
719
|
if (state.status !== "anonymous") throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
|
|
616
720
|
if (!state.baseUrl) throw new KeboolaError(KeboolaErrorType.Unconfigured);
|
|
617
721
|
expiredNotified = false;
|
|
722
|
+
epoch += 1;
|
|
618
723
|
store.set({
|
|
619
724
|
status: "authenticated",
|
|
620
725
|
baseUrl: state.baseUrl,
|
|
@@ -648,6 +753,7 @@ const createConfig$1 = (initial = INITIAL) => {
|
|
|
648
753
|
};
|
|
649
754
|
/** Drop the credential (sign out); keeps the configured baseUrl. */
|
|
650
755
|
const reset = () => {
|
|
756
|
+
epoch += 1;
|
|
651
757
|
store.set({
|
|
652
758
|
status: "anonymous",
|
|
653
759
|
baseUrl: store.get().baseUrl
|
|
@@ -689,6 +795,15 @@ const createConfig$1 = (initial = INITIAL) => {
|
|
|
689
795
|
};
|
|
690
796
|
const getBaseUrl = () => store.get().baseUrl;
|
|
691
797
|
/**
|
|
798
|
+
* Which sign-in this is — a counter, bumped by `authenticate` and `reset`.
|
|
799
|
+
*
|
|
800
|
+
* - For anything long-lived that must not outlive the credential it was built against: capture it,
|
|
801
|
+
* compare it later. A rotation does not move it; only a new session or a sign-out does.
|
|
802
|
+
* - Distinct from `notifyExpired`'s latch, which answers "report this death once" rather than
|
|
803
|
+
* "which session are we in".
|
|
804
|
+
*/
|
|
805
|
+
const getEpoch = () => epoch;
|
|
806
|
+
/**
|
|
692
807
|
* Session-expiry latch (fire-once):
|
|
693
808
|
* - why: concurrent 401s all report expiry, but the app must sign out once; and the credential /
|
|
694
809
|
* auth middleware are long-lived singletons, so the latch can't live in them — it must reset
|
|
@@ -717,6 +832,7 @@ const createConfig$1 = (initial = INITIAL) => {
|
|
|
717
832
|
forceExpire,
|
|
718
833
|
requireCredential,
|
|
719
834
|
getBaseUrl,
|
|
835
|
+
getEpoch,
|
|
720
836
|
notifyExpired,
|
|
721
837
|
debug
|
|
722
838
|
};
|
|
@@ -857,216 +973,6 @@ const createVariablesSdk = ({ storageClient }) => {
|
|
|
857
973
|
};
|
|
858
974
|
};
|
|
859
975
|
//#endregion
|
|
860
|
-
//#region src/clients/kaiAgent/kaiAgentClient.ts
|
|
861
|
-
const agentSettingsSchema = z.object({
|
|
862
|
-
projectId: z.string(),
|
|
863
|
-
customInstructions: z.string().nullable(),
|
|
864
|
-
createdAt: z.string(),
|
|
865
|
-
updatedAt: z.string()
|
|
866
|
-
});
|
|
867
|
-
const toolPermissionValueSchema = z.enum([
|
|
868
|
-
"always_allow",
|
|
869
|
-
"always_ask",
|
|
870
|
-
"blocked"
|
|
871
|
-
]);
|
|
872
|
-
const userAgentSettingsSchema = z.object({
|
|
873
|
-
projectId: z.string(),
|
|
874
|
-
userId: z.string(),
|
|
875
|
-
customInstructions: z.string().nullable(),
|
|
876
|
-
toolPermissions: z.record(z.string(), toolPermissionValueSchema).nullable(),
|
|
877
|
-
createdAt: z.string(),
|
|
878
|
-
updatedAt: z.string()
|
|
879
|
-
});
|
|
880
|
-
const toolInfoSchema = z.object({
|
|
881
|
-
name: z.string(),
|
|
882
|
-
description: z.string(),
|
|
883
|
-
readOnly: z.boolean()
|
|
884
|
-
});
|
|
885
|
-
const toolsListResponseSchema = z.object({ tools: z.array(toolInfoSchema) });
|
|
886
|
-
const skillInfoSchema = z.object({
|
|
887
|
-
name: z.string(),
|
|
888
|
-
description: z.string().nullable(),
|
|
889
|
-
source: z.enum([
|
|
890
|
-
"first-party",
|
|
891
|
-
"vendored",
|
|
892
|
-
"project"
|
|
893
|
-
])
|
|
894
|
-
});
|
|
895
|
-
const builtInCommandSchema = z.object({
|
|
896
|
-
name: z.string(),
|
|
897
|
-
description: z.string()
|
|
898
|
-
});
|
|
899
|
-
const skillsListResponseSchema = z.object({
|
|
900
|
-
skills: z.array(skillInfoSchema),
|
|
901
|
-
commands: z.array(builtInCommandSchema)
|
|
902
|
-
});
|
|
903
|
-
const sandboxFileEntrySchema = z.object({
|
|
904
|
-
name: z.string(),
|
|
905
|
-
path: z.string(),
|
|
906
|
-
type: z.enum(["file", "dir"]),
|
|
907
|
-
size: z.number().int().nonnegative().optional()
|
|
908
|
-
});
|
|
909
|
-
const sandboxFileListingSchema = z.object({ entries: z.array(sandboxFileEntrySchema) });
|
|
910
|
-
const sandboxFileContentSchema = z.object({
|
|
911
|
-
content: z.string(),
|
|
912
|
-
encoding: z.enum(["utf-8", "binary"]),
|
|
913
|
-
truncated: z.boolean(),
|
|
914
|
-
size: z.number().int().nonnegative()
|
|
915
|
-
});
|
|
916
|
-
const sandboxGitBranchSchema = z.object({ branch: z.string().nullable() });
|
|
917
|
-
const votesResponseSchema = z.array(z.object({
|
|
918
|
-
chatId: z.string(),
|
|
919
|
-
messageId: z.string(),
|
|
920
|
-
isUpvoted: z.boolean()
|
|
921
|
-
}));
|
|
922
|
-
const createKaiAgentClient = ({ baseUrl, middlewares, auth }) => {
|
|
923
|
-
const clientOptions = {
|
|
924
|
-
baseUrl,
|
|
925
|
-
middlewares,
|
|
926
|
-
headers: createAuthHeaders(auth)
|
|
927
|
-
};
|
|
928
|
-
const client = createOpenapiFetchClient(clientOptions);
|
|
929
|
-
const genericClient = createGenericFetchClient(clientOptions);
|
|
930
|
-
const getHistory = async (params) => {
|
|
931
|
-
const { data } = await client.get("/api/history", { query: params });
|
|
932
|
-
return data;
|
|
933
|
-
};
|
|
934
|
-
const getChat = async (chatId, signal) => {
|
|
935
|
-
const { data } = await client.get("/api/chat/{id}", { path: { id: chatId } }, { signal });
|
|
936
|
-
return data;
|
|
937
|
-
};
|
|
938
|
-
const deleteChat = async (chatId) => {
|
|
939
|
-
const { data } = await client.delete("/api/chat", { query: { id: chatId } });
|
|
940
|
-
return data;
|
|
941
|
-
};
|
|
942
|
-
const createChat = async (request) => {
|
|
943
|
-
const { response } = await client.post("/api/chat", { body: request });
|
|
944
|
-
return response;
|
|
945
|
-
};
|
|
946
|
-
const getVotes = async (chatId) => {
|
|
947
|
-
const { data } = await client.get("/api/vote", { query: { chatId } });
|
|
948
|
-
const result = votesResponseSchema.safeParse(data);
|
|
949
|
-
if (!result.success) throw new Error("Invalid votes response format");
|
|
950
|
-
return result.data;
|
|
951
|
-
};
|
|
952
|
-
const submitVote = async (params) => {
|
|
953
|
-
await client.patch("/api/vote", { body: params });
|
|
954
|
-
};
|
|
955
|
-
const getUsage = async (signal) => {
|
|
956
|
-
const { data } = await client.get("/api/usage", {}, { signal });
|
|
957
|
-
return data;
|
|
958
|
-
};
|
|
959
|
-
const approveToolCall = async (chatId, body) => {
|
|
960
|
-
await client.post("/api/chat/{id}/approval", {
|
|
961
|
-
path: { id: chatId },
|
|
962
|
-
body
|
|
963
|
-
});
|
|
964
|
-
};
|
|
965
|
-
const submitToolOutput = async (chatId, body) => {
|
|
966
|
-
await client.post("/api/chat/{id}/ui-tool-result", {
|
|
967
|
-
path: { id: chatId },
|
|
968
|
-
body
|
|
969
|
-
});
|
|
970
|
-
};
|
|
971
|
-
const stopChat = async (chatId) => {
|
|
972
|
-
const { data } = await client.post("/api/chat/{id}/stop", { path: { id: chatId } });
|
|
973
|
-
return data;
|
|
974
|
-
};
|
|
975
|
-
const getSuggestions = async (request, signal) => {
|
|
976
|
-
const { data } = await client.post("/api/suggestions", { body: request }, { signal });
|
|
977
|
-
return data;
|
|
978
|
-
};
|
|
979
|
-
const getAgentSettings = async (signal) => {
|
|
980
|
-
const { data } = await genericClient.get("/api/settings", {}, { signal });
|
|
981
|
-
const result = agentSettingsSchema.safeParse(data);
|
|
982
|
-
if (!result.success) throw new Error("Invalid agent settings response format");
|
|
983
|
-
return result.data;
|
|
984
|
-
};
|
|
985
|
-
const updateAgentSettings = async (request, signal) => {
|
|
986
|
-
const { data } = await genericClient.patch("/api/settings", { body: request }, { signal });
|
|
987
|
-
const result = agentSettingsSchema.safeParse(data);
|
|
988
|
-
if (!result.success) throw new Error("Invalid agent settings response format");
|
|
989
|
-
return result.data;
|
|
990
|
-
};
|
|
991
|
-
const getUserAgentSettings = async (signal) => {
|
|
992
|
-
const { data } = await genericClient.get("/api/settings/user", {}, { signal });
|
|
993
|
-
const result = userAgentSettingsSchema.safeParse(data);
|
|
994
|
-
if (!result.success) throw new Error("Invalid user agent settings response format");
|
|
995
|
-
return result.data;
|
|
996
|
-
};
|
|
997
|
-
const updateUserAgentSettings = async (request, signal) => {
|
|
998
|
-
const { data } = await genericClient.patch("/api/settings/user", { body: request }, { signal });
|
|
999
|
-
const result = userAgentSettingsSchema.safeParse(data);
|
|
1000
|
-
if (!result.success) throw new Error("Invalid user agent settings response format");
|
|
1001
|
-
return result.data;
|
|
1002
|
-
};
|
|
1003
|
-
const getToolsList = async (signal) => {
|
|
1004
|
-
const { data } = await genericClient.get("/api/settings/tools", {}, { signal });
|
|
1005
|
-
const result = toolsListResponseSchema.safeParse(data);
|
|
1006
|
-
if (!result.success) throw new Error("Invalid tools list response format");
|
|
1007
|
-
return result.data;
|
|
1008
|
-
};
|
|
1009
|
-
const getSkillsList = async (signal) => {
|
|
1010
|
-
const { data } = await genericClient.get("/api/skills", {}, { signal });
|
|
1011
|
-
const result = skillsListResponseSchema.safeParse(data);
|
|
1012
|
-
if (!result.success) throw new Error("Invalid skills list response format");
|
|
1013
|
-
return result.data;
|
|
1014
|
-
};
|
|
1015
|
-
const listSandboxFiles = async (chatId, path, signal) => {
|
|
1016
|
-
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/files`, { query: path ? { path } : void 0 }, { signal });
|
|
1017
|
-
const result = sandboxFileListingSchema.safeParse(data);
|
|
1018
|
-
if (!result.success) throw new Error("Invalid sandbox files response format");
|
|
1019
|
-
return result.data;
|
|
1020
|
-
};
|
|
1021
|
-
const readSandboxFile = async (chatId, path, signal) => {
|
|
1022
|
-
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/file`, { query: { path } }, { signal });
|
|
1023
|
-
const result = sandboxFileContentSchema.safeParse(data);
|
|
1024
|
-
if (!result.success) throw new Error("Invalid sandbox file response format");
|
|
1025
|
-
return result.data;
|
|
1026
|
-
};
|
|
1027
|
-
const downloadSandboxFile = async (chatId, path, signal) => {
|
|
1028
|
-
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/file/download`, { query: { path } }, { signal });
|
|
1029
|
-
if (!(data instanceof Blob)) throw new Error("Invalid sandbox file download response format");
|
|
1030
|
-
return data;
|
|
1031
|
-
};
|
|
1032
|
-
const getSandboxGitBranch = async (chatId, signal) => {
|
|
1033
|
-
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/git-branch`, {}, { signal });
|
|
1034
|
-
const result = sandboxGitBranchSchema.safeParse(data);
|
|
1035
|
-
if (!result.success) throw new Error("Invalid sandbox git-branch response format");
|
|
1036
|
-
return result.data;
|
|
1037
|
-
};
|
|
1038
|
-
const chatStreamUrl = clientOptions.baseUrl + "/api/chat";
|
|
1039
|
-
const healthCheck = async (signal) => {
|
|
1040
|
-
const { data } = await genericClient.get("/health", {}, { signal });
|
|
1041
|
-
return data;
|
|
1042
|
-
};
|
|
1043
|
-
return {
|
|
1044
|
-
healthCheck,
|
|
1045
|
-
getHistory,
|
|
1046
|
-
getChat,
|
|
1047
|
-
deleteChat,
|
|
1048
|
-
createChat,
|
|
1049
|
-
getVotes,
|
|
1050
|
-
submitVote,
|
|
1051
|
-
getUsage,
|
|
1052
|
-
approveToolCall,
|
|
1053
|
-
submitToolOutput,
|
|
1054
|
-
stopChat,
|
|
1055
|
-
getSuggestions,
|
|
1056
|
-
getAgentSettings,
|
|
1057
|
-
updateAgentSettings,
|
|
1058
|
-
getUserAgentSettings,
|
|
1059
|
-
updateUserAgentSettings,
|
|
1060
|
-
getToolsList,
|
|
1061
|
-
getSkillsList,
|
|
1062
|
-
listSandboxFiles,
|
|
1063
|
-
readSandboxFile,
|
|
1064
|
-
downloadSandboxFile,
|
|
1065
|
-
getSandboxGitBranch,
|
|
1066
|
-
chatStreamUrl
|
|
1067
|
-
};
|
|
1068
|
-
};
|
|
1069
|
-
//#endregion
|
|
1070
976
|
//#region src/keboola/createServiceClients.ts
|
|
1071
977
|
const createServiceClients = ({ baseUrl, auth, getServiceBaseUrl, middlewareFor, attachTokenMiddleware }) => createServiceClientRegistry()({
|
|
1072
978
|
getServiceBaseUrl,
|
|
@@ -1397,7 +1303,12 @@ const createKeboola = (options = {}) => {
|
|
|
1397
1303
|
const refresh = async () => {
|
|
1398
1304
|
const client = authClientBare.get();
|
|
1399
1305
|
assert$1(client, KeboolaErrorType.NotReady);
|
|
1400
|
-
const
|
|
1306
|
+
const epoch = config.getEpoch();
|
|
1307
|
+
const refreshed = await client.token.refresh(config.requireCredential().refreshToken).catch((error) => {
|
|
1308
|
+
if (config.getEpoch() !== epoch) throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1309
|
+
throw error;
|
|
1310
|
+
});
|
|
1311
|
+
if (config.getEpoch() !== epoch) throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1401
1312
|
config.applyRefresh(refreshed);
|
|
1402
1313
|
return refreshed.accessToken;
|
|
1403
1314
|
};
|
|
@@ -1413,8 +1324,36 @@ const createKeboola = (options = {}) => {
|
|
|
1413
1324
|
}
|
|
1414
1325
|
};
|
|
1415
1326
|
};
|
|
1327
|
+
/**
|
|
1328
|
+
* The project this session is scoped to, right now.
|
|
1329
|
+
*
|
|
1330
|
+
* - Read at every point that stamps a project, never snapshotted across an `await`: the scope moves
|
|
1331
|
+
* with `setProject`/`clearProject`, and neither ends the session, so it is not in the epoch and
|
|
1332
|
+
* `assertSameSession` cannot see it change.
|
|
1333
|
+
* - `NotReady` rather than `NotAuthenticated` when merely unscoped — the credential is fine, the
|
|
1334
|
+
* project is what is missing. A credential alone does not authorize a project request: kai-agent
|
|
1335
|
+
* reads the project from the header, not the token, and cannot attribute a call that omits it.
|
|
1336
|
+
*/
|
|
1337
|
+
const requireScopedProject = () => {
|
|
1338
|
+
const state = config.store.get();
|
|
1339
|
+
if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1340
|
+
if (state.status !== "scoped") throw new KeboolaError(KeboolaErrorType.NotReady);
|
|
1341
|
+
return state.projectId;
|
|
1342
|
+
};
|
|
1343
|
+
/**
|
|
1344
|
+
* The project client sets `forProject` has handed out, keyed by project id.
|
|
1345
|
+
*
|
|
1346
|
+
* - Not keyed by stack: `setBaseUrl` throws once authenticated and `signOut` empties this, so one
|
|
1347
|
+
* entry can never belong to a different `baseUrl` than the live session.
|
|
1348
|
+
* - A `lazy` per key, not a bare promise: concurrent callers share one bootstrap, later ones replay
|
|
1349
|
+
* the resolved set, and a rejected build clears only its own slot — so a build orphaned by a
|
|
1350
|
+
* sign-out cannot evict the entry that replaced it.
|
|
1351
|
+
*/
|
|
1352
|
+
const extraProjects = /* @__PURE__ */ new Map();
|
|
1416
1353
|
const signOut = () => {
|
|
1417
1354
|
config.reset();
|
|
1355
|
+
credential.abandonRefresh();
|
|
1356
|
+
extraProjects.clear();
|
|
1418
1357
|
persistor.clear();
|
|
1419
1358
|
};
|
|
1420
1359
|
const onSessionExpired = () => {
|
|
@@ -1425,13 +1364,75 @@ const createKeboola = (options = {}) => {
|
|
|
1425
1364
|
getToken,
|
|
1426
1365
|
onSessionExpired
|
|
1427
1366
|
});
|
|
1428
|
-
const
|
|
1367
|
+
const sessionGuard = (epoch) => () => {
|
|
1368
|
+
if (config.getEpoch() !== epoch) throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1369
|
+
};
|
|
1370
|
+
/**
|
|
1371
|
+
* The auth middleware, refusing to carry a request across a change of session.
|
|
1372
|
+
*
|
|
1373
|
+
* - The middleware holds no token — it reads the credential live — so anything built on it acts as
|
|
1374
|
+
* whoever is signed in *at request time*, not whoever built it. Rebuilding a store on sign-out
|
|
1375
|
+
* only stops new reads; a request already in flight completes as the next user, still stamped
|
|
1376
|
+
* with the old project. `config`'s epoch moves on `authenticate` and `reset` and never on a
|
|
1377
|
+
* rotation, so it is exactly "which sign-in is this".
|
|
1378
|
+
* - `epochFor` says which sign-in a request answers to, resolved per request:
|
|
1379
|
+
* 1. a client set pins to the sign-in that *built* it (`pinToSession`) — a set the caller still
|
|
1380
|
+
* holds must not ride the session that replaced it;
|
|
1381
|
+
* 2. `api.auth` pins to the sign-in the request *started* on, because its store is keyed on
|
|
1382
|
+
* `baseUrl` alone: it is built once, while anonymous, so a build-time pin would freeze at that
|
|
1383
|
+
* epoch and refuse every authenticated call.
|
|
1384
|
+
* - The guard covers every credential read, not only the wire request, so it wraps the credential
|
|
1385
|
+
* rather than sitting beside it. The 401 path rotates the token by calling the credential
|
|
1386
|
+
* directly: a straggler from a dead session would otherwise spend the *live* session's
|
|
1387
|
+
* single-use refresh token, and sign that session out if the rotation itself came back 401.
|
|
1388
|
+
* - `expiresSession` decides whether a 401 that survives a rotation means the session is dead.
|
|
1389
|
+
* True for this session's own realms; false where the 401 may be about the project instead of
|
|
1390
|
+
* the credential (see `forProject`).
|
|
1391
|
+
* - `inner` is for middleware that **re-invokes `next`** — a retry. Composed outside the pin it
|
|
1392
|
+
* would re-enter it per attempt, and with a per-request `epochFor` each attempt would re-pin to
|
|
1393
|
+
* whoever is signed in by then: a 503 backoff is exactly long enough for a sign-out to land, and
|
|
1394
|
+
* the retry then goes out as the next user. Inside, one epoch covers every attempt and each
|
|
1395
|
+
* attempt still passes the guard. Anything new that retries belongs here, not in the array.
|
|
1396
|
+
*/
|
|
1397
|
+
const createPinnedAuthMiddleware = (epochFor, { expiresSession = true, inner = [] } = {}) => {
|
|
1398
|
+
return (next) => (request) => {
|
|
1399
|
+
const assertSameSession = sessionGuard(epochFor());
|
|
1400
|
+
const pinnedCredential = {
|
|
1401
|
+
...credential,
|
|
1402
|
+
getAccessToken: async (options) => {
|
|
1403
|
+
assertSameSession();
|
|
1404
|
+
return credential.getAccessToken(options);
|
|
1405
|
+
},
|
|
1406
|
+
notifyExpired: expiresSession ? credential.notifyExpired : () => {}
|
|
1407
|
+
};
|
|
1408
|
+
const guarded = (wire) => (repeated) => {
|
|
1409
|
+
assertSameSession();
|
|
1410
|
+
return wire(repeated);
|
|
1411
|
+
};
|
|
1412
|
+
const chain = inner.reduceRight((acc, middleware) => middleware(acc), guarded(next));
|
|
1413
|
+
return createBearerAuthMiddleware(pinnedCredential)(chain)(request);
|
|
1414
|
+
};
|
|
1415
|
+
};
|
|
1416
|
+
/**
|
|
1417
|
+
* Pin something long-lived to the sign-in live right now.
|
|
1418
|
+
*
|
|
1419
|
+
* - `assertSameSession` is for whatever no middleware chain covers: a bootstrap whose every
|
|
1420
|
+
* request passed the guard before the sign-out resolves anyway and must not be handed back, and
|
|
1421
|
+
* `getAuthHeaders`, which emits the credential by hand.
|
|
1422
|
+
*/
|
|
1423
|
+
const pinToSession = (options) => {
|
|
1424
|
+
const epoch = config.getEpoch();
|
|
1425
|
+
return {
|
|
1426
|
+
assertSameSession: sessionGuard(epoch),
|
|
1427
|
+
pinnedAuthMiddleware: createPinnedAuthMiddleware(() => epoch, options)
|
|
1428
|
+
};
|
|
1429
|
+
};
|
|
1429
1430
|
const authClient = createDerivedStore({
|
|
1430
1431
|
source: config.store,
|
|
1431
1432
|
dependsOn: (state) => state.baseUrl,
|
|
1432
1433
|
build: (baseUrl) => baseUrl ? createAuthClient({
|
|
1433
1434
|
baseUrl,
|
|
1434
|
-
middlewares: middlewareFor("auth", [
|
|
1435
|
+
middlewares: middlewareFor("auth", [createPinnedAuthMiddleware(config.getEpoch, { inner: [retryContention] })])
|
|
1435
1436
|
}) : null
|
|
1436
1437
|
});
|
|
1437
1438
|
const management = createDerivedStore({
|
|
@@ -1443,7 +1444,7 @@ const createKeboola = (options = {}) => {
|
|
|
1443
1444
|
type: "bearer",
|
|
1444
1445
|
token: ""
|
|
1445
1446
|
},
|
|
1446
|
-
middlewares: middlewareFor("management", [
|
|
1447
|
+
middlewares: middlewareFor("management", [pinToSession().pinnedAuthMiddleware])
|
|
1447
1448
|
}) : null
|
|
1448
1449
|
});
|
|
1449
1450
|
const projectClientsAsync = createDerivedAsyncStore({
|
|
@@ -1455,13 +1456,33 @@ const createKeboola = (options = {}) => {
|
|
|
1455
1456
|
build: ({ baseUrl, projectId }) => {
|
|
1456
1457
|
return createProjectClients$1({
|
|
1457
1458
|
baseUrl,
|
|
1458
|
-
authMiddleware,
|
|
1459
|
+
authMiddleware: pinToSession().pinnedAuthMiddleware,
|
|
1459
1460
|
projectId,
|
|
1460
1461
|
middlewareFor,
|
|
1461
1462
|
clientServiceUrls: options.clientServiceUrls
|
|
1462
1463
|
});
|
|
1463
1464
|
}
|
|
1464
1465
|
});
|
|
1466
|
+
const forProject = async (projectId) => {
|
|
1467
|
+
const state = config.store.get();
|
|
1468
|
+
if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1469
|
+
const cached = extraProjects.get(projectId);
|
|
1470
|
+
if (cached) return cached();
|
|
1471
|
+
const { assertSameSession, pinnedAuthMiddleware } = pinToSession({ expiresSession: false });
|
|
1472
|
+
const build = lazy(async () => {
|
|
1473
|
+
const clients = await createProjectClients$1({
|
|
1474
|
+
baseUrl: state.baseUrl,
|
|
1475
|
+
authMiddleware: pinnedAuthMiddleware,
|
|
1476
|
+
projectId,
|
|
1477
|
+
middlewareFor,
|
|
1478
|
+
clientServiceUrls: options.clientServiceUrls
|
|
1479
|
+
});
|
|
1480
|
+
assertSameSession();
|
|
1481
|
+
return clients;
|
|
1482
|
+
});
|
|
1483
|
+
extraProjects.set(projectId, build);
|
|
1484
|
+
return build();
|
|
1485
|
+
};
|
|
1465
1486
|
if (options.baseUrl) config.setBaseUrl(options.baseUrl);
|
|
1466
1487
|
config.store.subscribe((state) => {
|
|
1467
1488
|
if (state.status === "anonymous") return;
|
|
@@ -1495,6 +1516,19 @@ const createKeboola = (options = {}) => {
|
|
|
1495
1516
|
* re-entering the project. Use `reset` to sign out instead.
|
|
1496
1517
|
*/
|
|
1497
1518
|
clearProject: config.clearProjectId,
|
|
1519
|
+
/**
|
|
1520
|
+
* The clients for one project, off this session — for reaching a second project without leaving
|
|
1521
|
+
* the first.
|
|
1522
|
+
*
|
|
1523
|
+
* - `setProjectAsync` *moves* the session (and `api`) to another project; this *adds* one. The
|
|
1524
|
+
* returned set is the caller's to hold and never appears on `api`.
|
|
1525
|
+
* - Every set shares this session's auth middleware, so one rotation serves all of them. A second
|
|
1526
|
+
* `createKeboola()` does not: both hold the same single-use refresh token, and the first to
|
|
1527
|
+
* rotate invalidates the other's, whose next refresh 401s and signs it out.
|
|
1528
|
+
* - Independent of the scope, including for the scoped project itself — asking for that one
|
|
1529
|
+
* builds a second set with its own `liveProject`, so prefer `api.*` there.
|
|
1530
|
+
*/
|
|
1531
|
+
forProject,
|
|
1498
1532
|
reset: signOut,
|
|
1499
1533
|
/**
|
|
1500
1534
|
* Dev/test only: mark the current access token as expired so the bearer credential rotates it on
|
|
@@ -1502,6 +1536,35 @@ const createKeboola = (options = {}) => {
|
|
|
1502
1536
|
* the rotation immediately and observe the new credential.
|
|
1503
1537
|
*/
|
|
1504
1538
|
debugForceRefresh: config.forceExpire,
|
|
1539
|
+
/**
|
|
1540
|
+
* The headers that authorize one off-client request, resolved fresh each call.
|
|
1541
|
+
*
|
|
1542
|
+
* - For a transport this package does not own — the chat SSE stream, whose `fetch` the AI SDK
|
|
1543
|
+
* holds. Anything with a service client on `api` should use that instead.
|
|
1544
|
+
* - Returns the assembled bag, never the bare token: no caller handles the credential as a
|
|
1545
|
+
* string, and `X-KBC-ProjectId` is composed here rather than in every consuming app.
|
|
1546
|
+
* - Resolved per call, through the credential — so a near-expiry token rotates and a revoked
|
|
1547
|
+
* one is never re-sent. A snapshot held by the caller would do neither.
|
|
1548
|
+
* - Throws rather than emitting a half-formed `Bearer null`: an unauthenticated or unscoped
|
|
1549
|
+
* session has nothing to authorize with.
|
|
1550
|
+
* - Pinned to the sign-in it was called on, like every client here. This is the one
|
|
1551
|
+
* credential-emitting surface with no middleware chain for the guard to sit in, so the check
|
|
1552
|
+
* is written out around the `await` that rotates the token.
|
|
1553
|
+
* - The scope is re-read after that `await`, not carried across it. The epoch the pin compares
|
|
1554
|
+
* moves on a sign-in and a sign-out only, so a project switch mid-rotation is invisible to it.
|
|
1555
|
+
*/
|
|
1556
|
+
getAuthHeaders: async () => {
|
|
1557
|
+
const { assertSameSession } = pinToSession();
|
|
1558
|
+
requireScopedProject();
|
|
1559
|
+
const accessToken = await credential.getAccessToken();
|
|
1560
|
+
assertSameSession();
|
|
1561
|
+
const projectId = requireScopedProject();
|
|
1562
|
+
assert$1(accessToken, KeboolaErrorType.NotAuthenticated);
|
|
1563
|
+
return {
|
|
1564
|
+
[HttpHeader.AUTHORIZATION]: `Bearer ${accessToken}`,
|
|
1565
|
+
[KeboolaHttpHeader.PROJECT_ID]: String(projectId)
|
|
1566
|
+
};
|
|
1567
|
+
},
|
|
1505
1568
|
restore: async () => {
|
|
1506
1569
|
const persisted = persistor.hydrate();
|
|
1507
1570
|
if (!persisted.refreshToken || !persisted.baseUrl) return { status: "empty" };
|
|
@@ -1513,8 +1576,10 @@ const createKeboola = (options = {}) => {
|
|
|
1513
1576
|
if (!configured) config.setBaseUrl(persisted.baseUrl);
|
|
1514
1577
|
const client = authClientBare.get();
|
|
1515
1578
|
assert$1(client, KeboolaErrorType.NotReady);
|
|
1579
|
+
const startedOn = config.getEpoch();
|
|
1516
1580
|
try {
|
|
1517
1581
|
const refreshed = await client.token.refresh(persisted.refreshToken);
|
|
1582
|
+
if (config.getEpoch() !== startedOn) return { status: "empty" };
|
|
1518
1583
|
config.authenticate(refreshed);
|
|
1519
1584
|
if (persisted.projectId !== null) {
|
|
1520
1585
|
config.setProjectId(persisted.projectId);
|
|
@@ -1522,6 +1587,7 @@ const createKeboola = (options = {}) => {
|
|
|
1522
1587
|
}
|
|
1523
1588
|
return { status: "restored" };
|
|
1524
1589
|
} catch (err) {
|
|
1590
|
+
if (config.getEpoch() !== startedOn) return { status: "empty" };
|
|
1525
1591
|
if (isUnauthorized(err)) {
|
|
1526
1592
|
persistor.clear();
|
|
1527
1593
|
return { status: "expired" };
|
|
@@ -1758,6 +1824,6 @@ const createLegacyKeboola = (options = {}) => {
|
|
|
1758
1824
|
};
|
|
1759
1825
|
};
|
|
1760
1826
|
//#endregion
|
|
1761
|
-
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 };
|
|
1827
|
+
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, isTimeoutError, isValidationError, jobStatus, keboolaUID, lazy, parseLogLines, parseOrThrow, poll, poller, schemaGuidedMerge, series, shallowEqual };
|
|
1762
1828
|
|
|
1763
1829
|
//# sourceMappingURL=index.js.map
|