@keboola/api-client 27.0.0 → 29.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 +145 -11
- package/API-SURFACE.md +8 -1
- package/README.md +53 -18
- package/dist/ManagementClientAuthError-B97OtOQ7.js +15 -0
- package/dist/ManagementClientAuthError-B97OtOQ7.js.map +1 -0
- package/dist/ManagementClientAuthError-ZJ2-RoKT.cjs +20 -0
- package/dist/ManagementClientAuthError-ZJ2-RoKT.cjs.map +1 -0
- package/dist/QueryJobTimeoutError-C7JbNGOM.js +38 -0
- package/dist/QueryJobTimeoutError-C7JbNGOM.js.map +1 -0
- package/dist/QueryJobTimeoutError-CVNPdCWX.cjs +61 -0
- package/dist/QueryJobTimeoutError-CVNPdCWX.cjs.map +1 -0
- package/dist/SyncActionError-BG0zwchi.cjs +35 -0
- package/dist/SyncActionError-BG0zwchi.cjs.map +1 -0
- package/dist/SyncActionError-CoZFsdUk.js +24 -0
- package/dist/SyncActionError-CoZFsdUk.js.map +1 -0
- package/dist/UserError-By_Zckmc.js +10 -0
- package/dist/UserError-By_Zckmc.js.map +1 -0
- package/dist/UserError-CSGO1qII.cjs +15 -0
- package/dist/UserError-CSGO1qII.cjs.map +1 -0
- package/dist/ValidationError-CzPWydEb.js +44 -0
- package/dist/ValidationError-CzPWydEb.js.map +1 -0
- package/dist/ValidationError-h5qvwahi.cjs +61 -0
- package/dist/ValidationError-h5qvwahi.cjs.map +1 -0
- package/dist/adminRoles-B40yBcmq.js +14 -0
- package/dist/adminRoles-B40yBcmq.js.map +1 -0
- package/dist/adminRoles-C696kD_U.d.cts +14 -0
- package/dist/adminRoles-C696kD_U.d.ts +14 -0
- package/dist/adminRoles-CO7J5qAy.cjs +19 -0
- package/dist/adminRoles-CO7J5qAy.cjs.map +1 -0
- package/dist/ai/index.cjs +62 -12
- package/dist/ai/index.cjs.map +1 -1
- package/dist/ai/index.d.cts +52 -53
- package/dist/ai/index.d.ts +52 -53
- package/dist/ai/index.js +62 -4
- package/dist/ai/index.js.map +1 -1
- package/dist/ai/types.cjs +0 -4
- package/dist/ai/types.d.cts +2 -2
- package/dist/ai/types.d.ts +2 -2
- package/dist/ai/types.js +1 -3
- package/dist/appLogs-CNG3yby-.cjs +153 -0
- package/dist/appLogs-CNG3yby-.cjs.map +1 -0
- package/dist/appLogs-Dl5BcCSD.d.cts +10 -0
- package/dist/appLogs-VdgP08aX.d.ts +10 -0
- package/dist/appLogs-enL9XR9r.js +132 -0
- package/dist/appLogs-enL9XR9r.js.map +1 -0
- package/dist/apps/index.cjs +229 -14
- package/dist/apps/index.cjs.map +1 -1
- package/dist/apps/index.d.cts +219 -220
- package/dist/apps/index.d.ts +219 -220
- package/dist/apps/index.js +229 -6
- package/dist/apps/index.js.map +1 -1
- package/dist/apps/types.cjs +0 -4
- package/dist/apps/types.d.cts +3 -3
- package/dist/apps/types.d.ts +3 -3
- package/dist/apps/types.js +1 -3
- package/dist/assets/index.cjs +33 -38
- package/dist/assets/index.cjs.map +1 -1
- package/dist/assets/index.d.cts +22 -22
- package/dist/assets/index.d.ts +22 -22
- package/dist/assets/index.js +32 -36
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/schema.cjs +23 -13
- package/dist/assets/schema.cjs.map +1 -1
- package/dist/assets/schema.d.cts +29 -28
- package/dist/assets/schema.d.ts +29 -28
- package/dist/assets/schema.js +21 -2
- package/dist/assets/schema.js.map +1 -1
- package/dist/auth/index.cjs +14 -57
- package/dist/auth/index.d.cts +2 -318
- package/dist/auth/index.d.ts +2 -318
- package/dist/auth/index.js +2 -4
- package/dist/auth/types.cjs +0 -4
- package/dist/auth/types.d.cts +2 -7
- package/dist/auth/types.d.ts +2 -7
- package/dist/auth/types.js +1 -3
- package/dist/auth-5HCvCsZO.cjs +18 -0
- package/dist/auth-5HCvCsZO.cjs.map +1 -0
- package/dist/auth-D2jfNlpX.js +13 -0
- package/dist/{chunk-5A3AQIXR.js.map → auth-D2jfNlpX.js.map} +1 -1
- package/dist/authClient-Bgj2Ay7h.d.cts +320 -0
- package/dist/authClient-DOk6VKdV.js +332 -0
- package/dist/authClient-DOk6VKdV.js.map +1 -0
- package/dist/authClient-Dsd7W99W.d.ts +320 -0
- package/dist/authClient-Z8Eg8rlN.cjs +405 -0
- package/dist/authClient-Z8Eg8rlN.cjs.map +1 -0
- package/dist/backends-DKBz5OxE.d.cts +9 -0
- package/dist/backends-DKBz5OxE.d.ts +9 -0
- package/dist/chat/index.cjs +134 -13
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.d.cts +49 -51
- package/dist/chat/index.d.ts +49 -51
- package/dist/chat/index.js +134 -5
- package/dist/chat/index.js.map +1 -1
- package/dist/chat/suggestions.cjs +152 -74
- package/dist/chat/suggestions.cjs.map +1 -1
- package/dist/chat/suggestions.d.cts +2 -437
- package/dist/chat/suggestions.d.ts +2 -437
- package/dist/chat/suggestions.js +136 -2
- package/dist/chat/suggestions.js.map +1 -1
- package/dist/chat/types.cjs +6 -8
- package/dist/chat/types.cjs.map +1 -1
- package/dist/chat/types.d.cts +2 -3
- package/dist/chat/types.d.ts +2 -3
- package/dist/chat/types.js +5 -6
- package/dist/chat/types.js.map +1 -1
- package/dist/componentId-DkyQ8PM0.cjs +73 -0
- package/dist/componentId-DkyQ8PM0.cjs.map +1 -0
- package/dist/componentId-vJz-kWs6.js +68 -0
- package/dist/componentId-vJz-kWs6.js.map +1 -0
- package/dist/concurrent-CH9fbNr3.js +34 -0
- package/dist/concurrent-CH9fbNr3.js.map +1 -0
- package/dist/concurrent-tbiIa0UL.cjs +39 -0
- package/dist/concurrent-tbiIa0UL.cjs.map +1 -0
- package/dist/configurations-Byt59bIa.js +726 -0
- package/dist/configurations-Byt59bIa.js.map +1 -0
- package/dist/configurations-CujCwDcB.cjs +743 -0
- package/dist/configurations-CujCwDcB.cjs.map +1 -0
- package/dist/configurations-DCOJONZZ.cjs +313 -0
- package/dist/configurations-DCOJONZZ.cjs.map +1 -0
- package/dist/configurations-iCbhe0tb.js +158 -0
- package/dist/configurations-iCbhe0tb.js.map +1 -0
- package/dist/constants/index.cjs +10 -34
- package/dist/constants/index.d.cts +4 -104
- package/dist/constants/index.d.ts +4 -104
- package/dist/constants/index.js +4 -5
- package/dist/constants-CqyyBkXW.cjs +197 -0
- package/dist/constants-CqyyBkXW.cjs.map +1 -0
- package/dist/constants-_HhqKvBg.js +174 -0
- package/dist/constants-_HhqKvBg.js.map +1 -0
- package/dist/createFetchClient-BK0TZK-U.js +184 -0
- package/dist/createFetchClient-BK0TZK-U.js.map +1 -0
- package/dist/createFetchClient-BsG719K1.cjs +263 -0
- package/dist/createFetchClient-BsG719K1.cjs.map +1 -0
- package/dist/createGenericFetchClient-CVZYekDk.js +7 -0
- package/dist/createGenericFetchClient-CVZYekDk.js.map +1 -0
- package/dist/createGenericFetchClient-DLbjX0eM.cjs +12 -0
- package/dist/createGenericFetchClient-DLbjX0eM.cjs.map +1 -0
- package/dist/createOpenapiFetchClient-B5U1fCHS.js +7 -0
- package/dist/createOpenapiFetchClient-B5U1fCHS.js.map +1 -0
- package/dist/createOpenapiFetchClient-Cr90VXY4.cjs +12 -0
- package/dist/createOpenapiFetchClient-Cr90VXY4.cjs.map +1 -0
- package/dist/createStore-BNiCRQXa.js +148 -0
- package/dist/createStore-BNiCRQXa.js.map +1 -0
- package/dist/createStore-MQbboXcB.cjs +177 -0
- package/dist/createStore-MQbboXcB.cjs.map +1 -0
- package/dist/credential-0c6yFwtp.cjs +44 -0
- package/dist/credential-0c6yFwtp.cjs.map +1 -0
- package/dist/credential-kEGLnVez.js +33 -0
- package/dist/credential-kEGLnVez.js.map +1 -0
- package/dist/dataScience/index.cjs +5 -20
- package/dist/dataScience/index.d.cts +3 -209
- package/dist/dataScience/index.d.ts +3 -209
- package/dist/dataScience/index.js +3 -7
- package/dist/dataScience/types.cjs +0 -4
- package/dist/dataScience/types.d.cts +3 -2172
- package/dist/dataScience/types.d.ts +3 -2172
- package/dist/dataScience/types.js +1 -3
- package/dist/dataScience-C-JrA0Uk.cjs +114 -0
- package/dist/dataScience-C-JrA0Uk.cjs.map +1 -0
- package/dist/dataScience-CE0pSWbl.js +109 -0
- package/dist/dataScience-CE0pSWbl.js.map +1 -0
- package/dist/dedupe-CiskLkGR.cjs +30 -0
- package/dist/dedupe-CiskLkGR.cjs.map +1 -0
- package/dist/dedupe-DYIHgZoG.js +25 -0
- package/dist/dedupe-DYIHgZoG.js.map +1 -0
- package/dist/developerPortal/index.cjs +6 -0
- package/dist/developerPortal/index.d.cts +3 -0
- package/dist/developerPortal/index.d.ts +3 -0
- package/dist/developerPortal/index.js +2 -0
- package/dist/developerPortal/types.cjs +0 -0
- package/dist/developerPortal/types.d.cts +2 -0
- package/dist/developerPortal/types.d.ts +2 -0
- package/dist/developerPortal/types.js +1 -0
- package/dist/developerPortalClient-BPPEAdJW.js +485 -0
- package/dist/developerPortalClient-BPPEAdJW.js.map +1 -0
- package/dist/developerPortalClient-C8oq48xW.cjs +508 -0
- package/dist/developerPortalClient-C8oq48xW.cjs.map +1 -0
- package/dist/domain/permissions/index.cjs +31 -122
- package/dist/domain/permissions/index.d.cts +19 -52
- package/dist/domain/permissions/index.d.ts +19 -52
- package/dist/domain/permissions/index.js +3 -5
- package/dist/domain/storageTable/index.cjs +4 -16
- package/dist/domain/storageTable/index.d.cts +2 -131
- package/dist/domain/storageTable/index.d.ts +2 -131
- package/dist/domain/storageTable/index.js +2 -3
- package/dist/editor/index.cjs +96 -12
- package/dist/editor/index.cjs.map +1 -1
- package/dist/editor/index.d.cts +163 -164
- package/dist/editor/index.d.ts +163 -164
- package/dist/editor/index.js +96 -4
- package/dist/editor/index.js.map +1 -1
- package/dist/editor/types.cjs +0 -4
- package/dist/editor/types.d.cts +2 -2
- package/dist/editor/types.d.ts +2 -2
- package/dist/editor/types.js +1 -3
- package/dist/encryption/index.cjs +58 -11
- package/dist/encryption/index.cjs.map +1 -1
- package/dist/encryption/index.d.cts +2 -20
- package/dist/encryption/index.d.ts +2 -20
- package/dist/encryption/index.js +58 -3
- package/dist/encryption/index.js.map +1 -1
- package/dist/encryption/types.cjs +0 -4
- package/dist/encryption/types.d.cts +2 -69
- package/dist/encryption/types.d.ts +2 -69
- package/dist/encryption/types.js +1 -3
- package/dist/generateUUID-C6qKBPIv.cjs +11 -0
- package/dist/generateUUID-C6qKBPIv.cjs.map +1 -0
- package/dist/generateUUID-Dr8l-aoc.js +6 -0
- package/dist/generateUUID-Dr8l-aoc.js.map +1 -0
- package/dist/import/index.cjs +3 -14
- package/dist/import/index.d.cts +41 -41
- package/dist/import/index.d.ts +41 -41
- package/dist/import/index.js +2 -5
- package/dist/import-Cf0W-7YD.js +116 -0
- package/dist/import-Cf0W-7YD.js.map +1 -0
- package/dist/import-KLH1uRtx.cjs +121 -0
- package/dist/import-KLH1uRtx.cjs.map +1 -0
- package/dist/index-8pN6Emos.d.ts +218 -0
- package/dist/index-BEKaJ7Cc.d.cts +1388 -0
- package/dist/index-BMqLPS6S.d.cts +135 -0
- package/dist/index-BMqLPS6S.d.ts +135 -0
- package/dist/index-BWBScAYc.d.cts +16 -0
- package/dist/index-BmjeNd9u.d.ts +1075 -0
- package/dist/index-BthgbVdd.d.ts +31 -0
- package/dist/index-CLPrlyIz.d.cts +218 -0
- package/dist/index-CXQRvZ-f.d.cts +31 -0
- package/dist/index-CeistZnj.d.ts +1388 -0
- package/dist/index-Cfrl7sd5.d.ts +65 -0
- package/dist/index-DIM8KZly.d.ts +16 -0
- package/dist/index-DNlX-H1V.d.ts +208 -0
- package/dist/index-DVsnxZap.d.cts +65 -0
- package/dist/index-DXi6wsr5.d.cts +77 -0
- package/dist/index-DYQt4zxC.d.ts +77 -0
- package/dist/index-DplMbm9E.d.cts +19882 -0
- package/dist/index-Dwp8tF6O.d.ts +19882 -0
- package/dist/index-IN0qzs52.d.cts +208 -0
- package/dist/index-KKJkrxjx.d.ts +26 -0
- package/dist/index-NC1dXRTD.d.cts +40 -0
- package/dist/index-NC1dXRTD.d.ts +40 -0
- package/dist/index-WQkVzx5e.d.cts +1075 -0
- package/dist/index-eEBVG5s3.d.cts +26 -0
- package/dist/index-vb9Rfqca.d.cts +115 -0
- package/dist/index-vb9Rfqca.d.ts +115 -0
- package/dist/index.cjs +1726 -1884
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -15778
- package/dist/index.d.ts +7 -15778
- package/dist/index.js +1676 -1724
- package/dist/index.js.map +1 -1
- package/dist/isPlainObject-BB3iy87C.cjs +16 -0
- package/dist/isPlainObject-BB3iy87C.cjs.map +1 -0
- package/dist/isPlainObject-LYW-03uB.js +11 -0
- package/dist/isPlainObject-LYW-03uB.js.map +1 -0
- package/dist/jobStatus-DbMupQEK.js +423 -0
- package/dist/jobStatus-DbMupQEK.js.map +1 -0
- package/dist/jobStatus-kQ9JqF8t.cjs +494 -0
- package/dist/jobStatus-kQ9JqF8t.cjs.map +1 -0
- package/dist/management/index.cjs +4 -18
- package/dist/management/index.d.cts +2 -1076
- package/dist/management/index.d.ts +2 -1076
- package/dist/management/index.js +2 -5
- package/dist/management/types.cjs +0 -4
- package/dist/management/types.d.cts +2 -12
- package/dist/management/types.d.ts +2 -12
- package/dist/management/types.js +1 -3
- package/dist/management-DqwQcDCx.js +1065 -0
- package/dist/management-DqwQcDCx.js.map +1 -0
- package/dist/management-WOmlBt6H.cjs +1076 -0
- package/dist/management-WOmlBt6H.cjs.map +1 -0
- package/dist/metastore/index.cjs +3 -14
- package/dist/metastore/index.d.cts +2 -32
- package/dist/metastore/index.d.ts +2 -32
- package/dist/metastore/index.js +2 -5
- package/dist/metastore/types.cjs +0 -4
- package/dist/metastore/types.d.cts +2 -2
- package/dist/metastore/types.d.ts +2 -2
- package/dist/metastore/types.js +1 -3
- package/dist/metastore-CNEhL66f.js +134 -0
- package/dist/metastore-CNEhL66f.js.map +1 -0
- package/dist/metastore-CkQluyX1.cjs +139 -0
- package/dist/metastore-CkQluyX1.cjs.map +1 -0
- package/dist/notifications/index.cjs +67 -13
- package/dist/notifications/index.cjs.map +1 -1
- package/dist/notifications/index.d.cts +56 -57
- package/dist/notifications/index.d.ts +56 -57
- package/dist/notifications/index.js +67 -5
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/types.cjs +0 -4
- package/dist/notifications/types.d.cts +2 -2
- package/dist/notifications/types.d.ts +2 -2
- package/dist/notifications/types.js +1 -3
- package/dist/oauth/index.cjs +3 -14
- package/dist/oauth/index.d.cts +49 -50
- package/dist/oauth/index.d.ts +49 -50
- package/dist/oauth/index.js +2 -5
- package/dist/oauth/types.cjs +0 -4
- package/dist/oauth/types.d.cts +2 -725
- package/dist/oauth/types.d.ts +2 -725
- package/dist/oauth/types.js +1 -3
- package/dist/oauth-DTvrqe6P.cjs +88 -0
- package/dist/oauth-DTvrqe6P.cjs.map +1 -0
- package/dist/oauth-DYDObUX9.js +83 -0
- package/dist/oauth-DYDObUX9.js.map +1 -0
- package/dist/omnisearch/index.cjs +47 -12
- package/dist/omnisearch/index.cjs.map +1 -1
- package/dist/omnisearch/index.d.cts +12 -14
- package/dist/omnisearch/index.d.ts +12 -14
- package/dist/omnisearch/index.js +47 -4
- package/dist/omnisearch/index.js.map +1 -1
- package/dist/omnisearch/types.cjs +0 -4
- package/dist/omnisearch/types.d.cts +2 -3
- package/dist/omnisearch/types.d.ts +2 -3
- package/dist/omnisearch/types.js +1 -3
- package/dist/project-BvFi19K_.cjs +56 -0
- package/dist/project-BvFi19K_.cjs.map +1 -0
- package/dist/project-CcGxXIW_.d.cts +18 -0
- package/dist/project-DWwZv66D.js +39 -0
- package/dist/project-DWwZv66D.js.map +1 -0
- package/dist/project-io1pY-hW.d.ts +18 -0
- package/dist/queryService/index.cjs +3 -14
- package/dist/queryService/index.d.cts +2 -40
- package/dist/queryService/index.d.ts +2 -40
- package/dist/queryService/index.js +2 -5
- package/dist/queryService/types.cjs +0 -4
- package/dist/queryService/types.d.cts +2 -2
- package/dist/queryService/types.d.ts +2 -2
- package/dist/queryService/types.js +1 -3
- package/dist/queryService-BHV_OZI2.js +114 -0
- package/dist/queryService-BHV_OZI2.js.map +1 -0
- package/dist/queryService-CvqDqigW.cjs +119 -0
- package/dist/queryService-CvqDqigW.cjs.map +1 -0
- package/dist/queue/index.cjs +3 -15
- package/dist/queue/index.d.cts +411 -340
- package/dist/queue/index.d.ts +411 -340
- package/dist/queue/index.js +2 -6
- package/dist/queue/types.cjs +0 -4
- package/dist/queue/types.d.cts +2 -2
- package/dist/queue/types.d.ts +2 -2
- package/dist/queue/types.js +1 -3
- package/dist/queue-CUHKupTA.cjs +137 -0
- package/dist/queue-CUHKupTA.cjs.map +1 -0
- package/dist/queue-uofE4Eu6.js +126 -0
- package/dist/queue-uofE4Eu6.js.map +1 -0
- package/dist/rolldown-runtime-VH7oDXx4.cjs +28 -0
- package/dist/scheduler/index.cjs +61 -13
- package/dist/scheduler/index.cjs.map +1 -1
- package/dist/scheduler/index.d.cts +73 -74
- package/dist/scheduler/index.d.ts +73 -74
- package/dist/scheduler/index.js +61 -5
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/types.cjs +0 -4
- package/dist/scheduler/types.d.cts +2 -372
- package/dist/scheduler/types.d.ts +2 -372
- package/dist/scheduler/types.js +1 -3
- package/dist/sdk/configurations/index.cjs +3 -16
- package/dist/sdk/configurations/index.d.cts +3066 -3078
- package/dist/sdk/configurations/index.d.ts +3066 -3078
- package/dist/sdk/configurations/index.js +2 -7
- package/dist/sdk/developerPortal/index.cjs +203 -0
- package/dist/sdk/developerPortal/index.cjs.map +1 -0
- package/dist/sdk/developerPortal/index.d.cts +1371 -0
- package/dist/sdk/developerPortal/index.d.ts +1371 -0
- package/dist/sdk/developerPortal/index.js +202 -0
- package/dist/sdk/developerPortal/index.js.map +1 -0
- package/dist/sdk/queryService/index.cjs +91 -14
- package/dist/sdk/queryService/index.cjs.map +1 -1
- package/dist/sdk/queryService/index.d.cts +2 -35
- package/dist/sdk/queryService/index.d.ts +2 -35
- package/dist/sdk/queryService/index.js +91 -6
- package/dist/sdk/queryService/index.js.map +1 -1
- package/dist/sdk/semanticLayer/index.cjs +352 -54
- package/dist/sdk/semanticLayer/index.cjs.map +1 -1
- package/dist/sdk/semanticLayer/index.d.cts +95 -99
- package/dist/sdk/semanticLayer/index.d.ts +95 -99
- package/dist/sdk/semanticLayer/index.js +346 -4
- package/dist/sdk/semanticLayer/index.js.map +1 -1
- package/dist/sdk/semanticLayer/types.cjs +0 -4
- package/dist/sdk/semanticLayer/types.d.cts +2 -152
- package/dist/sdk/semanticLayer/types.d.ts +2 -152
- package/dist/sdk/semanticLayer/types.js +1 -3
- package/dist/sdk/storage/index.cjs +267 -48
- package/dist/sdk/storage/index.cjs.map +1 -1
- package/dist/sdk/storage/index.d.cts +2 -120
- package/dist/sdk/storage/index.d.ts +2 -120
- package/dist/sdk/storage/index.js +258 -4
- package/dist/sdk/storage/index.js.map +1 -1
- package/dist/sdk/tag/index.cjs +3 -14
- package/dist/sdk/tag/index.d.cts +16 -20
- package/dist/sdk/tag/index.d.ts +16 -20
- package/dist/sdk/tag/index.js +2 -5
- package/dist/sdk/tag/types.cjs +0 -4
- package/dist/sdk/tag/types.d.cts +2 -36
- package/dist/sdk/tag/types.d.ts +2 -36
- package/dist/sdk/tag/types.js +1 -3
- package/dist/sdk/vault/index.cjs +93 -31
- package/dist/sdk/vault/index.cjs.map +1 -1
- package/dist/sdk/vault/index.d.cts +2 -73
- package/dist/sdk/vault/index.d.ts +2 -73
- package/dist/sdk/vault/index.js +88 -3
- package/dist/sdk/vault/index.js.map +1 -1
- package/dist/status/index.cjs +16 -20
- package/dist/status/index.cjs.map +1 -1
- package/dist/status/index.d.cts +8 -9
- package/dist/status/index.d.ts +8 -9
- package/dist/status/index.js +15 -18
- package/dist/status/index.js.map +1 -1
- package/dist/status/types.cjs +0 -6
- package/dist/status/types.d.cts +17 -15
- package/dist/status/types.d.ts +17 -15
- package/dist/status/types.js +1 -3
- package/dist/storage/index.cjs +27 -92
- package/dist/storage/index.d.cts +3 -24
- package/dist/storage/index.d.ts +3 -24
- package/dist/storage/index.js +8 -11
- package/dist/storage/types.cjs +0 -4
- package/dist/storage/types.d.cts +5 -1949
- package/dist/storage/types.d.ts +5 -1949
- package/dist/storage/types.js +1 -3
- package/dist/storage-DbyNnkIJ.cjs +2458 -0
- package/dist/storage-DbyNnkIJ.cjs.map +1 -0
- package/dist/storage-luq7YBZF.js +2429 -0
- package/dist/storage-luq7YBZF.js.map +1 -0
- package/dist/storageTable-C9crh4Ef.cjs +310 -0
- package/dist/storageTable-C9crh4Ef.cjs.map +1 -0
- package/dist/storageTable-DslXtqNL.js +299 -0
- package/dist/storageTable-DslXtqNL.js.map +1 -0
- package/dist/stream/index.cjs +363 -12
- package/dist/stream/index.cjs.map +1 -1
- package/dist/stream/index.d.cts +345 -346
- package/dist/stream/index.d.ts +345 -346
- package/dist/stream/index.js +363 -4
- package/dist/stream/index.js.map +1 -1
- package/dist/stream/types.cjs +0 -4
- package/dist/stream/types.d.cts +2 -2
- package/dist/stream/types.d.ts +2 -2
- package/dist/stream/types.js +1 -3
- package/dist/suggestions-BH3x7xU7.d.cts +438 -0
- package/dist/suggestions-BH3x7xU7.d.ts +438 -0
- package/dist/syncActions/index.cjs +3 -19
- package/dist/syncActions/index.d.cts +2 -67
- package/dist/syncActions/index.d.ts +2 -67
- package/dist/syncActions/index.js +2 -10
- package/dist/syncActions/types.cjs +0 -4
- package/dist/syncActions/types.d.cts +2 -614
- package/dist/syncActions/types.d.ts +2 -614
- package/dist/syncActions/types.js +1 -3
- package/dist/syncActions-DKWeJ8GH.cjs +504 -0
- package/dist/syncActions-DKWeJ8GH.cjs.map +1 -0
- package/dist/syncActions-ssWWVN_4.js +497 -0
- package/dist/syncActions-ssWWVN_4.js.map +1 -0
- package/dist/tag-CsoOZWB_.cjs +175 -0
- package/dist/tag-CsoOZWB_.cjs.map +1 -0
- package/dist/tag-DCsoewjL.js +164 -0
- package/dist/{chunk-WUFODWZV.js.map → tag-DCsoewjL.js.map} +1 -1
- package/dist/telemetry/index.cjs +3 -14
- package/dist/telemetry/index.d.cts +10 -10
- package/dist/telemetry/index.d.ts +10 -10
- package/dist/telemetry/index.js +2 -5
- package/dist/telemetry/types.cjs +0 -4
- package/dist/telemetry/types.d.cts +2 -12
- package/dist/telemetry/types.d.ts +2 -12
- package/dist/telemetry/types.js +1 -3
- package/dist/telemetry-2IrE8HaZ.cjs +29 -0
- package/dist/telemetry-2IrE8HaZ.cjs.map +1 -0
- package/dist/telemetry-yQfQxBBI.js +24 -0
- package/dist/telemetry-yQfQxBBI.js.map +1 -0
- package/dist/types--T-vBqdd.d.cts +2835 -0
- package/dist/{types-Cffam0Nw.d.ts → types-2mHlPakp.d.cts} +84 -80
- package/dist/types-7H6Dnz0Y.d.ts +23 -0
- package/dist/{types-BcaALDYY.d.cts → types-B06L4-WE.d.cts} +9 -15
- package/dist/types-B1S2H7q1.d.ts +373 -0
- package/dist/types-B1glyy_Q.d.ts +726 -0
- package/dist/types-BCt0EMiO.d.ts +2162 -0
- package/dist/{types-Y1ynT2PH.d.cts → types-BD6czYPH.d.ts} +29 -106
- package/dist/{types-CwAYn1EJ.d.cts → types-BO-mTxKb.d.cts} +48 -80
- package/dist/{types-nt7I4XNc.d.cts → types-BREBK0xX.d.ts} +7 -6
- package/dist/types-BRQAKEC1.d.cts +32 -0
- package/dist/types-BXK6Ebtm.d.ts +32 -0
- package/dist/types-BefwoXik.d.cts +373 -0
- package/dist/{types-BuEkMmKT.d.ts → types-BhBvnvqe.d.ts} +219 -234
- package/dist/{types-qvle4Ydu.d.cts → types-BmFyDKe6.d.ts} +84 -80
- package/dist/types-BpWqpMkL.d.ts +66 -0
- package/dist/types-C8XiTXxi.d.cts +23 -0
- package/dist/{types-DrGnvgkB.d.ts → types-CAOvDtMC.d.cts} +9 -14
- package/dist/types-CC0wymfG.d.ts +2088 -0
- package/dist/{types-Bom93Zx2.d.cts → types-CI1mW2lA.d.ts} +9 -14
- package/dist/{types-EZBBpiFU.d.ts → types-CRYtdj5w.d.ts} +238 -349
- package/dist/{types-CniF_D1P.d.cts → types-CSmttcZ_.d.ts} +8 -10
- package/dist/{types-CxAH36ip.d.cts → types-CbZ8aMKW.d.cts} +9 -12
- package/dist/{types-D2qGShlS.d.ts → types-CexuN7Mw.d.cts} +29 -106
- package/dist/types-CjAia48k.d.ts +386 -0
- package/dist/{types-ebolWqn1.d.ts → types-CtdyAkzI.d.cts} +27 -16
- package/dist/{types-COti0FGo.d.ts → types-CvADp-x-.d.ts} +9 -12
- package/dist/types-CwvOcTOm.d.cts +2088 -0
- package/dist/types-CyRK5z-E.d.cts +386 -0
- package/dist/{types-BALUbGA5.d.ts → types-D2n3h1gp.d.ts} +48 -80
- package/dist/types-DBOEA7l0.d.cts +148 -0
- package/dist/{types-DM1glEQI.d.ts → types-DCBKso0t.d.cts} +8 -10
- package/dist/{types-DNyZ0z3L.d.cts → types-DEKF5pbg.d.cts} +219 -234
- package/dist/{types-D6dnnju2.d.ts → types-DMvU4kZ2.d.cts} +32 -30
- package/dist/{types-BPKQRahf.d.cts → types-DS8uFAeq.d.cts} +8 -13
- package/dist/{types-DOc5_aYZ.d.ts → types-DeApSCzx.d.cts} +16 -21
- package/dist/types-DebL68-g.d.ts +148 -0
- package/dist/types-DgaYUtu_.d.cts +726 -0
- package/dist/{types-CfzHhZVG.d.ts → types-DkbfBOBr.d.cts} +7 -6
- package/dist/types-DvsGS8By.d.cts +66 -0
- package/dist/{types-Dpwb4dD0.d.ts → types-DwX1uxp_.d.ts} +8 -13
- package/dist/{types-cxk-0ftN.d.cts → types-ISUNM_BR.d.cts} +238 -349
- package/dist/types-QOIQ-dZU.d.cts +2162 -0
- package/dist/{types-BsejtGjZ.d.ts → types-SGuvOEV8.d.ts} +9 -15
- package/dist/types-V8rC5if7.d.cts +621 -0
- package/dist/{types-BCBF_5cU.d.cts → types-Z-vUwgym.d.ts} +32 -30
- package/dist/{types-Bp8d9PJf.d.cts → types-bws2RtKq.d.ts} +16 -21
- package/dist/types-h9TTimS_.d.ts +2835 -0
- package/dist/types-lFsTSkhe.d.cts +14 -0
- package/dist/types-lFsTSkhe.d.ts +14 -0
- package/dist/types-n4FFKqa4.d.ts +621 -0
- package/dist/{types-CFeOCzzg.d.cts → types-x4xPlrr0.d.ts} +27 -16
- package/dist/vault/index.cjs +49 -13
- package/dist/vault/index.cjs.map +1 -1
- package/dist/vault/index.d.cts +2 -27
- package/dist/vault/index.d.ts +2 -27
- package/dist/vault/index.js +49 -5
- package/dist/vault/index.js.map +1 -1
- package/dist/vault/types.cjs +0 -4
- package/dist/vault/types.d.cts +2 -385
- package/dist/vault/types.d.ts +2 -385
- package/dist/vault/types.js +1 -3
- package/package.json +43 -5
- package/surface/apps.md +2 -2
- package/surface/chat.md +2 -2
- package/surface/dataScience.md +2 -2
- package/surface/kaiAgent.md +1 -1
- package/surface/queryService.md +4 -3
- package/surface/queue.md +2 -1
- package/surface/sdk.md +8 -8
- package/surface/storage.md +40 -35
- package/surface/syncActions.md +2 -2
- package/dist/ManagementClientAuthError-4J0S5tV-.d.ts +0 -9
- package/dist/ManagementClientAuthError-CyDpa4NS.d.cts +0 -9
- package/dist/adminRoles-BSUPLfNf.d.cts +0 -12
- package/dist/adminRoles-BSUPLfNf.d.ts +0 -12
- package/dist/ai/types.cjs.map +0 -1
- package/dist/ai/types.js.map +0 -1
- package/dist/appLogs-BbgAJ5I8.d.cts +0 -7
- package/dist/appLogs-BbgAJ5I8.d.ts +0 -7
- package/dist/apps/types.cjs.map +0 -1
- package/dist/apps/types.js.map +0 -1
- package/dist/auth/index.cjs.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/types.cjs.map +0 -1
- package/dist/auth/types.js.map +0 -1
- package/dist/backends-UNp_e5y9.d.cts +0 -7
- package/dist/backends-UNp_e5y9.d.ts +0 -7
- package/dist/chunk-22E6IGXR.js +0 -6
- package/dist/chunk-22E6IGXR.js.map +0 -1
- package/dist/chunk-24YVNNAG.js +0 -83
- package/dist/chunk-24YVNNAG.js.map +0 -1
- package/dist/chunk-255CHZ3U.js +0 -200
- package/dist/chunk-255CHZ3U.js.map +0 -1
- package/dist/chunk-2BCH2U57.js +0 -67
- package/dist/chunk-2BCH2U57.js.map +0 -1
- package/dist/chunk-2BQBKU6E.js +0 -270
- package/dist/chunk-2BQBKU6E.js.map +0 -1
- package/dist/chunk-2JKTV7UG.cjs +0 -35
- package/dist/chunk-2JKTV7UG.cjs.map +0 -1
- package/dist/chunk-3UBGQFBU.js +0 -29
- package/dist/chunk-3UBGQFBU.js.map +0 -1
- package/dist/chunk-4RC5E3SL.js +0 -140
- package/dist/chunk-4RC5E3SL.js.map +0 -1
- package/dist/chunk-552FC4ZV.js +0 -14
- package/dist/chunk-552FC4ZV.js.map +0 -1
- package/dist/chunk-57Q4CY4H.js +0 -190
- package/dist/chunk-57Q4CY4H.js.map +0 -1
- package/dist/chunk-5A3AQIXR.js +0 -14
- package/dist/chunk-5HEIR4DC.js +0 -39
- package/dist/chunk-5HEIR4DC.js.map +0 -1
- package/dist/chunk-5SR2L35Y.cjs +0 -1828
- package/dist/chunk-5SR2L35Y.cjs.map +0 -1
- package/dist/chunk-62LG5KPI.js +0 -285
- package/dist/chunk-62LG5KPI.js.map +0 -1
- package/dist/chunk-67P5UI6H.js +0 -58
- package/dist/chunk-67P5UI6H.js.map +0 -1
- package/dist/chunk-6PVEHUJL.cjs +0 -1308
- package/dist/chunk-6PVEHUJL.cjs.map +0 -1
- package/dist/chunk-6XFXU5N4.js +0 -119
- package/dist/chunk-6XFXU5N4.js.map +0 -1
- package/dist/chunk-6YZQIMML.cjs +0 -163
- package/dist/chunk-6YZQIMML.cjs.map +0 -1
- package/dist/chunk-6ZQBFK2Y.js +0 -24
- package/dist/chunk-6ZQBFK2Y.js.map +0 -1
- package/dist/chunk-7J2R6XHB.js +0 -3
- package/dist/chunk-7J2R6XHB.js.map +0 -1
- package/dist/chunk-AJ3SCWUB.cjs +0 -69
- package/dist/chunk-AJ3SCWUB.cjs.map +0 -1
- package/dist/chunk-AXYNFDUI.cjs +0 -43
- package/dist/chunk-AXYNFDUI.cjs.map +0 -1
- package/dist/chunk-B45B4AYG.js +0 -272
- package/dist/chunk-B45B4AYG.js.map +0 -1
- package/dist/chunk-B4T4QCLB.js +0 -116
- package/dist/chunk-B4T4QCLB.js.map +0 -1
- package/dist/chunk-BCZPCMGL.cjs +0 -49
- package/dist/chunk-BCZPCMGL.cjs.map +0 -1
- package/dist/chunk-BGJWHTBJ.js +0 -66
- package/dist/chunk-BGJWHTBJ.js.map +0 -1
- package/dist/chunk-BVRPZKRE.cjs +0 -147
- package/dist/chunk-BVRPZKRE.cjs.map +0 -1
- package/dist/chunk-BZB4UVQA.cjs +0 -192
- package/dist/chunk-BZB4UVQA.cjs.map +0 -1
- package/dist/chunk-CHRBWCL7.cjs +0 -472
- package/dist/chunk-CHRBWCL7.cjs.map +0 -1
- package/dist/chunk-CPZME73I.js +0 -16
- package/dist/chunk-CPZME73I.js.map +0 -1
- package/dist/chunk-DVV35AIS.js +0 -468
- package/dist/chunk-DVV35AIS.js.map +0 -1
- package/dist/chunk-E7GGDLAH.cjs +0 -202
- package/dist/chunk-E7GGDLAH.cjs.map +0 -1
- package/dist/chunk-EQPBR3BE.cjs +0 -85
- package/dist/chunk-EQPBR3BE.cjs.map +0 -1
- package/dist/chunk-ERZEQ5JR.js +0 -40
- package/dist/chunk-ERZEQ5JR.js.map +0 -1
- package/dist/chunk-ES3ADC2G.cjs +0 -18
- package/dist/chunk-ES3ADC2G.cjs.map +0 -1
- package/dist/chunk-EWMXK3EI.cjs +0 -8
- package/dist/chunk-EWMXK3EI.cjs.map +0 -1
- package/dist/chunk-FEAE6L3K.cjs +0 -60
- package/dist/chunk-FEAE6L3K.cjs.map +0 -1
- package/dist/chunk-FPB6OGTV.js +0 -26
- package/dist/chunk-FPB6OGTV.js.map +0 -1
- package/dist/chunk-FVU7WU2H.cjs +0 -66
- package/dist/chunk-FVU7WU2H.cjs.map +0 -1
- package/dist/chunk-FW5GBBKL.js +0 -67
- package/dist/chunk-FW5GBBKL.js.map +0 -1
- package/dist/chunk-G2SWCC3X.js +0 -90
- package/dist/chunk-G2SWCC3X.js.map +0 -1
- package/dist/chunk-G3JHVIDZ.cjs +0 -286
- package/dist/chunk-G3JHVIDZ.cjs.map +0 -1
- package/dist/chunk-G3N5KDEY.js +0 -10
- package/dist/chunk-G3N5KDEY.js.map +0 -1
- package/dist/chunk-HGKDXF35.js +0 -301
- package/dist/chunk-HGKDXF35.js.map +0 -1
- package/dist/chunk-HITKHHWN.cjs +0 -174
- package/dist/chunk-HITKHHWN.cjs.map +0 -1
- package/dist/chunk-HQO572JW.cjs +0 -34
- package/dist/chunk-HQO572JW.cjs.map +0 -1
- package/dist/chunk-HUQ5ATIL.cjs +0 -290
- package/dist/chunk-HUQ5ATIL.cjs.map +0 -1
- package/dist/chunk-HZDVMHU6.js +0 -344
- package/dist/chunk-HZDVMHU6.js.map +0 -1
- package/dist/chunk-ICWUR5WA.cjs +0 -68
- package/dist/chunk-ICWUR5WA.cjs.map +0 -1
- package/dist/chunk-IQFNHQWP.cjs +0 -47
- package/dist/chunk-IQFNHQWP.cjs.map +0 -1
- package/dist/chunk-IZ4QM7O4.js +0 -1304
- package/dist/chunk-IZ4QM7O4.js.map +0 -1
- package/dist/chunk-J5JCXSAS.cjs +0 -117
- package/dist/chunk-J5JCXSAS.cjs.map +0 -1
- package/dist/chunk-JI7HLIDL.cjs +0 -119
- package/dist/chunk-JI7HLIDL.cjs.map +0 -1
- package/dist/chunk-JWISA775.cjs +0 -92
- package/dist/chunk-JWISA775.cjs.map +0 -1
- package/dist/chunk-K3BLXPLA.cjs +0 -16
- package/dist/chunk-K3BLXPLA.cjs.map +0 -1
- package/dist/chunk-KATUDT3E.js +0 -45
- package/dist/chunk-KATUDT3E.js.map +0 -1
- package/dist/chunk-KGBWWS6I.js +0 -32
- package/dist/chunk-KGBWWS6I.js.map +0 -1
- package/dist/chunk-KQENBXPS.cjs +0 -34
- package/dist/chunk-KQENBXPS.cjs.map +0 -1
- package/dist/chunk-KTKJD4DM.js +0 -60
- package/dist/chunk-KTKJD4DM.js.map +0 -1
- package/dist/chunk-LNZP2O4P.js +0 -169
- package/dist/chunk-LNZP2O4P.js.map +0 -1
- package/dist/chunk-LWQP7OWA.js +0 -75
- package/dist/chunk-LWQP7OWA.js.map +0 -1
- package/dist/chunk-MRHQJNWF.cjs +0 -8
- package/dist/chunk-MRHQJNWF.cjs.map +0 -1
- package/dist/chunk-MSI6FVGG.js +0 -6
- package/dist/chunk-MSI6FVGG.js.map +0 -1
- package/dist/chunk-N4COL54U.cjs +0 -22
- package/dist/chunk-N4COL54U.cjs.map +0 -1
- package/dist/chunk-NFJKJGXR.js +0 -397
- package/dist/chunk-NFJKJGXR.js.map +0 -1
- package/dist/chunk-NH2TQGRL.cjs +0 -28
- package/dist/chunk-NH2TQGRL.cjs.map +0 -1
- package/dist/chunk-NHYL5QPM.js +0 -74
- package/dist/chunk-NHYL5QPM.js.map +0 -1
- package/dist/chunk-ON4ILCHP.js +0 -1822
- package/dist/chunk-ON4ILCHP.js.map +0 -1
- package/dist/chunk-PLF4JX5B.cjs +0 -155
- package/dist/chunk-PLF4JX5B.cjs.map +0 -1
- package/dist/chunk-PSR3N4NC.js +0 -136
- package/dist/chunk-PSR3N4NC.js.map +0 -1
- package/dist/chunk-QHD4LPAQ.cjs +0 -8
- package/dist/chunk-QHD4LPAQ.cjs.map +0 -1
- package/dist/chunk-QNF3L4B7.js +0 -115
- package/dist/chunk-QNF3L4B7.js.map +0 -1
- package/dist/chunk-RBN3ITTM.js +0 -153
- package/dist/chunk-RBN3ITTM.js.map +0 -1
- package/dist/chunk-RRC5RKF7.cjs +0 -12
- package/dist/chunk-RRC5RKF7.cjs.map +0 -1
- package/dist/chunk-RXYT7EMN.cjs +0 -318
- package/dist/chunk-RXYT7EMN.cjs.map +0 -1
- package/dist/chunk-S46FMY4G.cjs +0 -64
- package/dist/chunk-S46FMY4G.cjs.map +0 -1
- package/dist/chunk-S6BWQKHJ.cjs +0 -116
- package/dist/chunk-S6BWQKHJ.cjs.map +0 -1
- package/dist/chunk-SFTI6QFB.cjs +0 -85
- package/dist/chunk-SFTI6QFB.cjs.map +0 -1
- package/dist/chunk-SNP577FA.cjs +0 -346
- package/dist/chunk-SNP577FA.cjs.map +0 -1
- package/dist/chunk-SUVM3S2T.cjs +0 -69
- package/dist/chunk-SUVM3S2T.cjs.map +0 -1
- package/dist/chunk-SYZ5OFNT.js +0 -114
- package/dist/chunk-SYZ5OFNT.js.map +0 -1
- package/dist/chunk-SZBW4EE2.cjs +0 -180
- package/dist/chunk-SZBW4EE2.cjs.map +0 -1
- package/dist/chunk-T526LPBK.js +0 -6
- package/dist/chunk-T526LPBK.js.map +0 -1
- package/dist/chunk-TBHJQCAE.js +0 -64
- package/dist/chunk-TBHJQCAE.js.map +0 -1
- package/dist/chunk-U3E5YMLO.cjs +0 -82
- package/dist/chunk-U3E5YMLO.cjs.map +0 -1
- package/dist/chunk-U5SE6W5M.cjs +0 -158
- package/dist/chunk-U5SE6W5M.cjs.map +0 -1
- package/dist/chunk-UUY6LQT6.cjs +0 -267
- package/dist/chunk-UUY6LQT6.cjs.map +0 -1
- package/dist/chunk-UVX733BX.js +0 -83
- package/dist/chunk-UVX733BX.js.map +0 -1
- package/dist/chunk-V6FT3RTU.cjs +0 -42
- package/dist/chunk-V6FT3RTU.cjs.map +0 -1
- package/dist/chunk-VB56OVFM.cjs +0 -312
- package/dist/chunk-VB56OVFM.cjs.map +0 -1
- package/dist/chunk-WQ7NNIJ3.js +0 -33
- package/dist/chunk-WQ7NNIJ3.js.map +0 -1
- package/dist/chunk-WUFODWZV.js +0 -177
- package/dist/chunk-WUJ53PP7.cjs +0 -76
- package/dist/chunk-WUJ53PP7.cjs.map +0 -1
- package/dist/chunk-XPDEQND7.cjs +0 -4
- package/dist/chunk-XPDEQND7.cjs.map +0 -1
- package/dist/chunk-YDOSWWE4.cjs +0 -419
- package/dist/chunk-YDOSWWE4.cjs.map +0 -1
- package/dist/chunk-YGEJDWGG.js +0 -19
- package/dist/chunk-YGEJDWGG.js.map +0 -1
- package/dist/chunk-YXGBD4WP.cjs +0 -16
- package/dist/chunk-YXGBD4WP.cjs.map +0 -1
- package/dist/chunk-ZOREOLGE.js +0 -264
- package/dist/chunk-ZOREOLGE.js.map +0 -1
- package/dist/constants/index.cjs.map +0 -1
- package/dist/constants/index.js.map +0 -1
- package/dist/createFetchClient-BHAsPDgF.d.cts +0 -86
- package/dist/createFetchClient-CFIwc6Lh.d.ts +0 -86
- package/dist/createGenericFetchClient-JcbIIqwF.d.cts +0 -18
- package/dist/createGenericFetchClient-ZGG5wbAC.d.ts +0 -18
- package/dist/createOpenapiFetchClient-CduEua6F.d.cts +0 -24
- package/dist/createOpenapiFetchClient-wLlVgp3k.d.ts +0 -24
- package/dist/dataScience/index.cjs.map +0 -1
- package/dist/dataScience/index.js.map +0 -1
- package/dist/dataScience/types.cjs.map +0 -1
- package/dist/dataScience/types.js.map +0 -1
- package/dist/domain/permissions/index.cjs.map +0 -1
- package/dist/domain/permissions/index.js.map +0 -1
- package/dist/domain/storageTable/index.cjs.map +0 -1
- package/dist/domain/storageTable/index.js.map +0 -1
- package/dist/editor/types.cjs.map +0 -1
- package/dist/editor/types.js.map +0 -1
- package/dist/encryption/types.cjs.map +0 -1
- package/dist/encryption/types.js.map +0 -1
- package/dist/import/index.cjs.map +0 -1
- package/dist/import/index.js.map +0 -1
- package/dist/keboolaUID-D1DGSbge.d.cts +0 -19
- package/dist/keboolaUID-D1DGSbge.d.ts +0 -19
- package/dist/management/index.cjs.map +0 -1
- package/dist/management/index.js.map +0 -1
- package/dist/management/types.cjs.map +0 -1
- package/dist/management/types.js.map +0 -1
- package/dist/metastore/index.cjs.map +0 -1
- package/dist/metastore/index.js.map +0 -1
- package/dist/metastore/types.cjs.map +0 -1
- package/dist/metastore/types.js.map +0 -1
- package/dist/notifications/types.cjs.map +0 -1
- package/dist/notifications/types.js.map +0 -1
- package/dist/oauth/index.cjs.map +0 -1
- package/dist/oauth/index.js.map +0 -1
- package/dist/oauth/types.cjs.map +0 -1
- package/dist/oauth/types.js.map +0 -1
- package/dist/omnisearch/types.cjs.map +0 -1
- package/dist/omnisearch/types.js.map +0 -1
- package/dist/project-Dmr-zrQG.d.ts +0 -17
- package/dist/project-DstzWVMN.d.cts +0 -17
- package/dist/queryService/index.cjs.map +0 -1
- package/dist/queryService/index.js.map +0 -1
- package/dist/queryService/types.cjs.map +0 -1
- package/dist/queryService/types.js.map +0 -1
- package/dist/queue/index.cjs.map +0 -1
- package/dist/queue/index.js.map +0 -1
- package/dist/queue/types.cjs.map +0 -1
- package/dist/queue/types.js.map +0 -1
- package/dist/registry-CcKlB-yY.d.ts +0 -1046
- package/dist/registry-Cg0Yng1z.d.cts +0 -1046
- package/dist/scheduler/types.cjs.map +0 -1
- package/dist/scheduler/types.js.map +0 -1
- package/dist/sdk/configurations/index.cjs.map +0 -1
- package/dist/sdk/configurations/index.js.map +0 -1
- package/dist/sdk/semanticLayer/types.cjs.map +0 -1
- package/dist/sdk/semanticLayer/types.js.map +0 -1
- package/dist/sdk/tag/index.cjs.map +0 -1
- package/dist/sdk/tag/index.js.map +0 -1
- package/dist/sdk/tag/types.cjs.map +0 -1
- package/dist/sdk/tag/types.js.map +0 -1
- package/dist/status/types.cjs.map +0 -1
- package/dist/status/types.js.map +0 -1
- package/dist/storage/index.cjs.map +0 -1
- package/dist/storage/index.js.map +0 -1
- package/dist/storage/types.cjs.map +0 -1
- package/dist/storage/types.js.map +0 -1
- package/dist/storageClient-BAid0vi2.d.cts +0 -1750
- package/dist/storageClient-BX50Attd.d.ts +0 -1750
- package/dist/storageSdk-BS5982c_.d.cts +0 -753
- package/dist/storageSdk-BeJcnEIO.d.ts +0 -753
- package/dist/stream/types.cjs.map +0 -1
- package/dist/stream/types.js.map +0 -1
- package/dist/syncActions/index.cjs.map +0 -1
- package/dist/syncActions/index.js.map +0 -1
- package/dist/syncActions/types.cjs.map +0 -1
- package/dist/syncActions/types.js.map +0 -1
- package/dist/telemetry/index.cjs.map +0 -1
- package/dist/telemetry/index.js.map +0 -1
- package/dist/telemetry/types.cjs.map +0 -1
- package/dist/telemetry/types.js.map +0 -1
- package/dist/types-C5DdOzx8.d.cts +0 -12
- package/dist/types-C_jxWM7A.d.ts +0 -12
- package/dist/types-UwuKN9Kx.d.cts +0 -60
- package/dist/types-UwuKN9Kx.d.ts +0 -60
- package/dist/types-f8dUjMX4.d.cts +0 -90
- package/dist/types-f8dUjMX4.d.ts +0 -90
- package/dist/vault/types.cjs.map +0 -1
- package/dist/vault/types.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,1804 +1,1756 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
|
|
51
|
-
export { parseLogLines } from './chunk-6XFXU5N4.js';
|
|
52
|
-
import { isPlainObject } from './chunk-MSI6FVGG.js';
|
|
53
|
-
export { isPlainObject } from './chunk-MSI6FVGG.js';
|
|
54
|
-
import { createEditorClient } from './chunk-QNF3L4B7.js';
|
|
55
|
-
import { createAuthHeaders } from './chunk-5A3AQIXR.js';
|
|
56
|
-
import { KeboolaHttpHeader, HttpStatus, isApiError, ApiError, normalizeBaseUrl, HttpHeader, createOpenapiFetchClient, createGenericFetchClient } from './chunk-2BQBKU6E.js';
|
|
57
|
-
export { ApiError, HttpContentType, HttpHeader, KeboolaHttpHeader, createGenericFetchClient, isAbortError, isApiError, isFetchClientError } from './chunk-2BQBKU6E.js';
|
|
58
|
-
import * as z2 from 'zod';
|
|
59
|
-
import { z } from 'zod';
|
|
60
|
-
|
|
61
|
-
// src/utils/assert.ts
|
|
1
|
+
import { t as createProject } from "./project-DWwZv66D.js";
|
|
2
|
+
import { a as poller, c as Result, d as delay, i as poll, l as asError, n as emitter, o as clamp, r as failureOf, s as finiteOr, t as jobStatus, u as lazy } from "./jobStatus-DbMupQEK.js";
|
|
3
|
+
import { n as collect, t as createQueueClient } from "./queue-uofE4Eu6.js";
|
|
4
|
+
import { t as concurrent } from "./concurrent-CH9fbNr3.js";
|
|
5
|
+
import { t as dedupe } from "./dedupe-DYIHgZoG.js";
|
|
6
|
+
import { a as shallowEqual, i as createStore, n as createDerivedStore, r as createEmitter, t as createDerivedAsyncStore } from "./createStore-BNiCRQXa.js";
|
|
7
|
+
import { a as series, i as ServiceUnavailableError, t as createStorageClient } from "./storage-luq7YBZF.js";
|
|
8
|
+
import { n as keboolaUID, t as createTagSdk } from "./tag-DCsoewjL.js";
|
|
9
|
+
import { t as generateUUID } from "./generateUUID-Dr8l-aoc.js";
|
|
10
|
+
import { t as isPlainObject } from "./isPlainObject-LYW-03uB.js";
|
|
11
|
+
import { n as schemaGuidedMerge, r as isEmptyDeep, t as createConfigurationSdk } from "./configurations-Byt59bIa.js";
|
|
12
|
+
import { t as UserError } from "./UserError-By_Zckmc.js";
|
|
13
|
+
import { a as HttpContentType, c as normalizeBaseUrl, d as HttpStatus, f as KeboolaHttpHeader, i as isFetchClientError, n as isAbortError, o as HttpHeader, p as ApiError, r as isApiError } from "./createFetchClient-BK0TZK-U.js";
|
|
14
|
+
import { t as ManagementClientAuthError } from "./ManagementClientAuthError-B97OtOQ7.js";
|
|
15
|
+
import { i as isQueryJobError, n as isQueryJobTimeoutError, r as QueryJobError, t as QueryJobTimeoutError } from "./QueryJobTimeoutError-C7JbNGOM.js";
|
|
16
|
+
import { n as isSyncActionError, t as SyncActionError } from "./SyncActionError-CoZFsdUk.js";
|
|
17
|
+
import { n as isValidationError, r as parseOrThrow, t as ValidationError } from "./ValidationError-CzPWydEb.js";
|
|
18
|
+
import { t as createGenericFetchClient } from "./createGenericFetchClient-CVZYekDk.js";
|
|
19
|
+
import { t as createImportClient } from "./import-Cf0W-7YD.js";
|
|
20
|
+
import { t as createOpenapiFetchClient } from "./createOpenapiFetchClient-B5U1fCHS.js";
|
|
21
|
+
import { t as createAuthClient } from "./authClient-DOk6VKdV.js";
|
|
22
|
+
import { n as isManagementClientAuthError, t as createManagementClient } from "./management-DqwQcDCx.js";
|
|
23
|
+
import { t as createAuthHeaders } from "./auth-D2jfNlpX.js";
|
|
24
|
+
import { i as ProjectFeature } from "./constants-_HhqKvBg.js";
|
|
25
|
+
import { t as createStorageTable } from "./storageTable-DslXtqNL.js";
|
|
26
|
+
import { createSemanticLayerSdk } from "./sdk/semanticLayer/index.js";
|
|
27
|
+
import { createStorageSdk } from "./sdk/storage/index.js";
|
|
28
|
+
import { createVaultSdk } from "./sdk/vault/index.js";
|
|
29
|
+
import { createAiClient } from "./ai/index.js";
|
|
30
|
+
import { t as parseLogLines } from "./appLogs-enL9XR9r.js";
|
|
31
|
+
import { createAppsClient } from "./apps/index.js";
|
|
32
|
+
import { createChatClient } from "./chat/index.js";
|
|
33
|
+
import { t as createDataScienceClient } from "./dataScience-CE0pSWbl.js";
|
|
34
|
+
import { createEditorClient } from "./editor/index.js";
|
|
35
|
+
import { createEncryptionClient } from "./encryption/index.js";
|
|
36
|
+
import { t as createMetastoreClient } from "./metastore-CNEhL66f.js";
|
|
37
|
+
import { createNotificationsClient } from "./notifications/index.js";
|
|
38
|
+
import { t as createOauthClient } from "./oauth-DYDObUX9.js";
|
|
39
|
+
import { createOmnisearchClient } from "./omnisearch/index.js";
|
|
40
|
+
import { t as createQueryServiceClient } from "./queryService-BHV_OZI2.js";
|
|
41
|
+
import { createSchedulerClient } from "./scheduler/index.js";
|
|
42
|
+
import { createStreamClient } from "./stream/index.js";
|
|
43
|
+
import { t as createSyncActionsClient } from "./syncActions-ssWWVN_4.js";
|
|
44
|
+
import { t as createTelemetryClient } from "./telemetry-yQfQxBBI.js";
|
|
45
|
+
import { createVaultClient } from "./vault/index.js";
|
|
46
|
+
import { n as isUnauthorized, t as createBearerCredential } from "./credential-kEGLnVez.js";
|
|
47
|
+
import { createQueryServiceSdk } from "./sdk/queryService/index.js";
|
|
48
|
+
import * as z$1 from "zod";
|
|
49
|
+
import { z } from "zod";
|
|
50
|
+
//#region src/utils/assert.ts
|
|
62
51
|
function assert(value, message) {
|
|
63
|
-
|
|
64
|
-
throw new Error(message);
|
|
65
|
-
}
|
|
52
|
+
if (value == null) throw new Error(message);
|
|
66
53
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
var createStore = (initial) => {
|
|
107
|
-
let value = initial;
|
|
108
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
109
|
-
return {
|
|
110
|
-
get: () => value,
|
|
111
|
-
set: (next) => {
|
|
112
|
-
if (Object.is(next, value)) return;
|
|
113
|
-
value = next;
|
|
114
|
-
listeners.forEach((listener) => listener(value));
|
|
115
|
-
},
|
|
116
|
-
subscribe: (listener) => {
|
|
117
|
-
listeners.add(listener);
|
|
118
|
-
return () => {
|
|
119
|
-
listeners.delete(listener);
|
|
120
|
-
};
|
|
121
|
-
},
|
|
122
|
-
dispose: () => {
|
|
123
|
-
value = initial;
|
|
124
|
-
listeners.clear();
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
var isPlainObjectOrArray = (value) => {
|
|
129
|
-
if (Array.isArray(value)) return true;
|
|
130
|
-
const proto = Object.getPrototypeOf(value);
|
|
131
|
-
return proto === Object.prototype || proto === null;
|
|
132
|
-
};
|
|
133
|
-
var shallowEqual = (a, b) => {
|
|
134
|
-
if (Object.is(a, b)) return true;
|
|
135
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) return false;
|
|
136
|
-
if (!isPlainObjectOrArray(a) || !isPlainObjectOrArray(b)) return false;
|
|
137
|
-
const aKeys = Object.keys(a);
|
|
138
|
-
const bKeys = Object.keys(b);
|
|
139
|
-
return aKeys.length === bKeys.length && aKeys.every((key) => Object.is(a[key], b[key]));
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/utils/async/coalesce.ts
|
|
56
|
+
/**
|
|
57
|
+
* Coalesces concurrent triggers onto a single, never-parallel run of `task`.
|
|
58
|
+
* Triggers fired while a run is busy collapse into one trailing run, and each
|
|
59
|
+
* resolves with the first run that started after it — so it never sees stale state.
|
|
60
|
+
*
|
|
61
|
+
* Example — A triggers, then B and C trigger while A's run is still going:
|
|
62
|
+
* 1. trigger A → run #1 starts
|
|
63
|
+
* 2. trigger B, C → run #1 busy, so they wait
|
|
64
|
+
* 3. run #1 done → A resolves
|
|
65
|
+
* 4. run #2 starts → covers B and C together (one trailing run, not two)
|
|
66
|
+
* 5. run #2 done → B and C resolve
|
|
67
|
+
*
|
|
68
|
+
* @returns a trigger; each call returns a promise of the task result.
|
|
69
|
+
* @throws The returned promise rejects with whatever `task` throws or rejects
|
|
70
|
+
* with — the caller handles it (try/catch, or `.catch` on `void trigger()`).
|
|
71
|
+
*/
|
|
72
|
+
const coalesce = (task) => {
|
|
73
|
+
let running = false;
|
|
74
|
+
const waiters = [];
|
|
75
|
+
const drain = async () => {
|
|
76
|
+
running = true;
|
|
77
|
+
const batch = waiters.splice(0);
|
|
78
|
+
try {
|
|
79
|
+
const result = await task();
|
|
80
|
+
batch.forEach((waiter) => waiter.resolve(result));
|
|
81
|
+
} catch (error) {
|
|
82
|
+
batch.forEach((waiter) => waiter.reject(error));
|
|
83
|
+
}
|
|
84
|
+
if (waiters.length > 0) return drain();
|
|
85
|
+
running = false;
|
|
86
|
+
};
|
|
87
|
+
return () => {
|
|
88
|
+
const waiter = Promise.withResolvers();
|
|
89
|
+
waiters.push(waiter);
|
|
90
|
+
if (!running) drain();
|
|
91
|
+
return waiter.promise;
|
|
92
|
+
};
|
|
140
93
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/utils/async/poll/registry.ts
|
|
96
|
+
const DEFAULT_LIMIT = 50;
|
|
97
|
+
const isFinished = ({ snapshot }) => snapshot.state !== "idle" && snapshot.state !== "polling";
|
|
98
|
+
const createPollRegistry = ({ limit = DEFAULT_LIMIT } = {}) => {
|
|
99
|
+
const entries = createStore([]);
|
|
100
|
+
const unsubscribes = /* @__PURE__ */ new Map();
|
|
101
|
+
const maxEntries = clamp(finiteOr(limit, DEFAULT_LIMIT), 1);
|
|
102
|
+
let nextKey = 1;
|
|
103
|
+
const forget = (key) => {
|
|
104
|
+
unsubscribes.get(key)?.();
|
|
105
|
+
unsubscribes.delete(key);
|
|
106
|
+
};
|
|
107
|
+
const trim = (list) => {
|
|
108
|
+
let kept = list;
|
|
109
|
+
while (kept.length > maxEntries) {
|
|
110
|
+
const dropped = kept.findLast(isFinished) ?? kept.at(-1);
|
|
111
|
+
if (!dropped) break;
|
|
112
|
+
forget(dropped.key);
|
|
113
|
+
kept = kept.filter((entry) => entry !== dropped);
|
|
114
|
+
}
|
|
115
|
+
return kept;
|
|
116
|
+
};
|
|
117
|
+
const replace = (key, snapshot) => entries.set(entries.get().map((entry) => entry.key === key ? {
|
|
118
|
+
...entry,
|
|
119
|
+
snapshot
|
|
120
|
+
} : entry));
|
|
121
|
+
const register = (poller) => {
|
|
122
|
+
const key = nextKey++;
|
|
123
|
+
const entry = {
|
|
124
|
+
key,
|
|
125
|
+
startedAt: Date.now(),
|
|
126
|
+
snapshot: poller.debug(),
|
|
127
|
+
stop: poller.stop,
|
|
128
|
+
start: poller.start
|
|
129
|
+
};
|
|
130
|
+
unsubscribes.set(key, poller.subscribe((snapshot) => replace(key, snapshot)));
|
|
131
|
+
entries.set(trim([entry, ...entries.get()]));
|
|
132
|
+
};
|
|
133
|
+
const collect = () => {
|
|
134
|
+
emitter.subscribe(register);
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
list: entries.get,
|
|
138
|
+
collect,
|
|
139
|
+
subscribe: (listener) => entries.subscribe(() => listener()),
|
|
140
|
+
clear: () => {
|
|
141
|
+
entries.get().forEach(({ key }) => forget(key));
|
|
142
|
+
entries.set([]);
|
|
143
|
+
},
|
|
144
|
+
stopAll: (reason) => entries.get().forEach((entry) => entry.stop(reason))
|
|
145
|
+
};
|
|
163
146
|
};
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
(value) => {
|
|
181
|
-
if (runGeneration === generation) store.set({ state: "ready", value });
|
|
182
|
-
},
|
|
183
|
-
(error) => {
|
|
184
|
-
if (runGeneration === generation) store.set({ state: "errored", error });
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
};
|
|
188
|
-
const sync = (state) => {
|
|
189
|
-
const next = dependsOn(state);
|
|
190
|
-
if (next === null) {
|
|
191
|
-
if (currentKey === null) return;
|
|
192
|
-
controller?.abort();
|
|
193
|
-
controller = null;
|
|
194
|
-
generation += 1;
|
|
195
|
-
currentKey = null;
|
|
196
|
-
store.set({ state: "idle" });
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
if (currentKey !== null && keyEquals(currentKey, next)) return;
|
|
200
|
-
currentKey = next;
|
|
201
|
-
run(next);
|
|
202
|
-
};
|
|
203
|
-
sync(source.get());
|
|
204
|
-
const unsubscribe = source.subscribe(sync);
|
|
205
|
-
const readable = {
|
|
206
|
-
get: store.get,
|
|
207
|
-
subscribe: store.subscribe,
|
|
208
|
-
dispose: () => {
|
|
209
|
-
controller?.abort();
|
|
210
|
-
unsubscribe();
|
|
211
|
-
store.dispose();
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
const settled = () => new Promise((resolve) => {
|
|
215
|
-
let unsubscribeSettled = () => {
|
|
216
|
-
};
|
|
217
|
-
const check = (state) => {
|
|
218
|
-
if (state.state === "ready" || state.state === "errored") {
|
|
219
|
-
unsubscribeSettled();
|
|
220
|
-
resolve(state);
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
unsubscribeSettled = store.subscribe(check);
|
|
224
|
-
check(store.get());
|
|
225
|
-
});
|
|
226
|
-
return { store: readable, settled };
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
// src/utils/deepMerge.ts
|
|
230
|
-
var deepMerge = (base, patch) => {
|
|
231
|
-
const out = { ...base };
|
|
232
|
-
for (const [key, value] of Object.entries(patch)) {
|
|
233
|
-
if (value === void 0) continue;
|
|
234
|
-
const current = out[key];
|
|
235
|
-
out[key] = isPlainObject(current) && isPlainObject(value) ? deepMerge(current, value) : value;
|
|
236
|
-
}
|
|
237
|
-
return out;
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/utils/deepMerge.ts
|
|
149
|
+
/**
|
|
150
|
+
* Recursively merge `patch` into `base`. Plain-object values are merged key-by-key; every
|
|
151
|
+
* other value (primitives, arrays, or a type mismatch between the two sides) replaces the
|
|
152
|
+
* base value. `undefined` patch values are skipped, so a partial patch leaves untouched
|
|
153
|
+
* fields alone. Pure — neither argument is mutated; the result preserves `base`'s type.
|
|
154
|
+
*/
|
|
155
|
+
const deepMerge = (base, patch) => {
|
|
156
|
+
const out = { ...base };
|
|
157
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
158
|
+
if (value === void 0) continue;
|
|
159
|
+
const current = out[key];
|
|
160
|
+
out[key] = isPlainObject(current) && isPlainObject(value) ? deepMerge(current, value) : value;
|
|
161
|
+
}
|
|
162
|
+
return out;
|
|
238
163
|
};
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
removeItem: () => {
|
|
246
|
-
}
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/utils/persistor/adapters.ts
|
|
166
|
+
const createNullStorage = () => ({
|
|
167
|
+
getItem: () => null,
|
|
168
|
+
setItem: () => {},
|
|
169
|
+
removeItem: () => {}
|
|
247
170
|
});
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
171
|
+
const createMemoryStorage = () => {
|
|
172
|
+
const store = /* @__PURE__ */ new Map();
|
|
173
|
+
return {
|
|
174
|
+
getItem: (key) => store.get(key) ?? null,
|
|
175
|
+
setItem: (key, value) => {
|
|
176
|
+
store.set(key, value);
|
|
177
|
+
},
|
|
178
|
+
removeItem: (key) => {
|
|
179
|
+
store.delete(key);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
259
182
|
};
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
183
|
+
const createWebStorage = (pick) => {
|
|
184
|
+
let web = null;
|
|
185
|
+
try {
|
|
186
|
+
web = pick();
|
|
187
|
+
if (web) {
|
|
188
|
+
const probe = "__keboola_storage_probe__";
|
|
189
|
+
web.setItem(probe, probe);
|
|
190
|
+
web.removeItem(probe);
|
|
191
|
+
}
|
|
192
|
+
} catch (err) {
|
|
193
|
+
console.warn("createWebStorage: web storage unavailable, falling back to memory", err);
|
|
194
|
+
web = null;
|
|
195
|
+
}
|
|
196
|
+
if (!web) return createMemoryStorage();
|
|
197
|
+
const storage = web;
|
|
198
|
+
return {
|
|
199
|
+
getItem: (key) => storage.getItem(key),
|
|
200
|
+
setItem: (key, value) => {
|
|
201
|
+
storage.setItem(key, value);
|
|
202
|
+
},
|
|
203
|
+
removeItem: (key) => {
|
|
204
|
+
storage.removeItem(key);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
284
207
|
};
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
};
|
|
348
|
-
return { hydrate, persist, clear, hasPersistedValue };
|
|
208
|
+
const createLocalStorage = () => createWebStorage(() => "localStorage" in globalThis ? globalThis.localStorage : null);
|
|
209
|
+
const createSessionStorage = () => createWebStorage(() => "sessionStorage" in globalThis ? globalThis.sessionStorage : null);
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/utils/persistor/persistor.ts
|
|
212
|
+
const createPersistor = ({ storage = createNullStorage(), key, schema, defaultValue, encode = JSON.stringify, decode = JSON.parse }) => {
|
|
213
|
+
const clear = () => {
|
|
214
|
+
try {
|
|
215
|
+
storage.removeItem(key);
|
|
216
|
+
} catch (err) {
|
|
217
|
+
console.warn(`createPersistor: failed to clear "${key}"`, err);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
const hasPersistedValue = () => {
|
|
221
|
+
try {
|
|
222
|
+
return !!storage.getItem(key);
|
|
223
|
+
} catch (err) {
|
|
224
|
+
console.warn(`createPersistor: failed to read "${key}", assuming empty`, err);
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const hydrate = () => {
|
|
229
|
+
let raw;
|
|
230
|
+
try {
|
|
231
|
+
raw = storage.getItem(key);
|
|
232
|
+
} catch (err) {
|
|
233
|
+
console.warn(`createPersistor: failed to read "${key}", using default`, err);
|
|
234
|
+
return defaultValue;
|
|
235
|
+
}
|
|
236
|
+
if (raw === null) return defaultValue;
|
|
237
|
+
let decoded;
|
|
238
|
+
try {
|
|
239
|
+
decoded = decode(raw);
|
|
240
|
+
} catch (err) {
|
|
241
|
+
console.warn(`createPersistor: failed to decode "${key}", resetting`, err);
|
|
242
|
+
clear();
|
|
243
|
+
return defaultValue;
|
|
244
|
+
}
|
|
245
|
+
const parsed = schema.safeParse(decoded);
|
|
246
|
+
if (parsed.success) return parsed.data;
|
|
247
|
+
clear();
|
|
248
|
+
return defaultValue;
|
|
249
|
+
};
|
|
250
|
+
const persist = (value) => {
|
|
251
|
+
let raw;
|
|
252
|
+
try {
|
|
253
|
+
raw = encode(value);
|
|
254
|
+
} catch (err) {
|
|
255
|
+
console.warn(`createPersistor: failed to encode "${key}", not persisting`, err);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
try {
|
|
259
|
+
storage.setItem(key, raw);
|
|
260
|
+
} catch (err) {
|
|
261
|
+
console.warn(`createPersistor: failed to write "${key}"`, err);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
return {
|
|
265
|
+
hydrate,
|
|
266
|
+
persist,
|
|
267
|
+
clear,
|
|
268
|
+
hasPersistedValue
|
|
269
|
+
};
|
|
349
270
|
};
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
// Project feature toggles — changes token.owner.features. Anchored to
|
|
358
|
-
// /projects/{id}/features so /manage/features and /users/{id}/features don't match.
|
|
359
|
-
/\/projects\/[^/]+\/features(\/[^/]+)?$/
|
|
360
|
-
];
|
|
361
|
-
var isStorageTokenMutatingRequest = (request) => {
|
|
362
|
-
if (request.method === "GET") return false;
|
|
363
|
-
const { pathname } = new URL(request.url);
|
|
364
|
-
return STORAGE_TOKEN_MUTATING_PATTERNS.some((pattern) => pattern.test(pathname));
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/keboola/createLiveProject.ts
|
|
273
|
+
const STORAGE_TOKEN_MUTATING_PATTERNS = [/\/buckets(\/[^/]+)?$/, /\/projects\/[^/]+\/features(\/[^/]+)?$/];
|
|
274
|
+
const isStorageTokenMutatingRequest = (request) => {
|
|
275
|
+
if (request.method === "GET") return false;
|
|
276
|
+
const { pathname } = new URL(request.url);
|
|
277
|
+
return STORAGE_TOKEN_MUTATING_PATTERNS.some((pattern) => pattern.test(pathname));
|
|
365
278
|
};
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
279
|
+
const createProjectRefreshMiddleware = (shouldRefresh, requestRefresh) => (next) => async (request) => {
|
|
280
|
+
const response = await next(request);
|
|
281
|
+
if (shouldRefresh(request.request)) await requestRefresh();
|
|
282
|
+
return response;
|
|
370
283
|
};
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
284
|
+
/**
|
|
285
|
+
* The live project store: seeded from the verified token, re-verified (coalesced) after a
|
|
286
|
+
* token-mutating request or an explicit re-scope. Its `middleware` drives the auto re-verify.
|
|
287
|
+
*/
|
|
288
|
+
const createLiveProject = ({ initialToken, verify }) => {
|
|
289
|
+
const store = createStore(createProject({ sapiToken: initialToken }));
|
|
290
|
+
const refresh = coalesce(async () => store.set(createProject({ sapiToken: await verify() })));
|
|
291
|
+
const middleware = createProjectRefreshMiddleware(isStorageTokenMutatingRequest, refresh);
|
|
292
|
+
return {
|
|
293
|
+
store,
|
|
294
|
+
getProject: () => store.get(),
|
|
295
|
+
subscribe: store.subscribe,
|
|
296
|
+
middleware,
|
|
297
|
+
refresh
|
|
298
|
+
};
|
|
379
299
|
};
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/keboola/errors.ts
|
|
302
|
+
/**
|
|
303
|
+
* The single error the keboola client / session throws. It carries a stable `type` (the switchable
|
|
304
|
+
* contract) and a human-readable message derived from that type — no per-call message strings.
|
|
305
|
+
*/
|
|
306
|
+
const KeboolaErrorType = {
|
|
307
|
+
Unconfigured: "unconfigured",
|
|
308
|
+
NotAuthenticated: "not-authenticated",
|
|
309
|
+
AlreadyAuthenticated: "already-authenticated",
|
|
310
|
+
NoStorageToken: "no-storage-token",
|
|
311
|
+
NoManagementToken: "no-management-token",
|
|
312
|
+
MissingProject: "missing-project",
|
|
313
|
+
NotBearer: "not-bearer",
|
|
314
|
+
NotReady: "not-ready",
|
|
315
|
+
InvalidBuildTransition: "invalid-build-transition"
|
|
392
316
|
};
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
317
|
+
const MESSAGES = {
|
|
318
|
+
[KeboolaErrorType.Unconfigured]: "The session is not configured — set a baseUrl first.",
|
|
319
|
+
[KeboolaErrorType.NotAuthenticated]: "The session is not authenticated — sign in first.",
|
|
320
|
+
[KeboolaErrorType.AlreadyAuthenticated]: "The session is already authenticated — reset before authenticating again.",
|
|
321
|
+
[KeboolaErrorType.NoStorageToken]: "No storage token — authenticate the storage realm first.",
|
|
322
|
+
[KeboolaErrorType.NoManagementToken]: "No management token — authenticate the management realm first.",
|
|
323
|
+
[KeboolaErrorType.MissingProject]: "A bearer storage session requires a project — call setProject(projectId) first.",
|
|
324
|
+
[KeboolaErrorType.NotBearer]: "This operation requires a bearer (OAuth) session.",
|
|
325
|
+
[KeboolaErrorType.NotReady]: "The client is not ready — authenticate the storage realm first.",
|
|
326
|
+
[KeboolaErrorType.InvalidBuildTransition]: "Invalid storage build transition — the build goes idle → initializing → ready | failed."
|
|
403
327
|
};
|
|
404
|
-
var KeboolaError = class
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
328
|
+
var KeboolaError = class KeboolaError extends Error {
|
|
329
|
+
type;
|
|
330
|
+
constructor(type) {
|
|
331
|
+
super(MESSAGES[type]);
|
|
332
|
+
this.type = type;
|
|
333
|
+
this.name = "KeboolaError";
|
|
334
|
+
Object.setPrototypeOf(this, KeboolaError.prototype);
|
|
335
|
+
}
|
|
412
336
|
};
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
337
|
+
const isKeboolaError = (error) => error instanceof KeboolaError;
|
|
338
|
+
/** Throw a {@link KeboolaError} of `type` when `value` is null/undefined; otherwise narrow it. */
|
|
339
|
+
function assert$1(value, type) {
|
|
340
|
+
if (value == null) throw new KeboolaError(type);
|
|
416
341
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
342
|
+
//#endregion
|
|
343
|
+
//#region src/middlewares/loggingMiddleware.ts
|
|
344
|
+
const CORRELATION_ID_HEADER = "X-Correlation-ID";
|
|
345
|
+
const ALWAYS_REDACTED_HEADERS = [
|
|
346
|
+
KeboolaHttpHeader.MANAGEMENT_API_TOKEN,
|
|
347
|
+
KeboolaHttpHeader.STORAGE_API_TOKEN,
|
|
348
|
+
"authorization",
|
|
349
|
+
"cookie",
|
|
350
|
+
"set-cookie"
|
|
426
351
|
];
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
352
|
+
const ALWAYS_REDACTED_QUERY_PARAMS = /* @__PURE__ */ new Set([
|
|
353
|
+
"token",
|
|
354
|
+
"apikey",
|
|
355
|
+
"api_key",
|
|
356
|
+
"access_token",
|
|
357
|
+
"refresh_token",
|
|
358
|
+
"code",
|
|
359
|
+
"state",
|
|
360
|
+
"signature",
|
|
361
|
+
"sig",
|
|
362
|
+
"x-amz-signature",
|
|
363
|
+
"x-amz-credential",
|
|
364
|
+
"x-amz-security-token",
|
|
365
|
+
"password",
|
|
366
|
+
"secret"
|
|
442
367
|
]);
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
});
|
|
453
|
-
return url.toString();
|
|
368
|
+
const REDACTED = "[REDACTED]";
|
|
369
|
+
const getRedactedUrl = (rawUrl) => {
|
|
370
|
+
const url = new URL(rawUrl);
|
|
371
|
+
if (url.username) url.username = REDACTED;
|
|
372
|
+
if (url.password) url.password = REDACTED;
|
|
373
|
+
url.searchParams.forEach((_value, key) => {
|
|
374
|
+
if (ALWAYS_REDACTED_QUERY_PARAMS.has(key.toLowerCase())) url.searchParams.set(key, REDACTED);
|
|
375
|
+
});
|
|
376
|
+
return url.toString();
|
|
454
377
|
};
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
378
|
+
const ensureCorrelationId = (request) => {
|
|
379
|
+
const correlationId = request.headers.get(CORRELATION_ID_HEADER) ?? generateUUID();
|
|
380
|
+
request.headers.set(CORRELATION_ID_HEADER, correlationId);
|
|
381
|
+
return correlationId;
|
|
459
382
|
};
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
});
|
|
468
|
-
return result;
|
|
383
|
+
const getRedactedHeaders = (headers, redacted) => {
|
|
384
|
+
const redactedSet = new Set([...ALWAYS_REDACTED_HEADERS, ...redacted].map((h) => h.toLowerCase()));
|
|
385
|
+
const result = {};
|
|
386
|
+
headers.forEach((value, name) => {
|
|
387
|
+
result[name] = redactedSet.has(name.toLowerCase()) ? REDACTED : value;
|
|
388
|
+
});
|
|
389
|
+
return result;
|
|
469
390
|
};
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
391
|
+
const getRequestLog = (request, redactedHeaders) => ({
|
|
392
|
+
url: getRedactedUrl(request.url),
|
|
393
|
+
headers: getRedactedHeaders(request.headers, redactedHeaders)
|
|
473
394
|
});
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
395
|
+
const getResponseLog = (response, redactedHeaders) => ({
|
|
396
|
+
status: response.status,
|
|
397
|
+
statusText: response.statusText,
|
|
398
|
+
headers: getRedactedHeaders(response.headers, redactedHeaders)
|
|
478
399
|
});
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
400
|
+
const redactApiError = (error, redactedHeaders) => new ApiError({
|
|
401
|
+
request: new Request(getRedactedUrl(error.request.url), {
|
|
402
|
+
method: error.request.method,
|
|
403
|
+
headers: getRedactedHeaders(error.request.headers, redactedHeaders)
|
|
404
|
+
}),
|
|
405
|
+
response: new Response(null, {
|
|
406
|
+
status: error.response.status,
|
|
407
|
+
statusText: error.response.statusText,
|
|
408
|
+
headers: getRedactedHeaders(error.response.headers, redactedHeaders)
|
|
409
|
+
}),
|
|
410
|
+
data: error.data
|
|
490
411
|
});
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
412
|
+
const formatLog = (level, log) => {
|
|
413
|
+
const parts = [
|
|
414
|
+
`[${level.toUpperCase()}]`,
|
|
415
|
+
`${Math.round(log.durationMs)}ms`,
|
|
416
|
+
log.method
|
|
417
|
+
];
|
|
418
|
+
parts.push(log.request.url);
|
|
419
|
+
if ("response" in log) parts.push(String(log.response.status));
|
|
420
|
+
return parts.join(" ");
|
|
496
421
|
};
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
};
|
|
422
|
+
const createSafeLogger = (logger, level = "error-only") => {
|
|
423
|
+
return {
|
|
424
|
+
info: (log) => {
|
|
425
|
+
if (level !== "all") return;
|
|
426
|
+
try {
|
|
427
|
+
if (logger?.info) {
|
|
428
|
+
logger.info(log);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
console.info(formatLog("info", log));
|
|
432
|
+
} catch {}
|
|
433
|
+
},
|
|
434
|
+
error: (log) => {
|
|
435
|
+
try {
|
|
436
|
+
if (logger?.error) {
|
|
437
|
+
logger.error(log);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
console.error(formatLog("error", log));
|
|
441
|
+
} catch {}
|
|
442
|
+
}
|
|
443
|
+
};
|
|
521
444
|
};
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
};
|
|
445
|
+
const createLoggingMiddleware = (options = {}) => {
|
|
446
|
+
const safeLogger = createSafeLogger(options.logger, options.level);
|
|
447
|
+
const redactHeaders = options.redactHeaders ?? [];
|
|
448
|
+
return (next) => async (fetchRequest) => {
|
|
449
|
+
const correlationId = ensureCorrelationId(fetchRequest.request);
|
|
450
|
+
const start = performance.now();
|
|
451
|
+
const method = fetchRequest.request.method.toLowerCase();
|
|
452
|
+
const requestLog = getRequestLog(fetchRequest.request, redactHeaders);
|
|
453
|
+
try {
|
|
454
|
+
const result = await next(fetchRequest);
|
|
455
|
+
safeLogger.info({
|
|
456
|
+
correlationId,
|
|
457
|
+
method,
|
|
458
|
+
durationMs: performance.now() - start,
|
|
459
|
+
request: requestLog,
|
|
460
|
+
response: getResponseLog(result.response, redactHeaders)
|
|
461
|
+
});
|
|
462
|
+
return result;
|
|
463
|
+
} catch (error) {
|
|
464
|
+
if (error instanceof Error) safeLogger.error({
|
|
465
|
+
correlationId,
|
|
466
|
+
method,
|
|
467
|
+
durationMs: performance.now() - start,
|
|
468
|
+
request: requestLog,
|
|
469
|
+
error: isApiError(error) ? redactApiError(error, redactHeaders) : error
|
|
470
|
+
});
|
|
471
|
+
throw error;
|
|
472
|
+
}
|
|
473
|
+
};
|
|
552
474
|
};
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
475
|
+
//#endregion
|
|
476
|
+
//#region src/middlewares/retryMiddleware.ts
|
|
477
|
+
const DEFAULT_MAX_RETRIES = 5;
|
|
478
|
+
const DEFAULT_RETRYABLE_STATUSES = [
|
|
479
|
+
HttpStatus.INTERNAL_SERVER_ERROR,
|
|
480
|
+
HttpStatus.BAD_GATEWAY,
|
|
481
|
+
HttpStatus.SERVICE_UNAVAILABLE,
|
|
482
|
+
HttpStatus.GATEWAY_TIMEOUT
|
|
561
483
|
];
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
if (attempt === maxRetries || !shouldRetry(error, attempt)) {
|
|
582
|
-
throw error;
|
|
583
|
-
}
|
|
584
|
-
const delayMs = backoffFactor * 1e3 * Math.pow(2, attempt);
|
|
585
|
-
await delay(delayMs, request.request.signal ?? void 0);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
throw new Error("unreachable");
|
|
589
|
-
};
|
|
484
|
+
const DEFAULT_BACKOFF_FACTOR = .3;
|
|
485
|
+
const defaultShouldRetry = (error) => error instanceof ApiError && DEFAULT_RETRYABLE_STATUSES.includes(error.response.status);
|
|
486
|
+
const createRetryMiddleware = (options) => {
|
|
487
|
+
const { maxRetries = DEFAULT_MAX_RETRIES, backoffFactor = DEFAULT_BACKOFF_FACTOR, shouldRetry = defaultShouldRetry } = options ?? {};
|
|
488
|
+
if (!Number.isInteger(maxRetries) || maxRetries < 0) throw new RangeError("maxRetries must be a non-negative integer");
|
|
489
|
+
if (!Number.isFinite(backoffFactor) || backoffFactor < 0) throw new RangeError("backoffFactor must be a finite non-negative number");
|
|
490
|
+
return (next) => async (request) => {
|
|
491
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) try {
|
|
492
|
+
return await next({
|
|
493
|
+
...request,
|
|
494
|
+
request: request.request.clone()
|
|
495
|
+
});
|
|
496
|
+
} catch (error) {
|
|
497
|
+
if (attempt === maxRetries || !shouldRetry(error, attempt)) throw error;
|
|
498
|
+
const delayMs = backoffFactor * 1e3 * Math.pow(2, attempt);
|
|
499
|
+
await delay(delayMs, request.request.signal ?? void 0);
|
|
500
|
+
}
|
|
501
|
+
throw new Error("unreachable");
|
|
502
|
+
};
|
|
590
503
|
};
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
});
|
|
607
|
-
return createProxy();
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/serviceClientRegistry/utils.ts
|
|
506
|
+
const isBuiltInProperty = (property) => typeof property === "symbol" || property === "then" || property === "constructor" || property === "toString" || property === "valueOf";
|
|
507
|
+
/**
|
|
508
|
+
* Creates a dummy client that intercepts method calls and invokes the provided onCall callback.
|
|
509
|
+
*/
|
|
510
|
+
const createDummyClient = ({ onCall }) => {
|
|
511
|
+
const createProxy = (path = []) => new Proxy(() => {}, {
|
|
512
|
+
get: (_target, prop) => {
|
|
513
|
+
if (isBuiltInProperty(prop)) return void 0;
|
|
514
|
+
return createProxy([...path, prop]);
|
|
515
|
+
},
|
|
516
|
+
apply: (_target, _thisArgs, args) => onCall(path, args)
|
|
517
|
+
});
|
|
518
|
+
return createProxy();
|
|
608
519
|
};
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
});
|
|
649
|
-
});
|
|
650
|
-
return {
|
|
651
|
-
client: clientMap,
|
|
652
|
-
meta: clientMeta
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
};
|
|
656
|
-
return registry;
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/serviceClientRegistry/createServiceClientRegistry.ts
|
|
522
|
+
const createServiceClientRegistry = () => ({ getServiceBaseUrl, onUnavailable }) => {
|
|
523
|
+
const dummy = (serviceId, clientName) => createDummyClient({ onCall: (path, args) => {
|
|
524
|
+
onUnavailable?.({
|
|
525
|
+
serviceId,
|
|
526
|
+
path,
|
|
527
|
+
args,
|
|
528
|
+
clientName
|
|
529
|
+
});
|
|
530
|
+
} });
|
|
531
|
+
const configs = [];
|
|
532
|
+
const resolveClient = ({ serviceId, clientFn, clientName }) => {
|
|
533
|
+
const serviceBaseUrl = getServiceBaseUrl(serviceId);
|
|
534
|
+
return serviceBaseUrl ? clientFn(serviceBaseUrl) : dummy(serviceId, clientName);
|
|
535
|
+
};
|
|
536
|
+
const registry = {
|
|
537
|
+
add: (config) => {
|
|
538
|
+
configs.push(config);
|
|
539
|
+
return registry;
|
|
540
|
+
},
|
|
541
|
+
build: () => {
|
|
542
|
+
const clientMap = {};
|
|
543
|
+
const clientMeta = [];
|
|
544
|
+
configs.forEach((config) => {
|
|
545
|
+
clientMap[config.clientName] = resolveClient(config);
|
|
546
|
+
clientMeta.push({
|
|
547
|
+
clientName: config.clientName,
|
|
548
|
+
serviceId: config.serviceId,
|
|
549
|
+
isAvailable: !!getServiceBaseUrl(config.serviceId)
|
|
550
|
+
});
|
|
551
|
+
});
|
|
552
|
+
return {
|
|
553
|
+
client: clientMap,
|
|
554
|
+
meta: clientMeta
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
return registry;
|
|
657
559
|
};
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
560
|
+
//#endregion
|
|
561
|
+
//#region src/keboola/createApi.ts
|
|
562
|
+
const createApi = (state) => new Proxy({}, { get(_target, property) {
|
|
563
|
+
if (isBuiltInProperty(property)) return void 0;
|
|
564
|
+
if (property === "auth") {
|
|
565
|
+
const authClient = state.getAuthClient();
|
|
566
|
+
assert$1(authClient, KeboolaErrorType.Unconfigured);
|
|
567
|
+
return authClient;
|
|
568
|
+
}
|
|
569
|
+
if (property === "management") {
|
|
570
|
+
const management = state.getManagementClient();
|
|
571
|
+
assert$1(management, KeboolaErrorType.NoManagementToken);
|
|
572
|
+
return management;
|
|
573
|
+
}
|
|
574
|
+
const clients = state.getProjectClients();
|
|
575
|
+
assert$1(clients, KeboolaErrorType.NotReady);
|
|
576
|
+
return clients[property];
|
|
577
|
+
} });
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region src/keboola/createMiddlewareFor.ts
|
|
580
|
+
const createMiddlewareFor = (middlewares) => {
|
|
581
|
+
return (target, baseline = []) => {
|
|
582
|
+
if (Array.isArray(middlewares)) return [...baseline, ...middlewares];
|
|
583
|
+
const all = middlewares?.all ?? [];
|
|
584
|
+
const targeted = middlewares?.[target] ?? [];
|
|
585
|
+
return [
|
|
586
|
+
...baseline,
|
|
587
|
+
...all,
|
|
588
|
+
...targeted
|
|
589
|
+
];
|
|
590
|
+
};
|
|
687
591
|
};
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const store = createStore(initial);
|
|
694
|
-
let expiredNotified = false;
|
|
695
|
-
const setBaseUrl = (baseUrl) => {
|
|
696
|
-
if (store.get().status !== "anonymous")
|
|
697
|
-
throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
|
|
698
|
-
store.set({ status: "anonymous", baseUrl });
|
|
699
|
-
};
|
|
700
|
-
const authenticate = (tokens) => {
|
|
701
|
-
const state = store.get();
|
|
702
|
-
if (state.status !== "anonymous") throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
|
|
703
|
-
if (!state.baseUrl) throw new KeboolaError(KeboolaErrorType.Unconfigured);
|
|
704
|
-
expiredNotified = false;
|
|
705
|
-
store.set({ status: "authenticated", baseUrl: state.baseUrl, credential: stamp(tokens) });
|
|
706
|
-
};
|
|
707
|
-
const setProjectId = (projectId) => {
|
|
708
|
-
const state = store.get();
|
|
709
|
-
if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
710
|
-
store.set({
|
|
711
|
-
status: "scoped",
|
|
712
|
-
baseUrl: state.baseUrl,
|
|
713
|
-
credential: state.credential,
|
|
714
|
-
projectId
|
|
715
|
-
});
|
|
716
|
-
};
|
|
717
|
-
const clearProjectId = () => {
|
|
718
|
-
const state = store.get();
|
|
719
|
-
if (state.status !== "scoped") return;
|
|
720
|
-
store.set({ status: "authenticated", baseUrl: state.baseUrl, credential: state.credential });
|
|
721
|
-
};
|
|
722
|
-
const reset = () => {
|
|
723
|
-
store.set({ status: "anonymous", baseUrl: store.get().baseUrl });
|
|
724
|
-
};
|
|
725
|
-
const applyRefresh = (tokens) => {
|
|
726
|
-
const state = store.get();
|
|
727
|
-
if (state.status === "anonymous") return;
|
|
728
|
-
store.set({ ...state, credential: stamp(tokens) });
|
|
729
|
-
};
|
|
730
|
-
const forceExpire = () => {
|
|
731
|
-
const state = store.get();
|
|
732
|
-
if (state.status === "anonymous") return;
|
|
733
|
-
const issuedAt = Date.now() - state.credential.expiresIn * 1e3;
|
|
734
|
-
store.set({ ...state, credential: { ...state.credential, issuedAt } });
|
|
735
|
-
};
|
|
736
|
-
const requireCredential = () => {
|
|
737
|
-
const state = store.get();
|
|
738
|
-
if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
739
|
-
return state.credential;
|
|
740
|
-
};
|
|
741
|
-
const getBaseUrl = () => store.get().baseUrl;
|
|
742
|
-
const notifyExpired = () => {
|
|
743
|
-
if (expiredNotified) return false;
|
|
744
|
-
expiredNotified = true;
|
|
745
|
-
return true;
|
|
746
|
-
};
|
|
747
|
-
const debug = () => store.get();
|
|
748
|
-
const readable = {
|
|
749
|
-
get: store.get,
|
|
750
|
-
subscribe: store.subscribe,
|
|
751
|
-
dispose: store.dispose
|
|
752
|
-
};
|
|
753
|
-
return {
|
|
754
|
-
store: readable,
|
|
755
|
-
setBaseUrl,
|
|
756
|
-
authenticate,
|
|
757
|
-
setProjectId,
|
|
758
|
-
clearProjectId,
|
|
759
|
-
reset,
|
|
760
|
-
applyRefresh,
|
|
761
|
-
forceExpire,
|
|
762
|
-
requireCredential,
|
|
763
|
-
getBaseUrl,
|
|
764
|
-
notifyExpired,
|
|
765
|
-
debug
|
|
766
|
-
};
|
|
592
|
+
//#endregion
|
|
593
|
+
//#region src/keboola/bearer/createConfig.ts
|
|
594
|
+
const INITIAL = {
|
|
595
|
+
status: "anonymous",
|
|
596
|
+
baseUrl: null
|
|
767
597
|
};
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
598
|
+
const stamp = (tokens) => ({
|
|
599
|
+
...tokens,
|
|
600
|
+
issuedAt: Date.now()
|
|
601
|
+
});
|
|
602
|
+
const createConfig$1 = (initial = INITIAL) => {
|
|
603
|
+
const store = createStore(initial);
|
|
604
|
+
let expiredNotified = false;
|
|
605
|
+
const setBaseUrl = (baseUrl) => {
|
|
606
|
+
if (store.get().status !== "anonymous") throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
|
|
607
|
+
store.set({
|
|
608
|
+
status: "anonymous",
|
|
609
|
+
baseUrl
|
|
610
|
+
});
|
|
611
|
+
};
|
|
612
|
+
const authenticate = (tokens) => {
|
|
613
|
+
const state = store.get();
|
|
614
|
+
if (state.status !== "anonymous") throw new KeboolaError(KeboolaErrorType.AlreadyAuthenticated);
|
|
615
|
+
if (!state.baseUrl) throw new KeboolaError(KeboolaErrorType.Unconfigured);
|
|
616
|
+
expiredNotified = false;
|
|
617
|
+
store.set({
|
|
618
|
+
status: "authenticated",
|
|
619
|
+
baseUrl: state.baseUrl,
|
|
620
|
+
credential: stamp(tokens)
|
|
621
|
+
});
|
|
622
|
+
};
|
|
623
|
+
const setProjectId = (projectId) => {
|
|
624
|
+
const state = store.get();
|
|
625
|
+
if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
626
|
+
store.set({
|
|
627
|
+
status: "scoped",
|
|
628
|
+
baseUrl: state.baseUrl,
|
|
629
|
+
credential: state.credential,
|
|
630
|
+
projectId
|
|
631
|
+
});
|
|
632
|
+
};
|
|
633
|
+
/**
|
|
634
|
+
* Drop the project scope, keeping the credential — the inverse of `setProjectId`, for leaving a
|
|
635
|
+
* project without signing out. The project clients are keyed on the scope, so they tear down and
|
|
636
|
+
* the storage build returns to `idle`; the session stays usable for `auth` and `management`.
|
|
637
|
+
* No-op unless currently scoped.
|
|
638
|
+
*/
|
|
639
|
+
const clearProjectId = () => {
|
|
640
|
+
const state = store.get();
|
|
641
|
+
if (state.status !== "scoped") return;
|
|
642
|
+
store.set({
|
|
643
|
+
status: "authenticated",
|
|
644
|
+
baseUrl: state.baseUrl,
|
|
645
|
+
credential: state.credential
|
|
646
|
+
});
|
|
647
|
+
};
|
|
648
|
+
/** Drop the credential (sign out); keeps the configured baseUrl. */
|
|
649
|
+
const reset = () => {
|
|
650
|
+
store.set({
|
|
651
|
+
status: "anonymous",
|
|
652
|
+
baseUrl: store.get().baseUrl
|
|
653
|
+
});
|
|
654
|
+
};
|
|
655
|
+
/** Apply a token refresh: replace the credential (fresh tokens, new issue time); no-op before auth. */
|
|
656
|
+
const applyRefresh = (tokens) => {
|
|
657
|
+
const state = store.get();
|
|
658
|
+
if (state.status === "anonymous") return;
|
|
659
|
+
store.set({
|
|
660
|
+
...state,
|
|
661
|
+
credential: stamp(tokens)
|
|
662
|
+
});
|
|
663
|
+
};
|
|
664
|
+
/**
|
|
665
|
+
* Dev/test lever: backdate the current token's issue time by a full lifetime so it reads as
|
|
666
|
+
* expired, making the refresh policy rotate it on the next request. No-op before auth.
|
|
667
|
+
*/
|
|
668
|
+
const forceExpire = () => {
|
|
669
|
+
const state = store.get();
|
|
670
|
+
if (state.status === "anonymous") return;
|
|
671
|
+
const issuedAt = Date.now() - state.credential.expiresIn * 1e3;
|
|
672
|
+
store.set({
|
|
673
|
+
...state,
|
|
674
|
+
credential: {
|
|
675
|
+
...state.credential,
|
|
676
|
+
issuedAt
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
};
|
|
680
|
+
/**
|
|
681
|
+
* The current credential, asserting the session is authenticated (or scoped). Single point for that
|
|
682
|
+
* check so callers (token attach, refresh) don't each re-narrow the state.
|
|
683
|
+
*/
|
|
684
|
+
const requireCredential = () => {
|
|
685
|
+
const state = store.get();
|
|
686
|
+
if (state.status === "anonymous") throw new KeboolaError(KeboolaErrorType.NotAuthenticated);
|
|
687
|
+
return state.credential;
|
|
688
|
+
};
|
|
689
|
+
const getBaseUrl = () => store.get().baseUrl;
|
|
690
|
+
/**
|
|
691
|
+
* Session-expiry latch (fire-once):
|
|
692
|
+
* - why: concurrent 401s all report expiry, but the app must sign out once; and the credential /
|
|
693
|
+
* auth middleware are long-lived singletons, so the latch can't live in them — it must reset
|
|
694
|
+
* per session.
|
|
695
|
+
* - how: returns `true` only for the first call since the last `authenticate` (which re-arms it),
|
|
696
|
+
* so the caller runs its sign-out exactly once per session death.
|
|
697
|
+
*/
|
|
698
|
+
const notifyExpired = () => {
|
|
699
|
+
if (expiredNotified) return false;
|
|
700
|
+
expiredNotified = true;
|
|
701
|
+
return true;
|
|
702
|
+
};
|
|
703
|
+
const debug = () => store.get();
|
|
704
|
+
return {
|
|
705
|
+
store: {
|
|
706
|
+
get: store.get,
|
|
707
|
+
subscribe: store.subscribe,
|
|
708
|
+
dispose: store.dispose
|
|
709
|
+
},
|
|
710
|
+
setBaseUrl,
|
|
711
|
+
authenticate,
|
|
712
|
+
setProjectId,
|
|
713
|
+
clearProjectId,
|
|
714
|
+
reset,
|
|
715
|
+
applyRefresh,
|
|
716
|
+
forceExpire,
|
|
717
|
+
requireCredential,
|
|
718
|
+
getBaseUrl,
|
|
719
|
+
notifyExpired,
|
|
720
|
+
debug
|
|
721
|
+
};
|
|
784
722
|
};
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
723
|
+
//#endregion
|
|
724
|
+
//#region src/domain/defaultBranch.ts
|
|
725
|
+
const createDefaultBranch = ({ devBranches }) => {
|
|
726
|
+
const defaultBranch = devBranches.find((branch) => branch.isDefault);
|
|
727
|
+
assert(defaultBranch, "No default branch found for the project.");
|
|
728
|
+
const getType = (branchId) => {
|
|
729
|
+
if (branchId == null || branchId === "default") return "default";
|
|
730
|
+
return Number(branchId) === defaultBranch.id ? "default" : "dev";
|
|
731
|
+
};
|
|
732
|
+
return {
|
|
733
|
+
id: defaultBranch.id,
|
|
734
|
+
name: defaultBranch.name,
|
|
735
|
+
getType,
|
|
736
|
+
isDev: (branchId) => getType(branchId) === "dev",
|
|
737
|
+
isDefault: (branchId) => getType(branchId) === "default"
|
|
738
|
+
};
|
|
791
739
|
};
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
740
|
+
//#endregion
|
|
741
|
+
//#region src/domain/stack.ts
|
|
742
|
+
const SERVICE_URL_OVERRIDES = { "kai-assistant": (url) => `${url}/api` };
|
|
743
|
+
const createStack = ({ stackInfo, clientServiceUrls }) => {
|
|
744
|
+
const { services, components, features, ...infoRest } = stackInfo;
|
|
745
|
+
const serviceMap = new Map(services.map((service) => {
|
|
746
|
+
const devOverride = clientServiceUrls?.[service.id]?.(service.url);
|
|
747
|
+
const prodOverride = SERVICE_URL_OVERRIDES[service.id]?.(service.url);
|
|
748
|
+
const url = devOverride ?? prodOverride ?? service.url;
|
|
749
|
+
return [service.id, url];
|
|
750
|
+
}));
|
|
751
|
+
const componentMap = new Map(components.map((component) => [component.id, component]));
|
|
752
|
+
const featureSet = new Set(features);
|
|
753
|
+
const hasFeature = (...feature) => {
|
|
754
|
+
if (feature.length === 0) return false;
|
|
755
|
+
return feature.every((x) => featureSet.has(x));
|
|
756
|
+
};
|
|
757
|
+
const hasComponent = (...componentId) => {
|
|
758
|
+
if (componentId.length === 0) return false;
|
|
759
|
+
return componentId.every((x) => componentMap.has(x));
|
|
760
|
+
};
|
|
761
|
+
const getComponent = (componentId) => componentMap.get(componentId) ?? null;
|
|
762
|
+
const hasService = (serviceId) => serviceMap.has(serviceId);
|
|
763
|
+
const getServiceUrl = (serviceId) => serviceMap.get(serviceId) ?? null;
|
|
764
|
+
return {
|
|
765
|
+
...infoRest,
|
|
766
|
+
services,
|
|
767
|
+
features,
|
|
768
|
+
components,
|
|
769
|
+
hasFeature,
|
|
770
|
+
getServiceUrl,
|
|
771
|
+
hasService,
|
|
772
|
+
getComponent,
|
|
773
|
+
hasComponent
|
|
774
|
+
};
|
|
826
775
|
};
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region src/sdks/variables/variablesSdk.ts
|
|
778
|
+
const VARIABLES_COMPONENT_ID = "keboola.variables";
|
|
779
|
+
/** Union the definitions by name; on a name conflict the target's definition is kept. */
|
|
780
|
+
const mergeVariableDefinitions = (target, source) => {
|
|
781
|
+
const targetNames = new Set(target.map((definition) => definition.name));
|
|
782
|
+
return [...target, ...source.filter((definition) => !targetNames.has(definition.name))];
|
|
833
783
|
};
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
];
|
|
784
|
+
/** Add values missing in the target; on a name conflict the value is updated to the source's. */
|
|
785
|
+
const mergeVariableValues = (target, source) => {
|
|
786
|
+
const sourceByName = new Map(source.map((value) => [value.name, value.value]));
|
|
787
|
+
const targetNames = new Set(target.map((value) => value.name));
|
|
788
|
+
return [...target.map((value) => sourceByName.has(value.name) ? {
|
|
789
|
+
...value,
|
|
790
|
+
value: sourceByName.get(value.name)
|
|
791
|
+
} : value), ...source.filter((value) => !targetNames.has(value.name))];
|
|
843
792
|
};
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
const [target, source] = await Promise.all([
|
|
909
|
-
readVariables(targetVariablesId, targetValuesId, branchId),
|
|
910
|
-
readVariables(sourceVariablesId, sourceValuesId, branchId)
|
|
911
|
-
]);
|
|
912
|
-
return createVariables(
|
|
913
|
-
mergeVariableDefinitions(target.definitions, source.definitions),
|
|
914
|
-
mergeVariableValues(target.values, source.values),
|
|
915
|
-
branchId
|
|
916
|
-
);
|
|
917
|
-
}
|
|
918
|
-
};
|
|
793
|
+
/**
|
|
794
|
+
* Orchestration for `keboola.variables` configs: copy a config, or merge two configs into a fresh
|
|
795
|
+
* one (union definitions, upsert values — source wins on a name conflict). Each result is a brand
|
|
796
|
+
* new config + values row, so the caller can reference it without sharing lineage with the source.
|
|
797
|
+
*/
|
|
798
|
+
const createVariablesSdk = ({ storageClient }) => {
|
|
799
|
+
const configs = storageClient.configurations;
|
|
800
|
+
const rows = storageClient.configurationRows;
|
|
801
|
+
const readVariables = async (configId, valuesRowId, branchId) => {
|
|
802
|
+
const config = await configs.getConfiguration({
|
|
803
|
+
componentId: VARIABLES_COMPONENT_ID,
|
|
804
|
+
configId,
|
|
805
|
+
branchId
|
|
806
|
+
});
|
|
807
|
+
const row = config.rows.find((candidate) => candidate.id === valuesRowId) ?? config.rows[0];
|
|
808
|
+
const rawDefinitions = config.configuration?.variables;
|
|
809
|
+
const rawValues = row?.configuration?.values;
|
|
810
|
+
return {
|
|
811
|
+
definitions: Array.isArray(rawDefinitions) ? rawDefinitions : [],
|
|
812
|
+
values: Array.isArray(rawValues) ? rawValues : []
|
|
813
|
+
};
|
|
814
|
+
};
|
|
815
|
+
const createVariables = async (definitions, values, branchId) => {
|
|
816
|
+
const config = await configs.createConfiguration({
|
|
817
|
+
branchId,
|
|
818
|
+
componentId: VARIABLES_COMPONENT_ID,
|
|
819
|
+
name: "Variables definition",
|
|
820
|
+
configuration: { variables: definitions }
|
|
821
|
+
});
|
|
822
|
+
try {
|
|
823
|
+
const row = await rows.createConfigurationRow({
|
|
824
|
+
branchId: String(branchId),
|
|
825
|
+
componentId: VARIABLES_COMPONENT_ID,
|
|
826
|
+
configurationId: config.id,
|
|
827
|
+
name: "Default values",
|
|
828
|
+
configuration: { values }
|
|
829
|
+
});
|
|
830
|
+
return {
|
|
831
|
+
variablesId: config.id,
|
|
832
|
+
variablesValuesId: row.id
|
|
833
|
+
};
|
|
834
|
+
} catch (error) {
|
|
835
|
+
await configs.deleteConfiguration({
|
|
836
|
+
branchId,
|
|
837
|
+
componentId: VARIABLES_COMPONENT_ID,
|
|
838
|
+
configId: config.id
|
|
839
|
+
}).catch((cleanupError) => {
|
|
840
|
+
if (error instanceof Error && error.cause === void 0) error.cause = cleanupError;
|
|
841
|
+
});
|
|
842
|
+
throw error;
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
return {
|
|
846
|
+
/** Copy a variables config into a fresh, independent config + values row. */
|
|
847
|
+
copy: async ({ variablesId, variablesValuesId, branchId = "default" }) => {
|
|
848
|
+
const { definitions, values } = await readVariables(variablesId, variablesValuesId, branchId);
|
|
849
|
+
return createVariables(definitions, values, branchId);
|
|
850
|
+
},
|
|
851
|
+
/** Merge the source's variables into the target's and create a fresh merged config + values row. */
|
|
852
|
+
merge: async ({ targetVariablesId, targetValuesId, sourceVariablesId, sourceValuesId, branchId = "default" }) => {
|
|
853
|
+
const [target, source] = await Promise.all([readVariables(targetVariablesId, targetValuesId, branchId), readVariables(sourceVariablesId, sourceValuesId, branchId)]);
|
|
854
|
+
return createVariables(mergeVariableDefinitions(target.definitions, source.definitions), mergeVariableValues(target.values, source.values), branchId);
|
|
855
|
+
}
|
|
856
|
+
};
|
|
919
857
|
};
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
var userAgentSettingsSchema = z.object({
|
|
928
|
-
projectId: z.string(),
|
|
929
|
-
userId: z.string(),
|
|
930
|
-
customInstructions: z.string().nullable(),
|
|
931
|
-
toolPermissions: z.record(z.string(), toolPermissionValueSchema).nullable(),
|
|
932
|
-
createdAt: z.string(),
|
|
933
|
-
updatedAt: z.string()
|
|
934
|
-
});
|
|
935
|
-
var toolInfoSchema = z.object({
|
|
936
|
-
name: z.string(),
|
|
937
|
-
description: z.string(),
|
|
938
|
-
readOnly: z.boolean()
|
|
939
|
-
});
|
|
940
|
-
var toolsListResponseSchema = z.object({
|
|
941
|
-
tools: z.array(toolInfoSchema)
|
|
858
|
+
//#endregion
|
|
859
|
+
//#region src/clients/kaiAgent/kaiAgentClient.ts
|
|
860
|
+
const agentSettingsSchema = z.object({
|
|
861
|
+
projectId: z.string(),
|
|
862
|
+
customInstructions: z.string().nullable(),
|
|
863
|
+
createdAt: z.string(),
|
|
864
|
+
updatedAt: z.string()
|
|
942
865
|
});
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
866
|
+
const toolPermissionValueSchema = z.enum([
|
|
867
|
+
"always_allow",
|
|
868
|
+
"always_ask",
|
|
869
|
+
"blocked"
|
|
870
|
+
]);
|
|
871
|
+
const userAgentSettingsSchema = z.object({
|
|
872
|
+
projectId: z.string(),
|
|
873
|
+
userId: z.string(),
|
|
874
|
+
customInstructions: z.string().nullable(),
|
|
875
|
+
toolPermissions: z.record(z.string(), toolPermissionValueSchema).nullable(),
|
|
876
|
+
createdAt: z.string(),
|
|
877
|
+
updatedAt: z.string()
|
|
947
878
|
});
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
879
|
+
const toolInfoSchema = z.object({
|
|
880
|
+
name: z.string(),
|
|
881
|
+
description: z.string(),
|
|
882
|
+
readOnly: z.boolean()
|
|
951
883
|
});
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
884
|
+
const toolsListResponseSchema = z.object({ tools: z.array(toolInfoSchema) });
|
|
885
|
+
const skillInfoSchema = z.object({
|
|
886
|
+
name: z.string(),
|
|
887
|
+
description: z.string().nullable(),
|
|
888
|
+
source: z.enum([
|
|
889
|
+
"first-party",
|
|
890
|
+
"vendored",
|
|
891
|
+
"project"
|
|
892
|
+
])
|
|
955
893
|
});
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
type: z.enum(["file", "dir"]),
|
|
960
|
-
size: z.number().int().nonnegative().optional()
|
|
894
|
+
const builtInCommandSchema = z.object({
|
|
895
|
+
name: z.string(),
|
|
896
|
+
description: z.string()
|
|
961
897
|
});
|
|
962
|
-
|
|
963
|
-
|
|
898
|
+
const skillsListResponseSchema = z.object({
|
|
899
|
+
skills: z.array(skillInfoSchema),
|
|
900
|
+
commands: z.array(builtInCommandSchema)
|
|
964
901
|
});
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
902
|
+
const sandboxFileEntrySchema = z.object({
|
|
903
|
+
name: z.string(),
|
|
904
|
+
path: z.string(),
|
|
905
|
+
type: z.enum(["file", "dir"]),
|
|
906
|
+
size: z.number().int().nonnegative().optional()
|
|
970
907
|
});
|
|
971
|
-
|
|
972
|
-
|
|
908
|
+
const sandboxFileListingSchema = z.object({ entries: z.array(sandboxFileEntrySchema) });
|
|
909
|
+
const sandboxFileContentSchema = z.object({
|
|
910
|
+
content: z.string(),
|
|
911
|
+
encoding: z.enum(["utf-8", "binary"]),
|
|
912
|
+
truncated: z.boolean(),
|
|
913
|
+
size: z.number().int().nonnegative()
|
|
973
914
|
});
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
)
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
return result.data;
|
|
1121
|
-
};
|
|
1122
|
-
const getSandboxGitBranch = async (chatId, signal) => {
|
|
1123
|
-
const { data } = await genericClient.get(
|
|
1124
|
-
`/api/chat/${encodeURIComponent(chatId)}/sandbox/git-branch`,
|
|
1125
|
-
{},
|
|
1126
|
-
{ signal }
|
|
1127
|
-
);
|
|
1128
|
-
const result = sandboxGitBranchSchema.safeParse(data);
|
|
1129
|
-
if (!result.success) {
|
|
1130
|
-
throw new Error("Invalid sandbox git-branch response format");
|
|
1131
|
-
}
|
|
1132
|
-
return result.data;
|
|
1133
|
-
};
|
|
1134
|
-
const chatStreamUrl = clientOptions.baseUrl + "/api/chat";
|
|
1135
|
-
const healthCheck = async (signal) => {
|
|
1136
|
-
const { data } = await genericClient.get("/health", {}, { signal });
|
|
1137
|
-
return data;
|
|
1138
|
-
};
|
|
1139
|
-
return {
|
|
1140
|
-
healthCheck,
|
|
1141
|
-
getHistory,
|
|
1142
|
-
getChat,
|
|
1143
|
-
deleteChat,
|
|
1144
|
-
createChat,
|
|
1145
|
-
getVotes,
|
|
1146
|
-
submitVote,
|
|
1147
|
-
getUsage,
|
|
1148
|
-
approveToolCall,
|
|
1149
|
-
submitToolOutput,
|
|
1150
|
-
stopChat,
|
|
1151
|
-
getSuggestions,
|
|
1152
|
-
getAgentSettings,
|
|
1153
|
-
updateAgentSettings,
|
|
1154
|
-
getUserAgentSettings,
|
|
1155
|
-
updateUserAgentSettings,
|
|
1156
|
-
getToolsList,
|
|
1157
|
-
getSkillsList,
|
|
1158
|
-
listSandboxFiles,
|
|
1159
|
-
readSandboxFile,
|
|
1160
|
-
getSandboxGitBranch,
|
|
1161
|
-
chatStreamUrl
|
|
1162
|
-
};
|
|
915
|
+
const sandboxGitBranchSchema = z.object({ branch: z.string().nullable() });
|
|
916
|
+
const votesResponseSchema = z.array(z.object({
|
|
917
|
+
chatId: z.string(),
|
|
918
|
+
messageId: z.string(),
|
|
919
|
+
isUpvoted: z.boolean()
|
|
920
|
+
}));
|
|
921
|
+
const createKaiAgentClient = ({ baseUrl, middlewares, auth }) => {
|
|
922
|
+
const clientOptions = {
|
|
923
|
+
baseUrl,
|
|
924
|
+
middlewares,
|
|
925
|
+
headers: createAuthHeaders(auth)
|
|
926
|
+
};
|
|
927
|
+
const client = createOpenapiFetchClient(clientOptions);
|
|
928
|
+
const genericClient = createGenericFetchClient(clientOptions);
|
|
929
|
+
const getHistory = async (params) => {
|
|
930
|
+
const { data } = await client.get("/api/history", { query: params });
|
|
931
|
+
return data;
|
|
932
|
+
};
|
|
933
|
+
const getChat = async (chatId, signal) => {
|
|
934
|
+
const { data } = await client.get("/api/chat/{id}", { path: { id: chatId } }, { signal });
|
|
935
|
+
return data;
|
|
936
|
+
};
|
|
937
|
+
const deleteChat = async (chatId) => {
|
|
938
|
+
const { data } = await client.delete("/api/chat", { query: { id: chatId } });
|
|
939
|
+
return data;
|
|
940
|
+
};
|
|
941
|
+
const createChat = async (request) => {
|
|
942
|
+
const { response } = await client.post("/api/chat", { body: request });
|
|
943
|
+
return response;
|
|
944
|
+
};
|
|
945
|
+
const getVotes = async (chatId) => {
|
|
946
|
+
const { data } = await client.get("/api/vote", { query: { chatId } });
|
|
947
|
+
const result = votesResponseSchema.safeParse(data);
|
|
948
|
+
if (!result.success) throw new Error("Invalid votes response format");
|
|
949
|
+
return result.data;
|
|
950
|
+
};
|
|
951
|
+
const submitVote = async (params) => {
|
|
952
|
+
await client.patch("/api/vote", { body: params });
|
|
953
|
+
};
|
|
954
|
+
const getUsage = async (signal) => {
|
|
955
|
+
const { data } = await client.get("/api/usage", {}, { signal });
|
|
956
|
+
return data;
|
|
957
|
+
};
|
|
958
|
+
const approveToolCall = async (chatId, body) => {
|
|
959
|
+
await client.post("/api/chat/{id}/approval", {
|
|
960
|
+
path: { id: chatId },
|
|
961
|
+
body
|
|
962
|
+
});
|
|
963
|
+
};
|
|
964
|
+
const submitToolOutput = async (chatId, body) => {
|
|
965
|
+
await client.post("/api/chat/{id}/ui-tool-result", {
|
|
966
|
+
path: { id: chatId },
|
|
967
|
+
body
|
|
968
|
+
});
|
|
969
|
+
};
|
|
970
|
+
const stopChat = async (chatId) => {
|
|
971
|
+
const { data } = await client.post("/api/chat/{id}/stop", { path: { id: chatId } });
|
|
972
|
+
return data;
|
|
973
|
+
};
|
|
974
|
+
const getSuggestions = async (request, signal) => {
|
|
975
|
+
const { data } = await client.post("/api/suggestions", { body: request }, { signal });
|
|
976
|
+
return data;
|
|
977
|
+
};
|
|
978
|
+
const getAgentSettings = async (signal) => {
|
|
979
|
+
const { data } = await genericClient.get("/api/settings", {}, { signal });
|
|
980
|
+
const result = agentSettingsSchema.safeParse(data);
|
|
981
|
+
if (!result.success) throw new Error("Invalid agent settings response format");
|
|
982
|
+
return result.data;
|
|
983
|
+
};
|
|
984
|
+
const updateAgentSettings = async (request, signal) => {
|
|
985
|
+
const { data } = await genericClient.patch("/api/settings", { body: request }, { signal });
|
|
986
|
+
const result = agentSettingsSchema.safeParse(data);
|
|
987
|
+
if (!result.success) throw new Error("Invalid agent settings response format");
|
|
988
|
+
return result.data;
|
|
989
|
+
};
|
|
990
|
+
const getUserAgentSettings = async (signal) => {
|
|
991
|
+
const { data } = await genericClient.get("/api/settings/user", {}, { signal });
|
|
992
|
+
const result = userAgentSettingsSchema.safeParse(data);
|
|
993
|
+
if (!result.success) throw new Error("Invalid user agent settings response format");
|
|
994
|
+
return result.data;
|
|
995
|
+
};
|
|
996
|
+
const updateUserAgentSettings = async (request, signal) => {
|
|
997
|
+
const { data } = await genericClient.patch("/api/settings/user", { body: request }, { signal });
|
|
998
|
+
const result = userAgentSettingsSchema.safeParse(data);
|
|
999
|
+
if (!result.success) throw new Error("Invalid user agent settings response format");
|
|
1000
|
+
return result.data;
|
|
1001
|
+
};
|
|
1002
|
+
const getToolsList = async (signal) => {
|
|
1003
|
+
const { data } = await genericClient.get("/api/settings/tools", {}, { signal });
|
|
1004
|
+
const result = toolsListResponseSchema.safeParse(data);
|
|
1005
|
+
if (!result.success) throw new Error("Invalid tools list response format");
|
|
1006
|
+
return result.data;
|
|
1007
|
+
};
|
|
1008
|
+
const getSkillsList = async (signal) => {
|
|
1009
|
+
const { data } = await genericClient.get("/api/skills", {}, { signal });
|
|
1010
|
+
const result = skillsListResponseSchema.safeParse(data);
|
|
1011
|
+
if (!result.success) throw new Error("Invalid skills list response format");
|
|
1012
|
+
return result.data;
|
|
1013
|
+
};
|
|
1014
|
+
const listSandboxFiles = async (chatId, path, signal) => {
|
|
1015
|
+
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/files`, { query: path ? { path } : void 0 }, { signal });
|
|
1016
|
+
const result = sandboxFileListingSchema.safeParse(data);
|
|
1017
|
+
if (!result.success) throw new Error("Invalid sandbox files response format");
|
|
1018
|
+
return result.data;
|
|
1019
|
+
};
|
|
1020
|
+
const readSandboxFile = async (chatId, path, signal) => {
|
|
1021
|
+
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/file`, { query: { path } }, { signal });
|
|
1022
|
+
const result = sandboxFileContentSchema.safeParse(data);
|
|
1023
|
+
if (!result.success) throw new Error("Invalid sandbox file response format");
|
|
1024
|
+
return result.data;
|
|
1025
|
+
};
|
|
1026
|
+
const getSandboxGitBranch = async (chatId, signal) => {
|
|
1027
|
+
const { data } = await genericClient.get(`/api/chat/${encodeURIComponent(chatId)}/sandbox/git-branch`, {}, { signal });
|
|
1028
|
+
const result = sandboxGitBranchSchema.safeParse(data);
|
|
1029
|
+
if (!result.success) throw new Error("Invalid sandbox git-branch response format");
|
|
1030
|
+
return result.data;
|
|
1031
|
+
};
|
|
1032
|
+
const chatStreamUrl = clientOptions.baseUrl + "/api/chat";
|
|
1033
|
+
const healthCheck = async (signal) => {
|
|
1034
|
+
const { data } = await genericClient.get("/health", {}, { signal });
|
|
1035
|
+
return data;
|
|
1036
|
+
};
|
|
1037
|
+
return {
|
|
1038
|
+
healthCheck,
|
|
1039
|
+
getHistory,
|
|
1040
|
+
getChat,
|
|
1041
|
+
deleteChat,
|
|
1042
|
+
createChat,
|
|
1043
|
+
getVotes,
|
|
1044
|
+
submitVote,
|
|
1045
|
+
getUsage,
|
|
1046
|
+
approveToolCall,
|
|
1047
|
+
submitToolOutput,
|
|
1048
|
+
stopChat,
|
|
1049
|
+
getSuggestions,
|
|
1050
|
+
getAgentSettings,
|
|
1051
|
+
updateAgentSettings,
|
|
1052
|
+
getUserAgentSettings,
|
|
1053
|
+
updateUserAgentSettings,
|
|
1054
|
+
getToolsList,
|
|
1055
|
+
getSkillsList,
|
|
1056
|
+
listSandboxFiles,
|
|
1057
|
+
readSandboxFile,
|
|
1058
|
+
getSandboxGitBranch,
|
|
1059
|
+
chatStreamUrl
|
|
1060
|
+
};
|
|
1163
1061
|
};
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
attachTokenMiddleware
|
|
1172
|
-
}) => createServiceClientRegistry()({
|
|
1173
|
-
getServiceBaseUrl,
|
|
1174
|
-
onUnavailable: ({ serviceId, path, clientName }) => {
|
|
1175
|
-
throw new ServiceUnavailableError(serviceId, path, clientName);
|
|
1176
|
-
}
|
|
1062
|
+
//#endregion
|
|
1063
|
+
//#region src/keboola/createServiceClients.ts
|
|
1064
|
+
const createServiceClients = ({ baseUrl, auth, getServiceBaseUrl, middlewareFor, attachTokenMiddleware }) => createServiceClientRegistry()({
|
|
1065
|
+
getServiceBaseUrl,
|
|
1066
|
+
onUnavailable: ({ serviceId, path, clientName }) => {
|
|
1067
|
+
throw new ServiceUnavailableError(serviceId, path, clientName);
|
|
1068
|
+
}
|
|
1177
1069
|
}).add({
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1070
|
+
serviceId: "vault",
|
|
1071
|
+
clientName: "vault",
|
|
1072
|
+
clientFn: (serviceBaseUrl) => createVaultClient({
|
|
1073
|
+
baseUrl: serviceBaseUrl,
|
|
1074
|
+
middlewares: middlewareFor("vault", [attachTokenMiddleware]),
|
|
1075
|
+
auth
|
|
1076
|
+
})
|
|
1185
1077
|
}).add({
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1078
|
+
serviceId: "data-science",
|
|
1079
|
+
clientName: "dataScience",
|
|
1080
|
+
clientFn: (serviceBaseUrl) => createDataScienceClient({
|
|
1081
|
+
baseUrl: serviceBaseUrl,
|
|
1082
|
+
middlewares: middlewareFor("dataScience", [attachTokenMiddleware]),
|
|
1083
|
+
auth
|
|
1084
|
+
})
|
|
1193
1085
|
}).add({
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
clientName: "apps",
|
|
1202
|
-
clientFn: (serviceBaseUrl) => createAppsClient({
|
|
1203
|
-
baseUrl: `${serviceBaseUrl}/v2`,
|
|
1204
|
-
middlewares: middlewareFor("apps", [attachTokenMiddleware]),
|
|
1205
|
-
auth
|
|
1206
|
-
})
|
|
1086
|
+
serviceId: "data-science",
|
|
1087
|
+
clientName: "apps",
|
|
1088
|
+
clientFn: (serviceBaseUrl) => createAppsClient({
|
|
1089
|
+
baseUrl: `${serviceBaseUrl}/v2`,
|
|
1090
|
+
middlewares: middlewareFor("apps", [attachTokenMiddleware]),
|
|
1091
|
+
auth
|
|
1092
|
+
})
|
|
1207
1093
|
}).add({
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1094
|
+
serviceId: "encryption",
|
|
1095
|
+
clientName: "encryption",
|
|
1096
|
+
clientFn: (serviceBaseUrl) => createEncryptionClient({
|
|
1097
|
+
baseUrl: serviceBaseUrl,
|
|
1098
|
+
middlewares: middlewareFor("encryption")
|
|
1099
|
+
})
|
|
1214
1100
|
}).add({
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1101
|
+
serviceId: "editor",
|
|
1102
|
+
clientName: "editor",
|
|
1103
|
+
clientFn: (serviceBaseUrl) => createEditorClient({
|
|
1104
|
+
baseUrl: serviceBaseUrl,
|
|
1105
|
+
middlewares: middlewareFor("editor", [attachTokenMiddleware]),
|
|
1106
|
+
auth
|
|
1107
|
+
})
|
|
1222
1108
|
}).add({
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1109
|
+
serviceId: "sync-actions",
|
|
1110
|
+
clientName: "syncActions",
|
|
1111
|
+
clientFn: (serviceBaseUrl) => createSyncActionsClient({
|
|
1112
|
+
baseUrl: serviceBaseUrl,
|
|
1113
|
+
middlewares: middlewareFor("syncActions", [attachTokenMiddleware]),
|
|
1114
|
+
auth
|
|
1115
|
+
})
|
|
1230
1116
|
}).add({
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1117
|
+
serviceId: "telemetry",
|
|
1118
|
+
clientName: "telemetry",
|
|
1119
|
+
clientFn: (serviceBaseUrl) => createTelemetryClient({
|
|
1120
|
+
baseUrl: serviceBaseUrl,
|
|
1121
|
+
middlewares: middlewareFor("telemetry", [attachTokenMiddleware]),
|
|
1122
|
+
auth
|
|
1123
|
+
})
|
|
1238
1124
|
}).add({
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1125
|
+
serviceId: "query",
|
|
1126
|
+
clientName: "queryService",
|
|
1127
|
+
clientFn: (serviceBaseUrl) => createQueryServiceClient({
|
|
1128
|
+
baseUrl: serviceBaseUrl,
|
|
1129
|
+
middlewares: middlewareFor("queryService", [attachTokenMiddleware]),
|
|
1130
|
+
auth
|
|
1131
|
+
})
|
|
1246
1132
|
}).add({
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1133
|
+
serviceId: "queue",
|
|
1134
|
+
clientName: "queue",
|
|
1135
|
+
clientFn: (serviceBaseUrl) => createQueueClient({
|
|
1136
|
+
baseUrl: serviceBaseUrl,
|
|
1137
|
+
middlewares: middlewareFor("queue", [attachTokenMiddleware]),
|
|
1138
|
+
auth
|
|
1139
|
+
})
|
|
1254
1140
|
}).add({
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1141
|
+
serviceId: "kai-assistant",
|
|
1142
|
+
clientName: "chat",
|
|
1143
|
+
clientFn: (serviceBaseUrl) => createChatClient({
|
|
1144
|
+
storageApiUrl: baseUrl,
|
|
1145
|
+
baseUrl: serviceBaseUrl,
|
|
1146
|
+
middlewares: middlewareFor("chat", [attachTokenMiddleware]),
|
|
1147
|
+
auth
|
|
1148
|
+
})
|
|
1263
1149
|
}).add({
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1150
|
+
serviceId: "ai",
|
|
1151
|
+
clientName: "ai",
|
|
1152
|
+
clientFn: (serviceBaseUrl) => createAiClient({
|
|
1153
|
+
baseUrl: serviceBaseUrl,
|
|
1154
|
+
middlewares: middlewareFor("ai", [attachTokenMiddleware]),
|
|
1155
|
+
auth
|
|
1156
|
+
})
|
|
1271
1157
|
}).add({
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
middlewares: middlewareFor("omnisearch", [attachTokenMiddleware]),
|
|
1280
|
-
auth
|
|
1281
|
-
})
|
|
1158
|
+
serviceId: "ai",
|
|
1159
|
+
clientName: "omnisearch",
|
|
1160
|
+
clientFn: (serviceBaseUrl) => createOmnisearchClient({
|
|
1161
|
+
baseUrl: `${serviceBaseUrl}/omnisearch`,
|
|
1162
|
+
middlewares: middlewareFor("omnisearch", [attachTokenMiddleware]),
|
|
1163
|
+
auth
|
|
1164
|
+
})
|
|
1282
1165
|
}).add({
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1166
|
+
serviceId: "import",
|
|
1167
|
+
clientName: "import",
|
|
1168
|
+
clientFn: (serviceBaseUrl) => createImportClient({
|
|
1169
|
+
baseUrl: serviceBaseUrl,
|
|
1170
|
+
middlewares: middlewareFor("import", [attachTokenMiddleware]),
|
|
1171
|
+
auth
|
|
1172
|
+
})
|
|
1290
1173
|
}).add({
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1174
|
+
serviceId: "kai-agent",
|
|
1175
|
+
clientName: "kaiAgent",
|
|
1176
|
+
clientFn: (serviceBaseUrl) => createKaiAgentClient({
|
|
1177
|
+
baseUrl: serviceBaseUrl,
|
|
1178
|
+
middlewares: middlewareFor("kaiAgent", [attachTokenMiddleware]),
|
|
1179
|
+
auth
|
|
1180
|
+
})
|
|
1298
1181
|
}).add({
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1182
|
+
serviceId: "oauth",
|
|
1183
|
+
clientName: "oauth",
|
|
1184
|
+
clientFn: (serviceBaseUrl) => createOauthClient({
|
|
1185
|
+
baseUrl: serviceBaseUrl,
|
|
1186
|
+
middlewares: middlewareFor("oauth", [attachTokenMiddleware]),
|
|
1187
|
+
auth
|
|
1188
|
+
})
|
|
1306
1189
|
}).add({
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1190
|
+
serviceId: "scheduler",
|
|
1191
|
+
clientName: "scheduler",
|
|
1192
|
+
clientFn: (serviceBaseUrl) => createSchedulerClient({
|
|
1193
|
+
baseUrl: serviceBaseUrl,
|
|
1194
|
+
middlewares: middlewareFor("scheduler", [attachTokenMiddleware]),
|
|
1195
|
+
auth
|
|
1196
|
+
})
|
|
1314
1197
|
}).add({
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1198
|
+
serviceId: "stream",
|
|
1199
|
+
clientName: "stream",
|
|
1200
|
+
clientFn: (serviceBaseUrl) => createStreamClient({
|
|
1201
|
+
baseUrl: serviceBaseUrl,
|
|
1202
|
+
middlewares: middlewareFor("stream", [attachTokenMiddleware]),
|
|
1203
|
+
auth
|
|
1204
|
+
})
|
|
1322
1205
|
}).add({
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1206
|
+
serviceId: "notification",
|
|
1207
|
+
clientName: "notifications",
|
|
1208
|
+
clientFn: (serviceBaseUrl) => createNotificationsClient({
|
|
1209
|
+
baseUrl: serviceBaseUrl,
|
|
1210
|
+
middlewares: middlewareFor("notifications", [attachTokenMiddleware]),
|
|
1211
|
+
auth
|
|
1212
|
+
})
|
|
1330
1213
|
}).add({
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1214
|
+
serviceId: "metastore",
|
|
1215
|
+
clientName: "metastore",
|
|
1216
|
+
clientFn: (serviceBaseUrl) => createMetastoreClient({
|
|
1217
|
+
baseUrl: serviceBaseUrl,
|
|
1218
|
+
middlewares: middlewareFor("metastore", [attachTokenMiddleware]),
|
|
1219
|
+
auth
|
|
1220
|
+
})
|
|
1338
1221
|
}).build();
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
const snapshot = getToken();
|
|
1434
|
-
if (snapshot === null) return null;
|
|
1435
|
-
const { accessToken, timing } = snapshot;
|
|
1436
|
-
if (forceRefresh) return refreshShared();
|
|
1437
|
-
if (Date.now() < refreshAt(timing)) return accessToken;
|
|
1438
|
-
return refreshShared().catch(() => accessToken);
|
|
1439
|
-
};
|
|
1440
|
-
return { getAccessToken, notifyExpired: () => onSessionExpired?.() };
|
|
1222
|
+
//#endregion
|
|
1223
|
+
//#region src/keboola/bearer/createProjectClients.ts
|
|
1224
|
+
/**
|
|
1225
|
+
* Bearer (OAuth) project surface. Same handshake + assembly as the legacy build. The
|
|
1226
|
+
* `Authorization: Bearer` header + transparent refresh come from the engine-shared `authMiddleware`
|
|
1227
|
+
* (one instance for management + every project client). This build only adds the project-scoped
|
|
1228
|
+
* `X-KBC-ProjectId` header, composed *outside* the auth middleware so the header is present
|
|
1229
|
+
* before it clones the request for the 401 replay. Bearer has no static token header, so this
|
|
1230
|
+
* combined `attach` rides on every client — including the operational storage and the bootstrap reader.
|
|
1231
|
+
*/
|
|
1232
|
+
const createProjectClients$1 = async ({ baseUrl, projectId, authMiddleware, middlewareFor, clientServiceUrls }) => {
|
|
1233
|
+
const auth = {
|
|
1234
|
+
type: "bearer",
|
|
1235
|
+
token: "",
|
|
1236
|
+
projectId
|
|
1237
|
+
};
|
|
1238
|
+
const projectIdMiddleware = (next) => (request) => {
|
|
1239
|
+
request.request.headers.set(KeboolaHttpHeader.PROJECT_ID, String(projectId));
|
|
1240
|
+
return next(request);
|
|
1241
|
+
};
|
|
1242
|
+
const attach = (next) => projectIdMiddleware(authMiddleware(next));
|
|
1243
|
+
const reader = createStorageClient({
|
|
1244
|
+
baseUrl,
|
|
1245
|
+
auth,
|
|
1246
|
+
middlewares: [attach]
|
|
1247
|
+
});
|
|
1248
|
+
const [stackInfo, sapiToken, devBranches] = await Promise.all([
|
|
1249
|
+
reader.getStackInfo({ exclude: "componentDetails" }),
|
|
1250
|
+
reader.tokens.verify(),
|
|
1251
|
+
reader.branches.getDevBranches()
|
|
1252
|
+
]);
|
|
1253
|
+
const stack = createStack({
|
|
1254
|
+
stackInfo,
|
|
1255
|
+
clientServiceUrls
|
|
1256
|
+
});
|
|
1257
|
+
const defaultBranch = createDefaultBranch({ devBranches });
|
|
1258
|
+
const liveProject = createLiveProject({
|
|
1259
|
+
initialToken: sapiToken,
|
|
1260
|
+
verify: () => reader.tokens.verify()
|
|
1261
|
+
});
|
|
1262
|
+
const storageTableStore = createDerivedStore({
|
|
1263
|
+
source: liveProject.store,
|
|
1264
|
+
build: createStorageTable,
|
|
1265
|
+
dependsOn: (project) => ({
|
|
1266
|
+
useLegacyBucketPrefix: !project.hasFeature(ProjectFeature.DisableLegacyBucketPrefix),
|
|
1267
|
+
hasProtectedDefaultBranch: project.hasFeature(ProjectFeature.SoxProtectedDefaultBranch),
|
|
1268
|
+
hasStorageBranches: project.hasFeature(ProjectFeature.StorageBranches)
|
|
1269
|
+
})
|
|
1270
|
+
});
|
|
1271
|
+
const context = {
|
|
1272
|
+
baseUrl: normalizeBaseUrl(baseUrl),
|
|
1273
|
+
stack,
|
|
1274
|
+
defaultBranch,
|
|
1275
|
+
get project() {
|
|
1276
|
+
return liveProject.getProject();
|
|
1277
|
+
},
|
|
1278
|
+
get st() {
|
|
1279
|
+
return storageTableStore.get();
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
const storage = createStorageClient({
|
|
1283
|
+
baseUrl,
|
|
1284
|
+
auth,
|
|
1285
|
+
middlewares: middlewareFor("storage", [attach, liveProject.middleware])
|
|
1286
|
+
});
|
|
1287
|
+
const { client: services, meta: serviceMeta } = createServiceClients({
|
|
1288
|
+
baseUrl,
|
|
1289
|
+
auth,
|
|
1290
|
+
getServiceBaseUrl: context.stack.getServiceUrl,
|
|
1291
|
+
middlewareFor,
|
|
1292
|
+
attachTokenMiddleware: attach
|
|
1293
|
+
});
|
|
1294
|
+
const sdk = {
|
|
1295
|
+
configuration: createConfigurationSdk({
|
|
1296
|
+
storageClient: storage,
|
|
1297
|
+
encryptionClient: services.encryption,
|
|
1298
|
+
context
|
|
1299
|
+
}),
|
|
1300
|
+
tag: createTagSdk({ metastoreClient: services.metastore }),
|
|
1301
|
+
semanticLayer: createSemanticLayerSdk({ metastoreClient: services.metastore }),
|
|
1302
|
+
storage: createStorageSdk({ storageClient: storage }),
|
|
1303
|
+
vault: createVaultSdk({
|
|
1304
|
+
vaultClient: services.vault,
|
|
1305
|
+
encryptionClient: services.encryption
|
|
1306
|
+
}),
|
|
1307
|
+
variables: createVariablesSdk({ storageClient: storage })
|
|
1308
|
+
};
|
|
1309
|
+
return {
|
|
1310
|
+
context,
|
|
1311
|
+
serviceMeta,
|
|
1312
|
+
storage,
|
|
1313
|
+
...services,
|
|
1314
|
+
sdk
|
|
1315
|
+
};
|
|
1441
1316
|
};
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1317
|
+
//#endregion
|
|
1318
|
+
//#region src/keboola/bearer/middleware.ts
|
|
1319
|
+
/**
|
|
1320
|
+
* Bearer auth for every outgoing request:
|
|
1321
|
+
* - Stamps the current access token (from the credential) as the `Authorization` header.
|
|
1322
|
+
* - On a 401, force-refreshes the token and replays the request once.
|
|
1323
|
+
* - If the replay still 401s, the fresh token is rejected → marks the session expired.
|
|
1324
|
+
*
|
|
1325
|
+
* When the session is anonymous (`getAccessToken` → `null`) the request is passed through untouched
|
|
1326
|
+
* with no 401 dance — so pre-auth calls on the auth client (`login`, `refresh`) work and a failed
|
|
1327
|
+
* login is never mistaken for session expiry.
|
|
1328
|
+
*
|
|
1329
|
+
* Holds no token and never touches config — all token and refresh state lives in the credential.
|
|
1330
|
+
*/
|
|
1331
|
+
const createBearerAuthMiddleware = (credential) => {
|
|
1332
|
+
return (next) => async (request) => {
|
|
1333
|
+
const token = await credential.getAccessToken({ forceRefresh: false });
|
|
1334
|
+
if (token === null) return next(request);
|
|
1335
|
+
const retryRequest = request.request.clone();
|
|
1336
|
+
request.request.headers.set(HttpHeader.AUTHORIZATION, `Bearer ${token}`);
|
|
1337
|
+
try {
|
|
1338
|
+
return await next(request);
|
|
1339
|
+
} catch (error) {
|
|
1340
|
+
if (!isUnauthorized(error)) throw error;
|
|
1341
|
+
const refreshed = await credential.getAccessToken({ forceRefresh: true });
|
|
1342
|
+
if (refreshed === null) throw error;
|
|
1343
|
+
retryRequest.headers.set(HttpHeader.AUTHORIZATION, `Bearer ${refreshed}`);
|
|
1344
|
+
try {
|
|
1345
|
+
return await next({
|
|
1346
|
+
...request,
|
|
1347
|
+
request: retryRequest
|
|
1348
|
+
});
|
|
1349
|
+
} catch (retryError) {
|
|
1350
|
+
if (isUnauthorized(retryError)) credential.notifyExpired();
|
|
1351
|
+
throw retryError;
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
};
|
|
1465
1355
|
};
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1356
|
+
//#endregion
|
|
1357
|
+
//#region src/keboola/bearer/persistor.ts
|
|
1358
|
+
const SESSION_KEY = "keboola:bearer-session";
|
|
1359
|
+
const persistedSessionSchema = z$1.object({
|
|
1360
|
+
baseUrl: z$1.string().nullable(),
|
|
1361
|
+
projectId: z$1.number().nullable(),
|
|
1362
|
+
refreshToken: z$1.string().nullable()
|
|
1471
1363
|
});
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1364
|
+
const EMPTY_PERSISTED_SESSION = {
|
|
1365
|
+
baseUrl: null,
|
|
1366
|
+
projectId: null,
|
|
1367
|
+
refreshToken: null
|
|
1476
1368
|
};
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1369
|
+
const createSessionPersistor = (storage) => createPersistor({
|
|
1370
|
+
storage,
|
|
1371
|
+
key: SESSION_KEY,
|
|
1372
|
+
schema: persistedSessionSchema,
|
|
1373
|
+
defaultValue: EMPTY_PERSISTED_SESSION
|
|
1482
1374
|
});
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1375
|
+
//#endregion
|
|
1376
|
+
//#region src/keboola/bearer/keboola.ts
|
|
1377
|
+
const createKeboola = (options = {}) => {
|
|
1378
|
+
const persistor = createSessionPersistor(options.storage);
|
|
1379
|
+
const config = createConfig$1();
|
|
1380
|
+
const middlewareFor = createMiddlewareFor(options.middlewares);
|
|
1381
|
+
const retryContention = createRetryMiddleware({ shouldRetry: (error) => error instanceof ApiError && error.response.status === HttpStatus.SERVICE_UNAVAILABLE });
|
|
1382
|
+
const authClientBare = createDerivedStore({
|
|
1383
|
+
source: config.store,
|
|
1384
|
+
dependsOn: (state) => state.baseUrl,
|
|
1385
|
+
build: (baseUrl) => baseUrl ? createAuthClient({
|
|
1386
|
+
baseUrl,
|
|
1387
|
+
middlewares: middlewareFor("auth", [retryContention])
|
|
1388
|
+
}) : null
|
|
1389
|
+
});
|
|
1390
|
+
const refresh = async () => {
|
|
1391
|
+
const client = authClientBare.get();
|
|
1392
|
+
assert$1(client, KeboolaErrorType.NotReady);
|
|
1393
|
+
const refreshed = await client.token.refresh(config.requireCredential().refreshToken);
|
|
1394
|
+
config.applyRefresh(refreshed);
|
|
1395
|
+
return refreshed.accessToken;
|
|
1396
|
+
};
|
|
1397
|
+
const getToken = () => {
|
|
1398
|
+
const state = config.store.get();
|
|
1399
|
+
if (state.status === "anonymous") return null;
|
|
1400
|
+
const { accessToken, issuedAt, expiresIn } = state.credential;
|
|
1401
|
+
return {
|
|
1402
|
+
accessToken,
|
|
1403
|
+
timing: {
|
|
1404
|
+
issuedAt,
|
|
1405
|
+
expiresIn
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
};
|
|
1409
|
+
const signOut = () => {
|
|
1410
|
+
config.reset();
|
|
1411
|
+
persistor.clear();
|
|
1412
|
+
};
|
|
1413
|
+
const onSessionExpired = () => {
|
|
1414
|
+
if (config.notifyExpired()) signOut();
|
|
1415
|
+
};
|
|
1416
|
+
const credential = createBearerCredential({
|
|
1417
|
+
refresh,
|
|
1418
|
+
getToken,
|
|
1419
|
+
onSessionExpired
|
|
1420
|
+
});
|
|
1421
|
+
const authMiddleware = createBearerAuthMiddleware(credential);
|
|
1422
|
+
const authClient = createDerivedStore({
|
|
1423
|
+
source: config.store,
|
|
1424
|
+
dependsOn: (state) => state.baseUrl,
|
|
1425
|
+
build: (baseUrl) => baseUrl ? createAuthClient({
|
|
1426
|
+
baseUrl,
|
|
1427
|
+
middlewares: middlewareFor("auth", [retryContention, authMiddleware])
|
|
1428
|
+
}) : null
|
|
1429
|
+
});
|
|
1430
|
+
const management = createDerivedStore({
|
|
1431
|
+
source: config.store,
|
|
1432
|
+
dependsOn: (state) => state.status === "anonymous" ? null : state.baseUrl,
|
|
1433
|
+
build: (baseUrl) => baseUrl ? createManagementClient({
|
|
1434
|
+
baseUrl,
|
|
1435
|
+
auth: {
|
|
1436
|
+
type: "bearer",
|
|
1437
|
+
token: ""
|
|
1438
|
+
},
|
|
1439
|
+
middlewares: middlewareFor("management", [authMiddleware])
|
|
1440
|
+
}) : null
|
|
1441
|
+
});
|
|
1442
|
+
const projectClientsAsync = createDerivedAsyncStore({
|
|
1443
|
+
source: config.store,
|
|
1444
|
+
dependsOn: (state) => state.status === "scoped" ? {
|
|
1445
|
+
baseUrl: state.baseUrl,
|
|
1446
|
+
projectId: state.projectId
|
|
1447
|
+
} : null,
|
|
1448
|
+
build: ({ baseUrl, projectId }) => {
|
|
1449
|
+
return createProjectClients$1({
|
|
1450
|
+
baseUrl,
|
|
1451
|
+
authMiddleware,
|
|
1452
|
+
projectId,
|
|
1453
|
+
middlewareFor,
|
|
1454
|
+
clientServiceUrls: options.clientServiceUrls
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
});
|
|
1458
|
+
if (options.baseUrl) config.setBaseUrl(options.baseUrl);
|
|
1459
|
+
config.store.subscribe((state) => {
|
|
1460
|
+
if (state.status === "anonymous") return;
|
|
1461
|
+
persistor.persist({
|
|
1462
|
+
baseUrl: state.baseUrl,
|
|
1463
|
+
projectId: state.status === "scoped" ? state.projectId : null,
|
|
1464
|
+
refreshToken: state.credential.refreshToken
|
|
1465
|
+
});
|
|
1466
|
+
});
|
|
1467
|
+
const debug = () => ({
|
|
1468
|
+
type: "Bearer",
|
|
1469
|
+
config: config.debug(),
|
|
1470
|
+
authReady: authClient.get() !== null,
|
|
1471
|
+
managementReady: management.get() !== null,
|
|
1472
|
+
storage: projectClientsAsync.store.get().state
|
|
1473
|
+
});
|
|
1474
|
+
const session = {
|
|
1475
|
+
hasPersistedValue: persistor.hasPersistedValue,
|
|
1476
|
+
setBaseUrl: config.setBaseUrl,
|
|
1477
|
+
isStorageReady: () => projectClientsAsync.store.get().state === "ready",
|
|
1478
|
+
authenticate: (tokens) => config.authenticate(tokens),
|
|
1479
|
+
setProject: config.setProjectId,
|
|
1480
|
+
setProjectAsync: async (projectId) => {
|
|
1481
|
+
config.setProjectId(projectId);
|
|
1482
|
+
await projectClientsAsync.settled();
|
|
1483
|
+
},
|
|
1484
|
+
/**
|
|
1485
|
+
* Leave the current project but stay signed in — the storage build returns to `idle`, so a
|
|
1486
|
+
* consumer gating on it falls back to its project picker. The persisted session is rewritten with
|
|
1487
|
+
* `projectId: null` by the subscription above, so a reload lands on the picker rather than
|
|
1488
|
+
* re-entering the project. Use `reset` to sign out instead.
|
|
1489
|
+
*/
|
|
1490
|
+
clearProject: config.clearProjectId,
|
|
1491
|
+
reset: signOut,
|
|
1492
|
+
/**
|
|
1493
|
+
* Dev/test only: mark the current access token as expired so the bearer credential rotates it on
|
|
1494
|
+
* the next request. Pair with any authenticated call (e.g. `api.storage.tokens.verify()`) to force
|
|
1495
|
+
* the rotation immediately and observe the new credential.
|
|
1496
|
+
*/
|
|
1497
|
+
debugForceRefresh: config.forceExpire,
|
|
1498
|
+
restore: async () => {
|
|
1499
|
+
const persisted = persistor.hydrate();
|
|
1500
|
+
if (!persisted.refreshToken || !persisted.baseUrl) return { status: "empty" };
|
|
1501
|
+
const configured = config.getBaseUrl();
|
|
1502
|
+
if (configured && configured !== persisted.baseUrl) {
|
|
1503
|
+
persistor.clear();
|
|
1504
|
+
return { status: "empty" };
|
|
1505
|
+
}
|
|
1506
|
+
if (!configured) config.setBaseUrl(persisted.baseUrl);
|
|
1507
|
+
const client = authClientBare.get();
|
|
1508
|
+
assert$1(client, KeboolaErrorType.NotReady);
|
|
1509
|
+
try {
|
|
1510
|
+
const refreshed = await client.token.refresh(persisted.refreshToken);
|
|
1511
|
+
config.authenticate(refreshed);
|
|
1512
|
+
if (persisted.projectId !== null) {
|
|
1513
|
+
config.setProjectId(persisted.projectId);
|
|
1514
|
+
await projectClientsAsync.settled();
|
|
1515
|
+
}
|
|
1516
|
+
return { status: "restored" };
|
|
1517
|
+
} catch (err) {
|
|
1518
|
+
if (isUnauthorized(err)) {
|
|
1519
|
+
persistor.clear();
|
|
1520
|
+
return { status: "expired" };
|
|
1521
|
+
}
|
|
1522
|
+
throw err;
|
|
1523
|
+
}
|
|
1524
|
+
},
|
|
1525
|
+
subscribe: (listener) => {
|
|
1526
|
+
const unsubscribeConfig = config.store.subscribe(() => listener(debug()));
|
|
1527
|
+
const unsubscribeBuild = projectClientsAsync.store.subscribe(() => listener(debug()));
|
|
1528
|
+
return () => {
|
|
1529
|
+
unsubscribeConfig();
|
|
1530
|
+
unsubscribeBuild();
|
|
1531
|
+
};
|
|
1532
|
+
},
|
|
1533
|
+
debug
|
|
1534
|
+
};
|
|
1535
|
+
return {
|
|
1536
|
+
api: createApi({
|
|
1537
|
+
getAuthClient: () => authClient.get(),
|
|
1538
|
+
getManagementClient: () => management.get(),
|
|
1539
|
+
getProjectClients: () => {
|
|
1540
|
+
const state = projectClientsAsync.store.get();
|
|
1541
|
+
return state.state === "ready" ? state.value : null;
|
|
1542
|
+
}
|
|
1543
|
+
}),
|
|
1544
|
+
session
|
|
1545
|
+
};
|
|
1636
1546
|
};
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1547
|
+
//#endregion
|
|
1548
|
+
//#region src/keboola/legacy/createConfig.ts
|
|
1549
|
+
const createConfig = () => {
|
|
1550
|
+
const store = createStore({
|
|
1551
|
+
baseUrl: null,
|
|
1552
|
+
sapiToken: null,
|
|
1553
|
+
managementToken: null
|
|
1554
|
+
});
|
|
1555
|
+
const setBaseUrl = (baseUrl) => {
|
|
1556
|
+
store.set({
|
|
1557
|
+
...store.get(),
|
|
1558
|
+
baseUrl
|
|
1559
|
+
});
|
|
1560
|
+
};
|
|
1561
|
+
const authenticate = (tokens) => {
|
|
1562
|
+
const current = store.get();
|
|
1563
|
+
store.set({
|
|
1564
|
+
...current,
|
|
1565
|
+
sapiToken: tokens.sapiToken ?? current.sapiToken,
|
|
1566
|
+
managementToken: tokens.managementToken ?? current.managementToken
|
|
1567
|
+
});
|
|
1568
|
+
};
|
|
1569
|
+
const getStorageToken = () => store.get().sapiToken ?? "";
|
|
1570
|
+
const setStorageToken = (sapiToken) => store.set({
|
|
1571
|
+
...store.get(),
|
|
1572
|
+
sapiToken
|
|
1573
|
+
});
|
|
1574
|
+
/** Current state, for diagnostics. */
|
|
1575
|
+
const debug = () => store.get();
|
|
1576
|
+
return {
|
|
1577
|
+
store,
|
|
1578
|
+
setBaseUrl,
|
|
1579
|
+
authenticate,
|
|
1580
|
+
getStorageToken,
|
|
1581
|
+
setStorageToken,
|
|
1582
|
+
debug
|
|
1583
|
+
};
|
|
1656
1584
|
};
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1585
|
+
//#endregion
|
|
1586
|
+
//#region src/keboola/legacy/createProjectClients.ts
|
|
1587
|
+
const createAttachStorageToken = (getToken) => (next) => (request) => {
|
|
1588
|
+
request.request.headers.set(KeboolaHttpHeader.STORAGE_API_TOKEN, getToken());
|
|
1589
|
+
return next(request);
|
|
1662
1590
|
};
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1591
|
+
const createProjectClients = async ({ baseUrl, getStorageToken, onStorageTokenRefreshed, middlewareFor, clientServiceUrls }) => {
|
|
1592
|
+
const auth = {
|
|
1593
|
+
type: "sapi-token",
|
|
1594
|
+
token: getStorageToken()
|
|
1595
|
+
};
|
|
1596
|
+
const attach = createAttachStorageToken(getStorageToken);
|
|
1597
|
+
const _storage = createStorageClient({
|
|
1598
|
+
baseUrl,
|
|
1599
|
+
auth,
|
|
1600
|
+
middlewares: [attach]
|
|
1601
|
+
});
|
|
1602
|
+
const [stackInfo, sapiToken, devBranches] = await Promise.all([
|
|
1603
|
+
_storage.getStackInfo({ exclude: "componentDetails" }),
|
|
1604
|
+
_storage.tokens.verify(),
|
|
1605
|
+
_storage.branches.getDevBranches()
|
|
1606
|
+
]);
|
|
1607
|
+
const stack = createStack({
|
|
1608
|
+
stackInfo,
|
|
1609
|
+
clientServiceUrls
|
|
1610
|
+
});
|
|
1611
|
+
const defaultBranch = createDefaultBranch({ devBranches });
|
|
1612
|
+
const liveProject = createLiveProject({
|
|
1613
|
+
initialToken: sapiToken,
|
|
1614
|
+
verify: () => _storage.tokens.verify()
|
|
1615
|
+
});
|
|
1616
|
+
const storageTableStore = createDerivedStore({
|
|
1617
|
+
source: liveProject.store,
|
|
1618
|
+
build: createStorageTable,
|
|
1619
|
+
dependsOn: (project) => ({
|
|
1620
|
+
useLegacyBucketPrefix: !project.hasFeature(ProjectFeature.DisableLegacyBucketPrefix),
|
|
1621
|
+
hasProtectedDefaultBranch: project.hasFeature(ProjectFeature.SoxProtectedDefaultBranch),
|
|
1622
|
+
hasStorageBranches: project.hasFeature(ProjectFeature.StorageBranches)
|
|
1623
|
+
})
|
|
1624
|
+
});
|
|
1625
|
+
const context = {
|
|
1626
|
+
baseUrl: normalizeBaseUrl(baseUrl),
|
|
1627
|
+
stack,
|
|
1628
|
+
defaultBranch,
|
|
1629
|
+
get project() {
|
|
1630
|
+
return liveProject.getProject();
|
|
1631
|
+
},
|
|
1632
|
+
get st() {
|
|
1633
|
+
return storageTableStore.get();
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1636
|
+
const storage = createStorageClient({
|
|
1637
|
+
baseUrl,
|
|
1638
|
+
auth,
|
|
1639
|
+
middlewares: middlewareFor("storage", [liveProject.middleware]),
|
|
1640
|
+
onRefreshToken: onStorageTokenRefreshed
|
|
1641
|
+
});
|
|
1642
|
+
const { client: services, meta: serviceMeta } = createServiceClients({
|
|
1643
|
+
baseUrl,
|
|
1644
|
+
auth,
|
|
1645
|
+
getServiceBaseUrl: context.stack.getServiceUrl,
|
|
1646
|
+
middlewareFor,
|
|
1647
|
+
attachTokenMiddleware: attach
|
|
1648
|
+
});
|
|
1649
|
+
const sdk = {
|
|
1650
|
+
configuration: createConfigurationSdk({
|
|
1651
|
+
storageClient: storage,
|
|
1652
|
+
encryptionClient: services.encryption,
|
|
1653
|
+
context
|
|
1654
|
+
}),
|
|
1655
|
+
tag: createTagSdk({ metastoreClient: services.metastore }),
|
|
1656
|
+
semanticLayer: createSemanticLayerSdk({ metastoreClient: services.metastore }),
|
|
1657
|
+
storage: createStorageSdk({ storageClient: storage }),
|
|
1658
|
+
vault: createVaultSdk({
|
|
1659
|
+
vaultClient: services.vault,
|
|
1660
|
+
encryptionClient: services.encryption
|
|
1661
|
+
}),
|
|
1662
|
+
variables: createVariablesSdk({ storageClient: storage })
|
|
1663
|
+
};
|
|
1664
|
+
return {
|
|
1665
|
+
context,
|
|
1666
|
+
serviceMeta,
|
|
1667
|
+
storage,
|
|
1668
|
+
...services,
|
|
1669
|
+
sdk
|
|
1670
|
+
};
|
|
1730
1671
|
};
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1672
|
+
//#endregion
|
|
1673
|
+
//#region src/keboola/legacy/keboola.ts
|
|
1674
|
+
const createLegacyKeboola = (options = {}) => {
|
|
1675
|
+
const config = createConfig();
|
|
1676
|
+
const middlewareFor = createMiddlewareFor(options.middlewares);
|
|
1677
|
+
const authClient = createDerivedStore({
|
|
1678
|
+
source: config.store,
|
|
1679
|
+
dependsOn: (state) => state.baseUrl,
|
|
1680
|
+
build: (baseUrl) => baseUrl ? createAuthClient({
|
|
1681
|
+
baseUrl,
|
|
1682
|
+
middlewares: middlewareFor("auth", [])
|
|
1683
|
+
}) : null
|
|
1684
|
+
});
|
|
1685
|
+
const management = createDerivedStore({
|
|
1686
|
+
source: config.store,
|
|
1687
|
+
dependsOn: (state) => ({
|
|
1688
|
+
baseUrl: state.baseUrl,
|
|
1689
|
+
token: state.managementToken
|
|
1690
|
+
}),
|
|
1691
|
+
build: ({ baseUrl, token }) => baseUrl ? createManagementClient({
|
|
1692
|
+
baseUrl,
|
|
1693
|
+
auth: token ? {
|
|
1694
|
+
type: "management-token",
|
|
1695
|
+
token
|
|
1696
|
+
} : { type: "management-token" },
|
|
1697
|
+
middlewares: middlewareFor("management", [])
|
|
1698
|
+
}) : null
|
|
1699
|
+
});
|
|
1700
|
+
const build = createDerivedAsyncStore({
|
|
1701
|
+
source: config.store,
|
|
1702
|
+
dependsOn: (state) => state.sapiToken && state.baseUrl ? state.baseUrl : null,
|
|
1703
|
+
build: (baseUrl) => createProjectClients({
|
|
1704
|
+
baseUrl,
|
|
1705
|
+
getStorageToken: config.getStorageToken,
|
|
1706
|
+
onStorageTokenRefreshed: config.setStorageToken,
|
|
1707
|
+
middlewareFor,
|
|
1708
|
+
clientServiceUrls: options.clientServiceUrls
|
|
1709
|
+
})
|
|
1710
|
+
});
|
|
1711
|
+
if (options.baseUrl) config.setBaseUrl(options.baseUrl);
|
|
1712
|
+
const debug = () => {
|
|
1713
|
+
const info = config.debug();
|
|
1714
|
+
return {
|
|
1715
|
+
type: "Sapi",
|
|
1716
|
+
config: info,
|
|
1717
|
+
authReady: authClient.get() !== null,
|
|
1718
|
+
managementReady: !!info.managementToken,
|
|
1719
|
+
storage: build.store.get().state
|
|
1720
|
+
};
|
|
1721
|
+
};
|
|
1722
|
+
const session = {
|
|
1723
|
+
setBaseUrl: config.setBaseUrl,
|
|
1724
|
+
isStorageReady: () => build.store.get().state === "ready",
|
|
1725
|
+
authenticateStorage: (sapiToken) => config.authenticate({ sapiToken }),
|
|
1726
|
+
authenticateStorageAsync: async (sapiToken) => {
|
|
1727
|
+
config.authenticate({ sapiToken });
|
|
1728
|
+
await build.settled();
|
|
1729
|
+
},
|
|
1730
|
+
authenticateManagement: (managementToken) => config.authenticate({ managementToken }),
|
|
1731
|
+
subscribe: (listener) => {
|
|
1732
|
+
const unsubscribeConfig = config.store.subscribe(() => listener(debug()));
|
|
1733
|
+
const unsubscribeBuild = build.store.subscribe(() => listener(debug()));
|
|
1734
|
+
return () => {
|
|
1735
|
+
unsubscribeConfig();
|
|
1736
|
+
unsubscribeBuild();
|
|
1737
|
+
};
|
|
1738
|
+
},
|
|
1739
|
+
debug
|
|
1740
|
+
};
|
|
1741
|
+
return {
|
|
1742
|
+
api: createApi({
|
|
1743
|
+
getAuthClient: () => authClient.get(),
|
|
1744
|
+
getManagementClient: () => management.get(),
|
|
1745
|
+
getProjectClients: () => {
|
|
1746
|
+
const state = build.store.get();
|
|
1747
|
+
return state.state === "ready" ? state.value : null;
|
|
1748
|
+
}
|
|
1749
|
+
}),
|
|
1750
|
+
session
|
|
1751
|
+
};
|
|
1800
1752
|
};
|
|
1753
|
+
//#endregion
|
|
1754
|
+
export { ApiError, 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, isKeboolaError, isManagementClientAuthError, isPlainObject, isQueryJobError, isQueryJobTimeoutError, isStorageTokenMutatingRequest, isSyncActionError, isValidationError, jobStatus, keboolaUID, lazy, parseLogLines, parseOrThrow, poll, poller, schemaGuidedMerge, series, shallowEqual };
|
|
1801
1755
|
|
|
1802
|
-
export { KeboolaError, KeboolaErrorType, assert, coalesce, createDerivedAsyncStore, createDerivedStore, createKeboola, createLegacyKeboola, createLocalStorage, createLoggingMiddleware, createMemoryStorage, createNullStorage, createPersistor, createRetryMiddleware, createSessionStorage, createStore, deepMerge, isKeboolaError, isStorageTokenMutatingRequest, lazy, shallowEqual };
|
|
1803
|
-
//# sourceMappingURL=index.js.map
|
|
1804
1756
|
//# sourceMappingURL=index.js.map
|