@burdenoff/be-sdk 2026.1110.1 → 2026.1110.3
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/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-Ca-NNcVx.js +546 -0
- package/dist/ai-credits-Ca-NNcVx.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-CEuBEBQN.js +228 -0
- package/dist/auth-CEuBEBQN.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-DcZ3iGES.js +565 -0
- package/dist/client-DcZ3iGES.js.map +1 -0
- package/dist/collector-endpoint-iyQYeI50.js +50 -0
- package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
- package/dist/context-CZnXf2yb.js +247 -0
- package/dist/context-CZnXf2yb.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/export/index.d.ts +2 -2
- package/dist/export/index.js +3 -14
- package/dist/export/index.js.map +1 -1
- package/dist/export-B6fphx8a.js +642 -0
- package/dist/export-B6fphx8a.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-71oDkrUe.js +422 -0
- package/dist/feature-flags-71oDkrUe.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-DjH0099H.js +830 -0
- package/dist/files-DjH0099H.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-DBFmxWks.js +50 -0
- package/dist/gateway-DBFmxWks.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-DDYgIryR.js +2152 -0
- package/dist/graph-DDYgIryR.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-DHAHHcww.js +161 -0
- package/dist/graphql-DHAHHcww.js.map +1 -0
- package/dist/graphql-DNkMkGBZ.d.ts +21 -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-BBqooJ52.d.ts +45 -0
- package/dist/index-BGzMYJsm.d.ts +209 -0
- package/dist/index-BKwHQtHQ.d.ts +63 -0
- package/dist/index-BMIMnp6T.d.ts +8 -0
- package/dist/index-BQDsNAMR.d.ts +81 -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-BqYfCQSP.d.ts +500 -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-CIgoeobA.d.ts +145 -0
- package/dist/index-CPQDMSFS.d.ts +103 -0
- package/dist/index-CSRcgkVi.d.ts +23 -0
- package/dist/index-CZTnQIRU.d.ts +341 -0
- package/dist/index-CaM9JUcc.d.ts +144 -0
- package/dist/index-CkT2aUr3.d.ts +704 -0
- package/dist/index-CliOgq6L.d.ts +203 -0
- package/dist/index-CnzbJZP7.d.ts +999 -0
- package/dist/index-D6UeLAye.d.ts +63 -0
- package/dist/index-DGgh9DWn.d.ts +59 -0
- package/dist/index-DY3dNhMN.d.ts +420 -0
- package/dist/index-DZC-2o9R.d.ts +207 -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-FbXPfen7.d.ts +132 -0
- package/dist/index-MArCb8Aq.d.ts +306 -0
- package/dist/index-N-huORcj.d.ts +303 -0
- package/dist/index-YOShAwkq.d.ts +45 -0
- package/dist/index-bZKZUvBu.d.ts +646 -0
- package/dist/index-yBSjMY32.d.ts +24 -0
- package/dist/index.d.ts +501 -544
- package/dist/index.js +1820 -2171
- 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-Dy3KhT6Y.js +325 -0
- package/dist/init-Dy3KhT6Y.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-CdETrtFK.js +869 -0
- package/dist/notifications-CdETrtFK.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/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/rbac/index.d.ts +2 -122
- package/dist/rbac/index.js +3 -6
- package/dist/rbac/index.js.map +1 -1
- package/dist/rbac-BB9l9Xph.js +1486 -0
- package/dist/rbac-BB9l9Xph.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/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 +2000 -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-BqwKn4eh.js +630 -0
- package/dist/stub-BqwKn4eh.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-B5xpbgsk.js +868 -0
- package/dist/{chunk-PBZFAAOM.js.map → tags-B5xpbgsk.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 +5 -20
- package/dist/tracker/index.js.map +1 -1
- package/dist/tracker-BQVoEFUo.js +839 -0
- package/dist/tracker-BQVoEFUo.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-Cj2RWXbz.js +90 -0
- package/dist/types-Cj2RWXbz.js.map +1 -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-BKFZiWQn.js +682 -0
- package/dist/usage-BKFZiWQn.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-PP534MBQ.js +0 -8
- package/dist/EventQueueFactory-PP534MBQ.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-7EISSMFP.js +0 -617
- package/dist/chunk-7EISSMFP.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-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-DIOS6L7M.js +0 -690
- package/dist/chunk-DIOS6L7M.js.map +0 -1
- package/dist/chunk-DJNHR37J.js +0 -1185
- package/dist/chunk-DJNHR37J.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-E6OAFS7A.js +0 -1346
- package/dist/chunk-E6OAFS7A.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-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-JVMAQOA3.js +0 -521
- package/dist/chunk-JVMAQOA3.js.map +0 -1
- package/dist/chunk-K56L7NUR.js +0 -1444
- package/dist/chunk-K56L7NUR.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-O2JMZHNH.js +0 -1908
- package/dist/chunk-O2JMZHNH.js.map +0 -1
- package/dist/chunk-OBBCR6WY.js +0 -277
- package/dist/chunk-OBBCR6WY.js.map +0 -1
- package/dist/chunk-OBZQ4AJC.js +0 -272
- package/dist/chunk-OBZQ4AJC.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-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-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-SBS4S2PJ.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { __export, __name } from './chunk-XE4OXN2W.js';
|
|
2
|
-
import crypto from 'crypto';
|
|
3
|
-
|
|
4
|
-
// src/crypto/index.ts
|
|
5
|
-
var crypto_exports = {};
|
|
6
|
-
__export(crypto_exports, {
|
|
7
|
-
decrypt: () => decrypt,
|
|
8
|
-
decryptIfNeeded: () => decryptIfNeeded,
|
|
9
|
-
encrypt: () => encrypt,
|
|
10
|
-
encryptIfNeeded: () => encryptIfNeeded,
|
|
11
|
-
generateEncryptionKey: () => generateEncryptionKey,
|
|
12
|
-
isEncrypted: () => isEncrypted
|
|
13
|
-
});
|
|
14
|
-
var ALGORITHM = "aes-256-gcm";
|
|
15
|
-
var IV_LENGTH = 16;
|
|
16
|
-
var AUTH_TAG_LENGTH = 16;
|
|
17
|
-
function encrypt(text, key) {
|
|
18
|
-
if (!text) {
|
|
19
|
-
throw new Error("Text to encrypt cannot be empty");
|
|
20
|
-
}
|
|
21
|
-
if (!key || key.length !== 64) {
|
|
22
|
-
throw new Error("Encryption key must be a 64-character hex string (32 bytes)");
|
|
23
|
-
}
|
|
24
|
-
const iv = crypto.randomBytes(IV_LENGTH);
|
|
25
|
-
const cipher = crypto.createCipheriv(ALGORITHM, Buffer.from(key, "hex"), iv);
|
|
26
|
-
let encrypted = cipher.update(text, "utf8", "hex");
|
|
27
|
-
encrypted += cipher.final("hex");
|
|
28
|
-
const authTag = cipher.getAuthTag();
|
|
29
|
-
return `${iv.toString("hex")}:${authTag.toString("hex")}:${encrypted}`;
|
|
30
|
-
}
|
|
31
|
-
__name(encrypt, "encrypt");
|
|
32
|
-
function decrypt(encryptedText, key) {
|
|
33
|
-
if (!encryptedText) {
|
|
34
|
-
throw new Error("Encrypted text cannot be empty");
|
|
35
|
-
}
|
|
36
|
-
if (!key || key.length !== 64) {
|
|
37
|
-
throw new Error("Encryption key must be a 64-character hex string (32 bytes)");
|
|
38
|
-
}
|
|
39
|
-
const parts = encryptedText.split(":");
|
|
40
|
-
if (parts.length !== 3) {
|
|
41
|
-
throw new Error("Invalid encrypted text format. Expected: iv:authTag:ciphertext");
|
|
42
|
-
}
|
|
43
|
-
const [ivHex, authTagHex, encrypted] = parts;
|
|
44
|
-
if (!ivHex || !authTagHex || !encrypted) {
|
|
45
|
-
throw new Error("Invalid encrypted text format. Missing components.");
|
|
46
|
-
}
|
|
47
|
-
const iv = Buffer.from(ivHex, "hex");
|
|
48
|
-
const authTag = Buffer.from(authTagHex, "hex");
|
|
49
|
-
if (iv.length !== IV_LENGTH) {
|
|
50
|
-
throw new Error(`Invalid IV length. Expected ${IV_LENGTH} bytes.`);
|
|
51
|
-
}
|
|
52
|
-
if (authTag.length !== AUTH_TAG_LENGTH) {
|
|
53
|
-
throw new Error(`Invalid auth tag length. Expected ${AUTH_TAG_LENGTH} bytes.`);
|
|
54
|
-
}
|
|
55
|
-
const decipher = crypto.createDecipheriv(ALGORITHM, Buffer.from(key, "hex"), iv);
|
|
56
|
-
decipher.setAuthTag(authTag);
|
|
57
|
-
let decrypted = decipher.update(encrypted, "hex", "utf8");
|
|
58
|
-
decrypted += decipher.final("utf8");
|
|
59
|
-
return decrypted;
|
|
60
|
-
}
|
|
61
|
-
__name(decrypt, "decrypt");
|
|
62
|
-
function generateEncryptionKey() {
|
|
63
|
-
return crypto.randomBytes(32).toString("hex");
|
|
64
|
-
}
|
|
65
|
-
__name(generateEncryptionKey, "generateEncryptionKey");
|
|
66
|
-
function isEncrypted(text) {
|
|
67
|
-
if (!text) return false;
|
|
68
|
-
const parts = text.split(":");
|
|
69
|
-
if (parts.length !== 3) return false;
|
|
70
|
-
const [ivHex, authTagHex, ciphertext] = parts;
|
|
71
|
-
if (!ivHex || ivHex.length !== 32 || !/^[0-9a-f]+$/i.test(ivHex)) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
if (!authTagHex || authTagHex.length !== 32 || !/^[0-9a-f]+$/i.test(authTagHex)) {
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
if (!ciphertext || !/^[0-9a-f]+$/i.test(ciphertext)) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
__name(isEncrypted, "isEncrypted");
|
|
83
|
-
function encryptIfNeeded(text, key) {
|
|
84
|
-
if (isEncrypted(text)) {
|
|
85
|
-
return text;
|
|
86
|
-
}
|
|
87
|
-
return encrypt(text, key);
|
|
88
|
-
}
|
|
89
|
-
__name(encryptIfNeeded, "encryptIfNeeded");
|
|
90
|
-
function decryptIfNeeded(text, key) {
|
|
91
|
-
if (!isEncrypted(text)) {
|
|
92
|
-
return text;
|
|
93
|
-
}
|
|
94
|
-
return decrypt(text, key);
|
|
95
|
-
}
|
|
96
|
-
__name(decryptIfNeeded, "decryptIfNeeded");
|
|
97
|
-
|
|
98
|
-
export { crypto_exports, decrypt, decryptIfNeeded, encrypt, encryptIfNeeded, generateEncryptionKey, isEncrypted };
|
|
99
|
-
//# sourceMappingURL=chunk-SBS4S2PJ.js.map
|
|
100
|
-
//# sourceMappingURL=chunk-SBS4S2PJ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/crypto/index.ts","../src/crypto/encryption.ts"],"names":["ALGORITHM","IV_LENGTH","AUTH_TAG_LENGTH","encrypt","text","key","Error","length","iv","crypto","randomBytes","cipher","createCipheriv","Buffer","from","encrypted","update","final","authTag","getAuthTag","toString","decrypt","encryptedText","parts","split","ivHex","authTagHex","decipher","createDecipheriv","setAuthTag","decrypted","generateEncryptionKey","isEncrypted","ciphertext","test","encryptIfNeeded","decryptIfNeeded"],"mappings":"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","file":"chunk-SBS4S2PJ.js","sourcesContent":["/**\n * Crypto module - Encryption utilities for sensitive data\n *\n * @module crypto\n *\n * @example\n * ```typescript\n * import { Crypto } from '@burdenoff/be-sdk';\n *\n * // Generate a key (do this once and store securely)\n * const key = Crypto.generateEncryptionKey();\n *\n * // Encrypt sensitive data\n * const encrypted = Crypto.encrypt('my-secret', key);\n *\n * // Decrypt when needed\n * const decrypted = Crypto.decrypt(encrypted, key);\n * ```\n */\n\nexport {\n encrypt,\n decrypt,\n generateEncryptionKey,\n isEncrypted,\n encryptIfNeeded,\n decryptIfNeeded,\n} from './encryption.js';\n","/**\n * AES-256-GCM Encryption utilities for sensitive data\n *\n * @module crypto/encryption\n */\n\nimport crypto from 'crypto';\n\nconst ALGORITHM = 'aes-256-gcm';\nconst IV_LENGTH = 16;\nconst AUTH_TAG_LENGTH = 16;\n\n/**\n * Encrypt a string using AES-256-GCM\n *\n * @param text - The plaintext to encrypt\n * @param key - 32-byte hex-encoded encryption key (64 hex characters)\n * @returns Encrypted string in format: iv:authTag:ciphertext (all hex-encoded)\n *\n * @example\n * ```typescript\n * import { encrypt, generateEncryptionKey } from '@burdenoff/be-sdk/crypto';\n *\n * const key = generateEncryptionKey();\n * const encrypted = encrypt('my-secret-data', key);\n * ```\n */\nexport function encrypt(text: string, key: string): string {\n if (!text) {\n throw new Error('Text to encrypt cannot be empty');\n }\n if (!key || key.length !== 64) {\n throw new Error('Encryption key must be a 64-character hex string (32 bytes)');\n }\n\n const iv = crypto.randomBytes(IV_LENGTH);\n const cipher = crypto.createCipheriv(ALGORITHM, Buffer.from(key, 'hex'), iv);\n\n let encrypted = cipher.update(text, 'utf8', 'hex');\n encrypted += cipher.final('hex');\n\n const authTag = cipher.getAuthTag();\n\n return `${iv.toString('hex')}:${authTag.toString('hex')}:${encrypted}`;\n}\n\n/**\n * Decrypt a string encrypted with AES-256-GCM\n *\n * @param encryptedText - Encrypted string in format: iv:authTag:ciphertext\n * @param key - 32-byte hex-encoded encryption key (64 hex characters)\n * @returns Decrypted plaintext\n *\n * @example\n * ```typescript\n * import { decrypt } from '@burdenoff/be-sdk/crypto';\n *\n * const decrypted = decrypt(encryptedData, key);\n * ```\n */\nexport function decrypt(encryptedText: string, key: string): string {\n if (!encryptedText) {\n throw new Error('Encrypted text cannot be empty');\n }\n if (!key || key.length !== 64) {\n throw new Error('Encryption key must be a 64-character hex string (32 bytes)');\n }\n\n const parts = encryptedText.split(':');\n if (parts.length !== 3) {\n throw new Error('Invalid encrypted text format. Expected: iv:authTag:ciphertext');\n }\n\n const [ivHex, authTagHex, encrypted] = parts;\n\n if (!ivHex || !authTagHex || !encrypted) {\n throw new Error('Invalid encrypted text format. Missing components.');\n }\n\n const iv = Buffer.from(ivHex, 'hex');\n const authTag = Buffer.from(authTagHex, 'hex');\n\n if (iv.length !== IV_LENGTH) {\n throw new Error(`Invalid IV length. Expected ${IV_LENGTH} bytes.`);\n }\n if (authTag.length !== AUTH_TAG_LENGTH) {\n throw new Error(`Invalid auth tag length. Expected ${AUTH_TAG_LENGTH} bytes.`);\n }\n\n const decipher = crypto.createDecipheriv(ALGORITHM, Buffer.from(key, 'hex'), iv);\n decipher.setAuthTag(authTag);\n\n let decrypted = decipher.update(encrypted, 'hex', 'utf8');\n decrypted += decipher.final('utf8');\n\n return decrypted;\n}\n\n/**\n * Generate a cryptographically secure encryption key\n *\n * @returns 64-character hex string (32 bytes) suitable for AES-256\n *\n * @example\n * ```typescript\n * import { generateEncryptionKey } from '@burdenoff/be-sdk/crypto';\n *\n * const key = generateEncryptionKey();\n * // Store this key securely (e.g., in environment variables)\n * console.log(key); // \"a1b2c3d4e5f6...\"\n * ```\n */\nexport function generateEncryptionKey(): string {\n return crypto.randomBytes(32).toString('hex');\n}\n\n/**\n * Check if a string appears to be encrypted (has the expected format)\n *\n * @param text - The string to check\n * @returns true if the string matches the encrypted format\n *\n * @example\n * ```typescript\n * import { isEncrypted } from '@burdenoff/be-sdk/crypto';\n *\n * if (!isEncrypted(data)) {\n * data = encrypt(data, key);\n * }\n * ```\n */\nexport function isEncrypted(text: string): boolean {\n if (!text) return false;\n\n const parts = text.split(':');\n if (parts.length !== 3) return false;\n\n const [ivHex, authTagHex, ciphertext] = parts;\n\n // Check IV is 32 hex chars (16 bytes)\n if (!ivHex || ivHex.length !== 32 || !/^[0-9a-f]+$/i.test(ivHex)) {\n return false;\n }\n\n // Check auth tag is 32 hex chars (16 bytes)\n if (!authTagHex || authTagHex.length !== 32 || !/^[0-9a-f]+$/i.test(authTagHex)) {\n return false;\n }\n\n // Check ciphertext exists and is hex\n if (!ciphertext || !/^[0-9a-f]+$/i.test(ciphertext)) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Encrypt a value only if it's not already encrypted\n *\n * @param text - The text to potentially encrypt\n * @param key - The encryption key\n * @returns Encrypted text (either newly encrypted or unchanged if already encrypted)\n */\nexport function encryptIfNeeded(text: string, key: string): string {\n if (isEncrypted(text)) {\n return text;\n }\n return encrypt(text, key);\n}\n\n/**\n * Decrypt a value only if it appears to be encrypted\n *\n * @param text - The text to potentially decrypt\n * @param key - The encryption key\n * @returns Decrypted text (either newly decrypted or unchanged if not encrypted)\n */\nexport function decryptIfNeeded(text: string, key: string): string {\n if (!isEncrypted(text)) {\n return text;\n }\n return decrypt(text, key);\n}\n"]}
|
package/dist/chunk-SPRG6G6G.js
DELETED
|
@@ -1,530 +0,0 @@
|
|
|
1
|
-
import { LayerManager } from './chunk-STWFX5E2.js';
|
|
2
|
-
import { signServiceJwt } from './chunk-VFCMR5GX.js';
|
|
3
|
-
import { ContextManager } from './chunk-RZOFS2BQ.js';
|
|
4
|
-
import { CircuitState, GatewayError, GatewayErrorType } from './chunk-QWNNFE4P.js';
|
|
5
|
-
import { currentEnvironment, isDeployedEnvironment } from './chunk-A5F6Z5UE.js';
|
|
6
|
-
import { DEFAULT_CIRCUIT_BREAKER_CONFIG, DEFAULT_GATEWAY_RETRY_CONFIG } from './chunk-5CAFHK2Z.js';
|
|
7
|
-
import { logger } from './chunk-RU266375.js';
|
|
8
|
-
import { __name } from './chunk-XE4OXN2W.js';
|
|
9
|
-
|
|
10
|
-
// src/gateway/service-jwt-guard.ts
|
|
11
|
-
var SERVICE_JWT_SECRET_ENV = "SERVICE_JWT_SECRET";
|
|
12
|
-
function serviceJwtMisconfigurationMessage(context) {
|
|
13
|
-
const environment = currentEnvironment() || "unset";
|
|
14
|
-
const layer = context.layer ?? "{layer}";
|
|
15
|
-
const operation = context.operationName ? ` (operation ${context.operationName})` : "";
|
|
16
|
-
const identity = context.serviceIdentity ? ` as '${context.serviceIdentity}'` : "";
|
|
17
|
-
return `[GatewayClient] Cross-layer call to ${context.gatewayUrl}${operation} cannot be authenticated${identity}: ${SERVICE_JWT_SECRET_ENV} is not set, so no service JWT can be minted. The peer layer's public gateway will strip actor headers and the subgraph will reject the request, so this call cannot succeed. Refusing to send it with DEPLOY_ENV=${environment}. Set ${SERVICE_JWT_SECRET_ENV} in boff/${environment}/${layer}/{module} \u2014 it must match the value the peer layer's gateway verifies with, which is per-environment and must never be copied across environments.`;
|
|
18
|
-
}
|
|
19
|
-
__name(serviceJwtMisconfigurationMessage, "serviceJwtMisconfigurationMessage");
|
|
20
|
-
function assertServiceJwtConfigured(context) {
|
|
21
|
-
if (!isDeployedEnvironment()) return;
|
|
22
|
-
throw new Error(serviceJwtMisconfigurationMessage(context));
|
|
23
|
-
}
|
|
24
|
-
__name(assertServiceJwtConfigured, "assertServiceJwtConfigured");
|
|
25
|
-
|
|
26
|
-
// src/gateway/client.ts
|
|
27
|
-
var uuidv4 = /* @__PURE__ */ __name(() => crypto.randomUUID(), "uuidv4");
|
|
28
|
-
function hasAuthorizationHeader(headers) {
|
|
29
|
-
for (const key of Object.keys(headers)) {
|
|
30
|
-
if (key.toLowerCase() === "authorization") return true;
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
__name(hasAuthorizationHeader, "hasAuthorizationHeader");
|
|
35
|
-
function isGraphQLError(value) {
|
|
36
|
-
return value !== null && typeof value === "object" && "message" in value && typeof value.message === "string" && (!("extensions" in value) || value.extensions !== null && typeof value.extensions === "object" && !Array.isArray(value.extensions));
|
|
37
|
-
}
|
|
38
|
-
__name(isGraphQLError, "isGraphQLError");
|
|
39
|
-
var TRANSIENT_CLIENT_STATUSES = /* @__PURE__ */ new Set([
|
|
40
|
-
408,
|
|
41
|
-
429
|
|
42
|
-
]);
|
|
43
|
-
function isGatewayClientError(error) {
|
|
44
|
-
if (!(error instanceof GatewayError)) return false;
|
|
45
|
-
if (error.type === GatewayErrorType.GRAPHQL_ERROR) return true;
|
|
46
|
-
if (error.type !== GatewayErrorType.NETWORK_ERROR || error.statusCode === void 0) return false;
|
|
47
|
-
return error.statusCode >= 400 && error.statusCode < 500 && !TRANSIENT_CLIENT_STATUSES.has(error.statusCode);
|
|
48
|
-
}
|
|
49
|
-
__name(isGatewayClientError, "isGatewayClientError");
|
|
50
|
-
function resolveBypassPermissionValue(token = process.env["INTERNAL_SERVICE_TOKEN"]) {
|
|
51
|
-
const normalizedToken = token?.trim();
|
|
52
|
-
if (!normalizedToken) {
|
|
53
|
-
throw new Error("INTERNAL_SERVICE_TOKEN must be configured for bypass-enabled gateway calls");
|
|
54
|
-
}
|
|
55
|
-
return normalizedToken;
|
|
56
|
-
}
|
|
57
|
-
__name(resolveBypassPermissionValue, "resolveBypassPermissionValue");
|
|
58
|
-
var CircuitBreaker = class CircuitBreaker2 {
|
|
59
|
-
static {
|
|
60
|
-
__name(this, "CircuitBreaker");
|
|
61
|
-
}
|
|
62
|
-
state = CircuitState.CLOSED;
|
|
63
|
-
failures = 0;
|
|
64
|
-
successes = 0;
|
|
65
|
-
consecutiveFailures = 0;
|
|
66
|
-
lastFailureTime = null;
|
|
67
|
-
lastSuccessTime = null;
|
|
68
|
-
openedAt = null;
|
|
69
|
-
failureTimestamps = [];
|
|
70
|
-
config;
|
|
71
|
-
constructor(config) {
|
|
72
|
-
this.config = config;
|
|
73
|
-
}
|
|
74
|
-
getState() {
|
|
75
|
-
this.checkStateTransition();
|
|
76
|
-
return this.state;
|
|
77
|
-
}
|
|
78
|
-
recordSuccess() {
|
|
79
|
-
this.successes++;
|
|
80
|
-
this.consecutiveFailures = 0;
|
|
81
|
-
this.lastSuccessTime = Date.now();
|
|
82
|
-
if (this.state === CircuitState.HALF_OPEN) {
|
|
83
|
-
this.state = CircuitState.CLOSED;
|
|
84
|
-
this.failures = 0;
|
|
85
|
-
this.failureTimestamps = [];
|
|
86
|
-
this.openedAt = null;
|
|
87
|
-
logger.info("[CircuitBreaker] Circuit closed after successful test");
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
recordFailure() {
|
|
91
|
-
this.failures++;
|
|
92
|
-
this.consecutiveFailures++;
|
|
93
|
-
this.lastFailureTime = Date.now();
|
|
94
|
-
this.failureTimestamps.push(Date.now());
|
|
95
|
-
const windowStart = Date.now() - this.config.failureWindow;
|
|
96
|
-
this.failureTimestamps = this.failureTimestamps.filter((t) => t > windowStart);
|
|
97
|
-
if (this.state === CircuitState.CLOSED && this.failureTimestamps.length >= this.config.failureThreshold) {
|
|
98
|
-
this.state = CircuitState.OPEN;
|
|
99
|
-
this.openedAt = Date.now();
|
|
100
|
-
logger.warn("[CircuitBreaker] Circuit opened due to failures", {
|
|
101
|
-
failures: this.failureTimestamps.length,
|
|
102
|
-
threshold: this.config.failureThreshold
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
if (this.state === CircuitState.HALF_OPEN) {
|
|
106
|
-
this.state = CircuitState.OPEN;
|
|
107
|
-
this.openedAt = Date.now();
|
|
108
|
-
logger.warn("[CircuitBreaker] Circuit re-opened after failed test");
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
allowRequest() {
|
|
112
|
-
this.checkStateTransition();
|
|
113
|
-
switch (this.state) {
|
|
114
|
-
case CircuitState.CLOSED:
|
|
115
|
-
return true;
|
|
116
|
-
case CircuitState.OPEN:
|
|
117
|
-
return false;
|
|
118
|
-
case CircuitState.HALF_OPEN:
|
|
119
|
-
return true;
|
|
120
|
-
default:
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
forceOpen() {
|
|
125
|
-
this.state = CircuitState.OPEN;
|
|
126
|
-
this.openedAt = Date.now();
|
|
127
|
-
logger.info("[CircuitBreaker] Circuit force-opened");
|
|
128
|
-
}
|
|
129
|
-
forceClose() {
|
|
130
|
-
this.state = CircuitState.CLOSED;
|
|
131
|
-
this.failures = 0;
|
|
132
|
-
this.consecutiveFailures = 0;
|
|
133
|
-
this.failureTimestamps = [];
|
|
134
|
-
this.openedAt = null;
|
|
135
|
-
logger.info("[CircuitBreaker] Circuit force-closed");
|
|
136
|
-
}
|
|
137
|
-
getStats() {
|
|
138
|
-
return {
|
|
139
|
-
state: this.state,
|
|
140
|
-
failures: this.failures,
|
|
141
|
-
successes: this.successes,
|
|
142
|
-
consecutiveFailures: this.consecutiveFailures,
|
|
143
|
-
lastFailureTime: this.lastFailureTime,
|
|
144
|
-
lastSuccessTime: this.lastSuccessTime,
|
|
145
|
-
openedAt: this.openedAt
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
checkStateTransition() {
|
|
149
|
-
if (this.state === CircuitState.OPEN && this.openedAt) {
|
|
150
|
-
const elapsed = Date.now() - this.openedAt;
|
|
151
|
-
if (elapsed >= this.config.resetTimeout) {
|
|
152
|
-
this.state = CircuitState.HALF_OPEN;
|
|
153
|
-
logger.info("[CircuitBreaker] Circuit transitioning to half-open");
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
var GatewayClient = class {
|
|
159
|
-
static {
|
|
160
|
-
__name(this, "GatewayClient");
|
|
161
|
-
}
|
|
162
|
-
config;
|
|
163
|
-
layerManager;
|
|
164
|
-
internalCircuitBreaker;
|
|
165
|
-
crossLayerCircuitBreaker;
|
|
166
|
-
retryConfig;
|
|
167
|
-
defaultHeaders;
|
|
168
|
-
constructor(config) {
|
|
169
|
-
this.config = {
|
|
170
|
-
timeout: 3e4,
|
|
171
|
-
enableLogging: true,
|
|
172
|
-
...config
|
|
173
|
-
};
|
|
174
|
-
this.layerManager = new LayerManager({
|
|
175
|
-
layer: config.layer,
|
|
176
|
-
serviceName: config.serviceName,
|
|
177
|
-
serviceIdentity: config.serviceIdentity
|
|
178
|
-
});
|
|
179
|
-
if (config.internalGatewayUrl) ;
|
|
180
|
-
if (config.crossLayerGatewayUrl) ;
|
|
181
|
-
const cbConfig = {
|
|
182
|
-
...DEFAULT_CIRCUIT_BREAKER_CONFIG,
|
|
183
|
-
...config.circuitBreaker
|
|
184
|
-
};
|
|
185
|
-
this.internalCircuitBreaker = new CircuitBreaker(cbConfig);
|
|
186
|
-
this.crossLayerCircuitBreaker = new CircuitBreaker(cbConfig);
|
|
187
|
-
this.retryConfig = {
|
|
188
|
-
...DEFAULT_GATEWAY_RETRY_CONFIG,
|
|
189
|
-
...config.retry
|
|
190
|
-
};
|
|
191
|
-
this.defaultHeaders = {
|
|
192
|
-
"x-service-identity": this.layerManager.getServiceIdentity(),
|
|
193
|
-
"x-actor-type": "service",
|
|
194
|
-
...config.defaultHeaders
|
|
195
|
-
};
|
|
196
|
-
logger.debug("[GatewayClient] Initialized", {
|
|
197
|
-
layer: config.layer,
|
|
198
|
-
serviceName: config.serviceName,
|
|
199
|
-
internalUrl: this.getInternalUrl(),
|
|
200
|
-
crossLayerUrl: this.getCrossLayerUrl()
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
getInternalUrl() {
|
|
204
|
-
return this.config.internalGatewayUrl || this.layerManager.getInternalGatewayUrl();
|
|
205
|
-
}
|
|
206
|
-
getCrossLayerUrl() {
|
|
207
|
-
return this.config.crossLayerGatewayUrl || this.layerManager.getCrossLayerGatewayUrl();
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Execute internal (same layer) GraphQL query/mutation
|
|
211
|
-
*/
|
|
212
|
-
async internalQuery(options) {
|
|
213
|
-
const context = this.createRequestContext("internal", options);
|
|
214
|
-
return this.executeWithRetry(this.getInternalUrl(), options, this.internalCircuitBreaker, context, {
|
|
215
|
-
bypassPermission: true
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Execute cross-layer GraphQL query/mutation
|
|
220
|
-
*/
|
|
221
|
-
async crossLayerQuery(options) {
|
|
222
|
-
const context = this.createRequestContext("cross-layer", options);
|
|
223
|
-
return this.executeWithRetry(
|
|
224
|
-
this.getCrossLayerUrl(),
|
|
225
|
-
options,
|
|
226
|
-
this.crossLayerCircuitBreaker,
|
|
227
|
-
context,
|
|
228
|
-
{
|
|
229
|
-
bypassPermission: false
|
|
230
|
-
}
|
|
231
|
-
// Cross-layer calls go through public gateway
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Execute GraphQL query/mutation with explicit gateway URL
|
|
236
|
-
*/
|
|
237
|
-
async query(gatewayUrl, options) {
|
|
238
|
-
const context = this.createRequestContext("direct", options);
|
|
239
|
-
return this.executeWithRetry(gatewayUrl, options, this.internalCircuitBreaker, context, {
|
|
240
|
-
bypassPermission: false
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
getInternalCircuitBreaker() {
|
|
244
|
-
return this.internalCircuitBreaker;
|
|
245
|
-
}
|
|
246
|
-
getCrossLayerCircuitBreaker() {
|
|
247
|
-
return this.crossLayerCircuitBreaker;
|
|
248
|
-
}
|
|
249
|
-
getHealthStatus() {
|
|
250
|
-
return {
|
|
251
|
-
internal: {
|
|
252
|
-
url: this.getInternalUrl(),
|
|
253
|
-
circuitState: this.internalCircuitBreaker.getState(),
|
|
254
|
-
stats: this.internalCircuitBreaker.getStats()
|
|
255
|
-
},
|
|
256
|
-
crossLayer: {
|
|
257
|
-
url: this.getCrossLayerUrl(),
|
|
258
|
-
circuitState: this.crossLayerCircuitBreaker.getState(),
|
|
259
|
-
stats: this.crossLayerCircuitBreaker.getStats()
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
updateDefaultHeaders(headers) {
|
|
264
|
-
this.defaultHeaders = {
|
|
265
|
-
...this.defaultHeaders,
|
|
266
|
-
...headers
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
createRequestContext(callType, options) {
|
|
270
|
-
return {
|
|
271
|
-
requestId: uuidv4(),
|
|
272
|
-
actorId: options.headers?.["x-actor-id"] || this.defaultHeaders["x-actor-id"],
|
|
273
|
-
workspaceId: options.headers?.["x-workspace-id"] || this.defaultHeaders["x-workspace-id"],
|
|
274
|
-
startTime: Date.now(),
|
|
275
|
-
callType
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Check if an error should be retried
|
|
280
|
-
*/
|
|
281
|
-
shouldRetryError(error) {
|
|
282
|
-
if (!(error instanceof GatewayError)) {
|
|
283
|
-
return true;
|
|
284
|
-
}
|
|
285
|
-
return error.type !== GatewayErrorType.GRAPHQL_ERROR && error.type !== GatewayErrorType.CIRCUIT_OPEN;
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Calculate retry delay with exponential backoff
|
|
289
|
-
*/
|
|
290
|
-
calculateRetryDelay(attempt) {
|
|
291
|
-
return Math.min(this.retryConfig.initialDelay * Math.pow(this.retryConfig.backoffMultiplier, attempt - 1), this.retryConfig.maxDelay);
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Log retry attempt if logging is enabled
|
|
295
|
-
*/
|
|
296
|
-
logRetryAttempt(context, attempt, maxAttempts, delay, error) {
|
|
297
|
-
if (this.config.enableLogging) {
|
|
298
|
-
logger.warn("[GatewayClient] Request failed, retrying", {
|
|
299
|
-
requestId: context.requestId,
|
|
300
|
-
attempt,
|
|
301
|
-
maxAttempts,
|
|
302
|
-
delay,
|
|
303
|
-
error: error.message
|
|
304
|
-
});
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
async executeWithRetry(gatewayUrl, options, circuitBreaker, context, settings) {
|
|
308
|
-
if (!options.skipCircuitBreaker && !circuitBreaker.allowRequest()) {
|
|
309
|
-
throw new GatewayError(`Circuit breaker is open for ${gatewayUrl}`, GatewayErrorType.CIRCUIT_OPEN, gatewayUrl);
|
|
310
|
-
}
|
|
311
|
-
const maxAttempts = options.skipRetry ? 1 : this.retryConfig.maxAttempts;
|
|
312
|
-
let lastError = null;
|
|
313
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
314
|
-
try {
|
|
315
|
-
const result = await this.executeRequest(gatewayUrl, options, context, settings.bypassPermission);
|
|
316
|
-
if (!options.skipCircuitBreaker) {
|
|
317
|
-
circuitBreaker.recordSuccess();
|
|
318
|
-
}
|
|
319
|
-
return result;
|
|
320
|
-
} catch (error) {
|
|
321
|
-
lastError = error instanceof Error ? error : new Error(String(error));
|
|
322
|
-
const clientError = isGatewayClientError(error);
|
|
323
|
-
if (!options.skipCircuitBreaker) {
|
|
324
|
-
if (clientError) {
|
|
325
|
-
circuitBreaker.recordSuccess();
|
|
326
|
-
} else {
|
|
327
|
-
circuitBreaker.recordFailure();
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
if (clientError || !this.shouldRetryError(error)) {
|
|
331
|
-
throw error;
|
|
332
|
-
}
|
|
333
|
-
if (attempt < maxAttempts) {
|
|
334
|
-
const delay = this.calculateRetryDelay(attempt);
|
|
335
|
-
this.logRetryAttempt(context, attempt, maxAttempts, delay, lastError);
|
|
336
|
-
await this.sleep(delay);
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
throw lastError || new GatewayError("Request failed after retries", GatewayErrorType.UNKNOWN_ERROR, gatewayUrl);
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Build headers for a request
|
|
344
|
-
*/
|
|
345
|
-
buildRequestHeaders(context, options, bypassPermission) {
|
|
346
|
-
const headers = {
|
|
347
|
-
"Content-Type": "application/json",
|
|
348
|
-
"x-request-id": context.requestId,
|
|
349
|
-
"x-call-type": context.callType
|
|
350
|
-
};
|
|
351
|
-
const cfHeaders = context.callType === "cross-layer" ? ContextManager.getCfAccessHeaders() : {};
|
|
352
|
-
Object.assign(headers, cfHeaders);
|
|
353
|
-
for (const [key, value] of Object.entries(this.defaultHeaders)) {
|
|
354
|
-
if (value !== void 0) {
|
|
355
|
-
headers[key] = String(value);
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
if (options.headers) {
|
|
359
|
-
for (const [key, value] of Object.entries(options.headers)) {
|
|
360
|
-
if (value !== void 0) {
|
|
361
|
-
headers[key] = String(value);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
if (bypassPermission) {
|
|
366
|
-
headers["x-bypass-permission"] = resolveBypassPermissionValue();
|
|
367
|
-
headers["x-bypass-source"] = this.layerManager.getServiceIdentity();
|
|
368
|
-
headers["x-bypass-timestamp"] = Date.now().toString();
|
|
369
|
-
}
|
|
370
|
-
const cfCookie = cfHeaders["cookie"];
|
|
371
|
-
if (cfCookie) {
|
|
372
|
-
const existing = headers["cookie"];
|
|
373
|
-
if (!existing) {
|
|
374
|
-
headers["cookie"] = cfCookie;
|
|
375
|
-
} else if (!existing.split(";").some((c) => c.trim() === cfCookie)) {
|
|
376
|
-
headers["cookie"] = `${existing}; ${cfCookie}`;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
return headers;
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Handle GraphQL errors in response
|
|
383
|
-
*/
|
|
384
|
-
handleGraphQLErrors(result, context, gatewayUrl, duration) {
|
|
385
|
-
if (!result.errors || result.errors.length === 0) {
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
const errorMessages = result.errors.map((e) => e.message).join(", ");
|
|
389
|
-
if (this.config.enableLogging) {
|
|
390
|
-
logger.warn("[GatewayClient] GraphQL errors", {
|
|
391
|
-
requestId: context.requestId,
|
|
392
|
-
errors: result.errors,
|
|
393
|
-
duration
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
throw new GatewayError(`GraphQL error: ${errorMessages}`, GatewayErrorType.GRAPHQL_ERROR, gatewayUrl, {
|
|
397
|
-
graphqlErrors: result.errors
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Handle fetch errors
|
|
402
|
-
*/
|
|
403
|
-
handleFetchError(error, context, gatewayUrl, timeout, duration) {
|
|
404
|
-
if (error instanceof GatewayError) {
|
|
405
|
-
throw error;
|
|
406
|
-
}
|
|
407
|
-
if (error instanceof Error) {
|
|
408
|
-
if (error.name === "AbortError") {
|
|
409
|
-
throw new GatewayError(`Request timed out after ${timeout}ms`, GatewayErrorType.TIMEOUT_ERROR, gatewayUrl, {
|
|
410
|
-
cause: error
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
if (this.config.enableLogging) {
|
|
414
|
-
logger.error("[GatewayClient] Request failed", {
|
|
415
|
-
requestId: context.requestId,
|
|
416
|
-
error: error.message,
|
|
417
|
-
duration
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
throw new GatewayError(error.message, GatewayErrorType.NETWORK_ERROR, gatewayUrl, {
|
|
421
|
-
cause: error
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
throw new GatewayError(String(error), GatewayErrorType.UNKNOWN_ERROR, gatewayUrl);
|
|
425
|
-
}
|
|
426
|
-
async executeRequest(gatewayUrl, options, context, bypassPermission) {
|
|
427
|
-
const timeout = options.timeout || this.config.timeout || 3e4;
|
|
428
|
-
const headers = this.buildRequestHeaders(context, options, bypassPermission);
|
|
429
|
-
if (context.callType === "cross-layer" && !hasAuthorizationHeader(headers)) {
|
|
430
|
-
const serviceActorId = this.layerManager.getServiceIdentity();
|
|
431
|
-
const serviceJwt = await signServiceJwt(serviceActorId);
|
|
432
|
-
if (serviceJwt) {
|
|
433
|
-
headers["Authorization"] = `Bearer ${serviceJwt}`;
|
|
434
|
-
} else {
|
|
435
|
-
assertServiceJwtConfigured({
|
|
436
|
-
gatewayUrl,
|
|
437
|
-
operationName: options.operationName,
|
|
438
|
-
layer: this.layerManager.getLayer(),
|
|
439
|
-
serviceIdentity: serviceActorId
|
|
440
|
-
});
|
|
441
|
-
if (this.config.enableLogging) {
|
|
442
|
-
logger.debug("[GatewayClient] SERVICE_JWT_SECRET not configured \u2014 cross-layer call will proceed without service JWT", {
|
|
443
|
-
requestId: context.requestId,
|
|
444
|
-
gatewayUrl
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
const body = JSON.stringify({
|
|
450
|
-
query: options.query,
|
|
451
|
-
variables: options.variables || {},
|
|
452
|
-
operationName: options.operationName
|
|
453
|
-
});
|
|
454
|
-
if (this.config.enableLogging) {
|
|
455
|
-
logger.debug("[GatewayClient] Executing request", {
|
|
456
|
-
requestId: context.requestId,
|
|
457
|
-
gatewayUrl,
|
|
458
|
-
operationName: options.operationName,
|
|
459
|
-
callType: context.callType,
|
|
460
|
-
bypassPermission
|
|
461
|
-
});
|
|
462
|
-
}
|
|
463
|
-
try {
|
|
464
|
-
const controller = new AbortController();
|
|
465
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
466
|
-
const response = await fetch(gatewayUrl, {
|
|
467
|
-
method: "POST",
|
|
468
|
-
headers,
|
|
469
|
-
body,
|
|
470
|
-
signal: controller.signal
|
|
471
|
-
});
|
|
472
|
-
clearTimeout(timeoutId);
|
|
473
|
-
const duration = Date.now() - context.startTime;
|
|
474
|
-
if (!response.ok) {
|
|
475
|
-
let graphqlErrors;
|
|
476
|
-
try {
|
|
477
|
-
const body2 = await response.json();
|
|
478
|
-
if (body2 !== null && typeof body2 === "object" && "errors" in body2 && Array.isArray(body2.errors) && body2.errors.length > 0 && body2.errors.every(isGraphQLError)) graphqlErrors = body2.errors;
|
|
479
|
-
} catch {
|
|
480
|
-
}
|
|
481
|
-
const httpMessage = `HTTP ${response.status}: ${response.statusText}`;
|
|
482
|
-
throw new GatewayError(graphqlErrors ? `${httpMessage} (GraphQL error: ${graphqlErrors.map((e) => e.message).join(", ")})` : httpMessage, graphqlErrors && response.status < 500 ? GatewayErrorType.GRAPHQL_ERROR : GatewayErrorType.NETWORK_ERROR, gatewayUrl, {
|
|
483
|
-
statusCode: response.status,
|
|
484
|
-
graphqlErrors
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
const result = await response.json();
|
|
488
|
-
this.handleGraphQLErrors(result, context, gatewayUrl, duration);
|
|
489
|
-
if (this.config.enableLogging) {
|
|
490
|
-
logger.debug("[GatewayClient] Request completed", {
|
|
491
|
-
requestId: context.requestId,
|
|
492
|
-
duration,
|
|
493
|
-
hasData: !!result.data
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
return result;
|
|
497
|
-
} catch (error) {
|
|
498
|
-
const duration = Date.now() - context.startTime;
|
|
499
|
-
this.handleFetchError(error, context, gatewayUrl, timeout, duration);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
sleep(ms) {
|
|
503
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
504
|
-
}
|
|
505
|
-
};
|
|
506
|
-
function createGatewayClient(config) {
|
|
507
|
-
return new GatewayClient(config);
|
|
508
|
-
}
|
|
509
|
-
__name(createGatewayClient, "createGatewayClient");
|
|
510
|
-
function createGatewayClientFromEnv() {
|
|
511
|
-
const layer = process.env["SERVICE_LAYER"];
|
|
512
|
-
if (!layer || layer !== "wspace" && layer !== "global") {
|
|
513
|
-
throw new Error(`[GatewayClient] Invalid or missing SERVICE_LAYER. Expected 'wspace' or 'global', got '${layer}'`);
|
|
514
|
-
}
|
|
515
|
-
const serviceName = process.env["SERVICE_NAME"];
|
|
516
|
-
if (!serviceName) {
|
|
517
|
-
throw new Error("[GatewayClient] SERVICE_NAME environment variable is required");
|
|
518
|
-
}
|
|
519
|
-
const serviceIdentity = process.env["SERVICE_IDENTITY"] || serviceName;
|
|
520
|
-
return new GatewayClient({
|
|
521
|
-
layer,
|
|
522
|
-
serviceName,
|
|
523
|
-
serviceIdentity
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
__name(createGatewayClientFromEnv, "createGatewayClientFromEnv");
|
|
527
|
-
|
|
528
|
-
export { GatewayClient, createGatewayClient, createGatewayClientFromEnv, isGatewayClientError, resolveBypassPermissionValue };
|
|
529
|
-
//# sourceMappingURL=chunk-SPRG6G6G.js.map
|
|
530
|
-
//# sourceMappingURL=chunk-SPRG6G6G.js.map
|