@keboola/api-client 44.0.0 → 46.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/CHANGELOG.md +32 -0
- package/dist/ManagementSessionMintError-5FFyvBZi.js +36 -0
- package/dist/ManagementSessionMintError-5FFyvBZi.js.map +1 -0
- package/dist/ManagementSessionMintError-Bm8s6yDB.cjs +47 -0
- package/dist/ManagementSessionMintError-Bm8s6yDB.cjs.map +1 -0
- package/dist/ai/index.d.cts +2 -2
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/types.d.cts +1 -1
- package/dist/ai/types.d.ts +1 -1
- package/dist/{appLogs-BS6ViVGR.d.ts → appLogs-DGIctwbb.d.ts} +2 -2
- package/dist/{appLogs-C9YlJ2g8.d.cts → appLogs-Dl0v684o.d.cts} +2 -2
- package/dist/apps/index.d.cts +3 -3
- package/dist/apps/index.d.ts +3 -3
- package/dist/apps/types.d.cts +2 -2
- package/dist/apps/types.d.ts +2 -2
- package/dist/assets/index.d.cts +1 -1
- package/dist/assets/index.d.ts +1 -1
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/types.d.cts +1 -1
- package/dist/auth/types.d.ts +1 -1
- package/dist/{authClient-CBVAT3v9.d.cts → authClient-DSa5t2Ft.d.cts} +27 -33
- package/dist/{authClient-CRumc934.d.ts → authClient-ZiaKSKpp.d.ts} +27 -33
- package/dist/billing/index.d.cts +1 -1
- package/dist/billing/index.d.ts +1 -1
- package/dist/billing/types.d.cts +1 -1
- package/dist/billing/types.d.ts +1 -1
- package/dist/chat/index.d.cts +2 -2
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat/types.d.cts +1 -1
- package/dist/chat/types.d.ts +1 -1
- package/dist/dataScience/index.d.cts +2 -2
- package/dist/dataScience/index.d.ts +2 -2
- package/dist/dataScience/types.d.cts +2 -2
- package/dist/dataScience/types.d.ts +2 -2
- package/dist/developerPortal/index.d.cts +2 -2
- package/dist/developerPortal/index.d.ts +2 -2
- package/dist/developerPortal/types.d.cts +1 -1
- package/dist/developerPortal/types.d.ts +1 -1
- package/dist/domain/permissions/index.cjs +1 -1
- package/dist/domain/permissions/index.d.cts +2 -2
- package/dist/domain/permissions/index.d.ts +2 -2
- package/dist/domain/permissions/index.js +1 -1
- package/dist/editor/index.d.cts +2 -2
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/types.d.cts +1 -1
- package/dist/editor/types.d.ts +1 -1
- package/dist/encryption/index.d.cts +1 -1
- package/dist/encryption/index.d.ts +1 -1
- package/dist/encryption/types.d.cts +1 -1
- package/dist/encryption/types.d.ts +1 -1
- package/dist/import/index.d.cts +3 -3
- package/dist/import/index.d.ts +3 -3
- package/dist/{index-DzGmgUvQ.d.ts → index-BP3choXr.d.ts} +578 -526
- package/dist/{index-04pgr-EO.d.cts → index-BhDxP0x4.d.cts} +4 -4
- package/dist/{index-zyxZVJnd.d.ts → index-BnPYPXGQ.d.ts} +3 -3
- package/dist/{index-D9UsQOuT.d.cts → index-Bt43tKyu.d.cts} +5 -5
- package/dist/{index-BVhHt5lx.d.cts → index-BzhLY7el.d.cts} +15 -2
- package/dist/{index-CWPi7lBF.d.ts → index-CH5Sg3rk.d.ts} +6 -6
- package/dist/{index-Cvkrjh--.d.cts → index-CTKC-mwi.d.cts} +30 -4
- package/dist/{index-DkCXaYsn.d.cts → index-CiwWDu-q.d.cts} +3 -3
- package/dist/{index-DINB7vsV.d.cts → index-D-4TT5yW.d.cts} +4 -4
- package/dist/{index-Bf8dr2KQ.d.ts → index-DCAnnlcL.d.ts} +3 -3
- package/dist/{index-CA6QxbhZ.d.ts → index-DCxVLGHH.d.ts} +239 -236
- package/dist/{index-Dd40ojPr.d.cts → index-DQwjlSJi.d.cts} +6 -6
- package/dist/{index-BCgmwncs.d.ts → index-DRaVzOLM.d.ts} +5 -5
- package/dist/{index-BMiZx-4_.d.cts → index-DS6O4UDB.d.cts} +4 -4
- package/dist/{index-B72LTF-k.d.ts → index-DWFxcmVD.d.ts} +4 -4
- package/dist/{index-CGCXR_6Q.d.ts → index-DXcTukgn.d.ts} +4 -4
- package/dist/{index-DkvrbR2i.d.cts → index-GVxpBH6j.d.cts} +239 -236
- package/dist/{index-BgR5zcjJ.d.ts → index-PyTPrtaL.d.ts} +15 -2
- package/dist/{index-R-w0Zncz.d.ts → index-se5ee8U1.d.ts} +4 -4
- package/dist/{index-DZcQUZaO.d.cts → index-syAYY5LC.d.cts} +578 -526
- package/dist/{index-BHWTa4YN.d.cts → index-x8ET_BTN.d.cts} +3 -3
- package/dist/{index-CX8GAP2g.d.ts → index-yJ0HrxY6.d.ts} +30 -4
- package/dist/index.cjs +36 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +33 -9
- package/dist/index.js.map +1 -1
- package/dist/{jobStatus-CcNlIy5R.cjs → jobStatus-B0E-MZ9I.cjs} +2 -2
- package/dist/{jobStatus-CcNlIy5R.cjs.map → jobStatus-B0E-MZ9I.cjs.map} +1 -1
- package/dist/{jobStatus-CDp4r5JQ.js → jobStatus-BJdbZ72V.js} +2 -2
- package/dist/{jobStatus-CDp4r5JQ.js.map → jobStatus-BJdbZ72V.js.map} +1 -1
- package/dist/kaiAgent/index.d.cts +2 -2
- package/dist/kaiAgent/index.d.ts +2 -2
- package/dist/kaiAgent/types.d.cts +1 -1
- package/dist/kaiAgent/types.d.ts +1 -1
- package/dist/management/index.cjs +2 -1
- package/dist/management/index.d.cts +2 -2
- package/dist/management/index.d.ts +2 -2
- package/dist/management/index.js +2 -2
- package/dist/management/types.d.cts +1 -1
- package/dist/management/types.d.ts +1 -1
- package/dist/{management-C5lf9nsU.cjs → management-0cWVLHei.cjs} +25 -6
- package/dist/management-0cWVLHei.cjs.map +1 -0
- package/dist/{management-WAtKH6Tu.js → management-eg4Ig-Cx.js} +18 -5
- package/dist/management-eg4Ig-Cx.js.map +1 -0
- package/dist/metastore/index.d.cts +1 -1
- package/dist/metastore/index.d.ts +1 -1
- package/dist/metastore/types.d.cts +1 -1
- package/dist/metastore/types.d.ts +1 -1
- package/dist/microsoftGraph/index.d.cts +3 -3
- package/dist/microsoftGraph/index.d.ts +3 -3
- package/dist/microsoftGraph/types.d.cts +2 -2
- package/dist/microsoftGraph/types.d.ts +2 -2
- package/dist/notifications/index.d.cts +2 -2
- package/dist/notifications/index.d.ts +2 -2
- package/dist/notifications/types.d.cts +1 -1
- package/dist/notifications/types.d.ts +1 -1
- package/dist/oauth/index.d.cts +2 -2
- package/dist/oauth/index.d.ts +2 -2
- package/dist/oauth/types.d.cts +1 -1
- package/dist/oauth/types.d.ts +1 -1
- package/dist/omnisearch/index.d.cts +2 -2
- package/dist/omnisearch/index.d.ts +2 -2
- package/dist/omnisearch/types.d.cts +1 -1
- package/dist/omnisearch/types.d.ts +1 -1
- package/dist/{project-B8wtlstY.d.cts → project-BN7YRWFS.d.cts} +8 -2
- package/dist/{project-DWwZv66D.js → project-BXLFrWJ6.js} +7 -1
- package/dist/project-BXLFrWJ6.js.map +1 -0
- package/dist/{project-BCc3mpAy.d.ts → project-BpWTnoQ_.d.ts} +8 -2
- package/dist/{project-BvFi19K_.cjs → project-CpgplgCr.cjs} +7 -1
- package/dist/project-CpgplgCr.cjs.map +1 -0
- 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-OgdbrBjA.js → queryService-Blfz59Ms.js} +2 -2
- package/dist/{queryService-OgdbrBjA.js.map → queryService-Blfz59Ms.js.map} +1 -1
- package/dist/{queryService-e2ql5eev.cjs → queryService-RlNYw7LG.cjs} +2 -2
- package/dist/{queryService-e2ql5eev.cjs.map → queryService-RlNYw7LG.cjs.map} +1 -1
- package/dist/queue/index.cjs +1 -1
- package/dist/queue/index.d.cts +9 -3
- package/dist/queue/index.d.ts +9 -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-DGoMbK1X.cjs → queue-BrgRdtOr.cjs} +2 -2
- package/dist/{queue-DGoMbK1X.cjs.map → queue-BrgRdtOr.cjs.map} +1 -1
- package/dist/{queue-BZwZuZZx.js → queue-CNvR-M23.js} +2 -2
- package/dist/{queue-BZwZuZZx.js.map → queue-CNvR-M23.js.map} +1 -1
- package/dist/scheduler/index.d.cts +2 -2
- package/dist/scheduler/index.d.ts +2 -2
- package/dist/scheduler/types.d.cts +1 -1
- package/dist/scheduler/types.d.ts +1 -1
- package/dist/{schema-DJa9WBjR.d.cts → schema-BUyMwQnM.d.cts} +7 -1
- package/dist/{schema-DJa9WBjR.d.ts → schema-BUyMwQnM.d.ts} +7 -1
- package/dist/sdk/configurations/index.d.cts +4 -4
- package/dist/sdk/configurations/index.d.ts +4 -4
- package/dist/sdk/developerPortal/index.d.cts +29 -3
- package/dist/sdk/developerPortal/index.d.ts +29 -3
- package/dist/sdk/kaiMemory/index.d.cts +1 -1
- package/dist/sdk/kaiMemory/index.d.ts +1 -1
- package/dist/sdk/kaiMemory/types.d.cts +1 -1
- package/dist/sdk/kaiMemory/types.d.ts +1 -1
- 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 +1 -2
- package/dist/sdk/semanticLayer/index.d.cts +3 -20
- package/dist/sdk/semanticLayer/index.d.ts +3 -20
- package/dist/sdk/semanticLayer/index.js +2 -2
- 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/{semanticLayer-Cz22bIjd.cjs → semanticLayer-7BejcMj_.cjs} +10 -84
- package/dist/semanticLayer-7BejcMj_.cjs.map +1 -0
- package/dist/{semanticLayer-JSE51K68.js → semanticLayer-DvjS_nzo.js} +11 -79
- package/dist/semanticLayer-DvjS_nzo.js.map +1 -0
- package/dist/status/index.d.cts +1 -1
- package/dist/status/index.d.ts +1 -1
- package/dist/storage/index.cjs +4 -3
- package/dist/storage/index.d.cts +3 -3
- package/dist/storage/index.d.ts +3 -3
- package/dist/storage/index.js +3 -3
- package/dist/storage/types.d.cts +2 -2
- package/dist/storage/types.d.ts +2 -2
- package/dist/{storage-B4AnXas_.cjs → storage-76Sf_z_H.cjs} +2 -2
- package/dist/{storage-B4AnXas_.cjs.map → storage-76Sf_z_H.cjs.map} +1 -1
- package/dist/{storage-CsdA47AL.js → storage-RkNaOFJ-.js} +2 -2
- package/dist/{storage-CsdA47AL.js.map → storage-RkNaOFJ-.js.map} +1 -1
- package/dist/stream/index.d.cts +2 -2
- package/dist/stream/index.d.ts +2 -2
- package/dist/stream/types.d.cts +1 -1
- package/dist/stream/types.d.ts +1 -1
- package/dist/syncActions/index.d.cts +2 -2
- package/dist/syncActions/index.d.ts +2 -2
- package/dist/syncActions/types.d.cts +1 -1
- package/dist/syncActions/types.d.ts +1 -1
- package/dist/telemetry/index.d.cts +2 -2
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/types.d.cts +1 -1
- package/dist/telemetry/types.d.ts +1 -1
- package/dist/{types-DgPt4LY_.d.cts → types--owScV0r.d.cts} +183 -77
- package/dist/{types-CLHaZv9f.d.cts → types-1B3ioN33.d.cts} +3 -3
- package/dist/{types-CAAgCRmE.d.cts → types-5HdT1rSH.d.cts} +13 -2
- package/dist/{types-DaMmgW-O.d.ts → types-B1GN_I06.d.ts} +2 -2
- package/dist/{types-CoJVrRAD.d.ts → types-B5kkD7h4.d.cts} +2 -2
- package/dist/{types-D9axmt5o.d.cts → types-BE7mRarT.d.ts} +8 -2
- package/dist/{types-CcYxlqtB.d.cts → types-BGICH80a.d.cts} +2 -2
- package/dist/{types-BaSlU0uo.d.ts → types-BHxsCu0f.d.ts} +2 -2
- package/dist/{types-CV7jmgtX.d.ts → types-BMWeCO5M.d.ts} +3 -3
- package/dist/{types-CGm2fQKK.d.cts → types-BRvs3fXN.d.cts} +64 -5
- package/dist/{types-CwZgZqrA.d.ts → types-BTqxM-IN.d.ts} +13 -2
- package/dist/{types-DxN2siRW.d.ts → types-BjIuVrAZ.d.ts} +3 -3
- package/dist/{types-DoZtE9tz.d.cts → types-BksK2Eo0.d.cts} +2 -2
- package/dist/{types-DicSaNwq.d.ts → types-BoNqe_Lz.d.ts} +2 -2
- package/dist/{types-CAp1VexS.d.ts → types-Br04cEri.d.ts} +16 -4
- package/dist/{types-CN6huo55.d.ts → types-BtII5RSD.d.ts} +183 -77
- package/dist/types-Btb8r9iw.d.ts +1467 -0
- package/dist/{types-B2w2TtSA.d.ts → types-BuKviWct.d.ts} +2 -2
- package/dist/{types-04GTqleJ.d.cts → types-C05ALlV6.d.cts} +3 -3
- package/dist/{types-DzV6LaZq.d.ts → types-C4yryy-R.d.ts} +132 -5
- package/dist/{types-DyArI_Jq.d.cts → types-C8oZX0oP.d.cts} +4 -8
- package/dist/{types-BhEx9iRx.d.ts → types-CESP1ONj.d.ts} +1364 -1316
- package/dist/{types-ByLH46Dt.d.cts → types-CFurl1xe.d.cts} +2 -2
- package/dist/{types-DUMal2E-.d.cts → types-CGhu0tID.d.cts} +30 -3
- package/dist/{types-QSchmyvO.d.ts → types-CaBhH99H.d.ts} +3 -3
- package/dist/{types-D1A4mAG0.d.cts → types-CclheyE7.d.cts} +3 -3
- package/dist/{types-DrvKfXXd.d.cts → types-CoQET4Ep.d.ts} +2 -2
- package/dist/{types-BiEh5c_t.d.cts → types-Csmy6qFk.d.cts} +132 -5
- package/dist/{types-CgBzm1YR.d.cts → types-CyO8qCKl.d.cts} +2 -2
- package/dist/{types-DlQw6FCi.d.ts → types-DDjp9lXD.d.ts} +2 -2
- package/dist/{types-CBPKpLTf.d.cts → types-DGu-wPPm.d.cts} +169 -2
- package/dist/{types-BgHtMe8s.d.cts → types-DHdXufVf.d.cts} +3 -3
- package/dist/{types-BPy5Ozee.d.cts → types-DMWfdZ5C.d.cts} +2 -2
- package/dist/{types-WZBztugL.d.ts → types-DQauEri3.d.ts} +2 -2
- package/dist/{types-BZDV8DZk.d.ts → types-DSv1XS7s.d.ts} +11 -6
- package/dist/{types-YHUEArkR.d.cts → types-DUDQg4ry.d.cts} +2 -2
- package/dist/{types-CigD_EF5.d.ts → types-DiE081mn.d.ts} +4 -8
- package/dist/{types-CZJlLCbA.d.ts → types-Dvysi2Eo.d.ts} +2 -2
- package/dist/{types-sV9OaqTI.d.cts → types-GaOcVZ3d.d.cts} +1364 -1316
- package/dist/{types-Bydx6ga_.d.cts → types-LxDyOfdY.d.cts} +2 -2
- package/dist/{types-D8pGSkRe.d.ts → types-M9vU_ONp.d.ts} +3 -3
- package/dist/{types-CfwqVkEA.d.ts → types-Nwq1QtYe.d.ts} +2 -2
- package/dist/{types-DwVSj-Da.d.ts → types-P_61P9Nd.d.ts} +30 -3
- package/dist/{types-pvQzbgNE.d.cts → types-QroFANIW.d.cts} +11 -6
- package/dist/{types-Fs4a3mVs.d.ts → types-UI2aZ74n.d.ts} +64 -5
- package/dist/{types-Dd31Lw4S.d.cts → types-XHNJRi3-.d.cts} +2 -2
- package/dist/{types-BBUZ9EHs.d.ts → types-YdE2VJzw.d.cts} +8 -2
- package/dist/{types-DazRtukc.d.ts → types-fAqPUl-a.d.ts} +521 -270
- package/dist/{types-c_bsDkV6.d.cts → types-ggpJFEWZ.d.cts} +16 -4
- package/dist/{types-CaOtNjSZ.d.ts → types-j30rKMe6.d.ts} +2 -2
- package/dist/{types-ePSqbXRr.d.cts → types-q5lgElyc.d.cts} +2 -2
- package/dist/{types-AYX7VtS6.d.ts → types-qGMVZGSB.d.ts} +169 -2
- package/dist/{types-D3wcs4tp.d.ts → types-qWA5iU0j.d.ts} +2 -2
- package/dist/{types-DVt0qlzI.d.cts → types-sI3K5t3w.d.cts} +521 -270
- package/dist/types-sg2xnYlr.d.cts +1467 -0
- package/dist/{types-B8N_k79M.d.cts → types-tJLoKlMX.d.cts} +2 -2
- package/dist/vault/index.d.cts +1 -1
- package/dist/vault/index.d.ts +1 -1
- package/dist/vault/types.d.cts +1 -1
- package/dist/vault/types.d.ts +1 -1
- package/package.json +1 -1
- package/surface/auth.md +19 -19
- package/surface/kaiAgent.md +1 -1
- package/surface/management.md +41 -41
- package/surface/queue.md +7 -7
- package/surface/storage.md +21 -21
- package/dist/ManagementClientAuthError-BcPYxAWZ.js +0 -16
- package/dist/ManagementClientAuthError-BcPYxAWZ.js.map +0 -1
- package/dist/ManagementClientAuthError-DHuykEPF.cjs +0 -21
- package/dist/ManagementClientAuthError-DHuykEPF.cjs.map +0 -1
- package/dist/management-C5lf9nsU.cjs.map +0 -1
- package/dist/management-WAtKH6Tu.js.map +0 -1
- package/dist/project-BvFi19K_.cjs.map +0 -1
- package/dist/project-DWwZv66D.js.map +0 -1
- package/dist/semanticLayer-Cz22bIjd.cjs.map +0 -1
- package/dist/semanticLayer-JSE51K68.js.map +0 -1
- package/dist/types-BhOUS9j1.d.cts +0 -749
- package/dist/types-gcAb6olM.d.ts +0 -749
|
@@ -331,7 +331,7 @@ const STORAGE = {
|
|
|
331
331
|
* Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.
|
|
332
332
|
*
|
|
333
333
|
* - `terminating` is running until `terminated`.
|
|
334
|
-
* - `
|
|
334
|
+
* - The split mirrors the job's `isSuccess`; with a job in hand, read `job.isSuccess` instead.
|
|
335
335
|
*/
|
|
336
336
|
const QUEUE = {
|
|
337
337
|
running: [
|
|
@@ -474,4 +474,4 @@ Object.defineProperty(exports, "poller", {
|
|
|
474
474
|
}
|
|
475
475
|
});
|
|
476
476
|
|
|
477
|
-
//# sourceMappingURL=jobStatus-
|
|
477
|
+
//# sourceMappingURL=jobStatus-B0E-MZ9I.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobStatus-CcNlIy5R.cjs","names":["createAbortError","createEmitter","createAbortError","createStore"],"sources":["../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":["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 * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\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 Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<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 = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\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 '../../store';\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 * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - `warning` is a success; the backend has no success/failure split.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\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, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n"],"mappings":";;;AAEA,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAOA,yBAAAA,iBAAiB,OAAO,MAAM,CAAC;CAElE,MAAM,gBAAgB;EACpB,aAAa,SAAS;EACtB,OAAOA,yBAAAA,iBAAiB,QA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WAAW,WAAmB,OAAO,IAAI,MAAM;EAC/C,UAAU,UAAmC,MAAM,IAAI,KAAK;EAC5D,WAAW,YAAoB;GAC7B,WAAW,QAAQ,IAAI,MAAM;GAC7B,YAAY,SAAS,IAAI,MAAM;GAC/B,cAAc,WAAW,IAAI,MAAM;GACnC,UAAU,OAAO,IAAI,MAAM;EAC7B;EACA,UAAU;GAAE;GAAS;GAAY;GAAQ;EAAS;EAClD,OAAO,OAAO,YACZ,IAAI,KAAK,WAAW,CAAC,OAAO,YAAY,GAAG,MAAM,CAAC,CACpD;CACF;AACF;;;;;;;AAQA,MAAa,YAAY;CACvB,SAAS,WAAW,OAAO;CAC3B,OAAO,WAAW,KAAK;CACvB,OAAO,WAAW,KAAK;AACzB"}
|
|
1
|
+
{"version":3,"file":"jobStatus-B0E-MZ9I.cjs","names":["createAbortError","createEmitter","createAbortError","createStore"],"sources":["../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":["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 * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\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 Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<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 = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\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 '../../store';\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 * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - The split mirrors the job's `isSuccess`; with a job in hand, read `job.isSuccess` instead.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\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, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobSt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AI,IAAI,OAAO,MAAM;CACzD,MAAM,2BAAgC,IAAI,IAAI,CAAC,GAAG,OAAO,YAAY,GAAG,OAAO,MAAM,CAAC;CACtF,MAAM,QAA6B,IAAI,IAAY,GAAG;CAEtD,OAAO;EACL,YAAY,WAAmB,QAAQ,IAAI,MAAM;EACjD,aAAa,WAAmB,SAAS,IAAI,MAAM;EACnD,eAAe,WAAmB,WAAW,IAAI,MAAM;EACvD,WAAW,WAAmB,OAAO,IAAI,MAAM;EAC/C,UAAU,UAAmC,MAAM,IAAI,KAAK;EAC5D,WAAW,YAAoB;GAC7B,WAAW,QAAQ,IAAI,MAAM;GAC7B,YAAY,SAAS,IAAI,MAAM;GAC/B,cAAc,WAAW,IAAI,MAAM;GACnC,UAAU,OAAO,IAAI,MAAM;EAC7B;EACA,UAAU;GAAE;GAAS;GAAY;GAAQ;EAAS;EAClD,OAAO,OAAO,YACZ,IAAI,KAAK,WAAW,CAAC,OAAO,YAAY,GAAG,MAAM,CAAC,CACpD;CACF;AACF;;;;;;;AAQA,MAAa,YAAY;CACvB,SAAS,WAAW,OAAO;CAC3B,OAAO,WAAW,KAAK;CACvB,OAAO,WAAW,KAAK;AACzB"}
|
|
@@ -331,7 +331,7 @@ const STORAGE = {
|
|
|
331
331
|
* Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.
|
|
332
332
|
*
|
|
333
333
|
* - `terminating` is running until `terminated`.
|
|
334
|
-
* - `
|
|
334
|
+
* - The split mirrors the job's `isSuccess`; with a job in hand, read `job.isSuccess` instead.
|
|
335
335
|
*/
|
|
336
336
|
const QUEUE = {
|
|
337
337
|
running: [
|
|
@@ -409,4 +409,4 @@ const jobStatus = {
|
|
|
409
409
|
//#endregion
|
|
410
410
|
export { poller as a, Result as c, delay as d, poll as i, asError as l, emitter as n, clamp as o, failureOf as r, finiteOr as s, jobStatus as t, lazy as u };
|
|
411
411
|
|
|
412
|
-
//# sourceMappingURL=jobStatus-
|
|
412
|
+
//# sourceMappingURL=jobStatus-BJdbZ72V.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jobStatus-CDp4r5JQ.js","names":[],"sources":["../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":["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 * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\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 Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<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 = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\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 '../../store';\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 * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - `warning` is a success; the backend has no success/failure split.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\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, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n"],"mappings":";;;AAEA,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAO,iBAAiB,OAAO,MAAM,CAAC;CAElE,MAAM,gBAAgB;EACpB,aAAa,SAAS;EACtB,OAAO,iBAAiB,QAAQ,MAAM,CAAC;CACzC;CAKA,MAAM,YAAY,iBAAiB;EACjC,QAAQ,oBAAoB,SAAS,OAAO;EAC5C,QAAQ;CACV,GAAG,OAAO;CAEV,QAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;AAC3D,CAAC;;;;;;;;;ACZH,MAAa,QAAW,SAAiD;CACv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;GAAQ;EAAS;EAClD,OAAO,OAAO,YACZ,IAAI,KAAK,WAAW,CAAC,OAAO,YAAY,GAAG,MAAM,CAAC,CACpD;CACF;AACF;;;;;;;AAQA,MAAa,YAAY;CACvB,SAAS,WAAW,OAAO;CAC3B,OAAO,WAAW,KAAK;CACvB,OAAO,WAAW,KAAK;AACzB"}
|
|
1
|
+
{"version":3,"file":"jobStatus-BJdbZ72V.js","names":[],"sources":["../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":["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 * Runs `task` once and replays its promise to every later caller.\n *\n * - A rejection is not cached: the next call retries, so a transient failure never sticks.\n * - Callers that joined the failed run reject with its error.\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 Success<T> = { success: true; data: T };\nexport type Failure<E extends Error> = { success: false; error: E };\nexport type Result<T, E extends Error = Error> = Success<T> | Failure<E>;\n\n// A task that returns a promise is a type error: the wrapper would report success before it\n// settles, and the rejection would go unhandled. Use the `*Async` sibling.\ntype NotPromise<T> = T extends PromiseLike<unknown> ? never : T;\n\nexport const asError = (thrown: unknown) =>\n thrown instanceof Error ? thrown : new Error(String(thrown), { cause: thrown });\n\nconst success = <T>(data: T): Result<T, never> => ({ success: true, data });\nconst failure = <E extends Error>(error: E): Result<never, E> => ({ success: false, error });\nconst isSuccess = <T, E extends Error>(result: Result<T, E>): result is Success<T> =>\n result.success;\nconst isFailure = <T, E extends Error>(result: Result<T, E>): result is Failure<E> =>\n !result.success;\n\nconst map = <T, E extends Error, U>(result: Result<T, E>, fn: (data: T) => U): Result<U, E> =>\n result.success ? success(fn(result.data)) : result;\n\nconst mapError = <T, E extends Error, F extends Error>(\n result: Result<T, E>,\n fn: (error: E) => F,\n): Result<T, F> => (result.success ? result : failure(fn(result.error)));\n\nconst andThen = <T, E extends Error, U, F extends Error>(\n result: Result<T, E>,\n fn: (data: T) => Result<U, F>,\n): Result<U, E | F> => (result.success ? fn(result.data) : result);\n\nconst match = <T, E extends Error, R>(\n result: Result<T, E>,\n onSuccess: (data: T) => R,\n onFailure: (error: E) => R,\n): R => (result.success ? onSuccess(result.data) : onFailure(result.error));\n\n// A side effect on a success; the result itself passes through untouched, same instance.\nconst tap = <T, E extends Error>(result: Result<T, E>, fn: (data: T) => void): Result<T, E> => {\n if (result.success) fn(result.data);\n return result;\n};\n\nconst unwrap = <T, E extends Error>(result: Result<T, E>): T => {\n if (result.success) return result.data;\n throw result.error;\n};\n\nconst unwrapOr = <T, E extends Error, U>(result: Result<T, E>, fallback: U): T | U =>\n result.success ? result.data : fallback;\n\nconst tryCatch = <T>(task: () => NotPromise<T>): Result<T> => {\n try {\n return success(task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst tryCatchAsync = async <T>(task: () => T | PromiseLike<T>): Promise<Result<T>> => {\n try {\n return success(await task());\n } catch (thrown) {\n return failure(asError(thrown));\n }\n};\n\nconst fromThrowable =\n <A extends unknown[], R>(fn: (...args: A) => NotPromise<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 = {\n success,\n failure,\n isSuccess,\n isFailure,\n map,\n mapError,\n andThen,\n match,\n tap,\n unwrap,\n unwrapOr,\n tryCatch,\n tryCatchAsync,\n fromThrowable,\n fromThrowableAsync,\n};\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 '../../store';\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 * One service's statuses split by what the job is doing.\n *\n * - Groups are disjoint and cover the vocabulary; terminal = successful + failed.\n * - The annotation makes a renamed generated status fail the build here.\n */\ntype StatusGroups<Status extends string> = {\n running: readonly Status[];\n successful: readonly Status[];\n failed: readonly Status[];\n};\n\n/** A service's statuses as named constants — `SUCCESS: 'success'`. */\ntype StatusNames<Status extends string> = { [K in Status as Uppercase<K>]: K };\n\n// Mirrors `StorageJobStatus` in `connection`.\nconst STORAGE: StatusGroups<StorageJobStatus> = {\n running: ['waiting', 'processing'],\n successful: ['success'],\n failed: ['error'],\n};\n\n/**\n * Mirrors `PlainJobInterface` in `job-queue-internal-api-php-client`.\n *\n * - `terminating` is running until `terminated`.\n * - The split mirrors the job's `isSuccess`; with a job in hand, read `job.isSuccess` instead.\n */\nconst QUEUE: StatusGroups<QueueJobStatus> = {\n running: ['created', 'waiting', 'processing', 'terminating'],\n successful: ['success', 'warning'],\n failed: ['error', 'cancelled', 'terminated'],\n};\n\n// Mirrors `JobState` in `go-monorepo` (`services/query/internal/repository/models`).\n// `canceled` with one `l`, unlike the other services.\nconst QUERY: StatusGroups<QueryJobStatus> = {\n running: ['created', 'enqueued', 'processing'],\n successful: ['completed'],\n failed: ['failed', 'canceled'],\n};\n\n/**\n * One service's status predicates, sets and named constants.\n *\n * - `isSuccessful` / `isFailed` are `false` while running.\n * - `isKnown` narrows an untyped string.\n * - `named` is asserted: `Object.fromEntries` can't prove the key mapping.\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, e.g. `jobStatus.queue.isFailed(status)`.\n *\n * - Never merge services: labels overlap but their meaning differs.\n * - `query` covers the query job, not its statements (which have `notExecuted`).\n */\nexport const jobStatus = {\n storage: forService(STORAGE),\n queue: forService(QUEUE),\n query: forService(QUERY),\n};\n"],"mappings":";;;AAEA,MAAa,SAAS,SAAiB,WACrC,IAAI,SAAe,SAAS,WAAW;CACrC,IAAI,QAAQ,SAAS,OAAO,OAAO,iBAAiB,OAAO,MAAM,CAAC;CAElE,MAAM,gBAAgB;EACpB,aAAa,SAAS;EACtB,OAAO,iBAAiB,QAAQ,MAAM,CAAC;CACzC;CAKA,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M,IAAI,KAAK;EAC5D,WAAW,YAAoB;GAC7B,WAAW,QAAQ,IAAI,MAAM;GAC7B,YAAY,SAAS,IAAI,MAAM;GAC/B,cAAc,WAAW,IAAI,MAAM;GACnC,UAAU,OAAO,IAAI,MAAM;EAC7B;EACA,UAAU;GAAE;GAAS;GAAY;GAAQ;EAAS;EAClD,OAAO,OAAO,YACZ,IAAI,KAAK,WAAW,CAAC,OAAO,YAAY,GAAG,MAAM,CAAC,CACpD;CACF;AACF;;;;;;;AAQA,MAAa,YAAY;CACvB,SAAS,WAAW,OAAO;CAC3B,OAAO,WAAW,KAAK;CACvB,OAAO,WAAW,KAAK;AACzB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { h as ProjectToolPolicyValue, m as ProjectToolPolicy } from "../types-
|
|
2
|
-
import { a as UserMemory, i as UserAgentSettings, o as createKaiAgentClient, t as AgentSettings } from "../index-
|
|
1
|
+
import { h as ProjectToolPolicyValue, m as ProjectToolPolicy } from "../types-CFurl1xe.cjs";
|
|
2
|
+
import { a as UserMemory, i as UserAgentSettings, o as createKaiAgentClient, t as AgentSettings } from "../index-BhDxP0x4.cjs";
|
|
3
3
|
export { type AgentSettings, type ProjectToolPolicy, type ProjectToolPolicyValue, type UserAgentSettings, type UserMemory, createKaiAgentClient };
|
package/dist/kaiAgent/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { h as ProjectToolPolicyValue, m as ProjectToolPolicy } from "../types-
|
|
2
|
-
import { a as UserMemory, i as UserAgentSettings, o as createKaiAgentClient, t as AgentSettings } from "../index-
|
|
1
|
+
import { h as ProjectToolPolicyValue, m as ProjectToolPolicy } from "../types-DDjp9lXD.js";
|
|
2
|
+
import { a as UserMemory, i as UserAgentSettings, o as createKaiAgentClient, t as AgentSettings } from "../index-se5ee8U1.js";
|
|
3
3
|
export { type AgentSettings, type ProjectToolPolicy, type ProjectToolPolicyValue, type UserAgentSettings, type UserMemory, createKaiAgentClient };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ChatWithMessages, c as GetChatPath, d as PrepareChatRequest, f as UsageResponse, i as ChatRequest, l as GetHistoryQuery, n as ArtifactListResponse, o as GetArtifactPath, p as VoteRequest, r as ArtifactResponse, s as GetArtifactsQuery, t as ApprovalBody, u as GetVotesQuery } from "../types-
|
|
1
|
+
import { a as ChatWithMessages, c as GetChatPath, d as PrepareChatRequest, f as UsageResponse, i as ChatRequest, l as GetHistoryQuery, n as ArtifactListResponse, o as GetArtifactPath, p as VoteRequest, r as ArtifactResponse, s as GetArtifactsQuery, t as ApprovalBody, u as GetVotesQuery } from "../types-DGu-wPPm.cjs";
|
|
2
2
|
export { ApprovalBody, ArtifactListResponse, ArtifactResponse, ChatRequest, ChatWithMessages, GetArtifactPath, GetArtifactsQuery, GetChatPath, GetHistoryQuery, GetVotesQuery, PrepareChatRequest, UsageResponse, VoteRequest };
|
package/dist/kaiAgent/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ChatWithMessages, c as GetChatPath, d as PrepareChatRequest, f as UsageResponse, i as ChatRequest, l as GetHistoryQuery, n as ArtifactListResponse, o as GetArtifactPath, p as VoteRequest, r as ArtifactResponse, s as GetArtifactsQuery, t as ApprovalBody, u as GetVotesQuery } from "../types-
|
|
1
|
+
import { a as ChatWithMessages, c as GetChatPath, d as PrepareChatRequest, f as UsageResponse, i as ChatRequest, l as GetHistoryQuery, n as ArtifactListResponse, o as GetArtifactPath, p as VoteRequest, r as ArtifactResponse, s as GetArtifactsQuery, t as ApprovalBody, u as GetVotesQuery } from "../types-qGMVZGSB.js";
|
|
2
2
|
export { ApprovalBody, ArtifactListResponse, ArtifactResponse, ChatRequest, ChatWithMessages, GetArtifactPath, GetArtifactsQuery, GetChatPath, GetHistoryQuery, GetVotesQuery, PrepareChatRequest, UsageResponse, VoteRequest };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_management = require("../management-
|
|
2
|
+
const require_management = require("../management-0cWVLHei.cjs");
|
|
3
3
|
exports.createManagementClient = require_management.createManagementClient;
|
|
4
4
|
exports.isManagementClientAuthError = require_management.isManagementClientAuthError;
|
|
5
|
+
exports.isManagementSessionMintError = require_management.isManagementSessionMintError;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { AuthStrategy, ManagementGenericFetchClient, ManagementOpenApiFetchClient, createManagementClient, isManagementClientAuthError };
|
|
1
|
+
import { a as ManagementOpenApiFetchClient, i as ManagementGenericFetchClient, n as isManagementSessionMintError, o as createManagementClient, r as AuthStrategy, t as isManagementClientAuthError } from "../index-GVxpBH6j.cjs";
|
|
2
|
+
export { AuthStrategy, ManagementGenericFetchClient, ManagementOpenApiFetchClient, createManagementClient, isManagementClientAuthError, isManagementSessionMintError };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { AuthStrategy, ManagementGenericFetchClient, ManagementOpenApiFetchClient, createManagementClient, isManagementClientAuthError };
|
|
1
|
+
import { a as ManagementOpenApiFetchClient, i as ManagementGenericFetchClient, n as isManagementSessionMintError, o as createManagementClient, r as AuthStrategy, t as isManagementClientAuthError } from "../index-DCxVLGHH.js";
|
|
2
|
+
export { AuthStrategy, ManagementGenericFetchClient, ManagementOpenApiFetchClient, createManagementClient, isManagementClientAuthError, isManagementSessionMintError };
|
package/dist/management/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as isManagementClientAuthError, t as createManagementClient } from "../management-
|
|
2
|
-
export { createManagementClient, isManagementClientAuthError };
|
|
1
|
+
import { n as isManagementClientAuthError, r as isManagementSessionMintError, t as createManagementClient } from "../management-eg4Ig-Cx.js";
|
|
2
|
+
export { createManagementClient, isManagementClientAuthError, isManagementSessionMintError };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ProjectMetadataInput, $n as RotateFileStorageAbsBody, $t as CreateMaintainerInvitationBody, A as ChangeProjectUserRolePath, An as CreateOrganizationProjectInput, At as User, B as JoinProjectBody, Bn as OrganizationUserPath, Bt as CreditPaymentRequest, C as UpdateStorageBackendInput, Cn as UpdateSamlConfigInput, Cr as ProjectInvitation, Ct as DeleteUserMetadataPath, D as AssignProjectTemplateFeatureInput, Dn as CreateOrganizationInvitationBody, Dr as CreateApplicationTokenBody, Dt as SetUserMetadataInput, E as AssignFeatureBody, En as AdminUser, Er as ApplicationTokenScope, Et as SetUserMetadataBody, F as DeleteProjectInvitationPath, Fn as OrganizationListItem, Ft as UserPath, G as MoveProjectBody, Gn as SetUpBigQueryBody, Gt as TopUpSetting, H as ListProjectInvitationsPath, Hn as SetOrganizationMetadataInput, Ht as PayAsYouGoBillingConfiguration, I as DeleteProjectMetadataPath, In as OrganizationMaintainer, It as UserProjectMembership, J as ProjectBase, Jn as CreateFileStorageS3Body, Jt as AddMaintainerUserBody, K as MoveProjectInput, Kn as CreateFileStorageAbsBody, Kt as UpdateStripeCustomerBody, L as GetProjectMetadataPath, Ln as OrganizationMetadataItemPath, Lt as ConfirmProgrammaticProjectPayload, M as CreateProjectFeaturePath, Mn as OrganizationDetail, Mt as UserListItem, N as CreateProjectInvitationBody, Nn as OrganizationInvitationDetail, Nt as UserMaintainerMembership, O as ChangeProjectUserRoleBody, On as CreateOrganizationInvitationInput, Or as CreatedApplicationToken, Ot as UpdateUserBody, P as CreateProjectInvitationPath, Pn as OrganizationInvitationPath, Pt as UserOrganizationMembership, Q as ProjectJoinRequestPath, Qn as FileStorageS3, Qt as CreateMaintainerBody, R as GetProjectPath, Rn as OrganizationPath, Rt as ConfirmProgrammaticProjectResult, S as UpdateStorageBackendBody, Sn as UpdateSamlConfigBody, Sr as OrganizationInvitation, St as AddUserFeaturePath, T as AddProjectUserPath, Tn as AddOrganizationUserInput, Tr as ApplicationToken, Tt as RemoveUserFeaturePath, U as ListProjectJoinRequestsPath, Un as UpdateOrganizationBody, Ut as StripeCustomer, V as JoinProjectInput, Vn as SetOrganizationMetadataBody, Vt as CreditPurchase, W as ListProjectUsersPath, Wn as UpdateOrganizationInput, Wt as StripeCustomerCard, X as ProjectInvitationDetail, Xn as FileStorageAbs, Xt as CompleteSamlSetupBody, Y as ProjectInvitableRole, Yn as FileStorage, Yt as AddMaintainerUserInput, Z as ProjectJoinRequestDetail, Zn as FileStorageGcs, Zt as CompleteSamlSetupInput, _ as StorageBackendMaintainer, _n as SamlConfigSummary, _r as DeletedProjectsListQuery, _t as SetProjectReviewersBody, a as GetUiAppsQuery, an as CreateSamlConfigPath, ar as RotateFileStorageS3Body, at as RemoveProjectLimitPath, b as UpdateBigqueryStorageBackendBody, bn as UpdateMaintainerBody, br as DeletedProjectsStatus, bt as UpdateProjectInput, c as UiApp, cn as MaintainerInvitationDetail, cr as UpdateFileStorageBody, ct as RequestProjectAccessBody, d as UiAppVersion, dn as MaintainerPath, dr as FeatureProject, dt as SetProjectDisabledBody, en as CreateMaintainerInvitationInput, er as RotateFileStorageAbsInput, et as ProjectMetadataItem, f as CreateBigqueryStorageBackendBody, fn as MaintainerUser, fr as FeatureType, ft as SetProjectDisabledInput, g as StorageBackend, gn as SamlConfigPath, gr as DeletedProjectsListFilter, gt as SetProjectMetadataPath, h as GetStorageBackendProjectsQuery, hn as SamlConfigDetail, hr as DeletedProjectPurgeResult, ht as SetProjectMetadataBody, i as ReactivateWorkspaceResult, in as CreateSamlConfigInput, ir as RotateFileStorageGcsPath, it as RemoveProjectFeaturePath, j as CreateProjectFeatureBody, jn as Organization, jt as UserDetail, k as ChangeProjectUserRoleInput, kn as CreateOrganizationProjectBody, kt as UpdateUserInput, l as UiAppDetail, ln as MaintainerInvitationPath, lr as Feature, lt as RequestProjectAccessInput, m as CreateSnowflakeStorageBackendResponse, mn as MetadataItem, mr as DeletedProject, mt as SetProjectLimitsInput, n as ProjectRetentionWorkspace, nn as CreateMaintainerOrganizationInput, nr as RotateFileStorageGcsBody, nt as ProjectTemplate, o as RegisterUiAppBody, on as Maintainer, or as RotateFileStorageS3Input, ot as RemoveProjectTemplateFeaturePath, p as CreateSnowflakeStorageBackendBody, pn as MaintainerUserPath, pr as GetAllFeaturesQuery, pt as SetProjectLimitsBody, q as Project, qn as CreateFileStorageGcsBody, qt as UpdateTopUpSettingBody, r as ProjectRetentionWorkspaceState, rn as CreateSamlConfigBody, rr as RotateFileStorageGcsInput, rt as ProjectTemplatePath, s as RenameUiAppBody, sn as MaintainerDetail, sr as RotateFileStorageS3Path, st as RemoveProjectUserPath, t as ManagementToken, tn as CreateMaintainerOrganizationBody, tr as RotateFileStorageAbsPath, tt as ProjectPath, u as UiAppRegistrationResult, un as MaintainerMetadataItemPath, ur as FeatureAdmin, ut as Reviewer, v as StorageBackendPath, vn as SetMaintainerMetadataBody, vr as DeletedProjectsPage, vt as SetProjectReviewersPath, w as AddProjectUserBody, wn as AddOrganizationUserBody, wr as ProjectJoinRequest, wt as GetUsersQuery, x as UpdateBigqueryStorageBackendInput, xn as UpdateMaintainerInput, xr as MaintainerInvitation, xt as AddUserFeatureBody, y as StorageBackendProject, yn as SetMaintainerMetadataInput, yr as DeletedProjectsStats, yt as UpdateProjectBody, z as GetProjectReviewersPath, zn as OrganizationProject, zt as CreatePaymentRequestBody } from "../types-
|
|
1
|
+
import { $ as ProjectMetadataInput, $n as RotateFileStorageAbsBody, $t as CreateMaintainerInvitationBody, A as ChangeProjectUserRolePath, An as CreateOrganizationProjectInput, At as User, B as JoinProjectBody, Bn as OrganizationUserPath, Bt as CreditPaymentRequest, C as UpdateStorageBackendInput, Cn as UpdateSamlConfigInput, Cr as ProjectInvitation, Ct as DeleteUserMetadataPath, D as AssignProjectTemplateFeatureInput, Dn as CreateOrganizationInvitationBody, Dr as CreateApplicationTokenBody, Dt as SetUserMetadataInput, E as AssignFeatureBody, En as AdminUser, Er as ApplicationTokenScope, Et as SetUserMetadataBody, F as DeleteProjectInvitationPath, Fn as OrganizationListItem, Ft as UserPath, G as MoveProjectBody, Gn as SetUpBigQueryBody, Gt as TopUpSetting, H as ListProjectInvitationsPath, Hn as SetOrganizationMetadataInput, Ht as PayAsYouGoBillingConfiguration, I as DeleteProjectMetadataPath, In as OrganizationMaintainer, It as UserProjectMembership, J as ProjectBase, Jn as CreateFileStorageS3Body, Jt as AddMaintainerUserBody, K as MoveProjectInput, Kn as CreateFileStorageAbsBody, Kt as UpdateStripeCustomerBody, L as GetProjectMetadataPath, Ln as OrganizationMetadataItemPath, Lt as ConfirmProgrammaticProjectPayload, M as CreateProjectFeaturePath, Mn as OrganizationDetail, Mt as UserListItem, N as CreateProjectInvitationBody, Nn as OrganizationInvitationDetail, Nt as UserMaintainerMembership, O as ChangeProjectUserRoleBody, On as CreateOrganizationInvitationInput, Or as CreatedApplicationToken, Ot as UpdateUserBody, P as CreateProjectInvitationPath, Pn as OrganizationInvitationPath, Pt as UserOrganizationMembership, Q as ProjectJoinRequestPath, Qn as FileStorageS3, Qt as CreateMaintainerBody, R as GetProjectPath, Rn as OrganizationPath, Rt as ConfirmProgrammaticProjectResult, S as UpdateStorageBackendBody, Sn as UpdateSamlConfigBody, Sr as OrganizationInvitation, St as AddUserFeaturePath, T as AddProjectUserPath, Tn as AddOrganizationUserInput, Tr as ApplicationToken, Tt as RemoveUserFeaturePath, U as ListProjectJoinRequestsPath, Un as UpdateOrganizationBody, Ut as StripeCustomer, V as JoinProjectInput, Vn as SetOrganizationMetadataBody, Vt as CreditPurchase, W as ListProjectUsersPath, Wn as UpdateOrganizationInput, Wt as StripeCustomerCard, X as ProjectInvitationDetail, Xn as FileStorageAbs, Xt as CompleteSamlSetupBody, Y as ProjectInvitableRole, Yn as FileStorage, Yt as AddMaintainerUserInput, Z as ProjectJoinRequestDetail, Zn as FileStorageGcs, Zt as CompleteSamlSetupInput, _ as StorageBackendMaintainer, _n as SamlConfigSummary, _r as DeletedProjectsListQuery, _t as SetProjectReviewersBody, a as GetUiAppsQuery, an as CreateSamlConfigPath, ar as RotateFileStorageS3Body, at as RemoveProjectLimitPath, b as UpdateBigqueryStorageBackendBody, bn as UpdateMaintainerBody, br as DeletedProjectsStatus, bt as UpdateProjectInput, c as UiApp, cn as MaintainerInvitationDetail, cr as UpdateFileStorageBody, ct as RequestProjectAccessBody, d as UiAppVersion, dn as MaintainerPath, dr as FeatureProject, dt as SetProjectDisabledBody, en as CreateMaintainerInvitationInput, er as RotateFileStorageAbsInput, et as ProjectMetadataItem, f as CreateBigqueryStorageBackendBody, fn as MaintainerUser, fr as FeatureType, ft as SetProjectDisabledInput, g as StorageBackend, gn as SamlConfigPath, gr as DeletedProjectsListFilter, gt as SetProjectMetadataPath, h as GetStorageBackendProjectsQuery, hn as SamlConfigDetail, hr as DeletedProjectPurgeResult, ht as SetProjectMetadataBody, i as ReactivateWorkspaceResult, in as CreateSamlConfigInput, ir as RotateFileStorageGcsPath, it as RemoveProjectFeaturePath, j as CreateProjectFeatureBody, jn as Organization, jt as UserDetail, k as ChangeProjectUserRoleInput, kn as CreateOrganizationProjectBody, kt as UpdateUserInput, l as UiAppDetail, ln as MaintainerInvitationPath, lr as Feature, lt as RequestProjectAccessInput, m as CreateSnowflakeStorageBackendResponse, mn as MetadataItem, mr as DeletedProject, mt as SetProjectLimitsInput, n as ProjectRetentionWorkspace, nn as CreateMaintainerOrganizationInput, nr as RotateFileStorageGcsBody, nt as ProjectTemplate, o as RegisterUiAppBody, on as Maintainer, or as RotateFileStorageS3Input, ot as RemoveProjectTemplateFeaturePath, p as CreateSnowflakeStorageBackendBody, pn as MaintainerUserPath, pr as GetAllFeaturesQuery, pt as SetProjectLimitsBody, q as Project, qn as CreateFileStorageGcsBody, qt as UpdateTopUpSettingBody, r as ProjectRetentionWorkspaceState, rn as CreateSamlConfigBody, rr as RotateFileStorageGcsInput, rt as ProjectTemplatePath, s as RenameUiAppBody, sn as MaintainerDetail, sr as RotateFileStorageS3Path, st as RemoveProjectUserPath, t as ManagementToken, tn as CreateMaintainerOrganizationBody, tr as RotateFileStorageAbsPath, tt as ProjectPath, u as UiAppRegistrationResult, un as MaintainerMetadataItemPath, ur as FeatureAdmin, ut as Reviewer, v as StorageBackendPath, vn as SetMaintainerMetadataBody, vr as DeletedProjectsPage, vt as SetProjectReviewersPath, w as AddProjectUserBody, wn as AddOrganizationUserBody, wr as ProjectJoinRequest, wt as GetUsersQuery, x as UpdateBigqueryStorageBackendInput, xn as UpdateMaintainerInput, xr as MaintainerInvitation, xt as AddUserFeatureBody, y as StorageBackendProject, yn as SetMaintainerMetadataInput, yr as DeletedProjectsStats, yt as UpdateProjectBody, z as GetProjectReviewersPath, zn as OrganizationProject, zt as CreatePaymentRequestBody } from "../types-sI3K5t3w.cjs";
|
|
2
2
|
export { AddMaintainerUserBody, AddMaintainerUserInput, AddOrganizationUserBody, AddOrganizationUserInput, AddProjectUserBody, AddProjectUserPath, AddUserFeatureBody, AddUserFeaturePath, AdminUser, ApplicationToken, ApplicationTokenScope, AssignFeatureBody, AssignProjectTemplateFeatureInput, ChangeProjectUserRoleBody, ChangeProjectUserRoleInput, ChangeProjectUserRolePath, CompleteSamlSetupBody, CompleteSamlSetupInput, ConfirmProgrammaticProjectPayload, ConfirmProgrammaticProjectResult, CreateApplicationTokenBody, CreateBigqueryStorageBackendBody, CreateFileStorageAbsBody, CreateFileStorageGcsBody, CreateFileStorageS3Body, CreateMaintainerBody, CreateMaintainerInvitationBody, CreateMaintainerInvitationInput, CreateMaintainerOrganizationBody, CreateMaintainerOrganizationInput, CreateOrganizationInvitationBody, CreateOrganizationInvitationInput, CreateOrganizationProjectBody, CreateOrganizationProjectInput, CreatePaymentRequestBody, CreateProjectFeatureBody, CreateProjectFeaturePath, CreateProjectInvitationBody, CreateProjectInvitationPath, CreateSamlConfigBody, CreateSamlConfigInput, CreateSamlConfigPath, CreateSnowflakeStorageBackendBody, CreateSnowflakeStorageBackendResponse, CreatedApplicationToken, CreditPaymentRequest, CreditPurchase, DeleteProjectInvitationPath, DeleteProjectMetadataPath, DeleteUserMetadataPath, DeletedProject, DeletedProjectPurgeResult, DeletedProjectsListFilter, DeletedProjectsListQuery, DeletedProjectsPage, DeletedProjectsStats, DeletedProjectsStatus, Feature, FeatureAdmin, FeatureProject, FeatureType, FileStorage, FileStorageAbs, FileStorageGcs, FileStorageS3, GetAllFeaturesQuery, GetProjectMetadataPath, GetProjectPath, GetProjectReviewersPath, GetStorageBackendProjectsQuery, GetUiAppsQuery, GetUsersQuery, JoinProjectBody, JoinProjectInput, ListProjectInvitationsPath, ListProjectJoinRequestsPath, ListProjectUsersPath, Maintainer, MaintainerDetail, MaintainerInvitation, MaintainerInvitationDetail, MaintainerInvitationPath, MaintainerMetadataItemPath, MaintainerPath, MaintainerUser, MaintainerUserPath, ManagementToken, MetadataItem, MoveProjectBody, MoveProjectInput, Organization, OrganizationDetail, OrganizationInvitation, OrganizationInvitationDetail, OrganizationInvitationPath, OrganizationListItem, OrganizationMaintainer, OrganizationMetadataItemPath, OrganizationPath, OrganizationProject, OrganizationUserPath, PayAsYouGoBillingConfiguration, Project, ProjectBase, ProjectInvitableRole, ProjectInvitation, ProjectInvitationDetail, ProjectJoinRequest, ProjectJoinRequestDetail, ProjectJoinRequestPath, ProjectMetadataInput, ProjectMetadataItem, ProjectPath, ProjectRetentionWorkspace, ProjectRetentionWorkspaceState, ProjectTemplate, ProjectTemplatePath, ReactivateWorkspaceResult, RegisterUiAppBody, RemoveProjectFeaturePath, RemoveProjectLimitPath, RemoveProjectTemplateFeaturePath, RemoveProjectUserPath, RemoveUserFeaturePath, RenameUiAppBody, RequestProjectAccessBody, RequestProjectAccessInput, Reviewer, RotateFileStorageAbsBody, RotateFileStorageAbsInput, RotateFileStorageAbsPath, RotateFileStorageGcsBody, RotateFileStorageGcsInput, RotateFileStorageGcsPath, RotateFileStorageS3Body, RotateFileStorageS3Input, RotateFileStorageS3Path, SamlConfigDetail, SamlConfigPath, SamlConfigSummary, SetMaintainerMetadataBody, SetMaintainerMetadataInput, SetOrganizationMetadataBody, SetOrganizationMetadataInput, SetProjectDisabledBody, SetProjectDisabledInput, SetProjectLimitsBody, SetProjectLimitsInput, SetProjectMetadataBody, SetProjectMetadataPath, SetProjectReviewersBody, SetProjectReviewersPath, SetUpBigQueryBody, SetUserMetadataBody, SetUserMetadataInput, StorageBackend, StorageBackendMaintainer, StorageBackendPath, StorageBackendProject, StripeCustomer, StripeCustomerCard, TopUpSetting, UiApp, UiAppDetail, UiAppRegistrationResult, UiAppVersion, UpdateBigqueryStorageBackendBody, UpdateBigqueryStorageBackendInput, UpdateFileStorageBody, UpdateMaintainerBody, UpdateMaintainerInput, UpdateOrganizationBody, UpdateOrganizationInput, UpdateProjectBody, UpdateProjectInput, UpdateSamlConfigBody, UpdateSamlConfigInput, UpdateStorageBackendBody, UpdateStorageBackendInput, UpdateStripeCustomerBody, UpdateTopUpSettingBody, UpdateUserBody, UpdateUserInput, User, UserDetail, UserListItem, UserMaintainerMembership, UserOrganizationMembership, UserPath, UserProjectMembership };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ProjectMetadataInput, $n as RotateFileStorageAbsBody, $t as CreateMaintainerInvitationBody, A as ChangeProjectUserRolePath, An as CreateOrganizationProjectInput, At as User, B as JoinProjectBody, Bn as OrganizationUserPath, Bt as CreditPaymentRequest, C as UpdateStorageBackendInput, Cn as UpdateSamlConfigInput, Cr as ProjectInvitation, Ct as DeleteUserMetadataPath, D as AssignProjectTemplateFeatureInput, Dn as CreateOrganizationInvitationBody, Dr as CreateApplicationTokenBody, Dt as SetUserMetadataInput, E as AssignFeatureBody, En as AdminUser, Er as ApplicationTokenScope, Et as SetUserMetadataBody, F as DeleteProjectInvitationPath, Fn as OrganizationListItem, Ft as UserPath, G as MoveProjectBody, Gn as SetUpBigQueryBody, Gt as TopUpSetting, H as ListProjectInvitationsPath, Hn as SetOrganizationMetadataInput, Ht as PayAsYouGoBillingConfiguration, I as DeleteProjectMetadataPath, In as OrganizationMaintainer, It as UserProjectMembership, J as ProjectBase, Jn as CreateFileStorageS3Body, Jt as AddMaintainerUserBody, K as MoveProjectInput, Kn as CreateFileStorageAbsBody, Kt as UpdateStripeCustomerBody, L as GetProjectMetadataPath, Ln as OrganizationMetadataItemPath, Lt as ConfirmProgrammaticProjectPayload, M as CreateProjectFeaturePath, Mn as OrganizationDetail, Mt as UserListItem, N as CreateProjectInvitationBody, Nn as OrganizationInvitationDetail, Nt as UserMaintainerMembership, O as ChangeProjectUserRoleBody, On as CreateOrganizationInvitationInput, Or as CreatedApplicationToken, Ot as UpdateUserBody, P as CreateProjectInvitationPath, Pn as OrganizationInvitationPath, Pt as UserOrganizationMembership, Q as ProjectJoinRequestPath, Qn as FileStorageS3, Qt as CreateMaintainerBody, R as GetProjectPath, Rn as OrganizationPath, Rt as ConfirmProgrammaticProjectResult, S as UpdateStorageBackendBody, Sn as UpdateSamlConfigBody, Sr as OrganizationInvitation, St as AddUserFeaturePath, T as AddProjectUserPath, Tn as AddOrganizationUserInput, Tr as ApplicationToken, Tt as RemoveUserFeaturePath, U as ListProjectJoinRequestsPath, Un as UpdateOrganizationBody, Ut as StripeCustomer, V as JoinProjectInput, Vn as SetOrganizationMetadataBody, Vt as CreditPurchase, W as ListProjectUsersPath, Wn as UpdateOrganizationInput, Wt as StripeCustomerCard, X as ProjectInvitationDetail, Xn as FileStorageAbs, Xt as CompleteSamlSetupBody, Y as ProjectInvitableRole, Yn as FileStorage, Yt as AddMaintainerUserInput, Z as ProjectJoinRequestDetail, Zn as FileStorageGcs, Zt as CompleteSamlSetupInput, _ as StorageBackendMaintainer, _n as SamlConfigSummary, _r as DeletedProjectsListQuery, _t as SetProjectReviewersBody, a as GetUiAppsQuery, an as CreateSamlConfigPath, ar as RotateFileStorageS3Body, at as RemoveProjectLimitPath, b as UpdateBigqueryStorageBackendBody, bn as UpdateMaintainerBody, br as DeletedProjectsStatus, bt as UpdateProjectInput, c as UiApp, cn as MaintainerInvitationDetail, cr as UpdateFileStorageBody, ct as RequestProjectAccessBody, d as UiAppVersion, dn as MaintainerPath, dr as FeatureProject, dt as SetProjectDisabledBody, en as CreateMaintainerInvitationInput, er as RotateFileStorageAbsInput, et as ProjectMetadataItem, f as CreateBigqueryStorageBackendBody, fn as MaintainerUser, fr as FeatureType, ft as SetProjectDisabledInput, g as StorageBackend, gn as SamlConfigPath, gr as DeletedProjectsListFilter, gt as SetProjectMetadataPath, h as GetStorageBackendProjectsQuery, hn as SamlConfigDetail, hr as DeletedProjectPurgeResult, ht as SetProjectMetadataBody, i as ReactivateWorkspaceResult, in as CreateSamlConfigInput, ir as RotateFileStorageGcsPath, it as RemoveProjectFeaturePath, j as CreateProjectFeatureBody, jn as Organization, jt as UserDetail, k as ChangeProjectUserRoleInput, kn as CreateOrganizationProjectBody, kt as UpdateUserInput, l as UiAppDetail, ln as MaintainerInvitationPath, lr as Feature, lt as RequestProjectAccessInput, m as CreateSnowflakeStorageBackendResponse, mn as MetadataItem, mr as DeletedProject, mt as SetProjectLimitsInput, n as ProjectRetentionWorkspace, nn as CreateMaintainerOrganizationInput, nr as RotateFileStorageGcsBody, nt as ProjectTemplate, o as RegisterUiAppBody, on as Maintainer, or as RotateFileStorageS3Input, ot as RemoveProjectTemplateFeaturePath, p as CreateSnowflakeStorageBackendBody, pn as MaintainerUserPath, pr as GetAllFeaturesQuery, pt as SetProjectLimitsBody, q as Project, qn as CreateFileStorageGcsBody, qt as UpdateTopUpSettingBody, r as ProjectRetentionWorkspaceState, rn as CreateSamlConfigBody, rr as RotateFileStorageGcsInput, rt as ProjectTemplatePath, s as RenameUiAppBody, sn as MaintainerDetail, sr as RotateFileStorageS3Path, st as RemoveProjectUserPath, t as ManagementToken, tn as CreateMaintainerOrganizationBody, tr as RotateFileStorageAbsPath, tt as ProjectPath, u as UiAppRegistrationResult, un as MaintainerMetadataItemPath, ur as FeatureAdmin, ut as Reviewer, v as StorageBackendPath, vn as SetMaintainerMetadataBody, vr as DeletedProjectsPage, vt as SetProjectReviewersPath, w as AddProjectUserBody, wn as AddOrganizationUserBody, wr as ProjectJoinRequest, wt as GetUsersQuery, x as UpdateBigqueryStorageBackendInput, xn as UpdateMaintainerInput, xr as MaintainerInvitation, xt as AddUserFeatureBody, y as StorageBackendProject, yn as SetMaintainerMetadataInput, yr as DeletedProjectsStats, yt as UpdateProjectBody, z as GetProjectReviewersPath, zn as OrganizationProject, zt as CreatePaymentRequestBody } from "../types-
|
|
1
|
+
import { $ as ProjectMetadataInput, $n as RotateFileStorageAbsBody, $t as CreateMaintainerInvitationBody, A as ChangeProjectUserRolePath, An as CreateOrganizationProjectInput, At as User, B as JoinProjectBody, Bn as OrganizationUserPath, Bt as CreditPaymentRequest, C as UpdateStorageBackendInput, Cn as UpdateSamlConfigInput, Cr as ProjectInvitation, Ct as DeleteUserMetadataPath, D as AssignProjectTemplateFeatureInput, Dn as CreateOrganizationInvitationBody, Dr as CreateApplicationTokenBody, Dt as SetUserMetadataInput, E as AssignFeatureBody, En as AdminUser, Er as ApplicationTokenScope, Et as SetUserMetadataBody, F as DeleteProjectInvitationPath, Fn as OrganizationListItem, Ft as UserPath, G as MoveProjectBody, Gn as SetUpBigQueryBody, Gt as TopUpSetting, H as ListProjectInvitationsPath, Hn as SetOrganizationMetadataInput, Ht as PayAsYouGoBillingConfiguration, I as DeleteProjectMetadataPath, In as OrganizationMaintainer, It as UserProjectMembership, J as ProjectBase, Jn as CreateFileStorageS3Body, Jt as AddMaintainerUserBody, K as MoveProjectInput, Kn as CreateFileStorageAbsBody, Kt as UpdateStripeCustomerBody, L as GetProjectMetadataPath, Ln as OrganizationMetadataItemPath, Lt as ConfirmProgrammaticProjectPayload, M as CreateProjectFeaturePath, Mn as OrganizationDetail, Mt as UserListItem, N as CreateProjectInvitationBody, Nn as OrganizationInvitationDetail, Nt as UserMaintainerMembership, O as ChangeProjectUserRoleBody, On as CreateOrganizationInvitationInput, Or as CreatedApplicationToken, Ot as UpdateUserBody, P as CreateProjectInvitationPath, Pn as OrganizationInvitationPath, Pt as UserOrganizationMembership, Q as ProjectJoinRequestPath, Qn as FileStorageS3, Qt as CreateMaintainerBody, R as GetProjectPath, Rn as OrganizationPath, Rt as ConfirmProgrammaticProjectResult, S as UpdateStorageBackendBody, Sn as UpdateSamlConfigBody, Sr as OrganizationInvitation, St as AddUserFeaturePath, T as AddProjectUserPath, Tn as AddOrganizationUserInput, Tr as ApplicationToken, Tt as RemoveUserFeaturePath, U as ListProjectJoinRequestsPath, Un as UpdateOrganizationBody, Ut as StripeCustomer, V as JoinProjectInput, Vn as SetOrganizationMetadataBody, Vt as CreditPurchase, W as ListProjectUsersPath, Wn as UpdateOrganizationInput, Wt as StripeCustomerCard, X as ProjectInvitationDetail, Xn as FileStorageAbs, Xt as CompleteSamlSetupBody, Y as ProjectInvitableRole, Yn as FileStorage, Yt as AddMaintainerUserInput, Z as ProjectJoinRequestDetail, Zn as FileStorageGcs, Zt as CompleteSamlSetupInput, _ as StorageBackendMaintainer, _n as SamlConfigSummary, _r as DeletedProjectsListQuery, _t as SetProjectReviewersBody, a as GetUiAppsQuery, an as CreateSamlConfigPath, ar as RotateFileStorageS3Body, at as RemoveProjectLimitPath, b as UpdateBigqueryStorageBackendBody, bn as UpdateMaintainerBody, br as DeletedProjectsStatus, bt as UpdateProjectInput, c as UiApp, cn as MaintainerInvitationDetail, cr as UpdateFileStorageBody, ct as RequestProjectAccessBody, d as UiAppVersion, dn as MaintainerPath, dr as FeatureProject, dt as SetProjectDisabledBody, en as CreateMaintainerInvitationInput, er as RotateFileStorageAbsInput, et as ProjectMetadataItem, f as CreateBigqueryStorageBackendBody, fn as MaintainerUser, fr as FeatureType, ft as SetProjectDisabledInput, g as StorageBackend, gn as SamlConfigPath, gr as DeletedProjectsListFilter, gt as SetProjectMetadataPath, h as GetStorageBackendProjectsQuery, hn as SamlConfigDetail, hr as DeletedProjectPurgeResult, ht as SetProjectMetadataBody, i as ReactivateWorkspaceResult, in as CreateSamlConfigInput, ir as RotateFileStorageGcsPath, it as RemoveProjectFeaturePath, j as CreateProjectFeatureBody, jn as Organization, jt as UserDetail, k as ChangeProjectUserRoleInput, kn as CreateOrganizationProjectBody, kt as UpdateUserInput, l as UiAppDetail, ln as MaintainerInvitationPath, lr as Feature, lt as RequestProjectAccessInput, m as CreateSnowflakeStorageBackendResponse, mn as MetadataItem, mr as DeletedProject, mt as SetProjectLimitsInput, n as ProjectRetentionWorkspace, nn as CreateMaintainerOrganizationInput, nr as RotateFileStorageGcsBody, nt as ProjectTemplate, o as RegisterUiAppBody, on as Maintainer, or as RotateFileStorageS3Input, ot as RemoveProjectTemplateFeaturePath, p as CreateSnowflakeStorageBackendBody, pn as MaintainerUserPath, pr as GetAllFeaturesQuery, pt as SetProjectLimitsBody, q as Project, qn as CreateFileStorageGcsBody, qt as UpdateTopUpSettingBody, r as ProjectRetentionWorkspaceState, rn as CreateSamlConfigBody, rr as RotateFileStorageGcsInput, rt as ProjectTemplatePath, s as RenameUiAppBody, sn as MaintainerDetail, sr as RotateFileStorageS3Path, st as RemoveProjectUserPath, t as ManagementToken, tn as CreateMaintainerOrganizationBody, tr as RotateFileStorageAbsPath, tt as ProjectPath, u as UiAppRegistrationResult, un as MaintainerMetadataItemPath, ur as FeatureAdmin, ut as Reviewer, v as StorageBackendPath, vn as SetMaintainerMetadataBody, vr as DeletedProjectsPage, vt as SetProjectReviewersPath, w as AddProjectUserBody, wn as AddOrganizationUserBody, wr as ProjectJoinRequest, wt as GetUsersQuery, x as UpdateBigqueryStorageBackendInput, xn as UpdateMaintainerInput, xr as MaintainerInvitation, xt as AddUserFeatureBody, y as StorageBackendProject, yn as SetMaintainerMetadataInput, yr as DeletedProjectsStats, yt as UpdateProjectBody, z as GetProjectReviewersPath, zn as OrganizationProject, zt as CreatePaymentRequestBody } from "../types-fAqPUl-a.js";
|
|
2
2
|
export { AddMaintainerUserBody, AddMaintainerUserInput, AddOrganizationUserBody, AddOrganizationUserInput, AddProjectUserBody, AddProjectUserPath, AddUserFeatureBody, AddUserFeaturePath, AdminUser, ApplicationToken, ApplicationTokenScope, AssignFeatureBody, AssignProjectTemplateFeatureInput, ChangeProjectUserRoleBody, ChangeProjectUserRoleInput, ChangeProjectUserRolePath, CompleteSamlSetupBody, CompleteSamlSetupInput, ConfirmProgrammaticProjectPayload, ConfirmProgrammaticProjectResult, CreateApplicationTokenBody, CreateBigqueryStorageBackendBody, CreateFileStorageAbsBody, CreateFileStorageGcsBody, CreateFileStorageS3Body, CreateMaintainerBody, CreateMaintainerInvitationBody, CreateMaintainerInvitationInput, CreateMaintainerOrganizationBody, CreateMaintainerOrganizationInput, CreateOrganizationInvitationBody, CreateOrganizationInvitationInput, CreateOrganizationProjectBody, CreateOrganizationProjectInput, CreatePaymentRequestBody, CreateProjectFeatureBody, CreateProjectFeaturePath, CreateProjectInvitationBody, CreateProjectInvitationPath, CreateSamlConfigBody, CreateSamlConfigInput, CreateSamlConfigPath, CreateSnowflakeStorageBackendBody, CreateSnowflakeStorageBackendResponse, CreatedApplicationToken, CreditPaymentRequest, CreditPurchase, DeleteProjectInvitationPath, DeleteProjectMetadataPath, DeleteUserMetadataPath, DeletedProject, DeletedProjectPurgeResult, DeletedProjectsListFilter, DeletedProjectsListQuery, DeletedProjectsPage, DeletedProjectsStats, DeletedProjectsStatus, Feature, FeatureAdmin, FeatureProject, FeatureType, FileStorage, FileStorageAbs, FileStorageGcs, FileStorageS3, GetAllFeaturesQuery, GetProjectMetadataPath, GetProjectPath, GetProjectReviewersPath, GetStorageBackendProjectsQuery, GetUiAppsQuery, GetUsersQuery, JoinProjectBody, JoinProjectInput, ListProjectInvitationsPath, ListProjectJoinRequestsPath, ListProjectUsersPath, Maintainer, MaintainerDetail, MaintainerInvitation, MaintainerInvitationDetail, MaintainerInvitationPath, MaintainerMetadataItemPath, MaintainerPath, MaintainerUser, MaintainerUserPath, ManagementToken, MetadataItem, MoveProjectBody, MoveProjectInput, Organization, OrganizationDetail, OrganizationInvitation, OrganizationInvitationDetail, OrganizationInvitationPath, OrganizationListItem, OrganizationMaintainer, OrganizationMetadataItemPath, OrganizationPath, OrganizationProject, OrganizationUserPath, PayAsYouGoBillingConfiguration, Project, ProjectBase, ProjectInvitableRole, ProjectInvitation, ProjectInvitationDetail, ProjectJoinRequest, ProjectJoinRequestDetail, ProjectJoinRequestPath, ProjectMetadataInput, ProjectMetadataItem, ProjectPath, ProjectRetentionWorkspace, ProjectRetentionWorkspaceState, ProjectTemplate, ProjectTemplatePath, ReactivateWorkspaceResult, RegisterUiAppBody, RemoveProjectFeaturePath, RemoveProjectLimitPath, RemoveProjectTemplateFeaturePath, RemoveProjectUserPath, RemoveUserFeaturePath, RenameUiAppBody, RequestProjectAccessBody, RequestProjectAccessInput, Reviewer, RotateFileStorageAbsBody, RotateFileStorageAbsInput, RotateFileStorageAbsPath, RotateFileStorageGcsBody, RotateFileStorageGcsInput, RotateFileStorageGcsPath, RotateFileStorageS3Body, RotateFileStorageS3Input, RotateFileStorageS3Path, SamlConfigDetail, SamlConfigPath, SamlConfigSummary, SetMaintainerMetadataBody, SetMaintainerMetadataInput, SetOrganizationMetadataBody, SetOrganizationMetadataInput, SetProjectDisabledBody, SetProjectDisabledInput, SetProjectLimitsBody, SetProjectLimitsInput, SetProjectMetadataBody, SetProjectMetadataPath, SetProjectReviewersBody, SetProjectReviewersPath, SetUpBigQueryBody, SetUserMetadataBody, SetUserMetadataInput, StorageBackend, StorageBackendMaintainer, StorageBackendPath, StorageBackendProject, StripeCustomer, StripeCustomerCard, TopUpSetting, UiApp, UiAppDetail, UiAppRegistrationResult, UiAppVersion, UpdateBigqueryStorageBackendBody, UpdateBigqueryStorageBackendInput, UpdateFileStorageBody, UpdateMaintainerBody, UpdateMaintainerInput, UpdateOrganizationBody, UpdateOrganizationInput, UpdateProjectBody, UpdateProjectInput, UpdateSamlConfigBody, UpdateSamlConfigInput, UpdateStorageBackendBody, UpdateStorageBackendInput, UpdateStripeCustomerBody, UpdateTopUpSettingBody, UpdateUserBody, UpdateUserInput, User, UserDetail, UserListItem, UserMaintainerMembership, UserOrganizationMembership, UserPath, UserProjectMembership };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_dedupe = require("./dedupe-OSnnst2u.cjs");
|
|
2
2
|
const require_createFetchClient = require("./createFetchClient-ClWD4ua3.cjs");
|
|
3
|
-
const
|
|
3
|
+
const require_ManagementSessionMintError = require("./ManagementSessionMintError-Bm8s6yDB.cjs");
|
|
4
4
|
const require_createGenericFetchClient = require("./createGenericFetchClient-B81Iezpb.cjs");
|
|
5
5
|
const require_createOpenapiFetchClient = require("./createOpenapiFetchClient-CioTX11-.cjs");
|
|
6
6
|
const require_isLoginPageRedirect = require("./isLoginPageRedirect-iNbwl3iz.cjs");
|
|
@@ -39,13 +39,14 @@ const createApplicationTokens = (client) => {
|
|
|
39
39
|
*/
|
|
40
40
|
const validateManagementStatus = (apiResponse) => {
|
|
41
41
|
const isValid = require_createFetchClient.defaultValidateStatus(apiResponse);
|
|
42
|
-
if (isValid && require_isLoginPageRedirect.isLoginPageRedirect(apiResponse)) return new
|
|
42
|
+
if (isValid && require_isLoginPageRedirect.isLoginPageRedirect(apiResponse)) return new require_ManagementSessionMintError.ManagementClientAuthError("Your session expired", "You will be logged out automatically.", apiResponse);
|
|
43
43
|
return isValid;
|
|
44
44
|
};
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/clients/management/authMiddleware.ts
|
|
47
47
|
const TOKEN_CACHE_TTL_MS = 6e4;
|
|
48
|
-
const isManagementClientAuthError = (error) => error instanceof
|
|
48
|
+
const isManagementClientAuthError = (error) => error instanceof require_ManagementSessionMintError.ManagementClientAuthError;
|
|
49
|
+
const isManagementSessionMintError = (error) => error instanceof require_ManagementSessionMintError.ManagementSessionMintError;
|
|
49
50
|
const createAuth = (baseUrl) => {
|
|
50
51
|
const fetchClient = require_createGenericFetchClient.createGenericFetchClient({
|
|
51
52
|
baseUrl,
|
|
@@ -62,8 +63,13 @@ const createAuth = (baseUrl) => {
|
|
|
62
63
|
return data.token;
|
|
63
64
|
};
|
|
64
65
|
const createAdminAccountSessionToken = async () => {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
try {
|
|
67
|
+
const { data } = await fetchClient.post("/admin/account/session-token", {});
|
|
68
|
+
return data.token;
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (isManagementClientAuthError(error)) throw new require_ManagementSessionMintError.ManagementSessionMintError(error);
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
67
73
|
};
|
|
68
74
|
return {
|
|
69
75
|
verifyManagementToken,
|
|
@@ -71,6 +77,13 @@ const createAuth = (baseUrl) => {
|
|
|
71
77
|
createAdminAccountSessionToken
|
|
72
78
|
};
|
|
73
79
|
};
|
|
80
|
+
/**
|
|
81
|
+
* Manage token auth for the legacy (SAPI) client: verifies, and mints a session token when needed.
|
|
82
|
+
*
|
|
83
|
+
* @deprecated Goes with the legacy entry point. A bearer client carries its credential and installs
|
|
84
|
+
* no auth middleware; delete this, `ManagementSessionMintError` and `manageSessionExpiredMiddleware`
|
|
85
|
+
* in kbc-ui once every stack is on bearer.
|
|
86
|
+
*/
|
|
74
87
|
const createAuthMiddleware = ({ accessToken, baseUrl, mintSessionToken = false }) => {
|
|
75
88
|
const auth = createAuth(baseUrl);
|
|
76
89
|
let token = mintSessionToken ? void 0 : accessToken;
|
|
@@ -1275,5 +1288,11 @@ Object.defineProperty(exports, "isManagementClientAuthError", {
|
|
|
1275
1288
|
return isManagementClientAuthError;
|
|
1276
1289
|
}
|
|
1277
1290
|
});
|
|
1291
|
+
Object.defineProperty(exports, "isManagementSessionMintError", {
|
|
1292
|
+
enumerable: true,
|
|
1293
|
+
get: function() {
|
|
1294
|
+
return isManagementSessionMintError;
|
|
1295
|
+
}
|
|
1296
|
+
});
|
|
1278
1297
|
|
|
1279
|
-
//# sourceMappingURL=management-
|
|
1298
|
+
//# sourceMappingURL=management-0cWVLHei.cjs.map
|