@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.cjs
CHANGED
|
@@ -1,52 +1,51 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-VH7oDXx4.cjs");
|
|
3
3
|
const require_project = require("./project-BvFi19K_.cjs");
|
|
4
|
-
const require_jobStatus = require("./jobStatus-
|
|
5
|
-
const require_queue = require("./queue-
|
|
4
|
+
const require_jobStatus = require("./jobStatus-0_Y3Sr4i.cjs");
|
|
5
|
+
const require_queue = require("./queue-D1_TCe0z.cjs");
|
|
6
6
|
const require_concurrent = require("./concurrent-tbiIa0UL.cjs");
|
|
7
7
|
const require_dedupe = require("./dedupe-CiskLkGR.cjs");
|
|
8
|
-
const
|
|
9
|
-
const require_storage = require("./storage-
|
|
8
|
+
const require_store = require("./store-xS-Cu_VS.cjs");
|
|
9
|
+
const require_storage = require("./storage-DexWot8H.cjs");
|
|
10
10
|
const require_tag = require("./tag-CsoOZWB_.cjs");
|
|
11
11
|
const require_generateUUID = require("./generateUUID-C6qKBPIv.cjs");
|
|
12
12
|
const require_isPlainObject = require("./isPlainObject-BB3iy87C.cjs");
|
|
13
|
-
const require_configurations = require("./configurations-
|
|
13
|
+
const require_configurations = require("./configurations-Ck-mNB_E.cjs");
|
|
14
14
|
const require_UserError = require("./UserError-CSGO1qII.cjs");
|
|
15
|
-
const require_createFetchClient = require("./createFetchClient-
|
|
16
|
-
const require_validateConnectionStatus = require("./validateConnectionStatus-
|
|
17
|
-
const require_ManagementClientAuthError = require("./ManagementClientAuthError-
|
|
15
|
+
const require_createFetchClient = require("./createFetchClient-DvZvD31l.cjs");
|
|
16
|
+
const require_validateConnectionStatus = require("./validateConnectionStatus-24zqIQ0p.cjs");
|
|
17
|
+
const require_ManagementClientAuthError = require("./ManagementClientAuthError-DqeXL8nv.cjs");
|
|
18
18
|
const require_QueryJobTimeoutError = require("./QueryJobTimeoutError-CVNPdCWX.cjs");
|
|
19
19
|
const require_SyncActionError = require("./SyncActionError-BG0zwchi.cjs");
|
|
20
20
|
const require_ValidationError = require("./ValidationError-h5qvwahi.cjs");
|
|
21
|
-
const require_createGenericFetchClient = require("./createGenericFetchClient-
|
|
22
|
-
const require_import = require("./import-
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const require_auth = require("./auth-DmgTH0uY.cjs");
|
|
27
|
-
const require_constants = require("./constants-CkAVvuUq.cjs");
|
|
21
|
+
const require_createGenericFetchClient = require("./createGenericFetchClient-qfCZlCTv.cjs");
|
|
22
|
+
const require_import = require("./import-DJilJ6tq.cjs");
|
|
23
|
+
const require_authClient = require("./authClient-IwQ9Ti0J.cjs");
|
|
24
|
+
const require_management = require("./management-DGfgKsaA.cjs");
|
|
25
|
+
const require_constants = require("./constants-lIfSdTzS.cjs");
|
|
28
26
|
const require_storageTable = require("./storageTable-C9crh4Ef.cjs");
|
|
29
27
|
const require_sdk_semanticLayer_index = require("./sdk/semanticLayer/index.cjs");
|
|
30
28
|
const require_sdk_storage_index = require("./sdk/storage/index.cjs");
|
|
31
29
|
const require_sdk_vault_index = require("./sdk/vault/index.cjs");
|
|
32
30
|
const require_ai_index = require("./ai/index.cjs");
|
|
33
|
-
const require_appLogs = require("./appLogs-
|
|
31
|
+
const require_appLogs = require("./appLogs-D8K0VeNM.cjs");
|
|
34
32
|
const require_apps_index = require("./apps/index.cjs");
|
|
35
33
|
const require_chat_index = require("./chat/index.cjs");
|
|
36
|
-
const require_dataScience = require("./dataScience-
|
|
34
|
+
const require_dataScience = require("./dataScience-BPW993AG.cjs");
|
|
37
35
|
const require_editor_index = require("./editor/index.cjs");
|
|
38
36
|
const require_encryption_index = require("./encryption/index.cjs");
|
|
39
|
-
const
|
|
37
|
+
const require_kaiAgent = require("./kaiAgent-CMVub6Sc.cjs");
|
|
38
|
+
const require_metastore = require("./metastore-DksEte8P.cjs");
|
|
40
39
|
const require_notifications_index = require("./notifications/index.cjs");
|
|
41
|
-
const require_oauth = require("./oauth-
|
|
40
|
+
const require_oauth = require("./oauth-DFsI1TE5.cjs");
|
|
42
41
|
const require_omnisearch_index = require("./omnisearch/index.cjs");
|
|
43
|
-
const require_queryService = require("./queryService
|
|
42
|
+
const require_queryService = require("./queryService--t_W9PSJ.cjs");
|
|
44
43
|
const require_scheduler_index = require("./scheduler/index.cjs");
|
|
45
44
|
const require_stream_index = require("./stream/index.cjs");
|
|
46
|
-
const require_syncActions = require("./syncActions-
|
|
47
|
-
const require_telemetry = require("./telemetry-
|
|
45
|
+
const require_syncActions = require("./syncActions-DQq_A9v6.cjs");
|
|
46
|
+
const require_telemetry = require("./telemetry-CAu1Qt7B.cjs");
|
|
48
47
|
const require_vault_index = require("./vault/index.cjs");
|
|
49
|
-
const require_credential = require("./credential-D-
|
|
48
|
+
const require_credential = require("./credential-D-X5QQrM.cjs");
|
|
50
49
|
const require_sdk_queryService_index = require("./sdk/queryService/index.cjs");
|
|
51
50
|
let zod = require("zod");
|
|
52
51
|
zod = require_rolldown_runtime.__toESM(zod, 1);
|
|
@@ -95,11 +94,116 @@ const coalesce = (task) => {
|
|
|
95
94
|
};
|
|
96
95
|
};
|
|
97
96
|
//#endregion
|
|
97
|
+
//#region src/utils/store/derivedStore.ts
|
|
98
|
+
const isPlainObjectOrArray = (value) => {
|
|
99
|
+
if (Array.isArray(value)) return true;
|
|
100
|
+
const proto = Object.getPrototypeOf(value);
|
|
101
|
+
return proto === Object.prototype || proto === null;
|
|
102
|
+
};
|
|
103
|
+
const shallowEqual = (a, b) => {
|
|
104
|
+
if (Object.is(a, b)) return true;
|
|
105
|
+
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) return false;
|
|
106
|
+
if (!isPlainObjectOrArray(a) || !isPlainObjectOrArray(b)) return false;
|
|
107
|
+
const aKeys = Object.keys(a);
|
|
108
|
+
const bKeys = Object.keys(b);
|
|
109
|
+
return aKeys.length === bKeys.length && aKeys.every((key) => Object.is(a[key], b[key]));
|
|
110
|
+
};
|
|
111
|
+
const createDerivedStore = ({ source, dependsOn, build, keyEquals = shallowEqual }) => {
|
|
112
|
+
let key = dependsOn(source.get());
|
|
113
|
+
const store = require_store.createStore(build(key));
|
|
114
|
+
const unsubscribe = source.subscribe((state) => {
|
|
115
|
+
const next = dependsOn(state);
|
|
116
|
+
if (keyEquals(key, next)) return;
|
|
117
|
+
key = next;
|
|
118
|
+
store.set(build(next));
|
|
119
|
+
});
|
|
120
|
+
const get = store.get;
|
|
121
|
+
const subscribe = store.subscribe;
|
|
122
|
+
const dispose = () => {
|
|
123
|
+
unsubscribe();
|
|
124
|
+
store.dispose();
|
|
125
|
+
};
|
|
126
|
+
return {
|
|
127
|
+
get,
|
|
128
|
+
subscribe,
|
|
129
|
+
dispose
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
//#endregion
|
|
133
|
+
//#region src/utils/store/derivedAsyncStore.ts
|
|
134
|
+
const createDerivedAsyncStore = ({ source, dependsOn, build, keyEquals = shallowEqual }) => {
|
|
135
|
+
const store = require_store.createStore({ state: "idle" });
|
|
136
|
+
let currentKey = null;
|
|
137
|
+
let generation = 0;
|
|
138
|
+
let controller = null;
|
|
139
|
+
const run = (key) => {
|
|
140
|
+
controller?.abort();
|
|
141
|
+
controller = new AbortController();
|
|
142
|
+
const runGeneration = ++generation;
|
|
143
|
+
store.set({ state: "pending" });
|
|
144
|
+
build(key, controller.signal).then((value) => {
|
|
145
|
+
if (runGeneration === generation) store.set({
|
|
146
|
+
state: "ready",
|
|
147
|
+
value
|
|
148
|
+
});
|
|
149
|
+
}, (error) => {
|
|
150
|
+
if (runGeneration === generation) store.set({
|
|
151
|
+
state: "errored",
|
|
152
|
+
error
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
const sync = (state) => {
|
|
157
|
+
const next = dependsOn(state);
|
|
158
|
+
if (next === null) {
|
|
159
|
+
if (currentKey === null) return;
|
|
160
|
+
controller?.abort();
|
|
161
|
+
controller = null;
|
|
162
|
+
generation += 1;
|
|
163
|
+
currentKey = null;
|
|
164
|
+
store.set({ state: "idle" });
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (currentKey !== null && keyEquals(currentKey, next)) return;
|
|
168
|
+
currentKey = next;
|
|
169
|
+
run(next);
|
|
170
|
+
};
|
|
171
|
+
sync(source.get());
|
|
172
|
+
const unsubscribe = source.subscribe(sync);
|
|
173
|
+
const get = store.get;
|
|
174
|
+
const subscribe = store.subscribe;
|
|
175
|
+
const dispose = () => {
|
|
176
|
+
controller?.abort();
|
|
177
|
+
unsubscribe();
|
|
178
|
+
store.dispose();
|
|
179
|
+
};
|
|
180
|
+
const readable = {
|
|
181
|
+
get,
|
|
182
|
+
subscribe,
|
|
183
|
+
dispose
|
|
184
|
+
};
|
|
185
|
+
const settled = () => new Promise((resolve) => {
|
|
186
|
+
let unsubscribeSettled = () => {};
|
|
187
|
+
const check = (state) => {
|
|
188
|
+
if (state.state === "ready" || state.state === "errored") {
|
|
189
|
+
unsubscribeSettled();
|
|
190
|
+
resolve(state);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
unsubscribeSettled = store.subscribe(check);
|
|
194
|
+
check(store.get());
|
|
195
|
+
});
|
|
196
|
+
return {
|
|
197
|
+
store: readable,
|
|
198
|
+
settled
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
//#endregion
|
|
98
202
|
//#region src/utils/async/poll/registry.ts
|
|
99
203
|
const DEFAULT_LIMIT = 50;
|
|
100
204
|
const isFinished = ({ snapshot }) => snapshot.state !== "idle" && snapshot.state !== "polling";
|
|
101
205
|
const createPollRegistry = ({ limit = DEFAULT_LIMIT } = {}) => {
|
|
102
|
-
const entries =
|
|
206
|
+
const entries = require_store.createStore([]);
|
|
103
207
|
const unsubscribes = /* @__PURE__ */ new Map();
|
|
104
208
|
const maxEntries = require_jobStatus.clamp(require_jobStatus.finiteOr(limit, DEFAULT_LIMIT), 1);
|
|
105
209
|
let nextKey = 1;
|
|
@@ -289,7 +393,7 @@ const createProjectRefreshMiddleware = (shouldRefresh, requestRefresh) => (next)
|
|
|
289
393
|
* token-mutating request or an explicit re-scope. Its `middleware` drives the auto re-verify.
|
|
290
394
|
*/
|
|
291
395
|
const createLiveProject = ({ initialToken, verify }) => {
|
|
292
|
-
const store =
|
|
396
|
+
const store = require_store.createStore(require_project.createProject({ sapiToken: initialToken }));
|
|
293
397
|
const refresh = coalesce(async () => store.set(require_project.createProject({ sapiToken: await verify() })));
|
|
294
398
|
const middleware = createProjectRefreshMiddleware(isStorageTokenMutatingRequest, refresh);
|
|
295
399
|
return {
|
|
@@ -603,8 +707,9 @@ const stamp = (tokens) => ({
|
|
|
603
707
|
issuedAt: Date.now()
|
|
604
708
|
});
|
|
605
709
|
const createConfig$1 = (initial = INITIAL) => {
|
|
606
|
-
const store =
|
|
710
|
+
const store = require_store.createStore(initial);
|
|
607
711
|
let expiredNotified = false;
|
|
712
|
+
let epoch = 0;
|
|
608
713
|
const setBaseUrl = (baseUrl) => {
|
|
609
714
|
if (store.get().status !== "anonymous") throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
|
|
610
715
|
store.set({
|
|
@@ -617,6 +722,7 @@ const createConfig$1 = (initial = INITIAL) => {
|
|
|
617
722
|
if (state.status !== "anonymous") throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
|
|
618
723
|
if (!state.baseUrl) throw new KeboolaError(KeboolaErrorType.Unconfigured);
|
|
619
724
|
expiredNotified = false;
|
|
725
|
+
epoch += 1;
|
|
620
726
|
store.set({
|
|
621
727
|
status: "authenticated",
|
|
622
728
|
baseUrl: state.baseUrl,
|
|
@@ -650,6 +756,7 @@ const createConfig$1 = (initial = INITIAL) => {
|
|
|
650
756
|
};
|
|
651
757
|
/** Drop the credential (sign out); keeps the configured baseUrl. */
|
|
652
758
|
const reset = () => {
|
|
759
|
+
epoch += 1;
|
|
653
760
|
store.set({
|
|
654
761
|
status: "anonymous",
|
|
655
762
|
baseUrl: store.get().baseUrl
|
|
@@ -691,6 +798,15 @@ const createConfig$1 = (initial = INITIAL) => {
|
|
|
691
798
|
};
|
|
692
799
|
const getBaseUrl = () => store.get().baseUrl;
|
|
693
800
|
/**
|
|
801
|
+
* Which sign-in this is — a counter, bumped by `authenticate` and `reset`.
|
|
802
|
+
*
|
|
803
|
+
* - For anything long-lived that must not outlive the credential it was built against: capture it,
|
|
804
|
+
* compare it later. A rotation does not move it; only a new session or a sign-out does.
|
|
805
|
+
* - Distinct from `notifyExpired`'s latch, which answers "report this death once" rather than
|
|
806
|
+
* "which session are we in".
|
|
807
|
+
*/
|
|
808
|
+
const getEpoch = () => epoch;
|
|
809
|
+
/**
|
|
694
810
|
* Session-expiry latch (fire-once):
|
|
695
811
|
* - why: concurrent 401s all report expiry, but the app must sign out once; and the credential /
|
|
696
812
|
* auth middleware are long-lived singletons, so the latch can't live in them — it must reset
|
|
@@ -719,6 +835,7 @@ const createConfig$1 = (initial = INITIAL) => {
|
|
|
719
835
|
forceExpire,
|
|
720
836
|
requireCredential,
|
|
721
837
|
getBaseUrl,
|
|
838
|
+
getEpoch,
|
|
722
839
|
notifyExpired,
|
|
723
840
|
debug
|
|
724
841
|
};
|
|
@@ -859,216 +976,6 @@ const createVariablesSdk = ({ storageClient }) => {
|
|
|
859
976
|
};
|
|
860
977
|
};
|
|
861
978
|
//#endregion
|
|
862
|
-
//#region src/clients/kaiAgent/kaiAgentClient.ts
|
|
863
|
-
const agentSettingsSchema = zod.z.object({
|
|
864
|
-
projectId: zod.z.string(),
|
|
865
|
-
customInstructions: zod.z.string().nullable(),
|
|
866
|
-
createdAt: zod.z.string(),
|
|
867
|
-
updatedAt: zod.z.string()
|
|
868
|
-
});
|
|
869
|
-
const toolPermissionValueSchema = zod.z.enum([
|
|
870
|
-
"always_allow",
|
|
871
|
-
"always_ask",
|
|
872
|
-
"blocked"
|
|
873
|
-
]);
|
|
874
|
-
const userAgentSettingsSchema = zod.z.object({
|
|
875
|
-
projectId: zod.z.string(),
|
|
876
|
-
userId: zod.z.string(),
|
|
877
|
-
customInstructions: zod.z.string().nullable(),
|
|
878
|
-
toolPermissions: zod.z.record(zod.z.string(), toolPermissionValueSchema).nullable(),
|
|
879
|
-
createdAt: zod.z.string(),
|
|
880
|
-
updatedAt: zod.z.string()
|
|
881
|
-
});
|
|
882
|
-
const toolInfoSchema = zod.z.object({
|
|
883
|
-
name: zod.z.string(),
|
|
884
|
-
description: zod.z.string(),
|
|
885
|
-
readOnly: zod.z.boolean()
|
|
886
|
-
});
|
|
887
|
-
const toolsListResponseSchema = zod.z.object({ tools: zod.z.array(toolInfoSchema) });
|
|
888
|
-
const skillInfoSchema = zod.z.object({
|
|
889
|
-
name: zod.z.string(),
|
|
890
|
-
description: zod.z.string().nullable(),
|
|
891
|
-
source: zod.z.enum([
|
|
892
|
-
"first-party",
|
|
893
|
-
"vendored",
|
|
894
|
-
"project"
|
|
895
|
-
])
|
|
896
|
-
});
|
|
897
|
-
const builtInCommandSchema = zod.z.object({
|
|
898
|
-
name: zod.z.string(),
|
|
899
|
-
description: zod.z.string()
|
|
900
|
-
});
|
|
901
|
-
const skillsListResponseSchema = zod.z.object({
|
|
902
|
-
skills: zod.z.array(skillInfoSchema),
|
|
903
|
-
commands: zod.z.array(builtInCommandSchema)
|
|
904
|
-
});
|
|
905
|
-
const sandboxFileEntrySchema = zod.z.object({
|
|
906
|
-
name: zod.z.string(),
|
|
907
|
-
path: zod.z.string(),
|
|
908
|
-
type: zod.z.enum(["file", "dir"]),
|
|
909
|
-
size: zod.z.number().int().nonnegative().optional()
|
|
910
|
-
});
|
|
911
|
-
const sandboxFileListingSchema = zod.z.object({ entries: zod.z.array(sandboxFileEntrySchema) });
|
|
912
|
-
const sandboxFileContentSchema = zod.z.object({
|
|
913
|
-
content: zod.z.string(),
|
|
914
|
-
encoding: zod.z.enum(["utf-8", "binary"]),
|
|
915
|
-
truncated: zod.z.boolean(),
|
|
916
|
-
size: zod.z.number().int().nonnegative()
|
|
917
|
-
});
|
|
918
|
-
const sandboxGitBranchSchema = zod.z.object({ branch: zod.z.string().nullable() });
|
|
919
|
-
const votesResponseSchema = zod.z.array(zod.z.object({
|
|
920
|
-
chatId: zod.z.string(),
|
|
921
|
-
messageId: zod.z.string(),
|
|
922
|
-
isUpvoted: zod.z.boolean()
|
|
923
|
-
}));
|
|
924
|
-
const createKaiAgentClient = ({ baseUrl, middlewares, auth }) => {
|
|
925
|
-
const clientOptions = {
|
|
926
|
-
baseUrl,
|
|
927
|
-
middlewares,
|
|
928
|
-
headers: require_auth.createAuthHeaders(auth)
|
|
929
|
-
};
|
|
930
|
-
const client = require_createOpenapiFetchClient.createOpenapiFetchClient(clientOptions);
|
|
931
|
-
const genericClient = require_createGenericFetchClient.createGenericFetchClient(clientOptions);
|
|
932
|
-
const getHistory = async (params) => {
|
|
933
|
-
const { data } = await client.get("/api/history", { query: params });
|
|
934
|
-
return data;
|
|
935
|
-
};
|
|
936
|
-
const getChat = async (chatId, signal) => {
|
|
937
|
-
const { data } = await client.get("/api/chat/{id}", { path: { id: chatId } }, { signal });
|
|
938
|
-
return data;
|
|
939
|
-
};
|
|
940
|
-
const deleteChat = async (chatId) => {
|
|
941
|
-
const { data } = await client.delete("/api/chat", { query: { id: chatId } });
|
|
942
|
-
return data;
|
|
943
|
-
};
|
|
944
|
-
const createChat = async (request) => {
|
|
945
|
-
const { response } = await client.post("/api/chat", { body: request });
|
|
946
|
-
return response;
|
|
947
|
-
};
|
|
948
|
-
const getVotes = async (chatId) => {
|
|
949
|
-
const { data } = await client.get("/api/vote", { query: { chatId } });
|
|
950
|
-
const result = votesResponseSchema.safeParse(data);
|
|
951
|
-
if (!result.success) throw new Error("Invalid votes response format");
|
|
952
|
-
return result.data;
|
|
953
|
-
};
|
|
954
|
-
const submitVote = async (params) => {
|
|
955
|
-
await client.patch("/api/vote", { body: params });
|
|
956
|
-
};
|
|
957
|
-
const getUsage = async (signal) => {
|
|
958
|
-
const { data } = await client.get("/api/usage", {}, { signal });
|
|
959
|
-
return data;
|
|
960
|
-
};
|
|
961
|
-
const approveToolCall = async (chatId, body) => {
|
|
962
|
-
await client.post("/api/chat/{id}/approval", {
|
|
963
|
-
path: { id: chatId },
|
|
964
|
-
body
|
|
965
|
-
});
|
|
966
|
-
};
|
|
967
|
-
const submitToolOutput = async (chatId, body) => {
|
|
968
|
-
await client.post("/api/chat/{id}/ui-tool-result", {
|
|
969
|
-
path: { id: chatId },
|
|
970
|
-
body
|
|
971
|
-
});
|
|
972
|
-
};
|
|
973
|
-
const stopChat = async (chatId) => {
|
|
974
|
-
const { data } = await client.post("/api/chat/{id}/stop", { path: { id: chatId } });
|
|
975
|
-
return data;
|
|
976
|
-
};
|
|
977
|
-
const getSuggestions = async (request, signal) => {
|
|
978
|
-
const { data } = await client.post("/api/suggestions", { body: request }, { signal });
|
|
979
|
-
return data;
|
|
980
|
-
};
|
|
981
|
-
const getAgentSettings = async (signal) => {
|
|
982
|
-
const { data } = await genericClient.get("/api/settings", {}, { signal });
|
|
983
|
-
const result = agentSettingsSchema.safeParse(data);
|
|
984
|
-
if (!result.success) throw new Error("Invalid agent settings response format");
|
|
985
|
-
return result.data;
|
|
986
|
-
};
|
|
987
|
-
const updateAgentSettings = async (request, signal) => {
|
|
988
|
-
const { data } = await genericClient.patch("/api/settings", { body: request }, { signal });
|
|
989
|
-
const result = agentSettingsSchema.safeParse(data);
|
|
990
|
-
if (!result.success) throw new Error("Invalid agent settings response format");
|
|
991
|
-
return result.data;
|
|
992
|
-
};
|
|
993
|
-
const getUserAgentSettings = async (signal) => {
|
|
994
|
-
const { data } = await genericClient.get("/api/settings/user", {}, { signal });
|
|
995
|
-
const result = userAgentSettingsSchema.safeParse(data);
|
|
996
|
-
if (!result.success) throw new Error("Invalid user agent settings response format");
|
|
997
|
-
return result.data;
|
|
998
|
-
};
|
|
999
|
-
const updateUserAgentSettings = async (request, signal) => {
|
|
1000
|
-
const { data } = await genericClient.patch("/api/settings/user", { body: request }, { signal });
|
|
1001
|
-
const result = userAgentSettingsSchema.safeParse(data);
|
|
1002
|
-
if (!result.success) throw new Error("Invalid user agent settings response format");
|
|
1003
|
-
return result.data;
|
|
1004
|
-
};
|
|
1005
|
-
const getToolsList = async (signal) => {
|
|
1006
|
-
const { data } = await genericClient.get("/api/settings/tools", {}, { signal });
|
|
1007
|
-
const result = toolsListResponseSchema.safeParse(data);
|
|
1008
|
-
if (!result.success) throw new Error("Invalid tools list response format");
|
|
1009
|
-
return result.data;
|
|
1010
|
-
};
|
|
1011
|
-
const getSkillsList = async (signal) => {
|
|
1012
|
-
const { data } = await genericClient.get("/api/skills", {}, { signal });
|
|
1013
|
-
const result = skillsListResponseSchema.safeParse(data);
|
|
1014
|
-
if (!result.success) throw new Error("Invalid skills list response format");
|
|
1015
|
-
return result.data;
|
|
1016
|
-
};
|
|
1017
|
-
const listSandboxFiles = async (chatId, path, signal) => {
|
|
1018
|
-
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/files`, { query: path ? { path } : void 0 }, { signal });
|
|
1019
|
-
const result = sandboxFileListingSchema.safeParse(data);
|
|
1020
|
-
if (!result.success) throw new Error("Invalid sandbox files response format");
|
|
1021
|
-
return result.data;
|
|
1022
|
-
};
|
|
1023
|
-
const readSandboxFile = async (chatId, path, signal) => {
|
|
1024
|
-
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/file`, { query: { path } }, { signal });
|
|
1025
|
-
const result = sandboxFileContentSchema.safeParse(data);
|
|
1026
|
-
if (!result.success) throw new Error("Invalid sandbox file response format");
|
|
1027
|
-
return result.data;
|
|
1028
|
-
};
|
|
1029
|
-
const downloadSandboxFile = async (chatId, path, signal) => {
|
|
1030
|
-
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/file/download`, { query: { path } }, { signal });
|
|
1031
|
-
if (!(data instanceof Blob)) throw new Error("Invalid sandbox file download response format");
|
|
1032
|
-
return data;
|
|
1033
|
-
};
|
|
1034
|
-
const getSandboxGitBranch = async (chatId, signal) => {
|
|
1035
|
-
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/git-branch`, {}, { signal });
|
|
1036
|
-
const result = sandboxGitBranchSchema.safeParse(data);
|
|
1037
|
-
if (!result.success) throw new Error("Invalid sandbox git-branch response format");
|
|
1038
|
-
return result.data;
|
|
1039
|
-
};
|
|
1040
|
-
const chatStreamUrl = clientOptions.baseUrl + "/api/chat";
|
|
1041
|
-
const healthCheck = async (signal) => {
|
|
1042
|
-
const { data } = await genericClient.get("/health", {}, { signal });
|
|
1043
|
-
return data;
|
|
1044
|
-
};
|
|
1045
|
-
return {
|
|
1046
|
-
healthCheck,
|
|
1047
|
-
getHistory,
|
|
1048
|
-
getChat,
|
|
1049
|
-
deleteChat,
|
|
1050
|
-
createChat,
|
|
1051
|
-
getVotes,
|
|
1052
|
-
submitVote,
|
|
1053
|
-
getUsage,
|
|
1054
|
-
approveToolCall,
|
|
1055
|
-
submitToolOutput,
|
|
1056
|
-
stopChat,
|
|
1057
|
-
getSuggestions,
|
|
1058
|
-
getAgentSettings,
|
|
1059
|
-
updateAgentSettings,
|
|
1060
|
-
getUserAgentSettings,
|
|
1061
|
-
updateUserAgentSettings,
|
|
1062
|
-
getToolsList,
|
|
1063
|
-
getSkillsList,
|
|
1064
|
-
listSandboxFiles,
|
|
1065
|
-
readSandboxFile,
|
|
1066
|
-
downloadSandboxFile,
|
|
1067
|
-
getSandboxGitBranch,
|
|
1068
|
-
chatStreamUrl
|
|
1069
|
-
};
|
|
1070
|
-
};
|
|
1071
|
-
//#endregion
|
|
1072
979
|
//#region src/keboola/createServiceClients.ts
|
|
1073
980
|
const createServiceClients = ({ baseUrl, auth, getServiceBaseUrl, middlewareFor, attachTokenMiddleware }) => createServiceClientRegistry()({
|
|
1074
981
|
getServiceBaseUrl,
|
|
@@ -1182,7 +1089,7 @@ const createServiceClients = ({ baseUrl, auth, getServiceBaseUrl, middlewareFor,
|
|
|
1182
1089
|
}).add({
|
|
1183
1090
|
serviceId: "kai-agent",
|
|
1184
1091
|
clientName: "kaiAgent",
|
|
1185
|
-
clientFn: (serviceBaseUrl) => createKaiAgentClient({
|
|
1092
|
+
clientFn: (serviceBaseUrl) => require_kaiAgent.createKaiAgentClient({
|
|
1186
1093
|
baseUrl: serviceBaseUrl,
|
|
1187
1094
|
middlewares: middlewareFor("kaiAgent", [attachTokenMiddleware]),
|
|
1188
1095
|
auth
|
|
@@ -1268,7 +1175,7 @@ const createProjectClients$1 = async ({ baseUrl, projectId, authMiddleware, midd
|
|
|
1268
1175
|
initialToken: sapiToken,
|
|
1269
1176
|
verify: () => reader.tokens.verify()
|
|
1270
1177
|
});
|
|
1271
|
-
const storageTableStore =
|
|
1178
|
+
const storageTableStore = createDerivedStore({
|
|
1272
1179
|
source: liveProject.store,
|
|
1273
1180
|
build: require_storageTable.createStorageTable,
|
|
1274
1181
|
dependsOn: (project) => ({
|
|
@@ -1388,7 +1295,7 @@ const createKeboola = (options = {}) => {
|
|
|
1388
1295
|
const config = createConfig$1();
|
|
1389
1296
|
const middlewareFor = createMiddlewareFor(options.middlewares);
|
|
1390
1297
|
const retryContention = createRetryMiddleware({ shouldRetry: (error) => error instanceof require_createFetchClient.ApiError && error.response.status === require_createFetchClient.HttpStatus.SERVICE_UNAVAILABLE });
|
|
1391
|
-
const authClientBare =
|
|
1298
|
+
const authClientBare = createDerivedStore({
|
|
1392
1299
|
source: config.store,
|
|
1393
1300
|
dependsOn: (state) => state.baseUrl,
|
|
1394
1301
|
build: (baseUrl) => baseUrl ? require_authClient.createAuthClient({
|
|
@@ -1399,7 +1306,12 @@ const createKeboola = (options = {}) => {
|
|
|
1399
1306
|
const refresh = async () => {
|
|
1400
1307
|
const client = authClientBare.get();
|
|
1401
1308
|
assert$1(client, KeboolaErrorType.NotReady);
|
|
1402
|
-
const
|
|
1309
|
+
const epoch = config.getEpoch();
|
|
1310
|
+
const refreshed = await client.token.refresh(config.requireCredential().refreshToken).catch((error) => {
|
|
1311
|
+
if (config.getEpoch() !== epoch) throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1312
|
+
throw error;
|
|
1313
|
+
});
|
|
1314
|
+
if (config.getEpoch() !== epoch) throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1403
1315
|
config.applyRefresh(refreshed);
|
|
1404
1316
|
return refreshed.accessToken;
|
|
1405
1317
|
};
|
|
@@ -1415,8 +1327,36 @@ const createKeboola = (options = {}) => {
|
|
|
1415
1327
|
}
|
|
1416
1328
|
};
|
|
1417
1329
|
};
|
|
1330
|
+
/**
|
|
1331
|
+
* The project this session is scoped to, right now.
|
|
1332
|
+
*
|
|
1333
|
+
* - Read at every point that stamps a project, never snapshotted across an `await`: the scope moves
|
|
1334
|
+
* with `setProject`/`clearProject`, and neither ends the session, so it is not in the epoch and
|
|
1335
|
+
* `assertSameSession` cannot see it change.
|
|
1336
|
+
* - `NotReady` rather than `NotAuthenticated` when merely unscoped — the credential is fine, the
|
|
1337
|
+
* project is what is missing. A credential alone does not authorize a project request: kai-agent
|
|
1338
|
+
* reads the project from the header, not the token, and cannot attribute a call that omits it.
|
|
1339
|
+
*/
|
|
1340
|
+
const requireScopedProject = () => {
|
|
1341
|
+
const state = config.store.get();
|
|
1342
|
+
if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1343
|
+
if (state.status !== "scoped") throw new KeboolaError(KeboolaErrorType.NotReady);
|
|
1344
|
+
return state.projectId;
|
|
1345
|
+
};
|
|
1346
|
+
/**
|
|
1347
|
+
* The project client sets `forProject` has handed out, keyed by project id.
|
|
1348
|
+
*
|
|
1349
|
+
* - Not keyed by stack: `setBaseUrl` throws once authenticated and `signOut` empties this, so one
|
|
1350
|
+
* entry can never belong to a different `baseUrl` than the live session.
|
|
1351
|
+
* - A `lazy` per key, not a bare promise: concurrent callers share one bootstrap, later ones replay
|
|
1352
|
+
* the resolved set, and a rejected build clears only its own slot — so a build orphaned by a
|
|
1353
|
+
* sign-out cannot evict the entry that replaced it.
|
|
1354
|
+
*/
|
|
1355
|
+
const extraProjects = /* @__PURE__ */ new Map();
|
|
1418
1356
|
const signOut = () => {
|
|
1419
1357
|
config.reset();
|
|
1358
|
+
credential.abandonRefresh();
|
|
1359
|
+
extraProjects.clear();
|
|
1420
1360
|
persistor.clear();
|
|
1421
1361
|
};
|
|
1422
1362
|
const onSessionExpired = () => {
|
|
@@ -1427,16 +1367,78 @@ const createKeboola = (options = {}) => {
|
|
|
1427
1367
|
getToken,
|
|
1428
1368
|
onSessionExpired
|
|
1429
1369
|
});
|
|
1430
|
-
const
|
|
1431
|
-
|
|
1370
|
+
const sessionGuard = (epoch) => () => {
|
|
1371
|
+
if (config.getEpoch() !== epoch) throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1372
|
+
};
|
|
1373
|
+
/**
|
|
1374
|
+
* The auth middleware, refusing to carry a request across a change of session.
|
|
1375
|
+
*
|
|
1376
|
+
* - The middleware holds no token — it reads the credential live — so anything built on it acts as
|
|
1377
|
+
* whoever is signed in *at request time*, not whoever built it. Rebuilding a store on sign-out
|
|
1378
|
+
* only stops new reads; a request already in flight completes as the next user, still stamped
|
|
1379
|
+
* with the old project. `config`'s epoch moves on `authenticate` and `reset` and never on a
|
|
1380
|
+
* rotation, so it is exactly "which sign-in is this".
|
|
1381
|
+
* - `epochFor` says which sign-in a request answers to, resolved per request:
|
|
1382
|
+
* 1. a client set pins to the sign-in that *built* it (`pinToSession`) — a set the caller still
|
|
1383
|
+
* holds must not ride the session that replaced it;
|
|
1384
|
+
* 2. `api.auth` pins to the sign-in the request *started* on, because its store is keyed on
|
|
1385
|
+
* `baseUrl` alone: it is built once, while anonymous, so a build-time pin would freeze at that
|
|
1386
|
+
* epoch and refuse every authenticated call.
|
|
1387
|
+
* - The guard covers every credential read, not only the wire request, so it wraps the credential
|
|
1388
|
+
* rather than sitting beside it. The 401 path rotates the token by calling the credential
|
|
1389
|
+
* directly: a straggler from a dead session would otherwise spend the *live* session's
|
|
1390
|
+
* single-use refresh token, and sign that session out if the rotation itself came back 401.
|
|
1391
|
+
* - `expiresSession` decides whether a 401 that survives a rotation means the session is dead.
|
|
1392
|
+
* True for this session's own realms; false where the 401 may be about the project instead of
|
|
1393
|
+
* the credential (see `forProject`).
|
|
1394
|
+
* - `inner` is for middleware that **re-invokes `next`** — a retry. Composed outside the pin it
|
|
1395
|
+
* would re-enter it per attempt, and with a per-request `epochFor` each attempt would re-pin to
|
|
1396
|
+
* whoever is signed in by then: a 503 backoff is exactly long enough for a sign-out to land, and
|
|
1397
|
+
* the retry then goes out as the next user. Inside, one epoch covers every attempt and each
|
|
1398
|
+
* attempt still passes the guard. Anything new that retries belongs here, not in the array.
|
|
1399
|
+
*/
|
|
1400
|
+
const createPinnedAuthMiddleware = (epochFor, { expiresSession = true, inner = [] } = {}) => {
|
|
1401
|
+
return (next) => (request) => {
|
|
1402
|
+
const assertSameSession = sessionGuard(epochFor());
|
|
1403
|
+
const pinnedCredential = {
|
|
1404
|
+
...credential,
|
|
1405
|
+
getAccessToken: async (options) => {
|
|
1406
|
+
assertSameSession();
|
|
1407
|
+
return credential.getAccessToken(options);
|
|
1408
|
+
},
|
|
1409
|
+
notifyExpired: expiresSession ? credential.notifyExpired : () => {}
|
|
1410
|
+
};
|
|
1411
|
+
const guarded = (wire) => (repeated) => {
|
|
1412
|
+
assertSameSession();
|
|
1413
|
+
return wire(repeated);
|
|
1414
|
+
};
|
|
1415
|
+
const chain = inner.reduceRight((acc, middleware) => middleware(acc), guarded(next));
|
|
1416
|
+
return createBearerAuthMiddleware(pinnedCredential)(chain)(request);
|
|
1417
|
+
};
|
|
1418
|
+
};
|
|
1419
|
+
/**
|
|
1420
|
+
* Pin something long-lived to the sign-in live right now.
|
|
1421
|
+
*
|
|
1422
|
+
* - `assertSameSession` is for whatever no middleware chain covers: a bootstrap whose every
|
|
1423
|
+
* request passed the guard before the sign-out resolves anyway and must not be handed back, and
|
|
1424
|
+
* `getAuthHeaders`, which emits the credential by hand.
|
|
1425
|
+
*/
|
|
1426
|
+
const pinToSession = (options) => {
|
|
1427
|
+
const epoch = config.getEpoch();
|
|
1428
|
+
return {
|
|
1429
|
+
assertSameSession: sessionGuard(epoch),
|
|
1430
|
+
pinnedAuthMiddleware: createPinnedAuthMiddleware(() => epoch, options)
|
|
1431
|
+
};
|
|
1432
|
+
};
|
|
1433
|
+
const authClient = createDerivedStore({
|
|
1432
1434
|
source: config.store,
|
|
1433
1435
|
dependsOn: (state) => state.baseUrl,
|
|
1434
1436
|
build: (baseUrl) => baseUrl ? require_authClient.createAuthClient({
|
|
1435
1437
|
baseUrl,
|
|
1436
|
-
middlewares: middlewareFor("auth", [
|
|
1438
|
+
middlewares: middlewareFor("auth", [createPinnedAuthMiddleware(config.getEpoch, { inner: [retryContention] })])
|
|
1437
1439
|
}) : null
|
|
1438
1440
|
});
|
|
1439
|
-
const management =
|
|
1441
|
+
const management = createDerivedStore({
|
|
1440
1442
|
source: config.store,
|
|
1441
1443
|
dependsOn: (state) => state.status === "anonymous" ? null : state.baseUrl,
|
|
1442
1444
|
build: (baseUrl) => baseUrl ? require_management.createManagementClient({
|
|
@@ -1445,10 +1447,10 @@ const createKeboola = (options = {}) => {
|
|
|
1445
1447
|
type: "bearer",
|
|
1446
1448
|
token: ""
|
|
1447
1449
|
},
|
|
1448
|
-
middlewares: middlewareFor("management", [
|
|
1450
|
+
middlewares: middlewareFor("management", [pinToSession().pinnedAuthMiddleware])
|
|
1449
1451
|
}) : null
|
|
1450
1452
|
});
|
|
1451
|
-
const projectClientsAsync =
|
|
1453
|
+
const projectClientsAsync = createDerivedAsyncStore({
|
|
1452
1454
|
source: config.store,
|
|
1453
1455
|
dependsOn: (state) => state.status === "scoped" ? {
|
|
1454
1456
|
baseUrl: state.baseUrl,
|
|
@@ -1457,13 +1459,33 @@ const createKeboola = (options = {}) => {
|
|
|
1457
1459
|
build: ({ baseUrl, projectId }) => {
|
|
1458
1460
|
return createProjectClients$1({
|
|
1459
1461
|
baseUrl,
|
|
1460
|
-
authMiddleware,
|
|
1462
|
+
authMiddleware: pinToSession().pinnedAuthMiddleware,
|
|
1461
1463
|
projectId,
|
|
1462
1464
|
middlewareFor,
|
|
1463
1465
|
clientServiceUrls: options.clientServiceUrls
|
|
1464
1466
|
});
|
|
1465
1467
|
}
|
|
1466
1468
|
});
|
|
1469
|
+
const forProject = async (projectId) => {
|
|
1470
|
+
const state = config.store.get();
|
|
1471
|
+
if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
1472
|
+
const cached = extraProjects.get(projectId);
|
|
1473
|
+
if (cached) return cached();
|
|
1474
|
+
const { assertSameSession, pinnedAuthMiddleware } = pinToSession({ expiresSession: false });
|
|
1475
|
+
const build = require_jobStatus.lazy(async () => {
|
|
1476
|
+
const clients = await createProjectClients$1({
|
|
1477
|
+
baseUrl: state.baseUrl,
|
|
1478
|
+
authMiddleware: pinnedAuthMiddleware,
|
|
1479
|
+
projectId,
|
|
1480
|
+
middlewareFor,
|
|
1481
|
+
clientServiceUrls: options.clientServiceUrls
|
|
1482
|
+
});
|
|
1483
|
+
assertSameSession();
|
|
1484
|
+
return clients;
|
|
1485
|
+
});
|
|
1486
|
+
extraProjects.set(projectId, build);
|
|
1487
|
+
return build();
|
|
1488
|
+
};
|
|
1467
1489
|
if (options.baseUrl) config.setBaseUrl(options.baseUrl);
|
|
1468
1490
|
config.store.subscribe((state) => {
|
|
1469
1491
|
if (state.status === "anonymous") return;
|
|
@@ -1497,6 +1519,19 @@ const createKeboola = (options = {}) => {
|
|
|
1497
1519
|
* re-entering the project. Use `reset` to sign out instead.
|
|
1498
1520
|
*/
|
|
1499
1521
|
clearProject: config.clearProjectId,
|
|
1522
|
+
/**
|
|
1523
|
+
* The clients for one project, off this session — for reaching a second project without leaving
|
|
1524
|
+
* the first.
|
|
1525
|
+
*
|
|
1526
|
+
* - `setProjectAsync` *moves* the session (and `api`) to another project; this *adds* one. The
|
|
1527
|
+
* returned set is the caller's to hold and never appears on `api`.
|
|
1528
|
+
* - Every set shares this session's auth middleware, so one rotation serves all of them. A second
|
|
1529
|
+
* `createKeboola()` does not: both hold the same single-use refresh token, and the first to
|
|
1530
|
+
* rotate invalidates the other's, whose next refresh 401s and signs it out.
|
|
1531
|
+
* - Independent of the scope, including for the scoped project itself — asking for that one
|
|
1532
|
+
* builds a second set with its own `liveProject`, so prefer `api.*` there.
|
|
1533
|
+
*/
|
|
1534
|
+
forProject,
|
|
1500
1535
|
reset: signOut,
|
|
1501
1536
|
/**
|
|
1502
1537
|
* Dev/test only: mark the current access token as expired so the bearer credential rotates it on
|
|
@@ -1504,6 +1539,35 @@ const createKeboola = (options = {}) => {
|
|
|
1504
1539
|
* the rotation immediately and observe the new credential.
|
|
1505
1540
|
*/
|
|
1506
1541
|
debugForceRefresh: config.forceExpire,
|
|
1542
|
+
/**
|
|
1543
|
+
* The headers that authorize one off-client request, resolved fresh each call.
|
|
1544
|
+
*
|
|
1545
|
+
* - For a transport this package does not own — the chat SSE stream, whose `fetch` the AI SDK
|
|
1546
|
+
* holds. Anything with a service client on `api` should use that instead.
|
|
1547
|
+
* - Returns the assembled bag, never the bare token: no caller handles the credential as a
|
|
1548
|
+
* string, and `X-KBC-ProjectId` is composed here rather than in every consuming app.
|
|
1549
|
+
* - Resolved per call, through the credential — so a near-expiry token rotates and a revoked
|
|
1550
|
+
* one is never re-sent. A snapshot held by the caller would do neither.
|
|
1551
|
+
* - Throws rather than emitting a half-formed `Bearer null`: an unauthenticated or unscoped
|
|
1552
|
+
* session has nothing to authorize with.
|
|
1553
|
+
* - Pinned to the sign-in it was called on, like every client here. This is the one
|
|
1554
|
+
* credential-emitting surface with no middleware chain for the guard to sit in, so the check
|
|
1555
|
+
* is written out around the `await` that rotates the token.
|
|
1556
|
+
* - The scope is re-read after that `await`, not carried across it. The epoch the pin compares
|
|
1557
|
+
* moves on a sign-in and a sign-out only, so a project switch mid-rotation is invisible to it.
|
|
1558
|
+
*/
|
|
1559
|
+
getAuthHeaders: async () => {
|
|
1560
|
+
const { assertSameSession } = pinToSession();
|
|
1561
|
+
requireScopedProject();
|
|
1562
|
+
const accessToken = await credential.getAccessToken();
|
|
1563
|
+
assertSameSession();
|
|
1564
|
+
const projectId = requireScopedProject();
|
|
1565
|
+
assert$1(accessToken, KeboolaErrorType.NotAuthenticated);
|
|
1566
|
+
return {
|
|
1567
|
+
[require_createFetchClient.HttpHeader.AUTHORIZATION]: `Bearer ${accessToken}`,
|
|
1568
|
+
[require_createFetchClient.KeboolaHttpHeader.PROJECT_ID]: String(projectId)
|
|
1569
|
+
};
|
|
1570
|
+
},
|
|
1507
1571
|
restore: async () => {
|
|
1508
1572
|
const persisted = persistor.hydrate();
|
|
1509
1573
|
if (!persisted.refreshToken || !persisted.baseUrl) return { status: "empty" };
|
|
@@ -1515,8 +1579,10 @@ const createKeboola = (options = {}) => {
|
|
|
1515
1579
|
if (!configured) config.setBaseUrl(persisted.baseUrl);
|
|
1516
1580
|
const client = authClientBare.get();
|
|
1517
1581
|
assert$1(client, KeboolaErrorType.NotReady);
|
|
1582
|
+
const startedOn = config.getEpoch();
|
|
1518
1583
|
try {
|
|
1519
1584
|
const refreshed = await client.token.refresh(persisted.refreshToken);
|
|
1585
|
+
if (config.getEpoch() !== startedOn) return { status: "empty" };
|
|
1520
1586
|
config.authenticate(refreshed);
|
|
1521
1587
|
if (persisted.projectId !== null) {
|
|
1522
1588
|
config.setProjectId(persisted.projectId);
|
|
@@ -1524,6 +1590,7 @@ const createKeboola = (options = {}) => {
|
|
|
1524
1590
|
}
|
|
1525
1591
|
return { status: "restored" };
|
|
1526
1592
|
} catch (err) {
|
|
1593
|
+
if (config.getEpoch() !== startedOn) return { status: "empty" };
|
|
1527
1594
|
if (require_credential.isUnauthorized(err)) {
|
|
1528
1595
|
persistor.clear();
|
|
1529
1596
|
return { status: "expired" };
|
|
@@ -1556,7 +1623,7 @@ const createKeboola = (options = {}) => {
|
|
|
1556
1623
|
//#endregion
|
|
1557
1624
|
//#region src/keboola/legacy/createConfig.ts
|
|
1558
1625
|
const createConfig = () => {
|
|
1559
|
-
const store =
|
|
1626
|
+
const store = require_store.createStore({
|
|
1560
1627
|
baseUrl: null,
|
|
1561
1628
|
sapiToken: null,
|
|
1562
1629
|
managementToken: null
|
|
@@ -1622,7 +1689,7 @@ const createProjectClients = async ({ baseUrl, getStorageToken, onStorageTokenRe
|
|
|
1622
1689
|
initialToken: sapiToken,
|
|
1623
1690
|
verify: () => _storage.tokens.verify()
|
|
1624
1691
|
});
|
|
1625
|
-
const storageTableStore =
|
|
1692
|
+
const storageTableStore = createDerivedStore({
|
|
1626
1693
|
source: liveProject.store,
|
|
1627
1694
|
build: require_storageTable.createStorageTable,
|
|
1628
1695
|
dependsOn: (project) => ({
|
|
@@ -1683,7 +1750,7 @@ const createProjectClients = async ({ baseUrl, getStorageToken, onStorageTokenRe
|
|
|
1683
1750
|
const createLegacyKeboola = (options = {}) => {
|
|
1684
1751
|
const config = createConfig();
|
|
1685
1752
|
const middlewareFor = createMiddlewareFor(options.middlewares);
|
|
1686
|
-
const authClient =
|
|
1753
|
+
const authClient = createDerivedStore({
|
|
1687
1754
|
source: config.store,
|
|
1688
1755
|
dependsOn: (state) => state.baseUrl,
|
|
1689
1756
|
build: (baseUrl) => baseUrl ? require_authClient.createAuthClient({
|
|
@@ -1691,7 +1758,7 @@ const createLegacyKeboola = (options = {}) => {
|
|
|
1691
1758
|
middlewares: middlewareFor("auth", [])
|
|
1692
1759
|
}) : null
|
|
1693
1760
|
});
|
|
1694
|
-
const management =
|
|
1761
|
+
const management = createDerivedStore({
|
|
1695
1762
|
source: config.store,
|
|
1696
1763
|
dependsOn: (state) => ({
|
|
1697
1764
|
baseUrl: state.baseUrl,
|
|
@@ -1706,7 +1773,7 @@ const createLegacyKeboola = (options = {}) => {
|
|
|
1706
1773
|
middlewares: middlewareFor("management", [])
|
|
1707
1774
|
}) : null
|
|
1708
1775
|
});
|
|
1709
|
-
const build =
|
|
1776
|
+
const build = createDerivedAsyncStore({
|
|
1710
1777
|
source: config.store,
|
|
1711
1778
|
dependsOn: (state) => state.sapiToken && state.baseUrl ? state.baseUrl : null,
|
|
1712
1779
|
build: (baseUrl) => createProjectClients({
|
|
@@ -1780,9 +1847,9 @@ exports.assert = assert;
|
|
|
1780
1847
|
exports.coalesce = coalesce;
|
|
1781
1848
|
exports.collect = require_queue.collect;
|
|
1782
1849
|
exports.concurrent = require_concurrent.concurrent;
|
|
1783
|
-
exports.createDerivedAsyncStore =
|
|
1784
|
-
exports.createDerivedStore =
|
|
1785
|
-
exports.createEmitter =
|
|
1850
|
+
exports.createDerivedAsyncStore = createDerivedAsyncStore;
|
|
1851
|
+
exports.createDerivedStore = createDerivedStore;
|
|
1852
|
+
exports.createEmitter = require_store.createEmitter;
|
|
1786
1853
|
exports.createGenericFetchClient = require_createGenericFetchClient.createGenericFetchClient;
|
|
1787
1854
|
exports.createKeboola = createKeboola;
|
|
1788
1855
|
exports.createLegacyKeboola = createLegacyKeboola;
|
|
@@ -1796,7 +1863,7 @@ exports.createQueryServiceSdk = require_sdk_queryService_index.createQueryServic
|
|
|
1796
1863
|
exports.createRetryMiddleware = createRetryMiddleware;
|
|
1797
1864
|
exports.createSessionStorage = createSessionStorage;
|
|
1798
1865
|
exports.createStorageSdk = require_sdk_storage_index.createStorageSdk;
|
|
1799
|
-
exports.createStore =
|
|
1866
|
+
exports.createStore = require_store.createStore;
|
|
1800
1867
|
exports.dedupe = require_dedupe.dedupe;
|
|
1801
1868
|
exports.deepMerge = deepMerge;
|
|
1802
1869
|
exports.delay = require_jobStatus.delay;
|
|
@@ -1815,6 +1882,7 @@ exports.isQueryJobError = require_QueryJobTimeoutError.isQueryJobError;
|
|
|
1815
1882
|
exports.isQueryJobTimeoutError = require_QueryJobTimeoutError.isQueryJobTimeoutError;
|
|
1816
1883
|
exports.isStorageTokenMutatingRequest = isStorageTokenMutatingRequest;
|
|
1817
1884
|
exports.isSyncActionError = require_SyncActionError.isSyncActionError;
|
|
1885
|
+
exports.isTimeoutError = require_createFetchClient.isTimeoutError;
|
|
1818
1886
|
exports.isValidationError = require_ValidationError.isValidationError;
|
|
1819
1887
|
exports.jobStatus = require_jobStatus.jobStatus;
|
|
1820
1888
|
exports.keboolaUID = require_tag.keboolaUID;
|
|
@@ -1825,6 +1893,6 @@ exports.poll = require_jobStatus.poll;
|
|
|
1825
1893
|
exports.poller = require_jobStatus.poller;
|
|
1826
1894
|
exports.schemaGuidedMerge = require_configurations.schemaGuidedMerge;
|
|
1827
1895
|
exports.series = require_storage.series;
|
|
1828
|
-
exports.shallowEqual =
|
|
1896
|
+
exports.shallowEqual = shallowEqual;
|
|
1829
1897
|
|
|
1830
1898
|
//# sourceMappingURL=index.cjs.map
|