@keboola/api-client 32.0.0 → 33.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +80 -2
- package/API-SURFACE.md +4 -1
- package/CHANGELOG.md +222 -0
- package/dist/{ManagementClientAuthError-B-tyPlyG.cjs → ManagementClientAuthError-DqeXL8nv.cjs} +2 -2
- package/dist/{ManagementClientAuthError-B-tyPlyG.cjs.map → ManagementClientAuthError-DqeXL8nv.cjs.map} +1 -1
- package/dist/{ManagementClientAuthError-BAFNvOdf.js → ManagementClientAuthError-iKbBugKC.js} +2 -2
- package/dist/{ManagementClientAuthError-BAFNvOdf.js.map → ManagementClientAuthError-iKbBugKC.js.map} +1 -1
- package/dist/ai/index.cjs +2 -2
- package/dist/ai/index.d.cts +2 -2
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.js +2 -2
- package/dist/ai/types.d.cts +1 -1
- package/dist/ai/types.d.ts +1 -1
- package/dist/{appLogs-DTLE6HTy.js → appLogs-D72eD8vP.js} +2 -2
- package/dist/{appLogs-DTLE6HTy.js.map → appLogs-D72eD8vP.js.map} +1 -1
- package/dist/{appLogs-NIEDTDHf.cjs → appLogs-D8K0VeNM.cjs} +2 -2
- package/dist/{appLogs-NIEDTDHf.cjs.map → appLogs-D8K0VeNM.cjs.map} +1 -1
- package/dist/{appLogs-BAaaGYKg.d.cts → appLogs-Q4A7A_Fc.d.cts} +2 -2
- package/dist/{appLogs-DX_WTBCa.d.ts → appLogs-u0XMZLjS.d.ts} +2 -2
- package/dist/apps/index.cjs +3 -3
- package/dist/apps/index.d.cts +3 -3
- package/dist/apps/index.d.ts +3 -3
- package/dist/apps/index.js +3 -3
- package/dist/apps/types.d.cts +2 -2
- package/dist/apps/types.d.ts +2 -2
- package/dist/assets/index.cjs +1 -1
- package/dist/assets/index.d.cts +1 -1
- package/dist/assets/index.d.ts +1 -1
- package/dist/assets/index.js +1 -1
- package/dist/auth/index.cjs +1 -1
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/types.d.cts +2 -2
- package/dist/auth/types.d.ts +2 -2
- package/dist/{auth-DP-6TFiM.cjs → auth-C2_JLisH.cjs} +2 -2
- package/dist/{auth-DP-6TFiM.cjs.map → auth-C2_JLisH.cjs.map} +1 -1
- package/dist/{auth-DtbQaeDj.js → auth-CE9rQV3-.js} +2 -2
- package/dist/{auth-DtbQaeDj.js.map → auth-CE9rQV3-.js.map} +1 -1
- package/dist/{authClient--BtZgjIc.js → authClient-DEyqR7GW.js} +43 -9
- package/dist/authClient-DEyqR7GW.js.map +1 -0
- package/dist/{authClient-DhfzOUaa.d.cts → authClient-DZ_8lvdJ.d.cts} +6 -6
- package/dist/{authClient-CtfyVHRD.d.ts → authClient-DwT6xdg5.d.ts} +6 -6
- package/dist/{authClient-b7uec7sw.cjs → authClient-IwQ9Ti0J.cjs} +43 -9
- package/dist/authClient-IwQ9Ti0J.cjs.map +1 -0
- package/dist/chat/index.cjs +3 -3
- package/dist/chat/index.d.cts +2 -2
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat/index.js +3 -3
- package/dist/chat/types.d.cts +1 -1
- package/dist/chat/types.d.ts +1 -1
- package/dist/{createFetchClient-BbG46bL0.js → createFetchClient-DdyZMhxO.js} +3 -2
- package/dist/{createFetchClient-BbG46bL0.js.map → createFetchClient-DdyZMhxO.js.map} +1 -1
- package/dist/{createFetchClient-BRfTjBLV.cjs → createFetchClient-DvZvD31l.cjs} +8 -1
- package/dist/{createFetchClient-BRfTjBLV.cjs.map → createFetchClient-DvZvD31l.cjs.map} +1 -1
- package/dist/{createGenericFetchClient-BHYQLZhe.js → createGenericFetchClient-MQeLRiNW.js} +2 -2
- package/dist/{createGenericFetchClient-BHYQLZhe.js.map → createGenericFetchClient-MQeLRiNW.js.map} +1 -1
- package/dist/{createGenericFetchClient-DHs-i7_O.cjs → createGenericFetchClient-qfCZlCTv.cjs} +2 -2
- package/dist/{createGenericFetchClient-DHs-i7_O.cjs.map → createGenericFetchClient-qfCZlCTv.cjs.map} +1 -1
- package/dist/{createOpenapiFetchClient-CyDUFxHB.cjs → createOpenapiFetchClient-C57Ljzi6.cjs} +2 -2
- package/dist/{createOpenapiFetchClient-CyDUFxHB.cjs.map → createOpenapiFetchClient-C57Ljzi6.cjs.map} +1 -1
- package/dist/{createOpenapiFetchClient-Bn6_Pn0H.js → createOpenapiFetchClient-E7OIVkYv.js} +2 -2
- package/dist/{createOpenapiFetchClient-Bn6_Pn0H.js.map → createOpenapiFetchClient-E7OIVkYv.js.map} +1 -1
- package/dist/{credential-d2RDcXRB.js → credential-Bxv7yxOZ.js} +7 -4
- package/dist/credential-Bxv7yxOZ.js.map +1 -0
- package/dist/{credential-DOXH7XRS.cjs → credential-D-X5QQrM.cjs} +7 -4
- package/dist/credential-D-X5QQrM.cjs.map +1 -0
- package/dist/dataScience/index.cjs +2 -2
- package/dist/dataScience/index.d.cts +2 -2
- package/dist/dataScience/index.d.ts +2 -2
- package/dist/dataScience/index.js +2 -2
- package/dist/dataScience/types.d.cts +2 -2
- package/dist/dataScience/types.d.ts +2 -2
- package/dist/{dataScience-wexHEIue.cjs → dataScience-BPW993AG.cjs} +5 -5
- package/dist/{dataScience-wexHEIue.cjs.map → dataScience-BPW993AG.cjs.map} +1 -1
- package/dist/{dataScience-Sm8iONhP.js → dataScience-B_TA7wCB.js} +5 -5
- package/dist/{dataScience-Sm8iONhP.js.map → dataScience-B_TA7wCB.js.map} +1 -1
- package/dist/developerPortal/index.cjs +1 -1
- package/dist/developerPortal/index.d.cts +2 -2
- package/dist/developerPortal/index.d.ts +2 -2
- package/dist/developerPortal/index.js +1 -1
- package/dist/developerPortal/types.d.cts +1 -1
- package/dist/developerPortal/types.d.ts +1 -1
- package/dist/{developerPortalClient-CgTSzLoG.cjs → developerPortalClient-Db2XVB_o.cjs} +3 -3
- package/dist/{developerPortalClient-CgTSzLoG.cjs.map → developerPortalClient-Db2XVB_o.cjs.map} +1 -1
- package/dist/{developerPortalClient-DywKpDlW.js → developerPortalClient-jk46sjwP.js} +3 -3
- package/dist/{developerPortalClient-DywKpDlW.js.map → developerPortalClient-jk46sjwP.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.d.cts +2 -2
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/index.js +2 -2
- package/dist/editor/types.d.cts +1 -1
- package/dist/editor/types.d.ts +1 -1
- package/dist/emitter-dLF1Fyfg.d.cts +11 -0
- package/dist/emitter-dLF1Fyfg.d.ts +11 -0
- package/dist/encryption/index.cjs +1 -1
- package/dist/encryption/index.d.cts +1 -1
- package/dist/encryption/index.d.ts +1 -1
- package/dist/encryption/index.js +1 -1
- package/dist/encryption/types.d.cts +1 -1
- package/dist/encryption/types.d.ts +1 -1
- package/dist/import/index.cjs +1 -1
- package/dist/import/index.d.cts +3 -3
- package/dist/import/index.d.ts +3 -3
- package/dist/import/index.js +1 -1
- package/dist/{import-SQuurg1G.js → import-2nqxQ9Rt.js} +3 -3
- package/dist/{import-SQuurg1G.js.map → import-2nqxQ9Rt.js.map} +1 -1
- package/dist/{import-C0-y1GQK.cjs → import-DJilJ6tq.cjs} +3 -3
- package/dist/{import-C0-y1GQK.cjs.map → import-DJilJ6tq.cjs.map} +1 -1
- package/dist/{index-FhKX7Cv1.d.ts → index-B0V1pJAa.d.ts} +241 -200
- package/dist/{index-Bg1P6Bb2.d.ts → index-B2OGaUap.d.ts} +6 -6
- package/dist/{index-Dbzjvy5h.d.ts → index-BjKjp3Rf.d.ts} +5 -5
- package/dist/{index-DeKPpYQy.d.ts → index-C7gxKoDF.d.cts} +3 -3
- package/dist/{index-D_7yCRKy.d.cts → index-CTd4YY8e.d.cts} +4 -4
- package/dist/{index-DiHHyMEo.d.cts → index-CUXEFQ7i.d.cts} +6 -6
- package/dist/{index-eAlN694c.d.cts → index-CVqk63at.d.ts} +3 -3
- package/dist/{index-Bc_hXWae.d.ts → index-C_cxKL1V.d.ts} +3 -3
- package/dist/{index-tKsiUarj.d.ts → index-ChMtULt4.d.ts} +4 -4
- package/dist/{index-Gn1H63Hk.d.cts → index-DCN2lH0v.d.cts} +4 -4
- package/dist/{index-Bjk-tCpG.d.cts → index-DIVvL54G.d.cts} +241 -200
- package/dist/{index-C7e3wBt9.d.cts → index-DLYAvSWZ.d.cts} +3 -3
- package/dist/{index-fHfc_VqS.d.ts → index-DQef014j.d.ts} +4 -4
- package/dist/{index-CeJOmN-P.d.ts → index-DVhTNwvu.d.ts} +3 -2
- package/dist/{index-CQrKS7PV.d.cts → index-DhVFuQDv.d.cts} +3 -2
- package/dist/{index-Ctqkm3Fx.d.ts → index-GNKwr7EQ.d.ts} +4 -4
- package/dist/{index-GDdFZCXp.d.ts → index-bB6wvw1f.d.ts} +4 -4
- package/dist/{index-BKh0prif.d.cts → index-exNi3I2Q.d.cts} +4 -4
- package/dist/{index-CXtdQ7be.d.cts → index-qOK5FtAH.d.cts} +4 -4
- package/dist/{index-DqOAjqxN.d.cts → index-t-a7kYnx.d.cts} +5 -5
- package/dist/index.cjs +303 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +285 -30
- package/dist/index.js.map +1 -1
- package/dist/{jobStatus-kQ9JqF8t.cjs → jobStatus-0_Y3Sr4i.cjs} +37 -20
- package/dist/jobStatus-0_Y3Sr4i.cjs.map +1 -0
- package/dist/{jobStatus-DbMupQEK.js → jobStatus-PSZJMTiA.js} +35 -18
- package/dist/jobStatus-PSZJMTiA.js.map +1 -0
- package/dist/kaiAgent/index.cjs +1 -1
- package/dist/kaiAgent/index.d.cts +2 -210
- package/dist/kaiAgent/index.d.ts +2 -210
- package/dist/kaiAgent/index.js +1 -1
- package/dist/kaiAgent/types.d.cts +1 -1
- package/dist/kaiAgent/types.d.ts +1 -1
- package/dist/{kaiAgent-4OiIK1C2.cjs → kaiAgent-CMVub6Sc.cjs} +48 -4
- package/dist/kaiAgent-CMVub6Sc.cjs.map +1 -0
- package/dist/{kaiAgent-HDaFS9BR.js → kaiAgent-CYYn0QJW.js} +48 -4
- package/dist/kaiAgent-CYYn0QJW.js.map +1 -0
- package/dist/kaiAgentClient-B2O0DF4d.d.ts +249 -0
- package/dist/kaiAgentClient-iCFR2tRU.d.cts +249 -0
- package/dist/management/index.cjs +1 -1
- package/dist/management/index.d.cts +1 -1
- package/dist/management/index.d.ts +1 -1
- package/dist/management/index.js +1 -1
- package/dist/management/types.d.cts +1 -1
- package/dist/management/types.d.ts +1 -1
- package/dist/{management-DfjwQo7z.cjs → management-DGfgKsaA.cjs} +5 -5
- package/dist/{management-DfjwQo7z.cjs.map → management-DGfgKsaA.cjs.map} +1 -1
- package/dist/{management-CIFhu1Nm.js → management-DNEKhR6a.js} +5 -5
- package/dist/{management-CIFhu1Nm.js.map → management-DNEKhR6a.js.map} +1 -1
- package/dist/metastore/index.cjs +1 -1
- package/dist/metastore/index.d.cts +1 -1
- package/dist/metastore/index.d.ts +1 -1
- package/dist/metastore/index.js +1 -1
- package/dist/metastore/types.d.cts +1 -1
- package/dist/metastore/types.d.ts +1 -1
- package/dist/{metastore-CrXkKufo.js → metastore-CjwktHvw.js} +4 -4
- package/dist/{metastore-CrXkKufo.js.map → metastore-CjwktHvw.js.map} +1 -1
- package/dist/{metastore-Dq2NS6jb.cjs → metastore-DksEte8P.cjs} +4 -4
- package/dist/{metastore-Dq2NS6jb.cjs.map → metastore-DksEte8P.cjs.map} +1 -1
- package/dist/microsoftGraph/index.cjs +2 -2
- package/dist/microsoftGraph/index.d.cts +2 -2
- package/dist/microsoftGraph/index.d.ts +2 -2
- package/dist/microsoftGraph/index.js +2 -2
- package/dist/microsoftGraph/types.d.cts +1 -1
- package/dist/microsoftGraph/types.d.ts +1 -1
- package/dist/notifications/index.cjs +3 -3
- package/dist/notifications/index.d.cts +2 -2
- package/dist/notifications/index.d.ts +2 -2
- package/dist/notifications/index.js +3 -3
- package/dist/notifications/types.d.cts +1 -1
- package/dist/notifications/types.d.ts +1 -1
- package/dist/oauth/index.cjs +1 -1
- package/dist/oauth/index.d.cts +2 -2
- package/dist/oauth/index.d.ts +2 -2
- package/dist/oauth/index.js +1 -1
- package/dist/oauth/types.d.cts +1 -1
- package/dist/oauth/types.d.ts +1 -1
- package/dist/{oauth-CFwSNz37.js → oauth-Bg5zro5S.js} +5 -5
- package/dist/{oauth-CFwSNz37.js.map → oauth-Bg5zro5S.js.map} +1 -1
- package/dist/{oauth-CkW5gln-.cjs → oauth-DFsI1TE5.cjs} +5 -5
- package/dist/{oauth-CkW5gln-.cjs.map → oauth-DFsI1TE5.cjs.map} +1 -1
- package/dist/omnisearch/index.cjs +2 -2
- package/dist/omnisearch/index.d.cts +2 -2
- package/dist/omnisearch/index.d.ts +2 -2
- package/dist/omnisearch/index.js +2 -2
- package/dist/omnisearch/types.d.cts +1 -1
- package/dist/omnisearch/types.d.ts +1 -1
- package/dist/{project-BOGaVs-q.d.ts → project-Bh954iOA.d.ts} +2 -2
- package/dist/{project-BnQkL8cb.d.cts → project-D25GH8zK.d.cts} +2 -2
- package/dist/queryService/index.cjs +1 -1
- package/dist/queryService/index.d.cts +1 -1
- package/dist/queryService/index.d.ts +1 -1
- package/dist/queryService/index.js +1 -1
- package/dist/queryService/types.d.cts +1 -1
- package/dist/queryService/types.d.ts +1 -1
- package/dist/{queryService-BLaGbpm-.cjs → queryService--t_W9PSJ.cjs} +6 -6
- package/dist/{queryService-BLaGbpm-.cjs.map → queryService--t_W9PSJ.cjs.map} +1 -1
- package/dist/{queryService-DK-jUnET.js → queryService-DX6zeAs_.js} +6 -6
- package/dist/{queryService-DK-jUnET.js.map → queryService-DX6zeAs_.js.map} +1 -1
- package/dist/queue/index.cjs +1 -1
- package/dist/queue/index.d.cts +3 -3
- package/dist/queue/index.d.ts +3 -3
- package/dist/queue/index.js +1 -1
- package/dist/queue/types.d.cts +1 -1
- package/dist/queue/types.d.ts +1 -1
- package/dist/{queue-B7TY4JLf.cjs → queue-D1_TCe0z.cjs} +5 -5
- package/dist/{queue-B7TY4JLf.cjs.map → queue-D1_TCe0z.cjs.map} +1 -1
- package/dist/{queue-DViSQ-eq.js → queue-DrLUbk98.js} +5 -5
- package/dist/{queue-DViSQ-eq.js.map → queue-DrLUbk98.js.map} +1 -1
- package/dist/scheduler/index.cjs +3 -3
- package/dist/scheduler/index.d.cts +2 -2
- package/dist/scheduler/index.d.ts +2 -2
- package/dist/scheduler/index.js +3 -3
- package/dist/scheduler/types.d.cts +1 -1
- package/dist/scheduler/types.d.ts +1 -1
- package/dist/sdk/configurations/index.d.cts +4 -4
- package/dist/sdk/configurations/index.d.ts +4 -4
- package/dist/sdk/developerPortal/index.cjs +5 -5
- package/dist/sdk/developerPortal/index.cjs.map +1 -1
- package/dist/sdk/developerPortal/index.d.cts +5 -4
- package/dist/sdk/developerPortal/index.d.ts +5 -4
- package/dist/sdk/developerPortal/index.js +4 -4
- package/dist/sdk/queryService/index.cjs +1 -1
- package/dist/sdk/queryService/index.d.cts +1 -1
- package/dist/sdk/queryService/index.d.ts +1 -1
- package/dist/sdk/queryService/index.js +1 -1
- package/dist/sdk/semanticLayer/index.cjs +163 -74
- package/dist/sdk/semanticLayer/index.cjs.map +1 -1
- package/dist/sdk/semanticLayer/index.d.cts +16 -13
- package/dist/sdk/semanticLayer/index.d.ts +16 -13
- package/dist/sdk/semanticLayer/index.js +158 -75
- package/dist/sdk/semanticLayer/index.js.map +1 -1
- package/dist/sdk/semanticLayer/types.d.cts +2 -2
- package/dist/sdk/semanticLayer/types.d.ts +2 -2
- package/dist/sdk/storage/index.d.cts +1 -1
- package/dist/sdk/storage/index.d.ts +1 -1
- package/dist/sdk/tag/index.d.cts +2 -2
- package/dist/sdk/tag/index.d.ts +2 -2
- package/dist/sdk/tag/types.d.cts +1 -1
- package/dist/sdk/tag/types.d.ts +1 -1
- package/dist/sdk/vault/index.d.cts +1 -1
- package/dist/sdk/vault/index.d.ts +1 -1
- package/dist/status/index.cjs +1 -1
- package/dist/status/index.d.cts +1 -1
- package/dist/status/index.d.ts +1 -1
- package/dist/status/index.js +1 -1
- package/dist/storage/index.cjs +4 -4
- package/dist/storage/index.d.cts +2 -2
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +4 -4
- package/dist/storage/types.d.cts +2 -2
- package/dist/storage/types.d.ts +2 -2
- package/dist/{storage-kgxscFEg.js → storage--cVaecFq.js} +7 -7
- package/dist/{storage-kgxscFEg.js.map → storage--cVaecFq.js.map} +1 -1
- package/dist/{storage-CihHwZ7z.cjs → storage-DexWot8H.cjs} +7 -7
- package/dist/{storage-CihHwZ7z.cjs.map → storage-DexWot8H.cjs.map} +1 -1
- package/dist/store-C9FQCHGe.js +74 -0
- package/dist/store-C9FQCHGe.js.map +1 -0
- package/dist/store-xS-Cu_VS.cjs +85 -0
- package/dist/store-xS-Cu_VS.cjs.map +1 -0
- package/dist/stream/index.cjs +3 -3
- package/dist/stream/index.d.cts +2 -2
- package/dist/stream/index.d.ts +2 -2
- package/dist/stream/index.js +3 -3
- package/dist/stream/types.d.cts +1 -1
- package/dist/stream/types.d.ts +1 -1
- package/dist/syncActions/index.cjs +1 -1
- package/dist/syncActions/index.d.cts +1 -1
- package/dist/syncActions/index.d.ts +1 -1
- package/dist/syncActions/index.js +1 -1
- package/dist/syncActions/types.d.cts +1 -1
- package/dist/syncActions/types.d.ts +1 -1
- package/dist/{syncActions-B75t0NwP.js → syncActions-CkMHM-jB.js} +5 -5
- package/dist/{syncActions-B75t0NwP.js.map → syncActions-CkMHM-jB.js.map} +1 -1
- package/dist/{syncActions-CevF_TEb.cjs → syncActions-DQq_A9v6.cjs} +5 -5
- package/dist/{syncActions-CevF_TEb.cjs.map → syncActions-DQq_A9v6.cjs.map} +1 -1
- package/dist/telemetry/index.cjs +1 -1
- package/dist/telemetry/index.d.cts +2 -2
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/index.js +1 -1
- package/dist/{telemetry-DwlSLVAU.cjs → telemetry-CAu1Qt7B.cjs} +3 -3
- package/dist/{telemetry-DwlSLVAU.cjs.map → telemetry-CAu1Qt7B.cjs.map} +1 -1
- package/dist/{telemetry-FXpodtJN.js → telemetry-Ca6j0i9w.js} +3 -3
- package/dist/{telemetry-FXpodtJN.js.map → telemetry-Ca6j0i9w.js.map} +1 -1
- package/dist/{types-CGH_lfxS.d.cts → types-0xa_7cgo.d.cts} +2 -2
- package/dist/{types-CyiRYRVq.d.cts → types-3p0adMdd.d.cts} +3 -3
- package/dist/{types-BlCoTm7n.d.ts → types-6ThDkaJw.d.ts} +2 -2
- package/dist/{types-CkcMoXRk.d.ts → types-6hh_3SZs.d.ts} +3 -3
- package/dist/{types-dybUhlU2.d.ts → types-6ku2LeX6.d.ts} +2 -2
- package/dist/{types-BH9ljNmj.d.cts → types-B42HhyB0.d.cts} +2 -2
- package/dist/{types-C1vhYcic.d.cts → types-B4_MM5Wf.d.cts} +2 -2
- package/dist/{types-DlbiVsVo.d.cts → types-B6JJCta-.d.cts} +2 -2
- package/dist/{types-sVYo0o9_.d.ts → types-B6lOyHY_.d.ts} +3 -3
- package/dist/{types-BZBdLUpH.d.ts → types-B7O5koJb.d.cts} +2 -2
- package/dist/{types-De_DA2ga.d.ts → types-BHI8Lin9.d.ts} +2 -2
- package/dist/{types-Cj4bLPp5.d.cts → types-BO3sCD0a.d.cts} +37 -6
- package/dist/{types-zA3H84SM.d.cts → types-BOnf68s5.d.cts} +2 -2
- package/dist/{types-CPanB0p7.d.cts → types-BS5M67xm.d.cts} +3 -3
- package/dist/{types-COIsNoTQ.d.cts → types-BT46XIgn.d.cts} +2 -2
- package/dist/types-BUYqdN7B.d.ts +205 -0
- package/dist/{types-D-qI9ne4.d.ts → types-BYKHr5bR.d.ts} +2 -2
- package/dist/{types-D1uloiuY.d.cts → types-Be3Wgn1U.d.cts} +2 -2
- package/dist/{types-BTbczawY.d.ts → types-BgVKG4vg.d.ts} +2 -2
- package/dist/{types-CyHZ1ZQe.d.ts → types-C2gzqtjf.d.ts} +2 -2
- package/dist/{types-Av2egS_l.d.ts → types-C35GWNmq.d.ts} +2 -2
- package/dist/{types-D6jKxUv_.d.ts → types-C4mr0lop.d.ts} +35 -3
- package/dist/{types-BI2jI-3-.d.cts → types-CCr1-9Q6.d.cts} +3 -3
- package/dist/{types-DeSd3gqW.d.ts → types-CHCM9oNk.d.ts} +3 -3
- package/dist/{types-BMQW-2Yw.d.ts → types-CNQdtffE.d.ts} +729 -79
- package/dist/{types-MbcIiKDI.d.cts → types-CPaluTW7.d.cts} +3 -3
- package/dist/{types-CXTqFYah.d.ts → types-CSc8NQCY.d.ts} +37 -6
- package/dist/{types-Cz1dj_TM.d.ts → types-C_ilZZkQ.d.ts} +2 -2
- package/dist/{types-EJEoI3ZK.d.ts → types-CaMfshWX.d.ts} +2 -2
- package/dist/{types-BoV9M5Xg.d.cts → types-Ccgbipp4.d.cts} +2 -2
- package/dist/{types-DuiUN0h8.d.ts → types-Cpjk0-ta.d.ts} +2 -2
- package/dist/{types-GuWtMCMn.d.cts → types-CrH4H8M4.d.cts} +2 -2
- package/dist/{types-DNXC_-fA.d.cts → types-Cu-0LT4f.d.cts} +2 -2
- package/dist/{types-BptQ7jpP.d.cts → types-CxmV36rp.d.cts} +2 -2
- package/dist/{types-DwpRt3e9.d.ts → types-D-98DirB.d.ts} +2 -2
- package/dist/{types-BV2BDccJ.d.cts → types-D6ocCyGh.d.cts} +35 -3
- package/dist/{types-COc-nind.d.cts → types-D7Wgcp0u.d.ts} +2 -2
- package/dist/{types-ByWD2oeV.d.ts → types-DAzmGzlb.d.ts} +2 -2
- package/dist/{types-BREGN3qo.d.cts → types-DHI0g51U.d.cts} +2 -2
- package/dist/{types-Dfc58bPE.d.ts → types-DHqIJKwx.d.ts} +2 -2
- package/dist/types-DONxb2-c.d.cts +205 -0
- package/dist/{types-Di8VIZwQ.d.ts → types-DTTC70Ac.d.ts} +2 -2
- package/dist/{types-C2CLlR4i.d.ts → types-DlvZeert.d.ts} +2 -2
- package/dist/{types-cDU_J45_.d.cts → types-DqniGeDJ.d.cts} +2 -2
- package/dist/{types-iNlsdRkx.d.cts → types-E3VT-zYz.d.cts} +729 -79
- package/dist/{types-B4jdPHoL.d.cts → types-Jt0ipbSm.d.cts} +2 -2
- package/dist/{types-Bpnpa2Wt.d.ts → types-Ur37iOqb.d.ts} +3 -3
- package/dist/{types-BnaAo7xn.d.ts → types-ZGAWRIBW.d.ts} +2 -2
- package/dist/{types-CvkqEvhv.d.cts → types-bY6K3y0O.d.cts} +2 -2
- package/dist/{types-CpALS017.d.ts → types-k4R8gQ4U.d.ts} +2 -2
- package/dist/{types-CcuG9cid.d.cts → types-sO52qIAA.d.cts} +2 -2
- package/dist/{types-CJHi0zdD.d.cts → types-sp1rJY9E.d.cts} +2 -2
- package/dist/{validateConnectionStatus-V9q6Nl6u.cjs → validateConnectionStatus-24zqIQ0p.cjs} +2 -2
- package/dist/{validateConnectionStatus-V9q6Nl6u.cjs.map → validateConnectionStatus-24zqIQ0p.cjs.map} +1 -1
- package/dist/{validateConnectionStatus-BrLXkoSI.js → validateConnectionStatus-DhkWg6Eq.js} +2 -2
- package/dist/{validateConnectionStatus-BrLXkoSI.js.map → validateConnectionStatus-DhkWg6Eq.js.map} +1 -1
- package/dist/vault/index.cjs +4 -4
- package/dist/vault/index.d.cts +1 -1
- package/dist/vault/index.d.ts +1 -1
- package/dist/vault/index.js +4 -4
- package/dist/vault/types.d.cts +1 -1
- package/dist/vault/types.d.ts +1 -1
- package/package.json +2 -2
- package/surface/auth.md +2 -2
- package/surface/kaiAgent.md +5 -2
- package/dist/authClient--BtZgjIc.js.map +0 -1
- package/dist/authClient-b7uec7sw.cjs.map +0 -1
- package/dist/createStore-BNiCRQXa.js +0 -148
- package/dist/createStore-BNiCRQXa.js.map +0 -1
- package/dist/createStore-MQbboXcB.cjs +0 -177
- package/dist/createStore-MQbboXcB.cjs.map +0 -1
- package/dist/credential-DOXH7XRS.cjs.map +0 -1
- package/dist/credential-d2RDcXRB.js.map +0 -1
- package/dist/jobStatus-DbMupQEK.js.map +0 -1
- package/dist/jobStatus-kQ9JqF8t.cjs.map +0 -1
- package/dist/kaiAgent-4OiIK1C2.cjs.map +0 -1
- package/dist/kaiAgent-HDaFS9BR.js.map +0 -1
- package/dist/types-B2vmg_UF.d.cts +0 -148
- package/dist/types-RfaldD4P.d.ts +0 -148
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createStore-BNiCRQXa.js","names":[],"sources":["../src/utils/createStore.ts"],"sourcesContent":["type Listener<T> = (value: T) => void;\n\nexport type Emitter<T> = {\n emit: (event: T) => void;\n subscribe: (listener: Listener<T>) => () => void;\n /** Drops every listener. A store's `dispose` is the reason this exists. */\n clear: () => void;\n};\n\n/**\n * An occurrence, announced to whoever is listening.\n *\n * - For what happened rather than what is: nothing is held, so a listener that arrives later hears\n * the next event and never the last one. A store is this plus a value it keeps.\n * - Listeners run in the order they subscribed, synchronously, so an emitter is safe where the\n * emitting code must not be left waiting.\n * - A listener that throws is logged and stepped over. Emitting happens on someone else's call\n * stack — a poll reporting how it ended, a session announcing a new token — and a subscriber's\n * failure must not become theirs.\n */\nexport const createEmitter = <T>(): Emitter<T> => {\n const listeners = new Set<Listener<T>>();\n\n return {\n emit: (event) =>\n listeners.forEach((listener) => {\n try {\n listener(event);\n } catch (error) {\n console.error('A subscriber threw while handling an event', error);\n }\n }),\n subscribe: (listener) => {\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n };\n },\n clear: () => listeners.clear(),\n };\n};\n\nexport type ReadableStore<T> = {\n get: () => T;\n subscribe: (listener: Listener<T>) => () => void;\n dispose: () => void;\n};\n\nexport type Store<T> = ReadableStore<T> & {\n set: (value: T) => void;\n};\n\n/** A value that is kept, and announced when it changes: an emitter with the value in front of it. */\nexport const createStore = <T>(initial: T): Store<T> => {\n const changes = createEmitter<T>();\n let value = initial;\n\n return {\n get: () => value,\n set: (next) => {\n if (Object.is(next, value)) return;\n\n value = next;\n changes.emit(value);\n },\n subscribe: changes.subscribe,\n dispose: () => {\n value = initial;\n changes.clear();\n },\n };\n};\n\nconst isPlainObjectOrArray = (value: object): boolean => {\n if (Array.isArray(value)) return true;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n};\n\nexport const shallowEqual = <T>(a: T, b: T): boolean => {\n if (Object.is(a, b)) return true;\n if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) return false;\n if (!isPlainObjectOrArray(a) || !isPlainObjectOrArray(b)) return false;\n const aKeys = Object.keys(a) as (keyof T)[];\n const bKeys = Object.keys(b) as (keyof T)[];\n return aKeys.length === bKeys.length && aKeys.every((key) => Object.is(a[key], b[key]));\n};\n\ntype DerivedStoreOptions<S, K, T> = {\n source: ReadableStore<S>;\n dependsOn: (state: S) => K;\n build: (key: K) => T;\n keyEquals?: (a: K, b: K) => boolean;\n};\n\nexport const createDerivedStore = <S, K, T>({\n source,\n dependsOn,\n build,\n keyEquals = shallowEqual,\n}: DerivedStoreOptions<S, K, T>): ReadableStore<T> => {\n let key = dependsOn(source.get());\n const store = createStore(build(key));\n\n // The source subscription lives for the derived store's lifetime (both normally live as long as\n // the client). `dispose()` tears down both it and the derived store, so a short-lived derived\n // store can be cleaned up without leaking the source subscription or taking stale updates.\n const unsubscribe = source.subscribe((state) => {\n const next = dependsOn(state);\n if (keyEquals(key, next)) return;\n key = next;\n store.set(build(next));\n });\n\n return {\n get: store.get,\n subscribe: store.subscribe,\n dispose: () => {\n unsubscribe();\n store.dispose();\n },\n };\n};\n\nexport type AsyncState<T> =\n | { state: 'idle' }\n | { state: 'pending' }\n | { state: 'ready'; value: T }\n | { state: 'errored'; error: unknown };\n\n// The terminal states `settled()` resolves with.\ntype SettledState<T> = Extract<AsyncState<T>, { state: 'ready' } | { state: 'errored' }>;\n\ntype DerivedAsyncStoreOptions<S, K, T> = {\n source: ReadableStore<S>;\n dependsOn: (state: S) => K | null;\n build: (key: K, signal: AbortSignal) => Promise<T>;\n keyEquals?: (a: K, b: K) => boolean;\n};\n\n// The async sibling of `createDerivedStore`: it derives a value that arrives later, exposed as an\n// `AsyncState<T>` cell. Two switchMap-style guarantees keep concurrent rebuilds honest:\n// - generation guard: only the latest run may write state, so a stale build resolving after a\n// newer key can never clobber the fresh result;\n// - AbortController: a re-key (or a null key) aborts the previous run's `signal` so in-flight work\n// can actually stop.\n// `dependsOn` returning `null` means \"nothing to build\" → the store goes `idle` and any in-flight run\n// is aborted. Like `createDerivedStore`, the subscription is permanent for the store's lifetime.\n//\n// Returns `{ store, settled }`: `store` is the reactive `AsyncState<T>` cell; `settled()` resolves\n// on the next terminal state with that state (`ready` or `errored`) — the awaitable bridge for\n// callers that need to `await` the build rather than react to it. It never rejects: a failed build\n// is data (`{ state: 'errored', error }`), so callers handle it the same way whether they await or\n// subscribe. Settles immediately if the store is already terminal; while `idle`/`pending` it waits.\nexport const createDerivedAsyncStore = <S, K, T>({\n source,\n dependsOn,\n build,\n keyEquals = shallowEqual,\n}: DerivedAsyncStoreOptions<S, K, T>): {\n store: ReadableStore<AsyncState<T>>;\n settled: () => Promise<SettledState<T>>;\n} => {\n const store = createStore<AsyncState<T>>({ state: 'idle' });\n let currentKey: K | null = null;\n let generation = 0;\n let controller: AbortController | null = null;\n\n const run = (key: K) => {\n controller?.abort();\n controller = new AbortController();\n const runGeneration = ++generation;\n store.set({ state: 'pending' });\n // `.then(onFulfilled, onRejected)` — the reject handler consumes every rejection (including the\n // AbortError from a superseded run), so nothing goes unhandled; the generation guard drops the\n // stale write either way.\n build(key, controller.signal).then(\n (value) => {\n if (runGeneration === generation) store.set({ state: 'ready', value });\n },\n (error) => {\n if (runGeneration === generation) store.set({ state: 'errored', error });\n },\n );\n };\n\n const sync = (state: S) => {\n const next = dependsOn(state);\n if (next === null) {\n if (currentKey === null) return;\n controller?.abort();\n controller = null;\n generation += 1;\n currentKey = null;\n store.set({ state: 'idle' });\n return;\n }\n if (currentKey !== null && keyEquals(currentKey, next)) return;\n currentKey = next;\n run(next);\n };\n sync(source.get());\n\n const unsubscribe = source.subscribe(sync);\n\n const readable: ReadableStore<AsyncState<T>> = {\n get: store.get,\n subscribe: store.subscribe,\n dispose: () => {\n controller?.abort();\n unsubscribe();\n store.dispose();\n },\n };\n\n const settled = (): Promise<SettledState<T>> =>\n new Promise<SettledState<T>>((resolve) => {\n let unsubscribeSettled = () => {};\n const check = (state: AsyncState<T>) => {\n if (state.state === 'ready' || state.state === 'errored') {\n unsubscribeSettled();\n resolve(state);\n }\n };\n unsubscribeSettled = store.subscribe(check);\n check(store.get());\n });\n\n return { store: readable, settled };\n};\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAa,sBAAqC;CAChD,MAAM,4BAAY,IAAI,IAAiB;CAEvC,OAAO;EACL,OAAO,UACL,UAAU,SAAS,aAAa;GAC9B,IAAI;IACF,SAAS,KAAK;GAChB,SAAS,OAAO;IACd,QAAQ,MAAM,8CAA8C,KAAK;GACnE;EACF,CAAC;EACH,YAAY,aAAa;GACvB,UAAU,IAAI,QAAQ;GAEtB,aAAa;IACX,UAAU,OAAO,QAAQ;GAC3B;EACF;EACA,aAAa,UAAU,MAAM;CAC/B;AACF;;AAaA,MAAa,eAAkB,YAAyB;CACtD,MAAM,UAAU,cAAiB;CACjC,IAAI,QAAQ;CAEZ,OAAO;EACL,WAAW;EACX,MAAM,SAAS;GACb,IAAI,OAAO,GAAG,MAAM,KAAK,GAAG;GAE5B,QAAQ;GACR,QAAQ,KAAK,KAAK;EACpB;EACA,WAAW,QAAQ;EACnB,eAAe;GACb,QAAQ;GACR,QAAQ,MAAM;EAChB;CACF;AACF;AAEA,MAAM,wBAAwB,UAA2B;CACvD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;CACjC,MAAM,QAAQ,OAAO,eAAe,KAAK;CACzC,OAAO,UAAU,OAAO,aAAa,UAAU;AACjD;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AAS;GAAM,CAAC;EACvE,IACC,UAAU;GACT,IAAI,kBAAkB,YAAY,MAAM,IAAI;IAAE,OAAO;IAAW;GAAM,CAAC;EACzE,CACF;CACF;CAEA,MAAM,QAAQ,UAAa;EACzB,MAAM,OAAO,UAAU,KAAK;EAC5B,IAAI,SAAS,MAAM;GACjB,IAAI,eAAe,MAAM;GACzB,YAAY,MAAM;GAClB,aAAa;GACb,cAAc;GACd,aAAa;GACb,MAAM,IAAI,EAAE,OAAO,OAAO,CAAC;GAC3B;EACF;EACA,IAAI,eAAe,QAAQ,UAAU,YAAY,IAAI,GAAG;EACxD,aAAa;EACb,IAAI,IAAI;CACV;CACA,KAAK,OAAO,IAAI,CAAC;CAEjB,MAAM,cAAc,OAAO,UAAU,IAAI;CAEzC,MAAM,WAAyC;EAC7C,KAAK,MAAM;EACX,WAAW,MAAM;EACjB,eAAe;GACb,YAAY,MAAM;GAClB,YAAY;GACZ,MAAM,QAAQ;EAChB;CACF;CAEA,MAAM,gBACJ,IAAI,SAA0B,YAAY;EACxC,IAAI,2BAA2B,CAAC;EAChC,MAAM,SAAS,UAAyB;GACtC,IAAI,MAAM,UAAU,WAAW,MAAM,UAAU,WAAW;IACxD,mBAAmB;IACnB,QAAQ,KAAK;GACf;EACF;EACA,qBAAqB,MAAM,UAAU,KAAK;EAC1C,MAAM,MAAM,IAAI,CAAC;CACnB,CAAC;CAEH,OAAO;EAAE,OAAO;EAAU;CAAQ;AACpC"}
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
//#region src/utils/createStore.ts
|
|
2
|
-
/**
|
|
3
|
-
* An occurrence, announced to whoever is listening.
|
|
4
|
-
*
|
|
5
|
-
* - For what happened rather than what is: nothing is held, so a listener that arrives later hears
|
|
6
|
-
* the next event and never the last one. A store is this plus a value it keeps.
|
|
7
|
-
* - Listeners run in the order they subscribed, synchronously, so an emitter is safe where the
|
|
8
|
-
* emitting code must not be left waiting.
|
|
9
|
-
* - A listener that throws is logged and stepped over. Emitting happens on someone else's call
|
|
10
|
-
* stack — a poll reporting how it ended, a session announcing a new token — and a subscriber's
|
|
11
|
-
* failure must not become theirs.
|
|
12
|
-
*/
|
|
13
|
-
const createEmitter = () => {
|
|
14
|
-
const listeners = /* @__PURE__ */ new Set();
|
|
15
|
-
return {
|
|
16
|
-
emit: (event) => listeners.forEach((listener) => {
|
|
17
|
-
try {
|
|
18
|
-
listener(event);
|
|
19
|
-
} catch (error) {
|
|
20
|
-
console.error("A subscriber threw while handling an event", error);
|
|
21
|
-
}
|
|
22
|
-
}),
|
|
23
|
-
subscribe: (listener) => {
|
|
24
|
-
listeners.add(listener);
|
|
25
|
-
return () => {
|
|
26
|
-
listeners.delete(listener);
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
clear: () => listeners.clear()
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
/** A value that is kept, and announced when it changes: an emitter with the value in front of it. */
|
|
33
|
-
const createStore = (initial) => {
|
|
34
|
-
const changes = createEmitter();
|
|
35
|
-
let value = initial;
|
|
36
|
-
return {
|
|
37
|
-
get: () => value,
|
|
38
|
-
set: (next) => {
|
|
39
|
-
if (Object.is(next, value)) return;
|
|
40
|
-
value = next;
|
|
41
|
-
changes.emit(value);
|
|
42
|
-
},
|
|
43
|
-
subscribe: changes.subscribe,
|
|
44
|
-
dispose: () => {
|
|
45
|
-
value = initial;
|
|
46
|
-
changes.clear();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
const isPlainObjectOrArray = (value) => {
|
|
51
|
-
if (Array.isArray(value)) return true;
|
|
52
|
-
const proto = Object.getPrototypeOf(value);
|
|
53
|
-
return proto === Object.prototype || proto === null;
|
|
54
|
-
};
|
|
55
|
-
const shallowEqual = (a, b) => {
|
|
56
|
-
if (Object.is(a, b)) return true;
|
|
57
|
-
if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) return false;
|
|
58
|
-
if (!isPlainObjectOrArray(a) || !isPlainObjectOrArray(b)) return false;
|
|
59
|
-
const aKeys = Object.keys(a);
|
|
60
|
-
const bKeys = Object.keys(b);
|
|
61
|
-
return aKeys.length === bKeys.length && aKeys.every((key) => Object.is(a[key], b[key]));
|
|
62
|
-
};
|
|
63
|
-
const createDerivedStore = ({ source, dependsOn, build, keyEquals = shallowEqual }) => {
|
|
64
|
-
let key = dependsOn(source.get());
|
|
65
|
-
const store = createStore(build(key));
|
|
66
|
-
const unsubscribe = source.subscribe((state) => {
|
|
67
|
-
const next = dependsOn(state);
|
|
68
|
-
if (keyEquals(key, next)) return;
|
|
69
|
-
key = next;
|
|
70
|
-
store.set(build(next));
|
|
71
|
-
});
|
|
72
|
-
return {
|
|
73
|
-
get: store.get,
|
|
74
|
-
subscribe: store.subscribe,
|
|
75
|
-
dispose: () => {
|
|
76
|
-
unsubscribe();
|
|
77
|
-
store.dispose();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
const createDerivedAsyncStore = ({ source, dependsOn, build, keyEquals = shallowEqual }) => {
|
|
82
|
-
const store = createStore({ state: "idle" });
|
|
83
|
-
let currentKey = null;
|
|
84
|
-
let generation = 0;
|
|
85
|
-
let controller = null;
|
|
86
|
-
const run = (key) => {
|
|
87
|
-
controller?.abort();
|
|
88
|
-
controller = new AbortController();
|
|
89
|
-
const runGeneration = ++generation;
|
|
90
|
-
store.set({ state: "pending" });
|
|
91
|
-
build(key, controller.signal).then((value) => {
|
|
92
|
-
if (runGeneration === generation) store.set({
|
|
93
|
-
state: "ready",
|
|
94
|
-
value
|
|
95
|
-
});
|
|
96
|
-
}, (error) => {
|
|
97
|
-
if (runGeneration === generation) store.set({
|
|
98
|
-
state: "errored",
|
|
99
|
-
error
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
const sync = (state) => {
|
|
104
|
-
const next = dependsOn(state);
|
|
105
|
-
if (next === null) {
|
|
106
|
-
if (currentKey === null) return;
|
|
107
|
-
controller?.abort();
|
|
108
|
-
controller = null;
|
|
109
|
-
generation += 1;
|
|
110
|
-
currentKey = null;
|
|
111
|
-
store.set({ state: "idle" });
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (currentKey !== null && keyEquals(currentKey, next)) return;
|
|
115
|
-
currentKey = next;
|
|
116
|
-
run(next);
|
|
117
|
-
};
|
|
118
|
-
sync(source.get());
|
|
119
|
-
const unsubscribe = source.subscribe(sync);
|
|
120
|
-
const readable = {
|
|
121
|
-
get: store.get,
|
|
122
|
-
subscribe: store.subscribe,
|
|
123
|
-
dispose: () => {
|
|
124
|
-
controller?.abort();
|
|
125
|
-
unsubscribe();
|
|
126
|
-
store.dispose();
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const settled = () => new Promise((resolve) => {
|
|
130
|
-
let unsubscribeSettled = () => {};
|
|
131
|
-
const check = (state) => {
|
|
132
|
-
if (state.state === "ready" || state.state === "errored") {
|
|
133
|
-
unsubscribeSettled();
|
|
134
|
-
resolve(state);
|
|
135
|
-
}
|
|
136
|
-
};
|
|
137
|
-
unsubscribeSettled = store.subscribe(check);
|
|
138
|
-
check(store.get());
|
|
139
|
-
});
|
|
140
|
-
return {
|
|
141
|
-
store: readable,
|
|
142
|
-
settled
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
//#endregion
|
|
146
|
-
Object.defineProperty(exports, "createDerivedAsyncStore", {
|
|
147
|
-
enumerable: true,
|
|
148
|
-
get: function() {
|
|
149
|
-
return createDerivedAsyncStore;
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
Object.defineProperty(exports, "createDerivedStore", {
|
|
153
|
-
enumerable: true,
|
|
154
|
-
get: function() {
|
|
155
|
-
return createDerivedStore;
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
|
-
Object.defineProperty(exports, "createEmitter", {
|
|
159
|
-
enumerable: true,
|
|
160
|
-
get: function() {
|
|
161
|
-
return createEmitter;
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
Object.defineProperty(exports, "createStore", {
|
|
165
|
-
enumerable: true,
|
|
166
|
-
get: function() {
|
|
167
|
-
return createStore;
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
Object.defineProperty(exports, "shallowEqual", {
|
|
171
|
-
enumerable: true,
|
|
172
|
-
get: function() {
|
|
173
|
-
return shallowEqual;
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
//# sourceMappingURL=createStore-MQbboXcB.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createStore-MQbboXcB.cjs","names":[],"sources":["../src/utils/createStore.ts"],"sourcesContent":["type Listener<T> = (value: T) => void;\n\nexport type Emitter<T> = {\n emit: (event: T) => void;\n subscribe: (listener: Listener<T>) => () => void;\n /** Drops every listener. A store's `dispose` is the reason this exists. */\n clear: () => void;\n};\n\n/**\n * An occurrence, announced to whoever is listening.\n *\n * - For what happened rather than what is: nothing is held, so a listener that arrives later hears\n * the next event and never the last one. A store is this plus a value it keeps.\n * - Listeners run in the order they subscribed, synchronously, so an emitter is safe where the\n * emitting code must not be left waiting.\n * - A listener that throws is logged and stepped over. Emitting happens on someone else's call\n * stack — a poll reporting how it ended, a session announcing a new token — and a subscriber's\n * failure must not become theirs.\n */\nexport const createEmitter = <T>(): Emitter<T> => {\n const listeners = new Set<Listener<T>>();\n\n return {\n emit: (event) =>\n listeners.forEach((listener) => {\n try {\n listener(event);\n } catch (error) {\n console.error('A subscriber threw while handling an event', error);\n }\n }),\n subscribe: (listener) => {\n listeners.add(listener);\n\n return () => {\n listeners.delete(listener);\n };\n },\n clear: () => listeners.clear(),\n };\n};\n\nexport type ReadableStore<T> = {\n get: () => T;\n subscribe: (listener: Listener<T>) => () => void;\n dispose: () => void;\n};\n\nexport type Store<T> = ReadableStore<T> & {\n set: (value: T) => void;\n};\n\n/** A value that is kept, and announced when it changes: an emitter with the value in front of it. */\nexport const createStore = <T>(initial: T): Store<T> => {\n const changes = createEmitter<T>();\n let value = initial;\n\n return {\n get: () => value,\n set: (next) => {\n if (Object.is(next, value)) return;\n\n value = next;\n changes.emit(value);\n },\n subscribe: changes.subscribe,\n dispose: () => {\n value = initial;\n changes.clear();\n },\n };\n};\n\nconst isPlainObjectOrArray = (value: object): boolean => {\n if (Array.isArray(value)) return true;\n const proto = Object.getPrototypeOf(value);\n return proto === Object.prototype || proto === null;\n};\n\nexport const shallowEqual = <T>(a: T, b: T): boolean => {\n if (Object.is(a, b)) return true;\n if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) return false;\n if (!isPlainObjectOrArray(a) || !isPlainObjectOrArray(b)) return false;\n const aKeys = Object.keys(a) as (keyof T)[];\n const bKeys = Object.keys(b) as (keyof T)[];\n return aKeys.length === bKeys.length && aKeys.every((key) => Object.is(a[key], b[key]));\n};\n\ntype DerivedStoreOptions<S, K, T> = {\n source: ReadableStore<S>;\n dependsOn: (state: S) => K;\n build: (key: K) => T;\n keyEquals?: (a: K, b: K) => boolean;\n};\n\nexport const createDerivedStore = <S, K, T>({\n source,\n dependsOn,\n build,\n keyEquals = shallowEqual,\n}: DerivedStoreOptions<S, K, T>): ReadableStore<T> => {\n let key = dependsOn(source.get());\n const store = createStore(build(key));\n\n // The source subscription lives for the derived store's lifetime (both normally live as long as\n // the client). `dispose()` tears down both it and the derived store, so a short-lived derived\n // store can be cleaned up without leaking the source subscription or taking stale updates.\n const unsubscribe = source.subscribe((state) => {\n const next = dependsOn(state);\n if (keyEquals(key, next)) return;\n key = next;\n store.set(build(next));\n });\n\n return {\n get: store.get,\n subscribe: store.subscribe,\n dispose: () => {\n unsubscribe();\n store.dispose();\n },\n };\n};\n\nexport type AsyncState<T> =\n | { state: 'idle' }\n | { state: 'pending' }\n | { state: 'ready'; value: T }\n | { state: 'errored'; error: unknown };\n\n// The terminal states `settled()` resolves with.\ntype SettledState<T> = Extract<AsyncState<T>, { state: 'ready' } | { state: 'errored' }>;\n\ntype DerivedAsyncStoreOptions<S, K, T> = {\n source: ReadableStore<S>;\n dependsOn: (state: S) => K | null;\n build: (key: K, signal: AbortSignal) => Promise<T>;\n keyEquals?: (a: K, b: K) => boolean;\n};\n\n// The async sibling of `createDerivedStore`: it derives a value that arrives later, exposed as an\n// `AsyncState<T>` cell. Two switchMap-style guarantees keep concurrent rebuilds honest:\n// - generation guard: only the latest run may write state, so a stale build resolving after a\n// newer key can never clobber the fresh result;\n// - AbortController: a re-key (or a null key) aborts the previous run's `signal` so in-flight work\n// can actually stop.\n// `dependsOn` returning `null` means \"nothing to build\" → the store goes `idle` and any in-flight run\n// is aborted. Like `createDerivedStore`, the subscription is permanent for the store's lifetime.\n//\n// Returns `{ store, settled }`: `store` is the reactive `AsyncState<T>` cell; `settled()` resolves\n// on the next terminal state with that state (`ready` or `errored`) — the awaitable bridge for\n// callers that need to `await` the build rather than react to it. It never rejects: a failed build\n// is data (`{ state: 'errored', error }`), so callers handle it the same way whether they await or\n// subscribe. Settles immediately if the store is already terminal; while `idle`/`pending` it waits.\nexport const createDerivedAsyncStore = <S, K, T>({\n source,\n dependsOn,\n build,\n keyEquals = shallowEqual,\n}: DerivedAsyncStoreOptions<S, K, T>): {\n store: ReadableStore<AsyncState<T>>;\n settled: () => Promise<SettledState<T>>;\n} => {\n const store = createStore<AsyncState<T>>({ state: 'idle' });\n let currentKey: K | null = null;\n let generation = 0;\n let controller: AbortController | null = null;\n\n const run = (key: K) => {\n controller?.abort();\n controller = new AbortController();\n const runGeneration = ++generation;\n store.set({ state: 'pending' });\n // `.then(onFulfilled, onRejected)` — the reject handler consumes every rejection (including the\n // AbortError from a superseded run), so nothing goes unhandled; the generation guard drops the\n // stale write either way.\n build(key, controller.signal).then(\n (value) => {\n if (runGeneration === generation) store.set({ state: 'ready', value });\n },\n (error) => {\n if (runGeneration === generation) store.set({ state: 'errored', error });\n },\n );\n };\n\n const sync = (state: S) => {\n const next = dependsOn(state);\n if (next === null) {\n if (currentKey === null) return;\n controller?.abort();\n controller = null;\n generation += 1;\n currentKey = null;\n store.set({ state: 'idle' });\n return;\n }\n if (currentKey !== null && keyEquals(currentKey, next)) return;\n currentKey = next;\n run(next);\n };\n sync(source.get());\n\n const unsubscribe = source.subscribe(sync);\n\n const readable: ReadableStore<AsyncState<T>> = {\n get: store.get,\n subscribe: store.subscribe,\n dispose: () => {\n controller?.abort();\n unsubscribe();\n store.dispose();\n },\n };\n\n const settled = (): Promise<SettledState<T>> =>\n new Promise<SettledState<T>>((resolve) => {\n let unsubscribeSettled = () => {};\n const check = (state: AsyncState<T>) => {\n if (state.state === 'ready' || state.state === 'errored') {\n unsubscribeSettled();\n resolve(state);\n }\n };\n unsubscribeSettled = store.subscribe(check);\n check(store.get());\n });\n\n return { store: readable, settled };\n};\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAa,sBAAqC;CAChD,MAAM,4BAAY,IAAI,IAAiB;CAEvC,OAAO;EACL,OAAO,UACL,UAAU,SAAS,aAAa;GAC9B,IAAI;IACF,SAAS,KAAK;GAChB,SAAS,OAAO;IACd,QAAQ,MAAM,8CAA8C,KAAK;GACnE;EACF,CAAC;EACH,YAAY,aAAa;GACvB,UAAU,IAAI,QAAQ;GAEtB,aAAa;IACX,UAAU,OAAO,QAAQ;GAC3B;EACF;EACA,aAAa,UAAU,MAAM;CAC/B;AACF;;AAaA,MAAa,eAAkB,YAAyB;CACtD,MAAM,UAAU,cAAiB;CACjC,IAAI,QAAQ;CAEZ,OAAO;EACL,WAAW;EACX,MAAM,SAAS;GACb,IAAI,OAAO,GAAG,MAAM,KAAK,GAAG;GAE5B,QAAQ;GACR,QAAQ,KAAK,KAAK;EACpB;EACA,WAAW,QAAQ;EACnB,eAAe;GACb,QAAQ;GACR,QAAQ,MAAM;EAChB;CACF;AACF;AAEA,MAAM,wBAAwB,UAA2B;CACvD,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;CACjC,MAAM,QAAQ,OAAO,eAAe,KAAK;CACzC,OAAO,UAAU,OAAO,aAAa,UAAU;AACjD;AAEA,MA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M,CAAC;EACvE,IACC,UAAU;GACT,IAAI,kBAAkB,YAAY,MAAM,IAAI;IAAE,OAAO;IAAW;GAAM,CAAC;EACzE,CACF;CACF;CAEA,MAAM,QAAQ,UAAa;EACzB,MAAM,OAAO,UAAU,KAAK;EAC5B,IAAI,SAAS,MAAM;GACjB,IAAI,eAAe,MAAM;GACzB,YAAY,MAAM;GAClB,aAAa;GACb,cAAc;GACd,aAAa;GACb,MAAM,IAAI,EAAE,OAAO,OAAO,CAAC;GAC3B;EACF;EACA,IAAI,eAAe,QAAQ,UAAU,YAAY,IAAI,GAAG;EACxD,aAAa;EACb,IAAI,IAAI;CACV;CACA,KAAK,OAAO,IAAI,CAAC;CAEjB,MAAM,cAAc,OAAO,UAAU,IAAI;CAEzC,MAAM,WAAyC;EAC7C,KAAK,MAAM;EACX,WAAW,MAAM;EACjB,eAAe;GACb,YAAY,MAAM;GAClB,YAAY;GACZ,MAAM,QAAQ;EAChB;CACF;CAEA,MAAM,gBACJ,IAAI,SAA0B,YAAY;EACxC,IAAI,2BAA2B,CAAC;EAChC,MAAM,SAAS,UAAyB;GACtC,IAAI,MAAM,UAAU,WAAW,MAAM,UAAU,WAAW;IACxD,mBAAmB;IACnB,QAAQ,KAAK;GACf;EACF;EACA,qBAAqB,MAAM,UAAU,KAAK;EAC1C,MAAM,MAAM,IAAI,CAAC;CACnB,CAAC;CAEH,OAAO;EAAE,OAAO;EAAU;CAAQ;AACpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credential-DOXH7XRS.cjs","names":["ApiError","HttpStatus","dedupe"],"sources":["../src/keboola/bearer/credential.ts"],"sourcesContent":["import { ApiError } from '../../errors';\nimport { HttpStatus } from '../../internal';\nimport { dedupe } from '../../utils';\n\ntype TokenTiming = { issuedAt: number; expiresIn: number };\ntype TokenSnapshot = { accessToken: string; timing: TokenTiming };\n\ntype Options = {\n // Rotate the credential (single-use refresh-token flow); resolves to the fresh access token.\n refresh: () => Promise<string>;\n // Live read of the current token + timing from the single source of truth (config). `null` when the\n // session is anonymous (no credential yet) — e.g. a pre-auth `login` request.\n getToken: () => TokenSnapshot | null;\n // Called when the session is found dead (refresh or replay rejected). The caller owns the\n // fire-once latch + per-session re-arm (see `config.notifyExpired`), so this may fire more than once.\n onSessionExpired?: () => void;\n refreshThreshold?: number;\n};\n\nconst DEFAULT_REFRESH_THRESHOLD = 0.9;\n\nexport const isUnauthorized = (error: unknown): boolean =>\n error instanceof ApiError && error.response.status === HttpStatus.UNAUTHORIZED;\n\nexport type BearerCredential = {\n // Resolves the current access token, or `null` when the session is anonymous (nothing to stamp).\n getAccessToken: (options?: { forceRefresh?: boolean }) => Promise<string | null>;\n notifyExpired: () => void;\n};\n\nexport const createBearerCredential = ({\n refresh,\n getToken,\n onSessionExpired,\n refreshThreshold = DEFAULT_REFRESH_THRESHOLD,\n}: Options): BearerCredential => {\n const doRefresh = async (): Promise<string> => {\n try {\n return await refresh();\n } catch (error) {\n if (isUnauthorized(error)) onSessionExpired?.();\n throw error;\n }\n };\n\n const refreshShared = dedupe(doRefresh);\n\n const refreshAt = (timing: TokenTiming): number =>\n timing.issuedAt + timing.expiresIn * 1000 * refreshThreshold;\n\n const getAccessToken = async ({ forceRefresh = false } = {}): Promise<string | null> => {\n const snapshot = getToken();\n if (snapshot === null) return null; // anonymous: nothing to stamp (pre-auth request)\n const { accessToken, timing } = snapshot;\n if (forceRefresh) return refreshShared(); // 401 path: must succeed, propagate failure\n if (Date.now() < refreshAt(timing)) return accessToken; // still fresh: current token\n // Proactive: best-effort — if the ahead-of-time refresh fails, proceed with the current token\n // and let a real 401 drive the mandatory refresh.\n return refreshShared().catch(() => accessToken);\n };\n\n return { getAccessToken, notifyExpired: () => onSessionExpired?.() };\n};\n"],"mappings":";;;AAmBA,MAAM,4BAA4B;AAElC,MAAa,kBAAkB,UAC7B,iBAAiBA,0BAAAA,YAAY,MAAM,SAAS,WAAWC,0BAAAA,WAAW;AAQpE,MAAa,0BAA0B,EACrC,SACA,UACA,kBACA,mBAAmB,gCACY;CAC/B,MAAM,YAAY,YAA6B;EAC7C,IAAI;GACF,OAAO,MAAM,QAAQ;EACvB,SAAS,OAAO;GACd,IAAI,eAAe,KAAK,GAAG,mBAAmB;GAC9C,MAAM;EACR;CACF;CAEA,MAAM,gBAAgBC,eAAAA,OAAO,SAAS;CAEtC,MAAM,aAAa,WACjB,OAAO,WAAW,OAAO,YAAY,MAAO;CAE9C,MAAM,iBAAiB,OAAO,EAAE,eAAe,UAAU,CAAC,MAA8B;EACtF,MAAM,WAAW,SAAS;EAC1B,IAAI,aAAa,MAAM,OAAO;EAC9B,MAAM,EAAE,aAAa,WAAW;EAChC,IAAI,cAAc,OAAO,cAAc;EACvC,IAAI,KAAK,IAAI,IAAI,UAAU,MAAM,GAAG,OAAO;EAG3C,OAAO,cAAc,CAAC,CAAC,YAAY,WAAW;CAChD;CAEA,OAAO;EAAE;EAAgB,qBAAqB,mBAAmB;CAAE;AACrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"credential-d2RDcXRB.js","names":[],"sources":["../src/keboola/bearer/credential.ts"],"sourcesContent":["import { ApiError } from '../../errors';\nimport { HttpStatus } from '../../internal';\nimport { dedupe } from '../../utils';\n\ntype TokenTiming = { issuedAt: number; expiresIn: number };\ntype TokenSnapshot = { accessToken: string; timing: TokenTiming };\n\ntype Options = {\n // Rotate the credential (single-use refresh-token flow); resolves to the fresh access token.\n refresh: () => Promise<string>;\n // Live read of the current token + timing from the single source of truth (config). `null` when the\n // session is anonymous (no credential yet) — e.g. a pre-auth `login` request.\n getToken: () => TokenSnapshot | null;\n // Called when the session is found dead (refresh or replay rejected). The caller owns the\n // fire-once latch + per-session re-arm (see `config.notifyExpired`), so this may fire more than once.\n onSessionExpired?: () => void;\n refreshThreshold?: number;\n};\n\nconst DEFAULT_REFRESH_THRESHOLD = 0.9;\n\nexport const isUnauthorized = (error: unknown): boolean =>\n error instanceof ApiError && error.response.status === HttpStatus.UNAUTHORIZED;\n\nexport type BearerCredential = {\n // Resolves the current access token, or `null` when the session is anonymous (nothing to stamp).\n getAccessToken: (options?: { forceRefresh?: boolean }) => Promise<string | null>;\n notifyExpired: () => void;\n};\n\nexport const createBearerCredential = ({\n refresh,\n getToken,\n onSessionExpired,\n refreshThreshold = DEFAULT_REFRESH_THRESHOLD,\n}: Options): BearerCredential => {\n const doRefresh = async (): Promise<string> => {\n try {\n return await refresh();\n } catch (error) {\n if (isUnauthorized(error)) onSessionExpired?.();\n throw error;\n }\n };\n\n const refreshShared = dedupe(doRefresh);\n\n const refreshAt = (timing: TokenTiming): number =>\n timing.issuedAt + timing.expiresIn * 1000 * refreshThreshold;\n\n const getAccessToken = async ({ forceRefresh = false } = {}): Promise<string | null> => {\n const snapshot = getToken();\n if (snapshot === null) return null; // anonymous: nothing to stamp (pre-auth request)\n const { accessToken, timing } = snapshot;\n if (forceRefresh) return refreshShared(); // 401 path: must succeed, propagate failure\n if (Date.now() < refreshAt(timing)) return accessToken; // still fresh: current token\n // Proactive: best-effort — if the ahead-of-time refresh fails, proceed with the current token\n // and let a real 401 drive the mandatory refresh.\n return refreshShared().catch(() => accessToken);\n };\n\n return { getAccessToken, notifyExpired: () => onSessionExpired?.() };\n};\n"],"mappings":";;;AAmBA,MAAM,4BAA4B;AAElC,MAAa,kBAAkB,UAC7B,iBAAiB,YAAY,MAAM,SAAS,WAAW,WAAW;AAQpE,MAAa,0BAA0B,EACrC,SACA,UACA,kBACA,mBAAmB,gCACY;CAC/B,MAAM,YAAY,YAA6B;EAC7C,IAAI;GACF,OAAO,MAAM,QAAQ;EACvB,SAAS,OAAO;GACd,IAAI,eAAe,KAAK,GAAG,mBAAmB;GAC9C,MAAM;EACR;CACF;CAEA,MAAM,gBAAgB,OAAO,SAAS;CAEtC,MAAM,aAAa,WACjB,OAAO,WAAW,OAAO,YAAY,MAAO;CAE9C,MAAM,iBAAiB,OAAO,EAAE,eAAe,UAAU,CAAC,MAA8B;EACtF,MAAM,WAAW,SAAS;EAC1B,IAAI,aAAa,MAAM,OAAO;EAC9B,MAAM,EAAE,aAAa,WAAW;EAChC,IAAI,cAAc,OAAO,cAAc;EACvC,IAAI,KAAK,IAAI,IAAI,UAAU,MAAM,GAAG,OAAO;EAG3C,OAAO,cAAc,CAAC,CAAC,YAAY,WAAW;CAChD;CAEA,OAAO;EAAE;EAAgB,qBAAqB,mBAAmB;CAAE;AACrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jobStatus-DbMupQEK.js","names":[],"sources":["../src/utils/createAbortError.ts","../src/utils/async/delay.ts","../src/utils/async/lazy.ts","../src/utils/async/result.ts","../src/utils/async/poll/utils.ts","../src/utils/async/poll/backoff.ts","../src/utils/async/poll/pollLoop.ts","../src/utils/async/poll/poll.ts","../src/domain/jobStatus.ts"],"sourcesContent":["export const createAbortError = (reason?: string) => new DOMException(reason, 'AbortError');\n","import { createAbortError } from '../createAbortError';\n\nexport const delay = (timeout: number, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal?.aborted) return reject(createAbortError(signal.reason));\n\n const onAbort = () => {\n clearTimeout(timeoutId);\n reject(createAbortError(signal?.reason));\n };\n\n // `once: true` only detaches the listener once the event fires, so the timeout path has to\n // detach it explicitly — a caller reusing one signal across many delays (`poll` does) would\n // otherwise pile up a listener per delay for as long as the signal is alive.\n const timeoutId = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n","import type { TaskFn } from './types';\n\n/**\n * Computes `task` on first call and hands that one value to every later caller —\n * the async `Lazy<T>`. While the first run is in flight every call shares it; once\n * it resolves, every call — right after, or long after — replays the same promise.\n * (Contrast `dedupe`, which shares only an *in-flight* run and lets the next\n * trigger start a fresh one, success or not.)\n *\n * A rejection is *not* kept: the slot is cleared, so the next call starts a fresh\n * run. Lazy init over the network — a stack index, JWKS, feature flags — must not\n * be bricked forever by one transient failure. Callers that joined the failed run\n * all reject with its error; only a call made after it settles retries.\n *\n * @returns a getter; each call returns the promise of the computed value.\n * @throws The returned promise rejects with whatever `task` throws or rejects\n * with — the caller handles it (try/catch, or `.catch` on `void get()`).\n */\nexport const lazy = <T>(task: TaskFn<T>): (() => Promise<Awaited<T>>) => {\n let value: Promise<Awaited<T>> | null = null;\n\n // async wrapper so a synchronous throw from `task` rejects rather than throws.\n const runTask = async (): Promise<Awaited<T>> => await task();\n\n return () => {\n value ??= runTask().catch((error: unknown) => {\n value = null;\n throw error;\n });\n return value;\n };\n};\n","export type Result<T, E extends Error = Error> =\n | { success: true; data: T }\n | { success: false; error: E };\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst tryCatch = <T>(task: () => T): Result<T> => {\n try {\n return { success: true, data: task() };\n } catch (thrown) {\n return { success: false, error: asError(thrown) };\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return { success: true, data: await task() };\n } catch (thrown) {\n return { success: false, error: asError(thrown) };\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => R) =>\n (...args: A): Result<R> =>\n tryCatch(() => fn(...args));\n\nconst fromThrowableAsync =\n <A extends unknown[], R>(fn: (...args: A) => R | PromiseLike<R>) =>\n (...args: A): Promise<Result<R>> =>\n tryCatchAsync(() => fn(...args));\n\nexport const Result = { tryCatch, tryCatchAsync, fromThrowable, fromThrowableAsync };\n","/**\n * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,\n * about 24.9 days.\n *\n * - Above it the delay wraps: Node warns and fires after 1 ms, so a long wait becomes a busy loop.\n * - It bounds a backoff curve and a poll's timeout alike, since both end up in a timer.\n */\nexport const MAX_TIMER_DELAY = 2 ** 31 - 1;\n\nexport const clamp = (value: number, min: number, max = Infinity) =>\n Math.min(Math.max(value, min), max);\n\nexport const finiteOr = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\n\n/** A signal that never aborts, so an input nobody gave costs no branch of its own. */\nexport const neverAborts = () => new AbortController().signal;\n","import { clamp, finiteOr, MAX_TIMER_DELAY } from './utils';\n\nexport type Jitter =\n | 'none' // delay\n | 'full' // [0, delay)\n | 'equal'; // [delay / 2, delay)\n\ntype Backoff =\n | { type: 'constant'; interval: number } // 3000, 3000, 3000, ...\n | { type: 'linear'; initialInterval: number; step: number } // 1000, 2000, 3000, …\n | { type: 'exponential'; initialInterval: number; factor?: number }; // 1000, 2000, 4000, 8000, …\n\ntype RandomFn = () => number;\ntype JitterFn = (delay: number) => number;\ntype BackoffFn = (attempt: number) => number;\n\nexport type BackoffDef = {\n jitter?: Jitter;\n maxInterval?: number;\n random?: RandomFn;\n} & Backoff;\n\nconst MIN_STEP = 500;\nconst MIN_FACTOR = 2;\nconst MIN_INTERVAL = 500;\n\nexport const createBackoff = ({\n jitter = 'none',\n maxInterval: _maxInterval = MAX_TIMER_DELAY,\n random = Math.random,\n ...backoff\n}: BackoffDef): BackoffFn => {\n const backoffFn: BackoffFn = (attempt) => {\n if (backoff.type === 'linear') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const step = clamp(finiteOr(backoff.step, MIN_STEP), MIN_STEP);\n\n return interval + step * (attempt - 1);\n }\n if (backoff.type === 'exponential') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const factor = clamp(finiteOr(backoff.factor ?? MIN_FACTOR, MIN_FACTOR), MIN_FACTOR);\n\n return interval * factor ** (attempt - 1);\n }\n\n return clamp(finiteOr(backoff.interval, MIN_INTERVAL), MIN_INTERVAL);\n };\n\n const jitterFn: JitterFn = (delay) => {\n if (jitter === 'none') return delay;\n if (jitter === 'full') return delay * random();\n return delay / 2 + (delay / 2) * random(); // equal\n };\n\n const maxInterval = clamp(finiteOr(_maxInterval, MAX_TIMER_DELAY), MIN_INTERVAL, MAX_TIMER_DELAY);\n return (_attempt) => {\n const attempt = clamp(finiteOr(Math.trunc(_attempt), 1), 1);\n const capped = Math.min(backoffFn(attempt), maxInterval);\n // Floored after the jitter, not before: `full` jitter multiplies by a random fraction, so a floor\n // applied to the curve alone leaves sub-millisecond gaps between attempts.\n return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);\n };\n};\n","import { delay } from '../delay';\nimport { Result } from '../result';\n\nimport { type BackoffDef, createBackoff } from './backoff';\nimport { clamp, finiteOr, MAX_TIMER_DELAY, neverAborts } from './utils';\n\ntype Clock = {\n wait: (ms: number, signal?: AbortSignal) => Promise<void>;\n now: () => number;\n};\n\nexport type PollKey = readonly unknown[];\n\nexport type PollContext<K extends PollKey = PollKey> = {\n pollKey: K;\n attempt: number;\n elapsed: number;\n};\n\n/** The context plus the answer it is about: what `until` decides on, and what an ending reports. */\nexport type PollTick<T, K extends PollKey = PollKey> = PollContext<K> & { last: T | null };\n\nexport type PollResultState = 'done' | 'timedOut' | 'exhausted' | 'aborted' | 'errored';\n\nexport type PollResult<T, K extends PollKey = PollKey> = PollTick<T, K> &\n (\n | { state: 'done'; data: T }\n | { state: 'timedOut' | 'exhausted'; error?: Error }\n | { state: 'aborted'; reason?: unknown }\n | { state: 'errored'; error: Error }\n );\n\nexport type PollOptions<T, K extends PollKey = PollKey> = {\n pollKey?: K;\n pollFn: (context: PollContext<K> & { signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T, K> & { data: T }) => boolean;\n signal?: AbortSignal;\n backoff?: BackoffDef;\n isRetryable?: (error: Error) => boolean;\n maxAttempts?: number;\n timeout?: number;\n clock?: Clock;\n};\n\nconst pollResult = {\n done: <T, K extends PollKey>(data: T, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'done',\n data,\n ...context,\n last: data,\n }),\n errored: <T, K extends PollKey>(error: Error, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'errored',\n error,\n ...context,\n }),\n exhausted: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'exhausted',\n error,\n ...context,\n }),\n timedOut: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'timedOut',\n error,\n ...context,\n }),\n aborted: <T, K extends PollKey>(context: PollTick<T, K>, reason: unknown): PollResult<T, K> => ({\n state: 'aborted',\n reason,\n ...context,\n }),\n};\n\nexport const pollLoop = async <T, K extends PollKey = PollKey>({\n pollKey,\n pollFn: _pollFn,\n until: _until,\n signal: callerSignal = neverAborts(),\n backoff: backoffDef = { type: 'constant', interval: 3000 },\n clock = { wait: (ms, signal) => delay(ms, signal), now: () => performance.now() },\n isRetryable: _isRetryable = () => false,\n maxAttempts: _maxAttempts = Infinity,\n timeout: _timeout = Infinity,\n}: PollOptions<T, K>): Promise<PollResult<T, K>> => {\n // A deadline ends up in a timer, so a finite one is bounded by what a timer can hold. `Infinity`\n // is answered before the clamp: it means no deadline, and clamping would make it the longest one.\n const requested = finiteOr(_timeout, Infinity);\n const timeout = requested === Infinity ? Infinity : clamp(requested, 0, MAX_TIMER_DELAY);\n const maxAttempts = Math.trunc(clamp(finiteOr(_maxAttempts, Infinity), 0));\n\n const timeoutSignal = timeout === Infinity ? neverAborts() : AbortSignal.timeout(timeout);\n const anySignal = AbortSignal.any([callerSignal, timeoutSignal]);\n const anyAborted = Promise.withResolvers<never>();\n\n anySignal.addEventListener('abort', () => anyAborted.reject(anySignal.reason), {\n once: true,\n });\n void anyAborted.promise.catch(() => undefined);\n\n const backoffFn = createBackoff(backoffDef);\n const startedAt = clock.now();\n\n const until = Result.fromThrowable(_until);\n const isRetryable = Result.fromThrowable(_isRetryable);\n // A poll without a key has an empty one, and `K` is opaque in here — the one place the absent\n // case is materialised is the one place it has to be asserted.\n const key = pollKey ?? ([] as unknown as K);\n // Only what the context declares: a request is not handed the tick's `last` as well.\n const pollFn = ({ pollKey: key, attempt: at, elapsed }: PollContext<K>) =>\n Result.tryCatchAsync(() =>\n Promise.race([\n _pollFn({ pollKey: key, attempt: at, elapsed, signal: anySignal }),\n anyAborted.promise,\n ]),\n );\n const sleep = Result.fromThrowableAsync((ms: number) => clock.wait(ms, anySignal));\n\n let attempt = 0;\n // What a retry swallowed: the poll carries it to whichever ending runs out first.\n let last: T | null = null;\n let lastError: Error | undefined;\n const context = (at = clock.now() - startedAt): PollTick<T, K> => ({\n pollKey: key,\n attempt,\n elapsed: at,\n last,\n });\n\n if (attempt >= maxAttempts) return pollResult.exhausted<T, K>(context());\n\n while (true) {\n const before = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(before, lastError);\n if (callerSignal.aborted) return pollResult.aborted(before, callerSignal.reason);\n\n attempt++;\n // The attempt it is, not the one before it — `before` was read to decide whether to make it.\n const poll = await pollFn({ ...before, attempt });\n\n // What the attempt produced, recorded before the tick that reports it: on any ending but `done`\n // these two are the only account of what the poll saw, and reading them one attempt behind is\n // reading the wrong answer.\n if (poll.success) last = poll.data;\n else lastError = poll.error;\n\n const after = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(after, lastError);\n if (callerSignal.aborted) return pollResult.aborted(after, callerSignal.reason);\n\n if (!poll.success) {\n const canRetry = isRetryable(poll.error);\n\n // A predicate that throws cannot ask for a retry. The request's own failure stays the reported\n // one — it is the type a caller's guards expect — and the predicate's rides along as its cause.\n if (!canRetry.success) {\n poll.error.cause ??= canRetry.error;\n return pollResult.errored(poll.error, after);\n }\n if (!canRetry.data) return pollResult.errored(poll.error, after);\n }\n\n if (poll.success) {\n const isDone = until({ ...after, data: poll.data });\n if (!isDone.success) return pollResult.errored(isDone.error, after);\n if (isDone.data) return pollResult.done(poll.data, after);\n }\n\n // exhausted\n if (attempt >= maxAttempts) return pollResult.exhausted(after, lastError);\n\n // sleep\n const backoff = backoffFn(attempt);\n if (after.elapsed + backoff >= timeout) return pollResult.timedOut(after, lastError);\n\n const slept = await sleep(backoff);\n if (!slept.success) {\n const afterSleep = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(afterSleep, lastError);\n if (callerSignal.aborted) return pollResult.aborted(afterSleep, callerSignal.reason);\n\n return pollResult.errored(slept.error, afterSleep);\n }\n }\n};\n","import { createAbortError } from '../../createAbortError';\nimport { createEmitter, createStore } from '../../createStore';\nimport { lazy } from '../lazy';\n\nimport {\n type PollKey,\n pollLoop,\n type PollOptions,\n type PollResult,\n type PollResultState,\n type PollTick,\n} from './pollLoop';\nimport { neverAborts } from './utils';\n\nexport type PollState = 'idle' | 'polling' | PollResultState;\nexport type PollSnapshot = PollTick<unknown> & { state: PollState };\n\ntype OnFailure<T> = (result: PollResult<T>) => Error | undefined;\n\nexport type PollerStartFn<T> = () => Promise<PollResult<T>>;\nexport type PollerStopFn = (reason?: string) => void;\ntype PollerSubscribeFn = (listener: (snapshot: PollSnapshot) => void) => () => void;\ntype PollerDebugFn = () => PollSnapshot;\ntype PollerUnwrapFn<T> = (onFailure?: OnFailure<T>) => Promise<T>;\nexport type Poller<T> = {\n readonly state: PollState;\n start: PollerStartFn<T>;\n unwrap: PollerUnwrapFn<T>;\n stop: PollerStopFn;\n subscribe: PollerSubscribeFn;\n debug: PollerDebugFn;\n};\n\nexport type PollTask<T> = Promise<PollResult<T>> &\n Pick<Poller<T>, 'unwrap' | 'stop' | 'subscribe' | 'debug'>;\n\nexport type ObservedPoller = Pick<Poller<unknown>, 'stop' | 'subscribe' | 'debug' | 'start'>;\n\nexport const emitter = createEmitter<ObservedPoller>();\n\nexport const failureOf = (result: PollResult<unknown>): Error => {\n if ('error' in result && result.error) return result.error;\n\n if (result.state === 'aborted') {\n if (result.reason instanceof Error) return result.reason;\n\n return createAbortError(\n typeof result.reason === 'string' ? result.reason : 'The poll was stopped.',\n );\n }\n\n return new Error(`The poll ${result.state} after ${result.attempt} attempts.`);\n};\n\nexport const poller = <T, K extends PollKey = PollKey>({\n pollKey,\n signal,\n until,\n ...pollLoopOptions\n}: PollOptions<T, K>): Poller<T> => {\n const callerSignal = signal ?? neverAborts();\n const pollerSignal = new AbortController();\n const anySignal = AbortSignal.any([pollerSignal.signal, callerSignal]);\n\n // snapshoting\n const snapshot = createStore<PollSnapshot>({\n pollKey: pollKey ?? [],\n state: 'idle',\n attempt: 0,\n elapsed: 0,\n last: null,\n });\n const updateSnapshot = (next: Partial<PollSnapshot>) =>\n snapshot.set({ ...snapshot.get(), ...next });\n\n const handleUntil = (context: PollTick<T, K> & { data: T }) => {\n updateSnapshot({ attempt: context.attempt, elapsed: context.elapsed, last: context.data });\n return until(context);\n };\n\n const start: PollerStartFn<T> = lazy(async () => {\n updateSnapshot({ state: 'polling' });\n const result = await pollLoop({\n ...pollLoopOptions,\n pollKey,\n until: handleUntil,\n signal: anySignal,\n });\n // The result knows what a tick cannot: attempts that failed, and the time the ending itself took.\n snapshot.set({\n pollKey: result.pollKey,\n state: result.state,\n attempt: result.attempt,\n elapsed: result.elapsed,\n last: result.last,\n });\n return result;\n });\n\n const stop: PollerStopFn = (reason) => pollerSignal.abort(reason);\n const subscribe: PollerSubscribeFn = (listener) =>\n snapshot.subscribe(() => listener(snapshot.get()));\n const debug: PollerDebugFn = snapshot.get;\n\n const unwrap: PollerUnwrapFn<T> = async (onFailure) => {\n const result = await start();\n if (result.state === 'done') return result.data;\n throw onFailure?.(result) ?? failureOf(result);\n };\n\n const controls = {\n stop,\n subscribe,\n debug,\n start,\n };\n\n emitter.emit(controls);\n\n return {\n get state() {\n return snapshot.get().state;\n },\n unwrap,\n ...controls,\n };\n};\n\nexport const poll = <T, K extends PollKey = PollKey>(options: PollOptions<T, K>): PollTask<T> => {\n const p = poller(options);\n\n return Object.assign(p.start(), {\n unwrap: p.unwrap,\n stop: p.stop,\n subscribe: p.subscribe,\n debug: p.debug,\n });\n};\n","import type { QueryJobStatus } from '../clients/queryService/types';\nimport type { QueueJobStatus } from '../clients/queue/types';\nimport type { StorageJobStatus } from '../clients/storage/jobs/types';\n\n/**\n * How one service's status vocabulary splits by what the job is doing. Declared per service, then\n * indexed into sets by `forService`.\n *\n * - The three groups are disjoint and together cover the vocabulary. `terminal` is not declared: a\n * job is terminal exactly when it has succeeded or failed.\n * - Annotating the constant is what validates its members: `QueueJobStatus` and `QueryJobStatus` are\n * generated, so a spec that renames one fails the build here instead of silently dropping it from\n * a group and leaving a poll loop to run to `maxAttempts`.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/**\n * A service's statuses as named constants — `SUCCESS: 'success'`.\n *\n * Keyed off the status type, so there is an entry per status and no more, and a spec that renames a\n * status renames the key with it.\n */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// `StorageJobStatus` in `connection`, whose `isDoneStatus` is the `success`/`error` pair.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running, not terminal: the job is still being killed and keeps reporting until\n * `terminated`.\n * - `warning` is a success — the run produced its output and only added a non-fatal notice, which is\n * why a flow keeps going past it. The backend declares no such split (`STATUSES_FINISHED` is its\n * only grouping), so dividing it into success and failure is ours.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// `JobState` in `go-monorepo` (`services/query/internal/repository/models`). `canceled` with one\n// `l` — queryService's spelling, unlike the other two services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's view of its statuses: a predicate per question, with the data a level down.\n *\n * - `isSuccessful` / `isFailed` are `false` while the job is still running, so read them together\n * with `isTerminal` where that distinction matters.\n * - `isKnown` narrows an untyped string — one read out of an MCP tool result or a URL, say. A status\n * that arrived on a typed response needs no guard. Its `Set<string>` is what takes the wider type\n * the caller has, so the guard needs no assertion of its own.\n * - `describe` answers every question about one status at once, for a caller that needs more than\n * one of them.\n * - `statuses.terminal` is `successful` plus `failed` — the group a poll loop stops on.\n * - `named` is asserted, not proven: `Object.fromEntries` types its result as an index signature,\n * and no expression convinces TypeScript that uppercasing every status produces exactly\n * `StatusNames<Status>`. The alternative is writing all three maps out by hand, which is the\n * duplication this file exists to avoid.\n */\nconst forService = <Status extends string>(groups: StatusGroups<Status>) => {\n const all = [...groups.running, ...groups.successful, ...groups.failed];\n\n const running: ReadonlySet<Status> = new Set(groups.running);\n const successful: ReadonlySet<Status> = new Set(groups.successful);\n const failed: ReadonlySet<Status> = new Set(groups.failed);\n const terminal: ReadonlySet<Status> = new Set([...groups.successful, ...groups.failed]);\n const known: ReadonlySet<string> = new Set<string>(all);\n\n return {\n isRunning: (status: Status) => running.has(status),\n isTerminal: (status: Status) => terminal.has(status),\n isSuccessful: (status: Status) => successful.has(status),\n isFailed: (status: Status) => failed.has(status),\n isKnown: (value: string): value is Status => known.has(value),\n describe: (status: Status) => ({\n isRunning: running.has(status),\n isTerminal: terminal.has(status),\n isSuccessful: successful.has(status),\n isFailed: failed.has(status),\n }),\n statuses: { running, successful, failed, terminal },\n named: Object.fromEntries(\n all.map((status) => [status.toUpperCase(), status]),\n ) as StatusNames<Status>,\n };\n};\n\n/**\n * Job statuses per service: `jobStatus.queue.isFailed(status)` is the question about one job,\n * `jobStatus.queue.statuses.failed` the statuses behind it,\n * `jobStatus.queue.named.ERROR` one of them by name.\n *\n * One entry per service, never one over the union: the vocabularies overlap by label — `processing`\n * belongs to all three, `created` to queue and query — while which statuses exist and what each\n * implies differ per service. A shared entry would take another service's status and answer by its\n * rules.\n *\n * - `storage` and `queue` describe a job; `query` describes a query job, not its statements. A\n * statement has its own state, including a terminal `notExecuted` with no job-level equivalent.\n * - Spread a group where an array is wanted — an API `status` filter, or a UI list that mixes job\n * statuses with its own.\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\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WAAW,KAAK;CACvB,OAAO,WAAW,KAAK;AACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jobStatus-kQ9JqF8t.cjs","names":["createEmitter","createStore"],"sources":["../src/utils/createAbortError.ts","../src/utils/async/delay.ts","../src/utils/async/lazy.ts","../src/utils/async/result.ts","../src/utils/async/poll/utils.ts","../src/utils/async/poll/backoff.ts","../src/utils/async/poll/pollLoop.ts","../src/utils/async/poll/poll.ts","../src/domain/jobStatus.ts"],"sourcesContent":["export const createAbortError = (reason?: string) => new DOMException(reason, 'AbortError');\n","import { createAbortError } from '../createAbortError';\n\nexport const delay = (timeout: number, signal?: AbortSignal) =>\n new Promise<void>((resolve, reject) => {\n if (signal?.aborted) return reject(createAbortError(signal.reason));\n\n const onAbort = () => {\n clearTimeout(timeoutId);\n reject(createAbortError(signal?.reason));\n };\n\n // `once: true` only detaches the listener once the event fires, so the timeout path has to\n // detach it explicitly — a caller reusing one signal across many delays (`poll` does) would\n // otherwise pile up a listener per delay for as long as the signal is alive.\n const timeoutId = setTimeout(() => {\n signal?.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n","import type { TaskFn } from './types';\n\n/**\n * Computes `task` on first call and hands that one value to every later caller —\n * the async `Lazy<T>`. While the first run is in flight every call shares it; once\n * it resolves, every call — right after, or long after — replays the same promise.\n * (Contrast `dedupe`, which shares only an *in-flight* run and lets the next\n * trigger start a fresh one, success or not.)\n *\n * A rejection is *not* kept: the slot is cleared, so the next call starts a fresh\n * run. Lazy init over the network — a stack index, JWKS, feature flags — must not\n * be bricked forever by one transient failure. Callers that joined the failed run\n * all reject with its error; only a call made after it settles retries.\n *\n * @returns a getter; each call returns the promise of the computed value.\n * @throws The returned promise rejects with whatever `task` throws or rejects\n * with — the caller handles it (try/catch, or `.catch` on `void get()`).\n */\nexport const lazy = <T>(task: TaskFn<T>): (() => Promise<Awaited<T>>) => {\n let value: Promise<Awaited<T>> | null = null;\n\n // async wrapper so a synchronous throw from `task` rejects rather than throws.\n const runTask = async (): Promise<Awaited<T>> => await task();\n\n return () => {\n value ??= runTask().catch((error: unknown) => {\n value = null;\n throw error;\n });\n return value;\n };\n};\n","export type Result<T, E extends Error = Error> =\n | { success: true; data: T }\n | { success: false; error: E };\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst tryCatch = <T>(task: () => T): Result<T> => {\n try {\n return { success: true, data: task() };\n } catch (thrown) {\n return { success: false, error: asError(thrown) };\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return { success: true, data: await task() };\n } catch (thrown) {\n return { success: false, error: asError(thrown) };\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => R) =>\n (...args: A): Result<R> =>\n tryCatch(() => fn(...args));\n\nconst fromThrowableAsync =\n <A extends unknown[], R>(fn: (...args: A) => R | PromiseLike<R>) =>\n (...args: A): Promise<Result<R>> =>\n tryCatchAsync(() => fn(...args));\n\nexport const Result = { tryCatch, tryCatchAsync, fromThrowable, fromThrowableAsync };\n","/**\n * The longest delay a timer can hold: `setTimeout` takes a 32-bit signed number of milliseconds,\n * about 24.9 days.\n *\n * - Above it the delay wraps: Node warns and fires after 1 ms, so a long wait becomes a busy loop.\n * - It bounds a backoff curve and a poll's timeout alike, since both end up in a timer.\n */\nexport const MAX_TIMER_DELAY = 2 ** 31 - 1;\n\nexport const clamp = (value: number, min: number, max = Infinity) =>\n Math.min(Math.max(value, min), max);\n\nexport const finiteOr = (value: number, fallback: number) =>\n Number.isFinite(value) ? value : fallback;\n\n/** A signal that never aborts, so an input nobody gave costs no branch of its own. */\nexport const neverAborts = () => new AbortController().signal;\n","import { clamp, finiteOr, MAX_TIMER_DELAY } from './utils';\n\nexport type Jitter =\n | 'none' // delay\n | 'full' // [0, delay)\n | 'equal'; // [delay / 2, delay)\n\ntype Backoff =\n | { type: 'constant'; interval: number } // 3000, 3000, 3000, ...\n | { type: 'linear'; initialInterval: number; step: number } // 1000, 2000, 3000, …\n | { type: 'exponential'; initialInterval: number; factor?: number }; // 1000, 2000, 4000, 8000, …\n\ntype RandomFn = () => number;\ntype JitterFn = (delay: number) => number;\ntype BackoffFn = (attempt: number) => number;\n\nexport type BackoffDef = {\n jitter?: Jitter;\n maxInterval?: number;\n random?: RandomFn;\n} & Backoff;\n\nconst MIN_STEP = 500;\nconst MIN_FACTOR = 2;\nconst MIN_INTERVAL = 500;\n\nexport const createBackoff = ({\n jitter = 'none',\n maxInterval: _maxInterval = MAX_TIMER_DELAY,\n random = Math.random,\n ...backoff\n}: BackoffDef): BackoffFn => {\n const backoffFn: BackoffFn = (attempt) => {\n if (backoff.type === 'linear') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const step = clamp(finiteOr(backoff.step, MIN_STEP), MIN_STEP);\n\n return interval + step * (attempt - 1);\n }\n if (backoff.type === 'exponential') {\n const interval = clamp(finiteOr(backoff.initialInterval, MIN_INTERVAL), MIN_INTERVAL);\n const factor = clamp(finiteOr(backoff.factor ?? MIN_FACTOR, MIN_FACTOR), MIN_FACTOR);\n\n return interval * factor ** (attempt - 1);\n }\n\n return clamp(finiteOr(backoff.interval, MIN_INTERVAL), MIN_INTERVAL);\n };\n\n const jitterFn: JitterFn = (delay) => {\n if (jitter === 'none') return delay;\n if (jitter === 'full') return delay * random();\n return delay / 2 + (delay / 2) * random(); // equal\n };\n\n const maxInterval = clamp(finiteOr(_maxInterval, MAX_TIMER_DELAY), MIN_INTERVAL, MAX_TIMER_DELAY);\n return (_attempt) => {\n const attempt = clamp(finiteOr(Math.trunc(_attempt), 1), 1);\n const capped = Math.min(backoffFn(attempt), maxInterval);\n // Floored after the jitter, not before: `full` jitter multiplies by a random fraction, so a floor\n // applied to the curve alone leaves sub-millisecond gaps between attempts.\n return clamp(finiteOr(jitterFn(capped), MIN_INTERVAL), MIN_INTERVAL, maxInterval);\n };\n};\n","import { delay } from '../delay';\nimport { Result } from '../result';\n\nimport { type BackoffDef, createBackoff } from './backoff';\nimport { clamp, finiteOr, MAX_TIMER_DELAY, neverAborts } from './utils';\n\ntype Clock = {\n wait: (ms: number, signal?: AbortSignal) => Promise<void>;\n now: () => number;\n};\n\nexport type PollKey = readonly unknown[];\n\nexport type PollContext<K extends PollKey = PollKey> = {\n pollKey: K;\n attempt: number;\n elapsed: number;\n};\n\n/** The context plus the answer it is about: what `until` decides on, and what an ending reports. */\nexport type PollTick<T, K extends PollKey = PollKey> = PollContext<K> & { last: T | null };\n\nexport type PollResultState = 'done' | 'timedOut' | 'exhausted' | 'aborted' | 'errored';\n\nexport type PollResult<T, K extends PollKey = PollKey> = PollTick<T, K> &\n (\n | { state: 'done'; data: T }\n | { state: 'timedOut' | 'exhausted'; error?: Error }\n | { state: 'aborted'; reason?: unknown }\n | { state: 'errored'; error: Error }\n );\n\nexport type PollOptions<T, K extends PollKey = PollKey> = {\n pollKey?: K;\n pollFn: (context: PollContext<K> & { signal: AbortSignal }) => Promise<T>;\n until: (tick: PollTick<T, K> & { data: T }) => boolean;\n signal?: AbortSignal;\n backoff?: BackoffDef;\n isRetryable?: (error: Error) => boolean;\n maxAttempts?: number;\n timeout?: number;\n clock?: Clock;\n};\n\nconst pollResult = {\n done: <T, K extends PollKey>(data: T, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'done',\n data,\n ...context,\n last: data,\n }),\n errored: <T, K extends PollKey>(error: Error, context: PollTick<T, K>): PollResult<T, K> => ({\n state: 'errored',\n error,\n ...context,\n }),\n exhausted: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'exhausted',\n error,\n ...context,\n }),\n timedOut: <T, K extends PollKey>(context: PollTick<T, K>, error?: Error): PollResult<T, K> => ({\n state: 'timedOut',\n error,\n ...context,\n }),\n aborted: <T, K extends PollKey>(context: PollTick<T, K>, reason: unknown): PollResult<T, K> => ({\n state: 'aborted',\n reason,\n ...context,\n }),\n};\n\nexport const pollLoop = async <T, K extends PollKey = PollKey>({\n pollKey,\n pollFn: _pollFn,\n until: _until,\n signal: callerSignal = neverAborts(),\n backoff: backoffDef = { type: 'constant', interval: 3000 },\n clock = { wait: (ms, signal) => delay(ms, signal), now: () => performance.now() },\n isRetryable: _isRetryable = () => false,\n maxAttempts: _maxAttempts = Infinity,\n timeout: _timeout = Infinity,\n}: PollOptions<T, K>): Promise<PollResult<T, K>> => {\n // A deadline ends up in a timer, so a finite one is bounded by what a timer can hold. `Infinity`\n // is answered before the clamp: it means no deadline, and clamping would make it the longest one.\n const requested = finiteOr(_timeout, Infinity);\n const timeout = requested === Infinity ? Infinity : clamp(requested, 0, MAX_TIMER_DELAY);\n const maxAttempts = Math.trunc(clamp(finiteOr(_maxAttempts, Infinity), 0));\n\n const timeoutSignal = timeout === Infinity ? neverAborts() : AbortSignal.timeout(timeout);\n const anySignal = AbortSignal.any([callerSignal, timeoutSignal]);\n const anyAborted = Promise.withResolvers<never>();\n\n anySignal.addEventListener('abort', () => anyAborted.reject(anySignal.reason), {\n once: true,\n });\n void anyAborted.promise.catch(() => undefined);\n\n const backoffFn = createBackoff(backoffDef);\n const startedAt = clock.now();\n\n const until = Result.fromThrowable(_until);\n const isRetryable = Result.fromThrowable(_isRetryable);\n // A poll without a key has an empty one, and `K` is opaque in here — the one place the absent\n // case is materialised is the one place it has to be asserted.\n const key = pollKey ?? ([] as unknown as K);\n // Only what the context declares: a request is not handed the tick's `last` as well.\n const pollFn = ({ pollKey: key, attempt: at, elapsed }: PollContext<K>) =>\n Result.tryCatchAsync(() =>\n Promise.race([\n _pollFn({ pollKey: key, attempt: at, elapsed, signal: anySignal }),\n anyAborted.promise,\n ]),\n );\n const sleep = Result.fromThrowableAsync((ms: number) => clock.wait(ms, anySignal));\n\n let attempt = 0;\n // What a retry swallowed: the poll carries it to whichever ending runs out first.\n let last: T | null = null;\n let lastError: Error | undefined;\n const context = (at = clock.now() - startedAt): PollTick<T, K> => ({\n pollKey: key,\n attempt,\n elapsed: at,\n last,\n });\n\n if (attempt >= maxAttempts) return pollResult.exhausted<T, K>(context());\n\n while (true) {\n const before = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(before, lastError);\n if (callerSignal.aborted) return pollResult.aborted(before, callerSignal.reason);\n\n attempt++;\n // The attempt it is, not the one before it — `before` was read to decide whether to make it.\n const poll = await pollFn({ ...before, attempt });\n\n // What the attempt produced, recorded before the tick that reports it: on any ending but `done`\n // these two are the only account of what the poll saw, and reading them one attempt behind is\n // reading the wrong answer.\n if (poll.success) last = poll.data;\n else lastError = poll.error;\n\n const after = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(after, lastError);\n if (callerSignal.aborted) return pollResult.aborted(after, callerSignal.reason);\n\n if (!poll.success) {\n const canRetry = isRetryable(poll.error);\n\n // A predicate that throws cannot ask for a retry. The request's own failure stays the reported\n // one — it is the type a caller's guards expect — and the predicate's rides along as its cause.\n if (!canRetry.success) {\n poll.error.cause ??= canRetry.error;\n return pollResult.errored(poll.error, after);\n }\n if (!canRetry.data) return pollResult.errored(poll.error, after);\n }\n\n if (poll.success) {\n const isDone = until({ ...after, data: poll.data });\n if (!isDone.success) return pollResult.errored(isDone.error, after);\n if (isDone.data) return pollResult.done(poll.data, after);\n }\n\n // exhausted\n if (attempt >= maxAttempts) return pollResult.exhausted(after, lastError);\n\n // sleep\n const backoff = backoffFn(attempt);\n if (after.elapsed + backoff >= timeout) return pollResult.timedOut(after, lastError);\n\n const slept = await sleep(backoff);\n if (!slept.success) {\n const afterSleep = context();\n if (timeoutSignal.aborted) return pollResult.timedOut(afterSleep, lastError);\n if (callerSignal.aborted) return pollResult.aborted(afterSleep, callerSignal.reason);\n\n return pollResult.errored(slept.error, afterSleep);\n }\n }\n};\n","import { createAbortError } from '../../createAbortError';\nimport { createEmitter, createStore } from '../../createStore';\nimport { lazy } from '../lazy';\n\nimport {\n type PollKey,\n pollLoop,\n type PollOptions,\n type PollResult,\n type PollResultState,\n type PollTick,\n} from './pollLoop';\nimport { neverAborts } from './utils';\n\nexport type PollState = 'idle' | 'polling' | PollResultState;\nexport type PollSnapshot = PollTick<unknown> & { state: PollState };\n\ntype OnFailure<T> = (result: PollResult<T>) => Error | undefined;\n\nexport type PollerStartFn<T> = () => Promise<PollResult<T>>;\nexport type PollerStopFn = (reason?: string) => void;\ntype PollerSubscribeFn = (listener: (snapshot: PollSnapshot) => void) => () => void;\ntype PollerDebugFn = () => PollSnapshot;\ntype PollerUnwrapFn<T> = (onFailure?: OnFailure<T>) => Promise<T>;\nexport type Poller<T> = {\n readonly state: PollState;\n start: PollerStartFn<T>;\n unwrap: PollerUnwrapFn<T>;\n stop: PollerStopFn;\n subscribe: PollerSubscribeFn;\n debug: PollerDebugFn;\n};\n\nexport type PollTask<T> = Promise<PollResult<T>> &\n Pick<Poller<T>, 'unwrap' | 'stop' | 'subscribe' | 'debug'>;\n\nexport type ObservedPoller = Pick<Poller<unknown>, 'stop' | 'subscribe' | 'debug' | 'start'>;\n\nexport const emitter = createEmitter<ObservedPoller>();\n\nexport const failureOf = (result: PollResult<unknown>): Error => {\n if ('error' in result && result.error) return result.error;\n\n if (result.state === 'aborted') {\n if (result.reason instanceof Error) return result.reason;\n\n return createAbortError(\n typeof result.reason === 'string' ? result.reason : 'The poll was stopped.',\n );\n }\n\n return new Error(`The poll ${result.state} after ${result.attempt} attempts.`);\n};\n\nexport const poller = <T, K extends PollKey = PollKey>({\n pollKey,\n signal,\n until,\n ...pollLoopOptions\n}: PollOptions<T, K>): Poller<T> => {\n const callerSignal = signal ?? neverAborts();\n const pollerSignal = new AbortController();\n const anySignal = AbortSignal.any([pollerSignal.signal, callerSignal]);\n\n // snapshoting\n const snapshot = createStore<PollSnapshot>({\n pollKey: pollKey ?? [],\n state: 'idle',\n attempt: 0,\n elapsed: 0,\n last: null,\n });\n const updateSnapshot = (next: Partial<PollSnapshot>) =>\n snapshot.set({ ...snapshot.get(), ...next });\n\n const handleUntil = (context: PollTick<T, K> & { data: T }) => {\n updateSnapshot({ attempt: context.attempt, elapsed: context.elapsed, last: context.data });\n return until(context);\n };\n\n const start: PollerStartFn<T> = lazy(async () => {\n updateSnapshot({ state: 'polling' });\n const result = await pollLoop({\n ...pollLoopOptions,\n pollKey,\n until: handleUntil,\n signal: anySignal,\n });\n // The result knows what a tick cannot: attempts that failed, and the time the ending itself took.\n snapshot.set({\n pollKey: result.pollKey,\n state: result.state,\n attempt: result.attempt,\n elapsed: result.elapsed,\n last: result.last,\n });\n return result;\n });\n\n const stop: PollerStopFn = (reason) => pollerSignal.abort(reason);\n const subscribe: PollerSubscribeFn = (listener) =>\n snapshot.subscribe(() => listener(snapshot.get()));\n const debug: PollerDebugFn = snapshot.get;\n\n const unwrap: PollerUnwrapFn<T> = async (onFailure) => {\n const result = await start();\n if (result.state === 'done') return result.data;\n throw onFailure?.(result) ?? failureOf(result);\n };\n\n const controls = {\n stop,\n subscribe,\n debug,\n start,\n };\n\n emitter.emit(controls);\n\n return {\n get state() {\n return snapshot.get().state;\n },\n unwrap,\n ...controls,\n };\n};\n\nexport const poll = <T, K extends PollKey = PollKey>(options: PollOptions<T, K>): PollTask<T> => {\n const p = poller(options);\n\n return Object.assign(p.start(), {\n unwrap: p.unwrap,\n stop: p.stop,\n subscribe: p.subscribe,\n debug: p.debug,\n });\n};\n","import type { QueryJobStatus } from '../clients/queryService/types';\nimport type { QueueJobStatus } from '../clients/queue/types';\nimport type { StorageJobStatus } from '../clients/storage/jobs/types';\n\n/**\n * How one service's status vocabulary splits by what the job is doing. Declared per service, then\n * indexed into sets by `forService`.\n *\n * - The three groups are disjoint and together cover the vocabulary. `terminal` is not declared: a\n * job is terminal exactly when it has succeeded or failed.\n * - Annotating the constant is what validates its members: `QueueJobStatus` and `QueryJobStatus` are\n * generated, so a spec that renames one fails the build here instead of silently dropping it from\n * a group and leaving a poll loop to run to `maxAttempts`.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/**\n * A service's statuses as named constants — `SUCCESS: 'success'`.\n *\n * Keyed off the status type, so there is an entry per status and no more, and a spec that renames a\n * status renames the key with it.\n */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// `StorageJobStatus` in `connection`, whose `isDoneStatus` is the `success`/`error` pair.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running, not terminal: the job is still being killed and keeps reporting until\n * `terminated`.\n * - `warning` is a success — the run produced its output and only added a non-fatal notice, which is\n * why a flow keeps going past it. The backend declares no such split (`STATUSES_FINISHED` is its\n * only grouping), so dividing it into success and failure is ours.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// `JobState` in `go-monorepo` (`services/query/internal/repository/models`). `canceled` with one\n// `l` — queryService's spelling, unlike the other two services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's view of its statuses: a predicate per question, with the data a level down.\n *\n * - `isSuccessful` / `isFailed` are `false` while the job is still running, so read them together\n * with `isTerminal` where that distinction matters.\n * - `isKnown` narrows an untyped string — one read out of an MCP tool result or a URL, say. A status\n * that arrived on a typed response needs no guard. Its `Set<string>` is what takes the wider type\n * the caller has, so the guard needs no assertion of its own.\n * - `describe` answers every question about one status at once, for a caller that needs more than\n * one of them.\n * - `statuses.terminal` is `successful` plus `failed` — the group a poll loop stops on.\n * - `named` is asserted, not proven: `Object.fromEntries` types its result as an index signature,\n * and no expression convinces TypeScript that uppercasing every status produces exactly\n * `StatusNames<Status>`. The alternative is writing all three maps out by hand, which is the\n * duplication this file exists to avoid.\n */\nconst forService = <Status extends string>(groups: StatusGroups<Status>) => {\n const all = [...groups.running, ...groups.successful, ...groups.failed];\n\n const running: ReadonlySet<Status> = new Set(groups.running);\n const successful: ReadonlySet<Status> = new Set(groups.successful);\n const failed: ReadonlySet<Status> = new Set(groups.failed);\n const terminal: ReadonlySet<Status> = new Set([...groups.successful, ...groups.failed]);\n const known: ReadonlySet<string> = new Set<string>(all);\n\n return {\n isRunning: (status: Status) => running.has(status),\n isTerminal: (status: Status) => terminal.has(status),\n isSuccessful: (status: Status) => successful.has(status),\n isFailed: (status: Status) => failed.has(status),\n isKnown: (value: string): value is Status => known.has(value),\n describe: (status: Status) => ({\n isRunning: running.has(status),\n isTerminal: terminal.has(status),\n isSuccessful: successful.has(status),\n isFailed: failed.has(status),\n }),\n statuses: { running, successful, failed, terminal },\n named: Object.fromEntries(\n all.map((status) => [status.toUpperCase(), status]),\n ) as StatusNames<Status>,\n };\n};\n\n/**\n * Job statuses per service: `jobStatus.queue.isFailed(status)` is the question about one job,\n * `jobStatus.queue.statuses.failed` the statuses behind it,\n * `jobStatus.queue.named.ERROR` one of them by name.\n *\n * One entry per service, never one over the union: the vocabularies overlap by label — `processing`\n * belongs to all three, `created` to queue and query — while which statuses exist and what each\n * implies differ per service. A shared entry would take another service's status and answer by its\n * rules.\n *\n * - `storage` and `queue` describe a job; `query` describes a query job, not its statements. A\n * statement has its own state, including a terminal `notExecuted` with no job-level equivalent.\n * - Spread a group where an array is wanted — an API `status` filter, or a UI list that mixes job\n * statuses with its own.\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n"],"mappings":";;AAAA,MAAa,oBAAoB,WAAoB,IAAI,aAAa,QAAQ,YAAY;;;ACE1F,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAO,iBAAiB,OAAO,MAAM,CAAC;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AgentClient.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\nconst votesResponseSchema = z.array(\n z.object({\n chatId: z.string(),\n messageId: z.string(),\n isUpvoted: z.boolean(),\n }),\n);\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\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 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 getToolsList,\n getSkillsList,\n listSandboxFiles,\n readSandboxFile,\n downloadSandboxFile,\n getSandboxGitBranch,\n chatStreamUrl,\n };\n};\n"],"mappings":";;;;;AAkBA,MAAM,sBAAsBA,IAAAA,EAAE,OAAO;CACnC,WAAWA,IAAAA,EAAE,OAAO;CACpB,oBAAoBA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CACxC,WAAWA,IAAAA,EAAE,OAAO;CACpB,WAAWA,IAAAA,EAAE,OAAO;AACtB,CAAC;AAED,MAAM,4BAA4BA,IAAAA,EAAE,KAAK;CAAC;CAAgB;CAAc;AAAS,CAAC;AAElF,MAAM,0BAA0BA,IAAAA,EAAE,OAAO;CACvC,WAAWA,IAAAA,EAAE,OAAO;CACpB,QAAQA,IAAAA,EAAE,OAAO;CACjB,oBAAoBA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CACxC,iBAAiBA,IAAAA,EAAE,OAAOA,IAAAA,EAAE,OAAO,GAA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;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kaiAgent-HDaFS9BR.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\nconst votesResponseSchema = z.array(\n z.object({\n chatId: z.string(),\n messageId: z.string(),\n isUpvoted: z.boolean(),\n }),\n);\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\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 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 getToolsList,\n getSkillsList,\n listSandboxFiles,\n readSandboxFile,\n downloadSandboxFile,\n getSandboxGitBranch,\n chatStreamUrl,\n };\n};\n"],"mappings":";;;;;AAkBA,MAAM,sBAAsB,EAAE,OAAO;CACnC,WAAW,EAAE,OAAO;CACpB,oBAAoB,EAAE,OAAO,CAAC,CAAC,SAAS;CACxC,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,OAAO;AACtB,CAAC;AAED,MAAM,4BAA4B,EAAE,KAAK;CAAC;CAAgB;CAAc;AAAS,CAAC;AAElF,MAAM,0BAA0B,EAAE,OAAO;CACvC,WAAW,EAAE,OAAO;CACpB,QAAQ,EAAE,OAAO;CACjB,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