@keboola/api-client 36.0.0 → 39.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 +12 -3
- package/API-SURFACE.md +14 -1
- package/CHANGELOG.md +74 -0
- package/README.md +19 -17
- package/dist/{ManagementClientAuthError-ey-f03vy.js → ManagementClientAuthError-Cr9IOsnJ.js} +3 -2
- package/dist/{ManagementClientAuthError-ey-f03vy.js.map → ManagementClientAuthError-Cr9IOsnJ.js.map} +1 -1
- package/dist/{ManagementClientAuthError-DD4u0EU7.cjs → ManagementClientAuthError-FcfMJNhr.cjs} +3 -2
- package/dist/{ManagementClientAuthError-DD4u0EU7.cjs.map → ManagementClientAuthError-FcfMJNhr.cjs.map} +1 -1
- package/dist/ai/index.cjs +2 -2
- package/dist/ai/index.js +2 -2
- package/dist/{appLogs-BjfUoWzs.cjs → appLogs-C_zP0lpv.cjs} +2 -2
- package/dist/{appLogs-BjfUoWzs.cjs.map → appLogs-C_zP0lpv.cjs.map} +1 -1
- package/dist/{appLogs-xsVkTriU.js → appLogs-Cl7Q_MR9.js} +2 -2
- package/dist/{appLogs-xsVkTriU.js.map → appLogs-Cl7Q_MR9.js.map} +1 -1
- package/dist/apps/index.cjs +3 -3
- package/dist/apps/index.js +3 -3
- package/dist/assets/index.cjs +1 -1
- package/dist/assets/index.js +1 -1
- package/dist/auth/index.cjs +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/{auth-aItmDu45.js → auth-BjmkFOgd.js} +2 -2
- package/dist/{auth-aItmDu45.js.map → auth-BjmkFOgd.js.map} +1 -1
- package/dist/{auth-JQ33o3nU.cjs → auth-DLWnl18b.cjs} +2 -2
- package/dist/{auth-JQ33o3nU.cjs.map → auth-DLWnl18b.cjs.map} +1 -1
- package/dist/{authClient-_PpvGgZJ.cjs → authClient-8yU1last.cjs} +5 -5
- package/dist/{authClient-_PpvGgZJ.cjs.map → authClient-8yU1last.cjs.map} +1 -1
- package/dist/{authClient-D7W9vWPR.js → authClient-BTo4Afm6.js} +5 -5
- package/dist/{authClient-D7W9vWPR.js.map → authClient-BTo4Afm6.js.map} +1 -1
- package/dist/billing/index.cjs +2 -2
- package/dist/billing/index.js +2 -2
- package/dist/businessWorkspaceApi/index.cjs +3 -0
- package/dist/businessWorkspaceApi/index.d.cts +2 -0
- package/dist/businessWorkspaceApi/index.d.ts +2 -0
- package/dist/businessWorkspaceApi/index.js +2 -0
- package/dist/businessWorkspaceApi/types.cjs +0 -0
- package/dist/businessWorkspaceApi/types.d.cts +2 -0
- package/dist/businessWorkspaceApi/types.d.ts +2 -0
- package/dist/businessWorkspaceApi/types.js +1 -0
- package/dist/businessWorkspaceApi-BD-iUj07.js +61 -0
- package/dist/businessWorkspaceApi-BD-iUj07.js.map +1 -0
- package/dist/businessWorkspaceApi-wyBdbpIJ.cjs +66 -0
- package/dist/businessWorkspaceApi-wyBdbpIJ.cjs.map +1 -0
- package/dist/businessWorkspaceApiClient-C2WyWN3b.d.ts +529 -0
- package/dist/businessWorkspaceApiClient-CRM1U8b-.d.cts +529 -0
- package/dist/chat/index.cjs +5 -5
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.d.cts +1 -1
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/index.js +5 -5
- package/dist/chat/index.js.map +1 -1
- package/dist/constants/index.cjs +1 -1
- package/dist/constants/index.d.cts +2 -2
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +1 -1
- package/dist/{constants-wfbFsqqN.js → constants-C2tYAJSj.js} +10 -1
- package/dist/constants-C2tYAJSj.js.map +1 -0
- package/dist/{constants-C4DlsF_M.cjs → constants-C6xku_Vx.cjs} +10 -1
- package/dist/constants-C6xku_Vx.cjs.map +1 -0
- package/dist/{createFetchClient-DgMiqTJ8.cjs → createFetchClient-BlgPbjFj.cjs} +14 -2
- package/dist/createFetchClient-BlgPbjFj.cjs.map +1 -0
- package/dist/{createFetchClient-U-ZrwPl2.js → createFetchClient-C-cadpBx.js} +14 -2
- package/dist/createFetchClient-C-cadpBx.js.map +1 -0
- package/dist/{createGenericFetchClient-rxvUUbap.js → createGenericFetchClient-Bnf1QK9W.js} +2 -2
- package/dist/{createGenericFetchClient-rxvUUbap.js.map → createGenericFetchClient-Bnf1QK9W.js.map} +1 -1
- package/dist/{createGenericFetchClient-o3cPJeRn.cjs → createGenericFetchClient-lcozzwk2.cjs} +2 -2
- package/dist/{createGenericFetchClient-o3cPJeRn.cjs.map → createGenericFetchClient-lcozzwk2.cjs.map} +1 -1
- package/dist/{createOpenapiFetchClient-DhUU3M1W.cjs → createOpenapiFetchClient-C3UmDXpe.cjs} +2 -2
- package/dist/{createOpenapiFetchClient-DhUU3M1W.cjs.map → createOpenapiFetchClient-C3UmDXpe.cjs.map} +1 -1
- package/dist/{createOpenapiFetchClient-BVSc9ibR.js → createOpenapiFetchClient-COaPeeQ0.js} +2 -2
- package/dist/{createOpenapiFetchClient-BVSc9ibR.js.map → createOpenapiFetchClient-COaPeeQ0.js.map} +1 -1
- package/dist/{credential-DVWvJFJs.cjs → credential-CAulvfZ-.cjs} +2 -2
- package/dist/{credential-DVWvJFJs.cjs.map → credential-CAulvfZ-.cjs.map} +1 -1
- package/dist/{credential-CihSf_xs.js → credential-DWXbo4IX.js} +2 -2
- package/dist/{credential-CihSf_xs.js.map → credential-DWXbo4IX.js.map} +1 -1
- package/dist/dataScience/index.cjs +2 -2
- package/dist/dataScience/index.js +2 -2
- package/dist/{dataScience-C1gO5zUn.js → dataScience-B_BmnB1m.js} +5 -5
- package/dist/{dataScience-C1gO5zUn.js.map → dataScience-B_BmnB1m.js.map} +1 -1
- package/dist/{dataScience-0Rl_EuV_.cjs → dataScience-D-hyc4GY.cjs} +5 -5
- package/dist/{dataScience-0Rl_EuV_.cjs.map → dataScience-D-hyc4GY.cjs.map} +1 -1
- package/dist/developerPortal/index.cjs +1 -1
- package/dist/developerPortal/index.js +1 -1
- package/dist/{developerPortalClient-ki0XS_OD.cjs → developerPortalClient-CutPqoAa.cjs} +3 -3
- package/dist/{developerPortalClient-ki0XS_OD.cjs.map → developerPortalClient-CutPqoAa.cjs.map} +1 -1
- package/dist/{developerPortalClient-C_48z8BN.js → developerPortalClient-yHFTkKPb.js} +3 -3
- package/dist/{developerPortalClient-C_48z8BN.js.map → developerPortalClient-yHFTkKPb.js.map} +1 -1
- package/dist/domain/permissions/index.d.cts +2 -2
- package/dist/domain/permissions/index.d.ts +2 -2
- package/dist/editor/index.cjs +2 -2
- package/dist/editor/index.js +2 -2
- package/dist/encryption/index.cjs +1 -1
- package/dist/encryption/index.d.cts +1 -1
- package/dist/encryption/index.d.ts +1 -1
- package/dist/encryption/index.js +1 -1
- package/dist/encryption/types.d.cts +1 -1
- package/dist/encryption/types.d.ts +1 -1
- package/dist/import/index.cjs +1 -1
- package/dist/import/index.js +1 -1
- package/dist/{import-C83w7BKz.cjs → import-7YyyD_U_.cjs} +3 -3
- package/dist/{import-C83w7BKz.cjs.map → import-7YyyD_U_.cjs.map} +1 -1
- package/dist/{import-CROEK82b.js → import-xliONVib.js} +3 -3
- package/dist/{import-CROEK82b.js.map → import-xliONVib.js.map} +1 -1
- package/dist/{index-D8rcUbnk.d.ts → index-1r_CskjU.d.ts} +2 -2
- package/dist/{index-BXF-bs2d.d.ts → index-BK-qHT39.d.ts} +8 -4
- package/dist/{index-DIAyi-EZ.d.cts → index-CHXnJQ9s.d.cts} +92 -14
- package/dist/{index-BDG-LKXj.d.cts → index-CWoEnDJ_.d.cts} +8 -4
- package/dist/{index-NaYLwG_h.d.ts → index-DBklbaTp.d.cts} +9 -1
- package/dist/{index-NaYLwG_h.d.cts → index-DBklbaTp.d.ts} +9 -1
- package/dist/{index-BgLnWTZU.d.cts → index-DVw4Av4b.d.cts} +4 -4
- package/dist/{index-DR4QqItd.d.cts → index-DWf6FXOr.d.cts} +2 -2
- package/dist/{index-CqgtL2NU.d.ts → index-De5qUWhp.d.ts} +4 -4
- package/dist/{index-2JM0gyAf.d.ts → index-GfKzh267.d.ts} +92 -14
- package/dist/index.cjs +30 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +30 -20
- package/dist/index.js.map +1 -1
- package/dist/{isLoginPageRedirect-B0EmRsHr.cjs → isLoginPageRedirect-Cm6Pn8Pj.cjs} +2 -2
- package/dist/{isLoginPageRedirect-B0EmRsHr.cjs.map → isLoginPageRedirect-Cm6Pn8Pj.cjs.map} +1 -1
- package/dist/{isLoginPageRedirect-BTTAedW-.js → isLoginPageRedirect-hyPqyWNX.js} +2 -2
- package/dist/{isLoginPageRedirect-BTTAedW-.js.map → isLoginPageRedirect-hyPqyWNX.js.map} +1 -1
- package/dist/kaiAgent/index.cjs +1 -1
- package/dist/kaiAgent/index.d.cts +1 -1
- package/dist/kaiAgent/index.d.ts +1 -1
- package/dist/kaiAgent/index.js +1 -1
- package/dist/kaiAgent/types.d.cts +2 -2
- package/dist/kaiAgent/types.d.ts +2 -2
- package/dist/{kaiAgent-8LNzGhZc.js → kaiAgent-CcT2oNip.js} +41 -6
- package/dist/kaiAgent-CcT2oNip.js.map +1 -0
- package/dist/{kaiAgent-B_TaUPRt.cjs → kaiAgent-DaB6UCsh.cjs} +41 -6
- package/dist/kaiAgent-DaB6UCsh.cjs.map +1 -0
- package/dist/{kaiAgentClient-BJj_2aqt.d.ts → kaiAgentClient-B5L4gbQ1.d.ts} +8 -3
- package/dist/{kaiAgentClient-DhTaM3GC.d.cts → kaiAgentClient-CHpULyeG.d.cts} +8 -3
- package/dist/management/index.cjs +1 -1
- package/dist/management/index.d.cts +2 -2
- package/dist/management/index.d.ts +2 -2
- package/dist/management/index.js +1 -1
- package/dist/management/types.d.cts +2 -2
- package/dist/management/types.d.ts +2 -2
- package/dist/{management-BoxlRNg2.cjs → management-DeZiQSlw.cjs} +41 -8
- package/dist/management-DeZiQSlw.cjs.map +1 -0
- package/dist/{management-Bp440RsV.js → management-ckdnu1dA.js} +41 -8
- package/dist/management-ckdnu1dA.js.map +1 -0
- package/dist/metastore/index.cjs +1 -1
- package/dist/metastore/index.js +1 -1
- package/dist/{metastore-BYYWTb3m.cjs → metastore-9AGrwjmN.cjs} +4 -4
- package/dist/{metastore-BYYWTb3m.cjs.map → metastore-9AGrwjmN.cjs.map} +1 -1
- package/dist/{metastore-VCDRVhUT.js → metastore-B0PolCjQ.js} +4 -4
- package/dist/{metastore-VCDRVhUT.js.map → metastore-B0PolCjQ.js.map} +1 -1
- package/dist/microsoftGraph/index.cjs +2 -2
- package/dist/microsoftGraph/index.js +2 -2
- package/dist/notifications/index.cjs +3 -3
- package/dist/notifications/index.js +3 -3
- package/dist/oauth/index.cjs +1 -1
- package/dist/oauth/index.js +1 -1
- package/dist/{oauth--asfePw-.js → oauth-BnHVf4cB.js} +5 -5
- package/dist/{oauth--asfePw-.js.map → oauth-BnHVf4cB.js.map} +1 -1
- package/dist/{oauth-B8yqG6Sy.cjs → oauth-DNtv4Ihb.cjs} +5 -5
- package/dist/{oauth-B8yqG6Sy.cjs.map → oauth-DNtv4Ihb.cjs.map} +1 -1
- package/dist/omnisearch/index.cjs +2 -2
- package/dist/omnisearch/index.js +2 -2
- package/dist/{project-hePfzUY0.d.cts → project-BRpzv3yE.d.cts} +2 -2
- package/dist/{project-C2wvX0xZ.d.ts → project-DCHOxRWd.d.ts} +2 -2
- package/dist/queryService/index.cjs +1 -1
- package/dist/queryService/index.d.cts +1 -1
- package/dist/queryService/index.d.ts +1 -1
- package/dist/queryService/index.js +1 -1
- package/dist/{queryService-BVtjkXy1.cjs → queryService-BVwD6Vmc.cjs} +5 -5
- package/dist/{queryService-BVtjkXy1.cjs.map → queryService-BVwD6Vmc.cjs.map} +1 -1
- package/dist/{queryService-Ca65E5KH.js → queryService-j3XZ2mX6.js} +5 -5
- package/dist/{queryService-Ca65E5KH.js.map → queryService-j3XZ2mX6.js.map} +1 -1
- package/dist/queue/index.cjs +1 -1
- package/dist/queue/index.d.cts +1 -1
- package/dist/queue/index.d.ts +1 -1
- package/dist/queue/index.js +1 -1
- package/dist/{queue-DyotLFJi.js → queue-Dagl0sdP.js} +4 -4
- package/dist/{queue-DyotLFJi.js.map → queue-Dagl0sdP.js.map} +1 -1
- package/dist/{queue-OJJUUqc2.cjs → queue-e3rMWbmK.cjs} +4 -4
- package/dist/{queue-OJJUUqc2.cjs.map → queue-e3rMWbmK.cjs.map} +1 -1
- package/dist/scheduler/index.cjs +3 -3
- package/dist/scheduler/index.js +3 -3
- package/dist/sdk/configurations/index.d.cts +4 -4
- package/dist/sdk/configurations/index.d.ts +4 -4
- package/dist/sdk/developerPortal/index.cjs +3 -3
- package/dist/sdk/developerPortal/index.js +3 -3
- package/dist/sdk/queryService/index.d.cts +1 -1
- package/dist/sdk/queryService/index.d.ts +1 -1
- package/dist/sdk/semanticLayer/index.cjs +1 -1
- package/dist/sdk/semanticLayer/index.js +1 -1
- package/dist/sdk/storage/index.d.cts +1 -1
- package/dist/sdk/storage/index.d.ts +1 -1
- package/dist/sdk/vault/index.d.cts +1 -1
- package/dist/sdk/vault/index.d.ts +1 -1
- package/dist/{semanticLayer-CSqmtHRo.js → semanticLayer-6_gtFxDu.js} +38 -5
- package/dist/semanticLayer-6_gtFxDu.js.map +1 -0
- package/dist/{semanticLayer-E0Vilu8u.cjs → semanticLayer-9uTaU7UT.cjs} +38 -5
- package/dist/semanticLayer-9uTaU7UT.cjs.map +1 -0
- package/dist/{serviceIds-DRcoTnSd.d.ts → serviceIds-DC-H6ZD9.d.cts} +2 -1
- package/dist/{serviceIds-DRcoTnSd.d.cts → serviceIds-DC-H6ZD9.d.ts} +2 -1
- package/dist/status/index.cjs +1 -1
- package/dist/status/index.js +1 -1
- package/dist/storage/index.cjs +5 -4
- package/dist/storage/index.d.cts +2 -2
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +5 -5
- package/dist/storage/types.d.cts +3 -3
- package/dist/storage/types.d.ts +3 -3
- package/dist/{storage-BKm7cztt.cjs → storage-HFUdEy7P.cjs} +43 -6
- package/dist/storage-HFUdEy7P.cjs.map +1 -0
- package/dist/{storage-LYwFQPNO.js → storage-Ob1LUIDq.js} +38 -7
- package/dist/storage-Ob1LUIDq.js.map +1 -0
- package/dist/stream/index.cjs +3 -3
- package/dist/stream/index.js +3 -3
- package/dist/syncActions/index.cjs +1 -1
- package/dist/syncActions/index.js +1 -1
- package/dist/{syncActions-QeBhIVhG.js → syncActions-B3NS5a0g.js} +5 -5
- package/dist/{syncActions-QeBhIVhG.js.map → syncActions-B3NS5a0g.js.map} +1 -1
- package/dist/{syncActions-OEZdVffK.cjs → syncActions-D2DhY6pP.cjs} +5 -5
- package/dist/{syncActions-OEZdVffK.cjs.map → syncActions-D2DhY6pP.cjs.map} +1 -1
- package/dist/telemetry/index.cjs +3 -3
- package/dist/telemetry/index.js +3 -3
- package/dist/{types-CzsnuPFh.d.cts → types-B-P4vQe0.d.cts} +35 -2
- package/dist/{types-DEc55spK.d.ts → types-B95uNQ9o.d.ts} +3 -3
- package/dist/{types-BQsOHNI0.d.ts → types-BrPlv-NS.d.ts} +3 -3
- package/dist/{types-DjrRmQUe.d.cts → types-CmF3pR2n.d.cts} +3 -3
- package/dist/{types-f8W_j6qD.d.cts → types-Crhy0c9m.d.cts} +657 -199
- package/dist/{types-DPS8nwkV.d.cts → types-DOyNe7oe.d.cts} +2 -1
- package/dist/{types-BuqxXXYP.d.ts → types-DPl8pZsY.d.ts} +35 -2
- package/dist/{types-CaYtinmA.d.cts → types-D_j2Uq5X.d.cts} +3 -3
- package/dist/{types-BupPADSm.d.ts → types-DrqKICcK.d.ts} +657 -199
- package/dist/{types-DBOSvWtD.d.ts → types-gi4Eay19.d.ts} +2 -1
- package/dist/{validateConnectionStatus-olE2sQ3U.js → validateConnectionStatus-828HV8WL.js} +4 -3
- package/dist/validateConnectionStatus-828HV8WL.js.map +1 -0
- package/dist/{validateConnectionStatus-CsvYmCOI.cjs → validateConnectionStatus-CvBKyeDO.cjs} +4 -3
- package/dist/validateConnectionStatus-CvBKyeDO.cjs.map +1 -0
- package/dist/vault/index.cjs +4 -4
- package/dist/vault/index.js +4 -4
- package/package.json +28 -2
- package/surface/businessWorkspaceApi.md +12 -0
- package/surface/chat.md +1 -1
- package/surface/kaiAgent.md +5 -2
- package/surface/management.md +4 -0
- package/dist/constants-C4DlsF_M.cjs.map +0 -1
- package/dist/constants-wfbFsqqN.js.map +0 -1
- package/dist/createFetchClient-DgMiqTJ8.cjs.map +0 -1
- package/dist/createFetchClient-U-ZrwPl2.js.map +0 -1
- package/dist/kaiAgent-8LNzGhZc.js.map +0 -1
- package/dist/kaiAgent-B_TaUPRt.cjs.map +0 -1
- package/dist/management-BoxlRNg2.cjs.map +0 -1
- package/dist/management-Bp440RsV.js.map +0 -1
- package/dist/semanticLayer-CSqmtHRo.js.map +0 -1
- package/dist/semanticLayer-E0Vilu8u.cjs.map +0 -1
- package/dist/storage-BKm7cztt.cjs.map +0 -1
- package/dist/storage-LYwFQPNO.js.map +0 -1
- package/dist/validateConnectionStatus-CsvYmCOI.cjs.map +0 -1
- package/dist/validateConnectionStatus-olE2sQ3U.js.map +0 -1
|
@@ -33517,6 +33517,7 @@ type StorageToken = Omit<StorageTokenRaw, 'token' | 'owner' | 'organization' | '
|
|
|
33517
33517
|
owner: StorageTokenOwner;
|
|
33518
33518
|
organization: {
|
|
33519
33519
|
id: string;
|
|
33520
|
+
created?: string | null;
|
|
33520
33521
|
};
|
|
33521
33522
|
admin: StorageTokenAdmin;
|
|
33522
33523
|
adminOwner: StorageTokenAdminOwner;
|
|
@@ -33554,4 +33555,4 @@ type ShareTokenInput = {
|
|
|
33554
33555
|
} & ShareTokenBody;
|
|
33555
33556
|
//#endregion
|
|
33556
33557
|
export { ProjectId as a, ShareTokenSchemaBody as c, TokenListItem as d, UpdateTokenBody as f, paths as g, components as h, GetTokenEventsInput as i, StorageToken as l, UpdateTokenSchemaBody as m, CreateTokenResponse as n, ShareTokenBody as o, UpdateTokenInput as p, CreateTokenSchemaBody as r, ShareTokenInput as s, CreateTokenBody as t, StorageTokenRaw as u };
|
|
33557
|
-
//# sourceMappingURL=types-
|
|
33558
|
+
//# sourceMappingURL=types-gi4Eay19.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as defaultValidateStatus, g as ApiError } from "./createFetchClient-
|
|
2
|
-
import { t as isLoginPageRedirect } from "./isLoginPageRedirect-
|
|
1
|
+
import { c as defaultValidateStatus, g as ApiError } from "./createFetchClient-C-cadpBx.js";
|
|
2
|
+
import { t as isLoginPageRedirect } from "./isLoginPageRedirect-hyPqyWNX.js";
|
|
3
3
|
//#region src/errors/HtmlResponseError.ts
|
|
4
4
|
/**
|
|
5
5
|
* A successful response that carried an HTML page instead of the endpoint's payload.
|
|
@@ -15,6 +15,7 @@ import { t as isLoginPageRedirect } from "./isLoginPageRedirect-BTTAedW-.js";
|
|
|
15
15
|
var HtmlResponseError = class extends ApiError {
|
|
16
16
|
constructor(res) {
|
|
17
17
|
super(res);
|
|
18
|
+
this.name = "HtmlResponseError";
|
|
18
19
|
this.message = "Expected data, got an HTML page. The session has most likely expired.";
|
|
19
20
|
}
|
|
20
21
|
};
|
|
@@ -36,4 +37,4 @@ const validateConnectionStatus = (apiResponse) => {
|
|
|
36
37
|
//#endregion
|
|
37
38
|
export { HtmlResponseError as n, isHtmlResponseError as r, validateConnectionStatus as t };
|
|
38
39
|
|
|
39
|
-
//# sourceMappingURL=validateConnectionStatus-
|
|
40
|
+
//# sourceMappingURL=validateConnectionStatus-828HV8WL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateConnectionStatus-828HV8WL.js","names":[],"sources":["../src/errors/HtmlResponseError.ts","../src/clients/validateConnectionStatus.ts"],"sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nimport { ApiError } from './ApiError';\n\n/**\n * A successful response that carried an HTML page instead of the endpoint's payload.\n *\n * - Connection answers an expired session with a 302 to the login screen, and `fetch` follows it,\n * so the request resolves `200 text/html`.\n * - Without this the page reaches the caller as a string typed as the endpoint's DTO and fails much\n * later, wherever the value is first read — an Immutable accessor on a string, modules away.\n * - The message stays constant so Sentry groups every occurrence together; `request` and `response`\n * carry the per-request detail.\n * - Raised only by the clients that opt in: some APIs do serve HTML from a 200 on purpose.\n */\nexport class HtmlResponseError extends ApiError {\n constructor(res: ApiResponse) {\n super(res);\n this.name = 'HtmlResponseError';\n this.message = 'Expected data, got an HTML page. The session has most likely expired.';\n }\n}\n\nexport const isHtmlResponseError = (error: unknown): error is HtmlResponseError =>\n error instanceof HtmlResponseError;\n","import { HtmlResponseError } from '../errors';\nimport { defaultValidateStatus, type ValidateStatusFn } from '../fetchClient';\n\nimport { isLoginPageRedirect } from './isLoginPageRedirect';\n\n/**\n * Status validation for the APIs Connection serves off its own host — storage and auth.\n *\n * - Rejects a successful login page; `HtmlResponseError` says why.\n * - HTML on a *failed* response is a real error page and stays an `ApiError`.\n * - Management answers the same condition with its own session-expiry error instead.\n */\nexport const validateConnectionStatus: ValidateStatusFn = (apiResponse) => {\n const isValid = defaultValidateStatus(apiResponse);\n\n if (isValid && isLoginPageRedirect(apiResponse)) {\n return new HtmlResponseError(apiResponse);\n }\n\n return isValid;\n};\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAa,oBAAb,cAAuC,SAAS;CAC9C,YAAY,KAAkB;EAC5B,MAAM,GAAG;EACT,KAAK,OAAO;EACZ,KAAK,UAAU;CACjB;AACF;AAEA,MAAa,uBAAuB,UAClC,iBAAiB;;;;;;;;;;ACZnB,MAAa,4BAA8C,gBAAgB;CACzE,MAAM,UAAU,sBAAsB,WAAW;CAEjD,IAAI,WAAW,oBAAoB,WAAW,GAC5C,OAAO,IAAI,kBAAkB,WAAW;CAG1C,OAAO;AACT"}
|
package/dist/{validateConnectionStatus-CsvYmCOI.cjs → validateConnectionStatus-CvBKyeDO.cjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_createFetchClient = require("./createFetchClient-
|
|
2
|
-
const require_isLoginPageRedirect = require("./isLoginPageRedirect-
|
|
1
|
+
const require_createFetchClient = require("./createFetchClient-BlgPbjFj.cjs");
|
|
2
|
+
const require_isLoginPageRedirect = require("./isLoginPageRedirect-Cm6Pn8Pj.cjs");
|
|
3
3
|
//#region src/errors/HtmlResponseError.ts
|
|
4
4
|
/**
|
|
5
5
|
* A successful response that carried an HTML page instead of the endpoint's payload.
|
|
@@ -15,6 +15,7 @@ const require_isLoginPageRedirect = require("./isLoginPageRedirect-B0EmRsHr.cjs"
|
|
|
15
15
|
var HtmlResponseError = class extends require_createFetchClient.ApiError {
|
|
16
16
|
constructor(res) {
|
|
17
17
|
super(res);
|
|
18
|
+
this.name = "HtmlResponseError";
|
|
18
19
|
this.message = "Expected data, got an HTML page. The session has most likely expired.";
|
|
19
20
|
}
|
|
20
21
|
};
|
|
@@ -53,4 +54,4 @@ Object.defineProperty(exports, "validateConnectionStatus", {
|
|
|
53
54
|
}
|
|
54
55
|
});
|
|
55
56
|
|
|
56
|
-
//# sourceMappingURL=validateConnectionStatus-
|
|
57
|
+
//# sourceMappingURL=validateConnectionStatus-CvBKyeDO.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateConnectionStatus-CvBKyeDO.cjs","names":["ApiError","defaultValidateStatus","isLoginPageRedirect"],"sources":["../src/errors/HtmlResponseError.ts","../src/clients/validateConnectionStatus.ts"],"sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nimport { ApiError } from './ApiError';\n\n/**\n * A successful response that carried an HTML page instead of the endpoint's payload.\n *\n * - Connection answers an expired session with a 302 to the login screen, and `fetch` follows it,\n * so the request resolves `200 text/html`.\n * - Without this the page reaches the caller as a string typed as the endpoint's DTO and fails much\n * later, wherever the value is first read — an Immutable accessor on a string, modules away.\n * - The message stays constant so Sentry groups every occurrence together; `request` and `response`\n * carry the per-request detail.\n * - Raised only by the clients that opt in: some APIs do serve HTML from a 200 on purpose.\n */\nexport class HtmlResponseError extends ApiError {\n constructor(res: ApiResponse) {\n super(res);\n this.name = 'HtmlResponseError';\n this.message = 'Expected data, got an HTML page. The session has most likely expired.';\n }\n}\n\nexport const isHtmlResponseError = (error: unknown): error is HtmlResponseError =>\n error instanceof HtmlResponseError;\n","import { HtmlResponseError } from '../errors';\nimport { defaultValidateStatus, type ValidateStatusFn } from '../fetchClient';\n\nimport { isLoginPageRedirect } from './isLoginPageRedirect';\n\n/**\n * Status validation for the APIs Connection serves off its own host — storage and auth.\n *\n * - Rejects a successful login page; `HtmlResponseError` says why.\n * - HTML on a *failed* response is a real error page and stays an `ApiError`.\n * - Management answers the same condition with its own session-expiry error instead.\n */\nexport const validateConnectionStatus: ValidateStatusFn = (apiResponse) => {\n const isValid = defaultValidateStatus(apiResponse);\n\n if (isValid && isLoginPageRedirect(apiResponse)) {\n return new HtmlResponseError(apiResponse);\n }\n\n return isValid;\n};\n"],"mappings":";;;;;;;;;;;;;;AAeA,IAAa,oBAAb,cAAuCA,0BAAAA,SAAS;CAC9C,YAAY,KAAkB;EAC5B,MAAM,GAAG;EACT,KAAK,OAAO;EACZ,KAAK,UAAU;CACjB;AACF;AAEA,MAAa,uBAAuB,UAClC,iBAAiB;;;;;;;;;;ACZnB,MAAa,4BAA8C,gBAAgB;CACzE,MAAM,UAAUC,0BAAAA,sBAAsB,WAAW;CAEjD,IAAI,WAAWC,4BAAAA,oBAAoB,WAAW,GAC5C,OAAO,IAAI,kBAAkB,WAAW;CAG1C,OAAO;AACT"}
|
package/dist/vault/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_UserError = require("../UserError-CSGO1qII.cjs");
|
|
3
|
-
require("../createFetchClient-
|
|
4
|
-
const require_createGenericFetchClient = require("../createGenericFetchClient-
|
|
5
|
-
const require_createOpenapiFetchClient = require("../createOpenapiFetchClient-
|
|
6
|
-
const require_auth = require("../auth-
|
|
3
|
+
require("../createFetchClient-BlgPbjFj.cjs");
|
|
4
|
+
const require_createGenericFetchClient = require("../createGenericFetchClient-lcozzwk2.cjs");
|
|
5
|
+
const require_createOpenapiFetchClient = require("../createOpenapiFetchClient-C3UmDXpe.cjs");
|
|
6
|
+
const require_auth = require("../auth-DLWnl18b.cjs");
|
|
7
7
|
//#region src/clients/vault/vaultClient.ts
|
|
8
8
|
const createVaultClient = ({ baseUrl, middlewares, auth }) => {
|
|
9
9
|
const client = require_createOpenapiFetchClient.createOpenapiFetchClient({
|
package/dist/vault/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as UserError } from "../UserError-By_Zckmc.js";
|
|
2
|
-
import "../createFetchClient-
|
|
3
|
-
import { t as createGenericFetchClient } from "../createGenericFetchClient-
|
|
4
|
-
import { t as createOpenapiFetchClient } from "../createOpenapiFetchClient-
|
|
5
|
-
import { t as createAuthHeaders } from "../auth-
|
|
2
|
+
import "../createFetchClient-C-cadpBx.js";
|
|
3
|
+
import { t as createGenericFetchClient } from "../createGenericFetchClient-Bnf1QK9W.js";
|
|
4
|
+
import { t as createOpenapiFetchClient } from "../createOpenapiFetchClient-COaPeeQ0.js";
|
|
5
|
+
import { t as createAuthHeaders } from "../auth-BjmkFOgd.js";
|
|
6
6
|
//#region src/clients/vault/vaultClient.ts
|
|
7
7
|
const createVaultClient = ({ baseUrl, middlewares, auth }) => {
|
|
8
8
|
const client = createOpenapiFetchClient({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keboola/api-client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "39.0.0",
|
|
4
4
|
"description": "TypeScript SDK for Keboola APIs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
"auth/types": [
|
|
42
42
|
"./dist/auth/types.d.ts"
|
|
43
43
|
],
|
|
44
|
+
"businessWorkspaceApi": [
|
|
45
|
+
"./dist/businessWorkspaceApi/index.d.ts"
|
|
46
|
+
],
|
|
47
|
+
"businessWorkspaceApi/types": [
|
|
48
|
+
"./dist/businessWorkspaceApi/types.d.ts"
|
|
49
|
+
],
|
|
44
50
|
"billing": [
|
|
45
51
|
"./dist/billing/index.d.ts"
|
|
46
52
|
],
|
|
@@ -332,6 +338,26 @@
|
|
|
332
338
|
"default": "./dist/auth/types.cjs"
|
|
333
339
|
}
|
|
334
340
|
},
|
|
341
|
+
"./businessWorkspaceApi": {
|
|
342
|
+
"import": {
|
|
343
|
+
"types": "./dist/businessWorkspaceApi/index.d.ts",
|
|
344
|
+
"default": "./dist/businessWorkspaceApi/index.js"
|
|
345
|
+
},
|
|
346
|
+
"require": {
|
|
347
|
+
"types": "./dist/businessWorkspaceApi/index.d.cts",
|
|
348
|
+
"default": "./dist/businessWorkspaceApi/index.cjs"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"./businessWorkspaceApi/types": {
|
|
352
|
+
"import": {
|
|
353
|
+
"types": "./dist/businessWorkspaceApi/types.d.ts",
|
|
354
|
+
"default": "./dist/businessWorkspaceApi/types.js"
|
|
355
|
+
},
|
|
356
|
+
"require": {
|
|
357
|
+
"types": "./dist/businessWorkspaceApi/types.d.cts",
|
|
358
|
+
"default": "./dist/businessWorkspaceApi/types.cjs"
|
|
359
|
+
}
|
|
360
|
+
},
|
|
335
361
|
"./billing": {
|
|
336
362
|
"import": {
|
|
337
363
|
"types": "./dist/billing/index.d.ts",
|
|
@@ -933,8 +959,8 @@
|
|
|
933
959
|
"vite": "^8.3.0",
|
|
934
960
|
"vitest": "^4.1.11",
|
|
935
961
|
"yaml": "^2.8.3",
|
|
936
|
-
"@keboola/oxlint-config": "^10.1.0",
|
|
937
962
|
"@keboola/tsconfig": "^0.2.1",
|
|
963
|
+
"@keboola/oxlint-config": "^10.1.0",
|
|
938
964
|
"@keboola/vitest-config": "^1.0.0"
|
|
939
965
|
},
|
|
940
966
|
"scripts": {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# `api.businessWorkspaceApi` — `@keboola/api-client` surface
|
|
2
|
+
|
|
3
|
+
<!-- GENERATED FILE — do not edit by hand. Run `pnpm --filter @keboola/api-client surface` to regenerate. -->
|
|
4
|
+
|
|
5
|
+
Part of the [`@keboola/api-client` surface index](../API-SURFACE.md).
|
|
6
|
+
|
|
7
|
+
- `api.businessWorkspaceApi.createDashboard(input: { id?: string | undefined; title: string; description?: string | null | undefined; primaryProjectId?: number | undefined; sourceProjectIds?: number[] | undefined; spec: { [key: string]: unknown; }; }, signal?: AbortSignal | undefined): Promise<{ id: string; ownerUserId: number; primaryProjectId: number; sourceProjectIds: number[]; title: string; description: string | null; spec: { [key: string]: unknown; }; createdAt: string; updatedAt: string; }>`
|
|
8
|
+
- `api.businessWorkspaceApi.deleteDashboard(id: string, signal?: AbortSignal | undefined): Promise<void>`
|
|
9
|
+
- `api.businessWorkspaceApi.getDashboard(id: string, signal?: AbortSignal | undefined): Promise<{ id: string; ownerUserId: number; primaryProjectId: number; sourceProjectIds: number[]; title: string; description: string | null; spec: { [key: string]: unknown; }; createdAt: string; updatedAt: string; }>`
|
|
10
|
+
- `api.businessWorkspaceApi.getDashboards(signal?: AbortSignal | undefined): Promise<{ id: string; ownerUserId: number; primaryProjectId: number; sourceProjectIds: number[]; title: string; description: string | null; createdAt: string; updatedAt: string; }[]>`
|
|
11
|
+
- `api.businessWorkspaceApi.healthCheck(signal?: AbortSignal | undefined): Promise<{ status: "ok"; }>`
|
|
12
|
+
- `api.businessWorkspaceApi.updateDashboard(id: string, input: { id?: string | undefined; title: string; description?: string | null | undefined; primaryProjectId?: number | undefined; sourceProjectIds?: number[] | undefined; spec: { [key: string]: unknown; }; }, signal?: AbortSignal | undefined): Promise<{ id: string; ownerUserId: number; primaryProjectId: number; sourceProjectIds: number[]; title: string; description: string | null; spec: { [key: string]: unknown; }; createdAt: string; updatedAt: string; }>`
|
package/surface/chat.md
CHANGED
|
@@ -8,7 +8,7 @@ Part of the [`@keboola/api-client` surface index](../API-SURFACE.md).
|
|
|
8
8
|
- `api.chat.deleteChat(chatId: string): Promise<{ id: string; title: string; userId: string; createdAt: string; lastMessageAt: string; visibility: "public" | "private"; branchId?: number | null | undefined; }>`
|
|
9
9
|
- `api.chat.getAgentSettings(signal?: AbortSignal | undefined): Promise<{ projectId: string; customInstructions: string | null; createdAt: string; updatedAt: string; }>`
|
|
10
10
|
- `api.chat.getChat(chatId: string, signal?: AbortSignal | undefined): Promise<{ id: string; title: string; userId: string; createdAt: string; lastMessageAt: string; visibility: "public" | "private"; branchId?: number | null | undefined; messages: { id: string; role: "user" | "assistant"; parts: ({ type: "text"; text: string; state?: "done" | undefined; } | { type: "tool-result"; toolCallId: string; toolName: string; result: string; } | { type: "step-start"; } | { type: string; toolCallId: string; state: "output-available" | "output-error" | "output-denied" | "input-available" | "input-streaming" | "approval-requested" | "approval-responded"; input?: { [key: string]: unknown; } | undefined; output?: unknown; errorText?: string | undefined; approval?: { id?: string | undefined; approved?: boolean | undefined; reason?: string | undefined; } | undefined; })[]; metadata?: { createdAt?: string | undefined; hidden?: boolean | undefined; requestContext?: { path?: string | undefined; sqlEditorActive?: boolean | undefined; } | undefined; compactedTo?: string | undefined; compactedFrom?: string | undefined; } | undefined; status?: "completed" | "failed" | "pending" | "interrupted" | undefined; }[]; }>`
|
|
11
|
-
- `api.chat.getHistory(params?: { limit?: number | undefined; starting_after?: string | undefined; ending_before?: string | undefined; } | undefined): Promise<{ chats: { id: string; title: string; userId: string; createdAt: string; lastMessageAt: string; visibility: "public" | "private"; branchId?: number | null | undefined; }[]; hasMore: boolean; }>`
|
|
11
|
+
- `api.chat.getHistory(params?: { limit?: number | undefined; starting_after?: string | undefined; ending_before?: string | undefined; } | undefined, signal?: AbortSignal | undefined): Promise<{ chats: { id: string; title: string; userId: string; createdAt: string; lastMessageAt: string; visibility: "public" | "private"; branchId?: number | null | undefined; }[]; hasMore: boolean; }>`
|
|
12
12
|
- `api.chat.getSuggestions(request: { context: "dashboard"; data: { recentFailedJobs: { id: string; status: "error" | "warning"; component: string; configId: string; createdTime: string; configName?: string | undefined; durationSeconds?: number | undefined; errorMessage?: string | undefined; }[]; deprecatedComponents: { id: string; name: string; type: string; expiredOn: string; configCount: number; }[]; userRecentEdits: { component: string; configId: string; configName: string; lastEdited: string; }[]; currentUserEmail: string; }; } | { context: "job-detail"; data: { job: { id: string; status: "error" | "success" | "warning" | "created" | "waiting" | "processing" | "terminating" | "terminated" | "cancelled"; component: string; createdTime: string; configId?: string | undefined; configName?: string | undefined; startTime?: string | undefined; endTime?: string | undefined; durationSeconds?: number | undefined; errorMessage?: string | undefined; errorType?: "user" | "application" | undefined; backendSize?: string | undefined; }; currentUserEmail: string; component?: { id: string; name: string; type: string; } | undefined; runtimeHistory?: { recentJobsCount: number; averageDurationSeconds?: number | undefined; minDurationSeconds?: number | undefined; maxDurationSeconds?: number | undefined; isSlowerThanAverage?: boolean | undefined; isFasterThanAverage?: boolean | undefined; percentageDifference?: number | undefined; } | undefined; }; } | { context: "configuration-detail"; data: { configuration: { id: string; name: string; component: string; hasRows: boolean; description?: string | undefined; rowCount?: number | undefined; lastChangeDescription?: string | undefined; }; currentUserEmail: string; component?: { id: string; name: string; type: string; } | undefined; latestJobs?: { id: string; status: "error" | "success" | "warning" | "created" | "waiting" | "processing" | "terminating" | "terminated" | "cancelled"; createdTime: string; durationSeconds?: number | undefined; errorMessage?: string | undefined; }[] | undefined; }; }, signal?: AbortSignal | undefined): Promise<{ suggestions: { label: string; prompt: string; priority: number; category: "error" | "maintenance" | "documentation"; reasoning: string; id: string; }[]; suggestionSessionId: string; }>`
|
|
13
13
|
- `api.chat.getToolsList(signal?: AbortSignal | undefined): Promise<{ tools: { name: string; description: string; readOnly: boolean; }[]; }>`
|
|
14
14
|
- `api.chat.getUsage(signal?: AbortSignal | undefined): Promise<{ messagesUsed: number; messagesLimit: number; resetDate: string; }>`
|
package/surface/kaiAgent.md
CHANGED
|
@@ -4,13 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
Part of the [`@keboola/api-client` surface index](../API-SURFACE.md).
|
|
6
6
|
|
|
7
|
-
- `api.kaiAgent.approveToolCall(chatId: string, body: { toolUseId: string; approved: boolean; reason?: string | undefined; updatedInput?: { [key: string]: unknown; } | undefined; answers?: { [key: string]: string; } | undefined; }): Promise<void>`
|
|
7
|
+
- `api.kaiAgent.approveToolCall(chatId: string, body: { toolUseId: string; approved: boolean; reason?: string | undefined; dismissed?: boolean | undefined; updatedInput?: { [key: string]: unknown; } | undefined; answers?: { [key: string]: string; } | undefined; }): Promise<void>`
|
|
8
8
|
- `api.kaiAgent.createChat(request: { id: string; message: { id: string; role: "user" | "assistant"; parts: { [key: string]: unknown; }[]; metadata?: { hidden?: boolean | undefined; requestContext?: { path?: string | undefined; sqlEditorActive?: boolean | undefined; } | undefined; tableContext?: { tableName: string; tableId: string; bucketId: string; fileName: string; }[] | undefined; } | undefined; }; selectedChatModel?: string | undefined; selectedVisibilityType?: "public" | "private" | undefined; branchId?: number | undefined; toolRestrictions?: { allowedTools?: string[] | undefined; disallowedTools?: string[] | undefined; readOnlyMode?: boolean | undefined; } | undefined; telemetryMetadata?: { [key: string]: string | number | boolean; } | undefined; supportsApprovalRequestedEvent?: boolean | undefined; client?: "kbc-ui" | "business-chat" | undefined; }): Promise<Response>`
|
|
9
9
|
- `api.kaiAgent.deleteChat(chatId: string): Promise<{ id?: string | undefined; title?: string | undefined; userId?: string | undefined; createdAt?: string | undefined; visibility?: "public" | "private" | undefined; branchId?: number | null | undefined; }>`
|
|
10
10
|
- `api.kaiAgent.downloadSandboxFile(chatId: string, path: string, signal?: AbortSignal | undefined): Promise<Blob>`
|
|
11
11
|
- `api.kaiAgent.getAgentSettings(signal?: AbortSignal | undefined): Promise<{ projectId: string; customInstructions: string | null; createdAt: string; updatedAt: string; }>`
|
|
12
|
+
- `api.kaiAgent.getArtifact(artifactId: string, signal?: AbortSignal | undefined): Promise<{ id: string; chatId: string; messageId: string; kind: "chart" | "table" | "document"; title: string; summary: string | null; spec: { [key: string]: unknown; }; recipe: { [key: string]: unknown; }; createdAt: string; }>`
|
|
13
|
+
- `api.kaiAgent.getArtifacts(chatId: string, signal?: AbortSignal | undefined): Promise<{ id: string; chatId: string; messageId: string; kind: "chart" | "table" | "document"; title: string; summary: string | null; spec: { [key: string]: unknown; }; recipe: { [key: string]: unknown; }; createdAt: string; }[]>`
|
|
12
14
|
- `api.kaiAgent.getChat(chatId: string, signal?: AbortSignal | undefined): Promise<{ id: string; title: string; userId: string; createdAt: string; lastMessageAt: string; visibility: "public" | "private"; branchId?: number | null | undefined; contextWindow?: { usedTokens: number; maxTokens: number; percentage: number; } | null | undefined; ppuUsed: number | null; ppuPercentage: number | null; messages: { id: string; role: "user" | "assistant"; parts: ({ type: "text"; text: string; state?: "done" | undefined; } | { type: "tool-result"; toolCallId: string; toolName: string; result: string; } | { type: "step-start"; } | { type: "data-compact-boundary"; data: { trigger: "manual" | "auto"; preTokens: number; preservedSegment?: { headUuid: string; anchorUuid: string; tailUuid: string; } | undefined; summary: string; sdkSessionId: string; }; } | { type: string; toolCallId: string; state: "output-available" | "output-error" | "output-denied" | "input-available" | "input-streaming" | "approval-requested" | "approval-responded"; input?: { [key: string]: unknown; } | undefined; output?: unknown; errorText?: string | undefined; approval?: { id: string; approved: boolean; reason?: string | undefined; } | undefined; })[]; metadata?: { createdAt?: string | undefined; hidden?: boolean | undefined; requestContext?: { path?: string | undefined; sqlEditorActive?: boolean | undefined; } | undefined; } | undefined; status?: "completed" | "failed" | "pending" | "interrupted" | undefined; }[]; }>`
|
|
13
|
-
- `api.kaiAgent.getHistory(params?: { limit?: number | undefined; starting_after?: string | undefined; ending_before?: string | undefined; client?: "kbc-ui" | "business-chat" | undefined; } | undefined): Promise<{ chats: { id?: string | undefined; title?: string | undefined; userId?: string | undefined; createdAt?: string | undefined; lastMessageAt?: string | undefined; visibility?: "public" | "private" | undefined; branchId?: number | null | undefined; client?: "kbc-ui" | "business-chat" | null | undefined; }[]; hasMore: boolean; }>`
|
|
15
|
+
- `api.kaiAgent.getHistory(params?: { limit?: number | undefined; starting_after?: string | undefined; ending_before?: string | undefined; client?: "kbc-ui" | "business-chat" | undefined; } | undefined, signal?: AbortSignal | undefined): Promise<{ chats: { id?: string | undefined; title?: string | undefined; userId?: string | undefined; createdAt?: string | undefined; lastMessageAt?: string | undefined; visibility?: "public" | "private" | undefined; branchId?: number | null | undefined; client?: "kbc-ui" | "business-chat" | null | undefined; }[]; hasMore: boolean; }>`
|
|
14
16
|
- `api.kaiAgent.getSandboxGitBranch(chatId: string, signal?: AbortSignal | undefined): Promise<{ branch: string | null; }>`
|
|
15
17
|
- `api.kaiAgent.getSkillsList(signal?: AbortSignal | undefined): Promise<{ skills: { name: string; description: string | null; source: "first-party" | "vendored" | "project"; }[]; commands: { name: string; description: string; }[]; }>`
|
|
16
18
|
- `api.kaiAgent.getSpendCaps(signal?: AbortSignal | undefined): Promise<SpendCapsView>`
|
|
@@ -21,6 +23,7 @@ Part of the [`@keboola/api-client` surface index](../API-SURFACE.md).
|
|
|
21
23
|
- `api.kaiAgent.getVotes(chatId: string): Promise<{ chatId: string; messageId: string; isUpvoted: boolean; }[]>`
|
|
22
24
|
- `api.kaiAgent.healthCheck(signal?: AbortSignal | undefined): Promise<unknown>`
|
|
23
25
|
- `api.kaiAgent.listSandboxFiles(chatId: string, path?: string | undefined, signal?: AbortSignal | undefined): Promise<{ entries: { name: string; path: string; type: "file" | "dir"; size?: number | undefined; }[]; }>`
|
|
26
|
+
- `api.kaiAgent.prepareChat(chatId: string, signal?: AbortSignal | undefined): Promise<{ started: boolean; }>`
|
|
24
27
|
- `api.kaiAgent.readSandboxFile(chatId: string, path: string, signal?: AbortSignal | undefined): Promise<{ content: string; encoding: "utf-8" | "binary"; truncated: boolean; size: number; }>`
|
|
25
28
|
- `api.kaiAgent.setUserSpendLimit(userId: string, overrideLimitPpu: number | null, signal?: AbortSignal | undefined): Promise<{ userId: string; overrideLimitPpu: number | null; effectiveLimitPpu: number | null; usedPpu: number; overrideUpdatedAt: string | null; overrideUpdatedByUserId: string | null; }>`
|
|
26
29
|
- `api.kaiAgent.stopChat(chatId: string): Promise<{ stopped: boolean; }>`
|
package/surface/management.md
CHANGED
|
@@ -113,6 +113,10 @@ Part of the [`@keboola/api-client` surface index](../API-SURFACE.md).
|
|
|
113
113
|
- `api.management.payAsYouGo.updateStripeCustomer(body: { idProject: number; email?: string | null | undefined; name?: string | null | undefined; vatId?: string | null | undefined; addressLine1?: string | null | undefined; addressLine2?: string | null | undefined; addressCity?: string | null | undefined; addressState?: string | null | undefined; addressPostalCode?: string | null | undefined; addressCountry?: string | null | undefined; dropCardId?: string | null | undefined; }): Promise<{ email: string | null; name: string | null; address?: { line1?: string | null | undefined; line2?: string | null | undefined; city?: string | null | undefined; state?: string | null | undefined; postal_code?: string | null | undefined; country?: string | null | undefined; } | undefined; vat_id?: string | undefined; cards: { id: string; brand: string; exp_month: number; exp_year: number; last4: string; funding: string; }[]; }>`
|
|
114
114
|
- `api.management.payAsYouGo.updateTopUpSetting(body: { idProject: number; amount: number; limit: number; enabled: boolean; }): Promise<void>`
|
|
115
115
|
|
|
116
|
+
### `api.management.programmaticProjects`
|
|
117
|
+
|
|
118
|
+
- `api.management.programmaticProjects.confirm(payload: ConfirmProgrammaticProjectPayload, signal?: AbortSignal | undefined): Promise<ConfirmProgrammaticProjectResult>`
|
|
119
|
+
|
|
116
120
|
### `api.management.projects`
|
|
117
121
|
|
|
118
122
|
- `api.management.projects.addProjectFeature({ projectId, feature, }: CreateProjectFeaturePath & CreateProjectFeatureBody): Promise<ProjectBase>`
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-C4DlsF_M.cjs","names":[],"sources":["../src/constants/projectFeatures.ts","../src/constants/backends.ts","../src/constants/serviceIds.ts","../src/constants/stacks.ts","../src/constants/index.ts"],"sourcesContent":["export const ProjectFeature = {\n DisableLegacyBucketPrefix: 'disable-legacy-bucket-prefix',\n SoxProtectedDefaultBranch: 'protected-default-branch',\n StorageBranches: 'storage-branches',\n} as const;\n\nexport type ProjectFeature = (typeof ProjectFeature)[keyof typeof ProjectFeature];\n","export const Backend = {\n Snowflake: 'snowflake',\n Bigquery: 'bigquery',\n} as const;\n\nexport type Backend = (typeof Backend)[keyof typeof Backend];\n","/**\n * Every service a Keboola stack can announce in its `GET /v2/storage` index.\n *\n * - The values are the `id`s the stack reports; `Service['id']` and the service-client registry\n * both narrow on them.\n * - Callers enumerate them at runtime — a test double announcing every service, for one.\n */\nexport const ServiceId = {\n Vault: 'vault',\n DataScience: 'data-science',\n Encryption: 'encryption',\n Telemetry: 'telemetry',\n Ai: 'ai',\n Editor: 'editor',\n Import: 'import',\n Oauth: 'oauth',\n Query: 'query',\n Queue: 'queue',\n KaiAssistant: 'kai-assistant',\n KaiAgent: 'kai-agent',\n SyncActions: 'sync-actions',\n Stream: 'stream',\n Notification: 'notification',\n Scheduler: 'scheduler',\n Metastore: 'metastore',\n Billing: 'billing',\n} as const;\n\nexport type ServiceId = (typeof ServiceId)[keyof typeof ServiceId];\n","export const Provider = {\n Aws: 'aws',\n Azure: 'azure',\n Gcp: 'gcp',\n} as const;\n\nexport type Provider = (typeof Provider)[keyof typeof Provider];\n\nexport const Continent = {\n Us: 'us',\n Europe: 'europe',\n} as const;\n\nexport type Continent = (typeof Continent)[keyof typeof Continent];\n\nexport type KeboolaStack = {\n id: string;\n host: string;\n isSingleTenant?: boolean;\n isTesting?: boolean;\n isPayg?: boolean;\n provider?: Provider;\n continent?: Continent;\n region?: string;\n isCanary?: boolean;\n};\n\nconst stacks = {\n NORTH_EUROPE_AZURE: {\n id: 'com-keboola-azure-north-europe',\n region: 'north-europe',\n host: 'connection.north-europe.azure.keboola.com',\n provider: 'azure',\n continent: 'europe',\n isPayg: true,\n },\n EU_CENTRAL_1_AWS: {\n id: 'kbc-eu-central-1',\n region: 'eu-central-1',\n host: 'connection.eu-central-1.keboola.com',\n provider: 'aws',\n continent: 'europe',\n },\n US_EAST_1_AWS: {\n id: 'kbc-us-east-1',\n region: 'us-east-1',\n host: 'connection.keboola.com',\n provider: 'aws',\n continent: 'us',\n },\n EUROPE_WEST3_GCP: {\n id: 'com-keboola-gcp-europe-west3',\n region: 'europe-west3',\n host: 'connection.europe-west3.gcp.keboola.com',\n provider: 'gcp',\n continent: 'europe',\n },\n US_EAST_4_GCP: {\n id: 'com-keboola-gcp-us-east4',\n region: 'us-east4',\n host: 'connection.us-east4.gcp.keboola.com',\n provider: 'gcp',\n continent: 'us',\n isPayg: true,\n },\n\n /* PRIVATE SINGLE TENANT STACKS\n ---------------------------- */\n HCI: {\n id: 'cloud-keboola-hci',\n host: 'connection.hci.keboola.cloud',\n isSingleTenant: true,\n },\n CSAS_PROD: {\n id: 'cloud-keboola-cs',\n host: 'connection.cs.keboola.cloud',\n isSingleTenant: true,\n },\n CSAS_TEST: {\n id: 'cloud-keboola-cs-test',\n host: 'connection.cs-test.keboola.cloud',\n isSingleTenant: true,\n },\n INNOGY: {\n id: 'cloud-keboola-innogy-hub',\n host: 'connection.innogy-hub.keboola.cloud',\n isSingleTenant: true,\n },\n GROUPON: {\n id: 'cloud-keboola-groupon',\n host: 'connection.groupon.keboola.cloud',\n isSingleTenant: true,\n },\n CREDIT_INFO: {\n id: 'cloud-keboola-creditinfo',\n host: 'connection.creditinfo.keboola.cloud',\n isSingleTenant: true,\n },\n COATES: {\n id: 'cloud-keboola-coates',\n host: 'connection.coates.keboola.cloud',\n isSingleTenant: true,\n },\n SLSP: {\n id: 'cloud-keboola-slsp',\n host: 'connection.slsp.keboola.cloud',\n isSingleTenant: true,\n },\n HCKZ: {\n id: 'cloud-keboola-hckz',\n host: 'connection.hckz.keboola.cloud',\n isSingleTenant: true,\n },\n PASHA: {\n id: 'cloud-keboola-pasha',\n host: 'connection.pasha.keboola.cloud',\n isSingleTenant: true,\n },\n RBI: {\n id: 'cloud-keboola-rbi',\n host: 'connection.rbi.keboola.cloud',\n isSingleTenant: true,\n },\n NAH: {\n id: 'cloud-keboola-nah',\n host: 'connection.nah.keboola.cloud',\n isSingleTenant: true,\n provider: 'azure',\n continent: 'us',\n },\n\n /* DEV STACKS\n ---------------------------- */\n DEV_US_CENTRAL_1_GCP: {\n id: 'dev-keboola-gcp-us-central1',\n region: 'us-central1',\n host: 'connection.us-central1.gcp.keboola.dev',\n provider: 'gcp',\n continent: 'us',\n isTesting: true,\n },\n DEV_EU_WEST_1_AWS: {\n id: 'dev-keboola-aws-eu-west-1',\n region: 'eu-west-1',\n host: 'connection.eu-west-1.aws.keboola.dev',\n provider: 'aws',\n continent: 'europe',\n isTesting: true,\n },\n DEV_US_EAST_2_AZURE: {\n id: 'kbc-testing-azure-east-us-2',\n region: 'east-us-2',\n host: 'connection.east-us-2.azure.keboola-testing.com',\n provider: 'azure',\n continent: 'us',\n isTesting: true,\n },\n DEV_KEBOOLA_CANARY_ORION: {\n id: 'dev-keboola-canary-orion',\n region: 'europe-west3',\n host: 'connection.canary-orion.keboola.dev',\n provider: 'gcp',\n continent: 'europe',\n isCanary: true,\n },\n} satisfies Record<string, Readonly<KeboolaStack>>;\n\n/**\n * Every stack the platform knows, keyed by name.\n *\n * - The key set is literal, so a name that is not in the object is a compile error at the call site\n * rather than an `undefined` to fall back from.\n * - The value type stays the uniform `KeboolaStack`, so `stack.isCanary` reads on any entry, not\n * only on the ones that carry the flag.\n */\nexport const STACKS: Record<keyof typeof stacks, Readonly<KeboolaStack>> = stacks;\n","export { ComponentId } from './componentId';\nexport { ProjectFeature } from './projectFeatures';\nexport { Backend } from './backends';\nexport { AdminRole } from './adminRoles';\nexport { ServiceId } from './serviceIds';\nexport { Continent, Provider, STACKS } from './stacks';\nexport type { KeboolaStack } from './stacks';\n\nexport const URLS = {\n USER_DOCUMENTATION: 'https://help.keboola.com',\n COMPONENTS: 'https://components.keboola.com',\n DEVELOPERS_DOCUMENTATION: 'https://developers.keboola.com',\n ACADEMY: 'https://academy.keboola.com',\n SALES_CONTACT_FORM: 'https://keboola.com/contact',\n SNOWFLAKE: 'https://www.snowflake.com',\n SNOWFLAKE_DOCS: 'https://docs.snowflake.com',\n MCP: 'https://www.keboola.com/mcp',\n CLI: 'https://www.keboola.com/cli',\n NODE_JS: 'https://nodejs.org/en',\n CLAUDE_CONNECTORS: 'https://claude.ai/customize/connectors',\n // Vendor \"how do I get this client\" pages linked from the connect surfaces.\n CLIENT_CLAUDE_CODE_QUICKSTART: 'https://code.claude.com/docs/en/quickstart',\n CLIENT_CLAUDE_AI: 'https://claude.ai',\n CLIENT_CLAUDE_DESKTOP_DOWNLOAD: 'https://claude.com/download',\n CLIENT_CURSOR_QUICKSTART: 'https://cursor.com/docs/get-started/quickstart',\n CLIENT_VS_CODE_SETUP: 'https://code.visualstudio.com/docs/setup/setup-overview',\n CLIENT_CODEX_QUICKSTART: 'https://developers.openai.com/codex/cli',\n CLIENT_CHATGPT_DOWNLOAD: 'https://chatgpt.com/download',\n CLIENT_MAKE_GET_STARTED: 'https://help.make.com/get-started',\n CLIENT_DEVIN_DESKTOP: 'https://docs.devin.ai/desktop/getting-started',\n} as const;\n"],"mappings":";AAAA,MAAa,iBAAiB;CAC5B,2BAA2B;CAC3B,2BAA2B;CAC3B,iBAAiB;AACnB;;;ACJA,MAAa,UAAU;CACrB,WAAW;CACX,UAAU;AACZ;;;;;;;;;;ACIA,MAAa,YAAY;CACvB,OAAO;CACP,aAAa;CACb,YAAY;CACZ,WAAW;CACX,IAAI;CACJ,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,cAAc;CACd,UAAU;CACV,aAAa;CACb,QAAQ;CACR,cAAc;CACd,WAAW;CACX,WAAW;CACX,SAAS;AACX;;;AC1BA,MAAa,WAAW;CACtB,KAAK;CACL,OAAO;CACP,KAAK;AACP;AAIA,MAAa,YAAY;CACvB,IAAI;CACJ,QAAQ;AACV;;;;;;;;;AAoKA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AW;EACX,WAAW;CACb;CACA,qBAAqB;EACnB,IAAI;EACJ,QAAQ;EACR,MAAM;EACN,UAAU;EACV,WAAW;EACX,WAAW;CACb;CACA,0BAA0B;EACxB,IAAI;EACJ,QAAQ;EACR,MAAM;EACN,UAAU;EACV,WAAW;EACX,UAAU;CACZ;AAWyE;;;ACvK3E,MAAa,OAAO;CAClB,oBAAoB;CACpB,YAAY;CACZ,0BAA0B;CAC1B,SAAS;CACT,oBAAoB;CACpB,WAAW;CACX,gBAAgB;CAChB,KAAK;CACL,KAAK;CACL,SAAS;CACT,mBAAmB;CAEnB,+BAA+B;CAC/B,kBAAkB;CAClB,gCAAgC;CAChC,0BAA0B;CAC1B,sBAAsB;CACtB,yBAAyB;CACzB,yBAAyB;CACzB,yBAAyB;CACzB,sBAAsB;AACxB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants-wfbFsqqN.js","names":[],"sources":["../src/constants/projectFeatures.ts","../src/constants/backends.ts","../src/constants/serviceIds.ts","../src/constants/stacks.ts","../src/constants/index.ts"],"sourcesContent":["export const ProjectFeature = {\n DisableLegacyBucketPrefix: 'disable-legacy-bucket-prefix',\n SoxProtectedDefaultBranch: 'protected-default-branch',\n StorageBranches: 'storage-branches',\n} as const;\n\nexport type ProjectFeature = (typeof ProjectFeature)[keyof typeof ProjectFeature];\n","export const Backend = {\n Snowflake: 'snowflake',\n Bigquery: 'bigquery',\n} as const;\n\nexport type Backend = (typeof Backend)[keyof typeof Backend];\n","/**\n * Every service a Keboola stack can announce in its `GET /v2/storage` index.\n *\n * - The values are the `id`s the stack reports; `Service['id']` and the service-client registry\n * both narrow on them.\n * - Callers enumerate them at runtime — a test double announcing every service, for one.\n */\nexport const ServiceId = {\n Vault: 'vault',\n DataScience: 'data-science',\n Encryption: 'encryption',\n Telemetry: 'telemetry',\n Ai: 'ai',\n Editor: 'editor',\n Import: 'import',\n Oauth: 'oauth',\n Query: 'query',\n Queue: 'queue',\n KaiAssistant: 'kai-assistant',\n KaiAgent: 'kai-agent',\n SyncActions: 'sync-actions',\n Stream: 'stream',\n Notification: 'notification',\n Scheduler: 'scheduler',\n Metastore: 'metastore',\n Billing: 'billing',\n} as const;\n\nexport type ServiceId = (typeof ServiceId)[keyof typeof ServiceId];\n","export const Provider = {\n Aws: 'aws',\n Azure: 'azure',\n Gcp: 'gcp',\n} as const;\n\nexport type Provider = (typeof Provider)[keyof typeof Provider];\n\nexport const Continent = {\n Us: 'us',\n Europe: 'europe',\n} as const;\n\nexport type Continent = (typeof Continent)[keyof typeof Continent];\n\nexport type KeboolaStack = {\n id: string;\n host: string;\n isSingleTenant?: boolean;\n isTesting?: boolean;\n isPayg?: boolean;\n provider?: Provider;\n continent?: Continent;\n region?: string;\n isCanary?: boolean;\n};\n\nconst stacks = {\n NORTH_EUROPE_AZURE: {\n id: 'com-keboola-azure-north-europe',\n region: 'north-europe',\n host: 'connection.north-europe.azure.keboola.com',\n provider: 'azure',\n continent: 'europe',\n isPayg: true,\n },\n EU_CENTRAL_1_AWS: {\n id: 'kbc-eu-central-1',\n region: 'eu-central-1',\n host: 'connection.eu-central-1.keboola.com',\n provider: 'aws',\n continent: 'europe',\n },\n US_EAST_1_AWS: {\n id: 'kbc-us-east-1',\n region: 'us-east-1',\n host: 'connection.keboola.com',\n provider: 'aws',\n continent: 'us',\n },\n EUROPE_WEST3_GCP: {\n id: 'com-keboola-gcp-europe-west3',\n region: 'europe-west3',\n host: 'connection.europe-west3.gcp.keboola.com',\n provider: 'gcp',\n continent: 'europe',\n },\n US_EAST_4_GCP: {\n id: 'com-keboola-gcp-us-east4',\n region: 'us-east4',\n host: 'connection.us-east4.gcp.keboola.com',\n provider: 'gcp',\n continent: 'us',\n isPayg: true,\n },\n\n /* PRIVATE SINGLE TENANT STACKS\n ---------------------------- */\n HCI: {\n id: 'cloud-keboola-hci',\n host: 'connection.hci.keboola.cloud',\n isSingleTenant: true,\n },\n CSAS_PROD: {\n id: 'cloud-keboola-cs',\n host: 'connection.cs.keboola.cloud',\n isSingleTenant: true,\n },\n CSAS_TEST: {\n id: 'cloud-keboola-cs-test',\n host: 'connection.cs-test.keboola.cloud',\n isSingleTenant: true,\n },\n INNOGY: {\n id: 'cloud-keboola-innogy-hub',\n host: 'connection.innogy-hub.keboola.cloud',\n isSingleTenant: true,\n },\n GROUPON: {\n id: 'cloud-keboola-groupon',\n host: 'connection.groupon.keboola.cloud',\n isSingleTenant: true,\n },\n CREDIT_INFO: {\n id: 'cloud-keboola-creditinfo',\n host: 'connection.creditinfo.keboola.cloud',\n isSingleTenant: true,\n },\n COATES: {\n id: 'cloud-keboola-coates',\n host: 'connection.coates.keboola.cloud',\n isSingleTenant: true,\n },\n SLSP: {\n id: 'cloud-keboola-slsp',\n host: 'connection.slsp.keboola.cloud',\n isSingleTenant: true,\n },\n HCKZ: {\n id: 'cloud-keboola-hckz',\n host: 'connection.hckz.keboola.cloud',\n isSingleTenant: true,\n },\n PASHA: {\n id: 'cloud-keboola-pasha',\n host: 'connection.pasha.keboola.cloud',\n isSingleTenant: true,\n },\n RBI: {\n id: 'cloud-keboola-rbi',\n host: 'connection.rbi.keboola.cloud',\n isSingleTenant: true,\n },\n NAH: {\n id: 'cloud-keboola-nah',\n host: 'connection.nah.keboola.cloud',\n isSingleTenant: true,\n provider: 'azure',\n continent: 'us',\n },\n\n /* DEV STACKS\n ---------------------------- */\n DEV_US_CENTRAL_1_GCP: {\n id: 'dev-keboola-gcp-us-central1',\n region: 'us-central1',\n host: 'connection.us-central1.gcp.keboola.dev',\n provider: 'gcp',\n continent: 'us',\n isTesting: true,\n },\n DEV_EU_WEST_1_AWS: {\n id: 'dev-keboola-aws-eu-west-1',\n region: 'eu-west-1',\n host: 'connection.eu-west-1.aws.keboola.dev',\n provider: 'aws',\n continent: 'europe',\n isTesting: true,\n },\n DEV_US_EAST_2_AZURE: {\n id: 'kbc-testing-azure-east-us-2',\n region: 'east-us-2',\n host: 'connection.east-us-2.azure.keboola-testing.com',\n provider: 'azure',\n continent: 'us',\n isTesting: true,\n },\n DEV_KEBOOLA_CANARY_ORION: {\n id: 'dev-keboola-canary-orion',\n region: 'europe-west3',\n host: 'connection.canary-orion.keboola.dev',\n provider: 'gcp',\n continent: 'europe',\n isCanary: true,\n },\n} satisfies Record<string, Readonly<KeboolaStack>>;\n\n/**\n * Every stack the platform knows, keyed by name.\n *\n * - The key set is literal, so a name that is not in the object is a compile error at the call site\n * rather than an `undefined` to fall back from.\n * - The value type stays the uniform `KeboolaStack`, so `stack.isCanary` reads on any entry, not\n * only on the ones that carry the flag.\n */\nexport const STACKS: Record<keyof typeof stacks, Readonly<KeboolaStack>> = stacks;\n","export { ComponentId } from './componentId';\nexport { ProjectFeature } from './projectFeatures';\nexport { Backend } from './backends';\nexport { AdminRole } from './adminRoles';\nexport { ServiceId } from './serviceIds';\nexport { Continent, Provider, STACKS } from './stacks';\nexport type { KeboolaStack } from './stacks';\n\nexport const URLS = {\n USER_DOCUMENTATION: 'https://help.keboola.com',\n COMPONENTS: 'https://components.keboola.com',\n DEVELOPERS_DOCUMENTATION: 'https://developers.keboola.com',\n ACADEMY: 'https://academy.keboola.com',\n SALES_CONTACT_FORM: 'https://keboola.com/contact',\n SNOWFLAKE: 'https://www.snowflake.com',\n SNOWFLAKE_DOCS: 'https://docs.snowflake.com',\n MCP: 'https://www.keboola.com/mcp',\n CLI: 'https://www.keboola.com/cli',\n NODE_JS: 'https://nodejs.org/en',\n CLAUDE_CONNECTORS: 'https://claude.ai/customize/connectors',\n // Vendor \"how do I get this client\" pages linked from the connect surfaces.\n CLIENT_CLAUDE_CODE_QUICKSTART: 'https://code.claude.com/docs/en/quickstart',\n CLIENT_CLAUDE_AI: 'https://claude.ai',\n CLIENT_CLAUDE_DESKTOP_DOWNLOAD: 'https://claude.com/download',\n CLIENT_CURSOR_QUICKSTART: 'https://cursor.com/docs/get-started/quickstart',\n CLIENT_VS_CODE_SETUP: 'https://code.visualstudio.com/docs/setup/setup-overview',\n CLIENT_CODEX_QUICKSTART: 'https://developers.openai.com/codex/cli',\n CLIENT_CHATGPT_DOWNLOAD: 'https://chatgpt.com/download',\n CLIENT_MAKE_GET_STARTED: 'https://help.make.com/get-started',\n CLIENT_DEVIN_DESKTOP: 'https://docs.devin.ai/desktop/getting-started',\n} as const;\n"],"mappings":";AAAA,MAAa,iBAAiB;CAC5B,2BAA2B;CAC3B,2BAA2B;CAC3B,iBAAiB;AACnB;;;ACJA,MAAa,UAAU;CACrB,WAAW;CACX,UAAU;AACZ;;;;;;;;;;ACIA,MAAa,YAAY;CACvB,OAAO;CACP,aAAa;CACb,YAAY;CACZ,WAAW;CACX,IAAI;CACJ,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,OAAO;CACP,OAAO;CACP,cAAc;CACd,UAAU;CACV,aAAa;CACb,QAAQ;CACR,cAAc;CACd,WAAW;CACX,WAAW;CACX,SAAS;AACX;;;AC1BA,MAAa,WAAW;CACtB,KAAK;CACL,OAAO;CACP,KAAK;AACP;AAIA,MAAa,YAAY;CACvB,IAAI;CACJ,QAAQ;AACV;;;;;;;;;AAoKA,MAAa,SAA8D;CAnJzE,oBAAoB;EAClB,IAAI;EACJ,QAAQ;EACR,MAAM;EACN,UAAU;EACV,WAAW;EACX,QAAQ;CACV;CACA,kBAAkB;EAChB,IAAI;EACJ,QAAQ;EACR,MAAM;EACN,UAAU;EACV,WAAW;CACb;CACA,eAAe;EACb,IAAI;EACJ,QAAQ;EACR,MAAM;EACN,UAAU;EACV,WAAW;CACb;CACA,kBAAkB;EAChB,IAAI;EACJ,QAAQ;EACR,MAAM;EACN,UAAU;EACV,WAAW;CACb;CACA,eAAe;EACb,IAAI;EACJ,QAAQ;EACR,MAAM;EACN,UAAU;EACV,WAAW;EACX,QAAQ;CACV;CAIA,KAAK;EACH,IAAI;EACJ,MAAM;EACN,gBAAgB;CAClB;CACA,WAAW;EACT,IAAI;EACJ,MAAM;EACN,gBAAgB;CAClB;CACA,WAAW;EACT,IAAI;EACJ,MAAM;EACN,g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-DgMiqTJ8.cjs","names":[],"sources":["../src/errors/ApiError.ts","../src/internal.ts","../src/fetchClient/createFetchClient/utils.ts","../src/fetchClient/createFetchClient/createFetchClient.ts"],"sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nexport class ApiError extends Error {\n response: Response;\n request: Request;\n data: unknown;\n\n constructor({ response, request, data }: ApiResponse) {\n super(response.statusText);\n this.response = response;\n this.request = request;\n this.data = data;\n }\n}\n","// Package-internal constants. Not part of the public\n// `@keboola/api-client/constants` sub-path (that is the `constants/` directory).\n\nexport const KeboolaHttpHeader = {\n STORAGE_API_TOKEN: 'X-StorageApi-Token',\n MANAGEMENT_API_TOKEN: 'X-Kbc-Manageapitoken',\n STORAGE_API_URL: 'x-storageapi-url',\n PROJECT_ID: 'X-KBC-ProjectId',\n /** Storage job a request enqueued, reported on the response rather than in its body. */\n STORAGE_API_JOB_ID: 'X-StorageApi-Job-Id',\n} as const;\n\nexport const HttpStatus = {\n NO_CONTENT: 204,\n BAD_REQUEST: 400,\n UNAUTHORIZED: 401,\n UNPROCESSABLE_ENTITY: 422,\n INTERNAL_SERVER_ERROR: 500,\n BAD_GATEWAY: 502,\n SERVICE_UNAVAILABLE: 503,\n GATEWAY_TIMEOUT: 504,\n} as const;\n\nexport const ENCRYPTED_VALUE_PREFIX = 'KBC::';\n","import type { IStringifyOptions } from 'qs';\nimport qs from 'qs';\n\nimport { HttpStatus } from '../../internal';\n\nimport type {\n ApiResponse,\n BodyParam,\n CreateFetchRequestFn,\n ParseAs,\n PathParam,\n ValidateStatusFn,\n} from './types';\n\n/**\n * Strips trailing slashes from a base URL so concatenating a leading-slash\n * path (e.g. `/v2/storage`) never produces a double slash.\n *\n * Without this, callers that pass `https://connection.keboola.com/` end up\n * issuing requests to `https://connection.keboola.com//v2/storage/...`, which\n * the Storage API rejects with a 404.\n */\nexport const normalizeBaseUrl = (baseUrl: string): string => baseUrl.replace(/\\/+$/, '');\n\nexport const HttpHeader = {\n CONTENT_TYPE: 'content-type',\n CONTENT_DISPOSITION: 'content-disposition',\n AUTHORIZATION: 'Authorization',\n IDEMPOTENCY_KEY: 'Idempotency-Key',\n IF_MATCH: 'If-Match',\n};\n\nexport const HttpContentType = {\n JSON: 'application/json',\n TEXT_PLAIN: 'text/plain',\n FORM_DATA: 'multipart/form-data',\n TEXT_HTML: 'text/html',\n};\n\nexport const defaultValidateStatus: ValidateStatusFn = ({ response }) =>\n response.status >= 200 && response.status <= 299;\n\n/**\n * Whether a response declares HTML.\n *\n * - Media types are case-insensitive, so `Text/HTML` counts.\n * - A header fact only: a `text/html` response may still carry no body at all.\n */\nexport const isHtmlResponse = ({ response }: ApiResponse) =>\n !!response.headers\n .get(HttpHeader.CONTENT_TYPE)\n ?.toLowerCase()\n .includes(HttpContentType.TEXT_HTML);\n\n/**\n * Whether a response carried no payload, across every shape `parseData` produces for one:\n *\n * 1. `null` — a `204`, or a JSON body that was empty or whitespace.\n * 2. `''` — any other media type with an empty body, read as text.\n *\n * Whitespace-only text counts as empty, matching how `parseJson` already treats it.\n */\nexport const isContentEmpty = ({ data }: ApiResponse) =>\n data === null || data === undefined || (typeof data === 'string' && data.trim() === '');\n\nfunction removeUndefined(obj: Record<string, string>) {\n const objCopy = { ...obj };\n for (const [key, value] of Object.entries(objCopy)) {\n if (value == null) delete objCopy[key];\n }\n return objCopy;\n}\n\n// `application/json`, but also `application/json; charset=utf-8` and the `+json` suffix family.\n// Comparing the raw header for equality misses every response that carries a charset.\nconst JSON_MEDIA_TYPE = /^application\\/([\\w.-]+\\+)?json$/;\n\nconst getMediaType = (response: Response) =>\n response.headers.get(HttpHeader.CONTENT_TYPE)?.split(';')[0]?.trim().toLowerCase() ?? '';\n\n// Declared JSON is parsed strictly: a body that doesn't parse is a broken response, not a text\n// payload, and `JSON.parse` throwing is the right answer. Read it as text first only so an empty\n// body can resolve to `null` like a 204 — matching the charset form brings `application/json;\n// charset=utf-8` onto this path, where `response.json()` would turn a 200-with-no-body into a\n// `SyntaxError` it never used to be.\nconst parseJson = async (response: Response) => {\n const text = await response.text();\n return text.trim() === '' ? null : JSON.parse(text);\n};\n\nexport const parseData = async (response: Response, parseAs: ParseAs = 'auto') => {\n // No body to read, whatever the caller asked for.\n if (response.status === HttpStatus.NO_CONTENT) return null;\n\n // Per-method-call override\n if (parseAs === 'text') return response.text();\n if (parseAs === 'blob') return response.blob();\n if (parseAs === 'json') return parseJson(response);\n\n const mediaType = getMediaType(response);\n if (JSON_MEDIA_TYPE.test(mediaType)) return parseJson(response);\n\n // A declared binary payload must come back as bytes — `text()` would decode it as UTF-8 and\n // corrupt it. `application/octet-stream` is the only binary type an endpoint declares today\n // (kai-agent's sandbox file download); widen deliberately, never by sniffing.\n if (mediaType === 'application/octet-stream') return response.blob();\n\n // Any other declared type describes its own payload — the query-service CSV export, the\n // data-science `text/plain` endpoints — so hand back the exact bytes instead of sniffing them.\n return response.text();\n};\n\n// Header instance serialize undefined value as `undefined`, we do not want that\nconst cleanHeadersInit = (headersInit: HeadersInit | undefined) => {\n if (Array.isArray(headersInit)) return headersInit;\n if (headersInit instanceof Headers) return headersInit;\n if (headersInit == null) return headersInit;\n\n return removeUndefined(headersInit);\n};\n\nconst createHeaders = (\n headersInitA: HeadersInit | undefined,\n headersInitB: HeadersInit | undefined,\n) => {\n const headersA = new Headers(cleanHeadersInit(headersInitA));\n const headersB = new Headers(cleanHeadersInit(headersInitB));\n\n headersB.forEach((value, key) => {\n headersA.set(key, value);\n });\n\n return headersA;\n};\n\nexport const createPath = (path: string, pathParam: PathParam = {}) =>\n path.replace(/\\{([^}]+)}/g, (_, key) => {\n if (!(key in pathParam))\n throw new Error(`Path parameter \"${key}\" is missing in the path \"${path}\"`);\n\n return encodeURIComponent(pathParam[key]!);\n });\n\nexport const createSearch = (\n query: Record<string, unknown>,\n options: Pick<IStringifyOptions, 'arrayFormat'> = {},\n) => {\n return qs.stringify(query, {\n encodeValuesOnly: true,\n skipNulls: true,\n ...options,\n });\n};\n\nexport const createBody = (body: BodyParam, headers: Headers) => {\n if (body == null) return null;\n if (body instanceof FormData) return body; // fetch automatically sets content-type header\n if (typeof body === 'string') return body; // fetch automatically sets content-type header\n\n const stringifyBody = JSON.stringify(body);\n const stringBody = stringifyBody === '{}' ? null : stringifyBody;\n if (stringBody) headers.set(HttpHeader.CONTENT_TYPE, HttpContentType.JSON);\n\n return stringBody;\n};\n\nexport const parseContentDispositionHeader = (contentDisposition?: string | null) => {\n // extract the type ('inline' or 'attachment'), default the type to 'unknown'\n const type = (() => {\n const typeMatch = contentDisposition?.match(/^\\s*(inline|attachment)\\s*;/i);\n return (typeMatch?.[1]?.toLowerCase() ?? 'unknown') as 'inline' | 'attachment' | 'unknown';\n })();\n\n // extract the filename, default the type to null\n const filename = (() => {\n const filenameMatch = contentDisposition?.match(/filename=\"([^\"]+)\"/i);\n if (filenameMatch) return filenameMatch[1];\n\n // If no filename=\"...\", check for encoded filename*=UTF-8''\n const encodedFilenameMatch = contentDisposition?.match(/filename\\*=(?:UTF-8'')?([^;]+)/i);\n if (encodedFilenameMatch?.[1]) return decodeURIComponent(encodedFilenameMatch[1]);\n\n // Check for unquoted filenames (rare but possible)\n const unquotedFilenameMatch = contentDisposition?.match(/filename=([^;]+)/i);\n return unquotedFilenameMatch?.[1] ?? null;\n })();\n\n // Return the parsed result\n return { type, filename };\n};\n\nexport const createFetchRequest: CreateFetchRequestFn = ({\n url,\n method,\n params,\n options = {},\n defaultOptions,\n}) => {\n const {\n baseUrl,\n validateStatus: defValidateStatus = defaultValidateStatus,\n headers: defaultHeaders,\n fetchFn: defaultFetchFn,\n ...restDefaultOptions\n } = defaultOptions;\n const {\n validateStatus,\n queryArrayFormat,\n headers: endpointHeaders,\n fetchFn,\n parseAs,\n ...restOptions\n } = options;\n\n const headers = createHeaders(defaultHeaders, endpointHeaders);\n const path = createPath(url, params.path);\n const search = createSearch(params.query ?? {}, { arrayFormat: queryArrayFormat });\n const body = createBody(params.body, headers);\n\n const urlInstance = new URL(normalizeBaseUrl(baseUrl) + path);\n urlInstance.search = search;\n\n const request = new Request(urlInstance, {\n ...restDefaultOptions,\n ...restOptions,\n headers,\n method: method.toUpperCase(),\n body,\n });\n\n return {\n request,\n validateStatus: validateStatus ?? defValidateStatus,\n fetchFn: fetchFn ?? defaultFetchFn,\n parseAs,\n };\n};\n","import { ApiError } from '../../errors';\n\nimport type {\n BaseFetchParams,\n CoreFetchFn,\n CreateFetchClientOptions,\n FetchClientOptions,\n HttpMethod,\n} from './types';\nimport { createFetchRequest, parseData } from './utils';\n\nexport type FetchClientError = TypeError | ApiError | SyntaxError | DOMException;\n\nexport const isApiError = (error: unknown): error is ApiError => error instanceof ApiError;\n\nexport const isAbortError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'AbortError';\n\nexport const isTimeoutError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'TimeoutError';\n\nexport const isFetchClientError = (error: unknown): error is FetchClientError =>\n error instanceof TypeError || error instanceof SyntaxError || isApiError(error);\n\n// `fetchFn` is resolved per request by `createFetchRequest` (endpoint option beats client option),\n// so a single request can swap the transport without rebuilding the client.\nconst coreFetch: CoreFetchFn = async ({ request, validateStatus, fetchFn = fetch, parseAs }) => {\n const response = await fetchFn(request);\n const data = await parseData(response, parseAs);\n\n const apiResponse = {\n request,\n response,\n data,\n };\n\n const boolOrError = validateStatus(apiResponse);\n if (isApiError(boolOrError)) throw boolOrError;\n if (!boolOrError) throw new ApiError(apiResponse);\n\n return apiResponse;\n};\n\nexport const createFetchClient = ({\n middlewares = [],\n ...defaultOptions\n}: CreateFetchClientOptions) => {\n const fetchWithMiddlewares = middlewares.reduceRight(\n (next, middleware) => middleware(next),\n coreFetch,\n );\n\n const createFetchMethod =\n (method: HttpMethod) =>\n async (url: string, params: BaseFetchParams, options: FetchClientOptions = {}) => {\n const request = createFetchRequest({\n url,\n method,\n params,\n defaultOptions,\n options,\n });\n\n const methodMiddlewares = options?.middlewares ?? [];\n\n return methodMiddlewares.reduceRight(\n (next, middleware) => middleware(next),\n fetchWithMiddlewares,\n )(request);\n };\n\n return {\n get: createFetchMethod('get'),\n post: createFetchMethod('post'),\n put: createFetchMethod('put'),\n patch: createFetchMethod('patch'),\n delete: createFetchMethod('delete'),\n };\n};\n"],"mappings":";;;;AAEA,IAAa,WAAb,cAA8B,MAAM;CAClC;CACA;CACA;CAEA,YAAY,EAAE,UAAU,SAAS,QAAqB;EACpD,MAAM,SAAS,UAAU;EACzB,KAAK,WAAW;EAChB,KAAK,UAAU;EACf,KAAK,OAAO;CACd;AACF;;;ACVA,MAAa,oBAAoB;CAC/B,mBAAmB;CACnB,sBAAsB;CACtB,iBAAiB;CACjB,YAAY;;CAEZ,oBAAoB;AACtB;AAEA,MAAa,aAAa;CACxB,YAAY;CACZ,aAAa;CACb,cAAc;CACd,sBAAsB;CACtB,uBAAuB;CACvB,aAAa;CACb,qBAAqB;CACrB,iBAAiB;AACnB;AAEA,MAAa,yBAAyB;;;;;;;;;;;ACDtC,MAAa,oBAAoB,YAA4B,QAAQ,QAAQ,QAAQ,EAAE;AAEvF,MAAa,aAAa;CACxB,cAAc;CACd,qBAAqB;CACrB,eAAe;CACf,iBAAiB;CACjB,UAAU;AACZ;AAEA,MAAa,kBAAkB;CAC7B,MAAM;CACN,YAAY;CACZ,WAAW;CACX,WAAW;AACb;AAEA,MAAa,yBAA2C,EAAE,eACxD,SAAS,UAAU,OAAO,SAAS,UAAU;;;;;;;AAQ/C,MAAa,kBAAkB,EAAE,eAC/B,CAAC,CAAC,SAAS,QACR,IAAI,WAAW,YAAY,CAAC,EAC3B,YAAY,CAAC,CACd,SAAS,gBAAgB,SAAS;;;;;;;;;AAUvC,MAAa,kBAAkB,EAAE,WAC/B,SAAS,QAAQ,SAAS,KAAA,KAAc,OAAO,SAAS,YAAY,KAAK,KAAK,MAAM;AAEtF,SAAS,gBAAgB,KAA6B;CACpD,MAAM,UAAU,EAAE,GAAG,IAAI;CACzB,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO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oBACF,CAAC,CAAC,OAAO;CACX;CAEF,OAAO;EACL,KAAK,kBAAkB,KAAK;EAC5B,MAAM,kBAAkB,MAAM;EAC9B,KAAK,kBAAkB,KAAK;EAC5B,OAAO,kBAAkB,OAAO;EAChC,QAAQ,kBAAkB,QAAQ;CACpC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createFetchClient-U-ZrwPl2.js","names":[],"sources":["../src/errors/ApiError.ts","../src/internal.ts","../src/fetchClient/createFetchClient/utils.ts","../src/fetchClient/createFetchClient/createFetchClient.ts"],"sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nexport class ApiError extends Error {\n response: Response;\n request: Request;\n data: unknown;\n\n constructor({ response, request, data }: ApiResponse) {\n super(response.statusText);\n this.response = response;\n this.request = request;\n this.data = data;\n }\n}\n","// Package-internal constants. Not part of the public\n// `@keboola/api-client/constants` sub-path (that is the `constants/` directory).\n\nexport const KeboolaHttpHeader = {\n STORAGE_API_TOKEN: 'X-StorageApi-Token',\n MANAGEMENT_API_TOKEN: 'X-Kbc-Manageapitoken',\n STORAGE_API_URL: 'x-storageapi-url',\n PROJECT_ID: 'X-KBC-ProjectId',\n /** Storage job a request enqueued, reported on the response rather than in its body. */\n STORAGE_API_JOB_ID: 'X-StorageApi-Job-Id',\n} as const;\n\nexport const HttpStatus = {\n NO_CONTENT: 204,\n BAD_REQUEST: 400,\n UNAUTHORIZED: 401,\n UNPROCESSABLE_ENTITY: 422,\n INTERNAL_SERVER_ERROR: 500,\n BAD_GATEWAY: 502,\n SERVICE_UNAVAILABLE: 503,\n GATEWAY_TIMEOUT: 504,\n} as const;\n\nexport const ENCRYPTED_VALUE_PREFIX = 'KBC::';\n","import type { IStringifyOptions } from 'qs';\nimport qs from 'qs';\n\nimport { HttpStatus } from '../../internal';\n\nimport type {\n ApiResponse,\n BodyParam,\n CreateFetchRequestFn,\n ParseAs,\n PathParam,\n ValidateStatusFn,\n} from './types';\n\n/**\n * Strips trailing slashes from a base URL so concatenating a leading-slash\n * path (e.g. `/v2/storage`) never produces a double slash.\n *\n * Without this, callers that pass `https://connection.keboola.com/` end up\n * issuing requests to `https://connection.keboola.com//v2/storage/...`, which\n * the Storage API rejects with a 404.\n */\nexport const normalizeBaseUrl = (baseUrl: string): string => baseUrl.replace(/\\/+$/, '');\n\nexport const HttpHeader = {\n CONTENT_TYPE: 'content-type',\n CONTENT_DISPOSITION: 'content-disposition',\n AUTHORIZATION: 'Authorization',\n IDEMPOTENCY_KEY: 'Idempotency-Key',\n IF_MATCH: 'If-Match',\n};\n\nexport const HttpContentType = {\n JSON: 'application/json',\n TEXT_PLAIN: 'text/plain',\n FORM_DATA: 'multipart/form-data',\n TEXT_HTML: 'text/html',\n};\n\nexport const defaultValidateStatus: ValidateStatusFn = ({ response }) =>\n response.status >= 200 && response.status <= 299;\n\n/**\n * Whether a response declares HTML.\n *\n * - Media types are case-insensitive, so `Text/HTML` counts.\n * - A header fact only: a `text/html` response may still carry no body at all.\n */\nexport const isHtmlResponse = ({ response }: ApiResponse) =>\n !!response.headers\n .get(HttpHeader.CONTENT_TYPE)\n ?.toLowerCase()\n .includes(HttpContentType.TEXT_HTML);\n\n/**\n * Whether a response carried no payload, across every shape `parseData` produces for one:\n *\n * 1. `null` — a `204`, or a JSON body that was empty or whitespace.\n * 2. `''` — any other media type with an empty body, read as text.\n *\n * Whitespace-only text counts as empty, matching how `parseJson` already treats it.\n */\nexport const isContentEmpty = ({ data }: ApiResponse) =>\n data === null || data === undefined || (typeof data === 'string' && data.trim() === '');\n\nfunction removeUndefined(obj: Record<string, string>) {\n const objCopy = { ...obj };\n for (const [key, value] of Object.entries(objCopy)) {\n if (value == null) delete objCopy[key];\n }\n return objCopy;\n}\n\n// `application/json`, but also `application/json; charset=utf-8` and the `+json` suffix family.\n// Comparing the raw header for equality misses every response that carries a charset.\nconst JSON_MEDIA_TYPE = /^application\\/([\\w.-]+\\+)?json$/;\n\nconst getMediaType = (response: Response) =>\n response.headers.get(HttpHeader.CONTENT_TYPE)?.split(';')[0]?.trim().toLowerCase() ?? '';\n\n// Declared JSON is parsed strictly: a body that doesn't parse is a broken response, not a text\n// payload, and `JSON.parse` throwing is the right answer. Read it as text first only so an empty\n// body can resolve to `null` like a 204 — matching the charset form brings `application/json;\n// charset=utf-8` onto this path, where `response.json()` would turn a 200-with-no-body into a\n// `SyntaxError` it never used to be.\nconst parseJson = async (response: Response) => {\n const text = await response.text();\n return text.trim() === '' ? null : JSON.parse(text);\n};\n\nexport const parseData = async (response: Response, parseAs: ParseAs = 'auto') => {\n // No body to read, whatever the caller asked for.\n if (response.status === HttpStatus.NO_CONTENT) return null;\n\n // Per-method-call override\n if (parseAs === 'text') return response.text();\n if (parseAs === 'blob') return response.blob();\n if (parseAs === 'json') return parseJson(response);\n\n const mediaType = getMediaType(response);\n if (JSON_MEDIA_TYPE.test(mediaType)) return parseJson(response);\n\n // A declared binary payload must come back as bytes — `text()` would decode it as UTF-8 and\n // corrupt it. `application/octet-stream` is the only binary type an endpoint declares today\n // (kai-agent's sandbox file download); widen deliberately, never by sniffing.\n if (mediaType === 'application/octet-stream') return response.blob();\n\n // Any other declared type describes its own payload — the query-service CSV export, the\n // data-science `text/plain` endpoints — so hand back the exact bytes instead of sniffing them.\n return response.text();\n};\n\n// Header instance serialize undefined value as `undefined`, we do not want that\nconst cleanHeadersInit = (headersInit: HeadersInit | undefined) => {\n if (Array.isArray(headersInit)) return headersInit;\n if (headersInit instanceof Headers) return headersInit;\n if (headersInit == null) return headersInit;\n\n return removeUndefined(headersInit);\n};\n\nconst createHeaders = (\n headersInitA: HeadersInit | undefined,\n headersInitB: HeadersInit | undefined,\n) => {\n const headersA = new Headers(cleanHeadersInit(headersInitA));\n const headersB = new Headers(cleanHeadersInit(headersInitB));\n\n headersB.forEach((value, key) => {\n headersA.set(key, value);\n });\n\n return headersA;\n};\n\nexport const createPath = (path: string, pathParam: PathParam = {}) =>\n path.replace(/\\{([^}]+)}/g, (_, key) => {\n if (!(key in pathParam))\n throw new Error(`Path parameter \"${key}\" is missing in the path \"${path}\"`);\n\n return encodeURIComponent(pathParam[key]!);\n });\n\nexport const createSearch = (\n query: Record<string, unknown>,\n options: Pick<IStringifyOptions, 'arrayFormat'> = {},\n) => {\n return qs.stringify(query, {\n encodeValuesOnly: true,\n skipNulls: true,\n ...options,\n });\n};\n\nexport const createBody = (body: BodyParam, headers: Headers) => {\n if (body == null) return null;\n if (body instanceof FormData) return body; // fetch automatically sets content-type header\n if (typeof body === 'string') return body; // fetch automatically sets content-type header\n\n const stringifyBody = JSON.stringify(body);\n const stringBody = stringifyBody === '{}' ? null : stringifyBody;\n if (stringBody) headers.set(HttpHeader.CONTENT_TYPE, HttpContentType.JSON);\n\n return stringBody;\n};\n\nexport const parseContentDispositionHeader = (contentDisposition?: string | null) => {\n // extract the type ('inline' or 'attachment'), default the type to 'unknown'\n const type = (() => {\n const typeMatch = contentDisposition?.match(/^\\s*(inline|attachment)\\s*;/i);\n return (typeMatch?.[1]?.toLowerCase() ?? 'unknown') as 'inline' | 'attachment' | 'unknown';\n })();\n\n // extract the filename, default the type to null\n const filename = (() => {\n const filenameMatch = contentDisposition?.match(/filename=\"([^\"]+)\"/i);\n if (filenameMatch) return filenameMatch[1];\n\n // If no filename=\"...\", check for encoded filename*=UTF-8''\n const encodedFilenameMatch = contentDisposition?.match(/filename\\*=(?:UTF-8'')?([^;]+)/i);\n if (encodedFilenameMatch?.[1]) return decodeURIComponent(encodedFilenameMatch[1]);\n\n // Check for unquoted filenames (rare but possible)\n const unquotedFilenameMatch = contentDisposition?.match(/filename=([^;]+)/i);\n return unquotedFilenameMatch?.[1] ?? null;\n })();\n\n // Return the parsed result\n return { type, filename };\n};\n\nexport const createFetchRequest: CreateFetchRequestFn = ({\n url,\n method,\n params,\n options = {},\n defaultOptions,\n}) => {\n const {\n baseUrl,\n validateStatus: defValidateStatus = defaultValidateStatus,\n headers: defaultHeaders,\n fetchFn: defaultFetchFn,\n ...restDefaultOptions\n } = defaultOptions;\n const {\n validateStatus,\n queryArrayFormat,\n headers: endpointHeaders,\n fetchFn,\n parseAs,\n ...restOptions\n } = options;\n\n const headers = createHeaders(defaultHeaders, endpointHeaders);\n const path = createPath(url, params.path);\n const search = createSearch(params.query ?? {}, { arrayFormat: queryArrayFormat });\n const body = createBody(params.body, headers);\n\n const urlInstance = new URL(normalizeBaseUrl(baseUrl) + path);\n urlInstance.search = search;\n\n const request = new Request(urlInstance, {\n ...restDefaultOptions,\n ...restOptions,\n headers,\n method: method.toUpperCase(),\n body,\n });\n\n return {\n request,\n validateStatus: validateStatus ?? defValidateStatus,\n fetchFn: fetchFn ?? defaultFetchFn,\n parseAs,\n };\n};\n","import { ApiError } from '../../errors';\n\nimport type {\n BaseFetchParams,\n CoreFetchFn,\n CreateFetchClientOptions,\n FetchClientOptions,\n HttpMethod,\n} from './types';\nimport { createFetchRequest, parseData } from './utils';\n\nexport type FetchClientError = TypeError | ApiError | SyntaxError | DOMException;\n\nexport const isApiError = (error: unknown): error is ApiError => error instanceof ApiError;\n\nexport const isAbortError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'AbortError';\n\nexport const isTimeoutError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'TimeoutError';\n\nexport const isFetchClientError = (error: unknown): error is FetchClientError =>\n error instanceof TypeError || error instanceof SyntaxError || isApiError(error);\n\n// `fetchFn` is resolved per request by `createFetchRequest` (endpoint option beats client option),\n// so a single request can swap the transport without rebuilding the client.\nconst coreFetch: CoreFetchFn = async ({ request, validateStatus, fetchFn = fetch, parseAs }) => {\n const response = await fetchFn(request);\n const data = await parseData(response, parseAs);\n\n const apiResponse = {\n request,\n response,\n data,\n };\n\n const boolOrError = validateStatus(apiResponse);\n if (isApiError(boolOrError)) throw boolOrError;\n if (!boolOrError) throw new ApiError(apiResponse);\n\n return apiResponse;\n};\n\nexport const createFetchClient = ({\n middlewares = [],\n ...defaultOptions\n}: CreateFetchClientOptions) => {\n const fetchWithMiddlewares = middlewares.reduceRight(\n (next, middleware) => middleware(next),\n coreFetch,\n );\n\n const createFetchMethod =\n (method: HttpMethod) =>\n async (url: string, params: BaseFetchParams, options: FetchClientOptions = {}) => {\n const request = createFetchRequest({\n url,\n method,\n params,\n defaultOptions,\n options,\n });\n\n const methodMiddlewares = options?.middlewares ?? [];\n\n return methodMiddlewares.reduceRight(\n (next, middleware) => middleware(next),\n fetchWithMiddlewares,\n )(request);\n };\n\n return {\n get: createFetchMethod('get'),\n post: createFetchMethod('post'),\n put: createFetchMethod('put'),\n patch: createFetchMethod('patch'),\n delete: createFetchMethod('delete'),\n };\n};\n"],"mappings":";;AAEA,IAAa,WAAb,cAA8B,MAAM;CAClC;CACA;CACA;CAEA,YAAY,EAAE,UAAU,SAAS,QAAqB;EACpD,MAAM,SAAS,UAAU;EACzB,KAAK,WAAW;EAChB,KAAK,UAAU;EACf,KAAK,OAAO;CACd;AACF;;;ACVA,MAAa,oBAAoB;CAC/B,mBAAmB;CACnB,sBAAsB;CACtB,iBAAiB;CACjB,YAAY;;CAEZ,oBAAoB;AACtB;AAEA,MAAa,aAAa;CACxB,YAAY;CACZ,aAAa;CACb,cAAc;CACd,sBAAsB;CACtB,uBAAuB;CACvB,aAAa;CACb,qBAAqB;CACrB,iBAAiB;AACnB;AAEA,MAAa,yBAAyB;;;;;;;;;;;ACDtC,MAAa,oBAAoB,YAA4B,QAAQ,QAAQ,QAAQ,EAAE;AAEvF,MAAa,aAAa;CACxB,cAAc;CACd,qBAAqB;CACrB,eAAe;CACf,iBAAiB;CACjB,UAAU;AACZ;AAEA,MAAa,kBAAkB;CAC7B,MAAM;CACN,YAAY;CACZ,WAAW;CACX,WAAW;AACb;AAEA,MAAa,yBAA2C,EAAE,eACxD,SAAS,UAAU,OAAO,SAAS,UAAU;;;;;;;AAQ/C,MAAa,kBAAkB,EAAE,eAC/B,CAAC,CAAC,SAAS,QACR,IAAI,WAAW,YAAY,CAAC,EAC3B,YAAY,CAAC,C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AM,eAAe,WAAW,IAAI,GACrC,SACF;CAEA,MAAM,qBACH,WACD,OAAO,KAAa,QAAyB,UAA8B,CAAC,MAAM;EAChF,MAAM,UAAU,mBAAmB;GACjC;GACA;GACA;GACA;GACA;EACF,CAAC;EAID,QAF0B,SAAS,eAAe,CAAC,EAAA,CAE1B,aACtB,MAAM,eAAe,WAAW,IAAI,GACrC,oBACF,CAAC,CAAC,OAAO;CACX;CAEF,OAAO;EACL,KAAK,kBAAkB,KAAK;EAC5B,MAAM,kBAAkB,MAAM;EAC9B,KAAK,kBAAkB,KAAK;EAC5B,OAAO,kBAAkB,OAAO;EAChC,QAAQ,kBAAkB,QAAQ;CACpC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kaiAgent-8LNzGhZc.js","names":[],"sources":["../src/clients/kaiAgent/kaiAgentClient.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { createGenericFetchClient, createOpenapiFetchClient } from '../../fetchClient';\nimport { createAuthHeaders } from '../auth';\nimport type { SuggestionsApiResponse, SuggestionsRequestBody } from '../chat/suggestions';\nimport type { ClientInitOptions } from '../types';\n\nimport type { paths } from './__generated__/schema';\nimport type {\n ApprovalBody,\n ChatRequest,\n GetChatPath,\n GetHistoryQuery,\n GetVotesQuery,\n UsageResponse,\n VoteRequest,\n} from './types';\n\nconst agentSettingsSchema = z.object({\n projectId: z.string(),\n customInstructions: z.string().nullable(),\n createdAt: z.string(),\n updatedAt: z.string(),\n});\n\nconst toolPermissionValueSchema = z.enum(['always_allow', 'always_ask', 'blocked']);\n\nconst userAgentSettingsSchema = z.object({\n projectId: z.string(),\n userId: z.string(),\n customInstructions: z.string().nullable(),\n toolPermissions: z.record(z.string(), toolPermissionValueSchema).nullable(),\n createdAt: z.string(),\n updatedAt: z.string(),\n});\n\nconst toolInfoSchema = z.object({\n name: z.string(),\n description: z.string(),\n readOnly: z.boolean(),\n});\n\nconst toolsListResponseSchema = z.object({\n tools: z.array(toolInfoSchema),\n});\n\nconst skillInfoSchema = z.object({\n name: z.string(),\n description: z.string().nullable(),\n source: z.enum(['first-party', 'vendored', 'project']),\n});\n\nconst builtInCommandSchema = z.object({\n name: z.string(),\n description: z.string(),\n});\n\nconst skillsListResponseSchema = z.object({\n skills: z.array(skillInfoSchema),\n commands: z.array(builtInCommandSchema),\n});\n\nconst sandboxFileEntrySchema = z.object({\n name: z.string(),\n path: z.string(),\n type: z.enum(['file', 'dir']),\n size: z.number().int().nonnegative().optional(),\n});\n\nconst sandboxFileListingSchema = z.object({\n entries: z.array(sandboxFileEntrySchema),\n});\n\nconst sandboxFileContentSchema = z.object({\n content: z.string(),\n encoding: z.enum(['utf-8', 'binary']),\n truncated: z.boolean(),\n size: z.number().int().nonnegative(),\n});\n\nconst sandboxGitBranchSchema = z.object({\n branch: z.string().nullable(),\n});\n\n// AI-3738: `userId` only, deliberately no `name`/`email` — kai-agent cannot\n// resolve a project's member list (no Storage endpoint for it on the\n// caller's own token). Consumers join `userId` against the member list they\n// already load elsewhere (e.g. `api.management.projects.getProjectUsers`).\nconst spendCapMemberSchema = z.object({\n userId: z.string(),\n overrideLimitPpu: z.number().nullable(),\n effectiveLimitPpu: z.number().nullable(),\n usedPpu: z.number(),\n overrideUpdatedAt: z.string().nullable(),\n overrideUpdatedByUserId: z.string().nullable(),\n});\n\nconst spendCapsViewSchema = z.object({\n // `null` = the org hasn't configured a project cap. Not the same as\n // unlimited — see `effectiveProjectCapPpu`.\n projectCapPpu: z.number().nullable(),\n // The cap actually enforced (`projectCapPpu` defaulted to kai-agent's\n // DEFAULT_PROJECT_CAP_PPU when unset) — always a number, since an\n // unconfigured project is never actually unlimited. Render this, not\n // `projectCapPpu`, when showing what cap applies; `projectCapPpu` is only\n // for distinguishing \"explicitly configured\" from \"using the default\".\n effectiveProjectCapPpu: z.number(),\n // The bare platform default, independent of what's persisted (AI-3833) —\n // `effectiveProjectCapPpu` only equals it when `projectCapPpu` is also\n // null, so a client validating a cleared-but-unsaved field needs this\n // instead. Optional here — kai-agent may not have deployed it yet during a\n // rollout — but always present on the exported `SpendCapsView`; the two\n // methods below fall back to `effectiveProjectCapPpu` before returning.\n defaultProjectCapPpu: z.number().optional(),\n defaultUserLimitPpu: z.number().nullable(),\n projectUsedPpu: z.number(),\n canWrite: z.boolean(),\n members: z.array(spendCapMemberSchema),\n updatedAt: z.string().nullable(),\n updatedByUserId: z.string().nullable(),\n});\n\nconst votesResponseSchema = z.array(\n z.object({\n chatId: z.string(),\n messageId: z.string(),\n isUpvoted: z.boolean(),\n }),\n);\n\nexport type SpendCapMember = z.infer<typeof spendCapMemberSchema>;\n// `defaultProjectCapPpu` is optional on the wire (rollout skew) but always\n// present here — `getSpendCaps`/`updateSpendCaps` fill it in before\n// returning, so every consumer sees a concrete number.\nexport type SpendCapsView = Omit<z.infer<typeof spendCapsViewSchema>, 'defaultProjectCapPpu'> & {\n defaultProjectCapPpu: number;\n};\ntype AgentSettings = z.infer<typeof agentSettingsSchema>;\ntype UserAgentSettings = z.infer<typeof userAgentSettingsSchema>;\ntype ToolsListResponse = z.infer<typeof toolsListResponseSchema>;\ntype SkillsListResponse = z.infer<typeof skillsListResponseSchema>;\ntype SandboxFileListing = z.infer<typeof sandboxFileListingSchema>;\ntype SandboxFileContent = z.infer<typeof sandboxFileContentSchema>;\ntype SandboxGitBranch = z.infer<typeof sandboxGitBranchSchema>;\ntype VotesResponse = z.infer<typeof votesResponseSchema>;\n\ntype UpdateAgentSettingsRequest = {\n customInstructions?: string | null;\n};\n\ntype UpdateUserAgentSettingsRequest = {\n customInstructions?: string | null;\n toolPermissions?: Record<string, z.infer<typeof toolPermissionValueSchema>> | null;\n};\n\ntype UpdateSpendCapsRequest = {\n projectCapPpu?: number | null;\n defaultUserLimitPpu?: number | null;\n};\n\nexport const createKaiAgentClient = ({ baseUrl, middlewares, auth }: ClientInitOptions) => {\n const clientOptions = {\n baseUrl,\n middlewares,\n headers: createAuthHeaders(auth),\n };\n\n const client = createOpenapiFetchClient<paths>(clientOptions);\n const genericClient = createGenericFetchClient(clientOptions);\n\n const getHistory = async (params?: GetHistoryQuery) => {\n const { data } = await client.get('/api/history', { query: params });\n return data;\n };\n\n const getChat = async (chatId: GetChatPath['id'], signal?: AbortSignal) => {\n const { data } = await client.get('/api/chat/{id}', { path: { id: chatId } }, { signal });\n return data;\n };\n\n const deleteChat = async (chatId: string) => {\n const { data } = await client.delete('/api/chat', { query: { id: chatId } });\n return data;\n };\n\n const createChat = async (request: ChatRequest) => {\n const { response } = await client.post('/api/chat', { body: request });\n return response;\n };\n\n const getVotes = async (chatId: GetVotesQuery['chatId']): Promise<VotesResponse> => {\n const { data } = await client.get('/api/vote', { query: { chatId } });\n\n const result = votesResponseSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid votes response format');\n }\n\n return result.data;\n };\n\n const submitVote = async (params: VoteRequest) => {\n await client.patch('/api/vote', { body: params });\n };\n\n const getUsage = async (signal?: AbortSignal): Promise<UsageResponse> => {\n const { data } = await client.get('/api/usage', {}, { signal });\n return data;\n };\n\n const approveToolCall = async (chatId: string, body: ApprovalBody): Promise<void> => {\n await client.post('/api/chat/{id}/approval', { path: { id: chatId }, body });\n };\n\n const submitToolOutput = async (\n chatId: string,\n body: { toolUseId: string; output?: string; errorText?: string },\n ): Promise<void> => {\n await client.post('/api/chat/{id}/ui-tool-result', { path: { id: chatId }, body });\n };\n\n const stopChat = async (chatId: string): Promise<{ stopped: boolean }> => {\n const { data } = await client.post('/api/chat/{id}/stop', { path: { id: chatId } });\n return data;\n };\n\n const getSuggestions = async (\n request: SuggestionsRequestBody,\n signal?: AbortSignal,\n ): Promise<SuggestionsApiResponse> => {\n const { data } = await client.post('/api/suggestions', { body: request }, { signal });\n return data;\n };\n\n const getAgentSettings = async (signal?: AbortSignal): Promise<AgentSettings> => {\n const { data } = await genericClient.get<AgentSettings>('/api/settings', {}, { signal });\n const result = agentSettingsSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid agent settings response format');\n }\n return result.data;\n };\n\n const updateAgentSettings = async (\n request: UpdateAgentSettingsRequest,\n signal?: AbortSignal,\n ): Promise<AgentSettings> => {\n const { data } = await genericClient.patch<AgentSettings>(\n '/api/settings',\n { body: request },\n { signal },\n );\n const result = agentSettingsSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid agent settings response format');\n }\n return result.data;\n };\n\n const getUserAgentSettings = async (signal?: AbortSignal): Promise<UserAgentSettings> => {\n const { data } = await genericClient.get<UserAgentSettings>(\n '/api/settings/user',\n {},\n { signal },\n );\n const result = userAgentSettingsSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid user agent settings response format');\n }\n return result.data;\n };\n\n const updateUserAgentSettings = async (\n request: UpdateUserAgentSettingsRequest,\n signal?: AbortSignal,\n ): Promise<UserAgentSettings> => {\n const { data } = await genericClient.patch<UserAgentSettings>(\n '/api/settings/user',\n { body: request },\n { signal },\n );\n const result = userAgentSettingsSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid user agent settings response format');\n }\n return result.data;\n };\n\n // `defaultProjectCapPpu` is optional on the wire (a kai-agent deployed\n // before AI-3833 doesn't send it) — falls back to `effectiveProjectCapPpu`,\n // the pre-fix behavior, rather than throwing on an otherwise-valid response\n // during a rollout where api-client ships ahead of kai-agent.\n const withDefaultProjectCap = (view: z.infer<typeof spendCapsViewSchema>): SpendCapsView => ({\n ...view,\n defaultProjectCapPpu: view.defaultProjectCapPpu ?? view.effectiveProjectCapPpu,\n });\n\n // AI-3738: not in `__generated__/schema` yet (kai-agent's OpenAPI spec is\n // regenerated from a live dev server — see docs/regenerate-api-types.md),\n // so this goes through `genericClient` + a zod guard like the settings\n // methods above rather than the typed `client`. Migrate to\n // `client.get('/api/settings/spend-caps')` once that regenerates.\n const getSpendCaps = async (signal?: AbortSignal): Promise<SpendCapsView> => {\n const { data } = await genericClient.get<SpendCapsView>(\n '/api/settings/spend-caps',\n {},\n { signal },\n );\n const result = spendCapsViewSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid spend caps response format');\n }\n return withDefaultProjectCap(result.data);\n };\n\n const updateSpendCaps = async (\n request: UpdateSpendCapsRequest,\n signal?: AbortSignal,\n ): Promise<SpendCapsView> => {\n const { data } = await genericClient.patch<SpendCapsView>(\n '/api/settings/spend-caps',\n { body: request },\n { signal },\n );\n const result = spendCapsViewSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid spend caps response format');\n }\n return withDefaultProjectCap(result.data);\n };\n\n const setUserSpendLimit = async (\n userId: string,\n overrideLimitPpu: number | null,\n signal?: AbortSignal,\n ): Promise<SpendCapMember> => {\n const { data } = await genericClient.put<SpendCapMember>(\n `/api/settings/spend-caps/users/${encodeURIComponent(userId)}`,\n { body: { overrideLimitPpu } },\n { signal },\n );\n const result = spendCapMemberSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid spend cap member response format');\n }\n return result.data;\n };\n\n const getToolsList = async (signal?: AbortSignal): Promise<ToolsListResponse> => {\n const { data } = await genericClient.get<ToolsListResponse>(\n '/api/settings/tools',\n {},\n { signal },\n );\n const result = toolsListResponseSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid tools list response format');\n }\n return result.data;\n };\n\n const getSkillsList = async (signal?: AbortSignal): Promise<SkillsListResponse> => {\n const { data } = await genericClient.get<SkillsListResponse>('/api/skills', {}, { signal });\n const result = skillsListResponseSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid skills list response format');\n }\n return result.data;\n };\n\n const listSandboxFiles = async (\n chatId: string,\n path?: string,\n signal?: AbortSignal,\n ): Promise<SandboxFileListing> => {\n const { data } = await genericClient.get<SandboxFileListing>(\n `/api/chat/${encodeURIComponent(chatId)}/sandbox/files`,\n { query: path ? { path } : undefined },\n { signal },\n );\n const result = sandboxFileListingSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid sandbox files response format');\n }\n return result.data;\n };\n\n const readSandboxFile = async (\n chatId: string,\n path: string,\n signal?: AbortSignal,\n ): Promise<SandboxFileContent> => {\n const { data } = await genericClient.get<SandboxFileContent>(\n `/api/chat/${encodeURIComponent(chatId)}/sandbox/file`,\n { query: { path } },\n { signal },\n );\n const result = sandboxFileContentSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid sandbox file response format');\n }\n return result.data;\n };\n\n const downloadSandboxFile = async (\n chatId: string,\n path: string,\n signal?: AbortSignal,\n ): Promise<Blob> => {\n // Rides the normal fetch pipeline (auth middlewares, 401 refresh+replay,\n // status validation); `parseData` hands a declared octet-stream body back\n // as a Blob, so the bytes arrive uncorrupted.\n const { data } = await genericClient.get<Blob>(\n `/api/chat/${encodeURIComponent(chatId)}/sandbox/file/download`,\n { query: { path } },\n { signal },\n );\n if (!(data instanceof Blob)) {\n throw new Error('Invalid sandbox file download response format');\n }\n return data;\n };\n\n const getSandboxGitBranch = async (\n chatId: string,\n signal?: AbortSignal,\n ): Promise<SandboxGitBranch> => {\n const { data } = await genericClient.get<SandboxGitBranch>(\n `/api/chat/${encodeURIComponent(chatId)}/sandbox/git-branch`,\n {},\n { signal },\n );\n const result = sandboxGitBranchSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid sandbox git-branch response format');\n }\n return result.data;\n };\n\n const chatStreamUrl = clientOptions.baseUrl + '/api/chat';\n\n // `/health` over the documented `/ping`: undocumented, but it reports the same\n // `{\"status\":\"ok\"}` as every other service instead of a bare timestamp.\n const healthCheck = async (signal?: AbortSignal) => {\n const { data } = await genericClient.get('/health', {}, { signal });\n\n return data;\n };\n\n return {\n healthCheck,\n getHistory,\n getChat,\n deleteChat,\n createChat,\n getVotes,\n submitVote,\n getUsage,\n approveToolCall,\n submitToolOutput,\n stopChat,\n getSuggestions,\n getAgentSettings,\n updateAgentSettings,\n getUserAgentSettings,\n updateUserAgentSettings,\n getSpendCaps,\n updateSpendCaps,\n setUserSpendLimit,\n getToolsList,\n getSkillsList,\n listSandboxFiles,\n readSandboxFile,\n downloadSandboxFile,\n getSandboxGitBranch,\n chatStreamUrl,\n };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mB,MAAM,EAAE,sBACxC,CAAC,GACD,EAAE,OAAO,CACX;EACA,MAAM,SAAS,uBAAuB,UAAU,IAAI;EACpD,IAAI,CAAC,OAAO,SACV,MAAM,IAAI,MAAM,4CAA4C;EAE9D,OAAO,OAAO;CAChB;CAEA,MAAM,gBAAgB,cAAc,UAAU;CAI9C,MAAM,cAAc,OAAO,WAAyB;EAClD,MAAM,EAAE,SAAS,MAAM,cAAc,IAAI,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC;EAElE,OAAO;CACT;CAEA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kaiAgent-B_TaUPRt.cjs","names":["z","createAuthHeaders","createOpenapiFetchClient","createGenericFetchClient"],"sources":["../src/clients/kaiAgent/kaiAgentClient.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { createGenericFetchClient, createOpenapiFetchClient } from '../../fetchClient';\nimport { createAuthHeaders } from '../auth';\nimport type { SuggestionsApiResponse, SuggestionsRequestBody } from '../chat/suggestions';\nimport type { ClientInitOptions } from '../types';\n\nimport type { paths } from './__generated__/schema';\nimport type {\n ApprovalBody,\n ChatRequest,\n GetChatPath,\n GetHistoryQuery,\n GetVotesQuery,\n UsageResponse,\n VoteRequest,\n} from './types';\n\nconst agentSettingsSchema = z.object({\n projectId: z.string(),\n customInstructions: z.string().nullable(),\n createdAt: z.string(),\n updatedAt: z.string(),\n});\n\nconst toolPermissionValueSchema = z.enum(['always_allow', 'always_ask', 'blocked']);\n\nconst userAgentSettingsSchema = z.object({\n projectId: z.string(),\n userId: z.string(),\n customInstructions: z.string().nullable(),\n toolPermissions: z.record(z.string(), toolPermissionValueSchema).nullable(),\n createdAt: z.string(),\n updatedAt: z.string(),\n});\n\nconst toolInfoSchema = z.object({\n name: z.string(),\n description: z.string(),\n readOnly: z.boolean(),\n});\n\nconst toolsListResponseSchema = z.object({\n tools: z.array(toolInfoSchema),\n});\n\nconst skillInfoSchema = z.object({\n name: z.string(),\n description: z.string().nullable(),\n source: z.enum(['first-party', 'vendored', 'project']),\n});\n\nconst builtInCommandSchema = z.object({\n name: z.string(),\n description: z.string(),\n});\n\nconst skillsListResponseSchema = z.object({\n skills: z.array(skillInfoSchema),\n commands: z.array(builtInCommandSchema),\n});\n\nconst sandboxFileEntrySchema = z.object({\n name: z.string(),\n path: z.string(),\n type: z.enum(['file', 'dir']),\n size: z.number().int().nonnegative().optional(),\n});\n\nconst sandboxFileListingSchema = z.object({\n entries: z.array(sandboxFileEntrySchema),\n});\n\nconst sandboxFileContentSchema = z.object({\n content: z.string(),\n encoding: z.enum(['utf-8', 'binary']),\n truncated: z.boolean(),\n size: z.number().int().nonnegative(),\n});\n\nconst sandboxGitBranchSchema = z.object({\n branch: z.string().nullable(),\n});\n\n// AI-3738: `userId` only, deliberately no `name`/`email` — kai-agent cannot\n// resolve a project's member list (no Storage endpoint for it on the\n// caller's own token). Consumers join `userId` against the member list they\n// already load elsewhere (e.g. `api.management.projects.getProjectUsers`).\nconst spendCapMemberSchema = z.object({\n userId: z.string(),\n overrideLimitPpu: z.number().nullable(),\n effectiveLimitPpu: z.number().nullable(),\n usedPpu: z.number(),\n overrideUpdatedAt: z.string().nullable(),\n overrideUpdatedByUserId: z.string().nullable(),\n});\n\nconst spendCapsViewSchema = z.object({\n // `null` = the org hasn't configured a project cap. Not the same as\n // unlimited — see `effectiveProjectCapPpu`.\n projectCapPpu: z.number().nullable(),\n // The cap actually enforced (`projectCapPpu` defaulted to kai-agent's\n // DEFAULT_PROJECT_CAP_PPU when unset) — always a number, since an\n // unconfigured project is never actually unlimited. Render this, not\n // `projectCapPpu`, when showing what cap applies; `projectCapPpu` is only\n // for distinguishing \"explicitly configured\" from \"using the default\".\n effectiveProjectCapPpu: z.number(),\n // The bare platform default, independent of what's persisted (AI-3833) —\n // `effectiveProjectCapPpu` only equals it when `projectCapPpu` is also\n // null, so a client validating a cleared-but-unsaved field needs this\n // instead. Optional here — kai-agent may not have deployed it yet during a\n // rollout — but always present on the exported `SpendCapsView`; the two\n // methods below fall back to `effectiveProjectCapPpu` before returning.\n defaultProjectCapPpu: z.number().optional(),\n defaultUserLimitPpu: z.number().nullable(),\n projectUsedPpu: z.number(),\n canWrite: z.boolean(),\n members: z.array(spendCapMemberSchema),\n updatedAt: z.string().nullable(),\n updatedByUserId: z.string().nullable(),\n});\n\nconst votesResponseSchema = z.array(\n z.object({\n chatId: z.string(),\n messageId: z.string(),\n isUpvoted: z.boolean(),\n }),\n);\n\nexport type SpendCapMember = z.infer<typeof spendCapMemberSchema>;\n// `defaultProjectCapPpu` is optional on the wire (rollout skew) but always\n// present here — `getSpendCaps`/`updateSpendCaps` fill it in before\n// returning, so every consumer sees a concrete number.\nexport type SpendCapsView = Omit<z.infer<typeof spendCapsViewSchema>, 'defaultProjectCapPpu'> & {\n defaultProjectCapPpu: number;\n};\ntype AgentSettings = z.infer<typeof agentSettingsSchema>;\ntype UserAgentSettings = z.infer<typeof userAgentSettingsSchema>;\ntype ToolsListResponse = z.infer<typeof toolsListResponseSchema>;\ntype SkillsListResponse = z.infer<typeof skillsListResponseSchema>;\ntype SandboxFileListing = z.infer<typeof sandboxFileListingSchema>;\ntype SandboxFileContent = z.infer<typeof sandboxFileContentSchema>;\ntype SandboxGitBranch = z.infer<typeof sandboxGitBranchSchema>;\ntype VotesResponse = z.infer<typeof votesResponseSchema>;\n\ntype UpdateAgentSettingsRequest = {\n customInstructions?: string | null;\n};\n\ntype UpdateUserAgentSettingsRequest = {\n customInstructions?: string | null;\n toolPermissions?: Record<string, z.infer<typeof toolPermissionValueSchema>> | null;\n};\n\ntype UpdateSpendCapsRequest = {\n projectCapPpu?: number | null;\n defaultUserLimitPpu?: number | null;\n};\n\nexport const createKaiAgentClient = ({ baseUrl, middlewares, auth }: ClientInitOptions) => {\n const clientOptions = {\n baseUrl,\n middlewares,\n headers: createAuthHeaders(auth),\n };\n\n const client = createOpenapiFetchClient<paths>(clientOptions);\n const genericClient = createGenericFetchClient(clientOptions);\n\n const getHistory = async (params?: GetHistoryQuery) => {\n const { data } = await client.get('/api/history', { query: params });\n return data;\n };\n\n const getChat = async (chatId: GetChatPath['id'], signal?: AbortSignal) => {\n const { data } = await client.get('/api/chat/{id}', { path: { id: chatId } }, { signal });\n return data;\n };\n\n const deleteChat = async (chatId: string) => {\n const { data } = await client.delete('/api/chat', { query: { id: chatId } });\n return data;\n };\n\n const createChat = async (request: ChatRequest) => {\n const { response } = await client.post('/api/chat', { body: request });\n return response;\n };\n\n const getVotes = async (chatId: GetVotesQuery['chatId']): Promise<VotesResponse> => {\n const { data } = await client.get('/api/vote', { query: { chatId } });\n\n const result = votesResponseSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid votes response format');\n }\n\n return result.data;\n };\n\n const submitVote = async (params: VoteRequest) => {\n await client.patch('/api/vote', { body: params });\n };\n\n const getUsage = async (signal?: AbortSignal): Promise<UsageResponse> => {\n const { data } = await client.get('/api/usage', {}, { signal });\n return data;\n };\n\n const approveToolCall = async (chatId: string, body: ApprovalBody): Promise<void> => {\n await client.post('/api/chat/{id}/approval', { path: { id: chatId }, body });\n };\n\n const submitToolOutput = async (\n chatId: string,\n body: { toolUseId: string; output?: string; errorText?: string },\n ): Promise<void> => {\n await client.post('/api/chat/{id}/ui-tool-result', { path: { id: chatId }, body });\n };\n\n const stopChat = async (chatId: string): Promise<{ stopped: boolean }> => {\n const { data } = await client.post('/api/chat/{id}/stop', { path: { id: chatId } });\n return data;\n };\n\n const getSuggestions = async (\n request: SuggestionsRequestBody,\n signal?: AbortSignal,\n ): Promise<SuggestionsApiResponse> => {\n const { data } = await client.post('/api/suggestions', { body: request }, { signal });\n return data;\n };\n\n const getAgentSettings = async (signal?: AbortSignal): Promise<AgentSettings> => {\n const { data } = await genericClient.get<AgentSettings>('/api/settings', {}, { signal });\n const result = agentSettingsSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid agent settings response format');\n }\n return result.data;\n };\n\n const updateAgentSettings = async (\n request: UpdateAgentSettingsRequest,\n signal?: AbortSignal,\n ): Promise<AgentSettings> => {\n const { data } = await genericClient.patch<AgentSettings>(\n '/api/settings',\n { body: request },\n { signal },\n );\n const result = agentSettingsSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid agent settings response format');\n }\n return result.data;\n };\n\n const getUserAgentSettings = async (signal?: AbortSignal): Promise<UserAgentSettings> => {\n const { data } = await genericClient.get<UserAgentSettings>(\n '/api/settings/user',\n {},\n { signal },\n );\n const result = userAgentSettingsSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid user agent settings response format');\n }\n return result.data;\n };\n\n const updateUserAgentSettings = async (\n request: UpdateUserAgentSettingsRequest,\n signal?: AbortSignal,\n ): Promise<UserAgentSettings> => {\n const { data } = await genericClient.patch<UserAgentSettings>(\n '/api/settings/user',\n { body: request },\n { signal },\n );\n const result = userAgentSettingsSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid user agent settings response format');\n }\n return result.data;\n };\n\n // `defaultProjectCapPpu` is optional on the wire (a kai-agent deployed\n // before AI-3833 doesn't send it) — falls back to `effectiveProjectCapPpu`,\n // the pre-fix behavior, rather than throwing on an otherwise-valid response\n // during a rollout where api-client ships ahead of kai-agent.\n const withDefaultProjectCap = (view: z.infer<typeof spendCapsViewSchema>): SpendCapsView => ({\n ...view,\n defaultProjectCapPpu: view.defaultProjectCapPpu ?? view.effectiveProjectCapPpu,\n });\n\n // AI-3738: not in `__generated__/schema` yet (kai-agent's OpenAPI spec is\n // regenerated from a live dev server — see docs/regenerate-api-types.md),\n // so this goes through `genericClient` + a zod guard like the settings\n // methods above rather than the typed `client`. Migrate to\n // `client.get('/api/settings/spend-caps')` once that regenerates.\n const getSpendCaps = async (signal?: AbortSignal): Promise<SpendCapsView> => {\n const { data } = await genericClient.get<SpendCapsView>(\n '/api/settings/spend-caps',\n {},\n { signal },\n );\n const result = spendCapsViewSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid spend caps response format');\n }\n return withDefaultProjectCap(result.data);\n };\n\n const updateSpendCaps = async (\n request: UpdateSpendCapsRequest,\n signal?: AbortSignal,\n ): Promise<SpendCapsView> => {\n const { data } = await genericClient.patch<SpendCapsView>(\n '/api/settings/spend-caps',\n { body: request },\n { signal },\n );\n const result = spendCapsViewSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid spend caps response format');\n }\n return withDefaultProjectCap(result.data);\n };\n\n const setUserSpendLimit = async (\n userId: string,\n overrideLimitPpu: number | null,\n signal?: AbortSignal,\n ): Promise<SpendCapMember> => {\n const { data } = await genericClient.put<SpendCapMember>(\n `/api/settings/spend-caps/users/${encodeURIComponent(userId)}`,\n { body: { overrideLimitPpu } },\n { signal },\n );\n const result = spendCapMemberSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid spend cap member response format');\n }\n return result.data;\n };\n\n const getToolsList = async (signal?: AbortSignal): Promise<ToolsListResponse> => {\n const { data } = await genericClient.get<ToolsListResponse>(\n '/api/settings/tools',\n {},\n { signal },\n );\n const result = toolsListResponseSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid tools list response format');\n }\n return result.data;\n };\n\n const getSkillsList = async (signal?: AbortSignal): Promise<SkillsListResponse> => {\n const { data } = await genericClient.get<SkillsListResponse>('/api/skills', {}, { signal });\n const result = skillsListResponseSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid skills list response format');\n }\n return result.data;\n };\n\n const listSandboxFiles = async (\n chatId: string,\n path?: string,\n signal?: AbortSignal,\n ): Promise<SandboxFileListing> => {\n const { data } = await genericClient.get<SandboxFileListing>(\n `/api/chat/${encodeURIComponent(chatId)}/sandbox/files`,\n { query: path ? { path } : undefined },\n { signal },\n );\n const result = sandboxFileListingSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid sandbox files response format');\n }\n return result.data;\n };\n\n const readSandboxFile = async (\n chatId: string,\n path: string,\n signal?: AbortSignal,\n ): Promise<SandboxFileContent> => {\n const { data } = await genericClient.get<SandboxFileContent>(\n `/api/chat/${encodeURIComponent(chatId)}/sandbox/file`,\n { query: { path } },\n { signal },\n );\n const result = sandboxFileContentSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid sandbox file response format');\n }\n return result.data;\n };\n\n const downloadSandboxFile = async (\n chatId: string,\n path: string,\n signal?: AbortSignal,\n ): Promise<Blob> => {\n // Rides the normal fetch pipeline (auth middlewares, 401 refresh+replay,\n // status validation); `parseData` hands a declared octet-stream body back\n // as a Blob, so the bytes arrive uncorrupted.\n const { data } = await genericClient.get<Blob>(\n `/api/chat/${encodeURIComponent(chatId)}/sandbox/file/download`,\n { query: { path } },\n { signal },\n );\n if (!(data instanceof Blob)) {\n throw new Error('Invalid sandbox file download response format');\n }\n return data;\n };\n\n const getSandboxGitBranch = async (\n chatId: string,\n signal?: AbortSignal,\n ): Promise<SandboxGitBranch> => {\n const { data } = await genericClient.get<SandboxGitBranch>(\n `/api/chat/${encodeURIComponent(chatId)}/sandbox/git-branch`,\n {},\n { signal },\n );\n const result = sandboxGitBranchSchema.safeParse(data);\n if (!result.success) {\n throw new Error('Invalid sandbox git-branch response format');\n }\n return result.data;\n };\n\n const chatStreamUrl = clientOptions.baseUrl + '/api/chat';\n\n // `/health` over the documented `/ping`: undocumented, but it reports the same\n // `{\"status\":\"ok\"}` as every other service instead of a bare timestamp.\n const healthCheck = async (signal?: AbortSignal) => {\n const { data } = await genericClient.get('/health', {}, { signal });\n\n return data;\n };\n\n return {\n healthCheck,\n getHistory,\n getChat,\n deleteChat,\n createChat,\n getVotes,\n submitVote,\n getUsage,\n approveToolCall,\n submitToolOutput,\n stopChat,\n getSuggestions,\n getAgentSettings,\n updateAgentSettings,\n getUserAgentSettings,\n updateUserAgentSettings,\n getSpendCaps,\n updateSpendCaps,\n setUserSpendLimit,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