@burdenoff/be-sdk 2026.1110.2 → 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-GXC3A7DH.js +0 -8
- package/dist/EventQueueFactory-GXC3A7DH.js.map +0 -1
- package/dist/chunk-4XIBXZ6J.js +0 -276
- package/dist/chunk-4XIBXZ6J.js.map +0 -1
- package/dist/chunk-554Z4C2K.js +0 -1006
- package/dist/chunk-554Z4C2K.js.map +0 -1
- package/dist/chunk-5CAFHK2Z.js +0 -107
- package/dist/chunk-5CAFHK2Z.js.map +0 -1
- package/dist/chunk-63ZXJ42X.js +0 -451
- package/dist/chunk-63ZXJ42X.js.map +0 -1
- package/dist/chunk-6XEXJATV.js +0 -304
- package/dist/chunk-6XEXJATV.js.map +0 -1
- package/dist/chunk-726AR6Q7.js +0 -1532
- package/dist/chunk-726AR6Q7.js.map +0 -1
- package/dist/chunk-A5F6Z5UE.js +0 -21
- package/dist/chunk-A5F6Z5UE.js.map +0 -1
- package/dist/chunk-A6DE32ZS.js +0 -1507
- package/dist/chunk-A6DE32ZS.js.map +0 -1
- package/dist/chunk-AXJDGQPE.js +0 -690
- package/dist/chunk-AXJDGQPE.js.map +0 -1
- package/dist/chunk-BJQOGOVW.js +0 -602
- package/dist/chunk-BJQOGOVW.js.map +0 -1
- package/dist/chunk-CFXWH2IS.js +0 -52
- package/dist/chunk-CFXWH2IS.js.map +0 -1
- package/dist/chunk-DRWH5XCJ.js +0 -876
- package/dist/chunk-DRWH5XCJ.js.map +0 -1
- package/dist/chunk-E4QNLVY4.js +0 -909
- package/dist/chunk-E4QNLVY4.js.map +0 -1
- package/dist/chunk-EBDHIL7V.js +0 -774
- package/dist/chunk-EBDHIL7V.js.map +0 -1
- package/dist/chunk-ELU7VL3E.js +0 -245
- package/dist/chunk-ELU7VL3E.js.map +0 -1
- package/dist/chunk-FZRODKIN.js +0 -31
- package/dist/chunk-FZRODKIN.js.map +0 -1
- package/dist/chunk-GCIB76AJ.js +0 -882
- package/dist/chunk-GCIB76AJ.js.map +0 -1
- package/dist/chunk-HC6MPUIH.js +0 -1571
- package/dist/chunk-HC6MPUIH.js.map +0 -1
- package/dist/chunk-HNMHPSAM.js +0 -272
- package/dist/chunk-HNMHPSAM.js.map +0 -1
- package/dist/chunk-HTLEGD3Q.js +0 -1480
- package/dist/chunk-HTLEGD3Q.js.map +0 -1
- package/dist/chunk-I3KOWRT3.js +0 -89
- package/dist/chunk-I3KOWRT3.js.map +0 -1
- package/dist/chunk-ID3WR4JS.js +0 -509
- package/dist/chunk-ID3WR4JS.js.map +0 -1
- package/dist/chunk-JS52ZHTK.js +0 -1346
- package/dist/chunk-JS52ZHTK.js.map +0 -1
- package/dist/chunk-JVMAQOA3.js +0 -521
- package/dist/chunk-JVMAQOA3.js.map +0 -1
- package/dist/chunk-KH4TRQCO.js +0 -1063
- package/dist/chunk-KH4TRQCO.js.map +0 -1
- package/dist/chunk-KJOSPVB2.js +0 -57
- package/dist/chunk-KJOSPVB2.js.map +0 -1
- package/dist/chunk-KO2ZXZ7W.js +0 -61
- package/dist/chunk-KO2ZXZ7W.js.map +0 -1
- package/dist/chunk-KS2HQCJR.js +0 -56
- package/dist/chunk-KS2HQCJR.js.map +0 -1
- package/dist/chunk-LA5KPWZ2.js +0 -413
- package/dist/chunk-LA5KPWZ2.js.map +0 -1
- package/dist/chunk-MESLAC5W.js +0 -574
- package/dist/chunk-MESLAC5W.js.map +0 -1
- package/dist/chunk-MWPYA2HD.js +0 -94
- package/dist/chunk-MWPYA2HD.js.map +0 -1
- package/dist/chunk-NUB5GQTU.js +0 -270
- package/dist/chunk-NUB5GQTU.js.map +0 -1
- package/dist/chunk-OBBCR6WY.js +0 -277
- package/dist/chunk-OBBCR6WY.js.map +0 -1
- package/dist/chunk-OQDSAOG3.js +0 -1908
- package/dist/chunk-OQDSAOG3.js.map +0 -1
- package/dist/chunk-OXNCBE7P.js +0 -971
- package/dist/chunk-OXNCBE7P.js.map +0 -1
- package/dist/chunk-PBZFAAOM.js +0 -941
- package/dist/chunk-PN6GIF3R.js +0 -1185
- package/dist/chunk-PN6GIF3R.js.map +0 -1
- package/dist/chunk-PYD44IHJ.js +0 -728
- package/dist/chunk-PYD44IHJ.js.map +0 -1
- package/dist/chunk-QVPIACWD.js +0 -679
- package/dist/chunk-QVPIACWD.js.map +0 -1
- package/dist/chunk-QWNNFE4P.js +0 -41
- package/dist/chunk-QWNNFE4P.js.map +0 -1
- package/dist/chunk-RU266375.js +0 -327
- package/dist/chunk-RU266375.js.map +0 -1
- package/dist/chunk-RYTSVGGA.js +0 -1624
- package/dist/chunk-RYTSVGGA.js.map +0 -1
- package/dist/chunk-RZOFS2BQ.js +0 -225
- package/dist/chunk-RZOFS2BQ.js.map +0 -1
- package/dist/chunk-SBS4S2PJ.js +0 -100
- package/dist/chunk-SBS4S2PJ.js.map +0 -1
- package/dist/chunk-SPRG6G6G.js +0 -530
- package/dist/chunk-SPRG6G6G.js.map +0 -1
- package/dist/chunk-STWFX5E2.js +0 -233
- package/dist/chunk-STWFX5E2.js.map +0 -1
- package/dist/chunk-UNASM5VJ.js +0 -419
- package/dist/chunk-UNASM5VJ.js.map +0 -1
- package/dist/chunk-VAT66FJA.js +0 -245
- package/dist/chunk-VAT66FJA.js.map +0 -1
- package/dist/chunk-VFCMR5GX.js +0 -49
- package/dist/chunk-VFCMR5GX.js.map +0 -1
- package/dist/chunk-VGAHZKNJ.js +0 -66
- package/dist/chunk-VGAHZKNJ.js.map +0 -1
- package/dist/chunk-VTJTAAXC.js +0 -627
- package/dist/chunk-VTJTAAXC.js.map +0 -1
- package/dist/chunk-VXVLKRU6.js +0 -758
- package/dist/chunk-VXVLKRU6.js.map +0 -1
- package/dist/chunk-WWUU5ETI.js +0 -163
- package/dist/chunk-WWUU5ETI.js.map +0 -1
- package/dist/chunk-XE4OXN2W.js +0 -10
- package/dist/chunk-XE4OXN2W.js.map +0 -1
- package/dist/chunk-XOJORS75.js +0 -1853
- package/dist/chunk-XOJORS75.js.map +0 -1
- package/dist/chunk-YMZEUTD2.js +0 -110
- package/dist/chunk-YMZEUTD2.js.map +0 -1
- package/dist/chunk-Z77BTSOK.js +0 -617
- package/dist/chunk-Z77BTSOK.js.map +0 -1
- package/dist/chunk-ZZK3WEDI.js +0 -181
- package/dist/chunk-ZZK3WEDI.js.map +0 -1
- package/dist/client-CCXpAZ2r.d.ts +0 -89
- package/dist/client-DSI_760t.d.ts +0 -36
- package/dist/client-JU6T3UPB.js +0 -11
- package/dist/client-JU6T3UPB.js.map +0 -1
- package/dist/dist-2X4Q7PJA.js +0 -1491
- package/dist/dist-2X4Q7PJA.js.map +0 -1
- package/dist/env-4UWSUS64.js +0 -4
- package/dist/env-4UWSUS64.js.map +0 -1
- package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
- package/dist/graphql-CMHMQjvd.d.ts +0 -23
- package/dist/i18n-Qm2AkPC-.d.ts +0 -33
- package/dist/index--yvpa6ay.d.ts +0 -83
- package/dist/index-4gKQKZ2B.d.ts +0 -71
- package/dist/index-5x0XMKXN.d.ts +0 -149
- package/dist/index-B70b5mYS.d.ts +0 -33
- package/dist/index-B8KrxO4j.d.ts +0 -755
- package/dist/index-BOuDKnqD.d.ts +0 -201
- package/dist/index-BTMt4OjA.d.ts +0 -201
- package/dist/index-BejbszA7.d.ts +0 -39
- package/dist/index-BkeOYZye.d.ts +0 -198
- package/dist/index-BuAj5nXg.d.ts +0 -83
- package/dist/index-BvkVcW8I.d.ts +0 -349
- package/dist/index-CWmH_-RZ.d.ts +0 -247
- package/dist/index-CbgWNcus.d.ts +0 -258
- package/dist/index-CmfPeQza.d.ts +0 -166
- package/dist/index-CmpG-zak.d.ts +0 -607
- package/dist/index-CoMKgL-p.d.ts +0 -12
- package/dist/index-D8HGwglK.d.ts +0 -541
- package/dist/index-DCaVm66D.d.ts +0 -1101
- package/dist/index-DE2w7E0d.d.ts +0 -83
- package/dist/index-DSOpj8DI.d.ts +0 -17
- package/dist/index-DW9q22GH.d.ts +0 -75
- package/dist/index-DnjJ9CwI.d.ts +0 -347
- package/dist/index-DwMJZ8PP.d.ts +0 -317
- package/dist/index-PaojfSdd.d.ts +0 -71
- package/dist/index-aHtYvc3i.d.ts +0 -284
- package/dist/index-e_18DzAg.d.ts +0 -18
- package/dist/index-ffmipXSA.d.ts +0 -55
- package/dist/index-joONjwLt.d.ts +0 -33
- package/dist/index-kssw5ziY.d.ts +0 -250
- package/dist/index-lFffh5-G.d.ts +0 -125
- package/dist/index-pxYge_6k.d.ts +0 -79
- package/dist/layer-Cv9vSwBx.d.ts +0 -70
- package/dist/pino-logger-H4HPW5P6.js +0 -5
- package/dist/pino-logger-H4HPW5P6.js.map +0 -1
- package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
- package/dist/sdk-L75WWUP3.js +0 -156
- package/dist/sdk-L75WWUP3.js.map +0 -1
- package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
- package/dist/types-Bo2wkjSP.d.ts +0 -35
- package/dist/types-DVpvrAhd.d.ts +0 -71
- package/dist/types-DgJ4lDYA.d.ts +0 -108
- package/dist/types-USOv09qy.d.ts +0 -327
- package/dist/workspace-guard-NXVYYBVJ.js +0 -5
- package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
package/dist/chunk-PBZFAAOM.js
DELETED
|
@@ -1,941 +0,0 @@
|
|
|
1
|
-
import { logger } from './chunk-RU266375.js';
|
|
2
|
-
import { __export, __name } from './chunk-XE4OXN2W.js';
|
|
3
|
-
import { GraphQLError } from 'graphql';
|
|
4
|
-
|
|
5
|
-
// src/tags/index.ts
|
|
6
|
-
var tags_exports = {};
|
|
7
|
-
__export(tags_exports, {
|
|
8
|
-
ENTITY_TAGS_GRAPHQL_CODES: () => ENTITY_TAGS_GRAPHQL_CODES,
|
|
9
|
-
EntityTagsError: () => EntityTagsError,
|
|
10
|
-
TAG_ACTOR_TYPES: () => TAG_ACTOR_TYPES,
|
|
11
|
-
TAG_ASSIGNMENT_SOURCES: () => TAG_ASSIGNMENT_SOURCES,
|
|
12
|
-
TagsGatewayAdapter: () => TagsGatewayAdapter,
|
|
13
|
-
UNIVERSAL_TAG_STUB_SDL: () => UNIVERSAL_TAG_STUB_SDL,
|
|
14
|
-
assertTagPrefix: () => assertTagPrefix,
|
|
15
|
-
buildEntityTagsSdl: () => buildEntityTagsSdl,
|
|
16
|
-
createEntityTagResolvers: () => createEntityTagResolvers,
|
|
17
|
-
defaultTagActor: () => defaultTagActor,
|
|
18
|
-
entityTagsFieldNames: () => entityTagsFieldNames,
|
|
19
|
-
entityTagsTypeNames: () => entityTagsTypeNames,
|
|
20
|
-
isEntityTagsError: () => isEntityTagsError,
|
|
21
|
-
mapTagAssignment: () => mapTagAssignment,
|
|
22
|
-
slugifyTagKey: () => slugifyTagKey
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// src/tags/types.ts
|
|
26
|
-
var TAG_ACTOR_TYPES = [
|
|
27
|
-
"user",
|
|
28
|
-
"app",
|
|
29
|
-
"service",
|
|
30
|
-
"super_admin"
|
|
31
|
-
];
|
|
32
|
-
var TAG_ASSIGNMENT_SOURCES = [
|
|
33
|
-
"AUTOMATIC",
|
|
34
|
-
"COMPUTED",
|
|
35
|
-
"IMPORTED",
|
|
36
|
-
"INHERITED",
|
|
37
|
-
"MANUAL",
|
|
38
|
-
"MIGRATED"
|
|
39
|
-
];
|
|
40
|
-
|
|
41
|
-
// src/tags/errors.ts
|
|
42
|
-
var ENTITY_TAGS_GRAPHQL_CODES = {
|
|
43
|
-
INVALID_ENTITY_TYPE: "BAD_USER_INPUT",
|
|
44
|
-
INVALID_SOURCE: "BAD_USER_INPUT",
|
|
45
|
-
INVALID_INPUT: "BAD_USER_INPUT",
|
|
46
|
-
MISSING_CONTEXT: "UNAUTHENTICATED",
|
|
47
|
-
UPSTREAM_ERROR: "INTERNAL_SERVER_ERROR",
|
|
48
|
-
CONFIGURATION_ERROR: "INTERNAL_SERVER_ERROR"
|
|
49
|
-
};
|
|
50
|
-
var EntityTagsError = class extends Error {
|
|
51
|
-
static {
|
|
52
|
-
__name(this, "EntityTagsError");
|
|
53
|
-
}
|
|
54
|
-
code;
|
|
55
|
-
details;
|
|
56
|
-
constructor(code, message, details = {}) {
|
|
57
|
-
super(message);
|
|
58
|
-
this.name = "EntityTagsError";
|
|
59
|
-
this.code = code;
|
|
60
|
-
this.details = details;
|
|
61
|
-
}
|
|
62
|
-
/** The GraphQL `extensions.code` this error maps to. */
|
|
63
|
-
get graphqlCode() {
|
|
64
|
-
return ENTITY_TAGS_GRAPHQL_CODES[this.code];
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
function isEntityTagsError(error) {
|
|
68
|
-
return error instanceof EntityTagsError;
|
|
69
|
-
}
|
|
70
|
-
__name(isEntityTagsError, "isEntityTagsError");
|
|
71
|
-
|
|
72
|
-
// src/tags/naming.ts
|
|
73
|
-
var PREFIX_PATTERN = /^[A-Z][A-Za-z0-9]*$/;
|
|
74
|
-
function assertTagPrefix(prefix) {
|
|
75
|
-
if (!PREFIX_PATTERN.test(prefix)) {
|
|
76
|
-
throw new EntityTagsError("CONFIGURATION_ERROR", `Entity tags prefix must be PascalCase ([A-Z][A-Za-z0-9]*), got "${prefix}"`, {
|
|
77
|
-
prefix
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
__name(assertTagPrefix, "assertTagPrefix");
|
|
82
|
-
function lowerFirst(value) {
|
|
83
|
-
return value.charAt(0).toLowerCase() + value.slice(1);
|
|
84
|
-
}
|
|
85
|
-
__name(lowerFirst, "lowerFirst");
|
|
86
|
-
function entityTagsFieldNames(prefix) {
|
|
87
|
-
assertTagPrefix(prefix);
|
|
88
|
-
const camel = lowerFirst(prefix);
|
|
89
|
-
return {
|
|
90
|
-
entityTags: `${camel}EntityTags`,
|
|
91
|
-
searchTags: `search${prefix}Tags`,
|
|
92
|
-
availableTags: `available${prefix}Tags`,
|
|
93
|
-
entitiesByTags: `${camel}EntitiesByTags`,
|
|
94
|
-
tagEntity: `tag${prefix}Entity`,
|
|
95
|
-
untagEntity: `untag${prefix}Entity`,
|
|
96
|
-
replaceEntityTags: `replace${prefix}EntityTags`,
|
|
97
|
-
createTag: `create${prefix}Tag`
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
__name(entityTagsFieldNames, "entityTagsFieldNames");
|
|
101
|
-
function entityTagsTypeNames(prefix, overrides = {}) {
|
|
102
|
-
assertTagPrefix(prefix);
|
|
103
|
-
const names = {
|
|
104
|
-
getEntityTagsInput: `Get${prefix}EntityTagsInput`,
|
|
105
|
-
tagEntityInput: `Tag${prefix}EntityInput`,
|
|
106
|
-
untagEntityInput: `Untag${prefix}EntityInput`,
|
|
107
|
-
replaceEntityTagsInput: `Replace${prefix}EntityTagsInput`,
|
|
108
|
-
createTagInput: `Create${prefix}TagInput`,
|
|
109
|
-
entitiesByTagsInput: `${prefix}EntitiesByTagsInput`,
|
|
110
|
-
tagInfo: `${prefix}TagInfo`,
|
|
111
|
-
tagAssignment: `${prefix}TagAssignment`,
|
|
112
|
-
availableTag: `${prefix}AvailableTag`,
|
|
113
|
-
taggedEntityPage: `${prefix}TaggedEntityPage`,
|
|
114
|
-
...overrides
|
|
115
|
-
};
|
|
116
|
-
const seen = /* @__PURE__ */ new Map();
|
|
117
|
-
for (const [role, name] of Object.entries(names)) {
|
|
118
|
-
if (!PREFIX_PATTERN.test(name)) {
|
|
119
|
-
throw new EntityTagsError("CONFIGURATION_ERROR", `Entity tags type name for ${role} is not a valid type name`, {
|
|
120
|
-
role,
|
|
121
|
-
name
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
const clash = seen.get(name);
|
|
125
|
-
if (clash) {
|
|
126
|
-
throw new EntityTagsError("CONFIGURATION_ERROR", `Entity tags type name "${name}" is used for both ${clash} and ${role}`, {
|
|
127
|
-
name
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
seen.set(name, role);
|
|
131
|
-
}
|
|
132
|
-
return names;
|
|
133
|
-
}
|
|
134
|
-
__name(entityTagsTypeNames, "entityTagsTypeNames");
|
|
135
|
-
|
|
136
|
-
// src/tags/adapter.ts
|
|
137
|
-
var SEARCH_LIMIT = {
|
|
138
|
-
default: 20,
|
|
139
|
-
max: 100
|
|
140
|
-
};
|
|
141
|
-
var AVAILABLE_LIMIT = {
|
|
142
|
-
default: 50,
|
|
143
|
-
max: 200
|
|
144
|
-
};
|
|
145
|
-
var ENTITIES_BY_TAGS_LIMIT = {
|
|
146
|
-
default: 50,
|
|
147
|
-
max: 200
|
|
148
|
-
};
|
|
149
|
-
var DEFAULT_REQUEST_TIMEOUT_MS = 1e4;
|
|
150
|
-
var ENTITY_TYPE_PATTERN = /^[A-Z][A-Z0-9_]*$/;
|
|
151
|
-
var ASSIGNMENT_FIELDS = "id tagId entityType entityId source assignedById createdAt validFrom validTo metadata tag { id key label color }";
|
|
152
|
-
function clampLimit(value, bounds) {
|
|
153
|
-
if (value === null || value === void 0 || !Number.isFinite(value)) return bounds.default;
|
|
154
|
-
return Math.min(Math.max(Math.trunc(value), 1), bounds.max);
|
|
155
|
-
}
|
|
156
|
-
__name(clampLimit, "clampLimit");
|
|
157
|
-
function toDate(value) {
|
|
158
|
-
if (!value) return null;
|
|
159
|
-
const date = new Date(value);
|
|
160
|
-
return Number.isNaN(date.getTime()) ? null : date;
|
|
161
|
-
}
|
|
162
|
-
__name(toDate, "toDate");
|
|
163
|
-
function requireNonEmpty(value, field) {
|
|
164
|
-
const trimmed = typeof value === "string" ? value.trim() : "";
|
|
165
|
-
if (!trimmed) {
|
|
166
|
-
throw new EntityTagsError("INVALID_INPUT", `${field} is required`, {
|
|
167
|
-
field
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return trimmed;
|
|
171
|
-
}
|
|
172
|
-
__name(requireNonEmpty, "requireNonEmpty");
|
|
173
|
-
function shortHash(value) {
|
|
174
|
-
let hash = 2166136261;
|
|
175
|
-
for (const char of value) {
|
|
176
|
-
hash ^= char.codePointAt(0) ?? 0;
|
|
177
|
-
hash = Math.imul(hash, 16777619) >>> 0;
|
|
178
|
-
}
|
|
179
|
-
return hash.toString(36);
|
|
180
|
-
}
|
|
181
|
-
__name(shortHash, "shortHash");
|
|
182
|
-
function slugifyTagKey(label) {
|
|
183
|
-
const slug = label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
184
|
-
return slug || `tag-${shortHash(label.trim())}`;
|
|
185
|
-
}
|
|
186
|
-
__name(slugifyTagKey, "slugifyTagKey");
|
|
187
|
-
function mapTagAssignment(raw) {
|
|
188
|
-
return {
|
|
189
|
-
id: raw.id,
|
|
190
|
-
tagId: raw.tagId,
|
|
191
|
-
entityType: raw.entityType,
|
|
192
|
-
entityId: raw.entityId,
|
|
193
|
-
source: raw.source,
|
|
194
|
-
assignedBy: raw.assignedById ?? null,
|
|
195
|
-
assignedAt: toDate(raw.createdAt) ?? toDate(raw.validFrom),
|
|
196
|
-
validFrom: toDate(raw.validFrom),
|
|
197
|
-
validTo: toDate(raw.validTo),
|
|
198
|
-
metadata: raw.metadata ?? null,
|
|
199
|
-
tag: raw.tag ? {
|
|
200
|
-
id: raw.tag.id
|
|
201
|
-
} : null,
|
|
202
|
-
tagInfo: raw.tag ? {
|
|
203
|
-
id: raw.tag.id,
|
|
204
|
-
key: raw.tag.key ?? null,
|
|
205
|
-
label: raw.tag.label ?? null,
|
|
206
|
-
color: raw.tag.color ?? null
|
|
207
|
-
} : null
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
__name(mapTagAssignment, "mapTagAssignment");
|
|
211
|
-
var TagsGatewayAdapter = class {
|
|
212
|
-
static {
|
|
213
|
-
__name(this, "TagsGatewayAdapter");
|
|
214
|
-
}
|
|
215
|
-
entityTypes;
|
|
216
|
-
vocabulary;
|
|
217
|
-
defaultSource;
|
|
218
|
-
entityTypeSet;
|
|
219
|
-
requestTimeoutMs;
|
|
220
|
-
clientOption;
|
|
221
|
-
serviceName;
|
|
222
|
-
clientPromise = null;
|
|
223
|
-
constructor(options) {
|
|
224
|
-
if (options.entityTypes.length === 0) {
|
|
225
|
-
throw new EntityTagsError("CONFIGURATION_ERROR", "TagsGatewayAdapter needs at least one entity type");
|
|
226
|
-
}
|
|
227
|
-
for (const entityType of options.entityTypes) {
|
|
228
|
-
if (!ENTITY_TYPE_PATTERN.test(entityType)) {
|
|
229
|
-
throw new EntityTagsError("CONFIGURATION_ERROR", `Entity type "${entityType}" must be UPPER_SNAKE_CASE (e.g. FLUIDGRIDS_WORKFLOW)`, {
|
|
230
|
-
entityType
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
requireNonEmpty(options.vocabulary.key, "vocabulary.key");
|
|
235
|
-
requireNonEmpty(options.vocabulary.name, "vocabulary.name");
|
|
236
|
-
const defaultSource = options.defaultSource ?? "MANUAL";
|
|
237
|
-
if (!TAG_ASSIGNMENT_SOURCES.includes(defaultSource)) {
|
|
238
|
-
throw new EntityTagsError("CONFIGURATION_ERROR", `Unknown default tag source "${defaultSource}"`);
|
|
239
|
-
}
|
|
240
|
-
this.entityTypes = Object.freeze([
|
|
241
|
-
...new Set(options.entityTypes)
|
|
242
|
-
]);
|
|
243
|
-
this.entityTypeSet = new Set(this.entityTypes);
|
|
244
|
-
this.vocabulary = Object.freeze({
|
|
245
|
-
...options.vocabulary
|
|
246
|
-
});
|
|
247
|
-
this.defaultSource = defaultSource;
|
|
248
|
-
this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
249
|
-
this.clientOption = options.client;
|
|
250
|
-
this.serviceName = options.serviceName;
|
|
251
|
-
}
|
|
252
|
-
// ── Validation ────────────────────────────────────────────────────────
|
|
253
|
-
isValidEntityType(entityType) {
|
|
254
|
-
return this.entityTypeSet.has(entityType);
|
|
255
|
-
}
|
|
256
|
-
assertEntityType(entityType) {
|
|
257
|
-
if (!this.isValidEntityType(entityType)) {
|
|
258
|
-
throw new EntityTagsError("INVALID_ENTITY_TYPE", `Unsupported entity type "${entityType}"`, {
|
|
259
|
-
entityType,
|
|
260
|
-
supported: this.entityTypes
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
/** Validate a caller-supplied source; empty means the adapter default. */
|
|
265
|
-
resolveSource(source) {
|
|
266
|
-
if (source === null || source === void 0 || source === "") return this.defaultSource;
|
|
267
|
-
const normalized = source.toUpperCase();
|
|
268
|
-
const match = TAG_ASSIGNMENT_SOURCES.find((candidate) => candidate === normalized);
|
|
269
|
-
if (!match) {
|
|
270
|
-
throw new EntityTagsError("INVALID_SOURCE", `Unknown tag source "${source}"`, {
|
|
271
|
-
source,
|
|
272
|
-
supported: TAG_ASSIGNMENT_SOURCES
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
return match;
|
|
276
|
-
}
|
|
277
|
-
// ── Assignments ───────────────────────────────────────────────────────
|
|
278
|
-
/** Tags currently assigned to an entity. */
|
|
279
|
-
async getEntityTags(entityType, entityId, actor) {
|
|
280
|
-
this.assertEntityType(entityType);
|
|
281
|
-
const id = requireNonEmpty(entityId, "entityId");
|
|
282
|
-
const data = await this.request(`query GetEntityTags($entityType: String!, $entityId: ID!) {
|
|
283
|
-
getEntityTags(entityType: $entityType, entityId: $entityId) { ${ASSIGNMENT_FIELDS} }
|
|
284
|
-
}`, {
|
|
285
|
-
entityType,
|
|
286
|
-
entityId: id
|
|
287
|
-
}, actor);
|
|
288
|
-
return (data.getEntityTags ?? []).map(mapTagAssignment);
|
|
289
|
-
}
|
|
290
|
-
/** Assign one tag to an entity. */
|
|
291
|
-
async tagEntity(entityType, entityId, options, actor) {
|
|
292
|
-
this.assertEntityType(entityType);
|
|
293
|
-
const id = requireNonEmpty(entityId, "entityId");
|
|
294
|
-
const tagId = requireNonEmpty(options.tagId, "tagId");
|
|
295
|
-
const source = this.resolveSource(options.source);
|
|
296
|
-
const context = this.requireActor(actor);
|
|
297
|
-
const data = await this.request(`mutation AssignTag($input: AssignTagInput!) {
|
|
298
|
-
assignTag(input: $input) { ${ASSIGNMENT_FIELDS} }
|
|
299
|
-
}`, {
|
|
300
|
-
input: {
|
|
301
|
-
tagId,
|
|
302
|
-
entityType,
|
|
303
|
-
entityId: id,
|
|
304
|
-
source,
|
|
305
|
-
validFrom: options.validFrom?.toISOString(),
|
|
306
|
-
validTo: options.validTo?.toISOString(),
|
|
307
|
-
metadata: options.metadata ?? void 0,
|
|
308
|
-
context: {
|
|
309
|
-
workspaceId: context.workspaceId
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}, context);
|
|
313
|
-
if (!data.assignTag) {
|
|
314
|
-
throw new EntityTagsError("UPSTREAM_ERROR", "wspace-tags-svc returned no assignment", {
|
|
315
|
-
entityType,
|
|
316
|
-
tagId
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
return mapTagAssignment(data.assignTag);
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Remove a tag from an entity. Removes every assignment of that tag on the entity
|
|
323
|
-
* (tags-svc allows several with different validity windows). `false` when the tag
|
|
324
|
-
* was not assigned.
|
|
325
|
-
*/
|
|
326
|
-
async untagEntity(entityType, entityId, tagId, actor) {
|
|
327
|
-
const id = requireNonEmpty(tagId, "tagId");
|
|
328
|
-
const assignments = await this.getEntityTags(entityType, entityId, actor);
|
|
329
|
-
const matches = assignments.filter((assignment) => assignment.tagId === id);
|
|
330
|
-
if (matches.length === 0) return false;
|
|
331
|
-
let removed = false;
|
|
332
|
-
for (const assignment of matches) {
|
|
333
|
-
const data = await this.request(`mutation RemoveTagAssignment($id: ID!) { removeTagAssignment(id: $id) }`, {
|
|
334
|
-
id: assignment.id
|
|
335
|
-
}, actor);
|
|
336
|
-
removed = data.removeTagAssignment === true || removed;
|
|
337
|
-
}
|
|
338
|
-
return removed;
|
|
339
|
-
}
|
|
340
|
-
/** Replace the full tag set on an entity (an empty list clears it). */
|
|
341
|
-
async replaceEntityTags(entityType, entityId, tagIds, actor) {
|
|
342
|
-
this.assertEntityType(entityType);
|
|
343
|
-
const id = requireNonEmpty(entityId, "entityId");
|
|
344
|
-
const uniqueTagIds = [
|
|
345
|
-
...new Set(tagIds.map((tagId) => requireNonEmpty(tagId, "tagIds[]")))
|
|
346
|
-
];
|
|
347
|
-
const data = await this.request(`mutation ReplaceEntityTags($entityType: String!, $entityId: ID!, $tagIds: [ID!]!) {
|
|
348
|
-
replaceEntityTags(entityType: $entityType, entityId: $entityId, tagIds: $tagIds) { ${ASSIGNMENT_FIELDS} }
|
|
349
|
-
}`, {
|
|
350
|
-
entityType,
|
|
351
|
-
entityId: id,
|
|
352
|
-
tagIds: uniqueTagIds
|
|
353
|
-
}, actor);
|
|
354
|
-
return (data.replaceEntityTags ?? []).map(mapTagAssignment);
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* Ids of `entityType` entities carrying the given tags — the server-side half of
|
|
358
|
-
* "filter this list by tag". Intersect the ids with the service's own query.
|
|
359
|
-
*/
|
|
360
|
-
async findEntityIdsByTags(entityType, tagIds, actor, options = {}) {
|
|
361
|
-
this.assertEntityType(entityType);
|
|
362
|
-
const uniqueTagIds = [
|
|
363
|
-
...new Set(tagIds.map((tagId) => requireNonEmpty(tagId, "tagIds[]")))
|
|
364
|
-
];
|
|
365
|
-
if (uniqueTagIds.length === 0) {
|
|
366
|
-
throw new EntityTagsError("INVALID_INPUT", "tagIds must contain at least one tag", {
|
|
367
|
-
field: "tagIds"
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
const data = await this.request(`query GetEntitiesByTags($tagIds: [ID!]!, $entityType: String, $matchAll: Boolean, $pagination: TagsPaginationInput) {
|
|
371
|
-
getEntitiesByTags(tagIds: $tagIds, entityType: $entityType, matchAll: $matchAll, pagination: $pagination) {
|
|
372
|
-
entities { entityId entityType } total hasMore nextCursor
|
|
373
|
-
}
|
|
374
|
-
}`, {
|
|
375
|
-
tagIds: uniqueTagIds,
|
|
376
|
-
entityType,
|
|
377
|
-
matchAll: options.matchAll ?? false,
|
|
378
|
-
pagination: {
|
|
379
|
-
limit: clampLimit(options.limit, ENTITIES_BY_TAGS_LIMIT),
|
|
380
|
-
...options.cursor ? {
|
|
381
|
-
cursor: options.cursor
|
|
382
|
-
} : {}
|
|
383
|
-
}
|
|
384
|
-
}, actor);
|
|
385
|
-
const page = data.getEntitiesByTags;
|
|
386
|
-
if (!page) return {
|
|
387
|
-
entityIds: [],
|
|
388
|
-
total: 0,
|
|
389
|
-
hasMore: false,
|
|
390
|
-
nextCursor: null
|
|
391
|
-
};
|
|
392
|
-
return {
|
|
393
|
-
// tags-svc already filters by entityType; re-check so a lax upstream never
|
|
394
|
-
// leaks another product's ids into this service's list.
|
|
395
|
-
entityIds: page.entities.filter((entity) => entity.entityType === entityType).map((entity) => entity.entityId),
|
|
396
|
-
total: page.total,
|
|
397
|
-
hasMore: page.hasMore,
|
|
398
|
-
nextCursor: page.nextCursor ?? null
|
|
399
|
-
};
|
|
400
|
-
}
|
|
401
|
-
// ── Workspace tags ────────────────────────────────────────────────────
|
|
402
|
-
/** Search assignable tags in the workspace. */
|
|
403
|
-
async searchTags(query, actor, limit) {
|
|
404
|
-
const data = await this.request(`query SearchTags($query: String!, $limit: Int) {
|
|
405
|
-
searchTags(query: $query, limit: $limit) { id key label color }
|
|
406
|
-
}`, {
|
|
407
|
-
query: query.trim(),
|
|
408
|
-
limit: clampLimit(limit, SEARCH_LIMIT)
|
|
409
|
-
}, actor);
|
|
410
|
-
return data.searchTags ?? [];
|
|
411
|
-
}
|
|
412
|
-
/** List assignable tags in the workspace. */
|
|
413
|
-
async getAvailableTags(actor, limit) {
|
|
414
|
-
const data = await this.request(`query GetTags($pagination: TagsPaginationInput) {
|
|
415
|
-
getTags(pagination: $pagination) { items { id key label color } }
|
|
416
|
-
}`, {
|
|
417
|
-
pagination: {
|
|
418
|
-
limit: clampLimit(limit, AVAILABLE_LIMIT)
|
|
419
|
-
}
|
|
420
|
-
}, actor);
|
|
421
|
-
return data.getTags?.items ?? [];
|
|
422
|
-
}
|
|
423
|
-
/** Create a workspace tag, in the default vocabulary unless `vocabularyId` is given. */
|
|
424
|
-
async createTag(options, actor) {
|
|
425
|
-
const label = requireNonEmpty(options.label, "label");
|
|
426
|
-
const vocabularyId = options.vocabularyId !== void 0 && options.vocabularyId !== null ? options.vocabularyId : await this.ensureWorkspaceVocabulary(actor);
|
|
427
|
-
const data = await this.request(`mutation CreateTag($input: CreateTagInput!) {
|
|
428
|
-
createTag(input: $input) { id key label color }
|
|
429
|
-
}`, {
|
|
430
|
-
input: {
|
|
431
|
-
vocabularyId,
|
|
432
|
-
key: slugifyTagKey(label),
|
|
433
|
-
label,
|
|
434
|
-
color: options.color || void 0
|
|
435
|
-
}
|
|
436
|
-
}, actor);
|
|
437
|
-
if (!data.createTag) {
|
|
438
|
-
throw new EntityTagsError("UPSTREAM_ERROR", "wspace-tags-svc returned no tag", {
|
|
439
|
-
label
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
return data.createTag;
|
|
443
|
-
}
|
|
444
|
-
// ── Vocabularies ──────────────────────────────────────────────────────
|
|
445
|
-
/**
|
|
446
|
-
* Resolve the workspace's default vocabulary id, creating the vocabulary on first
|
|
447
|
-
* use. Order: pinned `id` (if it exists in this workspace) → lookup by `key` →
|
|
448
|
-
* create → re-read by key (a concurrent request may have created it first).
|
|
449
|
-
*/
|
|
450
|
-
async ensureWorkspaceVocabulary(actor, override = {}) {
|
|
451
|
-
const vocabulary = {
|
|
452
|
-
...this.vocabulary,
|
|
453
|
-
...override
|
|
454
|
-
};
|
|
455
|
-
if (vocabulary.id) {
|
|
456
|
-
const byId = await this.getVocabularyById(vocabulary.id, actor);
|
|
457
|
-
if (byId?.id) return byId.id;
|
|
458
|
-
}
|
|
459
|
-
const byKey = await this.getVocabularyByKey(vocabulary.key, actor);
|
|
460
|
-
if (byKey?.id) return byKey.id;
|
|
461
|
-
let createError = null;
|
|
462
|
-
try {
|
|
463
|
-
const created = await this.createVocabulary(vocabulary, actor);
|
|
464
|
-
if (created?.id) return created.id;
|
|
465
|
-
} catch (error) {
|
|
466
|
-
createError = error;
|
|
467
|
-
}
|
|
468
|
-
const afterCreate = await this.getVocabularyByKey(vocabulary.key, actor);
|
|
469
|
-
if (afterCreate?.id) return afterCreate.id;
|
|
470
|
-
if (createError) throw createError;
|
|
471
|
-
throw new EntityTagsError("UPSTREAM_ERROR", `Failed to resolve tag vocabulary "${vocabulary.key}"`, {
|
|
472
|
-
vocabularyKey: vocabulary.key
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
async getVocabularyById(id, actor) {
|
|
476
|
-
const data = await this.request(`query GetVocabulary($id: ID!) { getVocabulary(id: $id) { id key name } }`, {
|
|
477
|
-
id
|
|
478
|
-
}, actor);
|
|
479
|
-
return data.getVocabulary ?? null;
|
|
480
|
-
}
|
|
481
|
-
async getVocabularyByKey(key, actor) {
|
|
482
|
-
const data = await this.request(`query GetVocabularyByKey($key: String!) { getVocabularyByKey(key: $key) { id key name } }`, {
|
|
483
|
-
key
|
|
484
|
-
}, actor);
|
|
485
|
-
return data.getVocabularyByKey ?? null;
|
|
486
|
-
}
|
|
487
|
-
/** Create a WORKSPACE-scoped, multi-valued, open (custom tags allowed) string vocabulary. */
|
|
488
|
-
async createVocabulary(vocabulary, actor) {
|
|
489
|
-
const data = await this.request(`mutation CreateVocabulary($input: CreateVocabularyInput!) {
|
|
490
|
-
createVocabulary(input: $input) { id key name }
|
|
491
|
-
}`, {
|
|
492
|
-
input: {
|
|
493
|
-
key: requireNonEmpty(vocabulary.key, "vocabulary.key"),
|
|
494
|
-
name: requireNonEmpty(vocabulary.name, "vocabulary.name"),
|
|
495
|
-
description: vocabulary.description,
|
|
496
|
-
scope: "WORKSPACE",
|
|
497
|
-
dataType: "STRING",
|
|
498
|
-
cardinality: "MULTIPLE",
|
|
499
|
-
allowCustomTags: true
|
|
500
|
-
}
|
|
501
|
-
}, actor);
|
|
502
|
-
return data.createVocabulary ?? null;
|
|
503
|
-
}
|
|
504
|
-
// ── Transport ─────────────────────────────────────────────────────────
|
|
505
|
-
requireActor(actor) {
|
|
506
|
-
if (!actor.actorId?.trim() || !actor.workspaceId?.trim()) {
|
|
507
|
-
throw new EntityTagsError("MISSING_CONTEXT", "Tag operations need an authenticated actor and a workspace");
|
|
508
|
-
}
|
|
509
|
-
return actor;
|
|
510
|
-
}
|
|
511
|
-
getClient() {
|
|
512
|
-
if (!this.clientPromise) {
|
|
513
|
-
const option = this.clientOption;
|
|
514
|
-
this.clientPromise = (async () => {
|
|
515
|
-
if (typeof option === "function") return option();
|
|
516
|
-
if (option) return option;
|
|
517
|
-
const gateway = await import('./client-JU6T3UPB.js');
|
|
518
|
-
if (this.serviceName) {
|
|
519
|
-
return new gateway.GatewayClient({
|
|
520
|
-
layer: "wspace",
|
|
521
|
-
serviceName: this.serviceName,
|
|
522
|
-
serviceIdentity: this.serviceName
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
return gateway.createGatewayClientFromEnv();
|
|
526
|
-
})();
|
|
527
|
-
this.clientPromise.catch(() => {
|
|
528
|
-
this.clientPromise = null;
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
return this.clientPromise;
|
|
532
|
-
}
|
|
533
|
-
async request(query, variables, actor) {
|
|
534
|
-
const { actorId, workspaceId, actorType } = this.requireActor(actor);
|
|
535
|
-
const client = await this.getClient();
|
|
536
|
-
const response = await client.internalQuery({
|
|
537
|
-
query,
|
|
538
|
-
variables,
|
|
539
|
-
timeout: this.requestTimeoutMs,
|
|
540
|
-
headers: {
|
|
541
|
-
"x-actor-id": actorId,
|
|
542
|
-
"x-actor-type": actorType || "user",
|
|
543
|
-
"x-workspace-id": workspaceId
|
|
544
|
-
}
|
|
545
|
-
});
|
|
546
|
-
if (response.errors?.length) {
|
|
547
|
-
throw new EntityTagsError("UPSTREAM_ERROR", `wspace-tags-svc error: ${response.errors.map((error) => error.message).join("; ")}`, {
|
|
548
|
-
errors: response.errors
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
if (!response.data) {
|
|
552
|
-
throw new EntityTagsError("UPSTREAM_ERROR", "wspace-tags-svc returned no data");
|
|
553
|
-
}
|
|
554
|
-
return response.data;
|
|
555
|
-
}
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
// src/tags/sdl.ts
|
|
559
|
-
var TYPE_NAME_PATTERN = /^[A-Z]\w*$/;
|
|
560
|
-
var RBAC_TOKEN_PATTERN = /^[a-z0-9][a-z0-9:_-]*$/i;
|
|
561
|
-
var UNIVERSAL_TAG_STUB_SDL = (
|
|
562
|
-
/* GraphQL */
|
|
563
|
-
`
|
|
564
|
-
"UniversalTag is owned by wspace-tags-svc; only its key is resolvable here."
|
|
565
|
-
type UniversalTag @key(fields: "id", resolvable: false) {
|
|
566
|
-
id: ID!
|
|
567
|
-
}
|
|
568
|
-
`
|
|
569
|
-
);
|
|
570
|
-
function rbacToken(value, field) {
|
|
571
|
-
if (!RBAC_TOKEN_PATTERN.test(value)) {
|
|
572
|
-
throw new EntityTagsError("CONFIGURATION_ERROR", `Entity tags rbac.${field} "${value}" is not a valid RBAC token`, {
|
|
573
|
-
field,
|
|
574
|
-
value
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
return value;
|
|
578
|
-
}
|
|
579
|
-
__name(rbacToken, "rbacToken");
|
|
580
|
-
function rbacDirective(action, resource, scopeType) {
|
|
581
|
-
return `@rbac(action: "${action}", resource: "${resource}", scopeType: "${scopeType}")`;
|
|
582
|
-
}
|
|
583
|
-
__name(rbacDirective, "rbacDirective");
|
|
584
|
-
function sanitizeDescription(value) {
|
|
585
|
-
return value.replace(/["\\]/g, "'").replace(/\s+/g, " ").trim();
|
|
586
|
-
}
|
|
587
|
-
__name(sanitizeDescription, "sanitizeDescription");
|
|
588
|
-
function buildEntityTagsSdl(options) {
|
|
589
|
-
const fields = entityTagsFieldNames(options.prefix);
|
|
590
|
-
const types = entityTagsTypeNames(options.prefix, options.typeNames);
|
|
591
|
-
const external = new Set(options.externalTypes ?? []);
|
|
592
|
-
const label = sanitizeDescription(options.productLabel ?? options.prefix);
|
|
593
|
-
const resource = rbacToken(options.rbac.resource, "resource");
|
|
594
|
-
const scopeType = rbacToken(options.rbac.scopeType ?? "wspace", "scopeType");
|
|
595
|
-
const read = rbacDirective(rbacToken(options.rbac.readAction ?? "read", "readAction"), resource, scopeType);
|
|
596
|
-
const update = rbacDirective(rbacToken(options.rbac.updateAction ?? "update", "updateAction"), resource, scopeType);
|
|
597
|
-
const create = rbacDirective(rbacToken(options.rbac.createAction ?? "create", "createAction"), resource, scopeType);
|
|
598
|
-
const extendTypes = [
|
|
599
|
-
...new Set(options.extendTypes ?? [])
|
|
600
|
-
];
|
|
601
|
-
for (const typeName of extendTypes) {
|
|
602
|
-
if (!TYPE_NAME_PATTERN.test(typeName)) {
|
|
603
|
-
throw new EntityTagsError("CONFIGURATION_ERROR", `Cannot extend "${typeName}": not a valid type name`, {
|
|
604
|
-
typeName
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
const blocks = [];
|
|
609
|
-
const emitType = /* @__PURE__ */ __name((role, sdl) => {
|
|
610
|
-
if (!external.has(role)) blocks.push(sdl);
|
|
611
|
-
}, "emitType");
|
|
612
|
-
if (options.includeUniversalTagStub) blocks.push(UNIVERSAL_TAG_STUB_SDL.trim());
|
|
613
|
-
emitType("getEntityTagsInput", `input ${types.getEntityTagsInput} {
|
|
614
|
-
entityType: String!
|
|
615
|
-
entityId: ID!
|
|
616
|
-
}`);
|
|
617
|
-
emitType("tagEntityInput", `input ${types.tagEntityInput} {
|
|
618
|
-
entityType: String!
|
|
619
|
-
entityId: ID!
|
|
620
|
-
tagId: ID!
|
|
621
|
-
"AssignmentSource (MANUAL, AUTOMATIC, IMPORTED, ...). Defaults to the service default."
|
|
622
|
-
source: String
|
|
623
|
-
metadata: JSON
|
|
624
|
-
}`);
|
|
625
|
-
emitType("untagEntityInput", `input ${types.untagEntityInput} {
|
|
626
|
-
entityType: String!
|
|
627
|
-
entityId: ID!
|
|
628
|
-
tagId: ID!
|
|
629
|
-
}`);
|
|
630
|
-
emitType("replaceEntityTagsInput", `input ${types.replaceEntityTagsInput} {
|
|
631
|
-
entityType: String!
|
|
632
|
-
entityId: ID!
|
|
633
|
-
tagIds: [ID!]!
|
|
634
|
-
}`);
|
|
635
|
-
emitType("createTagInput", `input ${types.createTagInput} {
|
|
636
|
-
"Optional. When omitted the tag goes to the workspace's default ${label} vocabulary (created on first use)."
|
|
637
|
-
vocabularyId: ID
|
|
638
|
-
label: String!
|
|
639
|
-
color: String
|
|
640
|
-
}`);
|
|
641
|
-
emitType("tagInfo", `"Inline (non-federated) tag projection, so clients render labels without a federated round-trip."
|
|
642
|
-
type ${types.tagInfo} {
|
|
643
|
-
id: ID!
|
|
644
|
-
key: String
|
|
645
|
-
label: String
|
|
646
|
-
color: String
|
|
647
|
-
}`);
|
|
648
|
-
emitType("tagAssignment", `"A tag assigned to a ${label} entity."
|
|
649
|
-
type ${types.tagAssignment} {
|
|
650
|
-
id: ID!
|
|
651
|
-
tagId: ID!
|
|
652
|
-
"Federated UniversalTag reference (owned by wspace-tags-svc). Prefer tagInfo for label/colour."
|
|
653
|
-
tag: UniversalTag
|
|
654
|
-
"Inline projection of the tag (key/label/colour)."
|
|
655
|
-
tagInfo: ${types.tagInfo}
|
|
656
|
-
entityType: String!
|
|
657
|
-
entityId: ID!
|
|
658
|
-
source: String!
|
|
659
|
-
assignedBy: ID
|
|
660
|
-
assignedAt: DateTime
|
|
661
|
-
validFrom: DateTime
|
|
662
|
-
validTo: DateTime
|
|
663
|
-
metadata: JSON
|
|
664
|
-
}`);
|
|
665
|
-
emitType("availableTag", `"An assignable workspace tag."
|
|
666
|
-
type ${types.availableTag} {
|
|
667
|
-
id: ID!
|
|
668
|
-
key: String!
|
|
669
|
-
label: String!
|
|
670
|
-
color: String
|
|
671
|
-
}`);
|
|
672
|
-
if (options.includeEntitiesByTags) {
|
|
673
|
-
emitType("entitiesByTagsInput", `input ${types.entitiesByTagsInput} {
|
|
674
|
-
entityType: String!
|
|
675
|
-
tagIds: [ID!]!
|
|
676
|
-
"true = entity must carry every tag; false (default) = any of them."
|
|
677
|
-
matchAll: Boolean
|
|
678
|
-
limit: Int
|
|
679
|
-
cursor: String
|
|
680
|
-
}`);
|
|
681
|
-
emitType("taggedEntityPage", `"Ids of entities carrying the requested tags."
|
|
682
|
-
type ${types.taggedEntityPage} {
|
|
683
|
-
entityIds: [ID!]!
|
|
684
|
-
total: Int!
|
|
685
|
-
hasMore: Boolean!
|
|
686
|
-
nextCursor: String
|
|
687
|
-
}`);
|
|
688
|
-
}
|
|
689
|
-
const queryFields = [
|
|
690
|
-
` "Tags currently assigned to a ${label} entity"
|
|
691
|
-
${fields.entityTags}(input: ${types.getEntityTagsInput}!): [${types.tagAssignment}!]! ${read}`,
|
|
692
|
-
` "Search assignable tags in the workspace"
|
|
693
|
-
${fields.searchTags}(query: String!, limit: Int): [${types.availableTag}!]! ${read}`,
|
|
694
|
-
` "List assignable tags in the workspace"
|
|
695
|
-
${fields.availableTags}(limit: Int): [${types.availableTag}!]! ${read}`
|
|
696
|
-
];
|
|
697
|
-
if (options.includeEntitiesByTags) {
|
|
698
|
-
queryFields.push(` "Ids of ${label} entities carrying the given tags (filter-by-tag)"
|
|
699
|
-
${fields.entitiesByTags}(input: ${types.entitiesByTagsInput}!): ${types.taggedEntityPage}! ${read}`);
|
|
700
|
-
}
|
|
701
|
-
blocks.push(`extend type Query {
|
|
702
|
-
${queryFields.join("\n\n")}
|
|
703
|
-
}`);
|
|
704
|
-
blocks.push(`extend type Mutation {
|
|
705
|
-
"Assign a tag to a ${label} entity"
|
|
706
|
-
${fields.tagEntity}(input: ${types.tagEntityInput}!): ${types.tagAssignment}! ${update}
|
|
707
|
-
|
|
708
|
-
"Remove a tag from a ${label} entity"
|
|
709
|
-
${fields.untagEntity}(input: ${types.untagEntityInput}!): Boolean! ${update}
|
|
710
|
-
|
|
711
|
-
"Replace the full tag set on a ${label} entity"
|
|
712
|
-
${fields.replaceEntityTags}(input: ${types.replaceEntityTagsInput}!): [${types.tagAssignment}!]! ${update}
|
|
713
|
-
|
|
714
|
-
"Create a new assignable tag (inline creation from a picker)"
|
|
715
|
-
${fields.createTag}(input: ${types.createTagInput}!): ${types.availableTag}! ${create}
|
|
716
|
-
}`);
|
|
717
|
-
for (const typeName of extendTypes) {
|
|
718
|
-
blocks.push(`extend type ${typeName} {
|
|
719
|
-
"Structured tag assignments (wspace-tags-svc)."
|
|
720
|
-
tagAssignments: [${types.tagAssignment}!]!
|
|
721
|
-
}`);
|
|
722
|
-
}
|
|
723
|
-
return `${blocks.join("\n\n")}
|
|
724
|
-
`;
|
|
725
|
-
}
|
|
726
|
-
__name(buildEntityTagsSdl, "buildEntityTagsSdl");
|
|
727
|
-
function readRecord(value, key) {
|
|
728
|
-
if (value === null || typeof value !== "object") return void 0;
|
|
729
|
-
return value[key];
|
|
730
|
-
}
|
|
731
|
-
__name(readRecord, "readRecord");
|
|
732
|
-
function readString(value) {
|
|
733
|
-
return typeof value === "string" ? value : "";
|
|
734
|
-
}
|
|
735
|
-
__name(readString, "readString");
|
|
736
|
-
function toActorType(value) {
|
|
737
|
-
return TAG_ACTOR_TYPES.find((candidate) => candidate === value) ?? "user";
|
|
738
|
-
}
|
|
739
|
-
__name(toActorType, "toActorType");
|
|
740
|
-
function defaultTagActor(context) {
|
|
741
|
-
const actor = readRecord(context, "actor");
|
|
742
|
-
const workspace = readRecord(context, "workspace");
|
|
743
|
-
return {
|
|
744
|
-
actorId: readString(readRecord(actor, "id")) || readString(readRecord(context, "actorId")),
|
|
745
|
-
actorType: toActorType(readRecord(actor, "type") ?? readRecord(context, "actorType")),
|
|
746
|
-
workspaceId: readString(readRecord(workspace, "id")) || readString(readRecord(context, "workspaceId"))
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
__name(defaultTagActor, "defaultTagActor");
|
|
750
|
-
function defaultMapError(error) {
|
|
751
|
-
if (error.code === "UPSTREAM_ERROR" || error.code === "CONFIGURATION_ERROR") {
|
|
752
|
-
logger.error("[be-sdk/tags] Tag operation failed", {
|
|
753
|
-
code: error.code,
|
|
754
|
-
message: error.message
|
|
755
|
-
});
|
|
756
|
-
return new GraphQLError("Tag operation failed", {
|
|
757
|
-
extensions: {
|
|
758
|
-
code: error.graphqlCode
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
return new GraphQLError(error.message, {
|
|
763
|
-
extensions: {
|
|
764
|
-
code: error.graphqlCode,
|
|
765
|
-
reason: error.code
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
__name(defaultMapError, "defaultMapError");
|
|
770
|
-
function createEntityTagResolvers(options) {
|
|
771
|
-
const { adapter } = options;
|
|
772
|
-
const fields = entityTagsFieldNames(options.prefix);
|
|
773
|
-
const getActor = options.getActor ?? ((context) => defaultTagActor(context));
|
|
774
|
-
const mapError = options.mapError ?? ((error) => defaultMapError(error));
|
|
775
|
-
for (const [typeName, binding] of Object.entries(options.entities ?? {})) {
|
|
776
|
-
if (!adapter.isValidEntityType(binding.entityType)) {
|
|
777
|
-
throw new EntityTagsError("CONFIGURATION_ERROR", `${typeName} is bound to entity type "${binding.entityType}", which the adapter does not register`, {
|
|
778
|
-
typeName,
|
|
779
|
-
entityType: binding.entityType
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
const guard = /* @__PURE__ */ __name(async (context, run) => {
|
|
784
|
-
try {
|
|
785
|
-
return await run();
|
|
786
|
-
} catch (error) {
|
|
787
|
-
if (isEntityTagsError(error)) throw mapError(error, context);
|
|
788
|
-
throw error;
|
|
789
|
-
}
|
|
790
|
-
}, "guard");
|
|
791
|
-
const authorize = /* @__PURE__ */ __name(async (input, access, actor, context) => {
|
|
792
|
-
adapter.assertEntityType(input.entityType);
|
|
793
|
-
if (!input.entityId?.trim()) {
|
|
794
|
-
throw new EntityTagsError("INVALID_INPUT", "entityId is required", {
|
|
795
|
-
field: "entityId"
|
|
796
|
-
});
|
|
797
|
-
}
|
|
798
|
-
if (options.authorizeEntity) {
|
|
799
|
-
await options.authorizeEntity({
|
|
800
|
-
entityType: input.entityType,
|
|
801
|
-
entityId: input.entityId,
|
|
802
|
-
access,
|
|
803
|
-
actor
|
|
804
|
-
}, context);
|
|
805
|
-
}
|
|
806
|
-
}, "authorize");
|
|
807
|
-
const notify = /* @__PURE__ */ __name(async (event, context) => {
|
|
808
|
-
if (!options.onMutation) return;
|
|
809
|
-
try {
|
|
810
|
-
await options.onMutation(event, context);
|
|
811
|
-
} catch (error) {
|
|
812
|
-
logger.warn("[be-sdk/tags] onMutation hook failed", {
|
|
813
|
-
fieldName: event.fieldName,
|
|
814
|
-
error: error instanceof Error ? error.message : String(error)
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
}, "notify");
|
|
818
|
-
const Query = {};
|
|
819
|
-
const Mutation = {};
|
|
820
|
-
const entityTags = /* @__PURE__ */ __name((_parent, { input }, context) => guard(context, async () => {
|
|
821
|
-
const actor = getActor(context);
|
|
822
|
-
await authorize(input, "read", actor, context);
|
|
823
|
-
return adapter.getEntityTags(input.entityType, input.entityId, actor);
|
|
824
|
-
}), "entityTags");
|
|
825
|
-
Query[fields.entityTags] = entityTags;
|
|
826
|
-
const searchTags = /* @__PURE__ */ __name((_parent, { query, limit }, context) => guard(context, () => adapter.searchTags(query, getActor(context), limit)), "searchTags");
|
|
827
|
-
Query[fields.searchTags] = searchTags;
|
|
828
|
-
const availableTags = /* @__PURE__ */ __name((_parent, { limit }, context) => guard(context, () => adapter.getAvailableTags(getActor(context), limit)), "availableTags");
|
|
829
|
-
Query[fields.availableTags] = availableTags;
|
|
830
|
-
if (options.includeEntitiesByTags) {
|
|
831
|
-
const entitiesByTags = /* @__PURE__ */ __name((_parent, { input }, context) => guard(context, () => adapter.findEntityIdsByTags(input.entityType, input.tagIds, getActor(context), {
|
|
832
|
-
matchAll: input.matchAll ?? false,
|
|
833
|
-
limit: input.limit,
|
|
834
|
-
cursor: input.cursor
|
|
835
|
-
})), "entitiesByTags");
|
|
836
|
-
Query[fields.entitiesByTags] = entitiesByTags;
|
|
837
|
-
}
|
|
838
|
-
const tagEntity = /* @__PURE__ */ __name((_parent, { input }, context) => guard(context, async () => {
|
|
839
|
-
const actor = getActor(context);
|
|
840
|
-
await authorize(input, "write", actor, context);
|
|
841
|
-
const assignment = await adapter.tagEntity(input.entityType, input.entityId, {
|
|
842
|
-
tagId: input.tagId,
|
|
843
|
-
source: input.source,
|
|
844
|
-
metadata: input.metadata
|
|
845
|
-
}, actor);
|
|
846
|
-
await notify({
|
|
847
|
-
operation: "tag",
|
|
848
|
-
fieldName: fields.tagEntity,
|
|
849
|
-
actor,
|
|
850
|
-
entityType: input.entityType,
|
|
851
|
-
entityId: input.entityId,
|
|
852
|
-
tagId: input.tagId,
|
|
853
|
-
source: assignment.source
|
|
854
|
-
}, context);
|
|
855
|
-
return assignment;
|
|
856
|
-
}), "tagEntity");
|
|
857
|
-
Mutation[fields.tagEntity] = tagEntity;
|
|
858
|
-
const untagEntity = /* @__PURE__ */ __name((_parent, { input }, context) => guard(context, async () => {
|
|
859
|
-
const actor = getActor(context);
|
|
860
|
-
await authorize(input, "write", actor, context);
|
|
861
|
-
const removed = await adapter.untagEntity(input.entityType, input.entityId, input.tagId, actor);
|
|
862
|
-
if (removed) {
|
|
863
|
-
await notify({
|
|
864
|
-
operation: "untag",
|
|
865
|
-
fieldName: fields.untagEntity,
|
|
866
|
-
actor,
|
|
867
|
-
entityType: input.entityType,
|
|
868
|
-
entityId: input.entityId,
|
|
869
|
-
tagId: input.tagId
|
|
870
|
-
}, context);
|
|
871
|
-
}
|
|
872
|
-
return removed;
|
|
873
|
-
}), "untagEntity");
|
|
874
|
-
Mutation[fields.untagEntity] = untagEntity;
|
|
875
|
-
const replaceEntityTags = /* @__PURE__ */ __name((_parent, { input }, context) => guard(context, async () => {
|
|
876
|
-
const actor = getActor(context);
|
|
877
|
-
await authorize(input, "write", actor, context);
|
|
878
|
-
const assignments = await adapter.replaceEntityTags(input.entityType, input.entityId, input.tagIds, actor);
|
|
879
|
-
await notify({
|
|
880
|
-
operation: "replace",
|
|
881
|
-
fieldName: fields.replaceEntityTags,
|
|
882
|
-
actor,
|
|
883
|
-
entityType: input.entityType,
|
|
884
|
-
entityId: input.entityId,
|
|
885
|
-
tagIds: [
|
|
886
|
-
...new Set(input.tagIds)
|
|
887
|
-
]
|
|
888
|
-
}, context);
|
|
889
|
-
return assignments;
|
|
890
|
-
}), "replaceEntityTags");
|
|
891
|
-
Mutation[fields.replaceEntityTags] = replaceEntityTags;
|
|
892
|
-
const createTag = /* @__PURE__ */ __name((_parent, { input }, context) => guard(context, async () => {
|
|
893
|
-
const actor = getActor(context);
|
|
894
|
-
const vocabularyId = input.vocabularyId !== void 0 && input.vocabularyId !== null ? input.vocabularyId : await adapter.ensureWorkspaceVocabulary(actor);
|
|
895
|
-
const tag = await adapter.createTag({
|
|
896
|
-
label: input.label,
|
|
897
|
-
color: input.color,
|
|
898
|
-
vocabularyId
|
|
899
|
-
}, actor);
|
|
900
|
-
await notify({
|
|
901
|
-
operation: "createTag",
|
|
902
|
-
fieldName: fields.createTag,
|
|
903
|
-
actor,
|
|
904
|
-
tag,
|
|
905
|
-
vocabularyId
|
|
906
|
-
}, context);
|
|
907
|
-
return tag;
|
|
908
|
-
}), "createTag");
|
|
909
|
-
Mutation[fields.createTag] = createTag;
|
|
910
|
-
const types = {};
|
|
911
|
-
for (const [typeName, binding] of Object.entries(options.entities ?? {})) {
|
|
912
|
-
const selectId = binding.entityId ?? ((parent) => readString(parent["id"]));
|
|
913
|
-
types[typeName] = {
|
|
914
|
-
tagAssignments: /* @__PURE__ */ __name(async (parent, _args, context) => {
|
|
915
|
-
const entityId = selectId(parent);
|
|
916
|
-
if (!entityId) return [];
|
|
917
|
-
try {
|
|
918
|
-
return await adapter.getEntityTags(binding.entityType, entityId, getActor(context));
|
|
919
|
-
} catch (error) {
|
|
920
|
-
logger.warn("[be-sdk/tags] Failed to resolve tagAssignments", {
|
|
921
|
-
typeName,
|
|
922
|
-
entityType: binding.entityType,
|
|
923
|
-
entityId,
|
|
924
|
-
error: error instanceof Error ? error.message : String(error)
|
|
925
|
-
});
|
|
926
|
-
return [];
|
|
927
|
-
}
|
|
928
|
-
}, "tagAssignments")
|
|
929
|
-
};
|
|
930
|
-
}
|
|
931
|
-
return {
|
|
932
|
-
Query,
|
|
933
|
-
Mutation,
|
|
934
|
-
types
|
|
935
|
-
};
|
|
936
|
-
}
|
|
937
|
-
__name(createEntityTagResolvers, "createEntityTagResolvers");
|
|
938
|
-
|
|
939
|
-
export { ENTITY_TAGS_GRAPHQL_CODES, EntityTagsError, TAG_ACTOR_TYPES, TAG_ASSIGNMENT_SOURCES, TagsGatewayAdapter, UNIVERSAL_TAG_STUB_SDL, assertTagPrefix, buildEntityTagsSdl, createEntityTagResolvers, defaultTagActor, entityTagsFieldNames, entityTagsTypeNames, isEntityTagsError, mapTagAssignment, slugifyTagKey, tags_exports };
|
|
940
|
-
//# sourceMappingURL=chunk-PBZFAAOM.js.map
|
|
941
|
-
//# sourceMappingURL=chunk-PBZFAAOM.js.map
|