@burdenoff/be-sdk 2026.1110.2 → 2026.1110.4
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/configs/eslint/index.js +1 -1
- package/configs/tsconfig/tsconfig.json +1 -1
- package/dist/EventQueueFactory-9NGZV9jl.js +1457 -0
- package/dist/EventQueueFactory-9NGZV9jl.js.map +1 -0
- package/dist/RedisStreamsConnection-CY8WySJy.js +283 -0
- package/dist/RedisStreamsConnection-CY8WySJy.js.map +1 -0
- package/dist/activity/index.d.ts +165 -0
- package/dist/activity/index.js +389 -0
- package/dist/activity/index.js.map +1 -0
- package/dist/ai-credits/index.d.ts +2 -3
- package/dist/ai-credits/index.js +3 -4
- package/dist/ai-credits/index.js.map +1 -1
- package/dist/ai-credits-xxfwGpHS.js +546 -0
- package/dist/ai-credits-xxfwGpHS.js.map +1 -0
- package/dist/{assistant-session-CJZhF4D6.d.ts → assistant-session-DA5ZKJOr.d.ts} +4 -5
- package/dist/auth/index.d.ts +2 -77
- package/dist/auth/index.js +3 -7
- package/dist/auth/index.js.map +1 -1
- package/dist/auth-C5ctwSLp.js +228 -0
- package/dist/auth-C5ctwSLp.js.map +1 -0
- package/dist/bootstrap/index.d.ts +74 -0
- package/dist/bootstrap/index.js +282 -0
- package/dist/bootstrap/index.js.map +1 -0
- package/dist/cache/index.d.ts +2 -3
- package/dist/cache/index.js +3 -7
- package/dist/cache/index.js.map +1 -1
- package/dist/cache-CU0uLwcS.js +1837 -0
- package/dist/cache-CU0uLwcS.js.map +1 -0
- package/dist/captcha/index.d.ts +2 -1
- package/dist/captcha/index.js +3 -3
- package/dist/captcha/index.js.map +1 -1
- package/dist/captcha-BT7yh1YS.js +77 -0
- package/dist/captcha-BT7yh1YS.js.map +1 -0
- package/dist/client/internal-client.d.ts +4 -7
- package/dist/client/internal-client.js +172 -4
- package/dist/client/internal-client.js.map +1 -1
- package/dist/client-BgAEvDC2.d.ts +86 -0
- package/dist/client-sAJTrb4i.js +565 -0
- package/dist/client-sAJTrb4i.js.map +1 -0
- package/dist/collector-endpoint-iyQYeI50.js +50 -0
- package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
- package/dist/context/index.d.ts +35 -0
- package/dist/context/index.js +283 -0
- package/dist/context/index.js.map +1 -0
- package/dist/crypto/index.d.ts +2 -1
- package/dist/crypto/index.js +3 -3
- package/dist/crypto/index.js.map +1 -1
- package/dist/crypto-DO9fM0FO.js +145 -0
- package/dist/crypto-DO9fM0FO.js.map +1 -0
- package/dist/database/index.d.ts +104 -108
- package/dist/database/index.js +468 -6
- package/dist/database/index.js.map +1 -1
- package/dist/dataloader/index.d.ts +2 -1
- package/dist/dataloader/index.js +3 -3
- package/dist/dataloader/index.js.map +1 -1
- package/dist/dataloader-DwpT3YoS.js +294 -0
- package/dist/dataloader-DwpT3YoS.js.map +1 -0
- package/dist/deployed-environment-p_Tdl3sT.js +38 -0
- package/dist/deployed-environment-p_Tdl3sT.js.map +1 -0
- package/dist/dist-BGKdXVy3.js +1718 -0
- package/dist/dist-BGKdXVy3.js.map +1 -0
- package/dist/env-DdaoGjIt.js +74 -0
- package/dist/env-DdaoGjIt.js.map +1 -0
- package/dist/event-queue/index.d.ts +2 -7
- package/dist/event-queue/index.js +7 -9
- package/dist/event-queue/index.js.map +1 -1
- package/dist/event-queue-Cw-YJPY_.js +1384 -0
- package/dist/event-queue-Cw-YJPY_.js.map +1 -0
- package/dist/{explicit-activity-scope-CCoxVwAr.d.ts → explicit-activity-scope-D8VeGGpt.d.ts} +1 -2
- package/dist/explicit-activity-scope-DikJ7NAE.js +57 -0
- package/dist/explicit-activity-scope-DikJ7NAE.js.map +1 -0
- package/dist/export/index.d.ts +2 -2
- package/dist/export/index.js +3 -14
- package/dist/export/index.js.map +1 -1
- package/dist/export-DJXE3Osa.js +642 -0
- package/dist/export-DJXE3Osa.js.map +1 -0
- package/dist/feature-flags/index.d.ts +2 -10
- package/dist/feature-flags/index.js +3 -6
- package/dist/feature-flags/index.js.map +1 -1
- package/dist/feature-flags-CP1KRgwD.js +422 -0
- package/dist/feature-flags-CP1KRgwD.js.map +1 -0
- package/dist/files/index.d.ts +2 -3
- package/dist/files/index.js +3 -4
- package/dist/files/index.js.map +1 -1
- package/dist/files-h5U-D2AF.js +830 -0
- package/dist/files-h5U-D2AF.js.map +1 -0
- package/dist/gateway/index.d.ts +4 -6
- package/dist/gateway/index.js +7 -13
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/security/index.d.ts +2 -2
- package/dist/gateway/security/index.js +3 -5
- package/dist/gateway/security/index.js.map +1 -1
- package/dist/gateway-ByVo-n37.js +50 -0
- package/dist/gateway-ByVo-n37.js.map +1 -0
- package/dist/graph/index.d.ts +3 -10
- package/dist/graph/index.js +4 -13
- package/dist/graph/index.js.map +1 -1
- package/dist/graph-CR7u4lpl.js +2152 -0
- package/dist/graph-CR7u4lpl.js.map +1 -0
- package/dist/graph-emitter-CdOXP7Tn.js +621 -0
- package/dist/graph-emitter-CdOXP7Tn.js.map +1 -0
- package/dist/graphql/index.d.ts +3 -2
- package/dist/graphql/index.js +4 -6
- package/dist/graphql/index.js.map +1 -1
- package/dist/graphql/services/index.d.ts +2 -24
- package/dist/graphql/services/index.js +3 -4
- package/dist/graphql/services/index.js.map +1 -1
- package/dist/graphql-CUDyhibV.d.ts +21 -0
- package/dist/graphql-DHAHHcww.js +161 -0
- package/dist/graphql-DHAHHcww.js.map +1 -0
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.js +3 -4
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n-BBMYFd0P.js +860 -0
- package/dist/i18n-BBMYFd0P.js.map +1 -0
- package/dist/import-optional-peer-B82VYxeX.js +18 -0
- package/dist/import-optional-peer-B82VYxeX.js.map +1 -0
- package/dist/index-3KOZ1zN9.d.ts +233 -0
- package/dist/index-ADmsX0BI.d.ts +646 -0
- package/dist/index-B2LCaK0R.d.ts +500 -0
- package/dist/index-BBqooJ52.d.ts +45 -0
- package/dist/index-BGzMYJsm.d.ts +209 -0
- package/dist/index-BMIMnp6T.d.ts +8 -0
- package/dist/index-BVOL7458.d.ts +10 -0
- package/dist/index-BcqQs-Uq.d.ts +69 -0
- package/dist/index-BeVtqGO-.d.ts +208 -0
- package/dist/index-BiTzGUZP.d.ts +114 -0
- package/dist/index-C0qLquY0.d.ts +150 -0
- package/dist/index-C5uEKchX.d.ts +60 -0
- package/dist/index-CDOqxSIi.d.ts +37 -0
- package/dist/index-CG6wj66Y.d.ts +148 -0
- package/dist/index-CHwMhK6v.d.ts +63 -0
- package/dist/index-CIgoeobA.d.ts +145 -0
- package/dist/index-CPQDMSFS.d.ts +103 -0
- package/dist/index-CSRcgkVi.d.ts +23 -0
- package/dist/index-CTTwo9av.d.ts +102 -0
- package/dist/index-CVCyKzhB.d.ts +207 -0
- package/dist/index-C_GXXF32.d.ts +704 -0
- package/dist/index-CaM9JUcc.d.ts +144 -0
- package/dist/index-CliOgq6L.d.ts +203 -0
- package/dist/index-Cot73bdh.d.ts +63 -0
- package/dist/index-DGgh9DWn.d.ts +59 -0
- package/dist/index-DY3dNhMN.d.ts +420 -0
- package/dist/index-DqbGqfAy.d.ts +127 -0
- package/dist/index-Dt1HJPTX.d.ts +12 -0
- package/dist/index-DtI6aBtB.d.ts +22 -0
- package/dist/index-FKohsiex.d.ts +38 -0
- package/dist/index-FRRaa6h2.d.ts +999 -0
- package/dist/index-FbXPfen7.d.ts +132 -0
- package/dist/index-MArCb8Aq.d.ts +306 -0
- package/dist/index-U_tu3zUl.d.ts +303 -0
- package/dist/index-YOShAwkq.d.ts +45 -0
- package/dist/index-cmR9k9ga.d.ts +26 -0
- package/dist/index-yBSjMY32.d.ts +24 -0
- package/dist/index-zd_NPGJo.d.ts +206 -0
- package/dist/index.d.ts +106 -609
- package/dist/index.js +769 -2590
- package/dist/index.js.map +1 -1
- package/dist/init/index.d.ts +2 -2
- package/dist/init/index.js +3 -16
- package/dist/init/index.js.map +1 -1
- package/dist/init-CQPFmOOe.js +325 -0
- package/dist/init-CQPFmOOe.js.map +1 -0
- package/dist/instrumentation/index.d.ts +3 -4
- package/dist/instrumentation/index.js +5 -5
- package/dist/instrumentation/index.js.map +1 -1
- package/dist/instrumentation-xkkmDgJ0.js +1678 -0
- package/dist/instrumentation-xkkmDgJ0.js.map +1 -0
- package/dist/lake/index.d.ts +50 -54
- package/dist/lake/index.js +169 -193
- package/dist/lake/index.js.map +1 -1
- package/dist/layer/index.d.ts +3 -2
- package/dist/layer/index.js +4 -5
- package/dist/layer/index.js.map +1 -1
- package/dist/layer-BZBZZWeV.d.ts +69 -0
- package/dist/layer-Bcix-WCl.js +105 -0
- package/dist/layer-Bcix-WCl.js.map +1 -0
- package/dist/layer-CEKy6cm8.js +252 -0
- package/dist/layer-CEKy6cm8.js.map +1 -0
- package/dist/lifecycle/index.d.ts +2 -1
- package/dist/lifecycle/index.js +3 -4
- package/dist/lifecycle/index.js.map +1 -1
- package/dist/lifecycle-DeoLSX0U.js +76 -0
- package/dist/lifecycle-DeoLSX0U.js.map +1 -0
- package/dist/logger/index.d.ts +2 -3
- package/dist/logger/index.js +3 -3
- package/dist/logger/index.js.map +1 -1
- package/dist/logger-B6rCpb7D.js +290 -0
- package/dist/logger-B6rCpb7D.js.map +1 -0
- package/dist/metrics/index.d.ts +13 -14
- package/dist/metrics/index.js +3 -4
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics-BrLwNUrb.js +52 -0
- package/dist/metrics-BrLwNUrb.js.map +1 -0
- package/dist/metrics-collector-C2eShrlW.js +922 -0
- package/dist/metrics-collector-C2eShrlW.js.map +1 -0
- package/dist/middleware/index.d.ts +3 -3
- package/dist/middleware/index.js +3 -4
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware-CUxJVUpD.js +1243 -0
- package/dist/middleware-CUxJVUpD.js.map +1 -0
- package/dist/middleware-Cq0zFMGp.js +253 -0
- package/dist/middleware-Cq0zFMGp.js.map +1 -0
- package/dist/notifications/index.d.ts +2 -5
- package/dist/notifications/index.js +3 -6
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications-DY_i37WN.js +869 -0
- package/dist/notifications-DY_i37WN.js.map +1 -0
- package/dist/observability/index.d.ts +2 -3
- package/dist/observability/index.js +3 -4
- package/dist/observability/index.js.map +1 -1
- package/dist/observability-DBDXipTU.js +272 -0
- package/dist/observability-DBDXipTU.js.map +1 -0
- package/dist/payments/index.d.ts +144 -0
- package/dist/payments/index.js +404 -0
- package/dist/payments/index.js.map +1 -0
- package/dist/platform/index.d.ts +2 -1
- package/dist/platform/index.js +3 -5
- package/dist/platform/index.js.map +1 -1
- package/dist/platform-DZwczW7v.js +1510 -0
- package/dist/platform-DZwczW7v.js.map +1 -0
- package/dist/prisma/generator/index.d.ts +1 -1
- package/dist/prisma/generator/index.js +97 -84
- package/dist/prisma/generator/index.js.map +1 -1
- package/dist/prisma/index.d.ts +4 -7
- package/dist/prisma/index.js +5 -12
- package/dist/prisma/index.js.map +1 -1
- package/dist/prisma-BzOOdt79.js +863 -0
- package/dist/prisma-BzOOdt79.js.map +1 -0
- package/dist/prisma-extension-Cfl09swM.d.ts +172 -0
- package/dist/product-alias/index.d.ts +2 -1
- package/dist/product-alias/index.js +3 -3
- package/dist/product-alias/index.js.map +1 -1
- package/dist/product-alias-BPqtskMq.js +273 -0
- package/dist/product-alias-BPqtskMq.js.map +1 -0
- package/dist/rate-limit-CBrK_U5H.js +142 -0
- package/dist/rate-limit-CBrK_U5H.js.map +1 -0
- package/dist/rbac/index.d.ts +2 -122
- package/dist/rbac/index.js +3 -6
- package/dist/rbac/index.js.map +1 -1
- package/dist/rbac-Dvz0YzEt.js +1486 -0
- package/dist/rbac-Dvz0YzEt.js.map +1 -0
- package/dist/resource-caps/index.d.ts +66 -72
- package/dist/resource-caps/index.js +430 -5
- package/dist/resource-caps/index.js.map +1 -1
- package/dist/rolldown-runtime-ad2WFvuA.js +17 -0
- package/dist/sdk-Dju9o-sq.js +124 -0
- package/dist/sdk-Dju9o-sq.js.map +1 -0
- package/dist/search/index.d.ts +112 -0
- package/dist/search/index.js +266 -0
- package/dist/search/index.js.map +1 -0
- package/dist/security/index.d.ts +2 -0
- package/dist/security/index.js +4 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/rate-limit/index.d.ts +2 -0
- package/dist/security/rate-limit/index.js +4 -0
- package/dist/security/rate-limit/index.js.map +1 -0
- package/dist/security-DIG-95Ic.js +1647 -0
- package/dist/security-DIG-95Ic.js.map +1 -0
- package/dist/server/index.d.ts +7 -164
- package/dist/server/index.js +2001 -1507
- package/dist/server/index.js.map +1 -1
- package/dist/service-jwt-Bu-WNA_-.js +80 -0
- package/dist/service-jwt-Bu-WNA_-.js.map +1 -0
- package/dist/services-BWzfz7vG.js +102 -0
- package/dist/services-BWzfz7vG.js.map +1 -0
- package/dist/sharding/index.d.ts +41 -44
- package/dist/sharding/index.js +156 -137
- package/dist/sharding/index.js.map +1 -1
- package/dist/sharing/index.d.ts +2 -1
- package/dist/sharing/index.js +3 -4
- package/dist/sharing/index.js.map +1 -1
- package/dist/sharing-CflDsSJ-.js +911 -0
- package/dist/sharing-CflDsSJ-.js.map +1 -0
- package/dist/stub-BUnfMiAS.js +577 -0
- package/dist/stub-BUnfMiAS.js.map +1 -0
- package/dist/tags/index.d.ts +2 -3
- package/dist/tags/index.js +3 -4
- package/dist/tags/index.js.map +1 -1
- package/dist/tags-CbijgoqR.js +868 -0
- package/dist/{chunk-PBZFAAOM.js.map → tags-CbijgoqR.js.map} +1 -1
- package/dist/telemetry/index.d.ts +64 -76
- package/dist/telemetry/index.js +369 -201
- package/dist/telemetry/index.js.map +1 -1
- package/dist/temporal/index.d.ts +2 -148
- package/dist/temporal/index.js +3 -5
- package/dist/temporal/index.js.map +1 -1
- package/dist/temporal-B534uYK8.js +706 -0
- package/dist/temporal-B534uYK8.js.map +1 -0
- package/dist/tracker/index.d.ts +5 -11
- package/dist/tracker/index.js +7 -20
- package/dist/tracker/index.js.map +1 -1
- package/dist/tracker-PQztSlhJ.js +458 -0
- package/dist/tracker-PQztSlhJ.js.map +1 -0
- package/dist/translation/index.d.ts +120 -0
- package/dist/translation/index.js +573 -0
- package/dist/translation/index.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +90 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types-BYMYND1L.js +44 -0
- package/dist/types-BYMYND1L.js.map +1 -0
- package/dist/types-C6EKaS3V.d.ts +106 -0
- package/dist/types-CWybW61E.d.ts +323 -0
- package/dist/types-C_yfu3XK.d.ts +34 -0
- package/dist/types-DgaQqvxo.d.ts +70 -0
- package/dist/usage/index.d.ts +2 -213
- package/dist/usage/index.js +3 -15
- package/dist/usage/index.js.map +1 -1
- package/dist/usage-BRqVP3CJ.js +682 -0
- package/dist/usage-BRqVP3CJ.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils-DL85Tnbn.js +500 -0
- package/dist/utils-DL85Tnbn.js.map +1 -0
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +3 -3
- package/dist/validation/index.js.map +1 -1
- package/dist/validation-CPUITdMk.js +762 -0
- package/dist/validation-CPUITdMk.js.map +1 -0
- package/dist/workspace-extension-COrC0dYi.js +979 -0
- package/dist/workspace-extension-COrC0dYi.js.map +1 -0
- package/dist/{workspace-extension-BGwTOV_r.d.ts → workspace-extension-DTFTdGVF.d.ts} +43 -45
- package/package.json +7 -10
- package/dist/EventQueueFactory-GXC3A7DH.js +0 -8
- package/dist/EventQueueFactory-GXC3A7DH.js.map +0 -1
- package/dist/chunk-4XIBXZ6J.js +0 -276
- package/dist/chunk-4XIBXZ6J.js.map +0 -1
- package/dist/chunk-554Z4C2K.js +0 -1006
- package/dist/chunk-554Z4C2K.js.map +0 -1
- package/dist/chunk-5CAFHK2Z.js +0 -107
- package/dist/chunk-5CAFHK2Z.js.map +0 -1
- package/dist/chunk-63ZXJ42X.js +0 -451
- package/dist/chunk-63ZXJ42X.js.map +0 -1
- package/dist/chunk-6XEXJATV.js +0 -304
- package/dist/chunk-6XEXJATV.js.map +0 -1
- package/dist/chunk-726AR6Q7.js +0 -1532
- package/dist/chunk-726AR6Q7.js.map +0 -1
- package/dist/chunk-A5F6Z5UE.js +0 -21
- package/dist/chunk-A5F6Z5UE.js.map +0 -1
- package/dist/chunk-A6DE32ZS.js +0 -1507
- package/dist/chunk-A6DE32ZS.js.map +0 -1
- package/dist/chunk-AXJDGQPE.js +0 -690
- package/dist/chunk-AXJDGQPE.js.map +0 -1
- package/dist/chunk-BJQOGOVW.js +0 -602
- package/dist/chunk-BJQOGOVW.js.map +0 -1
- package/dist/chunk-CFXWH2IS.js +0 -52
- package/dist/chunk-CFXWH2IS.js.map +0 -1
- package/dist/chunk-DRWH5XCJ.js +0 -876
- package/dist/chunk-DRWH5XCJ.js.map +0 -1
- package/dist/chunk-E4QNLVY4.js +0 -909
- package/dist/chunk-E4QNLVY4.js.map +0 -1
- package/dist/chunk-EBDHIL7V.js +0 -774
- package/dist/chunk-EBDHIL7V.js.map +0 -1
- package/dist/chunk-ELU7VL3E.js +0 -245
- package/dist/chunk-ELU7VL3E.js.map +0 -1
- package/dist/chunk-FZRODKIN.js +0 -31
- package/dist/chunk-FZRODKIN.js.map +0 -1
- package/dist/chunk-GCIB76AJ.js +0 -882
- package/dist/chunk-GCIB76AJ.js.map +0 -1
- package/dist/chunk-HC6MPUIH.js +0 -1571
- package/dist/chunk-HC6MPUIH.js.map +0 -1
- package/dist/chunk-HNMHPSAM.js +0 -272
- package/dist/chunk-HNMHPSAM.js.map +0 -1
- package/dist/chunk-HTLEGD3Q.js +0 -1480
- package/dist/chunk-HTLEGD3Q.js.map +0 -1
- package/dist/chunk-I3KOWRT3.js +0 -89
- package/dist/chunk-I3KOWRT3.js.map +0 -1
- package/dist/chunk-ID3WR4JS.js +0 -509
- package/dist/chunk-ID3WR4JS.js.map +0 -1
- package/dist/chunk-JS52ZHTK.js +0 -1346
- package/dist/chunk-JS52ZHTK.js.map +0 -1
- package/dist/chunk-JVMAQOA3.js +0 -521
- package/dist/chunk-JVMAQOA3.js.map +0 -1
- package/dist/chunk-KH4TRQCO.js +0 -1063
- package/dist/chunk-KH4TRQCO.js.map +0 -1
- package/dist/chunk-KJOSPVB2.js +0 -57
- package/dist/chunk-KJOSPVB2.js.map +0 -1
- package/dist/chunk-KO2ZXZ7W.js +0 -61
- package/dist/chunk-KO2ZXZ7W.js.map +0 -1
- package/dist/chunk-KS2HQCJR.js +0 -56
- package/dist/chunk-KS2HQCJR.js.map +0 -1
- package/dist/chunk-LA5KPWZ2.js +0 -413
- package/dist/chunk-LA5KPWZ2.js.map +0 -1
- package/dist/chunk-MESLAC5W.js +0 -574
- package/dist/chunk-MESLAC5W.js.map +0 -1
- package/dist/chunk-MWPYA2HD.js +0 -94
- package/dist/chunk-MWPYA2HD.js.map +0 -1
- package/dist/chunk-NUB5GQTU.js +0 -270
- package/dist/chunk-NUB5GQTU.js.map +0 -1
- package/dist/chunk-OBBCR6WY.js +0 -277
- package/dist/chunk-OBBCR6WY.js.map +0 -1
- package/dist/chunk-OQDSAOG3.js +0 -1908
- package/dist/chunk-OQDSAOG3.js.map +0 -1
- package/dist/chunk-OXNCBE7P.js +0 -971
- package/dist/chunk-OXNCBE7P.js.map +0 -1
- package/dist/chunk-PBZFAAOM.js +0 -941
- package/dist/chunk-PN6GIF3R.js +0 -1185
- package/dist/chunk-PN6GIF3R.js.map +0 -1
- package/dist/chunk-PYD44IHJ.js +0 -728
- package/dist/chunk-PYD44IHJ.js.map +0 -1
- package/dist/chunk-QVPIACWD.js +0 -679
- package/dist/chunk-QVPIACWD.js.map +0 -1
- package/dist/chunk-QWNNFE4P.js +0 -41
- package/dist/chunk-QWNNFE4P.js.map +0 -1
- package/dist/chunk-RU266375.js +0 -327
- package/dist/chunk-RU266375.js.map +0 -1
- package/dist/chunk-RYTSVGGA.js +0 -1624
- package/dist/chunk-RYTSVGGA.js.map +0 -1
- package/dist/chunk-RZOFS2BQ.js +0 -225
- package/dist/chunk-RZOFS2BQ.js.map +0 -1
- package/dist/chunk-SBS4S2PJ.js +0 -100
- package/dist/chunk-SBS4S2PJ.js.map +0 -1
- package/dist/chunk-SPRG6G6G.js +0 -530
- package/dist/chunk-SPRG6G6G.js.map +0 -1
- package/dist/chunk-STWFX5E2.js +0 -233
- package/dist/chunk-STWFX5E2.js.map +0 -1
- package/dist/chunk-UNASM5VJ.js +0 -419
- package/dist/chunk-UNASM5VJ.js.map +0 -1
- package/dist/chunk-VAT66FJA.js +0 -245
- package/dist/chunk-VAT66FJA.js.map +0 -1
- package/dist/chunk-VFCMR5GX.js +0 -49
- package/dist/chunk-VFCMR5GX.js.map +0 -1
- package/dist/chunk-VGAHZKNJ.js +0 -66
- package/dist/chunk-VGAHZKNJ.js.map +0 -1
- package/dist/chunk-VTJTAAXC.js +0 -627
- package/dist/chunk-VTJTAAXC.js.map +0 -1
- package/dist/chunk-VXVLKRU6.js +0 -758
- package/dist/chunk-VXVLKRU6.js.map +0 -1
- package/dist/chunk-WWUU5ETI.js +0 -163
- package/dist/chunk-WWUU5ETI.js.map +0 -1
- package/dist/chunk-XE4OXN2W.js +0 -10
- package/dist/chunk-XE4OXN2W.js.map +0 -1
- package/dist/chunk-XOJORS75.js +0 -1853
- package/dist/chunk-XOJORS75.js.map +0 -1
- package/dist/chunk-YMZEUTD2.js +0 -110
- package/dist/chunk-YMZEUTD2.js.map +0 -1
- package/dist/chunk-Z77BTSOK.js +0 -617
- package/dist/chunk-Z77BTSOK.js.map +0 -1
- package/dist/chunk-ZZK3WEDI.js +0 -181
- package/dist/chunk-ZZK3WEDI.js.map +0 -1
- package/dist/client-CCXpAZ2r.d.ts +0 -89
- package/dist/client-DSI_760t.d.ts +0 -36
- package/dist/client-JU6T3UPB.js +0 -11
- package/dist/client-JU6T3UPB.js.map +0 -1
- package/dist/dist-2X4Q7PJA.js +0 -1491
- package/dist/dist-2X4Q7PJA.js.map +0 -1
- package/dist/env-4UWSUS64.js +0 -4
- package/dist/env-4UWSUS64.js.map +0 -1
- package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
- package/dist/graphql-CMHMQjvd.d.ts +0 -23
- package/dist/i18n-Qm2AkPC-.d.ts +0 -33
- package/dist/index--yvpa6ay.d.ts +0 -83
- package/dist/index-4gKQKZ2B.d.ts +0 -71
- package/dist/index-5x0XMKXN.d.ts +0 -149
- package/dist/index-B70b5mYS.d.ts +0 -33
- package/dist/index-B8KrxO4j.d.ts +0 -755
- package/dist/index-BOuDKnqD.d.ts +0 -201
- package/dist/index-BTMt4OjA.d.ts +0 -201
- package/dist/index-BejbszA7.d.ts +0 -39
- package/dist/index-BkeOYZye.d.ts +0 -198
- package/dist/index-BuAj5nXg.d.ts +0 -83
- package/dist/index-BvkVcW8I.d.ts +0 -349
- package/dist/index-CWmH_-RZ.d.ts +0 -247
- package/dist/index-CbgWNcus.d.ts +0 -258
- package/dist/index-CmfPeQza.d.ts +0 -166
- package/dist/index-CmpG-zak.d.ts +0 -607
- package/dist/index-CoMKgL-p.d.ts +0 -12
- package/dist/index-D8HGwglK.d.ts +0 -541
- package/dist/index-DCaVm66D.d.ts +0 -1101
- package/dist/index-DE2w7E0d.d.ts +0 -83
- package/dist/index-DSOpj8DI.d.ts +0 -17
- package/dist/index-DW9q22GH.d.ts +0 -75
- package/dist/index-DnjJ9CwI.d.ts +0 -347
- package/dist/index-DwMJZ8PP.d.ts +0 -317
- package/dist/index-PaojfSdd.d.ts +0 -71
- package/dist/index-aHtYvc3i.d.ts +0 -284
- package/dist/index-e_18DzAg.d.ts +0 -18
- package/dist/index-ffmipXSA.d.ts +0 -55
- package/dist/index-joONjwLt.d.ts +0 -33
- package/dist/index-kssw5ziY.d.ts +0 -250
- package/dist/index-lFffh5-G.d.ts +0 -125
- package/dist/index-pxYge_6k.d.ts +0 -79
- package/dist/layer-Cv9vSwBx.d.ts +0 -70
- package/dist/pino-logger-H4HPW5P6.js +0 -5
- package/dist/pino-logger-H4HPW5P6.js.map +0 -1
- package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
- package/dist/sdk-L75WWUP3.js +0 -156
- package/dist/sdk-L75WWUP3.js.map +0 -1
- package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
- package/dist/types-Bo2wkjSP.d.ts +0 -35
- package/dist/types-DVpvrAhd.d.ts +0 -71
- package/dist/types-DgJ4lDYA.d.ts +0 -108
- package/dist/types-USOv09qy.d.ts +0 -327
- package/dist/workspace-guard-NXVYYBVJ.js +0 -5
- package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
package/dist/chunk-QVPIACWD.js
DELETED
|
@@ -1,679 +0,0 @@
|
|
|
1
|
-
import { GatewayClient } from './chunk-SPRG6G6G.js';
|
|
2
|
-
import { SDKError, ValidationError, QuotaExceededError } from './chunk-I3KOWRT3.js';
|
|
3
|
-
import { logger } from './chunk-RU266375.js';
|
|
4
|
-
import { __name } from './chunk-XE4OXN2W.js';
|
|
5
|
-
import { randomUUID } from 'crypto';
|
|
6
|
-
|
|
7
|
-
// src/usage/billing.ts
|
|
8
|
-
var DEFAULT_REQUEST_TIMEOUT_MS = 5e3;
|
|
9
|
-
var DEFAULT_QUOTA_LIMIT_CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
10
|
-
var QUOTA_LIMIT_CACHE_MAX_ENTRIES = 1e3;
|
|
11
|
-
var GET_WORKSPACE_ORG_QUERY = `
|
|
12
|
-
query GetWorkspaceOrg($workspaceId: ID!) {
|
|
13
|
-
workspace(id: $workspaceId) {
|
|
14
|
-
orgId
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
var GET_DEFAULT_BILLING_ACCOUNT_QUERY = `
|
|
19
|
-
query GetDefaultBillingAccount($orgId: ID!) {
|
|
20
|
-
getDefaultBillingAccountByOrgId(orgId: $orgId) {
|
|
21
|
-
id
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
`;
|
|
25
|
-
var CHECK_QUOTA_QUERY = `
|
|
26
|
-
query CheckQuotaExhausted($billingAccountId: ID!, $quotaName: String!, $productId: String) {
|
|
27
|
-
checkQuotaExhausted(
|
|
28
|
-
billingAccountId: $billingAccountId
|
|
29
|
-
quotaName: $quotaName
|
|
30
|
-
productId: $productId
|
|
31
|
-
) {
|
|
32
|
-
limitLeft
|
|
33
|
-
noLimit
|
|
34
|
-
quotaAssignmentId
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`;
|
|
38
|
-
var ADD_USAGE_MUTATION = `
|
|
39
|
-
mutation AddUsage(
|
|
40
|
-
$billingAccountId: ID!
|
|
41
|
-
$quotaName: String!
|
|
42
|
-
$value: Int!
|
|
43
|
-
$description: String!
|
|
44
|
-
$tags: JSON
|
|
45
|
-
$hash: String
|
|
46
|
-
$userId: ID
|
|
47
|
-
$productId: String
|
|
48
|
-
) {
|
|
49
|
-
addUsage(
|
|
50
|
-
billingAccountId: $billingAccountId
|
|
51
|
-
quotaName: $quotaName
|
|
52
|
-
value: $value
|
|
53
|
-
description: $description
|
|
54
|
-
tags: $tags
|
|
55
|
-
hash: $hash
|
|
56
|
-
userId: $userId
|
|
57
|
-
productId: $productId
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
61
|
-
var GET_QUOTA_LIMIT_QUERY = `
|
|
62
|
-
query GetQuotaLimit($billingAccountId: ID!, $quotaName: String!, $productId: String) {
|
|
63
|
-
getQuotaUsageAndLimit(
|
|
64
|
-
billingAccountId: $billingAccountId
|
|
65
|
-
quotaName: $quotaName
|
|
66
|
-
productId: $productId
|
|
67
|
-
) {
|
|
68
|
-
limit
|
|
69
|
-
noLimit
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
var FREE_UP_USAGE_MUTATION = `
|
|
74
|
-
mutation FreeUpUsage(
|
|
75
|
-
$billingAccountId: ID!
|
|
76
|
-
$quotaName: String!
|
|
77
|
-
$value: Int!
|
|
78
|
-
$description: String
|
|
79
|
-
$tags: JSON
|
|
80
|
-
$hash: String
|
|
81
|
-
$userId: ID
|
|
82
|
-
$productId: String
|
|
83
|
-
) {
|
|
84
|
-
freeUpUsage(
|
|
85
|
-
billingAccountId: $billingAccountId
|
|
86
|
-
quotaName: $quotaName
|
|
87
|
-
value: $value
|
|
88
|
-
description: $description
|
|
89
|
-
tags: $tags
|
|
90
|
-
hash: $hash
|
|
91
|
-
userId: $userId
|
|
92
|
-
productId: $productId
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
`;
|
|
96
|
-
function unwrap(data) {
|
|
97
|
-
if (!data) {
|
|
98
|
-
throw new Error("GraphQL response did not include data");
|
|
99
|
-
}
|
|
100
|
-
return data;
|
|
101
|
-
}
|
|
102
|
-
__name(unwrap, "unwrap");
|
|
103
|
-
var BillingUsageClient = class {
|
|
104
|
-
static {
|
|
105
|
-
__name(this, "BillingUsageClient");
|
|
106
|
-
}
|
|
107
|
-
gatewayClient;
|
|
108
|
-
quotaLimitCacheTtlMs;
|
|
109
|
-
logPrefix;
|
|
110
|
-
// In-process cache for plan limits (changes at most when a workspace
|
|
111
|
-
// upgrades their plan). Lazily pruned on access — no timers in a library.
|
|
112
|
-
quotaLimitCache = /* @__PURE__ */ new Map();
|
|
113
|
-
constructor(config) {
|
|
114
|
-
if (!config.serviceName) {
|
|
115
|
-
throw new TypeError("BillingUsageClient requires a serviceName");
|
|
116
|
-
}
|
|
117
|
-
this.gatewayClient = config.gatewayClient ?? new GatewayClient({
|
|
118
|
-
layer: "wspace",
|
|
119
|
-
serviceName: config.serviceName,
|
|
120
|
-
timeout: config.timeout ?? DEFAULT_REQUEST_TIMEOUT_MS
|
|
121
|
-
});
|
|
122
|
-
this.quotaLimitCacheTtlMs = config.quotaLimitCacheTtlMs ?? DEFAULT_QUOTA_LIMIT_CACHE_TTL_MS;
|
|
123
|
-
this.logPrefix = `[billing-usage:${config.serviceName}]`;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Same-layer (wspace -> wspace) internal-gateway call.
|
|
127
|
-
*/
|
|
128
|
-
async queryWorkspaceLayer(query, variables, workspaceId) {
|
|
129
|
-
const response = await this.gatewayClient.internalQuery({
|
|
130
|
-
query,
|
|
131
|
-
variables,
|
|
132
|
-
headers: {
|
|
133
|
-
"x-workspace-id": workspaceId
|
|
134
|
-
},
|
|
135
|
-
// Blocking on the create path — keep it single-shot & snappy; consumers fail open.
|
|
136
|
-
skipRetry: true
|
|
137
|
-
});
|
|
138
|
-
return unwrap(response.data);
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Cross-layer (wspace -> global) public-gateway call. No actor headers — the
|
|
142
|
-
* signed service JWT carries identity; adding `x-actor-id` would 403.
|
|
143
|
-
*/
|
|
144
|
-
async queryGlobalLayer(query, variables) {
|
|
145
|
-
const response = await this.gatewayClient.crossLayerQuery({
|
|
146
|
-
query,
|
|
147
|
-
variables
|
|
148
|
-
});
|
|
149
|
-
return unwrap(response.data);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Resolve the organization that owns a workspace. Fails open (`null`).
|
|
153
|
-
*/
|
|
154
|
-
async getOrgIdFromWorkspace(workspaceId) {
|
|
155
|
-
try {
|
|
156
|
-
const data = await this.queryWorkspaceLayer(GET_WORKSPACE_ORG_QUERY, {
|
|
157
|
-
workspaceId
|
|
158
|
-
}, workspaceId);
|
|
159
|
-
return data.workspace?.orgId ?? null;
|
|
160
|
-
} catch (error) {
|
|
161
|
-
logger.warn(`${this.logPrefix} Failed to resolve workspace org`, {
|
|
162
|
-
workspaceId,
|
|
163
|
-
error: error instanceof Error ? error.message : String(error)
|
|
164
|
-
});
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Resolve the default billing account for an organization via the global
|
|
170
|
-
* layer. Fails open (`null`).
|
|
171
|
-
*/
|
|
172
|
-
async getDefaultBillingAccountId(orgId) {
|
|
173
|
-
try {
|
|
174
|
-
const data = await this.queryGlobalLayer(GET_DEFAULT_BILLING_ACCOUNT_QUERY, {
|
|
175
|
-
orgId
|
|
176
|
-
});
|
|
177
|
-
return data.getDefaultBillingAccountByOrgId?.id ?? null;
|
|
178
|
-
} catch (error) {
|
|
179
|
-
logger.warn(`${this.logPrefix} Failed to resolve default billing account`, {
|
|
180
|
-
orgId,
|
|
181
|
-
error: error instanceof Error ? error.message : String(error)
|
|
182
|
-
});
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Check that an organization still has quota headroom for `value` units of
|
|
188
|
-
* `quotaName`. Returns `false` when no billing account exists or the quota
|
|
189
|
-
* is exhausted; rethrows nothing — transport errors propagate to the caller
|
|
190
|
-
* of this low-level variant (the workspace variant fails open instead).
|
|
191
|
-
*/
|
|
192
|
-
async ensureQuotaAvailableForOrg(input) {
|
|
193
|
-
const billingAccountId = await this.getDefaultBillingAccountId(input.orgId);
|
|
194
|
-
if (!billingAccountId) {
|
|
195
|
-
logger.warn(`${this.logPrefix} No billing account available for org quota check`, {
|
|
196
|
-
orgId: input.orgId,
|
|
197
|
-
quotaName: input.quotaName
|
|
198
|
-
});
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
const amount = input.value ?? 1;
|
|
202
|
-
const data = await this.queryGlobalLayer(CHECK_QUOTA_QUERY, {
|
|
203
|
-
billingAccountId,
|
|
204
|
-
quotaName: input.quotaName,
|
|
205
|
-
productId: input.productId
|
|
206
|
-
});
|
|
207
|
-
const result = data.checkQuotaExhausted;
|
|
208
|
-
if (!result) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
if (result.noLimit) {
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
return result.limitLeft >= amount;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Workspace-addressed quota gate: resolves the org, then applies
|
|
218
|
-
* {@link ensureQuotaAvailableForOrg}. Fails OPEN (`true`) when org
|
|
219
|
-
* resolution fails (unbilled / dev / internal workspaces) so local-stack
|
|
220
|
-
* test workspaces and workspaces with a transiently broken tenant lookup
|
|
221
|
-
* are never locked out; real limits only kick in when the workspace has a
|
|
222
|
-
* billable org.
|
|
223
|
-
*/
|
|
224
|
-
async ensureQuotaAvailableForWorkspace(input) {
|
|
225
|
-
const orgId = await this.getOrgIdFromWorkspace(input.workspaceId);
|
|
226
|
-
if (!orgId) {
|
|
227
|
-
logger.warn(`${this.logPrefix} No organization available; allowing quota op (fail-open)`, {
|
|
228
|
-
workspaceId: input.workspaceId,
|
|
229
|
-
quotaName: input.quotaName
|
|
230
|
-
});
|
|
231
|
-
return true;
|
|
232
|
-
}
|
|
233
|
-
return this.ensureQuotaAvailableForOrg({
|
|
234
|
-
...input,
|
|
235
|
-
orgId
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Record usage against an organization's billing account. No-ops (`false`)
|
|
240
|
-
* when there is no billing account.
|
|
241
|
-
*/
|
|
242
|
-
async addUsageForOrg(input) {
|
|
243
|
-
const billingAccountId = await this.getDefaultBillingAccountId(input.orgId);
|
|
244
|
-
if (!billingAccountId) {
|
|
245
|
-
logger.warn(`${this.logPrefix} No billing account available for addUsage`, {
|
|
246
|
-
orgId: input.orgId,
|
|
247
|
-
quotaName: input.quotaName
|
|
248
|
-
});
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
const data = await this.queryGlobalLayer(ADD_USAGE_MUTATION, {
|
|
252
|
-
billingAccountId,
|
|
253
|
-
quotaName: input.quotaName,
|
|
254
|
-
value: input.value ?? 1,
|
|
255
|
-
description: input.description,
|
|
256
|
-
tags: input.tags,
|
|
257
|
-
hash: input.hash,
|
|
258
|
-
userId: input.userId,
|
|
259
|
-
productId: input.productId
|
|
260
|
-
});
|
|
261
|
-
return data.addUsage ?? false;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Workspace-addressed {@link addUsageForOrg}. No-ops (`false`) when the
|
|
265
|
-
* workspace has no org.
|
|
266
|
-
*/
|
|
267
|
-
async addUsageForWorkspace(input) {
|
|
268
|
-
const orgId = await this.getOrgIdFromWorkspace(input.workspaceId);
|
|
269
|
-
if (!orgId) {
|
|
270
|
-
logger.warn(`${this.logPrefix} No organization available for workspace addUsage`, {
|
|
271
|
-
workspaceId: input.workspaceId,
|
|
272
|
-
quotaName: input.quotaName
|
|
273
|
-
});
|
|
274
|
-
return false;
|
|
275
|
-
}
|
|
276
|
-
return this.addUsageForOrg({
|
|
277
|
-
...input,
|
|
278
|
-
orgId
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Credit usage back to an organization's billing account. No-ops (`false`)
|
|
283
|
-
* when there is no billing account.
|
|
284
|
-
*/
|
|
285
|
-
async freeUpUsageForOrg(input) {
|
|
286
|
-
const billingAccountId = await this.getDefaultBillingAccountId(input.orgId);
|
|
287
|
-
if (!billingAccountId) {
|
|
288
|
-
logger.warn(`${this.logPrefix} No billing account available for freeUpUsage`, {
|
|
289
|
-
orgId: input.orgId,
|
|
290
|
-
quotaName: input.quotaName
|
|
291
|
-
});
|
|
292
|
-
return false;
|
|
293
|
-
}
|
|
294
|
-
const data = await this.queryGlobalLayer(FREE_UP_USAGE_MUTATION, {
|
|
295
|
-
billingAccountId,
|
|
296
|
-
quotaName: input.quotaName,
|
|
297
|
-
value: input.value ?? 1,
|
|
298
|
-
description: input.description,
|
|
299
|
-
tags: input.tags,
|
|
300
|
-
hash: input.hash,
|
|
301
|
-
userId: input.userId,
|
|
302
|
-
productId: input.productId
|
|
303
|
-
});
|
|
304
|
-
return data.freeUpUsage ?? false;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Workspace-addressed {@link freeUpUsageForOrg}. No-ops (`false`) when the
|
|
308
|
-
* workspace has no org.
|
|
309
|
-
*/
|
|
310
|
-
async freeUpUsageForWorkspace(input) {
|
|
311
|
-
const orgId = await this.getOrgIdFromWorkspace(input.workspaceId);
|
|
312
|
-
if (!orgId) {
|
|
313
|
-
logger.warn(`${this.logPrefix} No organization available for workspace freeUpUsage`, {
|
|
314
|
-
workspaceId: input.workspaceId,
|
|
315
|
-
quotaName: input.quotaName
|
|
316
|
-
});
|
|
317
|
-
return false;
|
|
318
|
-
}
|
|
319
|
-
return this.freeUpUsageForOrg({
|
|
320
|
-
...input,
|
|
321
|
-
orgId
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Fetch the plan limit for a quota from billing-svc, bypassing billing's
|
|
326
|
-
* internal usage counter (the caller's own DB is the source of truth for
|
|
327
|
-
* current usage; billing only stores the plan maximum). Results are cached
|
|
328
|
-
* in-process per workspace/quota/product. Fails open (`null`) when billing
|
|
329
|
-
* is unreachable so dev/test workspaces without billing accounts are never
|
|
330
|
-
* blocked.
|
|
331
|
-
*/
|
|
332
|
-
async getQuotaLimitForWorkspace(workspaceId, quotaName, productId) {
|
|
333
|
-
const cacheKey = `${workspaceId}:${quotaName}:${productId}`;
|
|
334
|
-
const cached = this.quotaLimitCache.get(cacheKey);
|
|
335
|
-
if (cached && cached.expiresAt > Date.now()) {
|
|
336
|
-
return {
|
|
337
|
-
limit: cached.limit,
|
|
338
|
-
noLimit: cached.noLimit
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
const orgId = await this.getOrgIdFromWorkspace(workspaceId);
|
|
342
|
-
if (!orgId) {
|
|
343
|
-
logger.warn(`${this.logPrefix} No org found for quota limit lookup; failing open`, {
|
|
344
|
-
workspaceId,
|
|
345
|
-
quotaName
|
|
346
|
-
});
|
|
347
|
-
return null;
|
|
348
|
-
}
|
|
349
|
-
const billingAccountId = await this.getDefaultBillingAccountId(orgId);
|
|
350
|
-
if (!billingAccountId) {
|
|
351
|
-
logger.warn(`${this.logPrefix} No billing account found for quota limit lookup; failing open`, {
|
|
352
|
-
workspaceId,
|
|
353
|
-
quotaName
|
|
354
|
-
});
|
|
355
|
-
return null;
|
|
356
|
-
}
|
|
357
|
-
try {
|
|
358
|
-
const data = await this.queryGlobalLayer(GET_QUOTA_LIMIT_QUERY, {
|
|
359
|
-
billingAccountId,
|
|
360
|
-
quotaName,
|
|
361
|
-
productId
|
|
362
|
-
});
|
|
363
|
-
const result = data.getQuotaUsageAndLimit;
|
|
364
|
-
if (!result) {
|
|
365
|
-
return null;
|
|
366
|
-
}
|
|
367
|
-
this.rememberQuotaLimit(cacheKey, {
|
|
368
|
-
limit: result.limit,
|
|
369
|
-
noLimit: result.noLimit
|
|
370
|
-
});
|
|
371
|
-
return {
|
|
372
|
-
limit: result.limit,
|
|
373
|
-
noLimit: result.noLimit
|
|
374
|
-
};
|
|
375
|
-
} catch (error) {
|
|
376
|
-
logger.warn(`${this.logPrefix} Failed to fetch quota limit; failing open`, {
|
|
377
|
-
workspaceId,
|
|
378
|
-
quotaName,
|
|
379
|
-
error: error instanceof Error ? error.message : String(error)
|
|
380
|
-
});
|
|
381
|
-
return null;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
rememberQuotaLimit(cacheKey, value) {
|
|
385
|
-
if (this.quotaLimitCache.size >= QUOTA_LIMIT_CACHE_MAX_ENTRIES) {
|
|
386
|
-
const now = Date.now();
|
|
387
|
-
for (const [key, entry] of this.quotaLimitCache) {
|
|
388
|
-
if (entry.expiresAt <= now) this.quotaLimitCache.delete(key);
|
|
389
|
-
}
|
|
390
|
-
if (this.quotaLimitCache.size >= QUOTA_LIMIT_CACHE_MAX_ENTRIES) {
|
|
391
|
-
const overflow = this.quotaLimitCache.size - QUOTA_LIMIT_CACHE_MAX_ENTRIES + 1;
|
|
392
|
-
let removed = 0;
|
|
393
|
-
for (const key of this.quotaLimitCache.keys()) {
|
|
394
|
-
this.quotaLimitCache.delete(key);
|
|
395
|
-
removed += 1;
|
|
396
|
-
if (removed >= overflow) break;
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
this.quotaLimitCache.set(cacheKey, {
|
|
401
|
-
...value,
|
|
402
|
-
expiresAt: Date.now() + this.quotaLimitCacheTtlMs
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
};
|
|
406
|
-
|
|
407
|
-
// src/usage/index.ts
|
|
408
|
-
var UsageMetricType = /* @__PURE__ */ (function(UsageMetricType2) {
|
|
409
|
-
UsageMetricType2["API_CALLS"] = "api_calls";
|
|
410
|
-
UsageMetricType2["STORAGE"] = "storage";
|
|
411
|
-
UsageMetricType2["BANDWIDTH"] = "bandwidth";
|
|
412
|
-
UsageMetricType2["USERS"] = "users";
|
|
413
|
-
UsageMetricType2["PROJECTS"] = "projects";
|
|
414
|
-
UsageMetricType2["WORKSPACES"] = "workspaces";
|
|
415
|
-
UsageMetricType2["RECORDS"] = "records";
|
|
416
|
-
UsageMetricType2["COMPUTE_TIME"] = "compute_time";
|
|
417
|
-
UsageMetricType2["TRANSACTIONS"] = "transactions";
|
|
418
|
-
UsageMetricType2["CUSTOM"] = "custom";
|
|
419
|
-
return UsageMetricType2;
|
|
420
|
-
})({});
|
|
421
|
-
var QuotaPeriod = /* @__PURE__ */ (function(QuotaPeriod2) {
|
|
422
|
-
QuotaPeriod2["DAILY"] = "daily";
|
|
423
|
-
QuotaPeriod2["WEEKLY"] = "weekly";
|
|
424
|
-
QuotaPeriod2["MONTHLY"] = "monthly";
|
|
425
|
-
QuotaPeriod2["YEARLY"] = "yearly";
|
|
426
|
-
QuotaPeriod2["LIFETIME"] = "lifetime";
|
|
427
|
-
return QuotaPeriod2;
|
|
428
|
-
})({});
|
|
429
|
-
var UsageOperationUnsupportedError = class _UsageOperationUnsupportedError extends SDKError {
|
|
430
|
-
static {
|
|
431
|
-
__name(this, "UsageOperationUnsupportedError");
|
|
432
|
-
}
|
|
433
|
-
constructor(operation, guidance) {
|
|
434
|
-
super(`UsageModule.${operation} is not supported by the workspace usage owner: ${guidance}`, "USAGE_OPERATION_UNSUPPORTED", {
|
|
435
|
-
operation
|
|
436
|
-
});
|
|
437
|
-
this.name = "UsageOperationUnsupportedError";
|
|
438
|
-
Object.setPrototypeOf(this, _UsageOperationUnsupportedError.prototype);
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
var CHECK_WORKSPACE_QUOTA_QUERY = `
|
|
442
|
-
query CheckWorkspaceQuota($workspaceId: ID!, $quotaName: String!, $amount: Float) {
|
|
443
|
-
checkWorkspaceQuota(workspaceId: $workspaceId, quotaName: $quotaName, amount: $amount) {
|
|
444
|
-
allowed
|
|
445
|
-
assignmentId
|
|
446
|
-
limitLeft
|
|
447
|
-
noLimit
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
`;
|
|
451
|
-
var TRACK_USAGE_MUTATION = `
|
|
452
|
-
mutation TrackUsage($input: TrackUsageInput!) {
|
|
453
|
-
trackUsage(input: $input)
|
|
454
|
-
}
|
|
455
|
-
`;
|
|
456
|
-
function legacyGuidance(replacement) {
|
|
457
|
-
return `quotas are addressed by quotaName on the workspace usage owner; use ${replacement}`;
|
|
458
|
-
}
|
|
459
|
-
__name(legacyGuidance, "legacyGuidance");
|
|
460
|
-
function nonEmpty(value) {
|
|
461
|
-
const trimmed = value?.trim();
|
|
462
|
-
return trimmed ? trimmed : void 0;
|
|
463
|
-
}
|
|
464
|
-
__name(nonEmpty, "nonEmpty");
|
|
465
|
-
function buildTrackUsageInput(options, context = {}) {
|
|
466
|
-
const quotaName = nonEmpty(options.quotaName);
|
|
467
|
-
if (!quotaName) {
|
|
468
|
-
throw new ValidationError("Quota name is required");
|
|
469
|
-
}
|
|
470
|
-
const productId = nonEmpty(options.productId) ?? nonEmpty(context.productId);
|
|
471
|
-
if (!productId) {
|
|
472
|
-
throw new ValidationError("Product ID is required");
|
|
473
|
-
}
|
|
474
|
-
const description = nonEmpty(options.description);
|
|
475
|
-
if (!description) {
|
|
476
|
-
throw new ValidationError("Description is required");
|
|
477
|
-
}
|
|
478
|
-
if (typeof options.amount !== "number" || !Number.isFinite(options.amount) || options.amount === 0) {
|
|
479
|
-
throw new ValidationError("Amount must be a finite, non-zero number");
|
|
480
|
-
}
|
|
481
|
-
const workspaceId = nonEmpty(options.workspaceId) ?? nonEmpty(context.workspaceId);
|
|
482
|
-
if (!workspaceId) {
|
|
483
|
-
throw new ValidationError("Workspace ID is required");
|
|
484
|
-
}
|
|
485
|
-
const input = {
|
|
486
|
-
quotaName,
|
|
487
|
-
productId,
|
|
488
|
-
amount: options.amount,
|
|
489
|
-
description,
|
|
490
|
-
workspaceId,
|
|
491
|
-
hash: nonEmpty(options.hash) ?? `sdk-usage:${randomUUID()}`
|
|
492
|
-
};
|
|
493
|
-
const userId = nonEmpty(options.userId) ?? nonEmpty(context.actorId);
|
|
494
|
-
if (userId) input["userId"] = userId;
|
|
495
|
-
if (options.quotaAssignmentId) input["quotaAssignmentId"] = options.quotaAssignmentId;
|
|
496
|
-
if (options.billingAccountId) input["billingAccountId"] = options.billingAccountId;
|
|
497
|
-
if (options.metadata) input["metadata"] = options.metadata;
|
|
498
|
-
return input;
|
|
499
|
-
}
|
|
500
|
-
__name(buildTrackUsageInput, "buildTrackUsageInput");
|
|
501
|
-
var UsageModule = class {
|
|
502
|
-
static {
|
|
503
|
-
__name(this, "UsageModule");
|
|
504
|
-
}
|
|
505
|
-
client;
|
|
506
|
-
context;
|
|
507
|
-
constructor(client, context) {
|
|
508
|
-
this.client = client;
|
|
509
|
-
this.context = context;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Context for one owner call: relayed as a platform service acting for `userId`, with the
|
|
513
|
-
* quota's workspace in scope. The owner takes the workspace from this context, never from
|
|
514
|
-
* the input, and only lets services release (decrement) usage.
|
|
515
|
-
*/
|
|
516
|
-
requestContext(workspaceId, userId) {
|
|
517
|
-
const actorId = userId ?? this.context.actorId;
|
|
518
|
-
return {
|
|
519
|
-
...this.context,
|
|
520
|
-
...actorId ? {
|
|
521
|
-
actorId
|
|
522
|
-
} : {},
|
|
523
|
-
actorType: "service",
|
|
524
|
-
workspaceId
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Check whether a workspace quota has capacity for `amount` (default 1).
|
|
529
|
-
*/
|
|
530
|
-
async checkWorkspaceQuota(options) {
|
|
531
|
-
const quotaName = nonEmpty(options.quotaName);
|
|
532
|
-
if (!quotaName) {
|
|
533
|
-
throw new ValidationError("Quota name is required");
|
|
534
|
-
}
|
|
535
|
-
const amount = options.amount ?? 1;
|
|
536
|
-
if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0) {
|
|
537
|
-
throw new ValidationError("Quota checks need a positive amount");
|
|
538
|
-
}
|
|
539
|
-
const workspaceId = nonEmpty(options.workspaceId) ?? nonEmpty(this.context.workspaceId);
|
|
540
|
-
if (!workspaceId) {
|
|
541
|
-
throw new ValidationError("Workspace ID is required");
|
|
542
|
-
}
|
|
543
|
-
logger.debug("[Usage] Checking workspace quota", {
|
|
544
|
-
workspaceId,
|
|
545
|
-
quotaName,
|
|
546
|
-
amount
|
|
547
|
-
});
|
|
548
|
-
const response = await this.client.query(CHECK_WORKSPACE_QUOTA_QUERY, {
|
|
549
|
-
workspaceId,
|
|
550
|
-
quotaName,
|
|
551
|
-
amount
|
|
552
|
-
}, this.requestContext(workspaceId, nonEmpty(options.userId)));
|
|
553
|
-
const result = response.checkWorkspaceQuota;
|
|
554
|
-
logger.debug("[Usage] Workspace quota check result", {
|
|
555
|
-
workspaceId,
|
|
556
|
-
quotaName,
|
|
557
|
-
allowed: result.allowed
|
|
558
|
-
});
|
|
559
|
-
return result;
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Check a workspace quota and throw {@link QuotaExceededError} when it has no capacity.
|
|
563
|
-
* Returns the check result so the caller can pass `assignmentId` to {@link trackUsage}.
|
|
564
|
-
*/
|
|
565
|
-
async requireWorkspaceQuota(options) {
|
|
566
|
-
const result = await this.checkWorkspaceQuota(options);
|
|
567
|
-
if (!result.allowed) {
|
|
568
|
-
const notProvisioned = result.assignmentId === null;
|
|
569
|
-
throw new QuotaExceededError(notProvisioned ? `Quota ${options.quotaName} is not included in this workspace's plan` : "Quota exceeded", {
|
|
570
|
-
quotaName: options.quotaName,
|
|
571
|
-
requestedAmount: options.amount ?? 1,
|
|
572
|
-
limitLeft: result.limitLeft,
|
|
573
|
-
notProvisioned
|
|
574
|
-
});
|
|
575
|
-
}
|
|
576
|
-
return result;
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Record workspace quota usage. A negative amount releases previously recorded usage.
|
|
580
|
-
* Resolves to `true` once the owner has stored (or deduplicated) the record.
|
|
581
|
-
*/
|
|
582
|
-
async trackUsage(options) {
|
|
583
|
-
const input = buildTrackUsageInput(options, this.context);
|
|
584
|
-
const workspaceId = input["workspaceId"];
|
|
585
|
-
logger.debug("[Usage] Tracking workspace usage", {
|
|
586
|
-
workspaceId,
|
|
587
|
-
quotaName: input["quotaName"],
|
|
588
|
-
amount: input["amount"]
|
|
589
|
-
});
|
|
590
|
-
const response = await this.client.query(TRACK_USAGE_MUTATION, {
|
|
591
|
-
input
|
|
592
|
-
}, this.requestContext(workspaceId, nonEmpty(options.userId)));
|
|
593
|
-
logger.info("[Usage] Workspace usage tracked", {
|
|
594
|
-
workspaceId,
|
|
595
|
-
quotaName: input["quotaName"]
|
|
596
|
-
});
|
|
597
|
-
return response.trackUsage;
|
|
598
|
-
}
|
|
599
|
-
/**
|
|
600
|
-
* @deprecated The workspace usage owner has no `trackUsage` record shape keyed by
|
|
601
|
-
* `entityId`/`metricType`. Use {@link trackUsage} with a `quotaName`.
|
|
602
|
-
*/
|
|
603
|
-
async track(_options) {
|
|
604
|
-
throw new UsageOperationUnsupportedError("track", legacyGuidance("trackUsage({ quotaName, productId, amount })"));
|
|
605
|
-
}
|
|
606
|
-
/**
|
|
607
|
-
* @deprecated The owner has no `checkQuota` operation. Use {@link checkWorkspaceQuota}.
|
|
608
|
-
*/
|
|
609
|
-
async checkQuota(_options) {
|
|
610
|
-
throw new UsageOperationUnsupportedError("checkQuota", legacyGuidance("checkWorkspaceQuota({ quotaName, amount })"));
|
|
611
|
-
}
|
|
612
|
-
/**
|
|
613
|
-
* @deprecated The owner has no `checkQuota` operation. Use {@link requireWorkspaceQuota}.
|
|
614
|
-
*/
|
|
615
|
-
async requireQuota(_options) {
|
|
616
|
-
throw new UsageOperationUnsupportedError("requireQuota", legacyGuidance("requireWorkspaceQuota({ quotaName, amount })"));
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* @deprecated Use {@link requireWorkspaceQuota} followed by {@link trackUsage}.
|
|
620
|
-
*/
|
|
621
|
-
async trackAndCheck(_options) {
|
|
622
|
-
throw new UsageOperationUnsupportedError("trackAndCheck", legacyGuidance("requireWorkspaceQuota() and then trackUsage()"));
|
|
623
|
-
}
|
|
624
|
-
/**
|
|
625
|
-
* @deprecated The owner has no `getUsage` operation; read records with the owner's
|
|
626
|
-
* `getUsageRecords(filters, pagination)`.
|
|
627
|
-
*/
|
|
628
|
-
async getUsage(_options) {
|
|
629
|
-
throw new UsageOperationUnsupportedError("getUsage", legacyGuidance("the owner's getUsageRecords query"));
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* @deprecated The owner's `getUsageSummary` takes `UsageFilters` and returns a list; this
|
|
633
|
-
* signature does not map onto it.
|
|
634
|
-
*/
|
|
635
|
-
async getSummary(_entityId, _entityType, _metricType, _period) {
|
|
636
|
-
throw new UsageOperationUnsupportedError("getSummary", legacyGuidance("the owner's getUsageSummary(filters) query"));
|
|
637
|
-
}
|
|
638
|
-
/**
|
|
639
|
-
* @deprecated Quota limits are assigned by global-billing-svc through the owner's
|
|
640
|
-
* `assignWorkspaceQuota`, which only billing's service identity may call.
|
|
641
|
-
*/
|
|
642
|
-
async setQuota(_options) {
|
|
643
|
-
throw new UsageOperationUnsupportedError("setQuota", "quota limits are assigned by global-billing-svc");
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* @deprecated The owner has no `getQuota` operation; read `workspaceQuotaStatuses(workspaceId)`.
|
|
647
|
-
*/
|
|
648
|
-
async getQuota(_entityId, _entityType, _metricType) {
|
|
649
|
-
throw new UsageOperationUnsupportedError("getQuota", legacyGuidance("the owner's workspaceQuotaStatuses query"));
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* @deprecated The owner has no `getQuotas` operation; read `workspaceQuotaAssignments(workspaceId)`.
|
|
653
|
-
*/
|
|
654
|
-
async getQuotas(_entityId, _entityType) {
|
|
655
|
-
throw new UsageOperationUnsupportedError("getQuotas", legacyGuidance("the owner's workspaceQuotaAssignments query"));
|
|
656
|
-
}
|
|
657
|
-
/**
|
|
658
|
-
* @deprecated The owner has no `resetQuota` operation; quotas reset on their `resetPeriod`.
|
|
659
|
-
*/
|
|
660
|
-
async resetQuota(_entityId, _entityType, _metricType) {
|
|
661
|
-
throw new UsageOperationUnsupportedError("resetQuota", "quotas reset on the assignment's resetPeriod");
|
|
662
|
-
}
|
|
663
|
-
/**
|
|
664
|
-
* @deprecated The owner has no `deleteQuota` operation; billing deactivates assignments.
|
|
665
|
-
*/
|
|
666
|
-
async deleteQuota(_entityId, _entityType, _metricType) {
|
|
667
|
-
throw new UsageOperationUnsupportedError("deleteQuota", "quota assignments are deactivated by global-billing-svc");
|
|
668
|
-
}
|
|
669
|
-
/**
|
|
670
|
-
* @deprecated The owner has no `trackUsageBulk` operation. Call {@link trackUsage} per record.
|
|
671
|
-
*/
|
|
672
|
-
async trackBulk(_records) {
|
|
673
|
-
throw new UsageOperationUnsupportedError("trackBulk", legacyGuidance("trackUsage() per record"));
|
|
674
|
-
}
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
export { BillingUsageClient, CHECK_WORKSPACE_QUOTA_QUERY, QuotaPeriod, TRACK_USAGE_MUTATION, UsageMetricType, UsageModule, UsageOperationUnsupportedError, buildTrackUsageInput };
|
|
678
|
-
//# sourceMappingURL=chunk-QVPIACWD.js.map
|
|
679
|
-
//# sourceMappingURL=chunk-QVPIACWD.js.map
|