@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.
Files changed (497) hide show
  1. package/configs/eslint/index.js +1 -1
  2. package/configs/tsconfig/tsconfig.json +1 -1
  3. package/dist/EventQueueFactory-9NGZV9jl.js +1457 -0
  4. package/dist/EventQueueFactory-9NGZV9jl.js.map +1 -0
  5. package/dist/RedisStreamsConnection-CY8WySJy.js +283 -0
  6. package/dist/RedisStreamsConnection-CY8WySJy.js.map +1 -0
  7. package/dist/activity/index.d.ts +165 -0
  8. package/dist/activity/index.js +389 -0
  9. package/dist/activity/index.js.map +1 -0
  10. package/dist/ai-credits/index.d.ts +2 -3
  11. package/dist/ai-credits/index.js +3 -4
  12. package/dist/ai-credits/index.js.map +1 -1
  13. package/dist/ai-credits-xxfwGpHS.js +546 -0
  14. package/dist/ai-credits-xxfwGpHS.js.map +1 -0
  15. package/dist/{assistant-session-CJZhF4D6.d.ts → assistant-session-DA5ZKJOr.d.ts} +4 -5
  16. package/dist/auth/index.d.ts +2 -77
  17. package/dist/auth/index.js +3 -7
  18. package/dist/auth/index.js.map +1 -1
  19. package/dist/auth-C5ctwSLp.js +228 -0
  20. package/dist/auth-C5ctwSLp.js.map +1 -0
  21. package/dist/bootstrap/index.d.ts +74 -0
  22. package/dist/bootstrap/index.js +282 -0
  23. package/dist/bootstrap/index.js.map +1 -0
  24. package/dist/cache/index.d.ts +2 -3
  25. package/dist/cache/index.js +3 -7
  26. package/dist/cache/index.js.map +1 -1
  27. package/dist/cache-CU0uLwcS.js +1837 -0
  28. package/dist/cache-CU0uLwcS.js.map +1 -0
  29. package/dist/captcha/index.d.ts +2 -1
  30. package/dist/captcha/index.js +3 -3
  31. package/dist/captcha/index.js.map +1 -1
  32. package/dist/captcha-BT7yh1YS.js +77 -0
  33. package/dist/captcha-BT7yh1YS.js.map +1 -0
  34. package/dist/client/internal-client.d.ts +4 -7
  35. package/dist/client/internal-client.js +172 -4
  36. package/dist/client/internal-client.js.map +1 -1
  37. package/dist/client-BgAEvDC2.d.ts +86 -0
  38. package/dist/client-sAJTrb4i.js +565 -0
  39. package/dist/client-sAJTrb4i.js.map +1 -0
  40. package/dist/collector-endpoint-iyQYeI50.js +50 -0
  41. package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
  42. package/dist/context/index.d.ts +35 -0
  43. package/dist/context/index.js +283 -0
  44. package/dist/context/index.js.map +1 -0
  45. package/dist/crypto/index.d.ts +2 -1
  46. package/dist/crypto/index.js +3 -3
  47. package/dist/crypto/index.js.map +1 -1
  48. package/dist/crypto-DO9fM0FO.js +145 -0
  49. package/dist/crypto-DO9fM0FO.js.map +1 -0
  50. package/dist/database/index.d.ts +104 -108
  51. package/dist/database/index.js +468 -6
  52. package/dist/database/index.js.map +1 -1
  53. package/dist/dataloader/index.d.ts +2 -1
  54. package/dist/dataloader/index.js +3 -3
  55. package/dist/dataloader/index.js.map +1 -1
  56. package/dist/dataloader-DwpT3YoS.js +294 -0
  57. package/dist/dataloader-DwpT3YoS.js.map +1 -0
  58. package/dist/deployed-environment-p_Tdl3sT.js +38 -0
  59. package/dist/deployed-environment-p_Tdl3sT.js.map +1 -0
  60. package/dist/dist-BGKdXVy3.js +1718 -0
  61. package/dist/dist-BGKdXVy3.js.map +1 -0
  62. package/dist/env-DdaoGjIt.js +74 -0
  63. package/dist/env-DdaoGjIt.js.map +1 -0
  64. package/dist/event-queue/index.d.ts +2 -7
  65. package/dist/event-queue/index.js +7 -9
  66. package/dist/event-queue/index.js.map +1 -1
  67. package/dist/event-queue-Cw-YJPY_.js +1384 -0
  68. package/dist/event-queue-Cw-YJPY_.js.map +1 -0
  69. package/dist/{explicit-activity-scope-CCoxVwAr.d.ts → explicit-activity-scope-D8VeGGpt.d.ts} +1 -2
  70. package/dist/explicit-activity-scope-DikJ7NAE.js +57 -0
  71. package/dist/explicit-activity-scope-DikJ7NAE.js.map +1 -0
  72. package/dist/export/index.d.ts +2 -2
  73. package/dist/export/index.js +3 -14
  74. package/dist/export/index.js.map +1 -1
  75. package/dist/export-DJXE3Osa.js +642 -0
  76. package/dist/export-DJXE3Osa.js.map +1 -0
  77. package/dist/feature-flags/index.d.ts +2 -10
  78. package/dist/feature-flags/index.js +3 -6
  79. package/dist/feature-flags/index.js.map +1 -1
  80. package/dist/feature-flags-CP1KRgwD.js +422 -0
  81. package/dist/feature-flags-CP1KRgwD.js.map +1 -0
  82. package/dist/files/index.d.ts +2 -3
  83. package/dist/files/index.js +3 -4
  84. package/dist/files/index.js.map +1 -1
  85. package/dist/files-h5U-D2AF.js +830 -0
  86. package/dist/files-h5U-D2AF.js.map +1 -0
  87. package/dist/gateway/index.d.ts +4 -6
  88. package/dist/gateway/index.js +7 -13
  89. package/dist/gateway/index.js.map +1 -1
  90. package/dist/gateway/security/index.d.ts +2 -2
  91. package/dist/gateway/security/index.js +3 -5
  92. package/dist/gateway/security/index.js.map +1 -1
  93. package/dist/gateway-ByVo-n37.js +50 -0
  94. package/dist/gateway-ByVo-n37.js.map +1 -0
  95. package/dist/graph/index.d.ts +3 -10
  96. package/dist/graph/index.js +4 -13
  97. package/dist/graph/index.js.map +1 -1
  98. package/dist/graph-CR7u4lpl.js +2152 -0
  99. package/dist/graph-CR7u4lpl.js.map +1 -0
  100. package/dist/graph-emitter-CdOXP7Tn.js +621 -0
  101. package/dist/graph-emitter-CdOXP7Tn.js.map +1 -0
  102. package/dist/graphql/index.d.ts +3 -2
  103. package/dist/graphql/index.js +4 -6
  104. package/dist/graphql/index.js.map +1 -1
  105. package/dist/graphql/services/index.d.ts +2 -24
  106. package/dist/graphql/services/index.js +3 -4
  107. package/dist/graphql/services/index.js.map +1 -1
  108. package/dist/graphql-CUDyhibV.d.ts +21 -0
  109. package/dist/graphql-DHAHHcww.js +161 -0
  110. package/dist/graphql-DHAHHcww.js.map +1 -0
  111. package/dist/i18n/index.d.ts +3 -3
  112. package/dist/i18n/index.js +3 -4
  113. package/dist/i18n/index.js.map +1 -1
  114. package/dist/i18n-BBMYFd0P.js +860 -0
  115. package/dist/i18n-BBMYFd0P.js.map +1 -0
  116. package/dist/import-optional-peer-B82VYxeX.js +18 -0
  117. package/dist/import-optional-peer-B82VYxeX.js.map +1 -0
  118. package/dist/index-3KOZ1zN9.d.ts +233 -0
  119. package/dist/index-ADmsX0BI.d.ts +646 -0
  120. package/dist/index-B2LCaK0R.d.ts +500 -0
  121. package/dist/index-BBqooJ52.d.ts +45 -0
  122. package/dist/index-BGzMYJsm.d.ts +209 -0
  123. package/dist/index-BMIMnp6T.d.ts +8 -0
  124. package/dist/index-BVOL7458.d.ts +10 -0
  125. package/dist/index-BcqQs-Uq.d.ts +69 -0
  126. package/dist/index-BeVtqGO-.d.ts +208 -0
  127. package/dist/index-BiTzGUZP.d.ts +114 -0
  128. package/dist/index-C0qLquY0.d.ts +150 -0
  129. package/dist/index-C5uEKchX.d.ts +60 -0
  130. package/dist/index-CDOqxSIi.d.ts +37 -0
  131. package/dist/index-CG6wj66Y.d.ts +148 -0
  132. package/dist/index-CHwMhK6v.d.ts +63 -0
  133. package/dist/index-CIgoeobA.d.ts +145 -0
  134. package/dist/index-CPQDMSFS.d.ts +103 -0
  135. package/dist/index-CSRcgkVi.d.ts +23 -0
  136. package/dist/index-CTTwo9av.d.ts +102 -0
  137. package/dist/index-CVCyKzhB.d.ts +207 -0
  138. package/dist/index-C_GXXF32.d.ts +704 -0
  139. package/dist/index-CaM9JUcc.d.ts +144 -0
  140. package/dist/index-CliOgq6L.d.ts +203 -0
  141. package/dist/index-Cot73bdh.d.ts +63 -0
  142. package/dist/index-DGgh9DWn.d.ts +59 -0
  143. package/dist/index-DY3dNhMN.d.ts +420 -0
  144. package/dist/index-DqbGqfAy.d.ts +127 -0
  145. package/dist/index-Dt1HJPTX.d.ts +12 -0
  146. package/dist/index-DtI6aBtB.d.ts +22 -0
  147. package/dist/index-FKohsiex.d.ts +38 -0
  148. package/dist/index-FRRaa6h2.d.ts +999 -0
  149. package/dist/index-FbXPfen7.d.ts +132 -0
  150. package/dist/index-MArCb8Aq.d.ts +306 -0
  151. package/dist/index-U_tu3zUl.d.ts +303 -0
  152. package/dist/index-YOShAwkq.d.ts +45 -0
  153. package/dist/index-cmR9k9ga.d.ts +26 -0
  154. package/dist/index-yBSjMY32.d.ts +24 -0
  155. package/dist/index-zd_NPGJo.d.ts +206 -0
  156. package/dist/index.d.ts +106 -609
  157. package/dist/index.js +769 -2590
  158. package/dist/index.js.map +1 -1
  159. package/dist/init/index.d.ts +2 -2
  160. package/dist/init/index.js +3 -16
  161. package/dist/init/index.js.map +1 -1
  162. package/dist/init-CQPFmOOe.js +325 -0
  163. package/dist/init-CQPFmOOe.js.map +1 -0
  164. package/dist/instrumentation/index.d.ts +3 -4
  165. package/dist/instrumentation/index.js +5 -5
  166. package/dist/instrumentation/index.js.map +1 -1
  167. package/dist/instrumentation-xkkmDgJ0.js +1678 -0
  168. package/dist/instrumentation-xkkmDgJ0.js.map +1 -0
  169. package/dist/lake/index.d.ts +50 -54
  170. package/dist/lake/index.js +169 -193
  171. package/dist/lake/index.js.map +1 -1
  172. package/dist/layer/index.d.ts +3 -2
  173. package/dist/layer/index.js +4 -5
  174. package/dist/layer/index.js.map +1 -1
  175. package/dist/layer-BZBZZWeV.d.ts +69 -0
  176. package/dist/layer-Bcix-WCl.js +105 -0
  177. package/dist/layer-Bcix-WCl.js.map +1 -0
  178. package/dist/layer-CEKy6cm8.js +252 -0
  179. package/dist/layer-CEKy6cm8.js.map +1 -0
  180. package/dist/lifecycle/index.d.ts +2 -1
  181. package/dist/lifecycle/index.js +3 -4
  182. package/dist/lifecycle/index.js.map +1 -1
  183. package/dist/lifecycle-DeoLSX0U.js +76 -0
  184. package/dist/lifecycle-DeoLSX0U.js.map +1 -0
  185. package/dist/logger/index.d.ts +2 -3
  186. package/dist/logger/index.js +3 -3
  187. package/dist/logger/index.js.map +1 -1
  188. package/dist/logger-B6rCpb7D.js +290 -0
  189. package/dist/logger-B6rCpb7D.js.map +1 -0
  190. package/dist/metrics/index.d.ts +13 -14
  191. package/dist/metrics/index.js +3 -4
  192. package/dist/metrics/index.js.map +1 -1
  193. package/dist/metrics-BrLwNUrb.js +52 -0
  194. package/dist/metrics-BrLwNUrb.js.map +1 -0
  195. package/dist/metrics-collector-C2eShrlW.js +922 -0
  196. package/dist/metrics-collector-C2eShrlW.js.map +1 -0
  197. package/dist/middleware/index.d.ts +3 -3
  198. package/dist/middleware/index.js +3 -4
  199. package/dist/middleware/index.js.map +1 -1
  200. package/dist/middleware-CUxJVUpD.js +1243 -0
  201. package/dist/middleware-CUxJVUpD.js.map +1 -0
  202. package/dist/middleware-Cq0zFMGp.js +253 -0
  203. package/dist/middleware-Cq0zFMGp.js.map +1 -0
  204. package/dist/notifications/index.d.ts +2 -5
  205. package/dist/notifications/index.js +3 -6
  206. package/dist/notifications/index.js.map +1 -1
  207. package/dist/notifications-DY_i37WN.js +869 -0
  208. package/dist/notifications-DY_i37WN.js.map +1 -0
  209. package/dist/observability/index.d.ts +2 -3
  210. package/dist/observability/index.js +3 -4
  211. package/dist/observability/index.js.map +1 -1
  212. package/dist/observability-DBDXipTU.js +272 -0
  213. package/dist/observability-DBDXipTU.js.map +1 -0
  214. package/dist/payments/index.d.ts +144 -0
  215. package/dist/payments/index.js +404 -0
  216. package/dist/payments/index.js.map +1 -0
  217. package/dist/platform/index.d.ts +2 -1
  218. package/dist/platform/index.js +3 -5
  219. package/dist/platform/index.js.map +1 -1
  220. package/dist/platform-DZwczW7v.js +1510 -0
  221. package/dist/platform-DZwczW7v.js.map +1 -0
  222. package/dist/prisma/generator/index.d.ts +1 -1
  223. package/dist/prisma/generator/index.js +97 -84
  224. package/dist/prisma/generator/index.js.map +1 -1
  225. package/dist/prisma/index.d.ts +4 -7
  226. package/dist/prisma/index.js +5 -12
  227. package/dist/prisma/index.js.map +1 -1
  228. package/dist/prisma-BzOOdt79.js +863 -0
  229. package/dist/prisma-BzOOdt79.js.map +1 -0
  230. package/dist/prisma-extension-Cfl09swM.d.ts +172 -0
  231. package/dist/product-alias/index.d.ts +2 -1
  232. package/dist/product-alias/index.js +3 -3
  233. package/dist/product-alias/index.js.map +1 -1
  234. package/dist/product-alias-BPqtskMq.js +273 -0
  235. package/dist/product-alias-BPqtskMq.js.map +1 -0
  236. package/dist/rate-limit-CBrK_U5H.js +142 -0
  237. package/dist/rate-limit-CBrK_U5H.js.map +1 -0
  238. package/dist/rbac/index.d.ts +2 -122
  239. package/dist/rbac/index.js +3 -6
  240. package/dist/rbac/index.js.map +1 -1
  241. package/dist/rbac-Dvz0YzEt.js +1486 -0
  242. package/dist/rbac-Dvz0YzEt.js.map +1 -0
  243. package/dist/resource-caps/index.d.ts +66 -72
  244. package/dist/resource-caps/index.js +430 -5
  245. package/dist/resource-caps/index.js.map +1 -1
  246. package/dist/rolldown-runtime-ad2WFvuA.js +17 -0
  247. package/dist/sdk-Dju9o-sq.js +124 -0
  248. package/dist/sdk-Dju9o-sq.js.map +1 -0
  249. package/dist/search/index.d.ts +112 -0
  250. package/dist/search/index.js +266 -0
  251. package/dist/search/index.js.map +1 -0
  252. package/dist/security/index.d.ts +2 -0
  253. package/dist/security/index.js +4 -0
  254. package/dist/security/index.js.map +1 -0
  255. package/dist/security/rate-limit/index.d.ts +2 -0
  256. package/dist/security/rate-limit/index.js +4 -0
  257. package/dist/security/rate-limit/index.js.map +1 -0
  258. package/dist/security-DIG-95Ic.js +1647 -0
  259. package/dist/security-DIG-95Ic.js.map +1 -0
  260. package/dist/server/index.d.ts +7 -164
  261. package/dist/server/index.js +2001 -1507
  262. package/dist/server/index.js.map +1 -1
  263. package/dist/service-jwt-Bu-WNA_-.js +80 -0
  264. package/dist/service-jwt-Bu-WNA_-.js.map +1 -0
  265. package/dist/services-BWzfz7vG.js +102 -0
  266. package/dist/services-BWzfz7vG.js.map +1 -0
  267. package/dist/sharding/index.d.ts +41 -44
  268. package/dist/sharding/index.js +156 -137
  269. package/dist/sharding/index.js.map +1 -1
  270. package/dist/sharing/index.d.ts +2 -1
  271. package/dist/sharing/index.js +3 -4
  272. package/dist/sharing/index.js.map +1 -1
  273. package/dist/sharing-CflDsSJ-.js +911 -0
  274. package/dist/sharing-CflDsSJ-.js.map +1 -0
  275. package/dist/stub-BUnfMiAS.js +577 -0
  276. package/dist/stub-BUnfMiAS.js.map +1 -0
  277. package/dist/tags/index.d.ts +2 -3
  278. package/dist/tags/index.js +3 -4
  279. package/dist/tags/index.js.map +1 -1
  280. package/dist/tags-CbijgoqR.js +868 -0
  281. package/dist/{chunk-PBZFAAOM.js.map → tags-CbijgoqR.js.map} +1 -1
  282. package/dist/telemetry/index.d.ts +64 -76
  283. package/dist/telemetry/index.js +369 -201
  284. package/dist/telemetry/index.js.map +1 -1
  285. package/dist/temporal/index.d.ts +2 -148
  286. package/dist/temporal/index.js +3 -5
  287. package/dist/temporal/index.js.map +1 -1
  288. package/dist/temporal-B534uYK8.js +706 -0
  289. package/dist/temporal-B534uYK8.js.map +1 -0
  290. package/dist/tracker/index.d.ts +5 -11
  291. package/dist/tracker/index.js +7 -20
  292. package/dist/tracker/index.js.map +1 -1
  293. package/dist/tracker-PQztSlhJ.js +458 -0
  294. package/dist/tracker-PQztSlhJ.js.map +1 -0
  295. package/dist/translation/index.d.ts +120 -0
  296. package/dist/translation/index.js +573 -0
  297. package/dist/translation/index.js.map +1 -0
  298. package/dist/types/index.d.ts +3 -0
  299. package/dist/types/index.js +90 -0
  300. package/dist/types/index.js.map +1 -0
  301. package/dist/types-BYMYND1L.js +44 -0
  302. package/dist/types-BYMYND1L.js.map +1 -0
  303. package/dist/types-C6EKaS3V.d.ts +106 -0
  304. package/dist/types-CWybW61E.d.ts +323 -0
  305. package/dist/types-C_yfu3XK.d.ts +34 -0
  306. package/dist/types-DgaQqvxo.d.ts +70 -0
  307. package/dist/usage/index.d.ts +2 -213
  308. package/dist/usage/index.js +3 -15
  309. package/dist/usage/index.js.map +1 -1
  310. package/dist/usage-BRqVP3CJ.js +682 -0
  311. package/dist/usage-BRqVP3CJ.js.map +1 -0
  312. package/dist/utils/index.d.ts +2 -1
  313. package/dist/utils/index.js +3 -3
  314. package/dist/utils/index.js.map +1 -1
  315. package/dist/utils-DL85Tnbn.js +500 -0
  316. package/dist/utils-DL85Tnbn.js.map +1 -0
  317. package/dist/validation/index.d.ts +2 -2
  318. package/dist/validation/index.js +3 -3
  319. package/dist/validation/index.js.map +1 -1
  320. package/dist/validation-CPUITdMk.js +762 -0
  321. package/dist/validation-CPUITdMk.js.map +1 -0
  322. package/dist/workspace-extension-COrC0dYi.js +979 -0
  323. package/dist/workspace-extension-COrC0dYi.js.map +1 -0
  324. package/dist/{workspace-extension-BGwTOV_r.d.ts → workspace-extension-DTFTdGVF.d.ts} +43 -45
  325. package/package.json +7 -10
  326. package/dist/EventQueueFactory-GXC3A7DH.js +0 -8
  327. package/dist/EventQueueFactory-GXC3A7DH.js.map +0 -1
  328. package/dist/chunk-4XIBXZ6J.js +0 -276
  329. package/dist/chunk-4XIBXZ6J.js.map +0 -1
  330. package/dist/chunk-554Z4C2K.js +0 -1006
  331. package/dist/chunk-554Z4C2K.js.map +0 -1
  332. package/dist/chunk-5CAFHK2Z.js +0 -107
  333. package/dist/chunk-5CAFHK2Z.js.map +0 -1
  334. package/dist/chunk-63ZXJ42X.js +0 -451
  335. package/dist/chunk-63ZXJ42X.js.map +0 -1
  336. package/dist/chunk-6XEXJATV.js +0 -304
  337. package/dist/chunk-6XEXJATV.js.map +0 -1
  338. package/dist/chunk-726AR6Q7.js +0 -1532
  339. package/dist/chunk-726AR6Q7.js.map +0 -1
  340. package/dist/chunk-A5F6Z5UE.js +0 -21
  341. package/dist/chunk-A5F6Z5UE.js.map +0 -1
  342. package/dist/chunk-A6DE32ZS.js +0 -1507
  343. package/dist/chunk-A6DE32ZS.js.map +0 -1
  344. package/dist/chunk-AXJDGQPE.js +0 -690
  345. package/dist/chunk-AXJDGQPE.js.map +0 -1
  346. package/dist/chunk-BJQOGOVW.js +0 -602
  347. package/dist/chunk-BJQOGOVW.js.map +0 -1
  348. package/dist/chunk-CFXWH2IS.js +0 -52
  349. package/dist/chunk-CFXWH2IS.js.map +0 -1
  350. package/dist/chunk-DRWH5XCJ.js +0 -876
  351. package/dist/chunk-DRWH5XCJ.js.map +0 -1
  352. package/dist/chunk-E4QNLVY4.js +0 -909
  353. package/dist/chunk-E4QNLVY4.js.map +0 -1
  354. package/dist/chunk-EBDHIL7V.js +0 -774
  355. package/dist/chunk-EBDHIL7V.js.map +0 -1
  356. package/dist/chunk-ELU7VL3E.js +0 -245
  357. package/dist/chunk-ELU7VL3E.js.map +0 -1
  358. package/dist/chunk-FZRODKIN.js +0 -31
  359. package/dist/chunk-FZRODKIN.js.map +0 -1
  360. package/dist/chunk-GCIB76AJ.js +0 -882
  361. package/dist/chunk-GCIB76AJ.js.map +0 -1
  362. package/dist/chunk-HC6MPUIH.js +0 -1571
  363. package/dist/chunk-HC6MPUIH.js.map +0 -1
  364. package/dist/chunk-HNMHPSAM.js +0 -272
  365. package/dist/chunk-HNMHPSAM.js.map +0 -1
  366. package/dist/chunk-HTLEGD3Q.js +0 -1480
  367. package/dist/chunk-HTLEGD3Q.js.map +0 -1
  368. package/dist/chunk-I3KOWRT3.js +0 -89
  369. package/dist/chunk-I3KOWRT3.js.map +0 -1
  370. package/dist/chunk-ID3WR4JS.js +0 -509
  371. package/dist/chunk-ID3WR4JS.js.map +0 -1
  372. package/dist/chunk-JS52ZHTK.js +0 -1346
  373. package/dist/chunk-JS52ZHTK.js.map +0 -1
  374. package/dist/chunk-JVMAQOA3.js +0 -521
  375. package/dist/chunk-JVMAQOA3.js.map +0 -1
  376. package/dist/chunk-KH4TRQCO.js +0 -1063
  377. package/dist/chunk-KH4TRQCO.js.map +0 -1
  378. package/dist/chunk-KJOSPVB2.js +0 -57
  379. package/dist/chunk-KJOSPVB2.js.map +0 -1
  380. package/dist/chunk-KO2ZXZ7W.js +0 -61
  381. package/dist/chunk-KO2ZXZ7W.js.map +0 -1
  382. package/dist/chunk-KS2HQCJR.js +0 -56
  383. package/dist/chunk-KS2HQCJR.js.map +0 -1
  384. package/dist/chunk-LA5KPWZ2.js +0 -413
  385. package/dist/chunk-LA5KPWZ2.js.map +0 -1
  386. package/dist/chunk-MESLAC5W.js +0 -574
  387. package/dist/chunk-MESLAC5W.js.map +0 -1
  388. package/dist/chunk-MWPYA2HD.js +0 -94
  389. package/dist/chunk-MWPYA2HD.js.map +0 -1
  390. package/dist/chunk-NUB5GQTU.js +0 -270
  391. package/dist/chunk-NUB5GQTU.js.map +0 -1
  392. package/dist/chunk-OBBCR6WY.js +0 -277
  393. package/dist/chunk-OBBCR6WY.js.map +0 -1
  394. package/dist/chunk-OQDSAOG3.js +0 -1908
  395. package/dist/chunk-OQDSAOG3.js.map +0 -1
  396. package/dist/chunk-OXNCBE7P.js +0 -971
  397. package/dist/chunk-OXNCBE7P.js.map +0 -1
  398. package/dist/chunk-PBZFAAOM.js +0 -941
  399. package/dist/chunk-PN6GIF3R.js +0 -1185
  400. package/dist/chunk-PN6GIF3R.js.map +0 -1
  401. package/dist/chunk-PYD44IHJ.js +0 -728
  402. package/dist/chunk-PYD44IHJ.js.map +0 -1
  403. package/dist/chunk-QVPIACWD.js +0 -679
  404. package/dist/chunk-QVPIACWD.js.map +0 -1
  405. package/dist/chunk-QWNNFE4P.js +0 -41
  406. package/dist/chunk-QWNNFE4P.js.map +0 -1
  407. package/dist/chunk-RU266375.js +0 -327
  408. package/dist/chunk-RU266375.js.map +0 -1
  409. package/dist/chunk-RYTSVGGA.js +0 -1624
  410. package/dist/chunk-RYTSVGGA.js.map +0 -1
  411. package/dist/chunk-RZOFS2BQ.js +0 -225
  412. package/dist/chunk-RZOFS2BQ.js.map +0 -1
  413. package/dist/chunk-SBS4S2PJ.js +0 -100
  414. package/dist/chunk-SBS4S2PJ.js.map +0 -1
  415. package/dist/chunk-SPRG6G6G.js +0 -530
  416. package/dist/chunk-SPRG6G6G.js.map +0 -1
  417. package/dist/chunk-STWFX5E2.js +0 -233
  418. package/dist/chunk-STWFX5E2.js.map +0 -1
  419. package/dist/chunk-UNASM5VJ.js +0 -419
  420. package/dist/chunk-UNASM5VJ.js.map +0 -1
  421. package/dist/chunk-VAT66FJA.js +0 -245
  422. package/dist/chunk-VAT66FJA.js.map +0 -1
  423. package/dist/chunk-VFCMR5GX.js +0 -49
  424. package/dist/chunk-VFCMR5GX.js.map +0 -1
  425. package/dist/chunk-VGAHZKNJ.js +0 -66
  426. package/dist/chunk-VGAHZKNJ.js.map +0 -1
  427. package/dist/chunk-VTJTAAXC.js +0 -627
  428. package/dist/chunk-VTJTAAXC.js.map +0 -1
  429. package/dist/chunk-VXVLKRU6.js +0 -758
  430. package/dist/chunk-VXVLKRU6.js.map +0 -1
  431. package/dist/chunk-WWUU5ETI.js +0 -163
  432. package/dist/chunk-WWUU5ETI.js.map +0 -1
  433. package/dist/chunk-XE4OXN2W.js +0 -10
  434. package/dist/chunk-XE4OXN2W.js.map +0 -1
  435. package/dist/chunk-XOJORS75.js +0 -1853
  436. package/dist/chunk-XOJORS75.js.map +0 -1
  437. package/dist/chunk-YMZEUTD2.js +0 -110
  438. package/dist/chunk-YMZEUTD2.js.map +0 -1
  439. package/dist/chunk-Z77BTSOK.js +0 -617
  440. package/dist/chunk-Z77BTSOK.js.map +0 -1
  441. package/dist/chunk-ZZK3WEDI.js +0 -181
  442. package/dist/chunk-ZZK3WEDI.js.map +0 -1
  443. package/dist/client-CCXpAZ2r.d.ts +0 -89
  444. package/dist/client-DSI_760t.d.ts +0 -36
  445. package/dist/client-JU6T3UPB.js +0 -11
  446. package/dist/client-JU6T3UPB.js.map +0 -1
  447. package/dist/dist-2X4Q7PJA.js +0 -1491
  448. package/dist/dist-2X4Q7PJA.js.map +0 -1
  449. package/dist/env-4UWSUS64.js +0 -4
  450. package/dist/env-4UWSUS64.js.map +0 -1
  451. package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
  452. package/dist/graphql-CMHMQjvd.d.ts +0 -23
  453. package/dist/i18n-Qm2AkPC-.d.ts +0 -33
  454. package/dist/index--yvpa6ay.d.ts +0 -83
  455. package/dist/index-4gKQKZ2B.d.ts +0 -71
  456. package/dist/index-5x0XMKXN.d.ts +0 -149
  457. package/dist/index-B70b5mYS.d.ts +0 -33
  458. package/dist/index-B8KrxO4j.d.ts +0 -755
  459. package/dist/index-BOuDKnqD.d.ts +0 -201
  460. package/dist/index-BTMt4OjA.d.ts +0 -201
  461. package/dist/index-BejbszA7.d.ts +0 -39
  462. package/dist/index-BkeOYZye.d.ts +0 -198
  463. package/dist/index-BuAj5nXg.d.ts +0 -83
  464. package/dist/index-BvkVcW8I.d.ts +0 -349
  465. package/dist/index-CWmH_-RZ.d.ts +0 -247
  466. package/dist/index-CbgWNcus.d.ts +0 -258
  467. package/dist/index-CmfPeQza.d.ts +0 -166
  468. package/dist/index-CmpG-zak.d.ts +0 -607
  469. package/dist/index-CoMKgL-p.d.ts +0 -12
  470. package/dist/index-D8HGwglK.d.ts +0 -541
  471. package/dist/index-DCaVm66D.d.ts +0 -1101
  472. package/dist/index-DE2w7E0d.d.ts +0 -83
  473. package/dist/index-DSOpj8DI.d.ts +0 -17
  474. package/dist/index-DW9q22GH.d.ts +0 -75
  475. package/dist/index-DnjJ9CwI.d.ts +0 -347
  476. package/dist/index-DwMJZ8PP.d.ts +0 -317
  477. package/dist/index-PaojfSdd.d.ts +0 -71
  478. package/dist/index-aHtYvc3i.d.ts +0 -284
  479. package/dist/index-e_18DzAg.d.ts +0 -18
  480. package/dist/index-ffmipXSA.d.ts +0 -55
  481. package/dist/index-joONjwLt.d.ts +0 -33
  482. package/dist/index-kssw5ziY.d.ts +0 -250
  483. package/dist/index-lFffh5-G.d.ts +0 -125
  484. package/dist/index-pxYge_6k.d.ts +0 -79
  485. package/dist/layer-Cv9vSwBx.d.ts +0 -70
  486. package/dist/pino-logger-H4HPW5P6.js +0 -5
  487. package/dist/pino-logger-H4HPW5P6.js.map +0 -1
  488. package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
  489. package/dist/sdk-L75WWUP3.js +0 -156
  490. package/dist/sdk-L75WWUP3.js.map +0 -1
  491. package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
  492. package/dist/types-Bo2wkjSP.d.ts +0 -35
  493. package/dist/types-DVpvrAhd.d.ts +0 -71
  494. package/dist/types-DgJ4lDYA.d.ts +0 -108
  495. package/dist/types-USOv09qy.d.ts +0 -327
  496. package/dist/workspace-guard-NXVYYBVJ.js +0 -5
  497. package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
@@ -0,0 +1,868 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-ad2WFvuA.js";
2
+ import { a as logger } from "./logger-B6rCpb7D.js";
3
+ import { GraphQLError } from "graphql";
4
+
5
+ // src/tags/types.ts
6
+ /** Actor types the gateway forwards in `x-actor-type`. */
7
+ const TAG_ACTOR_TYPES = [
8
+ "user",
9
+ "app",
10
+ "service",
11
+ "super_admin"
12
+ ];
13
+ /** `AssignmentSource` enum members accepted by wspace-tags-svc. */
14
+ const TAG_ASSIGNMENT_SOURCES = [
15
+ "AUTOMATIC",
16
+ "COMPUTED",
17
+ "IMPORTED",
18
+ "INHERITED",
19
+ "MANUAL",
20
+ "MIGRATED"
21
+ ];
22
+
23
+ // src/tags/errors.ts
24
+ /** GraphQL `extensions.code` each {@link EntityTagsErrorCode} should surface as. */
25
+ const ENTITY_TAGS_GRAPHQL_CODES = {
26
+ INVALID_ENTITY_TYPE: "BAD_USER_INPUT",
27
+ INVALID_SOURCE: "BAD_USER_INPUT",
28
+ INVALID_INPUT: "BAD_USER_INPUT",
29
+ MISSING_CONTEXT: "UNAUTHENTICATED",
30
+ UPSTREAM_ERROR: "INTERNAL_SERVER_ERROR",
31
+ CONFIGURATION_ERROR: "INTERNAL_SERVER_ERROR"
32
+ };
33
+ var EntityTagsError = class extends Error {
34
+ code;
35
+ details;
36
+ constructor(code, message, details = {}) {
37
+ super(message);
38
+ this.name = "EntityTagsError";
39
+ this.code = code;
40
+ this.details = details;
41
+ }
42
+ /** The GraphQL `extensions.code` this error maps to. */
43
+ get graphqlCode() {
44
+ return ENTITY_TAGS_GRAPHQL_CODES[this.code];
45
+ }
46
+ };
47
+ function isEntityTagsError(error) {
48
+ return error instanceof EntityTagsError;
49
+ }
50
+
51
+ // src/tags/naming.ts
52
+ /**
53
+ * Entity tags — GraphQL naming.
54
+ *
55
+ * Every service in the workspaces supergraph publishes its own tag surface, so
56
+ * every type and root field must be unique to the service: unprefixed
57
+ * `EntityTagAssignment` / `AvailableTag` / `EntityTagInfo` declared by two
58
+ * subgraphs are non-shareable value types and break composition. The SDL
59
+ * builder and the resolver factory both derive their names from here, so a
60
+ * service's schema and its resolver map can never drift apart.
61
+ */
62
+ const PREFIX_PATTERN = /^[A-Z][A-Za-z0-9]*$/;
63
+ function assertTagPrefix(prefix) {
64
+ if (!PREFIX_PATTERN.test(prefix)) throw new EntityTagsError("CONFIGURATION_ERROR", `Entity tags prefix must be PascalCase ([A-Z][A-Za-z0-9]*), got "${prefix}"`, { prefix });
65
+ }
66
+ function lowerFirst(value) {
67
+ return value.charAt(0).toLowerCase() + value.slice(1);
68
+ }
69
+ function entityTagsFieldNames(prefix) {
70
+ assertTagPrefix(prefix);
71
+ const camel = lowerFirst(prefix);
72
+ return {
73
+ entityTags: `${camel}EntityTags`,
74
+ searchTags: `search${prefix}Tags`,
75
+ availableTags: `available${prefix}Tags`,
76
+ entitiesByTags: `${camel}EntitiesByTags`,
77
+ tagEntity: `tag${prefix}Entity`,
78
+ untagEntity: `untag${prefix}Entity`,
79
+ replaceEntityTags: `replace${prefix}EntityTags`,
80
+ createTag: `create${prefix}Tag`
81
+ };
82
+ }
83
+ /**
84
+ * Type names for `prefix`. Defaults carry the prefix everywhere (the FluidGrids
85
+ * convention). `overrides` exists for services that already published legacy
86
+ * names (VibeControls ships `EntityTagAssignment`, `TagEntityInput`, …) and must
87
+ * keep them for existing clients' fragments.
88
+ */
89
+ function entityTagsTypeNames(prefix, overrides = {}) {
90
+ assertTagPrefix(prefix);
91
+ const names = {
92
+ getEntityTagsInput: `Get${prefix}EntityTagsInput`,
93
+ tagEntityInput: `Tag${prefix}EntityInput`,
94
+ untagEntityInput: `Untag${prefix}EntityInput`,
95
+ replaceEntityTagsInput: `Replace${prefix}EntityTagsInput`,
96
+ createTagInput: `Create${prefix}TagInput`,
97
+ entitiesByTagsInput: `${prefix}EntitiesByTagsInput`,
98
+ tagInfo: `${prefix}TagInfo`,
99
+ tagAssignment: `${prefix}TagAssignment`,
100
+ availableTag: `${prefix}AvailableTag`,
101
+ taggedEntityPage: `${prefix}TaggedEntityPage`,
102
+ ...overrides
103
+ };
104
+ const seen = /* @__PURE__ */ new Map();
105
+ for (const [role, name] of Object.entries(names)) {
106
+ if (!PREFIX_PATTERN.test(name)) throw new EntityTagsError("CONFIGURATION_ERROR", `Entity tags type name for ${role} is not a valid type name`, {
107
+ role,
108
+ name
109
+ });
110
+ const clash = seen.get(name);
111
+ if (clash) throw new EntityTagsError("CONFIGURATION_ERROR", `Entity tags type name "${name}" is used for both ${clash} and ${role}`, { name });
112
+ seen.set(name, role);
113
+ }
114
+ return names;
115
+ }
116
+
117
+ // src/tags/adapter.ts
118
+ /**
119
+ * TagsGatewayAdapter — one implementation of "tag my entities" for every service.
120
+ *
121
+ * Thirteen services carried their own copy of this adapter (VibeControls,
122
+ * FluidGrids, BigConsole, files, integrations, …) and the copies drifted:
123
+ * argument order (`userId, workspaceId` vs `workspaceId, userId`), a hard-coded
124
+ * `x-actor-type: user`, `response.data!` non-null assertions, no source
125
+ * validation. This class is the lifted, configurable version: a service
126
+ * supplies its taggable entity types, its default vocabulary and (optionally)
127
+ * the gateway client, and gets the full tag surface.
128
+ *
129
+ * All calls are same-layer M2M to wspace-tags-svc through the internal
130
+ * workspace gateway (`GatewayClient.internalQuery`, which signs the service JWT);
131
+ * the caller's actor and workspace are forwarded explicitly because tags-svc
132
+ * scopes every vocabulary, tag and assignment by `x-workspace-id`.
133
+ *
134
+ * @example
135
+ * ```ts
136
+ * import { TagsGatewayAdapter } from '@burdenoff/be-sdk/tags';
137
+ *
138
+ * export const entityTags = new TagsGatewayAdapter({
139
+ * serviceName: 'wspace-workflow-svc',
140
+ * entityTypes: ['FLUIDGRIDS_WORKFLOW', 'FLUIDGRIDS_RUN', 'FLUIDGRIDS_DATATABLE'],
141
+ * vocabulary: { key: 'fluidgrids-tags', name: 'FluidGrids Tags' },
142
+ * });
143
+ *
144
+ * await entityTags.tagEntity('FLUIDGRIDS_RUN', run.id, { tagId }, { actorId, workspaceId });
145
+ * ```
146
+ */
147
+ /** tags-svc caps; requests outside are clamped rather than rejected. */
148
+ const SEARCH_LIMIT = {
149
+ default: 20,
150
+ max: 100
151
+ };
152
+ const AVAILABLE_LIMIT = {
153
+ default: 50,
154
+ max: 200
155
+ };
156
+ const ENTITIES_BY_TAGS_LIMIT = {
157
+ default: 50,
158
+ max: 200
159
+ };
160
+ /** Same-layer tag calls should fail fast; the GatewayClient default is 30s. */
161
+ const DEFAULT_REQUEST_TIMEOUT_MS = 1e4;
162
+ const ENTITY_TYPE_PATTERN = /^[A-Z][A-Z0-9_]*$/;
163
+ const ASSIGNMENT_FIELDS = "id tagId entityType entityId source assignedById createdAt validFrom validTo metadata tag { id key label color }";
164
+ function clampLimit(value, bounds) {
165
+ if (value === null || value === void 0 || !Number.isFinite(value)) return bounds.default;
166
+ return Math.min(Math.max(Math.trunc(value), 1), bounds.max);
167
+ }
168
+ function toDate(value) {
169
+ if (!value) return null;
170
+ const date = new Date(value);
171
+ return Number.isNaN(date.getTime()) ? null : date;
172
+ }
173
+ function requireNonEmpty(value, field) {
174
+ const trimmed = typeof value === "string" ? value.trim() : "";
175
+ if (!trimmed) throw new EntityTagsError("INVALID_INPUT", `${field} is required`, { field });
176
+ return trimmed;
177
+ }
178
+ /** FNV-1a, used only to give non-ASCII labels a stable, non-empty key. */
179
+ function shortHash(value) {
180
+ let hash = 2166136261;
181
+ for (const char of value) {
182
+ hash ^= char.codePointAt(0) ?? 0;
183
+ hash = Math.imul(hash, 16777619) >>> 0;
184
+ }
185
+ return hash.toString(36);
186
+ }
187
+ /**
188
+ * Tag key for a label: lowercase ASCII slug (`"Needs Review!"` → `needs-review`).
189
+ * Labels with no ASCII letters or digits (`"日本"`) get `tag-<hash>` so the key is
190
+ * never empty (tags-svc rejects an empty key) and stays stable for the same label.
191
+ */
192
+ function slugifyTagKey(label) {
193
+ return label.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || `tag-${shortHash(label.trim())}`;
194
+ }
195
+ /** Map a tags-svc `UniversalTagAssignment` onto the published assignment shape. */
196
+ function mapTagAssignment(raw) {
197
+ return {
198
+ id: raw.id,
199
+ tagId: raw.tagId,
200
+ entityType: raw.entityType,
201
+ entityId: raw.entityId,
202
+ source: raw.source,
203
+ assignedBy: raw.assignedById ?? null,
204
+ assignedAt: toDate(raw.createdAt) ?? toDate(raw.validFrom),
205
+ validFrom: toDate(raw.validFrom),
206
+ validTo: toDate(raw.validTo),
207
+ metadata: raw.metadata ?? null,
208
+ tag: raw.tag ? { id: raw.tag.id } : null,
209
+ tagInfo: raw.tag ? {
210
+ id: raw.tag.id,
211
+ key: raw.tag.key ?? null,
212
+ label: raw.tag.label ?? null,
213
+ color: raw.tag.color ?? null
214
+ } : null
215
+ };
216
+ }
217
+ var TagsGatewayAdapter = class {
218
+ entityTypes;
219
+ vocabulary;
220
+ defaultSource;
221
+ entityTypeSet;
222
+ requestTimeoutMs;
223
+ clientOption;
224
+ serviceName;
225
+ clientPromise = null;
226
+ constructor(options) {
227
+ if (options.entityTypes.length === 0) throw new EntityTagsError("CONFIGURATION_ERROR", "TagsGatewayAdapter needs at least one entity type");
228
+ for (const entityType of options.entityTypes) if (!ENTITY_TYPE_PATTERN.test(entityType)) throw new EntityTagsError("CONFIGURATION_ERROR", `Entity type "${entityType}" must be UPPER_SNAKE_CASE (e.g. FLUIDGRIDS_WORKFLOW)`, { entityType });
229
+ requireNonEmpty(options.vocabulary.key, "vocabulary.key");
230
+ requireNonEmpty(options.vocabulary.name, "vocabulary.name");
231
+ const defaultSource = options.defaultSource ?? "MANUAL";
232
+ if (!TAG_ASSIGNMENT_SOURCES.includes(defaultSource)) throw new EntityTagsError("CONFIGURATION_ERROR", `Unknown default tag source "${defaultSource}"`);
233
+ this.entityTypes = Object.freeze([...new Set(options.entityTypes)]);
234
+ this.entityTypeSet = new Set(this.entityTypes);
235
+ this.vocabulary = Object.freeze({ ...options.vocabulary });
236
+ this.defaultSource = defaultSource;
237
+ this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
238
+ this.clientOption = options.client;
239
+ this.serviceName = options.serviceName;
240
+ }
241
+ isValidEntityType(entityType) {
242
+ return this.entityTypeSet.has(entityType);
243
+ }
244
+ assertEntityType(entityType) {
245
+ if (!this.isValidEntityType(entityType)) throw new EntityTagsError("INVALID_ENTITY_TYPE", `Unsupported entity type "${entityType}"`, {
246
+ entityType,
247
+ supported: this.entityTypes
248
+ });
249
+ }
250
+ /** Validate a caller-supplied source; empty means the adapter default. */
251
+ resolveSource(source) {
252
+ if (source === null || source === void 0 || source === "") return this.defaultSource;
253
+ const normalized = source.toUpperCase();
254
+ const match = TAG_ASSIGNMENT_SOURCES.find((candidate) => candidate === normalized);
255
+ if (!match) throw new EntityTagsError("INVALID_SOURCE", `Unknown tag source "${source}"`, {
256
+ source,
257
+ supported: TAG_ASSIGNMENT_SOURCES
258
+ });
259
+ return match;
260
+ }
261
+ /** Tags currently assigned to an entity. */
262
+ async getEntityTags(entityType, entityId, actor) {
263
+ this.assertEntityType(entityType);
264
+ const id = requireNonEmpty(entityId, "entityId");
265
+ return ((await this.request(`query GetEntityTags($entityType: String!, $entityId: ID!) {
266
+ getEntityTags(entityType: $entityType, entityId: $entityId) { ${ASSIGNMENT_FIELDS} }
267
+ }`, {
268
+ entityType,
269
+ entityId: id
270
+ }, actor)).getEntityTags ?? []).map(mapTagAssignment);
271
+ }
272
+ /** Assign one tag to an entity. */
273
+ async tagEntity(entityType, entityId, options, actor) {
274
+ this.assertEntityType(entityType);
275
+ const id = requireNonEmpty(entityId, "entityId");
276
+ const tagId = requireNonEmpty(options.tagId, "tagId");
277
+ const source = this.resolveSource(options.source);
278
+ const context = this.requireActor(actor);
279
+ const data = await this.request(`mutation AssignTag($input: AssignTagInput!) {
280
+ assignTag(input: $input) { ${ASSIGNMENT_FIELDS} }
281
+ }`, { input: {
282
+ tagId,
283
+ entityType,
284
+ entityId: id,
285
+ source,
286
+ validFrom: options.validFrom?.toISOString(),
287
+ validTo: options.validTo?.toISOString(),
288
+ metadata: options.metadata ?? void 0,
289
+ context: { workspaceId: context.workspaceId }
290
+ } }, context);
291
+ if (!data.assignTag) throw new EntityTagsError("UPSTREAM_ERROR", "wspace-tags-svc returned no assignment", {
292
+ entityType,
293
+ tagId
294
+ });
295
+ return mapTagAssignment(data.assignTag);
296
+ }
297
+ /**
298
+ * Remove a tag from an entity. Removes every assignment of that tag on the entity
299
+ * (tags-svc allows several with different validity windows). `false` when the tag
300
+ * was not assigned.
301
+ */
302
+ async untagEntity(entityType, entityId, tagId, actor) {
303
+ const id = requireNonEmpty(tagId, "tagId");
304
+ const matches = (await this.getEntityTags(entityType, entityId, actor)).filter((assignment) => assignment.tagId === id);
305
+ if (matches.length === 0) return false;
306
+ let removed = false;
307
+ for (const assignment of matches) removed = (await this.request(`mutation RemoveTagAssignment($id: ID!) { removeTagAssignment(id: $id) }`, { id: assignment.id }, actor)).removeTagAssignment === true || removed;
308
+ return removed;
309
+ }
310
+ /** Replace the full tag set on an entity (an empty list clears it). */
311
+ async replaceEntityTags(entityType, entityId, tagIds, actor) {
312
+ this.assertEntityType(entityType);
313
+ const id = requireNonEmpty(entityId, "entityId");
314
+ const uniqueTagIds = [...new Set(tagIds.map((tagId) => requireNonEmpty(tagId, "tagIds[]")))];
315
+ return ((await this.request(`mutation ReplaceEntityTags($entityType: String!, $entityId: ID!, $tagIds: [ID!]!) {
316
+ replaceEntityTags(entityType: $entityType, entityId: $entityId, tagIds: $tagIds) { ${ASSIGNMENT_FIELDS} }
317
+ }`, {
318
+ entityType,
319
+ entityId: id,
320
+ tagIds: uniqueTagIds
321
+ }, actor)).replaceEntityTags ?? []).map(mapTagAssignment);
322
+ }
323
+ /**
324
+ * Ids of `entityType` entities carrying the given tags — the server-side half of
325
+ * "filter this list by tag". Intersect the ids with the service's own query.
326
+ */
327
+ async findEntityIdsByTags(entityType, tagIds, actor, options = {}) {
328
+ this.assertEntityType(entityType);
329
+ const uniqueTagIds = [...new Set(tagIds.map((tagId) => requireNonEmpty(tagId, "tagIds[]")))];
330
+ if (uniqueTagIds.length === 0) throw new EntityTagsError("INVALID_INPUT", "tagIds must contain at least one tag", { field: "tagIds" });
331
+ const page = (await this.request(`query GetEntitiesByTags($tagIds: [ID!]!, $entityType: String, $matchAll: Boolean, $pagination: TagsPaginationInput) {
332
+ getEntitiesByTags(tagIds: $tagIds, entityType: $entityType, matchAll: $matchAll, pagination: $pagination) {
333
+ entities { entityId entityType } total hasMore nextCursor
334
+ }
335
+ }`, {
336
+ tagIds: uniqueTagIds,
337
+ entityType,
338
+ matchAll: options.matchAll ?? false,
339
+ pagination: {
340
+ limit: clampLimit(options.limit, ENTITIES_BY_TAGS_LIMIT),
341
+ ...options.cursor ? { cursor: options.cursor } : {}
342
+ }
343
+ }, actor)).getEntitiesByTags;
344
+ if (!page) return {
345
+ entityIds: [],
346
+ total: 0,
347
+ hasMore: false,
348
+ nextCursor: null
349
+ };
350
+ return {
351
+ entityIds: page.entities.filter((entity) => entity.entityType === entityType).map((entity) => entity.entityId),
352
+ total: page.total,
353
+ hasMore: page.hasMore,
354
+ nextCursor: page.nextCursor ?? null
355
+ };
356
+ }
357
+ /** Search assignable tags in the workspace. */
358
+ async searchTags(query, actor, limit) {
359
+ return (await this.request(`query SearchTags($query: String!, $limit: Int) {
360
+ searchTags(query: $query, limit: $limit) { id key label color }
361
+ }`, {
362
+ query: query.trim(),
363
+ limit: clampLimit(limit, SEARCH_LIMIT)
364
+ }, actor)).searchTags ?? [];
365
+ }
366
+ /** List assignable tags in the workspace. */
367
+ async getAvailableTags(actor, limit) {
368
+ return (await this.request(`query GetTags($pagination: TagsPaginationInput) {
369
+ getTags(pagination: $pagination) { items { id key label color } }
370
+ }`, { pagination: { limit: clampLimit(limit, AVAILABLE_LIMIT) } }, actor)).getTags?.items ?? [];
371
+ }
372
+ /** Create a workspace tag, in the default vocabulary unless `vocabularyId` is given. */
373
+ async createTag(options, actor) {
374
+ const label = requireNonEmpty(options.label, "label");
375
+ const vocabularyId = options.vocabularyId !== void 0 && options.vocabularyId !== null ? options.vocabularyId : await this.ensureWorkspaceVocabulary(actor);
376
+ const data = await this.request(`mutation CreateTag($input: CreateTagInput!) {
377
+ createTag(input: $input) { id key label color }
378
+ }`, { input: {
379
+ vocabularyId,
380
+ key: slugifyTagKey(label),
381
+ label,
382
+ color: options.color || void 0
383
+ } }, actor);
384
+ if (!data.createTag) throw new EntityTagsError("UPSTREAM_ERROR", "wspace-tags-svc returned no tag", { label });
385
+ return data.createTag;
386
+ }
387
+ /**
388
+ * Resolve the workspace's default vocabulary id, creating the vocabulary on first
389
+ * use. Order: pinned `id` (if it exists in this workspace) → lookup by `key` →
390
+ * create → re-read by key (a concurrent request may have created it first).
391
+ */
392
+ async ensureWorkspaceVocabulary(actor, override = {}) {
393
+ const vocabulary = {
394
+ ...this.vocabulary,
395
+ ...override
396
+ };
397
+ if (vocabulary.id) {
398
+ const byId = await this.getVocabularyById(vocabulary.id, actor);
399
+ if (byId?.id) return byId.id;
400
+ }
401
+ const byKey = await this.getVocabularyByKey(vocabulary.key, actor);
402
+ if (byKey?.id) return byKey.id;
403
+ let createError = null;
404
+ try {
405
+ const created = await this.createVocabulary(vocabulary, actor);
406
+ if (created?.id) return created.id;
407
+ } catch (error) {
408
+ createError = error;
409
+ }
410
+ const afterCreate = await this.getVocabularyByKey(vocabulary.key, actor);
411
+ if (afterCreate?.id) return afterCreate.id;
412
+ if (createError) throw createError;
413
+ throw new EntityTagsError("UPSTREAM_ERROR", `Failed to resolve tag vocabulary "${vocabulary.key}"`, { vocabularyKey: vocabulary.key });
414
+ }
415
+ async getVocabularyById(id, actor) {
416
+ return (await this.request(`query GetVocabulary($id: ID!) { getVocabulary(id: $id) { id key name } }`, { id }, actor)).getVocabulary ?? null;
417
+ }
418
+ async getVocabularyByKey(key, actor) {
419
+ return (await this.request(`query GetVocabularyByKey($key: String!) { getVocabularyByKey(key: $key) { id key name } }`, { key }, actor)).getVocabularyByKey ?? null;
420
+ }
421
+ /** Create a WORKSPACE-scoped, multi-valued, open (custom tags allowed) string vocabulary. */
422
+ async createVocabulary(vocabulary, actor) {
423
+ return (await this.request(`mutation CreateVocabulary($input: CreateVocabularyInput!) {
424
+ createVocabulary(input: $input) { id key name }
425
+ }`, { input: {
426
+ key: requireNonEmpty(vocabulary.key, "vocabulary.key"),
427
+ name: requireNonEmpty(vocabulary.name, "vocabulary.name"),
428
+ description: vocabulary.description,
429
+ scope: "WORKSPACE",
430
+ dataType: "STRING",
431
+ cardinality: "MULTIPLE",
432
+ allowCustomTags: true
433
+ } }, actor)).createVocabulary ?? null;
434
+ }
435
+ requireActor(actor) {
436
+ if (!actor.actorId?.trim() || !actor.workspaceId?.trim()) throw new EntityTagsError("MISSING_CONTEXT", "Tag operations need an authenticated actor and a workspace");
437
+ return actor;
438
+ }
439
+ getClient() {
440
+ if (!this.clientPromise) {
441
+ const option = this.clientOption;
442
+ this.clientPromise = (async () => {
443
+ if (typeof option === "function") return option();
444
+ if (option) return option;
445
+ const gateway = await import("./client-sAJTrb4i.js").then((n) => n.n);
446
+ if (this.serviceName) return new gateway.GatewayClient({
447
+ layer: "wspace",
448
+ serviceName: this.serviceName,
449
+ serviceIdentity: this.serviceName
450
+ });
451
+ return gateway.createGatewayClientFromEnv();
452
+ })();
453
+ this.clientPromise.catch(() => {
454
+ this.clientPromise = null;
455
+ });
456
+ }
457
+ return this.clientPromise;
458
+ }
459
+ async request(query, variables, actor) {
460
+ const { actorId, workspaceId, actorType } = this.requireActor(actor);
461
+ const response = await (await this.getClient()).internalQuery({
462
+ query,
463
+ variables,
464
+ timeout: this.requestTimeoutMs,
465
+ headers: {
466
+ "x-actor-id": actorId,
467
+ "x-actor-type": actorType || "user",
468
+ "x-workspace-id": workspaceId
469
+ }
470
+ });
471
+ if (response.errors?.length) throw new EntityTagsError("UPSTREAM_ERROR", `wspace-tags-svc error: ${response.errors.map((error) => error.message).join("; ")}`, { errors: response.errors });
472
+ if (!response.data) throw new EntityTagsError("UPSTREAM_ERROR", "wspace-tags-svc returned no data");
473
+ return response.data;
474
+ }
475
+ };
476
+
477
+ // src/tags/sdl.ts
478
+ /**
479
+ * Entity tags — SDL generator.
480
+ *
481
+ * One fixed SDL fragment cannot be shared: two subgraphs declaring the same
482
+ * non-`@shareable` value type (`EntityTagAssignment`, `AvailableTag`, …) fail
483
+ * Federation composition. {@link buildEntityTagsSdl} therefore emits the whole
484
+ * tag surface under a per-service prefix (names from `./naming.ts`), with a
485
+ * static `@rbac` directive on every root field — the gateway enforces RBAC from
486
+ * the composed supergraph and needs a literal action/resource per field.
487
+ *
488
+ * The SDL references `@rbac`, `JSON`, `DateTime` and the federated
489
+ * `UniversalTag` entity, which the host subgraph already declares (pass
490
+ * `includeUniversalTagStub: true` if it does not declare `UniversalTag` yet).
491
+ */
492
+ const TYPE_NAME_PATTERN = /^[A-Z]\w*$/;
493
+ const RBAC_TOKEN_PATTERN = /^[a-z0-9][a-z0-9:_-]*$/i;
494
+ /** Non-resolvable stub for the tags-svc-owned `UniversalTag` entity. */
495
+ const UNIVERSAL_TAG_STUB_SDL = `
496
+ "UniversalTag is owned by wspace-tags-svc; only its key is resolvable here."
497
+ type UniversalTag @key(fields: "id", resolvable: false) {
498
+ id: ID!
499
+ }
500
+ `;
501
+ function rbacToken(value, field) {
502
+ if (!RBAC_TOKEN_PATTERN.test(value)) throw new EntityTagsError("CONFIGURATION_ERROR", `Entity tags rbac.${field} "${value}" is not a valid RBAC token`, {
503
+ field,
504
+ value
505
+ });
506
+ return value;
507
+ }
508
+ function rbacDirective(action, resource, scopeType) {
509
+ return `@rbac(action: "${action}", resource: "${resource}", scopeType: "${scopeType}")`;
510
+ }
511
+ function sanitizeDescription(value) {
512
+ return value.replace(/["\\]/g, "'").replace(/\s+/g, " ").trim();
513
+ }
514
+ function buildEntityTagsSdl(options) {
515
+ const fields = entityTagsFieldNames(options.prefix);
516
+ const types = entityTagsTypeNames(options.prefix, options.typeNames);
517
+ const external = new Set(options.externalTypes ?? []);
518
+ const label = sanitizeDescription(options.productLabel ?? options.prefix);
519
+ const resource = rbacToken(options.rbac.resource, "resource");
520
+ const scopeType = rbacToken(options.rbac.scopeType ?? "wspace", "scopeType");
521
+ const read = rbacDirective(rbacToken(options.rbac.readAction ?? "read", "readAction"), resource, scopeType);
522
+ const update = rbacDirective(rbacToken(options.rbac.updateAction ?? "update", "updateAction"), resource, scopeType);
523
+ const create = rbacDirective(rbacToken(options.rbac.createAction ?? "create", "createAction"), resource, scopeType);
524
+ const extendTypes = [...new Set(options.extendTypes ?? [])];
525
+ for (const typeName of extendTypes) if (!TYPE_NAME_PATTERN.test(typeName)) throw new EntityTagsError("CONFIGURATION_ERROR", `Cannot extend "${typeName}": not a valid type name`, { typeName });
526
+ const blocks = [];
527
+ const emitType = (role, sdl) => {
528
+ if (!external.has(role)) blocks.push(sdl);
529
+ };
530
+ if (options.includeUniversalTagStub) blocks.push(UNIVERSAL_TAG_STUB_SDL.trim());
531
+ emitType("getEntityTagsInput", `input ${types.getEntityTagsInput} {
532
+ entityType: String!
533
+ entityId: ID!
534
+ }`);
535
+ emitType("tagEntityInput", `input ${types.tagEntityInput} {
536
+ entityType: String!
537
+ entityId: ID!
538
+ tagId: ID!
539
+ "AssignmentSource (MANUAL, AUTOMATIC, IMPORTED, ...). Defaults to the service default."
540
+ source: String
541
+ metadata: JSON
542
+ }`);
543
+ emitType("untagEntityInput", `input ${types.untagEntityInput} {
544
+ entityType: String!
545
+ entityId: ID!
546
+ tagId: ID!
547
+ }`);
548
+ emitType("replaceEntityTagsInput", `input ${types.replaceEntityTagsInput} {
549
+ entityType: String!
550
+ entityId: ID!
551
+ tagIds: [ID!]!
552
+ }`);
553
+ emitType("createTagInput", `input ${types.createTagInput} {
554
+ "Optional. When omitted the tag goes to the workspace's default ${label} vocabulary (created on first use)."
555
+ vocabularyId: ID
556
+ label: String!
557
+ color: String
558
+ }`);
559
+ emitType("tagInfo", `"Inline (non-federated) tag projection, so clients render labels without a federated round-trip."
560
+ type ${types.tagInfo} {
561
+ id: ID!
562
+ key: String
563
+ label: String
564
+ color: String
565
+ }`);
566
+ emitType("tagAssignment", `"A tag assigned to a ${label} entity."
567
+ type ${types.tagAssignment} {
568
+ id: ID!
569
+ tagId: ID!
570
+ "Federated UniversalTag reference (owned by wspace-tags-svc). Prefer tagInfo for label/colour."
571
+ tag: UniversalTag
572
+ "Inline projection of the tag (key/label/colour)."
573
+ tagInfo: ${types.tagInfo}
574
+ entityType: String!
575
+ entityId: ID!
576
+ source: String!
577
+ assignedBy: ID
578
+ assignedAt: DateTime
579
+ validFrom: DateTime
580
+ validTo: DateTime
581
+ metadata: JSON
582
+ }`);
583
+ emitType("availableTag", `"An assignable workspace tag."
584
+ type ${types.availableTag} {
585
+ id: ID!
586
+ key: String!
587
+ label: String!
588
+ color: String
589
+ }`);
590
+ if (options.includeEntitiesByTags) {
591
+ emitType("entitiesByTagsInput", `input ${types.entitiesByTagsInput} {
592
+ entityType: String!
593
+ tagIds: [ID!]!
594
+ "true = entity must carry every tag; false (default) = any of them."
595
+ matchAll: Boolean
596
+ limit: Int
597
+ cursor: String
598
+ }`);
599
+ emitType("taggedEntityPage", `"Ids of entities carrying the requested tags."
600
+ type ${types.taggedEntityPage} {
601
+ entityIds: [ID!]!
602
+ total: Int!
603
+ hasMore: Boolean!
604
+ nextCursor: String
605
+ }`);
606
+ }
607
+ const queryFields = [
608
+ ` "Tags currently assigned to a ${label} entity"
609
+ ${fields.entityTags}(input: ${types.getEntityTagsInput}!): [${types.tagAssignment}!]! ${read}`,
610
+ ` "Search assignable tags in the workspace"
611
+ ${fields.searchTags}(query: String!, limit: Int): [${types.availableTag}!]! ${read}`,
612
+ ` "List assignable tags in the workspace"
613
+ ${fields.availableTags}(limit: Int): [${types.availableTag}!]! ${read}`
614
+ ];
615
+ if (options.includeEntitiesByTags) queryFields.push(` "Ids of ${label} entities carrying the given tags (filter-by-tag)"
616
+ ${fields.entitiesByTags}(input: ${types.entitiesByTagsInput}!): ${types.taggedEntityPage}! ${read}`);
617
+ blocks.push(`extend type Query {\n${queryFields.join("\n\n")}\n}`);
618
+ blocks.push(`extend type Mutation {
619
+ "Assign a tag to a ${label} entity"
620
+ ${fields.tagEntity}(input: ${types.tagEntityInput}!): ${types.tagAssignment}! ${update}
621
+
622
+ "Remove a tag from a ${label} entity"
623
+ ${fields.untagEntity}(input: ${types.untagEntityInput}!): Boolean! ${update}
624
+
625
+ "Replace the full tag set on a ${label} entity"
626
+ ${fields.replaceEntityTags}(input: ${types.replaceEntityTagsInput}!): [${types.tagAssignment}!]! ${update}
627
+
628
+ "Create a new assignable tag (inline creation from a picker)"
629
+ ${fields.createTag}(input: ${types.createTagInput}!): ${types.availableTag}! ${create}
630
+ }`);
631
+ for (const typeName of extendTypes) blocks.push(`extend type ${typeName} {
632
+ "Structured tag assignments (wspace-tags-svc)."
633
+ tagAssignments: [${types.tagAssignment}!]!
634
+ }`);
635
+ return `${blocks.join("\n\n")}\n`;
636
+ }
637
+
638
+ // src/tags/resolvers.ts
639
+ /**
640
+ * Entity tags — resolver factory.
641
+ *
642
+ * Builds the Query / Mutation / `tagAssignments` resolvers that match the SDL
643
+ * from {@link buildEntityTagsSdl} for the same `prefix` (both derive names from
644
+ * `./naming.ts`). The service supplies only what differs: how to read the actor
645
+ * off its context, which GraphQL types map to which entity types, how to map
646
+ * errors onto its i18n errors, and optional ownership/audit hooks.
647
+ *
648
+ * @example
649
+ * ```ts
650
+ * import { buildEntityTagsSdl, createEntityTagResolvers } from '@burdenoff/be-sdk/tags';
651
+ *
652
+ * const { Query, Mutation, types } = createEntityTagResolvers({
653
+ * prefix: 'Fluidgrids',
654
+ * adapter: entityTags,
655
+ * entities: {
656
+ * WorkflowDefinition: { entityType: 'FLUIDGRIDS_WORKFLOW', entityId: (p) => String(p.workflowKey ?? '') },
657
+ * WorkflowRun: { entityType: 'FLUIDGRIDS_RUN' },
658
+ * },
659
+ * mapError: (error, ctx) => workflowError(`tags.errors.${error.code}`, error.graphqlCode, ctx, error.details),
660
+ * });
661
+ * ```
662
+ */
663
+ function readRecord(value, key) {
664
+ if (value === null || typeof value !== "object") return void 0;
665
+ return value[key];
666
+ }
667
+ function readString(value) {
668
+ return typeof value === "string" ? value : "";
669
+ }
670
+ function toActorType(value) {
671
+ return TAG_ACTOR_TYPES.find((candidate) => candidate === value) ?? "user";
672
+ }
673
+ /** Default actor reader for the be-sdk server context shape. */
674
+ function defaultTagActor(context) {
675
+ const actor = readRecord(context, "actor");
676
+ const workspace = readRecord(context, "workspace");
677
+ return {
678
+ actorId: readString(readRecord(actor, "id")) || readString(readRecord(context, "actorId")),
679
+ actorType: toActorType(readRecord(actor, "type") ?? readRecord(context, "actorType")),
680
+ workspaceId: readString(readRecord(workspace, "id")) || readString(readRecord(context, "workspaceId"))
681
+ };
682
+ }
683
+ function defaultMapError(error) {
684
+ if (error.code === "UPSTREAM_ERROR" || error.code === "CONFIGURATION_ERROR") {
685
+ logger.error("[be-sdk/tags] Tag operation failed", {
686
+ code: error.code,
687
+ message: error.message
688
+ });
689
+ return new GraphQLError("Tag operation failed", { extensions: { code: error.graphqlCode } });
690
+ }
691
+ return new GraphQLError(error.message, { extensions: {
692
+ code: error.graphqlCode,
693
+ reason: error.code
694
+ } });
695
+ }
696
+ function createEntityTagResolvers(options) {
697
+ const { adapter } = options;
698
+ const fields = entityTagsFieldNames(options.prefix);
699
+ const getActor = options.getActor ?? ((context) => defaultTagActor(context));
700
+ const mapError = options.mapError ?? ((error) => defaultMapError(error));
701
+ for (const [typeName, binding] of Object.entries(options.entities ?? {})) if (!adapter.isValidEntityType(binding.entityType)) throw new EntityTagsError("CONFIGURATION_ERROR", `${typeName} is bound to entity type "${binding.entityType}", which the adapter does not register`, {
702
+ typeName,
703
+ entityType: binding.entityType
704
+ });
705
+ const guard = async (context, run) => {
706
+ try {
707
+ return await run();
708
+ } catch (error) {
709
+ if (isEntityTagsError(error)) throw mapError(error, context);
710
+ throw error;
711
+ }
712
+ };
713
+ const authorize = async (input, access, actor, context) => {
714
+ adapter.assertEntityType(input.entityType);
715
+ if (!input.entityId?.trim()) throw new EntityTagsError("INVALID_INPUT", "entityId is required", { field: "entityId" });
716
+ if (options.authorizeEntity) await options.authorizeEntity({
717
+ entityType: input.entityType,
718
+ entityId: input.entityId,
719
+ access,
720
+ actor
721
+ }, context);
722
+ };
723
+ const notify = async (event, context) => {
724
+ if (!options.onMutation) return;
725
+ try {
726
+ await options.onMutation(event, context);
727
+ } catch (error) {
728
+ logger.warn("[be-sdk/tags] onMutation hook failed", {
729
+ fieldName: event.fieldName,
730
+ error: error instanceof Error ? error.message : String(error)
731
+ });
732
+ }
733
+ };
734
+ const Query = {};
735
+ const Mutation = {};
736
+ const entityTags = (_parent, { input }, context) => guard(context, async () => {
737
+ const actor = getActor(context);
738
+ await authorize(input, "read", actor, context);
739
+ return adapter.getEntityTags(input.entityType, input.entityId, actor);
740
+ });
741
+ Query[fields.entityTags] = entityTags;
742
+ const searchTags = (_parent, { query, limit }, context) => guard(context, () => adapter.searchTags(query, getActor(context), limit));
743
+ Query[fields.searchTags] = searchTags;
744
+ const availableTags = (_parent, { limit }, context) => guard(context, () => adapter.getAvailableTags(getActor(context), limit));
745
+ Query[fields.availableTags] = availableTags;
746
+ if (options.includeEntitiesByTags) {
747
+ const entitiesByTags = (_parent, { input }, context) => guard(context, () => adapter.findEntityIdsByTags(input.entityType, input.tagIds, getActor(context), {
748
+ matchAll: input.matchAll ?? false,
749
+ limit: input.limit,
750
+ cursor: input.cursor
751
+ }));
752
+ Query[fields.entitiesByTags] = entitiesByTags;
753
+ }
754
+ const tagEntity = (_parent, { input }, context) => guard(context, async () => {
755
+ const actor = getActor(context);
756
+ await authorize(input, "write", actor, context);
757
+ const assignment = await adapter.tagEntity(input.entityType, input.entityId, {
758
+ tagId: input.tagId,
759
+ source: input.source,
760
+ metadata: input.metadata
761
+ }, actor);
762
+ await notify({
763
+ operation: "tag",
764
+ fieldName: fields.tagEntity,
765
+ actor,
766
+ entityType: input.entityType,
767
+ entityId: input.entityId,
768
+ tagId: input.tagId,
769
+ source: assignment.source
770
+ }, context);
771
+ return assignment;
772
+ });
773
+ Mutation[fields.tagEntity] = tagEntity;
774
+ const untagEntity = (_parent, { input }, context) => guard(context, async () => {
775
+ const actor = getActor(context);
776
+ await authorize(input, "write", actor, context);
777
+ const removed = await adapter.untagEntity(input.entityType, input.entityId, input.tagId, actor);
778
+ if (removed) await notify({
779
+ operation: "untag",
780
+ fieldName: fields.untagEntity,
781
+ actor,
782
+ entityType: input.entityType,
783
+ entityId: input.entityId,
784
+ tagId: input.tagId
785
+ }, context);
786
+ return removed;
787
+ });
788
+ Mutation[fields.untagEntity] = untagEntity;
789
+ const replaceEntityTags = (_parent, { input }, context) => guard(context, async () => {
790
+ const actor = getActor(context);
791
+ await authorize(input, "write", actor, context);
792
+ const assignments = await adapter.replaceEntityTags(input.entityType, input.entityId, input.tagIds, actor);
793
+ await notify({
794
+ operation: "replace",
795
+ fieldName: fields.replaceEntityTags,
796
+ actor,
797
+ entityType: input.entityType,
798
+ entityId: input.entityId,
799
+ tagIds: [...new Set(input.tagIds)]
800
+ }, context);
801
+ return assignments;
802
+ });
803
+ Mutation[fields.replaceEntityTags] = replaceEntityTags;
804
+ const createTag = (_parent, { input }, context) => guard(context, async () => {
805
+ const actor = getActor(context);
806
+ const vocabularyId = input.vocabularyId !== void 0 && input.vocabularyId !== null ? input.vocabularyId : await adapter.ensureWorkspaceVocabulary(actor);
807
+ const tag = await adapter.createTag({
808
+ label: input.label,
809
+ color: input.color,
810
+ vocabularyId
811
+ }, actor);
812
+ await notify({
813
+ operation: "createTag",
814
+ fieldName: fields.createTag,
815
+ actor,
816
+ tag,
817
+ vocabularyId
818
+ }, context);
819
+ return tag;
820
+ });
821
+ Mutation[fields.createTag] = createTag;
822
+ const types = {};
823
+ for (const [typeName, binding] of Object.entries(options.entities ?? {})) {
824
+ const selectId = binding.entityId ?? ((parent) => readString(parent["id"]));
825
+ types[typeName] = { tagAssignments: async (parent, _args, context) => {
826
+ const entityId = selectId(parent);
827
+ if (!entityId) return [];
828
+ try {
829
+ return await adapter.getEntityTags(binding.entityType, entityId, getActor(context));
830
+ } catch (error) {
831
+ logger.warn("[be-sdk/tags] Failed to resolve tagAssignments", {
832
+ typeName,
833
+ entityType: binding.entityType,
834
+ entityId,
835
+ error: error instanceof Error ? error.message : String(error)
836
+ });
837
+ return [];
838
+ }
839
+ } };
840
+ }
841
+ return {
842
+ Query,
843
+ Mutation,
844
+ types
845
+ };
846
+ }
847
+
848
+ // src/tags/index.ts
849
+ var tags_exports = /* @__PURE__ */ __exportAll({
850
+ ENTITY_TAGS_GRAPHQL_CODES: () => ENTITY_TAGS_GRAPHQL_CODES,
851
+ EntityTagsError: () => EntityTagsError,
852
+ TAG_ACTOR_TYPES: () => TAG_ACTOR_TYPES,
853
+ TAG_ASSIGNMENT_SOURCES: () => TAG_ASSIGNMENT_SOURCES,
854
+ TagsGatewayAdapter: () => TagsGatewayAdapter,
855
+ UNIVERSAL_TAG_STUB_SDL: () => UNIVERSAL_TAG_STUB_SDL,
856
+ assertTagPrefix: () => assertTagPrefix,
857
+ buildEntityTagsSdl: () => buildEntityTagsSdl,
858
+ createEntityTagResolvers: () => createEntityTagResolvers,
859
+ defaultTagActor: () => defaultTagActor,
860
+ entityTagsFieldNames: () => entityTagsFieldNames,
861
+ entityTagsTypeNames: () => entityTagsTypeNames,
862
+ isEntityTagsError: () => isEntityTagsError,
863
+ mapTagAssignment: () => mapTagAssignment,
864
+ slugifyTagKey: () => slugifyTagKey
865
+ });
866
+
867
+ export { buildEntityTagsSdl as a, slugifyTagKey as c, entityTagsTypeNames as d, ENTITY_TAGS_GRAPHQL_CODES as f, TAG_ASSIGNMENT_SOURCES as g, TAG_ACTOR_TYPES as h, UNIVERSAL_TAG_STUB_SDL as i, assertTagPrefix as l, isEntityTagsError as m, createEntityTagResolvers as n, TagsGatewayAdapter as o, EntityTagsError as p, defaultTagActor as r, mapTagAssignment as s, tags_exports as t, entityTagsFieldNames as u };
868
+ //# sourceMappingURL=tags-CbijgoqR.js.map