@burdenoff/be-sdk 2026.1110.1 → 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-PP534MBQ.js +0 -8
  299. package/dist/EventQueueFactory-PP534MBQ.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-7EISSMFP.js +0 -617
  313. package/dist/chunk-7EISSMFP.js.map +0 -1
  314. package/dist/chunk-A5F6Z5UE.js +0 -21
  315. package/dist/chunk-A5F6Z5UE.js.map +0 -1
  316. package/dist/chunk-A6DE32ZS.js +0 -1507
  317. package/dist/chunk-A6DE32ZS.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-DIOS6L7M.js +0 -690
  323. package/dist/chunk-DIOS6L7M.js.map +0 -1
  324. package/dist/chunk-DJNHR37J.js +0 -1185
  325. package/dist/chunk-DJNHR37J.js.map +0 -1
  326. package/dist/chunk-DRWH5XCJ.js +0 -876
  327. package/dist/chunk-DRWH5XCJ.js.map +0 -1
  328. package/dist/chunk-E4QNLVY4.js +0 -909
  329. package/dist/chunk-E4QNLVY4.js.map +0 -1
  330. package/dist/chunk-E6OAFS7A.js +0 -1346
  331. package/dist/chunk-E6OAFS7A.js.map +0 -1
  332. package/dist/chunk-EBDHIL7V.js +0 -774
  333. package/dist/chunk-EBDHIL7V.js.map +0 -1
  334. package/dist/chunk-ELU7VL3E.js +0 -245
  335. package/dist/chunk-ELU7VL3E.js.map +0 -1
  336. package/dist/chunk-FZRODKIN.js +0 -31
  337. package/dist/chunk-FZRODKIN.js.map +0 -1
  338. package/dist/chunk-GCIB76AJ.js +0 -882
  339. package/dist/chunk-GCIB76AJ.js.map +0 -1
  340. package/dist/chunk-HC6MPUIH.js +0 -1571
  341. package/dist/chunk-HC6MPUIH.js.map +0 -1
  342. package/dist/chunk-I3KOWRT3.js +0 -89
  343. package/dist/chunk-I3KOWRT3.js.map +0 -1
  344. package/dist/chunk-ID3WR4JS.js +0 -509
  345. package/dist/chunk-ID3WR4JS.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-K56L7NUR.js +0 -1444
  349. package/dist/chunk-K56L7NUR.js.map +0 -1
  350. package/dist/chunk-KH4TRQCO.js +0 -1063
  351. package/dist/chunk-KH4TRQCO.js.map +0 -1
  352. package/dist/chunk-KJOSPVB2.js +0 -57
  353. package/dist/chunk-KJOSPVB2.js.map +0 -1
  354. package/dist/chunk-KO2ZXZ7W.js +0 -61
  355. package/dist/chunk-KO2ZXZ7W.js.map +0 -1
  356. package/dist/chunk-KS2HQCJR.js +0 -56
  357. package/dist/chunk-KS2HQCJR.js.map +0 -1
  358. package/dist/chunk-LA5KPWZ2.js +0 -413
  359. package/dist/chunk-LA5KPWZ2.js.map +0 -1
  360. package/dist/chunk-MESLAC5W.js +0 -574
  361. package/dist/chunk-MESLAC5W.js.map +0 -1
  362. package/dist/chunk-MWPYA2HD.js +0 -94
  363. package/dist/chunk-MWPYA2HD.js.map +0 -1
  364. package/dist/chunk-NUB5GQTU.js +0 -270
  365. package/dist/chunk-NUB5GQTU.js.map +0 -1
  366. package/dist/chunk-O2JMZHNH.js +0 -1908
  367. package/dist/chunk-O2JMZHNH.js.map +0 -1
  368. package/dist/chunk-OBBCR6WY.js +0 -277
  369. package/dist/chunk-OBBCR6WY.js.map +0 -1
  370. package/dist/chunk-OBZQ4AJC.js +0 -272
  371. package/dist/chunk-OBZQ4AJC.js.map +0 -1
  372. package/dist/chunk-OXNCBE7P.js +0 -971
  373. package/dist/chunk-OXNCBE7P.js.map +0 -1
  374. package/dist/chunk-PBZFAAOM.js +0 -941
  375. package/dist/chunk-PYD44IHJ.js +0 -728
  376. package/dist/chunk-PYD44IHJ.js.map +0 -1
  377. package/dist/chunk-QVPIACWD.js +0 -679
  378. package/dist/chunk-QVPIACWD.js.map +0 -1
  379. package/dist/chunk-QWNNFE4P.js +0 -41
  380. package/dist/chunk-QWNNFE4P.js.map +0 -1
  381. package/dist/chunk-RU266375.js +0 -327
  382. package/dist/chunk-RU266375.js.map +0 -1
  383. package/dist/chunk-RYTSVGGA.js +0 -1624
  384. package/dist/chunk-RYTSVGGA.js.map +0 -1
  385. package/dist/chunk-RZOFS2BQ.js +0 -225
  386. package/dist/chunk-RZOFS2BQ.js.map +0 -1
  387. package/dist/chunk-SBS4S2PJ.js +0 -100
  388. package/dist/chunk-SBS4S2PJ.js.map +0 -1
  389. package/dist/chunk-SPRG6G6G.js +0 -530
  390. package/dist/chunk-SPRG6G6G.js.map +0 -1
  391. package/dist/chunk-STWFX5E2.js +0 -233
  392. package/dist/chunk-STWFX5E2.js.map +0 -1
  393. package/dist/chunk-UNASM5VJ.js +0 -419
  394. package/dist/chunk-UNASM5VJ.js.map +0 -1
  395. package/dist/chunk-VAT66FJA.js +0 -245
  396. package/dist/chunk-VAT66FJA.js.map +0 -1
  397. package/dist/chunk-VFCMR5GX.js +0 -49
  398. package/dist/chunk-VFCMR5GX.js.map +0 -1
  399. package/dist/chunk-VGAHZKNJ.js +0 -66
  400. package/dist/chunk-VGAHZKNJ.js.map +0 -1
  401. package/dist/chunk-VTJTAAXC.js +0 -627
  402. package/dist/chunk-VTJTAAXC.js.map +0 -1
  403. package/dist/chunk-VXVLKRU6.js +0 -758
  404. package/dist/chunk-VXVLKRU6.js.map +0 -1
  405. package/dist/chunk-WWUU5ETI.js +0 -163
  406. package/dist/chunk-WWUU5ETI.js.map +0 -1
  407. package/dist/chunk-XE4OXN2W.js +0 -10
  408. package/dist/chunk-XE4OXN2W.js.map +0 -1
  409. package/dist/chunk-XOJORS75.js +0 -1853
  410. package/dist/chunk-XOJORS75.js.map +0 -1
  411. package/dist/chunk-YMZEUTD2.js +0 -110
  412. package/dist/chunk-YMZEUTD2.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
@@ -1,1063 +0,0 @@
1
- import { APIError, ValidationError } from './chunk-I3KOWRT3.js';
2
- import { logger } from './chunk-RU266375.js';
3
- import { __export, __name } from './chunk-XE4OXN2W.js';
4
-
5
- // src/notifications/tenant-notifications.ts
6
- var tenant_notifications_exports = {};
7
- __export(tenant_notifications_exports, {
8
- NotificationChannel: () => NotificationChannel,
9
- NotificationPriority: () => NotificationPriority,
10
- NotificationType: () => NotificationType,
11
- TenantNotificationsModule: () => TenantNotificationsModule
12
- });
13
- var NotificationChannel = /* @__PURE__ */ (function(NotificationChannel3) {
14
- NotificationChannel3["EMAIL"] = "EMAIL";
15
- NotificationChannel3["SMS"] = "SMS";
16
- NotificationChannel3["PUSH"] = "PUSH";
17
- NotificationChannel3["IN_APP"] = "IN_APP";
18
- NotificationChannel3["WEBHOOK"] = "WEBHOOK";
19
- NotificationChannel3["WHATSAPP"] = "WHATSAPP";
20
- NotificationChannel3["TEAMS"] = "TEAMS";
21
- NotificationChannel3["SLACK"] = "SLACK";
22
- NotificationChannel3["TELEGRAM"] = "TELEGRAM";
23
- NotificationChannel3["DISCORD"] = "DISCORD";
24
- return NotificationChannel3;
25
- })({});
26
- var NotificationPriority = /* @__PURE__ */ (function(NotificationPriority2) {
27
- NotificationPriority2["LOW"] = "LOW";
28
- NotificationPriority2["MEDIUM"] = "MEDIUM";
29
- NotificationPriority2["HIGH"] = "HIGH";
30
- NotificationPriority2["URGENT"] = "URGENT";
31
- return NotificationPriority2;
32
- })({});
33
- var NotificationType = /* @__PURE__ */ (function(NotificationType3) {
34
- NotificationType3["TRANSACTIONAL"] = "TRANSACTIONAL";
35
- NotificationType3["MARKETING"] = "MARKETING";
36
- NotificationType3["SYSTEM"] = "SYSTEM";
37
- NotificationType3["ALERT"] = "ALERT";
38
- return NotificationType3;
39
- })({});
40
- var TenantNotificationsModule = class {
41
- static {
42
- __name(this, "TenantNotificationsModule");
43
- }
44
- client;
45
- context;
46
- constructor(client, context) {
47
- this.client = client;
48
- this.context = context;
49
- }
50
- /**
51
- * Send a single notification
52
- */
53
- async send(input, context) {
54
- this.validateSendInput(input);
55
- const notification = this.createNotificationInput(input);
56
- const callContext = {
57
- ...this.context,
58
- ...context
59
- };
60
- if (input.scheduledFor) {
61
- const response2 = await this.client.tenantQuery(`mutation ScheduleTenantNotification($input: ScheduleNotificationInput!) {
62
- scheduleNotification(input: $input) { notificationId status }
63
- }`, {
64
- input: {
65
- notification,
66
- scheduledFor: input.scheduledFor.toISOString(),
67
- timezone: input.recipient.timezone
68
- }
69
- }, callContext);
70
- const result2 = response2.scheduleNotification;
71
- if (!result2?.notificationId || result2.status !== "PENDING") {
72
- throw new APIError("Notification scheduling was not acknowledged", {
73
- operation: "scheduleNotification"
74
- });
75
- }
76
- return result2.notificationId;
77
- }
78
- const response = await this.client.tenantQuery(`mutation TriggerTenantNotification($input: TriggerNotificationInput!) {
79
- triggerNotification(input: $input) { id status channel }
80
- }`, {
81
- input: {
82
- notification,
83
- platform: input.channel,
84
- includeInApp: false
85
- }
86
- }, callContext);
87
- const result = response.triggerNotification;
88
- if (!result?.id || result.channel !== input.channel || ![
89
- "TRIGGERED",
90
- "SENT",
91
- "DELIVERED"
92
- ].includes(result.status)) {
93
- throw new APIError("Notification trigger was not acknowledged", {
94
- operation: "triggerNotification",
95
- notificationId: result?.id
96
- });
97
- }
98
- logger.info("[TenantNotifications] Notification accepted", {
99
- notificationId: result.id,
100
- channel: result.channel,
101
- status: result.status
102
- });
103
- return result.id;
104
- }
105
- /** Owner input deliberately excludes scheduling, which has a separate API. */
106
- createNotificationInput(input, priority) {
107
- return {
108
- recipient: input.recipient,
109
- channel: input.channel,
110
- type: input.type ?? "TRANSACTIONAL",
111
- priority: input.priority ?? priority ?? "MEDIUM",
112
- subject: input.subject,
113
- body: input.body,
114
- htmlBody: input.htmlBody,
115
- data: input.data,
116
- metadata: input.metadata,
117
- expiresAt: input.expiresAt?.toISOString(),
118
- trackOpens: input.trackOpens,
119
- trackClicks: input.trackClicks
120
- };
121
- }
122
- /**
123
- * Send notification using a template
124
- */
125
- async sendWithTemplate(input, context) {
126
- if (!input.templateSlug || input.templateSlug.trim().length === 0) {
127
- throw new ValidationError("Template slug is required");
128
- }
129
- if (!input.variables || typeof input.variables !== "object" || Array.isArray(input.variables)) {
130
- throw new ValidationError("Template variables must be an object");
131
- }
132
- if (!input.recipient || !input.recipient.email && !input.recipient.userId) {
133
- throw new ValidationError("Recipient email or userId is required");
134
- }
135
- this.validateDates(input);
136
- logger.info("[TenantNotifications] Sending notification with template", {
137
- templateSlug: input.templateSlug,
138
- priority: input.priority || "MEDIUM"
139
- });
140
- const mutation = `
141
- mutation TriggerNotificationWithTemplate($input: TriggerNotificationWithTemplateInput!) {
142
- triggerNotificationWithTemplate(input: $input) {
143
- totalRequested
144
- totalTriggered
145
- totalFailed
146
- notifications {
147
- id
148
- status
149
- deliveryStatus
150
- }
151
- }
152
- }
153
- `;
154
- const variables = {
155
- input: {
156
- templateSlug: input.templateSlug,
157
- variables: input.variables,
158
- recipient: input.recipient,
159
- priority: input.priority || "MEDIUM",
160
- scheduledFor: input.scheduledFor?.toISOString(),
161
- expiresAt: input.expiresAt?.toISOString(),
162
- trackOpens: input.trackOpens,
163
- trackClicks: input.trackClicks,
164
- // Platform is required for notification delivery routing
165
- // If channelId is specified, it takes precedence; otherwise platform determines delivery
166
- channelId: input.channelId,
167
- platform: input.platform || "EMAIL",
168
- timezone: input.timezone
169
- }
170
- };
171
- const response = await this.client.tenantQuery(mutation, variables, {
172
- ...this.context,
173
- ...context
174
- });
175
- const result = response.triggerNotificationWithTemplate;
176
- const firstNotification = result.notifications[0];
177
- if (result.totalTriggered === 0 || !firstNotification) {
178
- throw new ValidationError(`Notification trigger failed: requested=${result.totalRequested}, triggered=${result.totalTriggered}, failed=${result.totalFailed}`);
179
- }
180
- logger.info("[TenantNotifications] Notification sent with template", {
181
- notificationId: firstNotification.id,
182
- status: firstNotification.status,
183
- totalTriggered: result.totalTriggered,
184
- totalFailed: result.totalFailed
185
- });
186
- return firstNotification.id;
187
- }
188
- /**
189
- * Send batch notifications
190
- */
191
- async sendBatch(input, context) {
192
- if (!input.notifications?.length) throw new ValidationError("At least one notification is required");
193
- for (const notification of input.notifications) this.validateSendInput(notification);
194
- const schedules = new Set(input.notifications.map((notification) => notification.scheduledFor?.toISOString() ?? ""));
195
- if (schedules.size > 1) {
196
- throw new ValidationError("Batch notifications must share a schedule; use send() for distinct schedules");
197
- }
198
- if (input.batchSize !== void 0 && (!Number.isInteger(input.batchSize) || input.batchSize <= 0)) {
199
- throw new ValidationError("Batch size must be a positive integer");
200
- }
201
- if (input.delayBetweenBatches !== void 0 && (!Number.isInteger(input.delayBetweenBatches) || input.delayBetweenBatches < 0)) {
202
- throw new ValidationError("Batch delay must be a nonnegative integer");
203
- }
204
- const response = await this.client.tenantQuery(`mutation TriggerTenantBatchNotifications($input: TriggerBatchNotificationsInput!) {
205
- triggerBatchNotifications(input: $input) { totalRequested totalQueued: totalTriggered totalFailed batchId }
206
- }`, {
207
- input: {
208
- notifications: input.notifications.map((notification) => this.createNotificationInput(notification, input.priority)),
209
- priority: input.priority,
210
- scheduledFor: input.notifications[0]?.scheduledFor?.toISOString(),
211
- batchSize: input.batchSize,
212
- delayBetweenBatches: input.delayBetweenBatches
213
- }
214
- }, {
215
- ...this.context,
216
- ...context
217
- });
218
- const result = response.triggerBatchNotifications;
219
- if (!result?.batchId) throw new APIError("Notification batch was not acknowledged", {
220
- operation: "triggerBatchNotifications"
221
- });
222
- return result;
223
- }
224
- /**
225
- * Get a notification by ID
226
- */
227
- async getNotification(id) {
228
- const query = `
229
- query GetNotification($id: ID!) {
230
- notification(id: $id) {
231
- id
232
- userId
233
- channel
234
- type
235
- priority
236
- status
237
- deliveryStatus
238
- title
239
- message
240
- htmlMessage
241
- subject
242
- recipientEmail
243
- recipientPhone
244
- trackOpens
245
- trackClicks
246
- openedAt
247
- clickedAt
248
- sentAt
249
- deliveredAt
250
- createdAt
251
- updatedAt
252
- }
253
- }
254
- `;
255
- const response = await this.client.tenantQuery(query, {
256
- id
257
- }, this.context);
258
- return response.notification;
259
- }
260
- /**
261
- * Get notifications with filters
262
- */
263
- async getNotifications(filter) {
264
- const query = `
265
- query GetNotifications($filter: NotificationFilterInput, $limit: Int, $offset: Int) {
266
- notifications(filter: $filter, limit: $limit, offset: $offset) {
267
- items {
268
- id
269
- userId
270
- channel
271
- type
272
- priority
273
- status
274
- deliveryStatus
275
- title
276
- message
277
- subject
278
- recipientEmail
279
- trackOpens
280
- trackClicks
281
- openedAt
282
- clickedAt
283
- sentAt
284
- deliveredAt
285
- createdAt
286
- updatedAt
287
- }
288
- }
289
- }
290
- `;
291
- const variables = {
292
- filter: filter ? {
293
- userId: filter.userId,
294
- channel: filter.channel,
295
- type: filter.type,
296
- status: filter.status,
297
- priority: filter.priority,
298
- startDate: filter.startDate?.toISOString(),
299
- endDate: filter.endDate?.toISOString()
300
- } : void 0,
301
- limit: filter?.limit ?? 50,
302
- offset: filter?.offset ?? 0
303
- };
304
- const response = await this.client.tenantQuery(query, variables, this.context);
305
- return response.notifications.items;
306
- }
307
- /**
308
- * Get notification template
309
- */
310
- async getTemplate(slug, locale) {
311
- const query = `
312
- query GetNotificationTemplate($slug: String!, $locale: String) {
313
- notificationTemplate(slug: $slug, locale: $locale) {
314
- id
315
- name
316
- slug
317
- description
318
- channel
319
- type
320
- locale
321
- subject
322
- bodyTemplate
323
- htmlTemplate
324
- variables
325
- enabled
326
- version
327
- createdAt
328
- updatedAt
329
- }
330
- }
331
- `;
332
- const response = await this.client.tenantQuery(query, {
333
- slug,
334
- locale
335
- }, this.context);
336
- return response.notificationTemplate;
337
- }
338
- /**
339
- * Get all notification templates
340
- */
341
- async getTemplates(filter) {
342
- const query = `query GetNotificationTemplates($filter: TemplateFilterInput, $limit: Int!, $offset: Int!) {
343
- notificationTemplates(filter: $filter, limit: $limit, offset: $offset) {
344
- items { id name slug description channel type locale subject bodyTemplate htmlTemplate variables enabled version createdAt updatedAt }
345
- hasMore
346
- }
347
- }`;
348
- const templates = [];
349
- const seen = /* @__PURE__ */ new Set();
350
- for (let page = 0; page < 100; page++) {
351
- const response = await this.client.tenantQuery(query, {
352
- filter,
353
- limit: 100,
354
- offset: templates.length
355
- }, this.context);
356
- const result = response.notificationTemplates;
357
- if (!result || !Array.isArray(result.items) || typeof result.hasMore !== "boolean") {
358
- throw new APIError("Notification template page was invalid", {
359
- operation: "notificationTemplates"
360
- });
361
- }
362
- for (const template of result.items) {
363
- if (!template.id || seen.has(template.id)) {
364
- throw new APIError("Notification template pagination did not progress", {
365
- operation: "notificationTemplates"
366
- });
367
- }
368
- seen.add(template.id);
369
- templates.push(template);
370
- }
371
- if (!result.hasMore) return templates;
372
- if (!result.items.length) {
373
- throw new APIError("Notification template pagination did not progress", {
374
- operation: "notificationTemplates"
375
- });
376
- }
377
- }
378
- throw new APIError("Notification template pagination exceeded its bounded limit", {
379
- operation: "notificationTemplates"
380
- });
381
- }
382
- /**
383
- * Get notification statistics
384
- */
385
- async getStats(filter) {
386
- const query = `
387
- query GetNotificationStats($filter: NotificationFilterInput) {
388
- notificationStats(filter: $filter) {
389
- total
390
- pending
391
- triggered
392
- scheduled
393
- cancelled
394
- sent
395
- delivered
396
- failed
397
- byChannel
398
- byType
399
- }
400
- }
401
- `;
402
- const variables = {
403
- filter: filter ? {
404
- userId: filter.userId,
405
- startDate: filter.startDate?.toISOString(),
406
- endDate: filter.endDate?.toISOString()
407
- } : void 0
408
- };
409
- const response = await this.client.tenantQuery(query, variables, this.context);
410
- return response.notificationStats;
411
- }
412
- /**
413
- * Mark notifications as read
414
- */
415
- async markAsRead(notificationIds) {
416
- const mutation = `
417
- mutation MarkNotificationsAsRead($notificationIds: [ID!]!) {
418
- markNotificationsAsRead(notificationIds: $notificationIds) { success count failedIds }
419
- }
420
- `;
421
- const result = await this.client.tenantQuery(mutation, {
422
- notificationIds
423
- }, this.context);
424
- logger.info("[TenantNotifications] Read request completed", {
425
- success: result.markNotificationsAsRead.success,
426
- count: notificationIds.length
427
- });
428
- return result.markNotificationsAsRead.success;
429
- }
430
- /**
431
- * Mark all notifications as read for the current user
432
- */
433
- async markAllAsRead() {
434
- const mutation = `
435
- mutation MarkAllMyNotificationsAsRead {
436
- markAllMyNotificationsAsRead { success count failedIds }
437
- }
438
- `;
439
- const result = await this.client.tenantQuery(mutation, {}, this.context);
440
- logger.info("[TenantNotifications] Read-all request completed", {
441
- success: result.markAllMyNotificationsAsRead.success
442
- });
443
- return result.markAllMyNotificationsAsRead.success;
444
- }
445
- /**
446
- * Delete notifications
447
- */
448
- async deleteNotifications(notificationIds) {
449
- const mutation = `
450
- mutation DeleteNotifications($notificationIds: [ID!]!) {
451
- deleteNotifications(notificationIds: $notificationIds)
452
- }
453
- `;
454
- const result = await this.client.tenantQuery(mutation, {
455
- notificationIds
456
- }, this.context);
457
- logger.info("[TenantNotifications] Delete request completed", {
458
- success: result.deleteNotifications,
459
- count: notificationIds.length
460
- });
461
- return result.deleteNotifications;
462
- }
463
- /**
464
- * Delete all read notifications for the current user
465
- */
466
- async deleteAllReadNotifications() {
467
- const mutation = `
468
- mutation DeleteMyReadNotifications {
469
- deleteMyReadNotifications
470
- }
471
- `;
472
- const result = await this.client.tenantQuery(mutation, {}, this.context);
473
- logger.info("[TenantNotifications] Delete-read request completed", {
474
- success: result.deleteMyReadNotifications
475
- });
476
- return result.deleteMyReadNotifications;
477
- }
478
- /**
479
- * Validate send notification input
480
- */
481
- validateSendInput(input) {
482
- if (!Object.values(NotificationChannel).includes(input.channel)) {
483
- throw new ValidationError("A supported notification channel is required");
484
- }
485
- const recipientKeys = {
486
- EMAIL: [
487
- "email",
488
- "userId"
489
- ],
490
- SMS: [
491
- "phoneNumber",
492
- "userId"
493
- ],
494
- PUSH: [
495
- "pushToken",
496
- "userId"
497
- ],
498
- IN_APP: [
499
- "userId"
500
- ],
501
- WEBHOOK: [
502
- "webhookUrl",
503
- "userId"
504
- ],
505
- WHATSAPP: [
506
- "whatsappNumber",
507
- "phoneNumber",
508
- "userId"
509
- ],
510
- TEAMS: [
511
- "teamsUserId",
512
- "userId"
513
- ],
514
- SLACK: [
515
- "slackUserId",
516
- "userId"
517
- ],
518
- TELEGRAM: [
519
- "userId"
520
- ],
521
- DISCORD: [
522
- "userId"
523
- ]
524
- };
525
- if (!input.recipient || !recipientKeys[input.channel].some((key) => {
526
- const value = input.recipient[key];
527
- return typeof value === "string" && value.trim().length > 0;
528
- })) throw new ValidationError("A recipient address or userId appropriate for the channel is required");
529
- if (typeof input.body !== "string" || input.body.trim().length === 0) {
530
- throw new ValidationError("Notification body is required");
531
- }
532
- this.validateDates(input);
533
- }
534
- validateDates(input) {
535
- for (const value of [
536
- input.scheduledFor,
537
- input.expiresAt
538
- ]) {
539
- if (value != null && (!(value instanceof Date) || !Number.isFinite(value.getTime()))) {
540
- throw new ValidationError("Notification dates must be valid Date values");
541
- }
542
- }
543
- if (input.scheduledFor && input.expiresAt && input.expiresAt <= input.scheduledFor) {
544
- throw new ValidationError("Notification expiry must follow its scheduled delivery");
545
- }
546
- }
547
- };
548
-
549
- // src/notifications/index.ts
550
- var NotificationType2 = /* @__PURE__ */ (function(NotificationType3) {
551
- NotificationType3["INFO"] = "info";
552
- NotificationType3["SUCCESS"] = "success";
553
- NotificationType3["WARNING"] = "warning";
554
- NotificationType3["ERROR"] = "error";
555
- return NotificationType3;
556
- })({});
557
- var NotificationChannel2 = /* @__PURE__ */ (function(NotificationChannel3) {
558
- NotificationChannel3["EMAIL"] = "EMAIL";
559
- NotificationChannel3["SMS"] = "SMS";
560
- NotificationChannel3["WHATSAPP"] = "WHATSAPP";
561
- NotificationChannel3["PUSH"] = "PUSH";
562
- NotificationChannel3["SLACK"] = "SLACK";
563
- NotificationChannel3["TEAMS"] = "TEAMS";
564
- NotificationChannel3["WEBHOOK"] = "WEBHOOK";
565
- return NotificationChannel3;
566
- })({});
567
- function mapNotificationType(type) {
568
- return type === "warning" || type === "error" ? "ALERT" : "TRANSACTIONAL";
569
- }
570
- __name(mapNotificationType, "mapNotificationType");
571
- function resolveChannel(options) {
572
- if (options.email) return "EMAIL";
573
- if (options.sms) return "SMS";
574
- return "IN_APP";
575
- }
576
- __name(resolveChannel, "resolveChannel");
577
- var NotificationsModule = class {
578
- static {
579
- __name(this, "NotificationsModule");
580
- }
581
- client;
582
- context;
583
- constructor(client, context) {
584
- this.client = client;
585
- this.context = context;
586
- }
587
- /**
588
- * Send notification to users
589
- */
590
- async send(options) {
591
- if (!options.title || options.title.trim().length === 0) {
592
- throw new ValidationError("Notification title is required");
593
- }
594
- if (!options.message || options.message.trim().length === 0) {
595
- throw new ValidationError("Notification message is required");
596
- }
597
- if (!options.userIds || options.userIds.length === 0) {
598
- throw new ValidationError("At least one user ID is required");
599
- }
600
- if (options.expiresAt && (!(options.expiresAt instanceof Date) || !Number.isFinite(options.expiresAt.getTime()))) {
601
- throw new ValidationError("Notification expiry must be a valid Date");
602
- }
603
- logger.info("[Notifications] Sending notification", {
604
- userCount: options.userIds.length,
605
- type: options.type || "info"
606
- });
607
- const mutation = `
608
- mutation TriggerNotification($input: TriggerNotificationInput!) {
609
- triggerNotification(input: $input) {
610
- id
611
- status
612
- }
613
- }
614
- `;
615
- const channel = resolveChannel(options);
616
- const notificationIds = [];
617
- const errors = [];
618
- const results = await Promise.allSettled(options.userIds.map(async (userId) => {
619
- const variables = {
620
- input: {
621
- notification: {
622
- recipient: {
623
- userId
624
- },
625
- channel,
626
- type: mapNotificationType(options.type),
627
- subject: options.title,
628
- body: options.message,
629
- metadata: options.metadata,
630
- data: options.data,
631
- expiresAt: options.expiresAt?.toISOString(),
632
- ...options.redirectUrl ? {
633
- redirectUrl: options.redirectUrl
634
- } : {},
635
- ...options.appName ? {
636
- appName: options.appName
637
- } : {}
638
- },
639
- platform: channel,
640
- // Always leave an in-app trace when the primary channel is external, so the
641
- // notification is visible in the product even if email/SMS delivery fails.
642
- includeInApp: channel !== "IN_APP"
643
- }
644
- };
645
- const response = await this.client.tenantQuery(mutation, variables, this.context);
646
- const id = response.triggerNotification?.id;
647
- if (!id) {
648
- throw new Error(`notification service returned no id for user ${userId}`);
649
- }
650
- return id;
651
- }));
652
- for (const [index, settled] of results.entries()) {
653
- if (settled.status === "fulfilled") {
654
- notificationIds.push(settled.value);
655
- } else {
656
- const reason = settled.reason instanceof Error ? settled.reason.message : String(settled.reason);
657
- errors.push(`${options.userIds[index] ?? "unknown user"}: ${reason}`);
658
- }
659
- }
660
- const result = {
661
- successCount: notificationIds.length,
662
- failureCount: errors.length,
663
- errors,
664
- notificationIds
665
- };
666
- logger.info("[Notifications] Notification sent", {
667
- successCount: result.successCount,
668
- failureCount: result.failureCount
669
- });
670
- return result;
671
- }
672
- /**
673
- * Send notification to a single user (convenience method)
674
- */
675
- async sendToUser(userId, title, message, options) {
676
- return this.send({
677
- title,
678
- message,
679
- userIds: [
680
- userId
681
- ],
682
- ...options
683
- });
684
- }
685
- /**
686
- * Get notifications for a user
687
- */
688
- async getNotifications(options) {
689
- logger.debug("[Notifications] Getting notifications", {
690
- userId: options.userId
691
- });
692
- const query = `
693
- query GetNotifications(
694
- $userId: ID!
695
- $status: NotificationStatus
696
- $type: NotificationType
697
- $appName: String
698
- $search: String
699
- $limit: Int
700
- $offset: Int
701
- ) {
702
- getNotifications(
703
- userId: $userId
704
- status: $status
705
- type: $type
706
- appName: $appName
707
- search: $search
708
- limit: $limit
709
- offset: $offset
710
- ) {
711
- notifications {
712
- id
713
- userId
714
- title
715
- message
716
- type
717
- status
718
- redirectUrl
719
- appName
720
- createdAt
721
- updatedAt
722
- }
723
- total
724
- unreadCount
725
- }
726
- }
727
- `;
728
- const variables = {
729
- userId: options.userId,
730
- status: options.status,
731
- type: options.type,
732
- appName: options.appName,
733
- search: options.search,
734
- limit: options.limit || 20,
735
- offset: options.offset || 0
736
- };
737
- const response = await this.client.query(query, variables, this.context);
738
- return response.getNotifications;
739
- }
740
- /**
741
- * Mark notification as read
742
- */
743
- async markAsRead(notificationId) {
744
- logger.debug("[Notifications] Marking notification as read", {
745
- notificationId
746
- });
747
- const mutation = `
748
- mutation MarkNotificationAsRead($notificationId: ID!) {
749
- markNotificationAsRead(notificationId: $notificationId) {
750
- id
751
- status
752
- }
753
- }
754
- `;
755
- await this.client.tenantQuery(mutation, {
756
- notificationId
757
- }, this.context);
758
- logger.info("[Notifications] Notification marked as read", {
759
- notificationId
760
- });
761
- return true;
762
- }
763
- /**
764
- * Mark multiple notifications as read
765
- */
766
- async markMultipleAsRead(notificationIds) {
767
- logger.debug("[Notifications] Marking multiple notifications as read", {
768
- count: notificationIds.length
769
- });
770
- const mutation = `
771
- mutation MarkNotificationsAsRead($notificationIds: [ID!]!) {
772
- markNotificationsAsRead(notificationIds: $notificationIds) {
773
- count
774
- }
775
- }
776
- `;
777
- const response = await this.client.query(mutation, {
778
- notificationIds
779
- }, this.context);
780
- logger.info("[Notifications] Notifications marked as read", {
781
- count: response.markNotificationsAsRead.count
782
- });
783
- return response.markNotificationsAsRead.count;
784
- }
785
- /**
786
- * Mark all notifications as read for the current user
787
- */
788
- async markAllAsRead() {
789
- logger.debug("[Notifications] Marking all notifications as read");
790
- const mutation = `
791
- mutation MarkAllMyNotificationsAsRead {
792
- markAllMyNotificationsAsRead {
793
- count
794
- }
795
- }
796
- `;
797
- const response = await this.client.query(mutation, {}, this.context);
798
- logger.info("[Notifications] All notifications marked as read", {
799
- count: response.markAllMyNotificationsAsRead.count
800
- });
801
- return response.markAllMyNotificationsAsRead.count;
802
- }
803
- /**
804
- * Delete notification
805
- */
806
- async deleteNotification(notificationId) {
807
- logger.debug("[Notifications] Deleting notification", {
808
- notificationId
809
- });
810
- const mutation = `
811
- mutation DeleteNotification($notificationId: ID!) {
812
- deleteNotification(notificationId: $notificationId) {
813
- success
814
- }
815
- }
816
- `;
817
- await this.client.tenantQuery(mutation, {
818
- notificationId
819
- }, this.context);
820
- logger.info("[Notifications] Notification deleted", {
821
- notificationId
822
- });
823
- return true;
824
- }
825
- /**
826
- * Delete multiple notifications
827
- */
828
- async deleteMultiple(notificationIds) {
829
- logger.debug("[Notifications] Deleting multiple notifications", {
830
- count: notificationIds.length
831
- });
832
- const mutation = `
833
- mutation DeleteNotifications($notificationIds: [ID!]!) {
834
- deleteNotifications(notificationIds: $notificationIds) {
835
- count
836
- }
837
- }
838
- `;
839
- const response = await this.client.query(mutation, {
840
- notificationIds
841
- }, this.context);
842
- logger.info("[Notifications] Notifications deleted", {
843
- count: response.deleteNotifications.count
844
- });
845
- return response.deleteNotifications.count;
846
- }
847
- /**
848
- * Get unread notification count for a user
849
- */
850
- async getUnreadCount(userId) {
851
- const result = await this.getNotifications({
852
- userId,
853
- status: "unread",
854
- limit: 0
855
- });
856
- return result.unreadCount;
857
- }
858
- /**
859
- * Send notification via specific channel (EMAIL, SMS, WHATSAPP, etc.)
860
- * with optional in-app notification
861
- */
862
- async sendChannelNotification(options) {
863
- if (!options.body || options.body.trim().length === 0) {
864
- throw new ValidationError("Notification body is required");
865
- }
866
- if (!options.recipient && !options.recipients) {
867
- throw new ValidationError("At least one recipient is required");
868
- }
869
- if (options.includeInApp && (!options.userIds || options.userIds.length === 0)) {
870
- throw new ValidationError("User IDs are required when includeInApp is true");
871
- }
872
- logger.info("[Notifications] Sending channel notification", {
873
- platform: options.platform,
874
- recipientCount: options.recipients ? options.recipients.length : 1,
875
- includeInApp: options.includeInApp,
876
- inAppUserCount: options.userIds ? options.userIds.length : 0
877
- });
878
- const mutation = `
879
- mutation TriggerNotification($input: TriggerNotificationInput!) {
880
- triggerNotification(input: $input) {
881
- id
882
- status
883
- deliveryStatus
884
- }
885
- }
886
- `;
887
- const variables = {
888
- input: {
889
- platform: options.platform,
890
- channelId: options.channelId,
891
- includeInApp: options.includeInApp || false,
892
- userIds: options.userIds || [],
893
- notification: {
894
- subject: options.subject || "",
895
- body: options.body,
896
- htmlBody: options.htmlBody || "",
897
- channel: options.platform,
898
- type: options.type || "info",
899
- recipient: options.recipient,
900
- appName: options.appName,
901
- redirectUrl: options.redirectUrl || "",
902
- metadata: options.metadata || {},
903
- trackOpens: options.trackOpens || false,
904
- trackClicks: options.trackClicks || false,
905
- expiresAt: options.expiresAt?.toISOString()
906
- }
907
- }
908
- };
909
- if (options.recipients && options.recipients.length > 1) {
910
- const results = await Promise.allSettled(options.recipients.map((recipient) => this.client.tenantQuery(mutation, {
911
- input: {
912
- ...variables.input,
913
- notification: {
914
- ...variables.input.notification,
915
- recipient
916
- }
917
- }
918
- }, this.context)));
919
- let successCount = 0;
920
- let failureCount = 0;
921
- const errors = [];
922
- const notificationIds = [];
923
- results.forEach((result, index) => {
924
- if (result.status === "fulfilled") {
925
- successCount++;
926
- const response2 = result.value;
927
- notificationIds.push(response2.triggerNotification.id);
928
- } else {
929
- failureCount++;
930
- errors.push(`Recipient ${index + 1}: ${result.reason instanceof Error ? result.reason.message : "Unknown error"}`);
931
- }
932
- });
933
- const response = {
934
- successCount,
935
- failureCount,
936
- errors,
937
- notificationIds
938
- };
939
- logger.info("[Notifications] Channel notification sent (bulk)", {
940
- successCount,
941
- failureCount
942
- });
943
- return response;
944
- } else {
945
- try {
946
- const response = await this.client.query(mutation, variables, this.context);
947
- const result = {
948
- successCount: 1,
949
- failureCount: 0,
950
- errors: [],
951
- notificationIds: [
952
- response.triggerNotification.id
953
- ]
954
- };
955
- logger.info("[Notifications] Channel notification sent", {
956
- notificationId: response.triggerNotification.id,
957
- status: response.triggerNotification.status
958
- });
959
- return result;
960
- } catch (error) {
961
- logger.error("[Notifications] Failed to send channel notification", {
962
- error
963
- });
964
- return {
965
- successCount: 0,
966
- failureCount: 1,
967
- errors: [
968
- error instanceof Error ? error.message : "Unknown error"
969
- ],
970
- notificationIds: []
971
- };
972
- }
973
- }
974
- }
975
- /**
976
- * Send notification using a template with optional in-app notification
977
- */
978
- async sendTemplateNotification(options) {
979
- if (!options.templateSlug || options.templateSlug.trim().length === 0) {
980
- throw new ValidationError("Template slug is required");
981
- }
982
- if (!options.variables || typeof options.variables !== "object") {
983
- throw new ValidationError("Template variables are required");
984
- }
985
- if (!options.recipient && !options.recipients) {
986
- throw new ValidationError("At least one recipient is required");
987
- }
988
- if (options.includeInApp && (!options.userIds || options.userIds.length === 0)) {
989
- throw new ValidationError("User IDs are required when includeInApp is true");
990
- }
991
- logger.info("[Notifications] Sending template notification", {
992
- templateSlug: options.templateSlug,
993
- platform: options.platform,
994
- recipientCount: options.recipients ? options.recipients.length : 1,
995
- includeInApp: options.includeInApp,
996
- inAppUserCount: options.userIds ? options.userIds.length : 0
997
- });
998
- const mutation = `
999
- mutation TriggerNotificationWithTemplate($input: TriggerNotificationWithTemplateInput!) {
1000
- triggerNotificationWithTemplate(input: $input) {
1001
- totalRequested
1002
- totalTriggered
1003
- totalFailed
1004
- notifications {
1005
- id
1006
- status
1007
- deliveryStatus
1008
- }
1009
- }
1010
- }
1011
- `;
1012
- const variables = {
1013
- input: {
1014
- platform: options.platform,
1015
- channelId: options.channelId,
1016
- includeInApp: options.includeInApp || false,
1017
- userIds: options.userIds || [],
1018
- templateSlug: options.templateSlug,
1019
- variables: options.variables,
1020
- recipient: options.recipient,
1021
- recipients: options.recipients,
1022
- trackOpens: options.trackOpens || false,
1023
- trackClicks: options.trackClicks || false,
1024
- expiresAt: options.expiresAt?.toISOString(),
1025
- scheduledFor: options.scheduledFor?.toISOString(),
1026
- timezone: options.timezone
1027
- }
1028
- };
1029
- try {
1030
- const response = await this.client.query(mutation, variables, this.context);
1031
- const data = response.triggerNotificationWithTemplate;
1032
- const result = {
1033
- successCount: data.totalTriggered,
1034
- failureCount: data.totalFailed,
1035
- errors: [],
1036
- notificationIds: data.notifications.map((n) => n.id)
1037
- };
1038
- logger.info("[Notifications] Template notification sent", {
1039
- templateSlug: options.templateSlug,
1040
- totalTriggered: data.totalTriggered,
1041
- totalFailed: data.totalFailed,
1042
- notificationIds: result.notificationIds
1043
- });
1044
- return result;
1045
- } catch (error) {
1046
- logger.error("[Notifications] Failed to send template notification", {
1047
- error
1048
- });
1049
- return {
1050
- successCount: 0,
1051
- failureCount: 1,
1052
- errors: [
1053
- error instanceof Error ? error.message : "Unknown error"
1054
- ],
1055
- notificationIds: []
1056
- };
1057
- }
1058
- }
1059
- };
1060
-
1061
- export { NotificationChannel, NotificationChannel2, NotificationPriority, NotificationType, NotificationType2, NotificationsModule, TenantNotificationsModule, tenant_notifications_exports };
1062
- //# sourceMappingURL=chunk-KH4TRQCO.js.map
1063
- //# sourceMappingURL=chunk-KH4TRQCO.js.map