@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,165 @@
1
+ import { t as BurdenoffGraphQLClient } from "../graphql-CUDyhibV.js";
2
+ import { m as SDKError, p as SDKContext } from "../index-CTTwo9av.js";
3
+ export declare enum ActivityType {
4
+ CREATE = "create",
5
+ READ = "read",
6
+ UPDATE = "update",
7
+ DELETE = "delete",
8
+ LOGIN = "login",
9
+ LOGOUT = "logout",
10
+ EXPORT = "export",
11
+ IMPORT = "import",
12
+ SHARE = "share",
13
+ DOWNLOAD = "download",
14
+ UPLOAD = "upload",
15
+ EXECUTE = "execute",
16
+ APPROVE = "approve",
17
+ REJECT = "reject",
18
+ CUSTOM = "custom"
19
+ }
20
+ export declare enum ActivityStatus {
21
+ SUCCESS = "success",
22
+ FAILURE = "failure",
23
+ PENDING = "pending",
24
+ WARNING = "warning"
25
+ }
26
+ export declare enum ActivitySeverity {
27
+ LOW = "low",
28
+ MEDIUM = "medium",
29
+ HIGH = "high",
30
+ CRITICAL = "critical"
31
+ }
32
+ export type ActivityActorType = 'user' | 'app' | 'service' | 'super_admin';
33
+ export interface LogActivityOptions {
34
+ userId: string;
35
+ activityType: ActivityType;
36
+ resourceType: string;
37
+ resourceId?: string;
38
+ action: string;
39
+ status: ActivityStatus;
40
+ workspaceId?: string;
41
+ organizationId?: string;
42
+ projectId?: string;
43
+ productId?: string;
44
+ description?: string;
45
+ targetUserId?: string;
46
+ teamId?: string;
47
+ actorType?: ActivityActorType;
48
+ onBehalfOf?: string;
49
+ dedupeKey?: string;
50
+ ipAddress?: string;
51
+ userAgent?: string;
52
+ metadata?: Record<string, unknown>;
53
+ severity?: ActivitySeverity;
54
+ errorMessage?: string;
55
+ duration?: number;
56
+ }
57
+ export interface Activity {
58
+ id: string;
59
+ userId: string;
60
+ activityType: ActivityType;
61
+ resourceType: string;
62
+ resourceId?: string;
63
+ action: string;
64
+ status: ActivityStatus;
65
+ workspaceId?: string;
66
+ organizationId?: string;
67
+ projectId?: string;
68
+ productId?: string;
69
+ description?: string;
70
+ targetUserId?: string;
71
+ actorType?: string;
72
+ onBehalfOf?: string;
73
+ ipAddress?: string;
74
+ userAgent?: string;
75
+ metadata?: Record<string, unknown>;
76
+ severity: ActivitySeverity;
77
+ errorMessage?: string;
78
+ duration?: number;
79
+ createdAt: string;
80
+ }
81
+ export interface GetActivitiesOptions {
82
+ workspaceId?: string;
83
+ userId?: string;
84
+ action?: string;
85
+ resourceType?: string;
86
+ resourceId?: string;
87
+ targetUserId?: string;
88
+ startDate?: string;
89
+ endDate?: string;
90
+ limit?: number;
91
+ offset?: number;
92
+ organizationId?: string;
93
+ projectId?: string;
94
+ activityType?: ActivityType;
95
+ status?: ActivityStatus;
96
+ severity?: ActivitySeverity;
97
+ search?: string;
98
+ sortBy?: 'createdAt' | 'duration' | 'severity';
99
+ sortOrder?: 'asc' | 'desc';
100
+ }
101
+ export interface ActivityStats {
102
+ totalActivities: number;
103
+ successCount: number;
104
+ failureCount: number;
105
+ pendingCount: number;
106
+ warningCount: number;
107
+ averageDuration?: number;
108
+ activitiesByType: Record<string, number>;
109
+ activitiesBySeverity: Record<string, number>;
110
+ topUsers: Array<{
111
+ userId: string;
112
+ count: number;
113
+ }>;
114
+ topResources: Array<{
115
+ resourceType: string;
116
+ count: number;
117
+ }>;
118
+ }
119
+ export declare class ActivityOperationUnsupportedError extends SDKError {
120
+ constructor(operation: string, guidance: string);
121
+ }
122
+ export declare const ACTIVITY_LOG_SELECTION = "\n id\n userId\n action\n description\n details\n timestamp\n productId\n workspaceId\n resourceType\n resourceId\n targetUserId\n ipAddress\n userAgent\n actorType\n onBehalfOf\n context {\n projectId\n custom\n }\n";
123
+ export declare const RECORD_ACTIVITY_MUTATION = "\n mutation RecordActivity($input: RecordActivityInput!) {\n recordActivity(input: $input) {\n \n id\n userId\n action\n description\n details\n timestamp\n productId\n workspaceId\n resourceType\n resourceId\n targetUserId\n ipAddress\n userAgent\n actorType\n onBehalfOf\n context {\n projectId\n custom\n }\n\n }\n }\n";
124
+ export declare const WORKSPACE_ACTIVITY_SLICE_QUERY = "\n query GetWorkspaceActivitySlice($filter: ActivityLogFilter!) {\n getWorkspaceActivitySlice(filter: $filter) {\n \n id\n userId\n action\n description\n details\n timestamp\n productId\n workspaceId\n resourceType\n resourceId\n targetUserId\n ipAddress\n userAgent\n actorType\n onBehalfOf\n context {\n projectId\n custom\n }\n\n }\n activityCount(filter: $filter)\n }\n";
125
+ export interface ActivityLogRecord {
126
+ id: string;
127
+ userId: string;
128
+ action: string;
129
+ description?: string | null;
130
+ details?: unknown;
131
+ timestamp: string;
132
+ productId?: string | null;
133
+ workspaceId?: string | null;
134
+ resourceType?: string | null;
135
+ resourceId?: string | null;
136
+ targetUserId?: string | null;
137
+ ipAddress?: string | null;
138
+ userAgent?: string | null;
139
+ actorType?: string | null;
140
+ onBehalfOf?: string | null;
141
+ context?: {
142
+ projectId?: string | null;
143
+ custom?: unknown;
144
+ } | null;
145
+ }
146
+ export declare function buildRecordActivityInput(options: LogActivityOptions, context?: SDKContext): Record<string, unknown>;
147
+ export declare function toActivity(record: ActivityLogRecord): Activity;
148
+ export declare function buildActivityLogFilter(options: GetActivitiesOptions): Record<string, unknown>;
149
+ export declare class ActivityModule {
150
+ private client;
151
+ private context;
152
+ constructor(client: BurdenoffGraphQLClient, context: SDKContext);
153
+ log(options: LogActivityOptions): Promise<Activity>;
154
+ logSuccess(userId: string, action: string, resourceType: string, resourceId?: string, metadata?: Record<string, unknown>): Promise<Activity>;
155
+ logFailure(userId: string, action: string, resourceType: string, errorMessage: string, resourceId?: string, metadata?: Record<string, unknown>): Promise<Activity>;
156
+ getActivities(options: GetActivitiesOptions): Promise<{
157
+ activities: Activity[];
158
+ total: number;
159
+ }>;
160
+ getActivity(_activityId: string): Promise<Activity>;
161
+ getStats(_options: Omit<GetActivitiesOptions, 'limit' | 'offset'>): Promise<ActivityStats>;
162
+ cleanup(_olderThanDays: number, _workspaceId?: string): Promise<number>;
163
+ exportToCSV(_options: GetActivitiesOptions): Promise<string>;
164
+ private inferActivityType;
165
+ }
@@ -0,0 +1,389 @@
1
+ import { SDKError, ValidationError } from "../types/index.js";
2
+ import { a as logger } from "../logger-B6rCpb7D.js";
3
+ import { n as markExplicitActivity } from "../explicit-activity-scope-DikJ7NAE.js";
4
+ import { randomUUID } from "node:crypto";
5
+
6
+ // src/activity/index.ts
7
+ /**
8
+ * Activity Tracking Module
9
+ *
10
+ * Audit trail writes and reads against the workspace activity owner
11
+ * (`wspace-activity-svc`), reached through the configured workspace internal gateway.
12
+ *
13
+ * The SDK keeps its own descriptive vocabulary (`activityType`, `status`, `severity`,
14
+ * `duration`, ...) for callers, but the owning subgraph's `ActivityLog` type does not have
15
+ * those columns. This module therefore maps between the two contracts explicitly:
16
+ *
17
+ * - writes send only fields `RecordActivityInput` defines and carry the SDK-only fields in
18
+ * `metadata`, which the owner persists verbatim in the row's `details` column;
19
+ * - reads select only fields `ActivityLog` defines and rebuild the SDK shape from the row
20
+ * plus those persisted `details`.
21
+ *
22
+ * Selecting a field the owner does not define fails GraphQL validation for the whole
23
+ * operation, so the selections below are pinned by unit tests against the published schema.
24
+ */
25
+ let ActivityType = /* @__PURE__ */ function(ActivityType) {
26
+ ActivityType["CREATE"] = "create";
27
+ ActivityType["READ"] = "read";
28
+ ActivityType["UPDATE"] = "update";
29
+ ActivityType["DELETE"] = "delete";
30
+ ActivityType["LOGIN"] = "login";
31
+ ActivityType["LOGOUT"] = "logout";
32
+ ActivityType["EXPORT"] = "export";
33
+ ActivityType["IMPORT"] = "import";
34
+ ActivityType["SHARE"] = "share";
35
+ ActivityType["DOWNLOAD"] = "download";
36
+ ActivityType["UPLOAD"] = "upload";
37
+ ActivityType["EXECUTE"] = "execute";
38
+ ActivityType["APPROVE"] = "approve";
39
+ ActivityType["REJECT"] = "reject";
40
+ ActivityType["CUSTOM"] = "custom";
41
+ return ActivityType;
42
+ }({});
43
+ let ActivityStatus = /* @__PURE__ */ function(ActivityStatus) {
44
+ ActivityStatus["SUCCESS"] = "success";
45
+ ActivityStatus["FAILURE"] = "failure";
46
+ ActivityStatus["PENDING"] = "pending";
47
+ ActivityStatus["WARNING"] = "warning";
48
+ return ActivityStatus;
49
+ }({});
50
+ let ActivitySeverity = /* @__PURE__ */ function(ActivitySeverity) {
51
+ ActivitySeverity["LOW"] = "low";
52
+ ActivitySeverity["MEDIUM"] = "medium";
53
+ ActivitySeverity["HIGH"] = "high";
54
+ ActivitySeverity["CRITICAL"] = "critical";
55
+ return ActivitySeverity;
56
+ }({});
57
+ /** Thrown by SDK operations the current activity owner does not expose. */
58
+ var ActivityOperationUnsupportedError = class ActivityOperationUnsupportedError extends SDKError {
59
+ constructor(operation, guidance) {
60
+ super(`ActivityModule.${operation} is not supported by the workspace activity owner: ${guidance}`, "ACTIVITY_OPERATION_UNSUPPORTED", { operation });
61
+ this.name = "ActivityOperationUnsupportedError";
62
+ Object.setPrototypeOf(this, ActivityOperationUnsupportedError.prototype);
63
+ }
64
+ };
65
+ /**
66
+ * `ActivityLog` fields selected from wspace-activity-svc. Every name here must exist on the
67
+ * owner's published `ActivityLog` type (see tests/activity-module.test.ts).
68
+ */
69
+ const ACTIVITY_LOG_SELECTION = `
70
+ id
71
+ userId
72
+ action
73
+ description
74
+ details
75
+ timestamp
76
+ productId
77
+ workspaceId
78
+ resourceType
79
+ resourceId
80
+ targetUserId
81
+ ipAddress
82
+ userAgent
83
+ actorType
84
+ onBehalfOf
85
+ context {
86
+ projectId
87
+ custom
88
+ }
89
+ `;
90
+ const RECORD_ACTIVITY_MUTATION = `
91
+ mutation RecordActivity($input: RecordActivityInput!) {
92
+ recordActivity(input: $input) {
93
+ ${ACTIVITY_LOG_SELECTION}
94
+ }
95
+ }
96
+ `;
97
+ const WORKSPACE_ACTIVITY_SLICE_QUERY = `
98
+ query GetWorkspaceActivitySlice($filter: ActivityLogFilter!) {
99
+ getWorkspaceActivitySlice(filter: $filter) {
100
+ ${ACTIVITY_LOG_SELECTION}
101
+ }
102
+ activityCount(filter: $filter)
103
+ }
104
+ `;
105
+ /**
106
+ * Keys the SDK stores inside `metadata`/`details` for its own fields. The owner overwrites
107
+ * `metadata.ipAddress`/`metadata.userAgent` with the relaying request's values, so the end
108
+ * user's request details travel under their own keys.
109
+ */
110
+ const SDK_DETAIL_KEYS = [
111
+ "activityType",
112
+ "status",
113
+ "severity",
114
+ "duration",
115
+ "organizationId",
116
+ "projectId",
117
+ "requestIpAddress",
118
+ "requestUserAgent",
119
+ "errorMessage",
120
+ "ipAddress",
121
+ "userAgent"
122
+ ];
123
+ function readRecord(value) {
124
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
125
+ }
126
+ function readString(value) {
127
+ return typeof value === "string" && value.length > 0 ? value : void 0;
128
+ }
129
+ function readEnum(values, value, fallback) {
130
+ const allowed = Object.values(values);
131
+ return typeof value === "string" && allowed.includes(value) ? value : fallback;
132
+ }
133
+ /** Remove undefined entries so the payload only names fields the caller actually set. */
134
+ function compact(input) {
135
+ return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0));
136
+ }
137
+ /**
138
+ * Build the wspace-activity-svc `RecordActivityInput` for an SDK activity.
139
+ * Exported for unit tests.
140
+ */
141
+ function buildRecordActivityInput(options, context = {}) {
142
+ const severity = options.severity ?? "low";
143
+ const metadata = compact({
144
+ ...options.metadata,
145
+ activityType: options.activityType,
146
+ status: options.status,
147
+ severity,
148
+ duration: options.duration,
149
+ errorMessage: options.errorMessage,
150
+ organizationId: options.organizationId,
151
+ projectId: options.projectId,
152
+ requestIpAddress: options.ipAddress,
153
+ requestUserAgent: options.userAgent
154
+ });
155
+ const activityContext = compact({
156
+ workspaceId: options.workspaceId,
157
+ userId: options.userId,
158
+ projectId: options.projectId,
159
+ custom: options.organizationId ? { organizationId: options.organizationId } : void 0
160
+ });
161
+ return compact({
162
+ action: options.action,
163
+ description: options.description,
164
+ resourceType: options.resourceType,
165
+ resourceId: options.resourceId,
166
+ workspaceId: options.workspaceId,
167
+ productId: options.productId ?? context.productId,
168
+ targetUserId: options.targetUserId,
169
+ teamId: options.teamId,
170
+ success: options.status !== "failure",
171
+ errorMessage: options.errorMessage,
172
+ actorType: options.actorType,
173
+ onBehalfOf: options.onBehalfOf,
174
+ context: activityContext,
175
+ metadata,
176
+ dedupeKey: options.dedupeKey ?? `sdk-activity:${randomUUID()}`
177
+ });
178
+ }
179
+ /**
180
+ * Rebuild the SDK `Activity` shape from an owner row. Fields the owner has no column for are
181
+ * read back from the persisted `details`. Exported for unit tests.
182
+ */
183
+ function toActivity(record) {
184
+ const details = readRecord(record.details) ?? {};
185
+ const custom = readRecord(record.context?.custom);
186
+ const metadata = {};
187
+ for (const [key, value] of Object.entries(details)) if (!SDK_DETAIL_KEYS.includes(key)) metadata[key] = value;
188
+ const duration = details["duration"];
189
+ return {
190
+ id: record.id,
191
+ userId: record.userId,
192
+ activityType: readEnum(ActivityType, details["activityType"], "custom"),
193
+ resourceType: record.resourceType ?? "",
194
+ resourceId: record.resourceId ?? void 0,
195
+ action: record.action,
196
+ status: readEnum(ActivityStatus, details["status"], "success"),
197
+ workspaceId: record.workspaceId ?? void 0,
198
+ organizationId: readString(details["organizationId"]) ?? readString(custom?.["organizationId"]),
199
+ projectId: record.context?.projectId ?? readString(details["projectId"]),
200
+ productId: record.productId ?? void 0,
201
+ description: record.description ?? void 0,
202
+ targetUserId: record.targetUserId ?? void 0,
203
+ actorType: record.actorType ?? void 0,
204
+ onBehalfOf: record.onBehalfOf ?? void 0,
205
+ ipAddress: readString(details["requestIpAddress"]) ?? record.ipAddress ?? void 0,
206
+ userAgent: readString(details["requestUserAgent"]) ?? record.userAgent ?? void 0,
207
+ metadata,
208
+ severity: readEnum(ActivitySeverity, details["severity"], "low"),
209
+ errorMessage: readString(details["errorMessage"]),
210
+ duration: typeof duration === "number" && Number.isFinite(duration) ? duration : void 0,
211
+ createdAt: record.timestamp
212
+ };
213
+ }
214
+ /**
215
+ * Build the owner's `ActivityLogFilter` for an SDK read. Filters the owner cannot apply are
216
+ * rejected rather than dropped, because dropping them would return rows the caller excluded.
217
+ * Exported for unit tests.
218
+ */
219
+ function buildActivityLogFilter(options) {
220
+ if (!options.workspaceId) throw new ValidationError("workspaceId is required to read activities");
221
+ const unsupported = [
222
+ "organizationId",
223
+ "projectId",
224
+ "activityType",
225
+ "status",
226
+ "severity",
227
+ "search"
228
+ ].filter((key) => options[key] !== void 0);
229
+ if (options.sortBy !== void 0 && options.sortBy !== "createdAt") unsupported.push("sortBy");
230
+ if (options.sortOrder !== void 0 && options.sortOrder !== "desc") unsupported.push("sortOrder");
231
+ if (unsupported.length > 0) throw new ValidationError(`Activity filters not supported by the workspace activity owner: ${unsupported.join(", ")}`, { unsupported });
232
+ return compact({
233
+ workspaceId: options.workspaceId,
234
+ userId: options.userId,
235
+ action: options.action,
236
+ resourceType: options.resourceType,
237
+ resourceId: options.resourceId,
238
+ targetUserId: options.targetUserId,
239
+ startDate: options.startDate,
240
+ endDate: options.endDate,
241
+ limit: options.limit ?? 50,
242
+ offset: options.offset ?? 0
243
+ });
244
+ }
245
+ /**
246
+ * Activity Tracking Module
247
+ */
248
+ var ActivityModule = class {
249
+ client;
250
+ context;
251
+ constructor(client, context) {
252
+ this.client = client;
253
+ this.context = context;
254
+ }
255
+ /**
256
+ * Log activity
257
+ *
258
+ * The write is relayed as a platform service acting for `userId`, the same identity
259
+ * transport `trackOperation` uses, so the owner records the end user as the actor and
260
+ * honours `actorType`/`onBehalfOf` from the input.
261
+ */
262
+ async log(options) {
263
+ if (!options.userId) throw new ValidationError("User ID is required");
264
+ if (!options.activityType) throw new ValidationError("Activity type is required");
265
+ if (!options.resourceType) throw new ValidationError("Resource type is required");
266
+ if (!options.action) throw new ValidationError("Action is required");
267
+ if (!options.status) throw new ValidationError("Status is required");
268
+ markExplicitActivity();
269
+ logger.debug("[Activity] Logging activity", {
270
+ userId: options.userId,
271
+ action: options.action,
272
+ resourceType: options.resourceType
273
+ });
274
+ const input = buildRecordActivityInput(options, this.context);
275
+ const requestContext = {
276
+ ...this.context,
277
+ actorId: options.userId,
278
+ actorType: "service",
279
+ workspaceId: options.workspaceId ?? this.context.workspaceId
280
+ };
281
+ const activity = toActivity((await this.client.query(RECORD_ACTIVITY_MUTATION, { input }, requestContext)).recordActivity);
282
+ logger.info("[Activity] Activity logged", { activityId: activity.id });
283
+ return activity;
284
+ }
285
+ /**
286
+ * Log activity with automatic status detection
287
+ */
288
+ async logSuccess(userId, action, resourceType, resourceId, metadata) {
289
+ return this.log({
290
+ userId,
291
+ action,
292
+ resourceType,
293
+ resourceId,
294
+ activityType: this.inferActivityType(action),
295
+ status: "success",
296
+ severity: "low",
297
+ metadata,
298
+ workspaceId: this.context.workspaceId
299
+ });
300
+ }
301
+ /**
302
+ * Log failed activity
303
+ */
304
+ async logFailure(userId, action, resourceType, errorMessage, resourceId, metadata) {
305
+ return this.log({
306
+ userId,
307
+ action,
308
+ resourceType,
309
+ resourceId,
310
+ activityType: this.inferActivityType(action),
311
+ status: "failure",
312
+ severity: "high",
313
+ errorMessage,
314
+ metadata,
315
+ workspaceId: this.context.workspaceId
316
+ });
317
+ }
318
+ /**
319
+ * Get one workspace's activities, newest first.
320
+ *
321
+ * Reads the owner's workspace-scoped slice (`getWorkspaceActivitySlice`) together with the
322
+ * matching `activityCount`, so `total` counts every row the filter matches, not just the page.
323
+ */
324
+ async getActivities(options) {
325
+ logger.debug("[Activity] Getting activities", options);
326
+ const filter = buildActivityLogFilter(options);
327
+ const requestContext = {
328
+ ...this.context,
329
+ workspaceId: options.workspaceId
330
+ };
331
+ const response = await this.client.query(WORKSPACE_ACTIVITY_SLICE_QUERY, { filter }, requestContext);
332
+ return {
333
+ activities: response.getWorkspaceActivitySlice.map(toActivity),
334
+ total: response.activityCount
335
+ };
336
+ }
337
+ /**
338
+ * @deprecated The workspace activity owner has no read-by-id operation. Use
339
+ * {@link getActivities} with `resourceId`/`action` filters instead.
340
+ */
341
+ async getActivity(_activityId) {
342
+ throw new ActivityOperationUnsupportedError("getActivity", "use getActivities with a workspace filter");
343
+ }
344
+ /**
345
+ * @deprecated The workspace activity owner has no statistics operation. Use
346
+ * {@link getActivities} (its `total` is the owner's `activityCount`) per filter instead.
347
+ */
348
+ async getStats(_options) {
349
+ throw new ActivityOperationUnsupportedError("getStats", "use getActivities and its total per filter");
350
+ }
351
+ /**
352
+ * @deprecated Retention is enforced by the activity owner's retention policy and legal holds;
353
+ * there is no client-driven cleanup operation.
354
+ */
355
+ async cleanup(_olderThanDays, _workspaceId) {
356
+ throw new ActivityOperationUnsupportedError("cleanup", "retention is enforced by the activity owner");
357
+ }
358
+ /**
359
+ * @deprecated The workspace activity owner exports through `exportActivityLogsSiem`
360
+ * (CEF/LEEF/JSON lines); there is no CSV export operation.
361
+ */
362
+ async exportToCSV(_options) {
363
+ throw new ActivityOperationUnsupportedError("exportToCSV", "use the owner exportActivityLogsSiem query");
364
+ }
365
+ /**
366
+ * Infer activity type from action string
367
+ */
368
+ inferActivityType(action) {
369
+ const actionLower = action.toLowerCase();
370
+ if (actionLower.includes("create") || actionLower.includes("add")) return "create";
371
+ if (actionLower.includes("update") || actionLower.includes("edit") || actionLower.includes("modify")) return "update";
372
+ if (actionLower.includes("delete") || actionLower.includes("remove")) return "delete";
373
+ if (actionLower.includes("read") || actionLower.includes("view") || actionLower.includes("get")) return "read";
374
+ if (actionLower.includes("login") || actionLower.includes("signin")) return "login";
375
+ if (actionLower.includes("logout") || actionLower.includes("signout")) return "logout";
376
+ if (actionLower.includes("export")) return "export";
377
+ if (actionLower.includes("import")) return "import";
378
+ if (actionLower.includes("share")) return "share";
379
+ if (actionLower.includes("download")) return "download";
380
+ if (actionLower.includes("upload")) return "upload";
381
+ if (actionLower.includes("execute") || actionLower.includes("run")) return "execute";
382
+ if (actionLower.includes("approve")) return "approve";
383
+ if (actionLower.includes("reject")) return "reject";
384
+ return "custom";
385
+ }
386
+ };
387
+
388
+ export { ACTIVITY_LOG_SELECTION, ActivityModule, ActivityOperationUnsupportedError, ActivitySeverity, ActivityStatus, ActivityType, RECORD_ACTIVITY_MUTATION, WORKSPACE_ACTIVITY_SLICE_QUERY, buildActivityLogFilter, buildRecordActivityInput, toActivity };
389
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/activity/index.ts"],"sourcesContent":["/**\n * Activity Tracking Module\n *\n * Audit trail writes and reads against the workspace activity owner\n * (`wspace-activity-svc`), reached through the configured workspace internal gateway.\n *\n * The SDK keeps its own descriptive vocabulary (`activityType`, `status`, `severity`,\n * `duration`, ...) for callers, but the owning subgraph's `ActivityLog` type does not have\n * those columns. This module therefore maps between the two contracts explicitly:\n *\n * - writes send only fields `RecordActivityInput` defines and carry the SDK-only fields in\n * `metadata`, which the owner persists verbatim in the row's `details` column;\n * - reads select only fields `ActivityLog` defines and rebuild the SDK shape from the row\n * plus those persisted `details`.\n *\n * Selecting a field the owner does not define fails GraphQL validation for the whole\n * operation, so the selections below are pinned by unit tests against the published schema.\n */\n\nimport { randomUUID } from 'node:crypto';\nimport type { BurdenoffGraphQLClient } from '../client/graphql.js';\nimport type { SDKContext } from '../types/index.js';\nimport { SDKError, ValidationError } from '../types/index.js';\nimport { logger } from '../logger/index.js';\nimport { markExplicitActivity } from './explicit-activity-scope.js';\n\nexport enum ActivityType {\n CREATE = 'create',\n READ = 'read',\n UPDATE = 'update',\n DELETE = 'delete',\n LOGIN = 'login',\n LOGOUT = 'logout',\n EXPORT = 'export',\n IMPORT = 'import',\n SHARE = 'share',\n DOWNLOAD = 'download',\n UPLOAD = 'upload',\n EXECUTE = 'execute',\n APPROVE = 'approve',\n REJECT = 'reject',\n CUSTOM = 'custom',\n}\n\nexport enum ActivityStatus {\n SUCCESS = 'success',\n FAILURE = 'failure',\n PENDING = 'pending',\n WARNING = 'warning',\n}\n\nexport enum ActivitySeverity {\n LOW = 'low',\n MEDIUM = 'medium',\n HIGH = 'high',\n CRITICAL = 'critical',\n}\n\n/** Kinds of actor the activity owner records (the gateway `x-actor-type` vocabulary). */\nexport type ActivityActorType = 'user' | 'app' | 'service' | 'super_admin';\n\nexport interface LogActivityOptions {\n /** User performing the action */\n userId: string;\n /** Type of activity */\n activityType: ActivityType;\n /** Resource type being acted upon */\n resourceType: string;\n /** Resource ID */\n resourceId?: string;\n /** Action performed */\n action: string;\n /** Activity status */\n status: ActivityStatus;\n /** Workspace context */\n workspaceId?: string;\n /** Organization context */\n organizationId?: string;\n /** Project context */\n projectId?: string;\n /** Product that emitted the activity (defaults to the SDK context's productId) */\n productId?: string;\n /** Human-readable description (the owner generates one when omitted) */\n description?: string;\n /** User affected by the action, when different from the actor */\n targetUserId?: string;\n /** Team (group) the action belongs to */\n teamId?: string;\n /** Kind of actor that performed the action, when the caller can vouch for it */\n actorType?: ActivityActorType;\n /** User on whose behalf the action was taken (for an agent action: the human who started it) */\n onBehalfOf?: string;\n /**\n * Idempotency key. Replaying a write with the same key returns the existing row. A random\n * key is generated when omitted so the client's own transport retries never duplicate rows.\n */\n dedupeKey?: string;\n /** IP address of the end user's request */\n ipAddress?: string;\n /** User agent of the end user's request */\n userAgent?: string;\n /** Additional metadata */\n metadata?: Record<string, unknown>;\n /** Severity level */\n severity?: ActivitySeverity;\n /** Error message if failed */\n errorMessage?: string;\n /** Duration in milliseconds */\n duration?: number;\n}\n\nexport interface Activity {\n id: string;\n userId: string;\n activityType: ActivityType;\n resourceType: string;\n resourceId?: string;\n action: string;\n status: ActivityStatus;\n workspaceId?: string;\n organizationId?: string;\n projectId?: string;\n productId?: string;\n description?: string;\n targetUserId?: string;\n actorType?: string;\n onBehalfOf?: string;\n ipAddress?: string;\n userAgent?: string;\n metadata?: Record<string, unknown>;\n severity: ActivitySeverity;\n errorMessage?: string;\n duration?: number;\n createdAt: string;\n}\n\nexport interface GetActivitiesOptions {\n /** Workspace to read (required: the owner scopes every service read to one workspace) */\n workspaceId?: string;\n /** Filter by user */\n userId?: string;\n /** Filter by exact action */\n action?: string;\n /** Filter by resource type */\n resourceType?: string;\n /** Filter by resource ID */\n resourceId?: string;\n /** Filter by the user affected by the action */\n targetUserId?: string;\n /** Filter by date range */\n startDate?: string;\n endDate?: string;\n /** Limit number of results (the owner caps a page at 200) */\n limit?: number;\n /** Offset for pagination */\n offset?: number;\n /**\n * Not supported by the activity owner. Passing any of the fields below throws a\n * `ValidationError` instead of silently returning an unfiltered page.\n */\n organizationId?: string;\n projectId?: string;\n activityType?: ActivityType;\n status?: ActivityStatus;\n severity?: ActivitySeverity;\n search?: string;\n /** Only `createdAt` (newest first) is supported */\n sortBy?: 'createdAt' | 'duration' | 'severity';\n /** Only `desc` is supported */\n sortOrder?: 'asc' | 'desc';\n}\n\nexport interface ActivityStats {\n totalActivities: number;\n successCount: number;\n failureCount: number;\n pendingCount: number;\n warningCount: number;\n averageDuration?: number;\n activitiesByType: Record<string, number>;\n activitiesBySeverity: Record<string, number>;\n topUsers: Array<{ userId: string; count: number }>;\n topResources: Array<{ resourceType: string; count: number }>;\n}\n\n/** Thrown by SDK operations the current activity owner does not expose. */\nexport class ActivityOperationUnsupportedError extends SDKError {\n constructor(operation: string, guidance: string) {\n super(\n `ActivityModule.${operation} is not supported by the workspace activity owner: ${guidance}`,\n 'ACTIVITY_OPERATION_UNSUPPORTED',\n { operation }\n );\n this.name = 'ActivityOperationUnsupportedError';\n Object.setPrototypeOf(this, ActivityOperationUnsupportedError.prototype);\n }\n}\n\n/**\n * `ActivityLog` fields selected from wspace-activity-svc. Every name here must exist on the\n * owner's published `ActivityLog` type (see tests/activity-module.test.ts).\n */\nexport const ACTIVITY_LOG_SELECTION = `\n id\n userId\n action\n description\n details\n timestamp\n productId\n workspaceId\n resourceType\n resourceId\n targetUserId\n ipAddress\n userAgent\n actorType\n onBehalfOf\n context {\n projectId\n custom\n }\n`;\n\nexport const RECORD_ACTIVITY_MUTATION = `\n mutation RecordActivity($input: RecordActivityInput!) {\n recordActivity(input: $input) {\n ${ACTIVITY_LOG_SELECTION}\n }\n }\n`;\n\nexport const WORKSPACE_ACTIVITY_SLICE_QUERY = `\n query GetWorkspaceActivitySlice($filter: ActivityLogFilter!) {\n getWorkspaceActivitySlice(filter: $filter) {\n ${ACTIVITY_LOG_SELECTION}\n }\n activityCount(filter: $filter)\n }\n`;\n\n/** Raw `ActivityLog` row as selected by {@link ACTIVITY_LOG_SELECTION}. */\nexport interface ActivityLogRecord {\n id: string;\n userId: string;\n action: string;\n description?: string | null;\n details?: unknown;\n timestamp: string;\n productId?: string | null;\n workspaceId?: string | null;\n resourceType?: string | null;\n resourceId?: string | null;\n targetUserId?: string | null;\n ipAddress?: string | null;\n userAgent?: string | null;\n actorType?: string | null;\n onBehalfOf?: string | null;\n context?: { projectId?: string | null; custom?: unknown } | null;\n}\n\n/**\n * Keys the SDK stores inside `metadata`/`details` for its own fields. The owner overwrites\n * `metadata.ipAddress`/`metadata.userAgent` with the relaying request's values, so the end\n * user's request details travel under their own keys.\n */\nconst SDK_DETAIL_KEYS = [\n 'activityType',\n 'status',\n 'severity',\n 'duration',\n 'organizationId',\n 'projectId',\n 'requestIpAddress',\n 'requestUserAgent',\n 'errorMessage',\n 'ipAddress',\n 'userAgent',\n] as const;\n\nfunction readRecord(value: unknown): Record<string, unknown> | undefined {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\nfunction readString(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\nfunction readEnum<T extends string>(values: Record<string, T>, value: unknown, fallback: T): T {\n const allowed: readonly string[] = Object.values(values);\n return typeof value === 'string' && allowed.includes(value) ? (value as T) : fallback;\n}\n\n/** Remove undefined entries so the payload only names fields the caller actually set. */\nfunction compact(input: Record<string, unknown>): Record<string, unknown> {\n return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== undefined));\n}\n\n/**\n * Build the wspace-activity-svc `RecordActivityInput` for an SDK activity.\n * Exported for unit tests.\n */\nexport function buildRecordActivityInput(\n options: LogActivityOptions,\n context: SDKContext = {}\n): Record<string, unknown> {\n const severity = options.severity ?? ActivitySeverity.LOW;\n const metadata = compact({\n ...options.metadata,\n activityType: options.activityType,\n status: options.status,\n severity,\n duration: options.duration,\n // The owner stores errorMessage in a column it does not expose on ActivityLog; keeping a\n // copy in details is what lets a read return it.\n errorMessage: options.errorMessage,\n organizationId: options.organizationId,\n projectId: options.projectId,\n requestIpAddress: options.ipAddress,\n requestUserAgent: options.userAgent,\n });\n\n const activityContext = compact({\n workspaceId: options.workspaceId,\n userId: options.userId,\n projectId: options.projectId,\n custom: options.organizationId ? { organizationId: options.organizationId } : undefined,\n });\n\n return compact({\n action: options.action,\n description: options.description,\n resourceType: options.resourceType,\n resourceId: options.resourceId,\n workspaceId: options.workspaceId,\n productId: options.productId ?? context.productId,\n targetUserId: options.targetUserId,\n teamId: options.teamId,\n success: options.status !== ActivityStatus.FAILURE,\n errorMessage: options.errorMessage,\n actorType: options.actorType,\n onBehalfOf: options.onBehalfOf,\n context: activityContext,\n metadata,\n dedupeKey: options.dedupeKey ?? `sdk-activity:${randomUUID()}`,\n });\n}\n\n/**\n * Rebuild the SDK `Activity` shape from an owner row. Fields the owner has no column for are\n * read back from the persisted `details`. Exported for unit tests.\n */\nexport function toActivity(record: ActivityLogRecord): Activity {\n const details = readRecord(record.details) ?? {};\n const custom = readRecord(record.context?.custom);\n\n const metadata: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(details)) {\n if (!(SDK_DETAIL_KEYS as readonly string[]).includes(key)) metadata[key] = value;\n }\n\n const duration = details['duration'];\n\n return {\n id: record.id,\n userId: record.userId,\n activityType: readEnum(ActivityType, details['activityType'], ActivityType.CUSTOM),\n resourceType: record.resourceType ?? '',\n resourceId: record.resourceId ?? undefined,\n action: record.action,\n status: readEnum(ActivityStatus, details['status'], ActivityStatus.SUCCESS),\n workspaceId: record.workspaceId ?? undefined,\n organizationId: readString(details['organizationId']) ?? readString(custom?.['organizationId']),\n projectId: record.context?.projectId ?? readString(details['projectId']),\n productId: record.productId ?? undefined,\n description: record.description ?? undefined,\n targetUserId: record.targetUserId ?? undefined,\n actorType: record.actorType ?? undefined,\n onBehalfOf: record.onBehalfOf ?? undefined,\n ipAddress: readString(details['requestIpAddress']) ?? record.ipAddress ?? undefined,\n userAgent: readString(details['requestUserAgent']) ?? record.userAgent ?? undefined,\n metadata,\n severity: readEnum(ActivitySeverity, details['severity'], ActivitySeverity.LOW),\n errorMessage: readString(details['errorMessage']),\n duration: typeof duration === 'number' && Number.isFinite(duration) ? duration : undefined,\n createdAt: record.timestamp,\n };\n}\n\n/**\n * Build the owner's `ActivityLogFilter` for an SDK read. Filters the owner cannot apply are\n * rejected rather than dropped, because dropping them would return rows the caller excluded.\n * Exported for unit tests.\n */\nexport function buildActivityLogFilter(options: GetActivitiesOptions): Record<string, unknown> {\n if (!options.workspaceId) {\n throw new ValidationError('workspaceId is required to read activities');\n }\n\n const unsupported: string[] = (\n ['organizationId', 'projectId', 'activityType', 'status', 'severity', 'search'] as const\n ).filter((key) => options[key] !== undefined);\n if (options.sortBy !== undefined && options.sortBy !== 'createdAt') unsupported.push('sortBy');\n if (options.sortOrder !== undefined && options.sortOrder !== 'desc') unsupported.push('sortOrder');\n if (unsupported.length > 0) {\n throw new ValidationError(\n `Activity filters not supported by the workspace activity owner: ${unsupported.join(', ')}`,\n { unsupported }\n );\n }\n\n return compact({\n workspaceId: options.workspaceId,\n userId: options.userId,\n action: options.action,\n resourceType: options.resourceType,\n resourceId: options.resourceId,\n targetUserId: options.targetUserId,\n startDate: options.startDate,\n endDate: options.endDate,\n limit: options.limit ?? 50,\n offset: options.offset ?? 0,\n });\n}\n\n/**\n * Activity Tracking Module\n */\nexport class ActivityModule {\n constructor(\n private client: BurdenoffGraphQLClient,\n private context: SDKContext\n ) {}\n\n /**\n * Log activity\n *\n * The write is relayed as a platform service acting for `userId`, the same identity\n * transport `trackOperation` uses, so the owner records the end user as the actor and\n * honours `actorType`/`onBehalfOf` from the input.\n */\n public async log(options: LogActivityOptions): Promise<Activity> {\n // Validate required fields\n if (!options.userId) {\n throw new ValidationError('User ID is required');\n }\n\n if (!options.activityType) {\n throw new ValidationError('Activity type is required');\n }\n\n if (!options.resourceType) {\n throw new ValidationError('Resource type is required');\n }\n\n if (!options.action) {\n throw new ValidationError('Action is required');\n }\n\n if (!options.status) {\n throw new ValidationError('Status is required');\n }\n\n // A validated explicit write: the mutation-audit backstop skips its generic row for this operation.\n markExplicitActivity();\n\n logger.debug('[Activity] Logging activity', {\n userId: options.userId,\n action: options.action,\n resourceType: options.resourceType,\n });\n\n const input = buildRecordActivityInput(options, this.context);\n const requestContext: SDKContext = {\n ...this.context,\n actorId: options.userId,\n actorType: 'service',\n workspaceId: options.workspaceId ?? this.context.workspaceId,\n };\n\n const response = await this.client.query<{ recordActivity: ActivityLogRecord }>(\n RECORD_ACTIVITY_MUTATION,\n { input },\n requestContext\n );\n\n const activity = toActivity(response.recordActivity);\n logger.info('[Activity] Activity logged', { activityId: activity.id });\n return activity;\n }\n\n /**\n * Log activity with automatic status detection\n */\n public async logSuccess(\n userId: string,\n action: string,\n resourceType: string,\n resourceId?: string,\n metadata?: Record<string, unknown>\n ): Promise<Activity> {\n return this.log({\n userId,\n action,\n resourceType,\n resourceId,\n activityType: this.inferActivityType(action),\n status: ActivityStatus.SUCCESS,\n severity: ActivitySeverity.LOW,\n metadata,\n workspaceId: this.context.workspaceId,\n });\n }\n\n /**\n * Log failed activity\n */\n public async logFailure(\n userId: string,\n action: string,\n resourceType: string,\n errorMessage: string,\n resourceId?: string,\n metadata?: Record<string, unknown>\n ): Promise<Activity> {\n return this.log({\n userId,\n action,\n resourceType,\n resourceId,\n activityType: this.inferActivityType(action),\n status: ActivityStatus.FAILURE,\n severity: ActivitySeverity.HIGH,\n errorMessage,\n metadata,\n workspaceId: this.context.workspaceId,\n });\n }\n\n /**\n * Get one workspace's activities, newest first.\n *\n * Reads the owner's workspace-scoped slice (`getWorkspaceActivitySlice`) together with the\n * matching `activityCount`, so `total` counts every row the filter matches, not just the page.\n */\n public async getActivities(options: GetActivitiesOptions): Promise<{\n activities: Activity[];\n total: number;\n }> {\n logger.debug('[Activity] Getting activities', options);\n\n const filter = buildActivityLogFilter(options);\n const requestContext: SDKContext = {\n ...this.context,\n workspaceId: options.workspaceId,\n };\n\n const response = await this.client.query<{\n getWorkspaceActivitySlice: ActivityLogRecord[];\n activityCount: number;\n }>(WORKSPACE_ACTIVITY_SLICE_QUERY, { filter }, requestContext);\n\n return {\n activities: response.getWorkspaceActivitySlice.map(toActivity),\n total: response.activityCount,\n };\n }\n\n /**\n * @deprecated The workspace activity owner has no read-by-id operation. Use\n * {@link getActivities} with `resourceId`/`action` filters instead.\n */\n public async getActivity(_activityId: string): Promise<Activity> {\n throw new ActivityOperationUnsupportedError('getActivity', 'use getActivities with a workspace filter');\n }\n\n /**\n * @deprecated The workspace activity owner has no statistics operation. Use\n * {@link getActivities} (its `total` is the owner's `activityCount`) per filter instead.\n */\n public async getStats(_options: Omit<GetActivitiesOptions, 'limit' | 'offset'>): Promise<ActivityStats> {\n throw new ActivityOperationUnsupportedError('getStats', 'use getActivities and its total per filter');\n }\n\n /**\n * @deprecated Retention is enforced by the activity owner's retention policy and legal holds;\n * there is no client-driven cleanup operation.\n */\n public async cleanup(_olderThanDays: number, _workspaceId?: string): Promise<number> {\n throw new ActivityOperationUnsupportedError('cleanup', 'retention is enforced by the activity owner');\n }\n\n /**\n * @deprecated The workspace activity owner exports through `exportActivityLogsSiem`\n * (CEF/LEEF/JSON lines); there is no CSV export operation.\n */\n public async exportToCSV(_options: GetActivitiesOptions): Promise<string> {\n throw new ActivityOperationUnsupportedError('exportToCSV', 'use the owner exportActivityLogsSiem query');\n }\n\n /**\n * Infer activity type from action string\n */\n private inferActivityType(action: string): ActivityType {\n const actionLower = action.toLowerCase();\n\n if (actionLower.includes('create') || actionLower.includes('add')) {\n return ActivityType.CREATE;\n }\n if (actionLower.includes('update') || actionLower.includes('edit') || actionLower.includes('modify')) {\n return ActivityType.UPDATE;\n }\n if (actionLower.includes('delete') || actionLower.includes('remove')) {\n return ActivityType.DELETE;\n }\n if (actionLower.includes('read') || actionLower.includes('view') || actionLower.includes('get')) {\n return ActivityType.READ;\n }\n if (actionLower.includes('login') || actionLower.includes('signin')) {\n return ActivityType.LOGIN;\n }\n if (actionLower.includes('logout') || actionLower.includes('signout')) {\n return ActivityType.LOGOUT;\n }\n if (actionLower.includes('export')) {\n return ActivityType.EXPORT;\n }\n if (actionLower.includes('import')) {\n return ActivityType.IMPORT;\n }\n if (actionLower.includes('share')) {\n return ActivityType.SHARE;\n }\n if (actionLower.includes('download')) {\n return ActivityType.DOWNLOAD;\n }\n if (actionLower.includes('upload')) {\n return ActivityType.UPLOAD;\n }\n if (actionLower.includes('execute') || actionLower.includes('run')) {\n return ActivityType.EXECUTE;\n }\n if (actionLower.includes('approve')) {\n return ActivityType.APPROVE;\n }\n if (actionLower.includes('reject')) {\n return ActivityType.REJECT;\n }\n\n return ActivityType.CUSTOM;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAY,eAAL;CACL;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AACF;AAEA,IAAY,iBAAL;CACL;CACA;CACA;CACA;;AACF;AAEA,IAAY,mBAAL;CACL;CACA;CACA;CACA;;AACF;;AAkIA,IAAa,oCAAb,MAAa,0CAA0C,SAAS;CAC9D,YAAY,WAAmB,UAAkB;EAC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, e as AiCreditFetch, f as AiCreditGate, g as AiCreditGuardVerdict, h as AiCreditInputError, j as AiCreditInputErrorCode, k as AiCreditLogger, l as AiCreditMeter, m as AiCreditMeterOptions, n as AiCreditPricingTransport, o as AiCreditQuoteInput, p as AiCreditSkipReason, q as AiTokenUsageReport, r as AiTokenUsageValidationError, s as AiTokenUsageViolation, W as WorkspaceQuotaUsage, t as aiCreditIdempotencyHash, u as aiCreditQuotaName, v as defaultAiCreditHashPrefix, w as encodeAiCreditHashComponent, x as isAiCreditInputError, y as validateAiTokenUsage } from '../index-CmfPeQza.js';
2
- import '../types-DgJ4lDYA.js';
3
- import '../layer-Cv9vSwBx.js';
1
+ import { C as AiCreditPricingTransport, D as WorkspaceQuotaUsage, E as AiTokenUsageReport, S as AiCreditLogger, T as AiCreditSkipReason, _ as AiCreditChargeInput, a as AiCreditInputErrorCode, b as AiCreditGate, c as AiTokenUsageValidationError, d as aiCreditQuotaName, f as defaultAiCreditHashPrefix, g as AiCreditChargeGuard, h as AiCreditAllowance, i as AiCreditInputError, l as AiTokenUsageViolation, m as validateAiTokenUsage, n as AiCreditMeter, o as isAiCreditInputError, p as encodeAiCreditHashComponent, r as AiCreditMeterOptions, s as AI_CREDIT_MAX_TOKENS_PER_REPORT, u as aiCreditIdempotencyHash, v as AiCreditChargeResult, w as AiCreditQuoteInput, x as AiCreditGuardVerdict, y as AiCreditFetch } from "../index-FbXPfen7.js";
2
+ export { AI_CREDIT_MAX_TOKENS_PER_REPORT, type AiCreditAllowance, type AiCreditChargeGuard, type AiCreditChargeInput, type AiCreditChargeResult, type AiCreditFetch, type AiCreditGate, type AiCreditGuardVerdict, AiCreditInputError, type AiCreditInputErrorCode, type AiCreditLogger, AiCreditMeter, type AiCreditMeterOptions, type AiCreditPricingTransport, type AiCreditQuoteInput, type AiCreditSkipReason, type AiTokenUsageReport, type AiTokenUsageValidationError, type AiTokenUsageViolation, type WorkspaceQuotaUsage, aiCreditIdempotencyHash, aiCreditQuotaName, defaultAiCreditHashPrefix, encodeAiCreditHashComponent, isAiCreditInputError, validateAiTokenUsage };
@@ -1,5 +1,4 @@
1
- export { AI_CREDIT_MAX_TOKENS_PER_REPORT, AiCreditInputError, AiCreditMeter, aiCreditIdempotencyHash, aiCreditQuotaName, defaultAiCreditHashPrefix, encodeAiCreditHashComponent, isAiCreditInputError, validateAiTokenUsage } from '../chunk-MESLAC5W.js';
2
- import '../chunk-RU266375.js';
3
- import '../chunk-XE4OXN2W.js';
1
+ import { a as AI_CREDIT_MAX_TOKENS_PER_REPORT, c as defaultAiCreditHashPrefix, i as isAiCreditInputError, l as encodeAiCreditHashComponent, n as AiCreditMeter, o as aiCreditIdempotencyHash, r as AiCreditInputError, s as aiCreditQuotaName, u as validateAiTokenUsage } from "../ai-credits-xxfwGpHS.js";
2
+
3
+ export { AI_CREDIT_MAX_TOKENS_PER_REPORT, AiCreditInputError, AiCreditMeter, aiCreditIdempotencyHash, aiCreditQuotaName, defaultAiCreditHashPrefix, encodeAiCreditHashComponent, isAiCreditInputError, validateAiTokenUsage };
4
4
  //# sourceMappingURL=index.js.map
5
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
1
+ {"version":3,"file":"index.js","sources":[],"names":[],"mappings":""}