@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 @@
|
|
|
1
|
+
{"version":3,"file":"client-sAJTrb4i.js","names":[],"sources":["../src/gateway/service-jwt-guard.ts","../src/gateway/client.ts"],"sourcesContent":["/**\n * Cross-layer service-JWT configuration guard.\n *\n * A cross-layer call transits the peer layer's PUBLIC gateway, which propagates\n * `x-actor-*` context to subgraphs only when the request carries a valid JWT.\n * Without one the gateway strips those headers as potential client spoofing and\n * the subgraph rejects the call. So on a cross-layer request with no\n * Authorization header and no mintable service JWT, the outcome is already\n * decided before the request leaves the process: it will fail, downstream, with\n * an authentication error that names the callee rather than the missing secret.\n *\n * That is a bad trade in a deployed environment. It converts a one-line config\n * problem into an opaque failure attributed to the wrong service, and — because\n * several cross-layer callers treat these calls as best-effort and swallow the\n * error — into no visible failure at all. Alpha ran exactly that way: 414 calls\n * in 24h on `AddWorkspaceMemberFromWspace` and `WorkspaceOrganization`, every\n * one rejected, workspace-member mirroring silently not happening, and nothing\n * in the caller's logs above debug level.\n *\n * So in alpha, staging and production this throws before the request is sent,\n * naming the secret and the bundle to fix. Locally it stays a log: a laptop\n * calling across layers without a service JWT is a normal state while a\n * developer is mid-setup, and failing their `bun run dev` would be hostile.\n *\n * Verified inert before shipping, the same way the cache guard was: of the\n * alpha and prod service bundles in Secrets Manager, every be-sdk service that\n * makes cross-layer calls already carries `SERVICE_JWT_SECRET` (166 bundles).\n * The bundles without it are Temporal, OPA, the OTel collectors, NATS, Gatus,\n * the vibetunnels pair, the ai-assistant trio, the dormant `*-community`\n * deployments and the retired `state-archive-*` configs — none of which\n * constructs a GatewayClient or makes a cross-layer call. Nothing changes\n * today; this only catches the next caller rolled out without the secret.\n */\nimport { isDeployedEnvironment, currentEnvironment } from '../runtime/deployed-environment.js';\n\n/** Env var that must hold the signing key for service-actor JWTs. */\nexport const SERVICE_JWT_SECRET_ENV = 'SERVICE_JWT_SECRET';\n\nexport interface ServiceJwtGuardContext {\n /** Absolute URL of the peer gateway the call was about to be sent to. */\n gatewayUrl: string;\n /** GraphQL operation name, when the caller supplied one. */\n operationName?: string;\n /** Layer boundary of the CALLER, used to name the bundle to fix. */\n layer?: string;\n /** Service identity the JWT would have been minted for. */\n serviceIdentity?: string;\n}\n\n/**\n * Build the operator-facing explanation. Exported so the message itself is\n * covered by tests — a guard whose text does not say what to change just moves\n * the debugging, it does not remove it.\n */\nexport function serviceJwtMisconfigurationMessage(context: ServiceJwtGuardContext): string {\n const environment = currentEnvironment() || 'unset';\n const layer = context.layer ?? '{layer}';\n const operation = context.operationName ? ` (operation ${context.operationName})` : '';\n const identity = context.serviceIdentity ? ` as '${context.serviceIdentity}'` : '';\n return (\n `[GatewayClient] Cross-layer call to ${context.gatewayUrl}${operation} cannot be authenticated${identity}: ` +\n `${SERVICE_JWT_SECRET_ENV} is not set, so no service JWT can be minted. The peer layer's public ` +\n `gateway will strip actor headers and the subgraph will reject the request, so this call cannot ` +\n `succeed. Refusing to send it with DEPLOY_ENV=${environment}. Set ${SERVICE_JWT_SECRET_ENV} in ` +\n `boff/${environment}/${layer}/{module} — it must match the value the peer layer's gateway ` +\n `verifies with, which is per-environment and must never be copied across environments.`\n );\n}\n\n/**\n * Throw in a deployed environment when a cross-layer call is about to be sent\n * with no way to authenticate it. Returns normally everywhere else, and\n * whenever a JWT was available — so this costs nothing on the happy path.\n */\nexport function assertServiceJwtConfigured(context: ServiceJwtGuardContext): void {\n if (!isDeployedEnvironment()) return;\n throw new Error(serviceJwtMisconfigurationMessage(context));\n}\n","/**\n * Unified Gateway Client\n *\n * Provides a layer-aware GraphQL client with circuit breaker,\n * retry logic, and automatic header management for M2M communication.\n *\n * @module gateway/client\n * @category Gateway\n *\n * @example\n * ```typescript\n * import { GatewayClient } from '@burdenoff/be-sdk/gateway';\n *\n * const client = new GatewayClient({\n * layer: 'wspace',\n * serviceName: 'wspace-tags-svc',\n * });\n *\n * // Internal call (same layer)\n * const result = await client.internalQuery({\n * query: `query { getTag(id: \"123\") { id name } }`,\n * });\n *\n * // Cross-layer call\n * const authResult = await client.crossLayerQuery({\n * query: `query { getCurrentUser { id email } }`,\n * });\n * ```\n */\n\nimport { ContextManager } from '../context/index.js';\nimport { LayerManager } from '../layer/index.js';\nimport { logger } from '../logger/index.js';\nimport { signServiceJwt } from './service-jwt.js';\nimport { assertServiceJwtConfigured } from './service-jwt-guard.js';\nimport {\n DEFAULT_CIRCUIT_BREAKER_CONFIG,\n DEFAULT_GATEWAY_RETRY_CONFIG,\n type CircuitBreakerConfig,\n type GatewayRequestHeaders,\n type GatewayRetryConfig,\n type ServiceLayer,\n} from '../types/layer.js';\nimport {\n CircuitState,\n GatewayError,\n GatewayErrorType,\n type CircuitBreakerStats,\n type GatewayClientConfig,\n type GatewayClientHealth,\n type GraphQLError,\n type GraphQLRequestOptions,\n type GraphQLResponse,\n type ICircuitBreaker,\n type IGatewayClient,\n type RequestContext,\n} from './types.js';\n\nconst uuidv4 = (): string => crypto.randomUUID();\n\n/**\n * Case-insensitive presence check for the `Authorization` header. HTTP header\n * names are case-insensitive (RFC 7230), and while the outbound `fetch` will\n * preserve whatever casing the caller supplies, callers may legitimately set\n * `authorization` / `Authorization` / even `AUTHORIZATION` via defaultHeaders\n * or options.headers. We must not overwrite an already-supplied token.\n */\nfunction hasAuthorizationHeader(headers: Record<string, string>): boolean {\n for (const key of Object.keys(headers)) {\n if (key.toLowerCase() === 'authorization') return true;\n }\n return false;\n}\n\nfunction isGraphQLError(value: unknown): value is GraphQLError {\n return (\n value !== null &&\n typeof value === 'object' &&\n 'message' in value &&\n typeof value.message === 'string' &&\n (!('extensions' in value) ||\n (value.extensions !== null && typeof value.extensions === 'object' && !Array.isArray(value.extensions)))\n );\n}\n\n/**\n * HTTP statuses in the 4xx range that describe a transient condition rather than\n * a problem with the request itself: the request timed out at the peer (408) or\n * the peer is shedding load (429 without a GraphQL body, i.e. an edge or proxy\n * limit). Those stay retryable and still count toward the circuit breaker.\n */\nconst TRANSIENT_CLIENT_STATUSES: ReadonlySet<number> = new Set([408, 429]);\n\n/**\n * Is this failure a definitive answer about the request rather than a sign that\n * the gateway or the transport is unhealthy?\n *\n * True for:\n * - `GRAPHQL_ERROR`: the gateway executed the operation and answered with\n * GraphQL errors (for example `NOT_FOUND`, `BAD_USER_INPUT`, `FORBIDDEN`),\n * whether that arrived with HTTP 200 or with a 4xx status;\n * - an HTTP 4xx without a GraphQL body (for example an edge 403 or 404), except\n * the transient statuses 408 and 429.\n *\n * Such failures are never retried (the same request gets the same answer) and\n * are not counted toward the circuit breaker: a burst of legitimate \"not found\"\n * lookups must not open the circuit for every other call the service makes.\n *\n * @param error - Anything thrown by a GatewayClient call\n * @returns Whether the error is a client error in the sense above\n */\nexport function isGatewayClientError(error: unknown): boolean {\n if (!(error instanceof GatewayError)) return false;\n if (error.type === GatewayErrorType.GRAPHQL_ERROR) return true;\n if (error.type !== GatewayErrorType.NETWORK_ERROR || error.statusCode === undefined) return false;\n return error.statusCode >= 400 && error.statusCode < 500 && !TRANSIENT_CLIENT_STATUSES.has(error.statusCode);\n}\n\nexport function resolveBypassPermissionValue(\n token: string | undefined = process.env['INTERNAL_SERVICE_TOKEN']\n): string {\n const normalizedToken = token?.trim();\n\n if (!normalizedToken) {\n throw new Error('INTERNAL_SERVICE_TOKEN must be configured for bypass-enabled gateway calls');\n }\n\n return normalizedToken;\n}\n\n/**\n * Circuit Breaker Implementation\n */\nclass CircuitBreaker implements ICircuitBreaker {\n private state: CircuitState = CircuitState.CLOSED;\n private failures = 0;\n private successes = 0;\n private consecutiveFailures = 0;\n private lastFailureTime: number | null = null;\n private lastSuccessTime: number | null = null;\n private openedAt: number | null = null;\n private failureTimestamps: number[] = [];\n private config: CircuitBreakerConfig;\n\n constructor(config: CircuitBreakerConfig) {\n this.config = config;\n }\n\n getState(): CircuitState {\n this.checkStateTransition();\n return this.state;\n }\n\n recordSuccess(): void {\n this.successes++;\n this.consecutiveFailures = 0;\n this.lastSuccessTime = Date.now();\n\n if (this.state === CircuitState.HALF_OPEN) {\n this.state = CircuitState.CLOSED;\n this.failures = 0;\n this.failureTimestamps = [];\n this.openedAt = null;\n logger.info('[CircuitBreaker] Circuit closed after successful test');\n }\n }\n\n recordFailure(): void {\n this.failures++;\n this.consecutiveFailures++;\n this.lastFailureTime = Date.now();\n this.failureTimestamps.push(Date.now());\n\n // Clean up old timestamps\n const windowStart = Date.now() - this.config.failureWindow;\n this.failureTimestamps = this.failureTimestamps.filter((t) => t > windowStart);\n\n // Check if we should open the circuit\n if (this.state === CircuitState.CLOSED && this.failureTimestamps.length >= this.config.failureThreshold) {\n this.state = CircuitState.OPEN;\n this.openedAt = Date.now();\n logger.warn('[CircuitBreaker] Circuit opened due to failures', {\n failures: this.failureTimestamps.length,\n threshold: this.config.failureThreshold,\n });\n }\n\n // If we're half-open and fail, go back to open\n if (this.state === CircuitState.HALF_OPEN) {\n this.state = CircuitState.OPEN;\n this.openedAt = Date.now();\n logger.warn('[CircuitBreaker] Circuit re-opened after failed test');\n }\n }\n\n allowRequest(): boolean {\n this.checkStateTransition();\n\n switch (this.state) {\n case CircuitState.CLOSED:\n return true;\n case CircuitState.OPEN:\n return false;\n case CircuitState.HALF_OPEN:\n // Allow one test request\n return true;\n default:\n return true;\n }\n }\n\n forceOpen(): void {\n this.state = CircuitState.OPEN;\n this.openedAt = Date.now();\n logger.info('[CircuitBreaker] Circuit force-opened');\n }\n\n forceClose(): void {\n this.state = CircuitState.CLOSED;\n this.failures = 0;\n this.consecutiveFailures = 0;\n this.failureTimestamps = [];\n this.openedAt = null;\n logger.info('[CircuitBreaker] Circuit force-closed');\n }\n\n getStats(): CircuitBreakerStats {\n return {\n state: this.state,\n failures: this.failures,\n successes: this.successes,\n consecutiveFailures: this.consecutiveFailures,\n lastFailureTime: this.lastFailureTime,\n lastSuccessTime: this.lastSuccessTime,\n openedAt: this.openedAt,\n };\n }\n\n private checkStateTransition(): void {\n if (this.state === CircuitState.OPEN && this.openedAt) {\n const elapsed = Date.now() - this.openedAt;\n if (elapsed >= this.config.resetTimeout) {\n this.state = CircuitState.HALF_OPEN;\n logger.info('[CircuitBreaker] Circuit transitioning to half-open');\n }\n }\n }\n}\n\n/**\n * Unified Gateway Client\n */\nexport class GatewayClient implements IGatewayClient {\n private config: GatewayClientConfig;\n private layerManager: LayerManager;\n private internalCircuitBreaker: CircuitBreaker;\n private crossLayerCircuitBreaker: CircuitBreaker;\n private retryConfig: GatewayRetryConfig;\n private defaultHeaders: GatewayRequestHeaders;\n\n constructor(config: GatewayClientConfig) {\n this.config = {\n timeout: 30000,\n enableLogging: true,\n ...config,\n };\n\n // Initialize layer manager\n this.layerManager = new LayerManager({\n layer: config.layer,\n serviceName: config.serviceName,\n serviceIdentity: config.serviceIdentity,\n });\n\n // Override URLs if provided\n if (config.internalGatewayUrl) {\n // Use getter internally, but we'll store the override\n }\n if (config.crossLayerGatewayUrl) {\n // Use getter internally, but we'll store the override\n }\n\n // Initialize circuit breakers\n const cbConfig: CircuitBreakerConfig = {\n ...DEFAULT_CIRCUIT_BREAKER_CONFIG,\n ...config.circuitBreaker,\n };\n this.internalCircuitBreaker = new CircuitBreaker(cbConfig);\n this.crossLayerCircuitBreaker = new CircuitBreaker(cbConfig);\n\n // Initialize retry config\n this.retryConfig = {\n ...DEFAULT_GATEWAY_RETRY_CONFIG,\n ...config.retry,\n };\n\n // Initialize default headers\n this.defaultHeaders = {\n 'x-service-identity': this.layerManager.getServiceIdentity(),\n 'x-actor-type': 'service',\n ...config.defaultHeaders,\n };\n\n logger.debug('[GatewayClient] Initialized', {\n layer: config.layer,\n serviceName: config.serviceName,\n internalUrl: this.getInternalUrl(),\n crossLayerUrl: this.getCrossLayerUrl(),\n });\n }\n\n private getInternalUrl(): string {\n return this.config.internalGatewayUrl || this.layerManager.getInternalGatewayUrl();\n }\n\n private getCrossLayerUrl(): string {\n return this.config.crossLayerGatewayUrl || this.layerManager.getCrossLayerGatewayUrl();\n }\n\n /**\n * Execute internal (same layer) GraphQL query/mutation\n */\n async internalQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>> {\n const context = this.createRequestContext('internal', options);\n\n return this.executeWithRetry(this.getInternalUrl(), options, this.internalCircuitBreaker, context, {\n bypassPermission: true,\n });\n }\n\n /**\n * Execute cross-layer GraphQL query/mutation\n */\n async crossLayerQuery<T = unknown>(options: GraphQLRequestOptions): Promise<GraphQLResponse<T>> {\n const context = this.createRequestContext('cross-layer', options);\n\n return this.executeWithRetry(\n this.getCrossLayerUrl(),\n options,\n this.crossLayerCircuitBreaker,\n context,\n { bypassPermission: false } // Cross-layer calls go through public gateway\n );\n }\n\n /**\n * Execute GraphQL query/mutation with explicit gateway URL\n */\n async query<T = unknown>(gatewayUrl: string, options: GraphQLRequestOptions): Promise<GraphQLResponse<T>> {\n const context = this.createRequestContext('direct', options);\n\n // Use internal circuit breaker for direct calls\n return this.executeWithRetry(gatewayUrl, options, this.internalCircuitBreaker, context, {\n bypassPermission: false,\n });\n }\n\n getInternalCircuitBreaker(): ICircuitBreaker {\n return this.internalCircuitBreaker;\n }\n\n getCrossLayerCircuitBreaker(): ICircuitBreaker {\n return this.crossLayerCircuitBreaker;\n }\n\n getHealthStatus(): GatewayClientHealth {\n return {\n internal: {\n url: this.getInternalUrl(),\n circuitState: this.internalCircuitBreaker.getState(),\n stats: this.internalCircuitBreaker.getStats(),\n },\n crossLayer: {\n url: this.getCrossLayerUrl(),\n circuitState: this.crossLayerCircuitBreaker.getState(),\n stats: this.crossLayerCircuitBreaker.getStats(),\n },\n };\n }\n\n updateDefaultHeaders(headers: Partial<GatewayRequestHeaders>): void {\n this.defaultHeaders = { ...this.defaultHeaders, ...headers };\n }\n\n private createRequestContext(\n callType: 'internal' | 'cross-layer' | 'direct',\n options: GraphQLRequestOptions\n ): RequestContext {\n return {\n requestId: uuidv4(),\n actorId: options.headers?.['x-actor-id'] || this.defaultHeaders['x-actor-id'],\n workspaceId: options.headers?.['x-workspace-id'] || this.defaultHeaders['x-workspace-id'],\n startTime: Date.now(),\n callType,\n };\n }\n\n /**\n * Check if an error should be retried\n */\n private shouldRetryError(error: unknown): boolean {\n if (!(error instanceof GatewayError)) {\n return true;\n }\n // Don't retry GraphQL errors or circuit open errors\n return error.type !== GatewayErrorType.GRAPHQL_ERROR && error.type !== GatewayErrorType.CIRCUIT_OPEN;\n }\n\n /**\n * Calculate retry delay with exponential backoff\n */\n private calculateRetryDelay(attempt: number): number {\n return Math.min(\n this.retryConfig.initialDelay * Math.pow(this.retryConfig.backoffMultiplier, attempt - 1),\n this.retryConfig.maxDelay\n );\n }\n\n /**\n * Log retry attempt if logging is enabled\n */\n private logRetryAttempt(\n context: RequestContext,\n attempt: number,\n maxAttempts: number,\n delay: number,\n error: Error\n ): void {\n if (this.config.enableLogging) {\n logger.warn('[GatewayClient] Request failed, retrying', {\n requestId: context.requestId,\n attempt,\n maxAttempts,\n delay,\n error: error.message,\n });\n }\n }\n\n private async executeWithRetry<T>(\n gatewayUrl: string,\n options: GraphQLRequestOptions,\n circuitBreaker: CircuitBreaker,\n context: RequestContext,\n settings: { bypassPermission: boolean }\n ): Promise<GraphQLResponse<T>> {\n // Check circuit breaker\n if (!options.skipCircuitBreaker && !circuitBreaker.allowRequest()) {\n throw new GatewayError(`Circuit breaker is open for ${gatewayUrl}`, GatewayErrorType.CIRCUIT_OPEN, gatewayUrl);\n }\n\n const maxAttempts = options.skipRetry ? 1 : this.retryConfig.maxAttempts;\n let lastError: Error | null = null;\n\n for (let attempt = 1; attempt <= maxAttempts; attempt++) {\n try {\n const result = await this.executeRequest<T>(gatewayUrl, options, context, settings.bypassPermission);\n if (!options.skipCircuitBreaker) {\n circuitBreaker.recordSuccess();\n }\n return result;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n const clientError = isGatewayClientError(error);\n if (!options.skipCircuitBreaker) {\n // A client error means the gateway answered: record it as a healthy\n // round trip (which also closes a half-open circuit) instead of a failure.\n if (clientError) {\n circuitBreaker.recordSuccess();\n } else {\n circuitBreaker.recordFailure();\n }\n }\n\n if (clientError || !this.shouldRetryError(error)) {\n throw error;\n }\n\n if (attempt < maxAttempts) {\n const delay = this.calculateRetryDelay(attempt);\n this.logRetryAttempt(context, attempt, maxAttempts, delay, lastError);\n await this.sleep(delay);\n }\n }\n }\n\n throw lastError || new GatewayError('Request failed after retries', GatewayErrorType.UNKNOWN_ERROR, gatewayUrl);\n }\n\n /**\n * Build headers for a request\n */\n private buildRequestHeaders(\n context: RequestContext,\n options: GraphQLRequestOptions,\n bypassPermission: boolean\n ): Record<string, string> {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n 'x-request-id': context.requestId,\n 'x-call-type': context.callType,\n };\n\n // Cross-layer calls transit the peer layer's PUBLIC gateway, which on alpha\n // sits behind Cloudflare Access. Re-present the inbound request's CF creds\n // (service token and/or the CF_Authorization cookie) so the call passes the\n // CF edge. Added before default/request headers so a caller may still\n // override the non-cookie CF headers explicitly; the CF cookie is reconciled\n // after the merges below so it is never silently clobbered. No-op when the\n // inbound request carried no CF creds (local dev, production) — returns {}.\n const cfHeaders = context.callType === 'cross-layer' ? ContextManager.getCfAccessHeaders() : {};\n Object.assign(headers, cfHeaders);\n\n // Add default headers\n for (const [key, value] of Object.entries(this.defaultHeaders)) {\n if (value !== undefined) {\n headers[key] = String(value);\n }\n }\n\n // Add request-specific headers\n if (options.headers) {\n for (const [key, value] of Object.entries(options.headers)) {\n if (value !== undefined) {\n headers[key] = String(value);\n }\n }\n }\n\n // Add bypass headers for internal calls\n if (bypassPermission) {\n headers['x-bypass-permission'] = resolveBypassPermissionValue();\n headers['x-bypass-source'] = this.layerManager.getServiceIdentity();\n headers['x-bypass-timestamp'] = Date.now().toString();\n }\n\n // Reconcile the CF_Authorization cookie: the default/request-header merges\n // above may set their own `cookie`, which would otherwise clobber the CF\n // cookie applied earlier (or vice versa). Merge so both survive, without\n // duplicating if it's already present.\n const cfCookie = cfHeaders['cookie'];\n if (cfCookie) {\n const existing = headers['cookie'];\n if (!existing) {\n headers['cookie'] = cfCookie;\n } else if (!existing.split(';').some((c) => c.trim() === cfCookie)) {\n headers['cookie'] = `${existing}; ${cfCookie}`;\n }\n }\n\n return headers;\n }\n\n /**\n * Handle GraphQL errors in response\n */\n private handleGraphQLErrors<T>(\n result: GraphQLResponse<T>,\n context: RequestContext,\n gatewayUrl: string,\n duration: number\n ): void {\n if (!result.errors || result.errors.length === 0) {\n return;\n }\n\n const errorMessages = result.errors.map((e: GraphQLError) => e.message).join(', ');\n\n if (this.config.enableLogging) {\n logger.warn('[GatewayClient] GraphQL errors', {\n requestId: context.requestId,\n errors: result.errors,\n duration,\n });\n }\n\n throw new GatewayError(`GraphQL error: ${errorMessages}`, GatewayErrorType.GRAPHQL_ERROR, gatewayUrl, {\n graphqlErrors: result.errors,\n });\n }\n\n /**\n * Handle fetch errors\n */\n private handleFetchError(\n error: unknown,\n context: RequestContext,\n gatewayUrl: string,\n timeout: number,\n duration: number\n ): never {\n if (error instanceof GatewayError) {\n throw error;\n }\n\n if (error instanceof Error) {\n if (error.name === 'AbortError') {\n throw new GatewayError(`Request timed out after ${timeout}ms`, GatewayErrorType.TIMEOUT_ERROR, gatewayUrl, {\n cause: error,\n });\n }\n\n if (this.config.enableLogging) {\n logger.error('[GatewayClient] Request failed', {\n requestId: context.requestId,\n error: error.message,\n duration,\n });\n }\n\n throw new GatewayError(error.message, GatewayErrorType.NETWORK_ERROR, gatewayUrl, {\n cause: error,\n });\n }\n\n throw new GatewayError(String(error), GatewayErrorType.UNKNOWN_ERROR, gatewayUrl);\n }\n\n private async executeRequest<T>(\n gatewayUrl: string,\n options: GraphQLRequestOptions,\n context: RequestContext,\n bypassPermission: boolean\n ): Promise<GraphQLResponse<T>> {\n const timeout = options.timeout || this.config.timeout || 30000;\n const headers = this.buildRequestHeaders(context, options, bypassPermission);\n\n // Cross-layer calls transit the peer layer's PUBLIC gateway, which\n // requires JWT auth to propagate actor context. Mint a short-lived\n // service-actor JWT so the gateway admits the call and preserves\n // `x-actor-type: service` downstream. Skipped when the caller has\n // already supplied an Authorization header (e.g., user-originated\n // cross-layer flows) or when SERVICE_JWT_SECRET is unset.\n if (context.callType === 'cross-layer' && !hasAuthorizationHeader(headers)) {\n const serviceActorId = this.layerManager.getServiceIdentity();\n const serviceJwt = await signServiceJwt(serviceActorId);\n if (serviceJwt) {\n headers['Authorization'] = `Bearer ${serviceJwt}`;\n } else {\n // Without the JWT this call is already decided: the peer layer's public\n // gateway strips actor headers and the subgraph rejects it. Continuing\n // only converts a missing secret into an authentication error that names\n // the callee — and several cross-layer callers swallow that as\n // best-effort, so it surfaces as nothing at all. In a deployed\n // environment, refuse instead. See ./service-jwt-guard.ts.\n assertServiceJwtConfigured({\n gatewayUrl,\n operationName: options.operationName,\n layer: this.layerManager.getLayer(),\n serviceIdentity: serviceActorId,\n });\n if (this.config.enableLogging) {\n logger.debug(\n '[GatewayClient] SERVICE_JWT_SECRET not configured — cross-layer call will proceed without service JWT',\n { requestId: context.requestId, gatewayUrl }\n );\n }\n }\n }\n\n const body = JSON.stringify({\n query: options.query,\n variables: options.variables || {},\n operationName: options.operationName,\n });\n\n if (this.config.enableLogging) {\n logger.debug('[GatewayClient] Executing request', {\n requestId: context.requestId,\n gatewayUrl,\n operationName: options.operationName,\n callType: context.callType,\n bypassPermission,\n });\n }\n\n try {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), timeout);\n\n const response = await fetch(gatewayUrl, {\n method: 'POST',\n headers,\n body,\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n const duration = Date.now() - context.startTime;\n\n if (!response.ok) {\n let graphqlErrors: GraphQLError[] | undefined;\n try {\n const body: unknown = await response.json();\n if (\n body !== null &&\n typeof body === 'object' &&\n 'errors' in body &&\n Array.isArray(body.errors) &&\n body.errors.length > 0 &&\n body.errors.every(isGraphQLError)\n )\n graphqlErrors = body.errors;\n } catch {\n // Edge/proxy errors need not contain JSON; retain the original HTTP failure.\n }\n // Keep the \"HTTP <status>: <text>\" prefix callers may already match on,\n // and append the GraphQL messages so logs show what the gateway said.\n const httpMessage = `HTTP ${response.status}: ${response.statusText}`;\n throw new GatewayError(\n graphqlErrors\n ? `${httpMessage} (GraphQL error: ${graphqlErrors.map((e) => e.message).join(', ')})`\n : httpMessage,\n graphqlErrors && response.status < 500 ? GatewayErrorType.GRAPHQL_ERROR : GatewayErrorType.NETWORK_ERROR,\n gatewayUrl,\n { statusCode: response.status, graphqlErrors }\n );\n }\n\n const result = (await response.json()) as GraphQLResponse<T>;\n this.handleGraphQLErrors(result, context, gatewayUrl, duration);\n\n if (this.config.enableLogging) {\n logger.debug('[GatewayClient] Request completed', {\n requestId: context.requestId,\n duration,\n hasData: !!result.data,\n });\n }\n\n return result;\n } catch (error) {\n const duration = Date.now() - context.startTime;\n this.handleFetchError(error, context, gatewayUrl, timeout, duration);\n }\n }\n\n private sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n}\n\n/**\n * Create a gateway client for a specific layer\n */\nexport function createGatewayClient(config: GatewayClientConfig): GatewayClient {\n return new GatewayClient(config);\n}\n\n/**\n * Create a gateway client from environment variables\n *\n * Required environment variables:\n * - SERVICE_LAYER: 'wspace' | 'global'\n * - SERVICE_NAME: Service name\n *\n * Optional:\n * - SERVICE_IDENTITY: Service identity (defaults to SERVICE_NAME)\n * - {LAYER}_INT_GATEWAY_URL: Internal gateway URL\n * - {OPPOSITE_LAYER}_PUBLIC_GATEWAY_URL: Cross-layer gateway URL\n */\nexport function createGatewayClientFromEnv(): GatewayClient {\n const layer = process.env['SERVICE_LAYER'] as ServiceLayer;\n\n if (!layer || (layer !== 'wspace' && layer !== 'global')) {\n throw new Error(`[GatewayClient] Invalid or missing SERVICE_LAYER. Expected 'wspace' or 'global', got '${layer}'`);\n }\n\n const serviceName = process.env['SERVICE_NAME'];\n if (!serviceName) {\n throw new Error('[GatewayClient] SERVICE_NAME environment variable is required');\n }\n\n const serviceIdentity = process.env['SERVICE_IDENTITY'] || serviceName;\n\n return new GatewayClient({\n layer,\n serviceName,\n serviceIdentity,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,MAAa,yBAAyB;;;;;;AAkBtC,SAAgB,kCAAkC,SAAyC;CACzF,MAAM,cAAc,mBAAmB,KAAK;CAC5C,MAAM,QAAQ,QAAQ,SAAS;CAC/B,MAAM,YAAY,QAAQ,gBAAgB,eAAe,QAAQ,cAAc,KAAK;CACpF,MAAM,WAAW,QAAQ,kBAAkB,QAAQ,QAAQ,gBAAgB,KAAK;CAChF,OACE,uCAAuC,QAAQ,aAAa,UAAU,0BAA0B,SAAS,IACtG,uBAAuB,oNAEsB,YAAY,QAAQ,uBAAuB,WACnF,YAAY,GAAG,MAAM;AAGjC;;;;;;AAOA,SAAgB,2BAA2B,SAAuC;CAChF,IAAI,CAAC,sBAAsB,GAAG;CAC9B,MAAM,IAAI,MAAM,kCAAkC,OAAO,CAAC;AAC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACnBA,MAAM,eAAuB,OAAO,WAAW;;;;;;;;AAS/C,SAAS,uBAAuB,SAA0C;CACxE,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,GACnC,IAAI,IAAI,YAAY,MAAM,iBAAiB,OAAO;CAEpD,OAAO;AACT;AAEA,SAAS,eAAe,OAAuC;CAC7D,OACE,UAAU,QACV,OAAO,UAAU,YACjB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both collectors. The Service also exposes :80 for the same
|
|
4
|
+
* target port, but 4318 is the OTLP convention and says what it is.
|
|
5
|
+
*/
|
|
6
|
+
const OTLP_HTTP_PORT = 4318;
|
|
7
|
+
/** Kubernetes Service DNS for each layer's collector, in the `apps` namespace. */
|
|
8
|
+
const COLLECTOR_SERVICE = {
|
|
9
|
+
global: "otel-collector.apps.svc.cluster.local",
|
|
10
|
+
wspace: "otel-collector-wspace.apps.svc.cluster.local"
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Work out which layer's collector a service should push to.
|
|
14
|
+
*
|
|
15
|
+
* Order of preference:
|
|
16
|
+
* 1. `OTEL_COLLECTOR_LAYER` — an explicit escape hatch for anything whose
|
|
17
|
+
* name does not follow the convention.
|
|
18
|
+
* 2. The declared boundary, when it is a layer. `'gateway'` is not: all four
|
|
19
|
+
* gateways declare it, and two of them live in each cluster.
|
|
20
|
+
* 3. The service-name prefix, which is where the gateways and every worker
|
|
21
|
+
* are actually distinguishable (`wspace-public-gateway`, `global-int-gateway`).
|
|
22
|
+
* 4. `'global'` as a last resort.
|
|
23
|
+
*/
|
|
24
|
+
function resolveCollectorLayer(serviceName, boundary) {
|
|
25
|
+
const override = process.env["OTEL_COLLECTOR_LAYER"];
|
|
26
|
+
if (override === "wspace" || override === "global") return override;
|
|
27
|
+
if (boundary === "wspace" || boundary === "global") return boundary;
|
|
28
|
+
const name = serviceName.toLowerCase();
|
|
29
|
+
if (name.startsWith("wspace-") || name.startsWith("wspace")) return "wspace";
|
|
30
|
+
if (name.startsWith("global-") || name.startsWith("global")) return "global";
|
|
31
|
+
return "global";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Base OTLP endpoint (no signal path). Callers append `/v1/traces` or
|
|
35
|
+
* `/v1/metrics` themselves — this is the shape `bootstrapTelemetry` wants.
|
|
36
|
+
*/
|
|
37
|
+
function defaultCollectorEndpoint(serviceName, boundary) {
|
|
38
|
+
const layer = resolveCollectorLayer(serviceName, boundary);
|
|
39
|
+
return `http://${COLLECTOR_SERVICE[layer]}:${OTLP_HTTP_PORT}`;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Full OTLP traces URL. `OTLPTraceExporter` takes a complete signal URL rather
|
|
43
|
+
* than a base, so the gateway security defaults need this variant.
|
|
44
|
+
*/
|
|
45
|
+
function defaultCollectorTracesEndpoint(serviceName, boundary) {
|
|
46
|
+
return `${defaultCollectorEndpoint(serviceName, boundary)}/v1/traces`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { resolveCollectorLayer as a, defaultCollectorTracesEndpoint as i, OTLP_HTTP_PORT as n, defaultCollectorEndpoint as r, COLLECTOR_SERVICE as t };
|
|
50
|
+
//# sourceMappingURL=collector-endpoint-iyQYeI50.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector-endpoint-iyQYeI50.js","names":[],"sources":["../src/telemetry/collector-endpoint.ts"],"sourcesContent":["/**\n * In-cluster OpenTelemetry collector endpoint resolution.\n *\n * Every Burdenoff service pushes OTLP to the collector that lives in its OWN\n * EKS cluster. There are two, and their Kubernetes Service names differ by\n * layer because both occupy the `apps` namespace convention:\n *\n * global layer (eks-{alpha,prod}-global) -> otel-collector\n * wspace layer (eks-{alpha,prod}-wspace) -> otel-collector-wspace\n *\n * They are in separate clusters and separate VPCs, so the wrong choice is a\n * DNS failure rather than a cross-layer leak.\n *\n * History worth keeping: until 2026-08-25 the two default endpoints in this\n * SDK pointed at hosts that had not existed for months --\n * `alloy.sre.svc.cluster.local` (Alloy runs in the `monitoring` namespace, and\n * its OTLP receiver forwards logs to Loki only -- it never accepted traces)\n * and `tempo.tooling.internal.burdenoff.com` (a retired Azure host). Only the\n * four gateways and four workers per layer set OTEL_EXPORTER_OTLP_ENDPOINT\n * explicitly, so every other service in the fleet resolved a dead name and its\n * spans died in the exporter's retry queue. That is why tracing was\n * fleet-wide broken rather than merely partial.\n *\n * @module telemetry/collector-endpoint\n * @category Telemetry\n */\n\n/** The two deployment layers, each with its own cluster and collector. */\nexport type CollectorLayer = 'wspace' | 'global';\n\n/**\n * OTLP/HTTP port on both collectors. The Service also exposes :80 for the same\n * target port, but 4318 is the OTLP convention and says what it is.\n */\nexport const OTLP_HTTP_PORT = 4318;\n\n/** Kubernetes Service DNS for each layer's collector, in the `apps` namespace. */\nexport const COLLECTOR_SERVICE: Record<CollectorLayer, string> = {\n global: 'otel-collector.apps.svc.cluster.local',\n wspace: 'otel-collector-wspace.apps.svc.cluster.local',\n};\n\n/**\n * Work out which layer's collector a service should push to.\n *\n * Order of preference:\n * 1. `OTEL_COLLECTOR_LAYER` — an explicit escape hatch for anything whose\n * name does not follow the convention.\n * 2. The declared boundary, when it is a layer. `'gateway'` is not: all four\n * gateways declare it, and two of them live in each cluster.\n * 3. The service-name prefix, which is where the gateways and every worker\n * are actually distinguishable (`wspace-public-gateway`, `global-int-gateway`).\n * 4. `'global'` as a last resort.\n */\nexport function resolveCollectorLayer(serviceName: string, boundary?: string): CollectorLayer {\n const override = process.env['OTEL_COLLECTOR_LAYER'];\n if (override === 'wspace' || override === 'global') return override;\n\n if (boundary === 'wspace' || boundary === 'global') return boundary;\n\n const name = serviceName.toLowerCase();\n if (name.startsWith('wspace-') || name.startsWith('wspace')) return 'wspace';\n if (name.startsWith('global-') || name.startsWith('global')) return 'global';\n\n return 'global';\n}\n\n/**\n * Base OTLP endpoint (no signal path). Callers append `/v1/traces` or\n * `/v1/metrics` themselves — this is the shape `bootstrapTelemetry` wants.\n */\nexport function defaultCollectorEndpoint(serviceName: string, boundary?: string): string {\n const layer = resolveCollectorLayer(serviceName, boundary);\n return `http://${COLLECTOR_SERVICE[layer]}:${OTLP_HTTP_PORT}`;\n}\n\n/**\n * Full OTLP traces URL. `OTLPTraceExporter` takes a complete signal URL rather\n * than a base, so the gateway security defaults need this variant.\n */\nexport function defaultCollectorTracesEndpoint(serviceName: string, boundary?: string): string {\n return `${defaultCollectorEndpoint(serviceName, boundary)}/v1/traces`;\n}\n"],"mappings":";;;;;AAkCA,MAAa,iBAAiB;;AAG9B,MAAa,oBAAoD;CAC/D,QAAQ;CACR,QAAQ;AACV;;;;;;;;;;;;;AAcA,SAAgB,sBAAsB,aAAqB,UAAmC;CAC5F,MAAM,WAAW,QAAQ,IAAI;CAC7B,IAAI,aAAa,YAAY,aAAa,UAAU,OAAO;CAE3D,IAAI,aAAa,YAAY,aAAa,UAAU,OAAO;CAE3D,MAAM,OAAO,YAAY,YAAY;CACrC,IAAI,KAAK,WAAW,SAAS,KAAK,KAAK,WAAW,QAAQ,GAAG,OAAO;CACpE,IAAI,KAAK,WAAW,SAAS,KAAK,KAAK,WAAW,QAAQ,GAAG,OAAO;CAEpE,OAAO;AACT;;;;;AAMA,SAAgB,yBAAyB,aAAqB,UAA2B;CACvF,MAAM,QAAQ,sBAAsB,aAAa,QAAQ;CACzD,OAAO,UAAU,kBAAkB,OAAO,GAAG;AAC/C;;;;;AAMA,SAAgB,+BAA+B,aAAqB,UAA2B;CAC7F,OAAO,GAAG,yBAAyB,aAAa,QAAQ,EAAE;AAC5D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { p as SDKContext } from "../index-CTTwo9av.js";
|
|
2
|
+
export declare class ContextManager {
|
|
3
|
+
static getContext(): SDKContext | undefined;
|
|
4
|
+
static setContext(context: SDKContext): void;
|
|
5
|
+
static setCfAccessContext(clientId?: string, clientSecret?: string, cfAuthorization?: string): void;
|
|
6
|
+
static withContext<T>(context: SDKContext, fn: () => Promise<T>): Promise<T>;
|
|
7
|
+
static withContextSync<T>(context: SDKContext, fn: () => T): T;
|
|
8
|
+
static clearContext(): void;
|
|
9
|
+
static getActorId(): string | undefined;
|
|
10
|
+
static getUser(): string | undefined;
|
|
11
|
+
static getWorkspace(): string | undefined;
|
|
12
|
+
static getTenant(): string | undefined;
|
|
13
|
+
static getOrganization(): string | undefined;
|
|
14
|
+
static getProject(): string | undefined;
|
|
15
|
+
static getApp(): string | undefined;
|
|
16
|
+
static getToken(): string | undefined;
|
|
17
|
+
static getProduct(): string | undefined;
|
|
18
|
+
static getCfAccessClientId(): string | undefined;
|
|
19
|
+
static getCfAccessClientSecret(): string | undefined;
|
|
20
|
+
static getCfAuthorization(): string | undefined;
|
|
21
|
+
static getCfAccessHeaders(): Record<string, string>;
|
|
22
|
+
static updateContext(updates: Partial<SDKContext>): void;
|
|
23
|
+
static hasContext(): boolean;
|
|
24
|
+
static getCustomField(key: string): unknown;
|
|
25
|
+
static setCustomField(key: string, value: unknown): void;
|
|
26
|
+
}
|
|
27
|
+
export declare const contextManager: typeof ContextManager;
|
|
28
|
+
export declare function extractContextFromRequest(req: {
|
|
29
|
+
headers: Record<string, string | string[] | undefined>;
|
|
30
|
+
user?: {
|
|
31
|
+
user_id?: string;
|
|
32
|
+
workspace_id?: string;
|
|
33
|
+
tenant_endpoint?: string;
|
|
34
|
+
};
|
|
35
|
+
}): SDKContext;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
3
|
+
// src/context/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Context Module
|
|
6
|
+
* Manages request-scoped context using AsyncLocalStorage
|
|
7
|
+
* Thread-safe context propagation for async operations
|
|
8
|
+
*/
|
|
9
|
+
const asyncLocalStorage = new AsyncLocalStorage();
|
|
10
|
+
/**
|
|
11
|
+
* Module-level fallback for the Cloudflare Access service token.
|
|
12
|
+
*
|
|
13
|
+
* WHY THIS EXISTS — read before "simplifying" it away:
|
|
14
|
+
* `asyncLocalStorage.enterWith()` (used by `setContext`) does NOT reliably
|
|
15
|
+
* propagate across every async boundary under Bun + GraphQL Yoga — the same
|
|
16
|
+
* limitation documented for the Prisma workspace context store
|
|
17
|
+
* (see `src/prisma/workspace-extension.ts`). On top of that, the `createServer`
|
|
18
|
+
* request path (`src/server/context.ts` `buildContext`) populates the *Prisma*
|
|
19
|
+
* workspace store, not this `ContextManager` ALS at all. So a resolver-initiated
|
|
20
|
+
* cross-layer call would otherwise read an empty context and attach no CF creds,
|
|
21
|
+
* making the propagation a silent no-op on alpha.
|
|
22
|
+
*
|
|
23
|
+
* Unlike workspaceId/actorId (which differ per request and would race in a
|
|
24
|
+
* module-level singleton), the CF Access service token is effectively
|
|
25
|
+
* CONSTANT per environment — it's a single service-token pair fronting the
|
|
26
|
+
* gateway. So caching it module-side is race-safe: concurrent requests all
|
|
27
|
+
* carry the same value. It is only ever set when a request actually presents
|
|
28
|
+
* the headers (gated upstream on `cf-ray`), and stays unset in dev/prod where
|
|
29
|
+
* no CF Access sits in front of the gateways.
|
|
30
|
+
*/
|
|
31
|
+
let cfAccessFallback;
|
|
32
|
+
/**
|
|
33
|
+
* Module-level fallback for the CF Access USER-SSO cookie (`CF_Authorization`),
|
|
34
|
+
* mirroring `cfAccessFallback` for the same Bun+Yoga ALS-unreliability reason.
|
|
35
|
+
* Unlike the service-token pair this is per-USER and ~1h TTL — but for passing
|
|
36
|
+
* the CF edge any valid member cookie suffices (app-layer identity travels in
|
|
37
|
+
* `x-actor-*`). Refreshed by every inbound CF request, so an active fleet keeps
|
|
38
|
+
* a live value. See BOFF-2929.
|
|
39
|
+
*/
|
|
40
|
+
let cfAuthorizationFallback;
|
|
41
|
+
/**
|
|
42
|
+
* Context Manager for handling request-scoped context
|
|
43
|
+
*/
|
|
44
|
+
var ContextManager = class {
|
|
45
|
+
/**
|
|
46
|
+
* Get current context from async local storage
|
|
47
|
+
*/
|
|
48
|
+
static getContext() {
|
|
49
|
+
return asyncLocalStorage.getStore();
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Set context for current async scope
|
|
53
|
+
* Merges with existing context if present
|
|
54
|
+
*/
|
|
55
|
+
static setContext(context) {
|
|
56
|
+
const currentContext = this.getContext() || {};
|
|
57
|
+
asyncLocalStorage.enterWith({
|
|
58
|
+
...currentContext,
|
|
59
|
+
...context
|
|
60
|
+
});
|
|
61
|
+
if (context.cfAccessClientId && context.cfAccessClientSecret || context.cfAuthorization) this.setCfAccessContext(context.cfAccessClientId, context.cfAccessClientSecret, context.cfAuthorization);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Record the Cloudflare Access service token for the current process.
|
|
65
|
+
*
|
|
66
|
+
* Call this from every request-context builder that may receive CF headers
|
|
67
|
+
* (the SDK `createServer` `buildContext` and the bootstrap HTTP middleware
|
|
68
|
+
* both do). Stored in a module-level fallback because `enterWith()` is not a
|
|
69
|
+
* reliable carrier under Bun + Yoga — see the `cfAccessFallback` note above.
|
|
70
|
+
*
|
|
71
|
+
* Deliberately a NO-OP when either cred is absent: `buildContext` runs on
|
|
72
|
+
* every request, so clearing here on a tokenless request could wipe the value
|
|
73
|
+
* a concurrent CF request just stored. The token is constant per environment,
|
|
74
|
+
* so "remember, never clear on absence" is both safe and correct. Use
|
|
75
|
+
* `clearContext()` to reset (shutdown / tests).
|
|
76
|
+
*/
|
|
77
|
+
static setCfAccessContext(clientId, clientSecret, cfAuthorization) {
|
|
78
|
+
if (clientId && clientSecret) cfAccessFallback = {
|
|
79
|
+
clientId,
|
|
80
|
+
clientSecret
|
|
81
|
+
};
|
|
82
|
+
if (cfAuthorization) cfAuthorizationFallback = cfAuthorization;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Run function with specific context
|
|
86
|
+
* Context is isolated to this execution and its children
|
|
87
|
+
*/
|
|
88
|
+
static async withContext(context, fn) {
|
|
89
|
+
return asyncLocalStorage.run(context, fn);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Run synchronous function with specific context
|
|
93
|
+
*/
|
|
94
|
+
static withContextSync(context, fn) {
|
|
95
|
+
return asyncLocalStorage.run(context, fn);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Clear current context (including the module-level CF Access fallback).
|
|
99
|
+
*/
|
|
100
|
+
static clearContext() {
|
|
101
|
+
asyncLocalStorage.disable();
|
|
102
|
+
cfAccessFallback = void 0;
|
|
103
|
+
cfAuthorizationFallback = void 0;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get actor ID from context
|
|
107
|
+
*/
|
|
108
|
+
static getActorId() {
|
|
109
|
+
return this.getContext()?.actorId;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get legacy user ID from context.
|
|
113
|
+
*/
|
|
114
|
+
static getUser() {
|
|
115
|
+
const context = this.getContext();
|
|
116
|
+
const userId = context?.["userId"];
|
|
117
|
+
return typeof userId === "string" ? userId : context?.actorId;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get workspace ID from context
|
|
121
|
+
*/
|
|
122
|
+
static getWorkspace() {
|
|
123
|
+
return this.getContext()?.workspaceId;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get tenant ID from context
|
|
127
|
+
*/
|
|
128
|
+
static getTenant() {
|
|
129
|
+
return this.getContext()?.tenantId;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Get legacy organization ID from context.
|
|
133
|
+
*/
|
|
134
|
+
static getOrganization() {
|
|
135
|
+
const organizationId = this.getContext()?.["organizationId"];
|
|
136
|
+
return typeof organizationId === "string" ? organizationId : void 0;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get project ID from context
|
|
140
|
+
*/
|
|
141
|
+
static getProject() {
|
|
142
|
+
return this.getContext()?.projectId;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Get app ID from context
|
|
146
|
+
*/
|
|
147
|
+
static getApp() {
|
|
148
|
+
return this.getContext()?.appId;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Get JWT token from context
|
|
152
|
+
*/
|
|
153
|
+
static getToken() {
|
|
154
|
+
return this.getContext()?.token;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get product ID from context
|
|
158
|
+
*/
|
|
159
|
+
static getProduct() {
|
|
160
|
+
return this.getContext()?.productId;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get the Cloudflare Access service-token client id (ALS first, then the
|
|
164
|
+
* module-level fallback — see `cfAccessFallback`).
|
|
165
|
+
*/
|
|
166
|
+
static getCfAccessClientId() {
|
|
167
|
+
return this.getContext()?.cfAccessClientId ?? cfAccessFallback?.clientId;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get the Cloudflare Access service-token client secret (ALS first, then the
|
|
171
|
+
* module-level fallback — see `cfAccessFallback`).
|
|
172
|
+
*/
|
|
173
|
+
static getCfAccessClientSecret() {
|
|
174
|
+
return this.getContext()?.cfAccessClientSecret ?? cfAccessFallback?.clientSecret;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get the Cloudflare Access user-SSO cookie value (`CF_Authorization`) — ALS
|
|
178
|
+
* first, then the module-level fallback (see `cfAuthorizationFallback`).
|
|
179
|
+
*/
|
|
180
|
+
static getCfAuthorization() {
|
|
181
|
+
return this.getContext()?.cfAuthorization ?? cfAuthorizationFallback;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Build the Cloudflare Access credentials to re-present on a
|
|
185
|
+
* cross-layer outbound call.
|
|
186
|
+
*
|
|
187
|
+
* Cross-layer calls (wspace ↔ global) traverse the peer layer's PUBLIC
|
|
188
|
+
* gateway, which on alpha sits behind Cloudflare Access. Without the CF
|
|
189
|
+
* service token the request is rejected at the CF edge before reaching the
|
|
190
|
+
* gateway. We reuse the *inbound* request's CF creds (propagated by the
|
|
191
|
+
* public gateway into request-scoped context) so the cross-layer leg passes.
|
|
192
|
+
*
|
|
193
|
+
* Inbound-only: sourced from the request context (AsyncLocalStorage first,
|
|
194
|
+
* module-level fallback second — see `cfAccessFallback`). Returns `{}` unless
|
|
195
|
+
* BOTH creds are present — so it is a no-op in environments without CF in
|
|
196
|
+
* front of the gateways (local dev, and production, which is not
|
|
197
|
+
* CF-Access-gated and has no CF service token).
|
|
198
|
+
*/
|
|
199
|
+
static getCfAccessHeaders() {
|
|
200
|
+
const headers = {};
|
|
201
|
+
const clientId = this.getCfAccessClientId();
|
|
202
|
+
const clientSecret = this.getCfAccessClientSecret();
|
|
203
|
+
if (clientId && clientSecret) {
|
|
204
|
+
headers["cf-access-client-id"] = clientId;
|
|
205
|
+
headers["cf-access-client-secret"] = clientSecret;
|
|
206
|
+
}
|
|
207
|
+
const cfAuthorization = this.getCfAuthorization();
|
|
208
|
+
if (cfAuthorization) headers["cookie"] = `CF_Authorization=${cfAuthorization}`;
|
|
209
|
+
return headers;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Update specific context fields
|
|
213
|
+
*/
|
|
214
|
+
static updateContext(updates) {
|
|
215
|
+
const current = this.getContext();
|
|
216
|
+
if (current) this.setContext({
|
|
217
|
+
...current,
|
|
218
|
+
...updates
|
|
219
|
+
});
|
|
220
|
+
else this.setContext(updates);
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Check if context exists
|
|
224
|
+
*/
|
|
225
|
+
static hasContext() {
|
|
226
|
+
return this.getContext() !== void 0;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Get custom field from context
|
|
230
|
+
*/
|
|
231
|
+
static getCustomField(key) {
|
|
232
|
+
return this.getContext()?.[key];
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Set custom field in context
|
|
236
|
+
*/
|
|
237
|
+
static setCustomField(key, value) {
|
|
238
|
+
const current = this.getContext() || {};
|
|
239
|
+
this.setContext({
|
|
240
|
+
...current,
|
|
241
|
+
[key]: value
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Default export for convenience
|
|
247
|
+
*/
|
|
248
|
+
const contextManager = ContextManager;
|
|
249
|
+
/**
|
|
250
|
+
* Helper function to extract context from HTTP request
|
|
251
|
+
*/
|
|
252
|
+
function extractContextFromRequest(req) {
|
|
253
|
+
const context = {};
|
|
254
|
+
if (req.user) {
|
|
255
|
+
context.actorId = req.user.user_id;
|
|
256
|
+
context.workspaceId = req.user.workspace_id;
|
|
257
|
+
context.tenantId = req.user.tenant_endpoint;
|
|
258
|
+
}
|
|
259
|
+
const getHeader = (key) => {
|
|
260
|
+
const value = req.headers[key.toLowerCase()];
|
|
261
|
+
return Array.isArray(value) ? value[0] : value;
|
|
262
|
+
};
|
|
263
|
+
const authHeader = getHeader("authorization");
|
|
264
|
+
if (authHeader) context.token = authHeader.replace("Bearer ", "");
|
|
265
|
+
const workspaceId = getHeader("x-workspace-id");
|
|
266
|
+
if (workspaceId && !context.workspaceId) context.workspaceId = workspaceId;
|
|
267
|
+
const productId = getHeader("x-product-id");
|
|
268
|
+
if (productId) context.productId = productId;
|
|
269
|
+
const projectId = getHeader("x-project-id");
|
|
270
|
+
if (projectId) context.projectId = projectId;
|
|
271
|
+
const appId = getHeader("x-app-id");
|
|
272
|
+
if (appId) context.appId = appId;
|
|
273
|
+
const cfAccessClientId = getHeader("cf-access-client-id");
|
|
274
|
+
if (cfAccessClientId) context.cfAccessClientId = cfAccessClientId;
|
|
275
|
+
const cfAccessClientSecret = getHeader("cf-access-client-secret");
|
|
276
|
+
if (cfAccessClientSecret) context.cfAccessClientSecret = cfAccessClientSecret;
|
|
277
|
+
const cfAuthorization = getHeader("x-cf-authorization");
|
|
278
|
+
if (cfAuthorization) context.cfAuthorization = cfAuthorization;
|
|
279
|
+
return context;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export { ContextManager, contextManager, extractContextFromRequest };
|
|
283
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/context/index.ts"],"sourcesContent":["/**\n * Context Module\n * Manages request-scoped context using AsyncLocalStorage\n * Thread-safe context propagation for async operations\n */\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport type { SDKContext } from '../types/index.js';\n\nconst asyncLocalStorage = new AsyncLocalStorage<SDKContext>();\n\n/**\n * Module-level fallback for the Cloudflare Access service token.\n *\n * WHY THIS EXISTS — read before \"simplifying\" it away:\n * `asyncLocalStorage.enterWith()` (used by `setContext`) does NOT reliably\n * propagate across every async boundary under Bun + GraphQL Yoga — the same\n * limitation documented for the Prisma workspace context store\n * (see `src/prisma/workspace-extension.ts`). On top of that, the `createServer`\n * request path (`src/server/context.ts` `buildContext`) populates the *Prisma*\n * workspace store, not this `ContextManager` ALS at all. So a resolver-initiated\n * cross-layer call would otherwise read an empty context and attach no CF creds,\n * making the propagation a silent no-op on alpha.\n *\n * Unlike workspaceId/actorId (which differ per request and would race in a\n * module-level singleton), the CF Access service token is effectively\n * CONSTANT per environment — it's a single service-token pair fronting the\n * gateway. So caching it module-side is race-safe: concurrent requests all\n * carry the same value. It is only ever set when a request actually presents\n * the headers (gated upstream on `cf-ray`), and stays unset in dev/prod where\n * no CF Access sits in front of the gateways.\n */\nlet cfAccessFallback: { clientId: string; clientSecret: string } | undefined;\n\n/**\n * Module-level fallback for the CF Access USER-SSO cookie (`CF_Authorization`),\n * mirroring `cfAccessFallback` for the same Bun+Yoga ALS-unreliability reason.\n * Unlike the service-token pair this is per-USER and ~1h TTL — but for passing\n * the CF edge any valid member cookie suffices (app-layer identity travels in\n * `x-actor-*`). Refreshed by every inbound CF request, so an active fleet keeps\n * a live value. See BOFF-2929.\n */\nlet cfAuthorizationFallback: string | undefined;\n\n/**\n * Context Manager for handling request-scoped context\n */\nexport class ContextManager {\n /**\n * Get current context from async local storage\n */\n public static getContext(): SDKContext | undefined {\n return asyncLocalStorage.getStore();\n }\n\n /**\n * Set context for current async scope\n * Merges with existing context if present\n */\n public static setContext(context: SDKContext): void {\n const currentContext = this.getContext() || {};\n asyncLocalStorage.enterWith({ ...currentContext, ...context });\n // Mirror CF creds to the module-level fallback so cross-layer calls can\n // recover them even when enterWith() doesn't reach the resolver chain.\n if ((context.cfAccessClientId && context.cfAccessClientSecret) || context.cfAuthorization) {\n this.setCfAccessContext(context.cfAccessClientId, context.cfAccessClientSecret, context.cfAuthorization);\n }\n }\n\n /**\n * Record the Cloudflare Access service token for the current process.\n *\n * Call this from every request-context builder that may receive CF headers\n * (the SDK `createServer` `buildContext` and the bootstrap HTTP middleware\n * both do). Stored in a module-level fallback because `enterWith()` is not a\n * reliable carrier under Bun + Yoga — see the `cfAccessFallback` note above.\n *\n * Deliberately a NO-OP when either cred is absent: `buildContext` runs on\n * every request, so clearing here on a tokenless request could wipe the value\n * a concurrent CF request just stored. The token is constant per environment,\n * so \"remember, never clear on absence\" is both safe and correct. Use\n * `clearContext()` to reset (shutdown / tests).\n */\n public static setCfAccessContext(clientId?: string, clientSecret?: string, cfAuthorization?: string): void {\n if (clientId && clientSecret) {\n cfAccessFallback = { clientId, clientSecret };\n }\n // CF Access user-SSO cookie — remember, never clear on absence (same policy\n // as the service token). Present on real alpha user requests; kept live by\n // ongoing traffic. See BOFF-2929.\n if (cfAuthorization) {\n cfAuthorizationFallback = cfAuthorization;\n }\n }\n\n /**\n * Run function with specific context\n * Context is isolated to this execution and its children\n */\n public static async withContext<T>(context: SDKContext, fn: () => Promise<T>): Promise<T> {\n return asyncLocalStorage.run(context, fn);\n }\n\n /**\n * Run synchronous function with specific context\n */\n public static withContextSync<T>(context: SDKContext, fn: () => T): T {\n return asyncLocalStorage.run(context, fn);\n }\n\n /**\n * Clear current context (including the module-level CF Access fallback).\n */\n public static clearContext(): void {\n asyncLocalStorage.disable();\n cfAccessFallback = undefined;\n cfAuthorizationFallback = undefined;\n }\n\n /**\n * Get actor ID from context\n */\n public static getActorId(): string | undefined {\n return this.getContext()?.actorId;\n }\n\n /**\n * Get legacy user ID from context.\n */\n public static getUser(): string | undefined {\n const context = this.getContext();\n const userId = context?.['userId'];\n return typeof userId === 'string' ? userId : context?.actorId;\n }\n\n /**\n * Get workspace ID from context\n */\n public static getWorkspace(): string | undefined {\n return this.getContext()?.workspaceId;\n }\n\n /**\n * Get tenant ID from context\n */\n public static getTenant(): string | undefined {\n return this.getContext()?.tenantId;\n }\n\n /**\n * Get legacy organization ID from context.\n */\n public static getOrganization(): string | undefined {\n const organizationId = this.getContext()?.['organizationId'];\n return typeof organizationId === 'string' ? organizationId : undefined;\n }\n\n /**\n * Get project ID from context\n */\n public static getProject(): string | undefined {\n return this.getContext()?.projectId;\n }\n\n /**\n * Get app ID from context\n */\n public static getApp(): string | undefined {\n return this.getContext()?.appId;\n }\n\n /**\n * Get JWT token from context\n */\n public static getToken(): string | undefined {\n return this.getContext()?.token;\n }\n\n /**\n * Get product ID from context\n */\n public static getProduct(): string | undefined {\n return this.getContext()?.productId;\n }\n\n /**\n * Get the Cloudflare Access service-token client id (ALS first, then the\n * module-level fallback — see `cfAccessFallback`).\n */\n public static getCfAccessClientId(): string | undefined {\n return this.getContext()?.cfAccessClientId ?? cfAccessFallback?.clientId;\n }\n\n /**\n * Get the Cloudflare Access service-token client secret (ALS first, then the\n * module-level fallback — see `cfAccessFallback`).\n */\n public static getCfAccessClientSecret(): string | undefined {\n return this.getContext()?.cfAccessClientSecret ?? cfAccessFallback?.clientSecret;\n }\n\n /**\n * Get the Cloudflare Access user-SSO cookie value (`CF_Authorization`) — ALS\n * first, then the module-level fallback (see `cfAuthorizationFallback`).\n */\n public static getCfAuthorization(): string | undefined {\n return this.getContext()?.cfAuthorization ?? cfAuthorizationFallback;\n }\n\n /**\n * Build the Cloudflare Access credentials to re-present on a\n * cross-layer outbound call.\n *\n * Cross-layer calls (wspace ↔ global) traverse the peer layer's PUBLIC\n * gateway, which on alpha sits behind Cloudflare Access. Without the CF\n * service token the request is rejected at the CF edge before reaching the\n * gateway. We reuse the *inbound* request's CF creds (propagated by the\n * public gateway into request-scoped context) so the cross-layer leg passes.\n *\n * Inbound-only: sourced from the request context (AsyncLocalStorage first,\n * module-level fallback second — see `cfAccessFallback`). Returns `{}` unless\n * BOTH creds are present — so it is a no-op in environments without CF in\n * front of the gateways (local dev, and production, which is not\n * CF-Access-gated and has no CF service token).\n */\n public static getCfAccessHeaders(): Record<string, string> {\n const headers: Record<string, string> = {};\n\n // Service-token pair (machine callers). Present only when a service token\n // fronted the inbound call — not on browser user requests.\n const clientId = this.getCfAccessClientId();\n const clientSecret = this.getCfAccessClientSecret();\n if (clientId && clientSecret) {\n headers['cf-access-client-id'] = clientId;\n headers['cf-access-client-secret'] = clientSecret;\n }\n\n // User-SSO cookie. On alpha a real user request carries the CF_Authorization\n // cookie rather than the service-token pair; re-present it as the cookie so\n // the peer layer's CF Access (same app / shared AUD) admits the cross-layer\n // call. See BOFF-2929.\n const cfAuthorization = this.getCfAuthorization();\n if (cfAuthorization) {\n headers['cookie'] = `CF_Authorization=${cfAuthorization}`;\n }\n\n return headers;\n }\n\n /**\n * Update specific context fields\n */\n public static updateContext(updates: Partial<SDKContext>): void {\n const current = this.getContext();\n if (current) {\n this.setContext({ ...current, ...updates });\n } else {\n this.setContext(updates);\n }\n }\n\n /**\n * Check if context exists\n */\n public static hasContext(): boolean {\n return this.getContext() !== undefined;\n }\n\n /**\n * Get custom field from context\n */\n public static getCustomField(key: string): unknown {\n return this.getContext()?.[key];\n }\n\n /**\n * Set custom field in context\n */\n public static setCustomField(key: string, value: unknown): void {\n const current = this.getContext() || {};\n this.setContext({ ...current, [key]: value });\n }\n}\n\n/**\n * Default export for convenience\n */\nexport const contextManager = ContextManager;\n\n/**\n * Helper function to extract context from HTTP request\n */\nexport function extractContextFromRequest(req: {\n headers: Record<string, string | string[] | undefined>;\n user?: { user_id?: string; workspace_id?: string; tenant_endpoint?: string };\n}): SDKContext {\n const context: SDKContext = {};\n\n // Extract from user object (if JWT already verified)\n if (req.user) {\n context.actorId = req.user.user_id;\n context.workspaceId = req.user.workspace_id;\n context.tenantId = req.user.tenant_endpoint;\n }\n\n // Extract from headers\n const getHeader = (key: string): string | undefined => {\n const value = req.headers[key.toLowerCase()];\n return Array.isArray(value) ? value[0] : value;\n };\n\n const authHeader = getHeader('authorization');\n if (authHeader) {\n context.token = authHeader.replace('Bearer ', '');\n }\n\n const workspaceId = getHeader('x-workspace-id');\n if (workspaceId && !context.workspaceId) {\n context.workspaceId = workspaceId;\n }\n\n const productId = getHeader('x-product-id');\n if (productId) {\n context.productId = productId;\n }\n\n const projectId = getHeader('x-project-id');\n if (projectId) {\n context.projectId = projectId;\n }\n\n const appId = getHeader('x-app-id');\n if (appId) {\n context.appId = appId;\n }\n\n // Cloudflare Access service token. Forwarded to subgraphs by the public\n // gateways only when the request actually transited CF (cf-ray present), so\n // we can capture whatever arrives here. Re-presented on cross-layer outbound\n // calls — see ContextManager.getCfAccessHeaders.\n const cfAccessClientId = getHeader('cf-access-client-id');\n if (cfAccessClientId) {\n context.cfAccessClientId = cfAccessClientId;\n }\n\n const cfAccessClientSecret = getHeader('cf-access-client-secret');\n if (cfAccessClientSecret) {\n context.cfAccessClientSecret = cfAccessClientSecret;\n }\n\n // CF Access user-SSO cookie, forwarded by the public gateway as\n // x-cf-authorization. Re-presented as the CF_Authorization cookie on\n // cross-layer calls (see getCfAccessHeaders). See BOFF-2929.\n const cfAuthorization = getHeader('x-cf-authorization');\n if (cfAuthorization) {\n context.cfAuthorization = cfAuthorization;\n }\n\n return context;\n}\n"],"mappings":";;;;;;;;AASA,MAAM,oBAAoB,IAAI,kBAA8B;;;;;;;;;;;;;;;;;;;;;;AAuB5D,IAAI;;;;;;;;;AAUJ,IAAI;;;;AAKJ,IAAa,iBAAb,MAA4B;;;;CAI1B,OAAc,aAAqC;EACjD,OAAO,kBAAkB,SAAS;CACpC;;;;;CAMA,OAAc,WAAW,SAA2B;EAClD,MAAM,iBAAiB,KAAK,WAAW,KAAK,CAAC;EAC7C,kBAAkB,UAAU;GAAE,GAAG;GAAgB,GAAG;EAAQ,CAAC;EAG7D,IAAK,QAAQ,oBAAoB,QAAQ,wBAAyB,QAAQ,iBACxE,KAAK,mBAAmB,QAAQ,kBAAkB,QAAQ,sBAAsB,QAAQ,eAAe;CAE3G;;;;;;;;;;;;;;;CAgBA,OAAc,mBAAmB,UAAmB,cAAuB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AE;CAGlD,MAAM,cAAc,UAAU,gBAAgB;CAC9C,IAAI,eAAe,CAAC,QAAQ,aAC1B,QAAQ,cAAc;CAGxB,MAAM,YAAY,UAAU,cAAc;CAC1C,IAAI,WACF,QAAQ,YAAY;CAGtB,MAAM,YAAY,UAAU,cAAc;CAC1C,IAAI,WACF,QAAQ,YAAY;CAGtB,MAAM,QAAQ,UAAU,UAAU;CAClC,IAAI,OACF,QAAQ,QAAQ;CAOlB,MAAM,mBAAmB,UAAU,qBAAqB;CACxD,IAAI,kBACF,QAAQ,mBAAmB;CAG7B,MAAM,uBAAuB,UAAU,yBAAyB;CAChE,IAAI,sBACF,QAAQ,uBAAuB;CAMjC,MAAM,kBAAkB,UAAU,oBAAoB;CACtD,IAAI,iBACF,QAAQ,kBAAkB;CAG5B,OAAO;AACT"}
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as encryptIfNeeded, i as encrypt, n as decrypt, o as generateEncryptionKey, r as decryptIfNeeded, s as isEncrypted } from "../index-BVOL7458.js";
|
|
2
|
+
export { decrypt, decryptIfNeeded, encrypt, encryptIfNeeded, generateEncryptionKey, isEncrypted };
|
package/dist/crypto/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { a as encryptIfNeeded, i as encrypt, n as decrypt, o as generateEncryptionKey, r as decryptIfNeeded, s as isEncrypted } from "../crypto-DO9fM0FO.js";
|
|
2
|
+
|
|
3
|
+
export { decrypt, decryptIfNeeded, encrypt, encryptIfNeeded, generateEncryptionKey, isEncrypted };
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
package/dist/crypto/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"names":[],"mappings":""}
|