@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.
Files changed (469) 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/ai-credits/index.d.ts +2 -3
  8. package/dist/ai-credits/index.js +3 -4
  9. package/dist/ai-credits/index.js.map +1 -1
  10. package/dist/ai-credits-Ca-NNcVx.js +546 -0
  11. package/dist/ai-credits-Ca-NNcVx.js.map +1 -0
  12. package/dist/{assistant-session-CJZhF4D6.d.ts → assistant-session-DA5ZKJOr.d.ts} +4 -5
  13. package/dist/auth/index.d.ts +2 -77
  14. package/dist/auth/index.js +3 -7
  15. package/dist/auth/index.js.map +1 -1
  16. package/dist/auth-CEuBEBQN.js +228 -0
  17. package/dist/auth-CEuBEBQN.js.map +1 -0
  18. package/dist/cache/index.d.ts +2 -3
  19. package/dist/cache/index.js +3 -7
  20. package/dist/cache/index.js.map +1 -1
  21. package/dist/cache-CU0uLwcS.js +1837 -0
  22. package/dist/cache-CU0uLwcS.js.map +1 -0
  23. package/dist/captcha/index.d.ts +2 -1
  24. package/dist/captcha/index.js +3 -3
  25. package/dist/captcha/index.js.map +1 -1
  26. package/dist/captcha-BT7yh1YS.js +77 -0
  27. package/dist/captcha-BT7yh1YS.js.map +1 -0
  28. package/dist/client/internal-client.d.ts +4 -7
  29. package/dist/client/internal-client.js +172 -4
  30. package/dist/client/internal-client.js.map +1 -1
  31. package/dist/client-BgAEvDC2.d.ts +86 -0
  32. package/dist/client-DcZ3iGES.js +565 -0
  33. package/dist/client-DcZ3iGES.js.map +1 -0
  34. package/dist/collector-endpoint-iyQYeI50.js +50 -0
  35. package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
  36. package/dist/context-CZnXf2yb.js +247 -0
  37. package/dist/context-CZnXf2yb.js.map +1 -0
  38. package/dist/crypto/index.d.ts +2 -1
  39. package/dist/crypto/index.js +3 -3
  40. package/dist/crypto/index.js.map +1 -1
  41. package/dist/crypto-DO9fM0FO.js +145 -0
  42. package/dist/crypto-DO9fM0FO.js.map +1 -0
  43. package/dist/database/index.d.ts +104 -108
  44. package/dist/database/index.js +468 -6
  45. package/dist/database/index.js.map +1 -1
  46. package/dist/dataloader/index.d.ts +2 -1
  47. package/dist/dataloader/index.js +3 -3
  48. package/dist/dataloader/index.js.map +1 -1
  49. package/dist/dataloader-DwpT3YoS.js +294 -0
  50. package/dist/dataloader-DwpT3YoS.js.map +1 -0
  51. package/dist/deployed-environment-p_Tdl3sT.js +38 -0
  52. package/dist/deployed-environment-p_Tdl3sT.js.map +1 -0
  53. package/dist/dist-BGKdXVy3.js +1718 -0
  54. package/dist/dist-BGKdXVy3.js.map +1 -0
  55. package/dist/env-DdaoGjIt.js +74 -0
  56. package/dist/env-DdaoGjIt.js.map +1 -0
  57. package/dist/event-queue/index.d.ts +2 -7
  58. package/dist/event-queue/index.js +7 -9
  59. package/dist/event-queue/index.js.map +1 -1
  60. package/dist/event-queue-Cw-YJPY_.js +1384 -0
  61. package/dist/event-queue-Cw-YJPY_.js.map +1 -0
  62. package/dist/{explicit-activity-scope-CCoxVwAr.d.ts → explicit-activity-scope-D8VeGGpt.d.ts} +1 -2
  63. package/dist/export/index.d.ts +2 -2
  64. package/dist/export/index.js +3 -14
  65. package/dist/export/index.js.map +1 -1
  66. package/dist/export-B6fphx8a.js +642 -0
  67. package/dist/export-B6fphx8a.js.map +1 -0
  68. package/dist/feature-flags/index.d.ts +2 -10
  69. package/dist/feature-flags/index.js +3 -6
  70. package/dist/feature-flags/index.js.map +1 -1
  71. package/dist/feature-flags-71oDkrUe.js +422 -0
  72. package/dist/feature-flags-71oDkrUe.js.map +1 -0
  73. package/dist/files/index.d.ts +2 -3
  74. package/dist/files/index.js +3 -4
  75. package/dist/files/index.js.map +1 -1
  76. package/dist/files-DjH0099H.js +830 -0
  77. package/dist/files-DjH0099H.js.map +1 -0
  78. package/dist/gateway/index.d.ts +4 -6
  79. package/dist/gateway/index.js +7 -13
  80. package/dist/gateway/index.js.map +1 -1
  81. package/dist/gateway/security/index.d.ts +2 -2
  82. package/dist/gateway/security/index.js +3 -5
  83. package/dist/gateway/security/index.js.map +1 -1
  84. package/dist/gateway-DBFmxWks.js +50 -0
  85. package/dist/gateway-DBFmxWks.js.map +1 -0
  86. package/dist/graph/index.d.ts +3 -10
  87. package/dist/graph/index.js +4 -13
  88. package/dist/graph/index.js.map +1 -1
  89. package/dist/graph-DDYgIryR.js +2152 -0
  90. package/dist/graph-DDYgIryR.js.map +1 -0
  91. package/dist/graph-emitter-CdOXP7Tn.js +621 -0
  92. package/dist/graph-emitter-CdOXP7Tn.js.map +1 -0
  93. package/dist/graphql/index.d.ts +3 -2
  94. package/dist/graphql/index.js +4 -6
  95. package/dist/graphql/index.js.map +1 -1
  96. package/dist/graphql/services/index.d.ts +2 -24
  97. package/dist/graphql/services/index.js +3 -4
  98. package/dist/graphql/services/index.js.map +1 -1
  99. package/dist/graphql-DHAHHcww.js +161 -0
  100. package/dist/graphql-DHAHHcww.js.map +1 -0
  101. package/dist/graphql-DNkMkGBZ.d.ts +21 -0
  102. package/dist/i18n/index.d.ts +3 -3
  103. package/dist/i18n/index.js +3 -4
  104. package/dist/i18n/index.js.map +1 -1
  105. package/dist/i18n-BBMYFd0P.js +860 -0
  106. package/dist/i18n-BBMYFd0P.js.map +1 -0
  107. package/dist/import-optional-peer-B82VYxeX.js +18 -0
  108. package/dist/import-optional-peer-B82VYxeX.js.map +1 -0
  109. package/dist/index-3KOZ1zN9.d.ts +233 -0
  110. package/dist/index-BBqooJ52.d.ts +45 -0
  111. package/dist/index-BGzMYJsm.d.ts +209 -0
  112. package/dist/index-BKwHQtHQ.d.ts +63 -0
  113. package/dist/index-BMIMnp6T.d.ts +8 -0
  114. package/dist/index-BQDsNAMR.d.ts +81 -0
  115. package/dist/index-BVOL7458.d.ts +10 -0
  116. package/dist/index-BcqQs-Uq.d.ts +69 -0
  117. package/dist/index-BeVtqGO-.d.ts +208 -0
  118. package/dist/index-BiTzGUZP.d.ts +114 -0
  119. package/dist/index-BqYfCQSP.d.ts +500 -0
  120. package/dist/index-C0qLquY0.d.ts +150 -0
  121. package/dist/index-C5uEKchX.d.ts +60 -0
  122. package/dist/index-CDOqxSIi.d.ts +37 -0
  123. package/dist/index-CG6wj66Y.d.ts +148 -0
  124. package/dist/index-CIgoeobA.d.ts +145 -0
  125. package/dist/index-CPQDMSFS.d.ts +103 -0
  126. package/dist/index-CSRcgkVi.d.ts +23 -0
  127. package/dist/index-CZTnQIRU.d.ts +341 -0
  128. package/dist/index-CaM9JUcc.d.ts +144 -0
  129. package/dist/index-CkT2aUr3.d.ts +704 -0
  130. package/dist/index-CliOgq6L.d.ts +203 -0
  131. package/dist/index-CnzbJZP7.d.ts +999 -0
  132. package/dist/index-D6UeLAye.d.ts +63 -0
  133. package/dist/index-DGgh9DWn.d.ts +59 -0
  134. package/dist/index-DY3dNhMN.d.ts +420 -0
  135. package/dist/index-DZC-2o9R.d.ts +207 -0
  136. package/dist/index-DqbGqfAy.d.ts +127 -0
  137. package/dist/index-Dt1HJPTX.d.ts +12 -0
  138. package/dist/index-DtI6aBtB.d.ts +22 -0
  139. package/dist/index-FKohsiex.d.ts +38 -0
  140. package/dist/index-FbXPfen7.d.ts +132 -0
  141. package/dist/index-MArCb8Aq.d.ts +306 -0
  142. package/dist/index-N-huORcj.d.ts +303 -0
  143. package/dist/index-YOShAwkq.d.ts +45 -0
  144. package/dist/index-bZKZUvBu.d.ts +646 -0
  145. package/dist/index-yBSjMY32.d.ts +24 -0
  146. package/dist/index.d.ts +501 -544
  147. package/dist/index.js +1820 -2171
  148. package/dist/index.js.map +1 -1
  149. package/dist/init/index.d.ts +2 -2
  150. package/dist/init/index.js +3 -16
  151. package/dist/init/index.js.map +1 -1
  152. package/dist/init-Dy3KhT6Y.js +325 -0
  153. package/dist/init-Dy3KhT6Y.js.map +1 -0
  154. package/dist/instrumentation/index.d.ts +3 -4
  155. package/dist/instrumentation/index.js +5 -5
  156. package/dist/instrumentation/index.js.map +1 -1
  157. package/dist/instrumentation-xkkmDgJ0.js +1678 -0
  158. package/dist/instrumentation-xkkmDgJ0.js.map +1 -0
  159. package/dist/lake/index.d.ts +50 -54
  160. package/dist/lake/index.js +169 -193
  161. package/dist/lake/index.js.map +1 -1
  162. package/dist/layer/index.d.ts +3 -2
  163. package/dist/layer/index.js +4 -5
  164. package/dist/layer/index.js.map +1 -1
  165. package/dist/layer-BZBZZWeV.d.ts +69 -0
  166. package/dist/layer-Bcix-WCl.js +105 -0
  167. package/dist/layer-Bcix-WCl.js.map +1 -0
  168. package/dist/layer-CEKy6cm8.js +252 -0
  169. package/dist/layer-CEKy6cm8.js.map +1 -0
  170. package/dist/lifecycle/index.d.ts +2 -1
  171. package/dist/lifecycle/index.js +3 -4
  172. package/dist/lifecycle/index.js.map +1 -1
  173. package/dist/lifecycle-DeoLSX0U.js +76 -0
  174. package/dist/lifecycle-DeoLSX0U.js.map +1 -0
  175. package/dist/logger/index.d.ts +2 -3
  176. package/dist/logger/index.js +3 -3
  177. package/dist/logger/index.js.map +1 -1
  178. package/dist/logger-B6rCpb7D.js +290 -0
  179. package/dist/logger-B6rCpb7D.js.map +1 -0
  180. package/dist/metrics/index.d.ts +13 -14
  181. package/dist/metrics/index.js +3 -4
  182. package/dist/metrics/index.js.map +1 -1
  183. package/dist/metrics-BrLwNUrb.js +52 -0
  184. package/dist/metrics-BrLwNUrb.js.map +1 -0
  185. package/dist/metrics-collector-C2eShrlW.js +922 -0
  186. package/dist/metrics-collector-C2eShrlW.js.map +1 -0
  187. package/dist/middleware/index.d.ts +3 -3
  188. package/dist/middleware/index.js +3 -4
  189. package/dist/middleware/index.js.map +1 -1
  190. package/dist/middleware-CUxJVUpD.js +1243 -0
  191. package/dist/middleware-CUxJVUpD.js.map +1 -0
  192. package/dist/middleware-Cq0zFMGp.js +253 -0
  193. package/dist/middleware-Cq0zFMGp.js.map +1 -0
  194. package/dist/notifications/index.d.ts +2 -5
  195. package/dist/notifications/index.js +3 -6
  196. package/dist/notifications/index.js.map +1 -1
  197. package/dist/notifications-CdETrtFK.js +869 -0
  198. package/dist/notifications-CdETrtFK.js.map +1 -0
  199. package/dist/observability/index.d.ts +2 -3
  200. package/dist/observability/index.js +3 -4
  201. package/dist/observability/index.js.map +1 -1
  202. package/dist/observability-DBDXipTU.js +272 -0
  203. package/dist/observability-DBDXipTU.js.map +1 -0
  204. package/dist/platform/index.d.ts +2 -1
  205. package/dist/platform/index.js +3 -5
  206. package/dist/platform/index.js.map +1 -1
  207. package/dist/platform-DZwczW7v.js +1510 -0
  208. package/dist/platform-DZwczW7v.js.map +1 -0
  209. package/dist/prisma/generator/index.d.ts +1 -1
  210. package/dist/prisma/generator/index.js +97 -84
  211. package/dist/prisma/generator/index.js.map +1 -1
  212. package/dist/prisma/index.d.ts +4 -7
  213. package/dist/prisma/index.js +5 -12
  214. package/dist/prisma/index.js.map +1 -1
  215. package/dist/prisma-BzOOdt79.js +863 -0
  216. package/dist/prisma-BzOOdt79.js.map +1 -0
  217. package/dist/prisma-extension-Cfl09swM.d.ts +172 -0
  218. package/dist/product-alias/index.d.ts +2 -1
  219. package/dist/product-alias/index.js +3 -3
  220. package/dist/product-alias/index.js.map +1 -1
  221. package/dist/product-alias-BPqtskMq.js +273 -0
  222. package/dist/product-alias-BPqtskMq.js.map +1 -0
  223. package/dist/rbac/index.d.ts +2 -122
  224. package/dist/rbac/index.js +3 -6
  225. package/dist/rbac/index.js.map +1 -1
  226. package/dist/rbac-BB9l9Xph.js +1486 -0
  227. package/dist/rbac-BB9l9Xph.js.map +1 -0
  228. package/dist/resource-caps/index.d.ts +66 -72
  229. package/dist/resource-caps/index.js +430 -5
  230. package/dist/resource-caps/index.js.map +1 -1
  231. package/dist/rolldown-runtime-ad2WFvuA.js +17 -0
  232. package/dist/sdk-Dju9o-sq.js +124 -0
  233. package/dist/sdk-Dju9o-sq.js.map +1 -0
  234. package/dist/security-DIG-95Ic.js +1647 -0
  235. package/dist/security-DIG-95Ic.js.map +1 -0
  236. package/dist/server/index.d.ts +7 -164
  237. package/dist/server/index.js +2000 -1507
  238. package/dist/server/index.js.map +1 -1
  239. package/dist/service-jwt-Bu-WNA_-.js +80 -0
  240. package/dist/service-jwt-Bu-WNA_-.js.map +1 -0
  241. package/dist/services-BWzfz7vG.js +102 -0
  242. package/dist/services-BWzfz7vG.js.map +1 -0
  243. package/dist/sharding/index.d.ts +41 -44
  244. package/dist/sharding/index.js +156 -137
  245. package/dist/sharding/index.js.map +1 -1
  246. package/dist/sharing/index.d.ts +2 -1
  247. package/dist/sharing/index.js +3 -4
  248. package/dist/sharing/index.js.map +1 -1
  249. package/dist/sharing-CflDsSJ-.js +911 -0
  250. package/dist/sharing-CflDsSJ-.js.map +1 -0
  251. package/dist/stub-BqwKn4eh.js +630 -0
  252. package/dist/stub-BqwKn4eh.js.map +1 -0
  253. package/dist/tags/index.d.ts +2 -3
  254. package/dist/tags/index.js +3 -4
  255. package/dist/tags/index.js.map +1 -1
  256. package/dist/tags-B5xpbgsk.js +868 -0
  257. package/dist/{chunk-PBZFAAOM.js.map → tags-B5xpbgsk.js.map} +1 -1
  258. package/dist/telemetry/index.d.ts +64 -76
  259. package/dist/telemetry/index.js +369 -201
  260. package/dist/telemetry/index.js.map +1 -1
  261. package/dist/temporal/index.d.ts +2 -148
  262. package/dist/temporal/index.js +3 -5
  263. package/dist/temporal/index.js.map +1 -1
  264. package/dist/temporal-B534uYK8.js +706 -0
  265. package/dist/temporal-B534uYK8.js.map +1 -0
  266. package/dist/tracker/index.d.ts +5 -11
  267. package/dist/tracker/index.js +5 -20
  268. package/dist/tracker/index.js.map +1 -1
  269. package/dist/tracker-BQVoEFUo.js +839 -0
  270. package/dist/tracker-BQVoEFUo.js.map +1 -0
  271. package/dist/types-BYMYND1L.js +44 -0
  272. package/dist/types-BYMYND1L.js.map +1 -0
  273. package/dist/types-C6EKaS3V.d.ts +106 -0
  274. package/dist/types-CWybW61E.d.ts +323 -0
  275. package/dist/types-C_yfu3XK.d.ts +34 -0
  276. package/dist/types-Cj2RWXbz.js +90 -0
  277. package/dist/types-Cj2RWXbz.js.map +1 -0
  278. package/dist/types-DgaQqvxo.d.ts +70 -0
  279. package/dist/usage/index.d.ts +2 -213
  280. package/dist/usage/index.js +3 -15
  281. package/dist/usage/index.js.map +1 -1
  282. package/dist/usage-BKFZiWQn.js +682 -0
  283. package/dist/usage-BKFZiWQn.js.map +1 -0
  284. package/dist/utils/index.d.ts +2 -1
  285. package/dist/utils/index.js +3 -3
  286. package/dist/utils/index.js.map +1 -1
  287. package/dist/utils-DL85Tnbn.js +500 -0
  288. package/dist/utils-DL85Tnbn.js.map +1 -0
  289. package/dist/validation/index.d.ts +2 -2
  290. package/dist/validation/index.js +3 -3
  291. package/dist/validation/index.js.map +1 -1
  292. package/dist/validation-CPUITdMk.js +762 -0
  293. package/dist/validation-CPUITdMk.js.map +1 -0
  294. package/dist/workspace-extension-COrC0dYi.js +979 -0
  295. package/dist/workspace-extension-COrC0dYi.js.map +1 -0
  296. package/dist/{workspace-extension-BGwTOV_r.d.ts → workspace-extension-DTFTdGVF.d.ts} +43 -45
  297. package/package.json +7 -10
  298. package/dist/EventQueueFactory-GXC3A7DH.js +0 -8
  299. package/dist/EventQueueFactory-GXC3A7DH.js.map +0 -1
  300. package/dist/chunk-4XIBXZ6J.js +0 -276
  301. package/dist/chunk-4XIBXZ6J.js.map +0 -1
  302. package/dist/chunk-554Z4C2K.js +0 -1006
  303. package/dist/chunk-554Z4C2K.js.map +0 -1
  304. package/dist/chunk-5CAFHK2Z.js +0 -107
  305. package/dist/chunk-5CAFHK2Z.js.map +0 -1
  306. package/dist/chunk-63ZXJ42X.js +0 -451
  307. package/dist/chunk-63ZXJ42X.js.map +0 -1
  308. package/dist/chunk-6XEXJATV.js +0 -304
  309. package/dist/chunk-6XEXJATV.js.map +0 -1
  310. package/dist/chunk-726AR6Q7.js +0 -1532
  311. package/dist/chunk-726AR6Q7.js.map +0 -1
  312. package/dist/chunk-A5F6Z5UE.js +0 -21
  313. package/dist/chunk-A5F6Z5UE.js.map +0 -1
  314. package/dist/chunk-A6DE32ZS.js +0 -1507
  315. package/dist/chunk-A6DE32ZS.js.map +0 -1
  316. package/dist/chunk-AXJDGQPE.js +0 -690
  317. package/dist/chunk-AXJDGQPE.js.map +0 -1
  318. package/dist/chunk-BJQOGOVW.js +0 -602
  319. package/dist/chunk-BJQOGOVW.js.map +0 -1
  320. package/dist/chunk-CFXWH2IS.js +0 -52
  321. package/dist/chunk-CFXWH2IS.js.map +0 -1
  322. package/dist/chunk-DRWH5XCJ.js +0 -876
  323. package/dist/chunk-DRWH5XCJ.js.map +0 -1
  324. package/dist/chunk-E4QNLVY4.js +0 -909
  325. package/dist/chunk-E4QNLVY4.js.map +0 -1
  326. package/dist/chunk-EBDHIL7V.js +0 -774
  327. package/dist/chunk-EBDHIL7V.js.map +0 -1
  328. package/dist/chunk-ELU7VL3E.js +0 -245
  329. package/dist/chunk-ELU7VL3E.js.map +0 -1
  330. package/dist/chunk-FZRODKIN.js +0 -31
  331. package/dist/chunk-FZRODKIN.js.map +0 -1
  332. package/dist/chunk-GCIB76AJ.js +0 -882
  333. package/dist/chunk-GCIB76AJ.js.map +0 -1
  334. package/dist/chunk-HC6MPUIH.js +0 -1571
  335. package/dist/chunk-HC6MPUIH.js.map +0 -1
  336. package/dist/chunk-HNMHPSAM.js +0 -272
  337. package/dist/chunk-HNMHPSAM.js.map +0 -1
  338. package/dist/chunk-HTLEGD3Q.js +0 -1480
  339. package/dist/chunk-HTLEGD3Q.js.map +0 -1
  340. package/dist/chunk-I3KOWRT3.js +0 -89
  341. package/dist/chunk-I3KOWRT3.js.map +0 -1
  342. package/dist/chunk-ID3WR4JS.js +0 -509
  343. package/dist/chunk-ID3WR4JS.js.map +0 -1
  344. package/dist/chunk-JS52ZHTK.js +0 -1346
  345. package/dist/chunk-JS52ZHTK.js.map +0 -1
  346. package/dist/chunk-JVMAQOA3.js +0 -521
  347. package/dist/chunk-JVMAQOA3.js.map +0 -1
  348. package/dist/chunk-KH4TRQCO.js +0 -1063
  349. package/dist/chunk-KH4TRQCO.js.map +0 -1
  350. package/dist/chunk-KJOSPVB2.js +0 -57
  351. package/dist/chunk-KJOSPVB2.js.map +0 -1
  352. package/dist/chunk-KO2ZXZ7W.js +0 -61
  353. package/dist/chunk-KO2ZXZ7W.js.map +0 -1
  354. package/dist/chunk-KS2HQCJR.js +0 -56
  355. package/dist/chunk-KS2HQCJR.js.map +0 -1
  356. package/dist/chunk-LA5KPWZ2.js +0 -413
  357. package/dist/chunk-LA5KPWZ2.js.map +0 -1
  358. package/dist/chunk-MESLAC5W.js +0 -574
  359. package/dist/chunk-MESLAC5W.js.map +0 -1
  360. package/dist/chunk-MWPYA2HD.js +0 -94
  361. package/dist/chunk-MWPYA2HD.js.map +0 -1
  362. package/dist/chunk-NUB5GQTU.js +0 -270
  363. package/dist/chunk-NUB5GQTU.js.map +0 -1
  364. package/dist/chunk-OBBCR6WY.js +0 -277
  365. package/dist/chunk-OBBCR6WY.js.map +0 -1
  366. package/dist/chunk-OQDSAOG3.js +0 -1908
  367. package/dist/chunk-OQDSAOG3.js.map +0 -1
  368. package/dist/chunk-OXNCBE7P.js +0 -971
  369. package/dist/chunk-OXNCBE7P.js.map +0 -1
  370. package/dist/chunk-PBZFAAOM.js +0 -941
  371. package/dist/chunk-PN6GIF3R.js +0 -1185
  372. package/dist/chunk-PN6GIF3R.js.map +0 -1
  373. package/dist/chunk-PYD44IHJ.js +0 -728
  374. package/dist/chunk-PYD44IHJ.js.map +0 -1
  375. package/dist/chunk-QVPIACWD.js +0 -679
  376. package/dist/chunk-QVPIACWD.js.map +0 -1
  377. package/dist/chunk-QWNNFE4P.js +0 -41
  378. package/dist/chunk-QWNNFE4P.js.map +0 -1
  379. package/dist/chunk-RU266375.js +0 -327
  380. package/dist/chunk-RU266375.js.map +0 -1
  381. package/dist/chunk-RYTSVGGA.js +0 -1624
  382. package/dist/chunk-RYTSVGGA.js.map +0 -1
  383. package/dist/chunk-RZOFS2BQ.js +0 -225
  384. package/dist/chunk-RZOFS2BQ.js.map +0 -1
  385. package/dist/chunk-SBS4S2PJ.js +0 -100
  386. package/dist/chunk-SBS4S2PJ.js.map +0 -1
  387. package/dist/chunk-SPRG6G6G.js +0 -530
  388. package/dist/chunk-SPRG6G6G.js.map +0 -1
  389. package/dist/chunk-STWFX5E2.js +0 -233
  390. package/dist/chunk-STWFX5E2.js.map +0 -1
  391. package/dist/chunk-UNASM5VJ.js +0 -419
  392. package/dist/chunk-UNASM5VJ.js.map +0 -1
  393. package/dist/chunk-VAT66FJA.js +0 -245
  394. package/dist/chunk-VAT66FJA.js.map +0 -1
  395. package/dist/chunk-VFCMR5GX.js +0 -49
  396. package/dist/chunk-VFCMR5GX.js.map +0 -1
  397. package/dist/chunk-VGAHZKNJ.js +0 -66
  398. package/dist/chunk-VGAHZKNJ.js.map +0 -1
  399. package/dist/chunk-VTJTAAXC.js +0 -627
  400. package/dist/chunk-VTJTAAXC.js.map +0 -1
  401. package/dist/chunk-VXVLKRU6.js +0 -758
  402. package/dist/chunk-VXVLKRU6.js.map +0 -1
  403. package/dist/chunk-WWUU5ETI.js +0 -163
  404. package/dist/chunk-WWUU5ETI.js.map +0 -1
  405. package/dist/chunk-XE4OXN2W.js +0 -10
  406. package/dist/chunk-XE4OXN2W.js.map +0 -1
  407. package/dist/chunk-XOJORS75.js +0 -1853
  408. package/dist/chunk-XOJORS75.js.map +0 -1
  409. package/dist/chunk-YMZEUTD2.js +0 -110
  410. package/dist/chunk-YMZEUTD2.js.map +0 -1
  411. package/dist/chunk-Z77BTSOK.js +0 -617
  412. package/dist/chunk-Z77BTSOK.js.map +0 -1
  413. package/dist/chunk-ZZK3WEDI.js +0 -181
  414. package/dist/chunk-ZZK3WEDI.js.map +0 -1
  415. package/dist/client-CCXpAZ2r.d.ts +0 -89
  416. package/dist/client-DSI_760t.d.ts +0 -36
  417. package/dist/client-JU6T3UPB.js +0 -11
  418. package/dist/client-JU6T3UPB.js.map +0 -1
  419. package/dist/dist-2X4Q7PJA.js +0 -1491
  420. package/dist/dist-2X4Q7PJA.js.map +0 -1
  421. package/dist/env-4UWSUS64.js +0 -4
  422. package/dist/env-4UWSUS64.js.map +0 -1
  423. package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
  424. package/dist/graphql-CMHMQjvd.d.ts +0 -23
  425. package/dist/i18n-Qm2AkPC-.d.ts +0 -33
  426. package/dist/index--yvpa6ay.d.ts +0 -83
  427. package/dist/index-4gKQKZ2B.d.ts +0 -71
  428. package/dist/index-5x0XMKXN.d.ts +0 -149
  429. package/dist/index-B70b5mYS.d.ts +0 -33
  430. package/dist/index-B8KrxO4j.d.ts +0 -755
  431. package/dist/index-BOuDKnqD.d.ts +0 -201
  432. package/dist/index-BTMt4OjA.d.ts +0 -201
  433. package/dist/index-BejbszA7.d.ts +0 -39
  434. package/dist/index-BkeOYZye.d.ts +0 -198
  435. package/dist/index-BuAj5nXg.d.ts +0 -83
  436. package/dist/index-BvkVcW8I.d.ts +0 -349
  437. package/dist/index-CWmH_-RZ.d.ts +0 -247
  438. package/dist/index-CbgWNcus.d.ts +0 -258
  439. package/dist/index-CmfPeQza.d.ts +0 -166
  440. package/dist/index-CmpG-zak.d.ts +0 -607
  441. package/dist/index-CoMKgL-p.d.ts +0 -12
  442. package/dist/index-D8HGwglK.d.ts +0 -541
  443. package/dist/index-DCaVm66D.d.ts +0 -1101
  444. package/dist/index-DE2w7E0d.d.ts +0 -83
  445. package/dist/index-DSOpj8DI.d.ts +0 -17
  446. package/dist/index-DW9q22GH.d.ts +0 -75
  447. package/dist/index-DnjJ9CwI.d.ts +0 -347
  448. package/dist/index-DwMJZ8PP.d.ts +0 -317
  449. package/dist/index-PaojfSdd.d.ts +0 -71
  450. package/dist/index-aHtYvc3i.d.ts +0 -284
  451. package/dist/index-e_18DzAg.d.ts +0 -18
  452. package/dist/index-ffmipXSA.d.ts +0 -55
  453. package/dist/index-joONjwLt.d.ts +0 -33
  454. package/dist/index-kssw5ziY.d.ts +0 -250
  455. package/dist/index-lFffh5-G.d.ts +0 -125
  456. package/dist/index-pxYge_6k.d.ts +0 -79
  457. package/dist/layer-Cv9vSwBx.d.ts +0 -70
  458. package/dist/pino-logger-H4HPW5P6.js +0 -5
  459. package/dist/pino-logger-H4HPW5P6.js.map +0 -1
  460. package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
  461. package/dist/sdk-L75WWUP3.js +0 -156
  462. package/dist/sdk-L75WWUP3.js.map +0 -1
  463. package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
  464. package/dist/types-Bo2wkjSP.d.ts +0 -35
  465. package/dist/types-DVpvrAhd.d.ts +0 -71
  466. package/dist/types-DgJ4lDYA.d.ts +0 -108
  467. package/dist/types-USOv09qy.d.ts +0 -327
  468. package/dist/workspace-guard-NXVYYBVJ.js +0 -5
  469. package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
@@ -0,0 +1,839 @@
1
+ import { a as QuotaExceededError, c as ValidationError, i as PermissionDeniedError, o as SDKError } from "./types-Cj2RWXbz.js";
2
+ import { a as logger } from "./logger-B6rCpb7D.js";
3
+ import { t as RBACModule } from "./rbac-BB9l9Xph.js";
4
+ import { _ as runInExplicitActivityScope, g as markExplicitActivity, h as createExplicitActivityScope, o as trackOperation } from "./stub-BqwKn4eh.js";
5
+ import { a as UsageModule } from "./usage-BKFZiWQn.js";
6
+ import { n as NotificationType, r as NotificationsModule } from "./notifications-CdETrtFK.js";
7
+ import { randomUUID } from "node:crypto";
8
+
9
+ // src/activity/index.ts
10
+ /**
11
+ * Activity Tracking Module
12
+ *
13
+ * Audit trail writes and reads against the workspace activity owner
14
+ * (`wspace-activity-svc`), reached through the configured workspace internal gateway.
15
+ *
16
+ * The SDK keeps its own descriptive vocabulary (`activityType`, `status`, `severity`,
17
+ * `duration`, ...) for callers, but the owning subgraph's `ActivityLog` type does not have
18
+ * those columns. This module therefore maps between the two contracts explicitly:
19
+ *
20
+ * - writes send only fields `RecordActivityInput` defines and carry the SDK-only fields in
21
+ * `metadata`, which the owner persists verbatim in the row's `details` column;
22
+ * - reads select only fields `ActivityLog` defines and rebuild the SDK shape from the row
23
+ * plus those persisted `details`.
24
+ *
25
+ * Selecting a field the owner does not define fails GraphQL validation for the whole
26
+ * operation, so the selections below are pinned by unit tests against the published schema.
27
+ */
28
+ let ActivityType = /* @__PURE__ */ function(ActivityType) {
29
+ ActivityType["CREATE"] = "create";
30
+ ActivityType["READ"] = "read";
31
+ ActivityType["UPDATE"] = "update";
32
+ ActivityType["DELETE"] = "delete";
33
+ ActivityType["LOGIN"] = "login";
34
+ ActivityType["LOGOUT"] = "logout";
35
+ ActivityType["EXPORT"] = "export";
36
+ ActivityType["IMPORT"] = "import";
37
+ ActivityType["SHARE"] = "share";
38
+ ActivityType["DOWNLOAD"] = "download";
39
+ ActivityType["UPLOAD"] = "upload";
40
+ ActivityType["EXECUTE"] = "execute";
41
+ ActivityType["APPROVE"] = "approve";
42
+ ActivityType["REJECT"] = "reject";
43
+ ActivityType["CUSTOM"] = "custom";
44
+ return ActivityType;
45
+ }({});
46
+ let ActivityStatus = /* @__PURE__ */ function(ActivityStatus) {
47
+ ActivityStatus["SUCCESS"] = "success";
48
+ ActivityStatus["FAILURE"] = "failure";
49
+ ActivityStatus["PENDING"] = "pending";
50
+ ActivityStatus["WARNING"] = "warning";
51
+ return ActivityStatus;
52
+ }({});
53
+ let ActivitySeverity = /* @__PURE__ */ function(ActivitySeverity) {
54
+ ActivitySeverity["LOW"] = "low";
55
+ ActivitySeverity["MEDIUM"] = "medium";
56
+ ActivitySeverity["HIGH"] = "high";
57
+ ActivitySeverity["CRITICAL"] = "critical";
58
+ return ActivitySeverity;
59
+ }({});
60
+ /** Thrown by SDK operations the current activity owner does not expose. */
61
+ var ActivityOperationUnsupportedError = class ActivityOperationUnsupportedError extends SDKError {
62
+ constructor(operation, guidance) {
63
+ super(`ActivityModule.${operation} is not supported by the workspace activity owner: ${guidance}`, "ACTIVITY_OPERATION_UNSUPPORTED", { operation });
64
+ this.name = "ActivityOperationUnsupportedError";
65
+ Object.setPrototypeOf(this, ActivityOperationUnsupportedError.prototype);
66
+ }
67
+ };
68
+ /**
69
+ * `ActivityLog` fields selected from wspace-activity-svc. Every name here must exist on the
70
+ * owner's published `ActivityLog` type (see tests/activity-module.test.ts).
71
+ */
72
+ const ACTIVITY_LOG_SELECTION = `
73
+ id
74
+ userId
75
+ action
76
+ description
77
+ details
78
+ timestamp
79
+ productId
80
+ workspaceId
81
+ resourceType
82
+ resourceId
83
+ targetUserId
84
+ ipAddress
85
+ userAgent
86
+ actorType
87
+ onBehalfOf
88
+ context {
89
+ projectId
90
+ custom
91
+ }
92
+ `;
93
+ const RECORD_ACTIVITY_MUTATION = `
94
+ mutation RecordActivity($input: RecordActivityInput!) {
95
+ recordActivity(input: $input) {
96
+ ${ACTIVITY_LOG_SELECTION}
97
+ }
98
+ }
99
+ `;
100
+ const WORKSPACE_ACTIVITY_SLICE_QUERY = `
101
+ query GetWorkspaceActivitySlice($filter: ActivityLogFilter!) {
102
+ getWorkspaceActivitySlice(filter: $filter) {
103
+ ${ACTIVITY_LOG_SELECTION}
104
+ }
105
+ activityCount(filter: $filter)
106
+ }
107
+ `;
108
+ /**
109
+ * Keys the SDK stores inside `metadata`/`details` for its own fields. The owner overwrites
110
+ * `metadata.ipAddress`/`metadata.userAgent` with the relaying request's values, so the end
111
+ * user's request details travel under their own keys.
112
+ */
113
+ const SDK_DETAIL_KEYS = [
114
+ "activityType",
115
+ "status",
116
+ "severity",
117
+ "duration",
118
+ "organizationId",
119
+ "projectId",
120
+ "requestIpAddress",
121
+ "requestUserAgent",
122
+ "errorMessage",
123
+ "ipAddress",
124
+ "userAgent"
125
+ ];
126
+ function readRecord(value) {
127
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
128
+ }
129
+ function readString(value) {
130
+ return typeof value === "string" && value.length > 0 ? value : void 0;
131
+ }
132
+ function readEnum(values, value, fallback) {
133
+ const allowed = Object.values(values);
134
+ return typeof value === "string" && allowed.includes(value) ? value : fallback;
135
+ }
136
+ /** Remove undefined entries so the payload only names fields the caller actually set. */
137
+ function compact(input) {
138
+ return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0));
139
+ }
140
+ /**
141
+ * Build the wspace-activity-svc `RecordActivityInput` for an SDK activity.
142
+ * Exported for unit tests.
143
+ */
144
+ function buildRecordActivityInput(options, context = {}) {
145
+ const severity = options.severity ?? "low";
146
+ const metadata = compact({
147
+ ...options.metadata,
148
+ activityType: options.activityType,
149
+ status: options.status,
150
+ severity,
151
+ duration: options.duration,
152
+ errorMessage: options.errorMessage,
153
+ organizationId: options.organizationId,
154
+ projectId: options.projectId,
155
+ requestIpAddress: options.ipAddress,
156
+ requestUserAgent: options.userAgent
157
+ });
158
+ const activityContext = compact({
159
+ workspaceId: options.workspaceId,
160
+ userId: options.userId,
161
+ projectId: options.projectId,
162
+ custom: options.organizationId ? { organizationId: options.organizationId } : void 0
163
+ });
164
+ return compact({
165
+ action: options.action,
166
+ description: options.description,
167
+ resourceType: options.resourceType,
168
+ resourceId: options.resourceId,
169
+ workspaceId: options.workspaceId,
170
+ productId: options.productId ?? context.productId,
171
+ targetUserId: options.targetUserId,
172
+ teamId: options.teamId,
173
+ success: options.status !== "failure",
174
+ errorMessage: options.errorMessage,
175
+ actorType: options.actorType,
176
+ onBehalfOf: options.onBehalfOf,
177
+ context: activityContext,
178
+ metadata,
179
+ dedupeKey: options.dedupeKey ?? `sdk-activity:${randomUUID()}`
180
+ });
181
+ }
182
+ /**
183
+ * Rebuild the SDK `Activity` shape from an owner row. Fields the owner has no column for are
184
+ * read back from the persisted `details`. Exported for unit tests.
185
+ */
186
+ function toActivity(record) {
187
+ const details = readRecord(record.details) ?? {};
188
+ const custom = readRecord(record.context?.custom);
189
+ const metadata = {};
190
+ for (const [key, value] of Object.entries(details)) if (!SDK_DETAIL_KEYS.includes(key)) metadata[key] = value;
191
+ const duration = details["duration"];
192
+ return {
193
+ id: record.id,
194
+ userId: record.userId,
195
+ activityType: readEnum(ActivityType, details["activityType"], "custom"),
196
+ resourceType: record.resourceType ?? "",
197
+ resourceId: record.resourceId ?? void 0,
198
+ action: record.action,
199
+ status: readEnum(ActivityStatus, details["status"], "success"),
200
+ workspaceId: record.workspaceId ?? void 0,
201
+ organizationId: readString(details["organizationId"]) ?? readString(custom?.["organizationId"]),
202
+ projectId: record.context?.projectId ?? readString(details["projectId"]),
203
+ productId: record.productId ?? void 0,
204
+ description: record.description ?? void 0,
205
+ targetUserId: record.targetUserId ?? void 0,
206
+ actorType: record.actorType ?? void 0,
207
+ onBehalfOf: record.onBehalfOf ?? void 0,
208
+ ipAddress: readString(details["requestIpAddress"]) ?? record.ipAddress ?? void 0,
209
+ userAgent: readString(details["requestUserAgent"]) ?? record.userAgent ?? void 0,
210
+ metadata,
211
+ severity: readEnum(ActivitySeverity, details["severity"], "low"),
212
+ errorMessage: readString(details["errorMessage"]),
213
+ duration: typeof duration === "number" && Number.isFinite(duration) ? duration : void 0,
214
+ createdAt: record.timestamp
215
+ };
216
+ }
217
+ /**
218
+ * Build the owner's `ActivityLogFilter` for an SDK read. Filters the owner cannot apply are
219
+ * rejected rather than dropped, because dropping them would return rows the caller excluded.
220
+ * Exported for unit tests.
221
+ */
222
+ function buildActivityLogFilter(options) {
223
+ if (!options.workspaceId) throw new ValidationError("workspaceId is required to read activities");
224
+ const unsupported = [
225
+ "organizationId",
226
+ "projectId",
227
+ "activityType",
228
+ "status",
229
+ "severity",
230
+ "search"
231
+ ].filter((key) => options[key] !== void 0);
232
+ if (options.sortBy !== void 0 && options.sortBy !== "createdAt") unsupported.push("sortBy");
233
+ if (options.sortOrder !== void 0 && options.sortOrder !== "desc") unsupported.push("sortOrder");
234
+ if (unsupported.length > 0) throw new ValidationError(`Activity filters not supported by the workspace activity owner: ${unsupported.join(", ")}`, { unsupported });
235
+ return compact({
236
+ workspaceId: options.workspaceId,
237
+ userId: options.userId,
238
+ action: options.action,
239
+ resourceType: options.resourceType,
240
+ resourceId: options.resourceId,
241
+ targetUserId: options.targetUserId,
242
+ startDate: options.startDate,
243
+ endDate: options.endDate,
244
+ limit: options.limit ?? 50,
245
+ offset: options.offset ?? 0
246
+ });
247
+ }
248
+ /**
249
+ * Activity Tracking Module
250
+ */
251
+ var ActivityModule = class {
252
+ client;
253
+ context;
254
+ constructor(client, context) {
255
+ this.client = client;
256
+ this.context = context;
257
+ }
258
+ /**
259
+ * Log activity
260
+ *
261
+ * The write is relayed as a platform service acting for `userId`, the same identity
262
+ * transport `trackOperation` uses, so the owner records the end user as the actor and
263
+ * honours `actorType`/`onBehalfOf` from the input.
264
+ */
265
+ async log(options) {
266
+ if (!options.userId) throw new ValidationError("User ID is required");
267
+ if (!options.activityType) throw new ValidationError("Activity type is required");
268
+ if (!options.resourceType) throw new ValidationError("Resource type is required");
269
+ if (!options.action) throw new ValidationError("Action is required");
270
+ if (!options.status) throw new ValidationError("Status is required");
271
+ markExplicitActivity();
272
+ logger.debug("[Activity] Logging activity", {
273
+ userId: options.userId,
274
+ action: options.action,
275
+ resourceType: options.resourceType
276
+ });
277
+ const input = buildRecordActivityInput(options, this.context);
278
+ const requestContext = {
279
+ ...this.context,
280
+ actorId: options.userId,
281
+ actorType: "service",
282
+ workspaceId: options.workspaceId ?? this.context.workspaceId
283
+ };
284
+ const activity = toActivity((await this.client.query(RECORD_ACTIVITY_MUTATION, { input }, requestContext)).recordActivity);
285
+ logger.info("[Activity] Activity logged", { activityId: activity.id });
286
+ return activity;
287
+ }
288
+ /**
289
+ * Log activity with automatic status detection
290
+ */
291
+ async logSuccess(userId, action, resourceType, resourceId, metadata) {
292
+ return this.log({
293
+ userId,
294
+ action,
295
+ resourceType,
296
+ resourceId,
297
+ activityType: this.inferActivityType(action),
298
+ status: "success",
299
+ severity: "low",
300
+ metadata,
301
+ workspaceId: this.context.workspaceId
302
+ });
303
+ }
304
+ /**
305
+ * Log failed activity
306
+ */
307
+ async logFailure(userId, action, resourceType, errorMessage, resourceId, metadata) {
308
+ return this.log({
309
+ userId,
310
+ action,
311
+ resourceType,
312
+ resourceId,
313
+ activityType: this.inferActivityType(action),
314
+ status: "failure",
315
+ severity: "high",
316
+ errorMessage,
317
+ metadata,
318
+ workspaceId: this.context.workspaceId
319
+ });
320
+ }
321
+ /**
322
+ * Get one workspace's activities, newest first.
323
+ *
324
+ * Reads the owner's workspace-scoped slice (`getWorkspaceActivitySlice`) together with the
325
+ * matching `activityCount`, so `total` counts every row the filter matches, not just the page.
326
+ */
327
+ async getActivities(options) {
328
+ logger.debug("[Activity] Getting activities", options);
329
+ const filter = buildActivityLogFilter(options);
330
+ const requestContext = {
331
+ ...this.context,
332
+ workspaceId: options.workspaceId
333
+ };
334
+ const response = await this.client.query(WORKSPACE_ACTIVITY_SLICE_QUERY, { filter }, requestContext);
335
+ return {
336
+ activities: response.getWorkspaceActivitySlice.map(toActivity),
337
+ total: response.activityCount
338
+ };
339
+ }
340
+ /**
341
+ * @deprecated The workspace activity owner has no read-by-id operation. Use
342
+ * {@link getActivities} with `resourceId`/`action` filters instead.
343
+ */
344
+ async getActivity(_activityId) {
345
+ throw new ActivityOperationUnsupportedError("getActivity", "use getActivities with a workspace filter");
346
+ }
347
+ /**
348
+ * @deprecated The workspace activity owner has no statistics operation. Use
349
+ * {@link getActivities} (its `total` is the owner's `activityCount`) per filter instead.
350
+ */
351
+ async getStats(_options) {
352
+ throw new ActivityOperationUnsupportedError("getStats", "use getActivities and its total per filter");
353
+ }
354
+ /**
355
+ * @deprecated Retention is enforced by the activity owner's retention policy and legal holds;
356
+ * there is no client-driven cleanup operation.
357
+ */
358
+ async cleanup(_olderThanDays, _workspaceId) {
359
+ throw new ActivityOperationUnsupportedError("cleanup", "retention is enforced by the activity owner");
360
+ }
361
+ /**
362
+ * @deprecated The workspace activity owner exports through `exportActivityLogsSiem`
363
+ * (CEF/LEEF/JSON lines); there is no CSV export operation.
364
+ */
365
+ async exportToCSV(_options) {
366
+ throw new ActivityOperationUnsupportedError("exportToCSV", "use the owner exportActivityLogsSiem query");
367
+ }
368
+ /**
369
+ * Infer activity type from action string
370
+ */
371
+ inferActivityType(action) {
372
+ const actionLower = action.toLowerCase();
373
+ if (actionLower.includes("create") || actionLower.includes("add")) return "create";
374
+ if (actionLower.includes("update") || actionLower.includes("edit") || actionLower.includes("modify")) return "update";
375
+ if (actionLower.includes("delete") || actionLower.includes("remove")) return "delete";
376
+ if (actionLower.includes("read") || actionLower.includes("view") || actionLower.includes("get")) return "read";
377
+ if (actionLower.includes("login") || actionLower.includes("signin")) return "login";
378
+ if (actionLower.includes("logout") || actionLower.includes("signout")) return "logout";
379
+ if (actionLower.includes("export")) return "export";
380
+ if (actionLower.includes("import")) return "import";
381
+ if (actionLower.includes("share")) return "share";
382
+ if (actionLower.includes("download")) return "download";
383
+ if (actionLower.includes("upload")) return "upload";
384
+ if (actionLower.includes("execute") || actionLower.includes("run")) return "execute";
385
+ if (actionLower.includes("approve")) return "approve";
386
+ if (actionLower.includes("reject")) return "reject";
387
+ return "custom";
388
+ }
389
+ };
390
+
391
+ // src/tracker/agent-activity.ts
392
+ /**
393
+ * AI-agent activity (BOFF-9684)
394
+ *
395
+ * Platform-wide activity actions for what an AI agent does, and a helper that records them with
396
+ * the agent as an `app` actor. The audit trail can then separate agent actions from the human
397
+ * actions around them (ISO/IEC 42001 Annex A.9 evidence) and link each one back to the person
398
+ * who started the run (`onBehalfOf`).
399
+ *
400
+ * The action names follow the platform taxonomy `<domain>.<resource>.<verb>` and are shared by
401
+ * every product that runs agents; the product is identified by `productId`.
402
+ *
403
+ * @example
404
+ * ```ts
405
+ * import { AGENT_ACTIVITY_ACTIONS, trackAgentActivity } from '@burdenoff/be-sdk/tracker';
406
+ *
407
+ * await trackAgentActivity({
408
+ * action: AGENT_ACTIVITY_ACTIONS.TOOL_CALLED,
409
+ * agentId: agent.id,
410
+ * workspaceId,
411
+ * onBehalfOf: userId,
412
+ * productId: 'botmanor',
413
+ * metadata: { toolName: 'search' },
414
+ * });
415
+ * ```
416
+ *
417
+ * @module tracker/agent-activity
418
+ * @category Tracking
419
+ */
420
+ /** Activity actions for AI-agent behaviour. */
421
+ const AGENT_ACTIVITY_ACTIONS = Object.freeze({
422
+ /** An agent run (one turn) finished and produced a response. */
423
+ RUN_COMPLETED: "agent.run.completed",
424
+ /** An agent run failed before producing a response. */
425
+ RUN_FAILED: "agent.run.failed",
426
+ /** The agent called a tool (MCP or similar). `success: false` when the call failed. */
427
+ TOOL_CALLED: "agent.tool.called",
428
+ /** The agent delegated a sub-task to another agent. */
429
+ DELEGATION_SENT: "agent.delegation.sent",
430
+ /** A governance policy refused something the agent run attempted (input, output, tool, model, budget, rate). */
431
+ POLICY_BLOCKED: "agent.policy.blocked"
432
+ });
433
+ /** Default `resourceType` of agent activity rows; `resourceId` defaults to the agent id. */
434
+ const AGENT_ACTIVITY_RESOURCE_TYPE = "agent";
435
+ const FAILURE_ACTIONS = /* @__PURE__ */ new Set([AGENT_ACTIVITY_ACTIONS.RUN_FAILED, AGENT_ACTIVITY_ACTIONS.POLICY_BLOCKED]);
436
+ /**
437
+ * Record one AI-agent activity row, attributed to the agent as an `app` actor.
438
+ *
439
+ * Fire-and-forget like `trackOperation`: it never throws for a delivery failure and never blocks
440
+ * on the activity service. It runs in its own explicit-activity scope, so recording what the
441
+ * agent did does not suppress the mutation-audit row of the human request that started the run.
442
+ */
443
+ function trackAgentActivity(options) {
444
+ const success = options.success ?? !FAILURE_ACTIONS.has(options.action);
445
+ return runInExplicitActivityScope(createExplicitActivityScope(), () => trackOperation({
446
+ operationName: options.action,
447
+ userId: options.agentId,
448
+ actorType: "app",
449
+ ...options.onBehalfOf ? { onBehalfOf: options.onBehalfOf } : {},
450
+ workspaceId: options.workspaceId,
451
+ ...options.productId ? { productId: options.productId } : {},
452
+ success,
453
+ ...options.errorMessage ? { errorMessage: options.errorMessage } : {},
454
+ activityOptions: {
455
+ enabled: true,
456
+ activityType: options.action,
457
+ description: options.description ?? `Agent ${options.agentId}: ${options.action}`,
458
+ workspaceId: options.workspaceId,
459
+ resourceType: options.resourceType ?? "agent",
460
+ resourceId: options.resourceId ?? options.agentId,
461
+ metadata: {
462
+ ...options.metadata,
463
+ agentId: options.agentId
464
+ },
465
+ ...options.dedupeKey ? { dedupeKey: options.dedupeKey } : {}
466
+ }
467
+ }));
468
+ }
469
+
470
+ // src/tracker/index.ts
471
+ /**
472
+ * Unified Tracker Module
473
+ *
474
+ * The primary module products should use for tracking operations.
475
+ * Automatically handles RBAC checks, activity logging, usage tracking, and notifications.
476
+ *
477
+ * @example
478
+ * ```typescript
479
+ * const result = await sdk.tracker.track({
480
+ * userId: 'user123',
481
+ * action: 'create_project',
482
+ * resourceType: 'project',
483
+ * workspaceId: 'ws123',
484
+ * usage: {
485
+ * quotaName: 'myproduct.projects.count',
486
+ * productId: 'myproduct',
487
+ * amount: 1,
488
+ * checkQuota: true,
489
+ * },
490
+ * notification: {
491
+ * onSuccess: {
492
+ * title: 'Project Created',
493
+ * message: 'Your project has been created successfully',
494
+ * },
495
+ * },
496
+ * });
497
+ *
498
+ * if (!result.success) {
499
+ * // Handle error
500
+ * }
501
+ * ```
502
+ */
503
+ var TrackerModule = class {
504
+ context;
505
+ rbac;
506
+ activity;
507
+ usage;
508
+ notifications;
509
+ constructor(client, context = {}) {
510
+ this.context = context;
511
+ this.rbac = new RBACModule(client, context);
512
+ this.activity = new ActivityModule(client, context);
513
+ this.usage = new UsageModule(client, context);
514
+ this.notifications = new NotificationsModule(client, context);
515
+ }
516
+ /**
517
+ * Track operation with RBAC, Activity, Usage, and Notifications
518
+ * This is the primary method products should use
519
+ */
520
+ async track(options) {
521
+ const startTime = Date.now();
522
+ const result = {
523
+ success: false,
524
+ permissionGranted: false,
525
+ duration: 0
526
+ };
527
+ try {
528
+ this.validateOptions(options);
529
+ if (options.rbac?.enabled !== false) {
530
+ await this.checkPermission(options, result);
531
+ if (!result.permissionGranted) {
532
+ result.duration = Date.now() - startTime;
533
+ await this.logFailedActivity(options, result, startTime);
534
+ return result;
535
+ }
536
+ } else result.permissionGranted = true;
537
+ const usage = this.resolveUsage(options);
538
+ if (usage) {
539
+ let quotaAssignmentId;
540
+ if (usage.checkQuota) {
541
+ quotaAssignmentId = await this.checkQuota(options, usage, result);
542
+ if (result.quotaAvailable === false) {
543
+ result.duration = Date.now() - startTime;
544
+ await this.logFailedActivity(options, result, startTime);
545
+ return result;
546
+ }
547
+ }
548
+ await this.trackUsage(options, usage, quotaAssignmentId, result);
549
+ }
550
+ if (options.activity?.enabled !== false) await this.logSuccessActivity(options, result, startTime);
551
+ if (options.notification?.onSuccess) await this.sendSuccessNotification(options, result);
552
+ result.success = true;
553
+ result.duration = Date.now() - startTime;
554
+ logger.info("[Tracker] Operation tracked successfully", {
555
+ action: options.action,
556
+ duration: result.duration
557
+ });
558
+ return result;
559
+ } catch (error) {
560
+ result.duration = Date.now() - startTime;
561
+ result.success = false;
562
+ if (error instanceof PermissionDeniedError) result.error = {
563
+ type: "permission",
564
+ message: error.message,
565
+ details: error.details
566
+ };
567
+ else if (error instanceof QuotaExceededError) result.error = {
568
+ type: "quota",
569
+ message: error.message,
570
+ details: error.details
571
+ };
572
+ else if (error instanceof ValidationError) result.error = {
573
+ type: "validation",
574
+ message: error.message,
575
+ details: error.details
576
+ };
577
+ else result.error = {
578
+ type: "unknown",
579
+ message: error instanceof Error ? error.message : "Unknown error"
580
+ };
581
+ await this.logFailedActivity(options, result, startTime);
582
+ if (options.notification?.onFailure) await this.sendFailureNotification(options, result);
583
+ logger.error("[Tracker] Operation tracking failed", {
584
+ action: options.action,
585
+ error: result.error,
586
+ duration: result.duration
587
+ });
588
+ return result;
589
+ }
590
+ }
591
+ /**
592
+ * Track operation and throw on failure
593
+ * Convenience method that throws errors instead of returning them in result
594
+ */
595
+ async trackOrThrow(options) {
596
+ const result = await this.track(options);
597
+ if (!result.success && result.error) {
598
+ const errorMessage = result.error.message;
599
+ const errorDetails = result.error.details;
600
+ switch (result.error.type) {
601
+ case "permission": throw new PermissionDeniedError(errorMessage, errorDetails);
602
+ case "quota": throw new QuotaExceededError(errorMessage, errorDetails);
603
+ case "validation": throw new ValidationError(errorMessage, errorDetails);
604
+ default: throw new Error(errorMessage);
605
+ }
606
+ }
607
+ return result;
608
+ }
609
+ /**
610
+ * Simplified track method for common operations.
611
+ * The trailing metric type is accepted for source compatibility and is not metered.
612
+ */
613
+ async trackSimple(userId, action, resourceType, resourceId, _metricType) {
614
+ return (await this.track({
615
+ userId,
616
+ action,
617
+ resourceType,
618
+ resourceId,
619
+ workspaceId: this.context.workspaceId,
620
+ usage: { enabled: false }
621
+ })).success;
622
+ }
623
+ /**
624
+ * Validate tracking options
625
+ */
626
+ validateOptions(options) {
627
+ if (!options.userId) throw new ValidationError("User ID is required");
628
+ if (!options.action) throw new ValidationError("Action is required");
629
+ if (!options.resourceType) throw new ValidationError("Resource type is required");
630
+ }
631
+ /**
632
+ * Check RBAC permission
633
+ */
634
+ async checkPermission(options, result) {
635
+ const permissionOptions = {
636
+ userId: options.userId,
637
+ action: options.rbac?.permissionAction || options.action,
638
+ resourceType: options.resourceType,
639
+ resourceId: options.resourceId,
640
+ workspaceId: options.workspaceId
641
+ };
642
+ const hasPermission = await this.rbac.checkPermission(permissionOptions);
643
+ result.permissionGranted = hasPermission;
644
+ if (!hasPermission) result.error = {
645
+ type: "permission",
646
+ message: "Permission denied",
647
+ details: permissionOptions
648
+ };
649
+ }
650
+ /**
651
+ * Resolve the usage step for an operation, or null when nothing is metered: usage is
652
+ * disabled, or no workspace quota is named (a legacy `metricType` alone has no owner
653
+ * quota to charge).
654
+ */
655
+ resolveUsage(options) {
656
+ const usage = options.usage;
657
+ if (!usage || usage.enabled === false) return null;
658
+ const quotaName = usage.quotaName?.trim();
659
+ if (!quotaName) {
660
+ if (usage.metricType) logger.debug("[Tracker] Usage step skipped: no quotaName for legacy metricType", {
661
+ action: options.action,
662
+ metricType: usage.metricType
663
+ });
664
+ return null;
665
+ }
666
+ const amount = usage.amount ?? 1;
667
+ if (typeof amount !== "number" || !Number.isFinite(amount) || amount === 0) throw new ValidationError("Usage amount must be a finite, non-zero number");
668
+ const workspaceId = options.workspaceId ?? this.context.workspaceId;
669
+ if (!workspaceId) throw new ValidationError("Workspace ID is required to track workspace quota usage");
670
+ return {
671
+ quotaName,
672
+ amount,
673
+ workspaceId,
674
+ checkQuota: usage.checkQuota !== false && amount > 0
675
+ };
676
+ }
677
+ /**
678
+ * Check workspace quota capacity. Returns the assignment to charge when one exists.
679
+ */
680
+ async checkQuota(options, usage, result) {
681
+ const quotaCheck = await this.usage.checkWorkspaceQuota({
682
+ quotaName: usage.quotaName,
683
+ amount: usage.amount,
684
+ workspaceId: usage.workspaceId,
685
+ userId: options.userId
686
+ });
687
+ result.quotaAvailable = quotaCheck.allowed;
688
+ result.quotaRemaining = quotaCheck.limitLeft ?? void 0;
689
+ if (!quotaCheck.allowed) {
690
+ const notProvisioned = quotaCheck.assignmentId === null;
691
+ result.error = {
692
+ type: "quota",
693
+ message: notProvisioned ? `Quota ${usage.quotaName} is not included in this workspace's plan` : "Quota exceeded",
694
+ details: {
695
+ quotaName: usage.quotaName,
696
+ requestedAmount: usage.amount,
697
+ limitLeft: quotaCheck.limitLeft,
698
+ notProvisioned
699
+ }
700
+ };
701
+ }
702
+ return quotaCheck.assignmentId ?? void 0;
703
+ }
704
+ /**
705
+ * Record workspace quota usage with the owner.
706
+ */
707
+ async trackUsage(options, usage, quotaAssignmentId, result) {
708
+ result.usageTracked = await this.usage.trackUsage({
709
+ quotaName: usage.quotaName,
710
+ productId: options.usage?.productId,
711
+ amount: usage.amount,
712
+ description: options.usage?.description?.trim() || `${options.action} ${options.resourceType}`,
713
+ workspaceId: usage.workspaceId,
714
+ userId: options.userId,
715
+ quotaAssignmentId,
716
+ metadata: {
717
+ action: options.action,
718
+ resourceType: options.resourceType,
719
+ ...options.resourceId ? { resourceId: options.resourceId } : {}
720
+ }
721
+ });
722
+ }
723
+ /**
724
+ * Log successful activity
725
+ */
726
+ async logSuccessActivity(options, result, startTime) {
727
+ result.activityId = (await this.activity.log({
728
+ userId: options.userId,
729
+ activityType: options.activity?.activityType || this.inferActivityType(options.action),
730
+ resourceType: options.resourceType,
731
+ resourceId: options.resourceId,
732
+ action: options.action,
733
+ status: "success",
734
+ workspaceId: options.workspaceId,
735
+ organizationId: options.organizationId,
736
+ projectId: options.projectId,
737
+ ipAddress: options.activity?.ipAddress,
738
+ userAgent: options.activity?.userAgent,
739
+ metadata: options.activity?.metadata,
740
+ severity: options.activity?.severity || "low",
741
+ duration: Date.now() - startTime
742
+ })).id;
743
+ }
744
+ /**
745
+ * Log failed activity
746
+ */
747
+ async logFailedActivity(options, result, startTime) {
748
+ if (options.activity?.enabled === false) return;
749
+ try {
750
+ result.activityId = (await this.activity.log({
751
+ userId: options.userId,
752
+ activityType: options.activity?.activityType || this.inferActivityType(options.action),
753
+ resourceType: options.resourceType,
754
+ resourceId: options.resourceId,
755
+ action: options.action,
756
+ status: "failure",
757
+ workspaceId: options.workspaceId,
758
+ organizationId: options.organizationId,
759
+ projectId: options.projectId,
760
+ ipAddress: options.activity?.ipAddress,
761
+ userAgent: options.activity?.userAgent,
762
+ metadata: options.activity?.metadata,
763
+ severity: "high",
764
+ errorMessage: result.error?.message,
765
+ duration: Date.now() - startTime
766
+ })).id;
767
+ } catch (error) {
768
+ logger.error("[Tracker] Failed to log activity", { error });
769
+ }
770
+ }
771
+ /**
772
+ * Send success notification
773
+ */
774
+ async sendSuccessNotification(options, result) {
775
+ if (!options.notification?.onSuccess) return;
776
+ try {
777
+ const userIds = [options.userId, ...options.notification.onSuccess.additionalUserIds || []];
778
+ result.notificationIds = (await this.notifications.send({
779
+ title: options.notification.onSuccess.title,
780
+ message: options.notification.onSuccess.message,
781
+ type: options.notification.onSuccess.type || "success",
782
+ userIds
783
+ })).notificationIds;
784
+ } catch (error) {
785
+ logger.error("[Tracker] Failed to send success notification", { error });
786
+ }
787
+ }
788
+ /**
789
+ * Send failure notification
790
+ */
791
+ async sendFailureNotification(options, result) {
792
+ if (!options.notification?.onFailure) return;
793
+ try {
794
+ const userIds = [options.userId, ...options.notification.onFailure.additionalUserIds || []];
795
+ result.notificationIds = (await this.notifications.send({
796
+ title: options.notification.onFailure.title,
797
+ message: options.notification.onFailure.message,
798
+ type: options.notification.onFailure.type || "error",
799
+ userIds
800
+ })).notificationIds;
801
+ } catch (error) {
802
+ logger.error("[Tracker] Failed to send failure notification", { error });
803
+ }
804
+ }
805
+ /**
806
+ * Infer activity type from action
807
+ */
808
+ inferActivityType(action) {
809
+ const actionLower = action.toLowerCase();
810
+ if (actionLower.includes("create") || actionLower.includes("add")) return "create";
811
+ if (actionLower.includes("update") || actionLower.includes("edit")) return "update";
812
+ if (actionLower.includes("delete") || actionLower.includes("remove")) return "delete";
813
+ if (actionLower.includes("read") || actionLower.includes("view")) return "read";
814
+ if (actionLower.includes("login")) return "login";
815
+ if (actionLower.includes("logout")) return "logout";
816
+ if (actionLower.includes("export")) return "export";
817
+ if (actionLower.includes("import")) return "import";
818
+ if (actionLower.includes("share")) return "share";
819
+ if (actionLower.includes("download")) return "download";
820
+ if (actionLower.includes("upload")) return "upload";
821
+ return "custom";
822
+ }
823
+ /**
824
+ * Batch track multiple operations
825
+ */
826
+ async trackBatch(operations) {
827
+ logger.debug("[Tracker] Batch tracking operations", { count: operations.length });
828
+ const results = await Promise.all(operations.map((op) => this.track(op)));
829
+ logger.info("[Tracker] Batch tracking completed", {
830
+ total: results.length,
831
+ successful: results.filter((r) => r.success).length,
832
+ failed: results.filter((r) => !r.success).length
833
+ });
834
+ return results;
835
+ }
836
+ };
837
+
838
+ export { ActivityModule as a, trackAgentActivity as i, AGENT_ACTIVITY_ACTIONS as n, ActivityOperationUnsupportedError as o, AGENT_ACTIVITY_RESOURCE_TYPE as r, TrackerModule as t };
839
+ //# sourceMappingURL=tracker-BQVoEFUo.js.map