@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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import jwt from "jsonwebtoken";
|
|
2
|
+
|
|
3
|
+
// src/gateway/service-jwt.ts
|
|
4
|
+
/**
|
|
5
|
+
* Service JWT minting + caching for M2M cross-layer calls.
|
|
6
|
+
*
|
|
7
|
+
* The public gateways (global-public-gateway, wspace-public-gateway) validate
|
|
8
|
+
* every incoming request's Authorization header and only propagate `x-actor-*`
|
|
9
|
+
* context headers to subgraphs when the JWT is valid. Without a JWT, raw
|
|
10
|
+
* actor headers are stripped as potential client spoofing. For service-to-
|
|
11
|
+
* service cross-layer calls there is no user JWT to forward — we mint a short-
|
|
12
|
+
* lived service JWT with `actor_type: 'service'` so the gateway admits the
|
|
13
|
+
* call and the subgraph sees a trusted service context.
|
|
14
|
+
*
|
|
15
|
+
* Signing key: SERVICE_JWT_SECRET — a dedicated, separate secret from
|
|
16
|
+
* GLOBAL_AUTH_SECRET (which signs user tokens). Keeping them distinct means a
|
|
17
|
+
* service minter that leaks its env cannot forge user logins. The gateways
|
|
18
|
+
* hold both secrets and pick between them by the JWT's `kid` header
|
|
19
|
+
* (this minter stamps `kid: service-v1`).
|
|
20
|
+
*
|
|
21
|
+
* Signing library: `jsonwebtoken` — the same library global-auth-svc and every
|
|
22
|
+
* auth strategy already use to sign/verify tokens. Standardizing on it means a
|
|
23
|
+
* cross-layer service caller doesn't have to additionally pull in `jose` just
|
|
24
|
+
* to mint a token (a missing optional `jose` peer dep silently broke all
|
|
25
|
+
* cross-layer workspace sync — see BOFF-2717). The output is a standard HS256
|
|
26
|
+
* compact JWS, so the gateways keep verifying it with `jose.jwtVerify`
|
|
27
|
+
* unchanged: sign and verify are wire-compatible across the two libraries.
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Dedicated secret for service-minted JWTs.
|
|
31
|
+
*
|
|
32
|
+
* Deliberately separate from `GLOBAL_AUTH_SECRET` (which signs user tokens)
|
|
33
|
+
* so that services that mint service JWTs do not also hold the ability to
|
|
34
|
+
* forge user logins. Blast radius of a leaked secret stays scoped to 60s
|
|
35
|
+
* service tokens with no PII.
|
|
36
|
+
*
|
|
37
|
+
* Gateways hold both secrets and select by the JWT's `kid` header.
|
|
38
|
+
*/
|
|
39
|
+
const SIGNING_ENV_VAR = "SERVICE_JWT_SECRET";
|
|
40
|
+
const KEY_ID = "service-v1";
|
|
41
|
+
const DEFAULT_TTL_SECONDS = 60;
|
|
42
|
+
const REFRESH_BEFORE_EXP_MS = 1e4;
|
|
43
|
+
const cache = /* @__PURE__ */ new Map();
|
|
44
|
+
function cacheKey(actorId, ttlSeconds) {
|
|
45
|
+
return `${actorId}:${ttlSeconds}`;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Sign a service-actor JWT.
|
|
49
|
+
* Returns null when no signing secret is configured (opt-in).
|
|
50
|
+
*
|
|
51
|
+
* Stays `async` (signing is synchronous with `jsonwebtoken`) so existing
|
|
52
|
+
* `await signServiceJwt(...)` callers are unaffected.
|
|
53
|
+
*/
|
|
54
|
+
async function signServiceJwt(actorId, ttlSeconds = DEFAULT_TTL_SECONDS) {
|
|
55
|
+
const secret = process.env[SIGNING_ENV_VAR];
|
|
56
|
+
if (!secret) return null;
|
|
57
|
+
const key = cacheKey(actorId, ttlSeconds);
|
|
58
|
+
const cached = cache.get(key);
|
|
59
|
+
if (cached && cached.expiresAtMs - REFRESH_BEFORE_EXP_MS > Date.now()) return cached.token;
|
|
60
|
+
const nowSec = Math.floor(Date.now() / 1e3);
|
|
61
|
+
const expSec = nowSec + ttlSeconds;
|
|
62
|
+
const token = jwt.sign({
|
|
63
|
+
actor_type: "service",
|
|
64
|
+
iat: nowSec,
|
|
65
|
+
exp: expSec
|
|
66
|
+
}, secret, {
|
|
67
|
+
algorithm: "HS256",
|
|
68
|
+
keyid: KEY_ID,
|
|
69
|
+
subject: actorId,
|
|
70
|
+
issuer: actorId
|
|
71
|
+
});
|
|
72
|
+
cache.set(key, {
|
|
73
|
+
token,
|
|
74
|
+
expiresAtMs: expSec * 1e3
|
|
75
|
+
});
|
|
76
|
+
return token;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { signServiceJwt as t };
|
|
80
|
+
//# sourceMappingURL=service-jwt-Bu-WNA_-.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-jwt-Bu-WNA_-.js","names":[],"sources":["../src/gateway/service-jwt.ts"],"sourcesContent":["/**\n * Service JWT minting + caching for M2M cross-layer calls.\n *\n * The public gateways (global-public-gateway, wspace-public-gateway) validate\n * every incoming request's Authorization header and only propagate `x-actor-*`\n * context headers to subgraphs when the JWT is valid. Without a JWT, raw\n * actor headers are stripped as potential client spoofing. For service-to-\n * service cross-layer calls there is no user JWT to forward — we mint a short-\n * lived service JWT with `actor_type: 'service'` so the gateway admits the\n * call and the subgraph sees a trusted service context.\n *\n * Signing key: SERVICE_JWT_SECRET — a dedicated, separate secret from\n * GLOBAL_AUTH_SECRET (which signs user tokens). Keeping them distinct means a\n * service minter that leaks its env cannot forge user logins. The gateways\n * hold both secrets and pick between them by the JWT's `kid` header\n * (this minter stamps `kid: service-v1`).\n *\n * Signing library: `jsonwebtoken` — the same library global-auth-svc and every\n * auth strategy already use to sign/verify tokens. Standardizing on it means a\n * cross-layer service caller doesn't have to additionally pull in `jose` just\n * to mint a token (a missing optional `jose` peer dep silently broke all\n * cross-layer workspace sync — see BOFF-2717). The output is a standard HS256\n * compact JWS, so the gateways keep verifying it with `jose.jwtVerify`\n * unchanged: sign and verify are wire-compatible across the two libraries.\n */\nimport jwt from 'jsonwebtoken';\n\n/**\n * Dedicated secret for service-minted JWTs.\n *\n * Deliberately separate from `GLOBAL_AUTH_SECRET` (which signs user tokens)\n * so that services that mint service JWTs do not also hold the ability to\n * forge user logins. Blast radius of a leaked secret stays scoped to 60s\n * service tokens with no PII.\n *\n * Gateways hold both secrets and select by the JWT's `kid` header.\n */\nconst SIGNING_ENV_VAR = 'SERVICE_JWT_SECRET';\nconst KEY_ID = 'service-v1';\nconst DEFAULT_TTL_SECONDS = 60;\nconst REFRESH_BEFORE_EXP_MS = 10_000;\n\ninterface CachedToken {\n token: string;\n expiresAtMs: number;\n}\n\nconst cache = new Map<string, CachedToken>();\n\nfunction cacheKey(actorId: string, ttlSeconds: number): string {\n return `${actorId}:${ttlSeconds}`;\n}\n\n/**\n * Sign a service-actor JWT.\n * Returns null when no signing secret is configured (opt-in).\n *\n * Stays `async` (signing is synchronous with `jsonwebtoken`) so existing\n * `await signServiceJwt(...)` callers are unaffected.\n */\nexport async function signServiceJwt(\n actorId: string,\n ttlSeconds: number = DEFAULT_TTL_SECONDS\n): Promise<string | null> {\n const secret = process.env[SIGNING_ENV_VAR];\n if (!secret) {\n return null;\n }\n\n const key = cacheKey(actorId, ttlSeconds);\n const cached = cache.get(key);\n if (cached && cached.expiresAtMs - REFRESH_BEFORE_EXP_MS > Date.now()) {\n return cached.token;\n }\n\n const nowSec = Math.floor(Date.now() / 1000);\n const expSec = nowSec + ttlSeconds;\n\n const token = jwt.sign(\n {\n actor_type: 'service',\n iat: nowSec,\n exp: expSec,\n },\n secret,\n {\n algorithm: 'HS256',\n keyid: KEY_ID,\n subject: actorId,\n // `iss` = the service identity that minted the token. Matches `sub`\n // because these are self-minted tokens (caller is asserting itself).\n // Gives the gateway room to enforce a minter allowlist later without\n // a token-format change.\n issuer: actorId,\n }\n );\n\n cache.set(key, { token, expiresAtMs: expSec * 1000 });\n return token;\n}\n\n/** Test hook to clear the cache between tests. */\nexport function __clearServiceJwtCache(): void {\n cache.clear();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAM,kBAAkB;AACxB,MAAM,SAAS;AACf,MAAM,sBAAsB;AAC5B,MAAM,wBAAwB;AAO9B,MAAM,wBAAQ,IAAI,IAAyB;AAE3C,SAAS,SAAS,SAAiB,YAA4B;CAC7D,OAAO,GAAG,QAAQ,GAAG;AACvB;;;;;;;;AASA,eAAsB,eACpB,SACA,aAAqB,qBACG;CACxB,MAAM,SAAS,QAAQ,IAAI;CAC3B,IAAI,CAAC,QACH,OAAO;CAGT,MAAM,MAAM,SAAS,SAAS,UAAU;CACxC,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IAAI,UAAU,OAAO,cAAc,wBAAwB,KAAK,IAAI,GAClE,OAAO,OAAO;CAGhB,MAAM,SAAS,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;CAC3C,MAAM,SAAS,SAAS;CAExB,MAAM,QAAQ,IAAI,KAChB;EACE,YAAY;EACZ,KAAK;EACL,KAAK;CACP,GACA,QACA;EACE,WAAW;EACX,OAAO;EACP,SAAS;EAKT,QAAQ;CACV,CACF;CAEA,MAAM,IAAI,KAAK;EAAE;EAAO,aAAa,SAAS;CAAK,CAAC;CACpD,OAAO;AACT"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { a as logger } from "./logger-B6rCpb7D.js";
|
|
2
|
+
|
|
3
|
+
// src/graphql/services/Logger.ts
|
|
4
|
+
/**
|
|
5
|
+
* Logger Service - Utility class for logging
|
|
6
|
+
*
|
|
7
|
+
* Provides structured logging functionality.
|
|
8
|
+
* Wrap this class with decorators in your microservice for DI.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { Logger } from '@burdenoff/be-sdk/graphql/services';
|
|
13
|
+
* import { Injectable, Scope } from 'graphql-modules';
|
|
14
|
+
*
|
|
15
|
+
* // In your microservice
|
|
16
|
+
* @Injectable({ scope: Scope.Singleton, global: true })
|
|
17
|
+
* export class LoggerProvider extends Logger {}
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
var Logger = class {
|
|
21
|
+
/**
|
|
22
|
+
* Log a message at INFO level
|
|
23
|
+
*/
|
|
24
|
+
log(message, ...args) {
|
|
25
|
+
logger.info(message, ...args);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Log a message at INFO level
|
|
29
|
+
*/
|
|
30
|
+
info(message, ...args) {
|
|
31
|
+
logger.info(message, ...args);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Log a message at WARN level
|
|
35
|
+
*/
|
|
36
|
+
warn(message, ...args) {
|
|
37
|
+
logger.warn(message, ...args);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Log a message at ERROR level
|
|
41
|
+
*/
|
|
42
|
+
error(message, error, ...args) {
|
|
43
|
+
logger.error(message, error, ...args);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Log a message at DEBUG level
|
|
47
|
+
*/
|
|
48
|
+
debug(message, ...args) {
|
|
49
|
+
logger.debug(message, ...args);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Log a message at TRACE level
|
|
53
|
+
*/
|
|
54
|
+
trace(message, ...args) {
|
|
55
|
+
if ("trace" in logger && typeof logger.trace === "function") logger.trace(message, ...args);
|
|
56
|
+
else logger.debug(message, ...args);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/graphql/services/Database.ts
|
|
61
|
+
/**
|
|
62
|
+
* Create a Database service class with the provided Prisma client
|
|
63
|
+
*
|
|
64
|
+
* @param prismaClient - The Prisma client instance for this microservice
|
|
65
|
+
* @returns Database service class (without decorators - add them in your microservice)
|
|
66
|
+
*/
|
|
67
|
+
function createDatabaseService(prismaClient) {
|
|
68
|
+
class Database {
|
|
69
|
+
/**
|
|
70
|
+
* Get the Prisma client instance
|
|
71
|
+
*/
|
|
72
|
+
get client() {
|
|
73
|
+
return prismaClient;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Execute a transaction
|
|
77
|
+
*
|
|
78
|
+
* @param fn - Transaction callback function
|
|
79
|
+
* @returns Promise resolving to transaction result
|
|
80
|
+
*/
|
|
81
|
+
async transaction(fn) {
|
|
82
|
+
return prismaClient.$transaction(fn);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check if database is connected
|
|
86
|
+
*
|
|
87
|
+
* @returns Promise resolving to true if connected, false otherwise
|
|
88
|
+
*/
|
|
89
|
+
async isConnected() {
|
|
90
|
+
try {
|
|
91
|
+
if ("$queryRaw" in prismaClient && typeof prismaClient.$queryRaw === "function") await prismaClient.$queryRaw`SELECT 1`;
|
|
92
|
+
return true;
|
|
93
|
+
} catch {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return Database;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { Logger as n, createDatabaseService as t };
|
|
102
|
+
//# sourceMappingURL=services-BWzfz7vG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"services-BWzfz7vG.js","names":["sdkLogger"],"sources":["../src/graphql/services/Logger.ts","../src/graphql/services/Database.ts"],"sourcesContent":["/**\n * Logger Service - Utility class for logging\n *\n * Provides structured logging functionality.\n * Wrap this class with decorators in your microservice for DI.\n *\n * @example\n * ```typescript\n * import { Logger } from '@burdenoff/be-sdk/graphql/services';\n * import { Injectable, Scope } from 'graphql-modules';\n *\n * // In your microservice\n * @Injectable({ scope: Scope.Singleton, global: true })\n * export class LoggerProvider extends Logger {}\n * ```\n */\n\nimport { logger as sdkLogger } from '../../logger/index.js';\n\nexport class Logger {\n /**\n * Log a message at INFO level\n */\n log(message: string, ...args: unknown[]): void {\n sdkLogger.info(message, ...args);\n }\n\n /**\n * Log a message at INFO level\n */\n info(message: string, ...args: unknown[]): void {\n sdkLogger.info(message, ...args);\n }\n\n /**\n * Log a message at WARN level\n */\n warn(message: string, ...args: unknown[]): void {\n sdkLogger.warn(message, ...args);\n }\n\n /**\n * Log a message at ERROR level\n */\n error(message: string, error?: Error | unknown, ...args: unknown[]): void {\n sdkLogger.error(message, error, ...args);\n }\n\n /**\n * Log a message at DEBUG level\n */\n debug(message: string, ...args: unknown[]): void {\n sdkLogger.debug(message, ...args);\n }\n\n /**\n * Log a message at TRACE level\n */\n trace(message: string, ...args: unknown[]): void {\n if ('trace' in sdkLogger && typeof sdkLogger.trace === 'function') {\n sdkLogger.trace(message, ...args);\n } else {\n sdkLogger.debug(message, ...args);\n }\n }\n}\n","/**\n * Database Service - Utility class for database operations\n *\n * Provides access to Prisma client for database operations.\n * Each microservice creates its own Database instance with its Prisma client.\n * Wrap the returned class with decorators in your microservice for DI.\n *\n * @example\n * ```typescript\n * // In your module definition:\n * import { createDatabaseService } from '@burdenoff/be-sdk/graphql/services';\n * import { prisma } from './utils/prisma.js';\n *\n * // Create base Database class from SDK\n * const BaseDatabaseService = createDatabaseService(prisma);\n *\n * // Wrap with decorators in your microservice\n * @Injectable({ scope: Scope.Singleton, global: true })\n * class DatabaseProvider extends BaseDatabaseService {}\n *\n * export const myModule = createModule({\n * providers: [DatabaseProvider, MyProvider, ...],\n * });\n * ```\n */\n\n/**\n * Type for Prisma client transaction\n */\nexport type PrismaTransactionClient<TPrismaClient> = Omit<\n TPrismaClient,\n '$connect' | '$disconnect' | '$on' | '$transaction' | '$use' | '$extends'\n>;\n\n/**\n * Create a Database service class with the provided Prisma client\n *\n * @param prismaClient - The Prisma client instance for this microservice\n * @returns Database service class (without decorators - add them in your microservice)\n */\nexport function createDatabaseService<TPrismaClient extends { $transaction: (...args: unknown[]) => Promise<unknown> }>(\n prismaClient: TPrismaClient\n): {\n new (): {\n readonly client: TPrismaClient;\n transaction<T>(fn: (tx: PrismaTransactionClient<TPrismaClient>) => Promise<T>): Promise<T>;\n isConnected(): Promise<boolean>;\n };\n} {\n class Database {\n /**\n * Get the Prisma client instance\n */\n get client(): TPrismaClient {\n return prismaClient;\n }\n\n /**\n * Execute a transaction\n *\n * @param fn - Transaction callback function\n * @returns Promise resolving to transaction result\n */\n async transaction<T>(fn: (tx: PrismaTransactionClient<TPrismaClient>) => Promise<T>): Promise<T> {\n return prismaClient.$transaction(fn) as Promise<T>;\n }\n\n /**\n * Check if database is connected\n *\n * @returns Promise resolving to true if connected, false otherwise\n */\n async isConnected(): Promise<boolean> {\n try {\n // Use $queryRaw if available, otherwise assume connected\n if ('$queryRaw' in prismaClient && typeof prismaClient.$queryRaw === 'function') {\n await (prismaClient.$queryRaw as (query: TemplateStringsArray) => Promise<unknown>)`SELECT 1`;\n }\n return true;\n } catch {\n return false;\n }\n }\n }\n\n return Database;\n}\n\n/**\n * Type helper to extract Database service type\n */\nexport type DatabaseService<TPrismaClient extends { $transaction: (...args: unknown[]) => Promise<unknown> }> =\n InstanceType<ReturnType<typeof createDatabaseService<TPrismaClient>>>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAmBA,IAAa,SAAb,MAAoB;;;;CAIlB,IAAI,SAAiB,GAAG,MAAuB;EAC7C,OAAU,KAAK,SAAS,GAAG,IAAI;CACjC;;;;CAKA,KAAK,SAAiB,GAAG,MAAuB;EAC9C,OAAU,KAAK,SAAS,GAAG,IAAI;CACjC;;;;CAKA,KAAK,SAAiB,GAAG,MAAuB;EAC9C,OAAU,KAAK,SAAS,GAAG,IAAI;CACjC;;;;CAKA,MAAM,SAAiB,OAAyB,GAAG,MAAuB;EACxE,OAAU,MAAM,SAAS,OAAO,GAAG,IAAI;CACzC;;;;CAKA,MAAM,SAAiB,GAAG,MAAuB;EAC/C,OAAU,MAAM,SAAS,GAAG,IAAI;CAClC;;;;CAKA,MAAM,SAAiB,GAAG,MAAuB;EAC/C,IAAI,WAAWA,UAAa,OAAOA,OAAU,UAAU,YACrD,OAAU,MAAM,SAAS,GAAG,IAAI;OAEhC,OAAU,MAAM,SAAS,GAAG,IAAI;CAEpC;AACF;;;;;;;;;ACzBA,SAAgB,sBACd,cAOA;CACA,MAAM,SAAS;;;;EAIb,IAAI,SAAwB;GAC1B,OAAO;EACT;;;;;;;EAQA,MAAM,YAAe,IAA4E;GAC/F,OAAO,aAAa,aAAa,EAAE;EACrC;;;;;;EAOA,MAAM,cAAgC;GACpC,IAAI;IAEF,IAAI,eAAe,gBAAgB,OAAO,aAAa,cAAc,YACnE,MAAM,AAAC,aAAa,SAA+D;IAErF,OAAO;GACT,QAAQ;IACN,OAAO;GACT;EACF;CACF;CAEA,OAAO;AACT"}
|
package/dist/sharding/index.d.ts
CHANGED
|
@@ -2,58 +2,55 @@ type ShardId = string;
|
|
|
2
2
|
type ShardTier = 'pool' | 'bridge' | 'silo';
|
|
3
3
|
type ShardState = 'active' | 'draining' | 'read_only';
|
|
4
4
|
interface ShardCatalogEntry {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
shardId: ShardId;
|
|
6
|
+
layer?: string;
|
|
7
|
+
connectionString: string;
|
|
8
|
+
region?: string;
|
|
9
|
+
capacityWeight?: number;
|
|
10
|
+
state?: ShardState;
|
|
11
11
|
}
|
|
12
12
|
interface TenantShardMapping {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
workspaceId: string;
|
|
14
|
+
shardId: ShardId;
|
|
15
|
+
tier?: ShardTier;
|
|
16
|
+
state?: 'active' | 'migrating' | 'read_only';
|
|
17
|
+
migratingTo?: ShardId | null;
|
|
18
18
|
}
|
|
19
19
|
interface ShardDirectory {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
resolveShardId(workspaceId: string): Promise<ShardId>;
|
|
21
|
+
getShard(shardId: ShardId): Promise<ShardCatalogEntry | undefined>;
|
|
22
|
+
listShards(): Promise<ShardCatalogEntry[]>;
|
|
23
23
|
}
|
|
24
24
|
type ShardedClientFactory<TClient> = (connectionString: string, shardId: ShardId) => TClient;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
listShards(): Promise<ShardCatalogEntry[]>;
|
|
25
|
+
export declare class StaticShardDirectory implements ShardDirectory {
|
|
26
|
+
private readonly entry;
|
|
27
|
+
constructor(defaultShardId: ShardId, defaultConnectionString: string, layer?: string);
|
|
28
|
+
resolveShardId(_workspaceId: string): Promise<ShardId>;
|
|
29
|
+
getShard(shardId: ShardId): Promise<ShardCatalogEntry | undefined>;
|
|
30
|
+
listShards(): Promise<ShardCatalogEntry[]>;
|
|
32
31
|
}
|
|
33
|
-
declare class EnvShardDirectory implements ShardDirectory {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
export declare class EnvShardDirectory implements ShardDirectory {
|
|
33
|
+
private readonly defaultShardId;
|
|
34
|
+
private readonly catalog;
|
|
35
|
+
private readonly overrides;
|
|
36
|
+
constructor(defaultShardId: ShardId, defaultConnectionString: string, env?: NodeJS.ProcessEnv);
|
|
37
|
+
resolveShardId(workspaceId: string): Promise<ShardId>;
|
|
38
|
+
getShard(shardId: ShardId): Promise<ShardCatalogEntry | undefined>;
|
|
39
|
+
listShards(): Promise<ShardCatalogEntry[]>;
|
|
41
40
|
}
|
|
42
|
-
|
|
43
41
|
interface ShardRouterOptions {
|
|
44
|
-
|
|
42
|
+
maxClients?: number;
|
|
45
43
|
}
|
|
46
|
-
declare class ShardRouter<TClient> {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
export declare class ShardRouter<TClient> {
|
|
45
|
+
private readonly directory;
|
|
46
|
+
private readonly factory;
|
|
47
|
+
private readonly clients;
|
|
48
|
+
private readonly maxClients;
|
|
49
|
+
constructor(directory: ShardDirectory, factory: ShardedClientFactory<TClient>, options?: ShardRouterOptions);
|
|
50
|
+
resolveShardId(workspaceId: string): Promise<ShardId>;
|
|
51
|
+
getClientForWorkspace(workspaceId: string): Promise<TClient>;
|
|
52
|
+
getClientForShard(shardId: ShardId): Promise<TClient>;
|
|
53
|
+
cachedShardIds(): ShardId[];
|
|
56
54
|
}
|
|
57
|
-
declare function createShardRouterFromEnv<TClient>(factory: ShardedClientFactory<TClient>, options?: ShardRouterOptions, env?: NodeJS.ProcessEnv): ShardRouter<TClient>;
|
|
58
|
-
|
|
59
|
-
export { EnvShardDirectory, type ShardCatalogEntry, type ShardDirectory, type ShardId, ShardRouter, type ShardRouterOptions, type ShardState, type ShardTier, type ShardedClientFactory, StaticShardDirectory, type TenantShardMapping, createShardRouterFromEnv };
|
|
55
|
+
export declare function createShardRouterFromEnv<TClient>(factory: ShardedClientFactory<TClient>, options?: ShardRouterOptions, env?: NodeJS.ProcessEnv): ShardRouter<TClient>;
|
|
56
|
+
export type { ShardCatalogEntry, ShardDirectory, ShardId, ShardRouterOptions, ShardState, ShardTier, ShardedClientFactory, TenantShardMapping };
|
package/dist/sharding/index.js
CHANGED
|
@@ -1,152 +1,171 @@
|
|
|
1
|
-
import { logger } from
|
|
2
|
-
import { __name } from '../chunk-XE4OXN2W.js';
|
|
1
|
+
import { a as logger } from "../logger-B6rCpb7D.js";
|
|
3
2
|
|
|
4
3
|
// src/sharding/directory.ts
|
|
4
|
+
/**
|
|
5
|
+
* Single-shard directory: every workspace → the default shard. This is the
|
|
6
|
+
* "Step 1" foundation — introducing the router as pure indirection with no data
|
|
7
|
+
* placement changes.
|
|
8
|
+
*/
|
|
5
9
|
var StaticShardDirectory = class {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
async listShards() {
|
|
25
|
-
return [
|
|
26
|
-
this.entry
|
|
27
|
-
];
|
|
28
|
-
}
|
|
10
|
+
entry;
|
|
11
|
+
constructor(defaultShardId, defaultConnectionString, layer) {
|
|
12
|
+
this.entry = {
|
|
13
|
+
shardId: defaultShardId,
|
|
14
|
+
connectionString: defaultConnectionString,
|
|
15
|
+
layer,
|
|
16
|
+
state: "active"
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async resolveShardId(_workspaceId) {
|
|
20
|
+
return this.entry.shardId;
|
|
21
|
+
}
|
|
22
|
+
async getShard(shardId) {
|
|
23
|
+
return shardId === this.entry.shardId ? this.entry : void 0;
|
|
24
|
+
}
|
|
25
|
+
async listShards() {
|
|
26
|
+
return [this.entry];
|
|
27
|
+
}
|
|
29
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Environment-driven directory.
|
|
31
|
+
*
|
|
32
|
+
* - `SHARD_CATALOG`: optional JSON array of ShardCatalogEntry. When unset, the
|
|
33
|
+
* catalog is just the default shard (built from `defaultConnectionString`).
|
|
34
|
+
* - `TENANT_SHARD_MAP`: optional JSON object `{ "<workspaceId>": "<shardId>" }`
|
|
35
|
+
* of explicit overrides (e.g. whales promoted to a silo shard). Any workspace
|
|
36
|
+
* NOT listed falls back to `defaultShardId`.
|
|
37
|
+
*
|
|
38
|
+
* With neither env set, this is identical to {@link StaticShardDirectory}. This
|
|
39
|
+
* is the migration on-ramp: place a handful of workspaces on new shards via the
|
|
40
|
+
* override map before a real Redis/DB-backed directory exists.
|
|
41
|
+
*/
|
|
30
42
|
var EnvShardDirectory = class {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (mapped && this.catalog.has(mapped)) {
|
|
69
|
-
return mapped;
|
|
70
|
-
}
|
|
71
|
-
return this.defaultShardId;
|
|
72
|
-
}
|
|
73
|
-
async getShard(shardId) {
|
|
74
|
-
return this.catalog.get(shardId);
|
|
75
|
-
}
|
|
76
|
-
async listShards() {
|
|
77
|
-
return Array.from(this.catalog.values());
|
|
78
|
-
}
|
|
43
|
+
defaultShardId;
|
|
44
|
+
catalog;
|
|
45
|
+
overrides;
|
|
46
|
+
constructor(defaultShardId, defaultConnectionString, env = process.env) {
|
|
47
|
+
this.defaultShardId = defaultShardId;
|
|
48
|
+
this.catalog = /* @__PURE__ */ new Map();
|
|
49
|
+
this.catalog.set(defaultShardId, {
|
|
50
|
+
shardId: defaultShardId,
|
|
51
|
+
connectionString: defaultConnectionString,
|
|
52
|
+
state: "active"
|
|
53
|
+
});
|
|
54
|
+
const rawCatalog = env["SHARD_CATALOG"];
|
|
55
|
+
if (rawCatalog && rawCatalog.trim() !== "") {
|
|
56
|
+
const parsed = JSON.parse(rawCatalog);
|
|
57
|
+
for (const entry of parsed) if (entry && typeof entry.shardId === "string" && typeof entry.connectionString === "string") this.catalog.set(entry.shardId, {
|
|
58
|
+
state: "active",
|
|
59
|
+
...entry
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
this.overrides = /* @__PURE__ */ new Map();
|
|
63
|
+
const rawMap = env["TENANT_SHARD_MAP"];
|
|
64
|
+
if (rawMap && rawMap.trim() !== "") {
|
|
65
|
+
const parsed = JSON.parse(rawMap);
|
|
66
|
+
for (const [workspaceId, shardId] of Object.entries(parsed)) this.overrides.set(workspaceId, shardId);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async resolveShardId(workspaceId) {
|
|
70
|
+
const mapped = this.overrides.get(workspaceId);
|
|
71
|
+
if (mapped && this.catalog.has(mapped)) return mapped;
|
|
72
|
+
return this.defaultShardId;
|
|
73
|
+
}
|
|
74
|
+
async getShard(shardId) {
|
|
75
|
+
return this.catalog.get(shardId);
|
|
76
|
+
}
|
|
77
|
+
async listShards() {
|
|
78
|
+
return Array.from(this.catalog.values());
|
|
79
|
+
}
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
// src/sharding/router.ts
|
|
83
|
+
/**
|
|
84
|
+
* Shard router — resolves a workspace to a shard client.
|
|
85
|
+
*
|
|
86
|
+
* The router owns a per-shard client cache (one client per shard per process,
|
|
87
|
+
* lazily created). Given a `workspaceId` it consults the {@link ShardDirectory}
|
|
88
|
+
* and returns the client for that workspace's shard. With the default
|
|
89
|
+
* single-shard directory, every workspace resolves to the same shard, so there
|
|
90
|
+
* is exactly one client and behavior is identical to today.
|
|
91
|
+
*
|
|
92
|
+
* The router never opens connections itself — it delegates client construction
|
|
93
|
+
* to the caller-supplied {@link ShardedClientFactory} (so the consuming service
|
|
94
|
+
* supplies its own generated PrismaClient constructor + pool wiring).
|
|
95
|
+
*
|
|
96
|
+
* @module sharding/router
|
|
97
|
+
*/
|
|
98
|
+
/**
|
|
99
|
+
* Routes `workspaceId` → the Prisma client for that workspace's shard.
|
|
100
|
+
*/
|
|
82
101
|
var ShardRouter = class {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
return client;
|
|
132
|
-
}
|
|
133
|
-
/** Currently-cached shard ids (for diagnostics/tests). */
|
|
134
|
-
cachedShardIds() {
|
|
135
|
-
return Array.from(this.clients.keys());
|
|
136
|
-
}
|
|
102
|
+
directory;
|
|
103
|
+
factory;
|
|
104
|
+
clients = /* @__PURE__ */ new Map();
|
|
105
|
+
maxClients;
|
|
106
|
+
constructor(directory, factory, options) {
|
|
107
|
+
this.directory = directory;
|
|
108
|
+
this.factory = factory;
|
|
109
|
+
this.maxClients = options?.maxClients ?? 32;
|
|
110
|
+
}
|
|
111
|
+
/** Resolve which shard a workspace lives on. */
|
|
112
|
+
async resolveShardId(workspaceId) {
|
|
113
|
+
return this.directory.resolveShardId(workspaceId);
|
|
114
|
+
}
|
|
115
|
+
/** Get (or lazily create) the client for a workspace's shard. */
|
|
116
|
+
async getClientForWorkspace(workspaceId) {
|
|
117
|
+
const shardId = await this.directory.resolveShardId(workspaceId);
|
|
118
|
+
return this.getClientForShard(shardId);
|
|
119
|
+
}
|
|
120
|
+
/** Get (or lazily create) the client for a specific shard. */
|
|
121
|
+
async getClientForShard(shardId) {
|
|
122
|
+
const existing = this.clients.get(shardId);
|
|
123
|
+
if (existing !== void 0) {
|
|
124
|
+
this.clients.delete(shardId);
|
|
125
|
+
this.clients.set(shardId, existing);
|
|
126
|
+
return existing;
|
|
127
|
+
}
|
|
128
|
+
const shard = await this.directory.getShard(shardId);
|
|
129
|
+
if (!shard) throw new Error(`[ShardRouter] unknown shard '${shardId}' — not in the shard catalog`);
|
|
130
|
+
const client = this.factory(shard.connectionString, shardId);
|
|
131
|
+
this.clients.set(shardId, client);
|
|
132
|
+
logger.info("[ShardRouter] shard client created", {
|
|
133
|
+
shardId,
|
|
134
|
+
layer: shard.layer
|
|
135
|
+
});
|
|
136
|
+
if (this.clients.size > this.maxClients) {
|
|
137
|
+
const oldest = this.clients.keys().next().value;
|
|
138
|
+
if (oldest !== void 0 && oldest !== shardId) {
|
|
139
|
+
this.clients.delete(oldest);
|
|
140
|
+
logger.info("[ShardRouter] evicted LRU shard client", { shardId: oldest });
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return client;
|
|
144
|
+
}
|
|
145
|
+
/** Currently-cached shard ids (for diagnostics/tests). */
|
|
146
|
+
cachedShardIds() {
|
|
147
|
+
return Array.from(this.clients.keys());
|
|
148
|
+
}
|
|
137
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* Build a {@link ShardRouter} from environment, defaulting to single-shard
|
|
152
|
+
* passthrough. Reads:
|
|
153
|
+
* - `DATABASE_URL` (required): the default shard's connection string.
|
|
154
|
+
* - `DEFAULT_SHARD_ID` (default 'shard-01').
|
|
155
|
+
* - `SHARDING_ENABLED` (default 'false'): when false, uses the single-shard
|
|
156
|
+
* {@link StaticShardDirectory}; when true, uses {@link EnvShardDirectory}
|
|
157
|
+
* (which still passes through unless `SHARD_CATALOG`/`TENANT_SHARD_MAP` are set).
|
|
158
|
+
*
|
|
159
|
+
* With defaults, this is a behavior-preserving indirection over the current
|
|
160
|
+
* single database — the safe "Step 1" of horizontal scale-out.
|
|
161
|
+
*/
|
|
138
162
|
function createShardRouterFromEnv(factory, options, env = process.env) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
const enabled = (env["SHARDING_ENABLED"] ?? "false").toLowerCase() === "true";
|
|
145
|
-
const directory = enabled ? new EnvShardDirectory(defaultShardId, databaseUrl, env) : new StaticShardDirectory(defaultShardId, databaseUrl);
|
|
146
|
-
return new ShardRouter(directory, factory, options);
|
|
163
|
+
const databaseUrl = env["DATABASE_URL"];
|
|
164
|
+
if (!databaseUrl) throw new Error("[ShardRouter] DATABASE_URL is required to build the default shard");
|
|
165
|
+
const defaultShardId = env["DEFAULT_SHARD_ID"]?.trim() || "shard-01";
|
|
166
|
+
const directory = (env["SHARDING_ENABLED"] ?? "false").toLowerCase() === "true" ? new EnvShardDirectory(defaultShardId, databaseUrl, env) : new StaticShardDirectory(defaultShardId, databaseUrl);
|
|
167
|
+
return new ShardRouter(directory, factory, options);
|
|
147
168
|
}
|
|
148
|
-
__name(createShardRouterFromEnv, "createShardRouterFromEnv");
|
|
149
169
|
|
|
150
170
|
export { EnvShardDirectory, ShardRouter, StaticShardDirectory, createShardRouterFromEnv };
|
|
151
|
-
//# sourceMappingURL=index.js.map
|
|
152
171
|
//# sourceMappingURL=index.js.map
|