@burdenoff/be-sdk 2026.1110.2 → 2026.1110.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configs/eslint/index.js +1 -1
- package/configs/tsconfig/tsconfig.json +1 -1
- package/dist/EventQueueFactory-9NGZV9jl.js +1457 -0
- package/dist/EventQueueFactory-9NGZV9jl.js.map +1 -0
- package/dist/RedisStreamsConnection-CY8WySJy.js +283 -0
- package/dist/RedisStreamsConnection-CY8WySJy.js.map +1 -0
- package/dist/ai-credits/index.d.ts +2 -3
- package/dist/ai-credits/index.js +3 -4
- package/dist/ai-credits/index.js.map +1 -1
- package/dist/ai-credits-Ca-NNcVx.js +546 -0
- package/dist/ai-credits-Ca-NNcVx.js.map +1 -0
- package/dist/{assistant-session-CJZhF4D6.d.ts → assistant-session-DA5ZKJOr.d.ts} +4 -5
- package/dist/auth/index.d.ts +2 -77
- package/dist/auth/index.js +3 -7
- package/dist/auth/index.js.map +1 -1
- package/dist/auth-CEuBEBQN.js +228 -0
- package/dist/auth-CEuBEBQN.js.map +1 -0
- package/dist/cache/index.d.ts +2 -3
- package/dist/cache/index.js +3 -7
- package/dist/cache/index.js.map +1 -1
- package/dist/cache-CU0uLwcS.js +1837 -0
- package/dist/cache-CU0uLwcS.js.map +1 -0
- package/dist/captcha/index.d.ts +2 -1
- package/dist/captcha/index.js +3 -3
- package/dist/captcha/index.js.map +1 -1
- package/dist/captcha-BT7yh1YS.js +77 -0
- package/dist/captcha-BT7yh1YS.js.map +1 -0
- package/dist/client/internal-client.d.ts +4 -7
- package/dist/client/internal-client.js +172 -4
- package/dist/client/internal-client.js.map +1 -1
- package/dist/client-BgAEvDC2.d.ts +86 -0
- package/dist/client-DcZ3iGES.js +565 -0
- package/dist/client-DcZ3iGES.js.map +1 -0
- package/dist/collector-endpoint-iyQYeI50.js +50 -0
- package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
- package/dist/context-CZnXf2yb.js +247 -0
- package/dist/context-CZnXf2yb.js.map +1 -0
- package/dist/crypto/index.d.ts +2 -1
- package/dist/crypto/index.js +3 -3
- package/dist/crypto/index.js.map +1 -1
- package/dist/crypto-DO9fM0FO.js +145 -0
- package/dist/crypto-DO9fM0FO.js.map +1 -0
- package/dist/database/index.d.ts +104 -108
- package/dist/database/index.js +468 -6
- package/dist/database/index.js.map +1 -1
- package/dist/dataloader/index.d.ts +2 -1
- package/dist/dataloader/index.js +3 -3
- package/dist/dataloader/index.js.map +1 -1
- package/dist/dataloader-DwpT3YoS.js +294 -0
- package/dist/dataloader-DwpT3YoS.js.map +1 -0
- package/dist/deployed-environment-p_Tdl3sT.js +38 -0
- package/dist/deployed-environment-p_Tdl3sT.js.map +1 -0
- package/dist/dist-BGKdXVy3.js +1718 -0
- package/dist/dist-BGKdXVy3.js.map +1 -0
- package/dist/env-DdaoGjIt.js +74 -0
- package/dist/env-DdaoGjIt.js.map +1 -0
- package/dist/event-queue/index.d.ts +2 -7
- package/dist/event-queue/index.js +7 -9
- package/dist/event-queue/index.js.map +1 -1
- package/dist/event-queue-Cw-YJPY_.js +1384 -0
- package/dist/event-queue-Cw-YJPY_.js.map +1 -0
- package/dist/{explicit-activity-scope-CCoxVwAr.d.ts → explicit-activity-scope-D8VeGGpt.d.ts} +1 -2
- package/dist/export/index.d.ts +2 -2
- package/dist/export/index.js +3 -14
- package/dist/export/index.js.map +1 -1
- package/dist/export-B6fphx8a.js +642 -0
- package/dist/export-B6fphx8a.js.map +1 -0
- package/dist/feature-flags/index.d.ts +2 -10
- package/dist/feature-flags/index.js +3 -6
- package/dist/feature-flags/index.js.map +1 -1
- package/dist/feature-flags-71oDkrUe.js +422 -0
- package/dist/feature-flags-71oDkrUe.js.map +1 -0
- package/dist/files/index.d.ts +2 -3
- package/dist/files/index.js +3 -4
- package/dist/files/index.js.map +1 -1
- package/dist/files-DjH0099H.js +830 -0
- package/dist/files-DjH0099H.js.map +1 -0
- package/dist/gateway/index.d.ts +4 -6
- package/dist/gateway/index.js +7 -13
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/security/index.d.ts +2 -2
- package/dist/gateway/security/index.js +3 -5
- package/dist/gateway/security/index.js.map +1 -1
- package/dist/gateway-DBFmxWks.js +50 -0
- package/dist/gateway-DBFmxWks.js.map +1 -0
- package/dist/graph/index.d.ts +3 -10
- package/dist/graph/index.js +4 -13
- package/dist/graph/index.js.map +1 -1
- package/dist/graph-DDYgIryR.js +2152 -0
- package/dist/graph-DDYgIryR.js.map +1 -0
- package/dist/graph-emitter-CdOXP7Tn.js +621 -0
- package/dist/graph-emitter-CdOXP7Tn.js.map +1 -0
- package/dist/graphql/index.d.ts +3 -2
- package/dist/graphql/index.js +4 -6
- package/dist/graphql/index.js.map +1 -1
- package/dist/graphql/services/index.d.ts +2 -24
- package/dist/graphql/services/index.js +3 -4
- package/dist/graphql/services/index.js.map +1 -1
- package/dist/graphql-DHAHHcww.js +161 -0
- package/dist/graphql-DHAHHcww.js.map +1 -0
- package/dist/graphql-DNkMkGBZ.d.ts +21 -0
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.js +3 -4
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n-BBMYFd0P.js +860 -0
- package/dist/i18n-BBMYFd0P.js.map +1 -0
- package/dist/import-optional-peer-B82VYxeX.js +18 -0
- package/dist/import-optional-peer-B82VYxeX.js.map +1 -0
- package/dist/index-3KOZ1zN9.d.ts +233 -0
- package/dist/index-BBqooJ52.d.ts +45 -0
- package/dist/index-BGzMYJsm.d.ts +209 -0
- package/dist/index-BKwHQtHQ.d.ts +63 -0
- package/dist/index-BMIMnp6T.d.ts +8 -0
- package/dist/index-BQDsNAMR.d.ts +81 -0
- package/dist/index-BVOL7458.d.ts +10 -0
- package/dist/index-BcqQs-Uq.d.ts +69 -0
- package/dist/index-BeVtqGO-.d.ts +208 -0
- package/dist/index-BiTzGUZP.d.ts +114 -0
- package/dist/index-BqYfCQSP.d.ts +500 -0
- package/dist/index-C0qLquY0.d.ts +150 -0
- package/dist/index-C5uEKchX.d.ts +60 -0
- package/dist/index-CDOqxSIi.d.ts +37 -0
- package/dist/index-CG6wj66Y.d.ts +148 -0
- package/dist/index-CIgoeobA.d.ts +145 -0
- package/dist/index-CPQDMSFS.d.ts +103 -0
- package/dist/index-CSRcgkVi.d.ts +23 -0
- package/dist/index-CZTnQIRU.d.ts +341 -0
- package/dist/index-CaM9JUcc.d.ts +144 -0
- package/dist/index-CkT2aUr3.d.ts +704 -0
- package/dist/index-CliOgq6L.d.ts +203 -0
- package/dist/index-CnzbJZP7.d.ts +999 -0
- package/dist/index-D6UeLAye.d.ts +63 -0
- package/dist/index-DGgh9DWn.d.ts +59 -0
- package/dist/index-DY3dNhMN.d.ts +420 -0
- package/dist/index-DZC-2o9R.d.ts +207 -0
- package/dist/index-DqbGqfAy.d.ts +127 -0
- package/dist/index-Dt1HJPTX.d.ts +12 -0
- package/dist/index-DtI6aBtB.d.ts +22 -0
- package/dist/index-FKohsiex.d.ts +38 -0
- package/dist/index-FbXPfen7.d.ts +132 -0
- package/dist/index-MArCb8Aq.d.ts +306 -0
- package/dist/index-N-huORcj.d.ts +303 -0
- package/dist/index-YOShAwkq.d.ts +45 -0
- package/dist/index-bZKZUvBu.d.ts +646 -0
- package/dist/index-yBSjMY32.d.ts +24 -0
- package/dist/index.d.ts +501 -544
- package/dist/index.js +1820 -2171
- package/dist/index.js.map +1 -1
- package/dist/init/index.d.ts +2 -2
- package/dist/init/index.js +3 -16
- package/dist/init/index.js.map +1 -1
- package/dist/init-Dy3KhT6Y.js +325 -0
- package/dist/init-Dy3KhT6Y.js.map +1 -0
- package/dist/instrumentation/index.d.ts +3 -4
- package/dist/instrumentation/index.js +5 -5
- package/dist/instrumentation/index.js.map +1 -1
- package/dist/instrumentation-xkkmDgJ0.js +1678 -0
- package/dist/instrumentation-xkkmDgJ0.js.map +1 -0
- package/dist/lake/index.d.ts +50 -54
- package/dist/lake/index.js +169 -193
- package/dist/lake/index.js.map +1 -1
- package/dist/layer/index.d.ts +3 -2
- package/dist/layer/index.js +4 -5
- package/dist/layer/index.js.map +1 -1
- package/dist/layer-BZBZZWeV.d.ts +69 -0
- package/dist/layer-Bcix-WCl.js +105 -0
- package/dist/layer-Bcix-WCl.js.map +1 -0
- package/dist/layer-CEKy6cm8.js +252 -0
- package/dist/layer-CEKy6cm8.js.map +1 -0
- package/dist/lifecycle/index.d.ts +2 -1
- package/dist/lifecycle/index.js +3 -4
- package/dist/lifecycle/index.js.map +1 -1
- package/dist/lifecycle-DeoLSX0U.js +76 -0
- package/dist/lifecycle-DeoLSX0U.js.map +1 -0
- package/dist/logger/index.d.ts +2 -3
- package/dist/logger/index.js +3 -3
- package/dist/logger/index.js.map +1 -1
- package/dist/logger-B6rCpb7D.js +290 -0
- package/dist/logger-B6rCpb7D.js.map +1 -0
- package/dist/metrics/index.d.ts +13 -14
- package/dist/metrics/index.js +3 -4
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics-BrLwNUrb.js +52 -0
- package/dist/metrics-BrLwNUrb.js.map +1 -0
- package/dist/metrics-collector-C2eShrlW.js +922 -0
- package/dist/metrics-collector-C2eShrlW.js.map +1 -0
- package/dist/middleware/index.d.ts +3 -3
- package/dist/middleware/index.js +3 -4
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware-CUxJVUpD.js +1243 -0
- package/dist/middleware-CUxJVUpD.js.map +1 -0
- package/dist/middleware-Cq0zFMGp.js +253 -0
- package/dist/middleware-Cq0zFMGp.js.map +1 -0
- package/dist/notifications/index.d.ts +2 -5
- package/dist/notifications/index.js +3 -6
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications-CdETrtFK.js +869 -0
- package/dist/notifications-CdETrtFK.js.map +1 -0
- package/dist/observability/index.d.ts +2 -3
- package/dist/observability/index.js +3 -4
- package/dist/observability/index.js.map +1 -1
- package/dist/observability-DBDXipTU.js +272 -0
- package/dist/observability-DBDXipTU.js.map +1 -0
- package/dist/platform/index.d.ts +2 -1
- package/dist/platform/index.js +3 -5
- package/dist/platform/index.js.map +1 -1
- package/dist/platform-DZwczW7v.js +1510 -0
- package/dist/platform-DZwczW7v.js.map +1 -0
- package/dist/prisma/generator/index.d.ts +1 -1
- package/dist/prisma/generator/index.js +97 -84
- package/dist/prisma/generator/index.js.map +1 -1
- package/dist/prisma/index.d.ts +4 -7
- package/dist/prisma/index.js +5 -12
- package/dist/prisma/index.js.map +1 -1
- package/dist/prisma-BzOOdt79.js +863 -0
- package/dist/prisma-BzOOdt79.js.map +1 -0
- package/dist/prisma-extension-Cfl09swM.d.ts +172 -0
- package/dist/product-alias/index.d.ts +2 -1
- package/dist/product-alias/index.js +3 -3
- package/dist/product-alias/index.js.map +1 -1
- package/dist/product-alias-BPqtskMq.js +273 -0
- package/dist/product-alias-BPqtskMq.js.map +1 -0
- package/dist/rbac/index.d.ts +2 -122
- package/dist/rbac/index.js +3 -6
- package/dist/rbac/index.js.map +1 -1
- package/dist/rbac-BB9l9Xph.js +1486 -0
- package/dist/rbac-BB9l9Xph.js.map +1 -0
- package/dist/resource-caps/index.d.ts +66 -72
- package/dist/resource-caps/index.js +430 -5
- package/dist/resource-caps/index.js.map +1 -1
- package/dist/rolldown-runtime-ad2WFvuA.js +17 -0
- package/dist/sdk-Dju9o-sq.js +124 -0
- package/dist/sdk-Dju9o-sq.js.map +1 -0
- package/dist/security-DIG-95Ic.js +1647 -0
- package/dist/security-DIG-95Ic.js.map +1 -0
- package/dist/server/index.d.ts +7 -164
- package/dist/server/index.js +2000 -1507
- package/dist/server/index.js.map +1 -1
- package/dist/service-jwt-Bu-WNA_-.js +80 -0
- package/dist/service-jwt-Bu-WNA_-.js.map +1 -0
- package/dist/services-BWzfz7vG.js +102 -0
- package/dist/services-BWzfz7vG.js.map +1 -0
- package/dist/sharding/index.d.ts +41 -44
- package/dist/sharding/index.js +156 -137
- package/dist/sharding/index.js.map +1 -1
- package/dist/sharing/index.d.ts +2 -1
- package/dist/sharing/index.js +3 -4
- package/dist/sharing/index.js.map +1 -1
- package/dist/sharing-CflDsSJ-.js +911 -0
- package/dist/sharing-CflDsSJ-.js.map +1 -0
- package/dist/stub-BqwKn4eh.js +630 -0
- package/dist/stub-BqwKn4eh.js.map +1 -0
- package/dist/tags/index.d.ts +2 -3
- package/dist/tags/index.js +3 -4
- package/dist/tags/index.js.map +1 -1
- package/dist/tags-B5xpbgsk.js +868 -0
- package/dist/{chunk-PBZFAAOM.js.map → tags-B5xpbgsk.js.map} +1 -1
- package/dist/telemetry/index.d.ts +64 -76
- package/dist/telemetry/index.js +369 -201
- package/dist/telemetry/index.js.map +1 -1
- package/dist/temporal/index.d.ts +2 -148
- package/dist/temporal/index.js +3 -5
- package/dist/temporal/index.js.map +1 -1
- package/dist/temporal-B534uYK8.js +706 -0
- package/dist/temporal-B534uYK8.js.map +1 -0
- package/dist/tracker/index.d.ts +5 -11
- package/dist/tracker/index.js +5 -20
- package/dist/tracker/index.js.map +1 -1
- package/dist/tracker-BQVoEFUo.js +839 -0
- package/dist/tracker-BQVoEFUo.js.map +1 -0
- package/dist/types-BYMYND1L.js +44 -0
- package/dist/types-BYMYND1L.js.map +1 -0
- package/dist/types-C6EKaS3V.d.ts +106 -0
- package/dist/types-CWybW61E.d.ts +323 -0
- package/dist/types-C_yfu3XK.d.ts +34 -0
- package/dist/types-Cj2RWXbz.js +90 -0
- package/dist/types-Cj2RWXbz.js.map +1 -0
- package/dist/types-DgaQqvxo.d.ts +70 -0
- package/dist/usage/index.d.ts +2 -213
- package/dist/usage/index.js +3 -15
- package/dist/usage/index.js.map +1 -1
- package/dist/usage-BKFZiWQn.js +682 -0
- package/dist/usage-BKFZiWQn.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils-DL85Tnbn.js +500 -0
- package/dist/utils-DL85Tnbn.js.map +1 -0
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +3 -3
- package/dist/validation/index.js.map +1 -1
- package/dist/validation-CPUITdMk.js +762 -0
- package/dist/validation-CPUITdMk.js.map +1 -0
- package/dist/workspace-extension-COrC0dYi.js +979 -0
- package/dist/workspace-extension-COrC0dYi.js.map +1 -0
- package/dist/{workspace-extension-BGwTOV_r.d.ts → workspace-extension-DTFTdGVF.d.ts} +43 -45
- package/package.json +7 -10
- package/dist/EventQueueFactory-GXC3A7DH.js +0 -8
- package/dist/EventQueueFactory-GXC3A7DH.js.map +0 -1
- package/dist/chunk-4XIBXZ6J.js +0 -276
- package/dist/chunk-4XIBXZ6J.js.map +0 -1
- package/dist/chunk-554Z4C2K.js +0 -1006
- package/dist/chunk-554Z4C2K.js.map +0 -1
- package/dist/chunk-5CAFHK2Z.js +0 -107
- package/dist/chunk-5CAFHK2Z.js.map +0 -1
- package/dist/chunk-63ZXJ42X.js +0 -451
- package/dist/chunk-63ZXJ42X.js.map +0 -1
- package/dist/chunk-6XEXJATV.js +0 -304
- package/dist/chunk-6XEXJATV.js.map +0 -1
- package/dist/chunk-726AR6Q7.js +0 -1532
- package/dist/chunk-726AR6Q7.js.map +0 -1
- package/dist/chunk-A5F6Z5UE.js +0 -21
- package/dist/chunk-A5F6Z5UE.js.map +0 -1
- package/dist/chunk-A6DE32ZS.js +0 -1507
- package/dist/chunk-A6DE32ZS.js.map +0 -1
- package/dist/chunk-AXJDGQPE.js +0 -690
- package/dist/chunk-AXJDGQPE.js.map +0 -1
- package/dist/chunk-BJQOGOVW.js +0 -602
- package/dist/chunk-BJQOGOVW.js.map +0 -1
- package/dist/chunk-CFXWH2IS.js +0 -52
- package/dist/chunk-CFXWH2IS.js.map +0 -1
- package/dist/chunk-DRWH5XCJ.js +0 -876
- package/dist/chunk-DRWH5XCJ.js.map +0 -1
- package/dist/chunk-E4QNLVY4.js +0 -909
- package/dist/chunk-E4QNLVY4.js.map +0 -1
- package/dist/chunk-EBDHIL7V.js +0 -774
- package/dist/chunk-EBDHIL7V.js.map +0 -1
- package/dist/chunk-ELU7VL3E.js +0 -245
- package/dist/chunk-ELU7VL3E.js.map +0 -1
- package/dist/chunk-FZRODKIN.js +0 -31
- package/dist/chunk-FZRODKIN.js.map +0 -1
- package/dist/chunk-GCIB76AJ.js +0 -882
- package/dist/chunk-GCIB76AJ.js.map +0 -1
- package/dist/chunk-HC6MPUIH.js +0 -1571
- package/dist/chunk-HC6MPUIH.js.map +0 -1
- package/dist/chunk-HNMHPSAM.js +0 -272
- package/dist/chunk-HNMHPSAM.js.map +0 -1
- package/dist/chunk-HTLEGD3Q.js +0 -1480
- package/dist/chunk-HTLEGD3Q.js.map +0 -1
- package/dist/chunk-I3KOWRT3.js +0 -89
- package/dist/chunk-I3KOWRT3.js.map +0 -1
- package/dist/chunk-ID3WR4JS.js +0 -509
- package/dist/chunk-ID3WR4JS.js.map +0 -1
- package/dist/chunk-JS52ZHTK.js +0 -1346
- package/dist/chunk-JS52ZHTK.js.map +0 -1
- package/dist/chunk-JVMAQOA3.js +0 -521
- package/dist/chunk-JVMAQOA3.js.map +0 -1
- package/dist/chunk-KH4TRQCO.js +0 -1063
- package/dist/chunk-KH4TRQCO.js.map +0 -1
- package/dist/chunk-KJOSPVB2.js +0 -57
- package/dist/chunk-KJOSPVB2.js.map +0 -1
- package/dist/chunk-KO2ZXZ7W.js +0 -61
- package/dist/chunk-KO2ZXZ7W.js.map +0 -1
- package/dist/chunk-KS2HQCJR.js +0 -56
- package/dist/chunk-KS2HQCJR.js.map +0 -1
- package/dist/chunk-LA5KPWZ2.js +0 -413
- package/dist/chunk-LA5KPWZ2.js.map +0 -1
- package/dist/chunk-MESLAC5W.js +0 -574
- package/dist/chunk-MESLAC5W.js.map +0 -1
- package/dist/chunk-MWPYA2HD.js +0 -94
- package/dist/chunk-MWPYA2HD.js.map +0 -1
- package/dist/chunk-NUB5GQTU.js +0 -270
- package/dist/chunk-NUB5GQTU.js.map +0 -1
- package/dist/chunk-OBBCR6WY.js +0 -277
- package/dist/chunk-OBBCR6WY.js.map +0 -1
- package/dist/chunk-OQDSAOG3.js +0 -1908
- package/dist/chunk-OQDSAOG3.js.map +0 -1
- package/dist/chunk-OXNCBE7P.js +0 -971
- package/dist/chunk-OXNCBE7P.js.map +0 -1
- package/dist/chunk-PBZFAAOM.js +0 -941
- package/dist/chunk-PN6GIF3R.js +0 -1185
- package/dist/chunk-PN6GIF3R.js.map +0 -1
- package/dist/chunk-PYD44IHJ.js +0 -728
- package/dist/chunk-PYD44IHJ.js.map +0 -1
- package/dist/chunk-QVPIACWD.js +0 -679
- package/dist/chunk-QVPIACWD.js.map +0 -1
- package/dist/chunk-QWNNFE4P.js +0 -41
- package/dist/chunk-QWNNFE4P.js.map +0 -1
- package/dist/chunk-RU266375.js +0 -327
- package/dist/chunk-RU266375.js.map +0 -1
- package/dist/chunk-RYTSVGGA.js +0 -1624
- package/dist/chunk-RYTSVGGA.js.map +0 -1
- package/dist/chunk-RZOFS2BQ.js +0 -225
- package/dist/chunk-RZOFS2BQ.js.map +0 -1
- package/dist/chunk-SBS4S2PJ.js +0 -100
- package/dist/chunk-SBS4S2PJ.js.map +0 -1
- package/dist/chunk-SPRG6G6G.js +0 -530
- package/dist/chunk-SPRG6G6G.js.map +0 -1
- package/dist/chunk-STWFX5E2.js +0 -233
- package/dist/chunk-STWFX5E2.js.map +0 -1
- package/dist/chunk-UNASM5VJ.js +0 -419
- package/dist/chunk-UNASM5VJ.js.map +0 -1
- package/dist/chunk-VAT66FJA.js +0 -245
- package/dist/chunk-VAT66FJA.js.map +0 -1
- package/dist/chunk-VFCMR5GX.js +0 -49
- package/dist/chunk-VFCMR5GX.js.map +0 -1
- package/dist/chunk-VGAHZKNJ.js +0 -66
- package/dist/chunk-VGAHZKNJ.js.map +0 -1
- package/dist/chunk-VTJTAAXC.js +0 -627
- package/dist/chunk-VTJTAAXC.js.map +0 -1
- package/dist/chunk-VXVLKRU6.js +0 -758
- package/dist/chunk-VXVLKRU6.js.map +0 -1
- package/dist/chunk-WWUU5ETI.js +0 -163
- package/dist/chunk-WWUU5ETI.js.map +0 -1
- package/dist/chunk-XE4OXN2W.js +0 -10
- package/dist/chunk-XE4OXN2W.js.map +0 -1
- package/dist/chunk-XOJORS75.js +0 -1853
- package/dist/chunk-XOJORS75.js.map +0 -1
- package/dist/chunk-YMZEUTD2.js +0 -110
- package/dist/chunk-YMZEUTD2.js.map +0 -1
- package/dist/chunk-Z77BTSOK.js +0 -617
- package/dist/chunk-Z77BTSOK.js.map +0 -1
- package/dist/chunk-ZZK3WEDI.js +0 -181
- package/dist/chunk-ZZK3WEDI.js.map +0 -1
- package/dist/client-CCXpAZ2r.d.ts +0 -89
- package/dist/client-DSI_760t.d.ts +0 -36
- package/dist/client-JU6T3UPB.js +0 -11
- package/dist/client-JU6T3UPB.js.map +0 -1
- package/dist/dist-2X4Q7PJA.js +0 -1491
- package/dist/dist-2X4Q7PJA.js.map +0 -1
- package/dist/env-4UWSUS64.js +0 -4
- package/dist/env-4UWSUS64.js.map +0 -1
- package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
- package/dist/graphql-CMHMQjvd.d.ts +0 -23
- package/dist/i18n-Qm2AkPC-.d.ts +0 -33
- package/dist/index--yvpa6ay.d.ts +0 -83
- package/dist/index-4gKQKZ2B.d.ts +0 -71
- package/dist/index-5x0XMKXN.d.ts +0 -149
- package/dist/index-B70b5mYS.d.ts +0 -33
- package/dist/index-B8KrxO4j.d.ts +0 -755
- package/dist/index-BOuDKnqD.d.ts +0 -201
- package/dist/index-BTMt4OjA.d.ts +0 -201
- package/dist/index-BejbszA7.d.ts +0 -39
- package/dist/index-BkeOYZye.d.ts +0 -198
- package/dist/index-BuAj5nXg.d.ts +0 -83
- package/dist/index-BvkVcW8I.d.ts +0 -349
- package/dist/index-CWmH_-RZ.d.ts +0 -247
- package/dist/index-CbgWNcus.d.ts +0 -258
- package/dist/index-CmfPeQza.d.ts +0 -166
- package/dist/index-CmpG-zak.d.ts +0 -607
- package/dist/index-CoMKgL-p.d.ts +0 -12
- package/dist/index-D8HGwglK.d.ts +0 -541
- package/dist/index-DCaVm66D.d.ts +0 -1101
- package/dist/index-DE2w7E0d.d.ts +0 -83
- package/dist/index-DSOpj8DI.d.ts +0 -17
- package/dist/index-DW9q22GH.d.ts +0 -75
- package/dist/index-DnjJ9CwI.d.ts +0 -347
- package/dist/index-DwMJZ8PP.d.ts +0 -317
- package/dist/index-PaojfSdd.d.ts +0 -71
- package/dist/index-aHtYvc3i.d.ts +0 -284
- package/dist/index-e_18DzAg.d.ts +0 -18
- package/dist/index-ffmipXSA.d.ts +0 -55
- package/dist/index-joONjwLt.d.ts +0 -33
- package/dist/index-kssw5ziY.d.ts +0 -250
- package/dist/index-lFffh5-G.d.ts +0 -125
- package/dist/index-pxYge_6k.d.ts +0 -79
- package/dist/layer-Cv9vSwBx.d.ts +0 -70
- package/dist/pino-logger-H4HPW5P6.js +0 -5
- package/dist/pino-logger-H4HPW5P6.js.map +0 -1
- package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
- package/dist/sdk-L75WWUP3.js +0 -156
- package/dist/sdk-L75WWUP3.js.map +0 -1
- package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
- package/dist/types-Bo2wkjSP.d.ts +0 -35
- package/dist/types-DVpvrAhd.d.ts +0 -71
- package/dist/types-DgJ4lDYA.d.ts +0 -108
- package/dist/types-USOv09qy.d.ts +0 -327
- package/dist/workspace-guard-NXVYYBVJ.js +0 -5
- package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
|
@@ -0,0 +1,869 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-ad2WFvuA.js";
|
|
2
|
+
import { c as ValidationError, t as APIError } from "./types-Cj2RWXbz.js";
|
|
3
|
+
import { a as logger } from "./logger-B6rCpb7D.js";
|
|
4
|
+
|
|
5
|
+
// src/notifications/tenant-notifications.ts
|
|
6
|
+
var tenant_notifications_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
NotificationChannel: () => NotificationChannel$1,
|
|
8
|
+
NotificationPriority: () => NotificationPriority,
|
|
9
|
+
NotificationType: () => NotificationType$1,
|
|
10
|
+
TenantNotificationsModule: () => TenantNotificationsModule
|
|
11
|
+
});
|
|
12
|
+
let NotificationChannel$1 = /* @__PURE__ */ function(NotificationChannel) {
|
|
13
|
+
NotificationChannel["EMAIL"] = "EMAIL";
|
|
14
|
+
NotificationChannel["SMS"] = "SMS";
|
|
15
|
+
NotificationChannel["PUSH"] = "PUSH";
|
|
16
|
+
NotificationChannel["IN_APP"] = "IN_APP";
|
|
17
|
+
NotificationChannel["WEBHOOK"] = "WEBHOOK";
|
|
18
|
+
NotificationChannel["WHATSAPP"] = "WHATSAPP";
|
|
19
|
+
NotificationChannel["TEAMS"] = "TEAMS";
|
|
20
|
+
NotificationChannel["SLACK"] = "SLACK";
|
|
21
|
+
NotificationChannel["TELEGRAM"] = "TELEGRAM";
|
|
22
|
+
NotificationChannel["DISCORD"] = "DISCORD";
|
|
23
|
+
return NotificationChannel;
|
|
24
|
+
}({});
|
|
25
|
+
let NotificationPriority = /* @__PURE__ */ function(NotificationPriority) {
|
|
26
|
+
NotificationPriority["LOW"] = "LOW";
|
|
27
|
+
NotificationPriority["MEDIUM"] = "MEDIUM";
|
|
28
|
+
NotificationPriority["HIGH"] = "HIGH";
|
|
29
|
+
NotificationPriority["URGENT"] = "URGENT";
|
|
30
|
+
return NotificationPriority;
|
|
31
|
+
}({});
|
|
32
|
+
let NotificationType$1 = /* @__PURE__ */ function(NotificationType) {
|
|
33
|
+
NotificationType["TRANSACTIONAL"] = "TRANSACTIONAL";
|
|
34
|
+
NotificationType["MARKETING"] = "MARKETING";
|
|
35
|
+
NotificationType["SYSTEM"] = "SYSTEM";
|
|
36
|
+
NotificationType["ALERT"] = "ALERT";
|
|
37
|
+
return NotificationType;
|
|
38
|
+
}({});
|
|
39
|
+
/**
|
|
40
|
+
* Tenant-Backend Notifications Module
|
|
41
|
+
* Provides access to the centralized notification system
|
|
42
|
+
*/
|
|
43
|
+
var TenantNotificationsModule = class {
|
|
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 result = (await this.client.tenantQuery(`mutation ScheduleTenantNotification($input: ScheduleNotificationInput!) {
|
|
62
|
+
scheduleNotification(input: $input) { notificationId status }
|
|
63
|
+
}`, { input: {
|
|
64
|
+
notification,
|
|
65
|
+
scheduledFor: input.scheduledFor.toISOString(),
|
|
66
|
+
timezone: input.recipient.timezone
|
|
67
|
+
} }, callContext)).scheduleNotification;
|
|
68
|
+
if (!result?.notificationId || result.status !== "PENDING") throw new APIError("Notification scheduling was not acknowledged", { operation: "scheduleNotification" });
|
|
69
|
+
return result.notificationId;
|
|
70
|
+
}
|
|
71
|
+
const result = (await this.client.tenantQuery(`mutation TriggerTenantNotification($input: TriggerNotificationInput!) {
|
|
72
|
+
triggerNotification(input: $input) { id status channel }
|
|
73
|
+
}`, { input: {
|
|
74
|
+
notification,
|
|
75
|
+
platform: input.channel,
|
|
76
|
+
includeInApp: false
|
|
77
|
+
} }, callContext)).triggerNotification;
|
|
78
|
+
if (!result?.id || result.channel !== input.channel || ![
|
|
79
|
+
"TRIGGERED",
|
|
80
|
+
"SENT",
|
|
81
|
+
"DELIVERED"
|
|
82
|
+
].includes(result.status)) throw new APIError("Notification trigger was not acknowledged", {
|
|
83
|
+
operation: "triggerNotification",
|
|
84
|
+
notificationId: result?.id
|
|
85
|
+
});
|
|
86
|
+
logger.info("[TenantNotifications] Notification accepted", {
|
|
87
|
+
notificationId: result.id,
|
|
88
|
+
channel: result.channel,
|
|
89
|
+
status: result.status
|
|
90
|
+
});
|
|
91
|
+
return result.id;
|
|
92
|
+
}
|
|
93
|
+
/** Owner input deliberately excludes scheduling, which has a separate API. */
|
|
94
|
+
createNotificationInput(input, priority) {
|
|
95
|
+
return {
|
|
96
|
+
recipient: input.recipient,
|
|
97
|
+
channel: input.channel,
|
|
98
|
+
type: input.type ?? "TRANSACTIONAL",
|
|
99
|
+
priority: input.priority ?? priority ?? "MEDIUM",
|
|
100
|
+
subject: input.subject,
|
|
101
|
+
body: input.body,
|
|
102
|
+
htmlBody: input.htmlBody,
|
|
103
|
+
data: input.data,
|
|
104
|
+
metadata: input.metadata,
|
|
105
|
+
expiresAt: input.expiresAt?.toISOString(),
|
|
106
|
+
trackOpens: input.trackOpens,
|
|
107
|
+
trackClicks: input.trackClicks
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Send notification using a template
|
|
112
|
+
*/
|
|
113
|
+
async sendWithTemplate(input, context) {
|
|
114
|
+
if (!input.templateSlug || input.templateSlug.trim().length === 0) throw new ValidationError("Template slug is required");
|
|
115
|
+
if (!input.variables || typeof input.variables !== "object" || Array.isArray(input.variables)) throw new ValidationError("Template variables must be an object");
|
|
116
|
+
if (!input.recipient || !input.recipient.email && !input.recipient.userId) throw new ValidationError("Recipient email or userId is required");
|
|
117
|
+
this.validateDates(input);
|
|
118
|
+
logger.info("[TenantNotifications] Sending notification with template", {
|
|
119
|
+
templateSlug: input.templateSlug,
|
|
120
|
+
priority: input.priority || "MEDIUM"
|
|
121
|
+
});
|
|
122
|
+
const mutation = `
|
|
123
|
+
mutation TriggerNotificationWithTemplate($input: TriggerNotificationWithTemplateInput!) {
|
|
124
|
+
triggerNotificationWithTemplate(input: $input) {
|
|
125
|
+
totalRequested
|
|
126
|
+
totalTriggered
|
|
127
|
+
totalFailed
|
|
128
|
+
notifications {
|
|
129
|
+
id
|
|
130
|
+
status
|
|
131
|
+
deliveryStatus
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
`;
|
|
136
|
+
const variables = { input: {
|
|
137
|
+
templateSlug: input.templateSlug,
|
|
138
|
+
variables: input.variables,
|
|
139
|
+
recipient: input.recipient,
|
|
140
|
+
priority: input.priority || "MEDIUM",
|
|
141
|
+
scheduledFor: input.scheduledFor?.toISOString(),
|
|
142
|
+
expiresAt: input.expiresAt?.toISOString(),
|
|
143
|
+
trackOpens: input.trackOpens,
|
|
144
|
+
trackClicks: input.trackClicks,
|
|
145
|
+
channelId: input.channelId,
|
|
146
|
+
platform: input.platform || "EMAIL",
|
|
147
|
+
timezone: input.timezone
|
|
148
|
+
} };
|
|
149
|
+
const result = (await this.client.tenantQuery(mutation, variables, {
|
|
150
|
+
...this.context,
|
|
151
|
+
...context
|
|
152
|
+
})).triggerNotificationWithTemplate;
|
|
153
|
+
const firstNotification = result.notifications[0];
|
|
154
|
+
if (result.totalTriggered === 0 || !firstNotification) throw new ValidationError(`Notification trigger failed: requested=${result.totalRequested}, triggered=${result.totalTriggered}, failed=${result.totalFailed}`);
|
|
155
|
+
logger.info("[TenantNotifications] Notification sent with template", {
|
|
156
|
+
notificationId: firstNotification.id,
|
|
157
|
+
status: firstNotification.status,
|
|
158
|
+
totalTriggered: result.totalTriggered,
|
|
159
|
+
totalFailed: result.totalFailed
|
|
160
|
+
});
|
|
161
|
+
return firstNotification.id;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Send batch notifications
|
|
165
|
+
*/
|
|
166
|
+
async sendBatch(input, context) {
|
|
167
|
+
if (!input.notifications?.length) throw new ValidationError("At least one notification is required");
|
|
168
|
+
for (const notification of input.notifications) this.validateSendInput(notification);
|
|
169
|
+
if (new Set(input.notifications.map((notification) => notification.scheduledFor?.toISOString() ?? "")).size > 1) throw new ValidationError("Batch notifications must share a schedule; use send() for distinct schedules");
|
|
170
|
+
if (input.batchSize !== void 0 && (!Number.isInteger(input.batchSize) || input.batchSize <= 0)) throw new ValidationError("Batch size must be a positive integer");
|
|
171
|
+
if (input.delayBetweenBatches !== void 0 && (!Number.isInteger(input.delayBetweenBatches) || input.delayBetweenBatches < 0)) throw new ValidationError("Batch delay must be a nonnegative integer");
|
|
172
|
+
const result = (await this.client.tenantQuery(`mutation TriggerTenantBatchNotifications($input: TriggerBatchNotificationsInput!) {
|
|
173
|
+
triggerBatchNotifications(input: $input) { totalRequested totalQueued: totalTriggered totalFailed batchId }
|
|
174
|
+
}`, { input: {
|
|
175
|
+
notifications: input.notifications.map((notification) => this.createNotificationInput(notification, input.priority)),
|
|
176
|
+
priority: input.priority,
|
|
177
|
+
scheduledFor: input.notifications[0]?.scheduledFor?.toISOString(),
|
|
178
|
+
batchSize: input.batchSize,
|
|
179
|
+
delayBetweenBatches: input.delayBetweenBatches
|
|
180
|
+
} }, {
|
|
181
|
+
...this.context,
|
|
182
|
+
...context
|
|
183
|
+
})).triggerBatchNotifications;
|
|
184
|
+
if (!result?.batchId) throw new APIError("Notification batch was not acknowledged", { operation: "triggerBatchNotifications" });
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Get a notification by ID
|
|
189
|
+
*/
|
|
190
|
+
async getNotification(id) {
|
|
191
|
+
return (await this.client.tenantQuery(`
|
|
192
|
+
query GetNotification($id: ID!) {
|
|
193
|
+
notification(id: $id) {
|
|
194
|
+
id
|
|
195
|
+
userId
|
|
196
|
+
channel
|
|
197
|
+
type
|
|
198
|
+
priority
|
|
199
|
+
status
|
|
200
|
+
deliveryStatus
|
|
201
|
+
title
|
|
202
|
+
message
|
|
203
|
+
htmlMessage
|
|
204
|
+
subject
|
|
205
|
+
recipientEmail
|
|
206
|
+
recipientPhone
|
|
207
|
+
trackOpens
|
|
208
|
+
trackClicks
|
|
209
|
+
openedAt
|
|
210
|
+
clickedAt
|
|
211
|
+
sentAt
|
|
212
|
+
deliveredAt
|
|
213
|
+
createdAt
|
|
214
|
+
updatedAt
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
`, { id }, this.context)).notification;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Get notifications with filters
|
|
221
|
+
*/
|
|
222
|
+
async getNotifications(filter) {
|
|
223
|
+
const query = `
|
|
224
|
+
query GetNotifications($filter: NotificationFilterInput, $limit: Int, $offset: Int) {
|
|
225
|
+
notifications(filter: $filter, limit: $limit, offset: $offset) {
|
|
226
|
+
items {
|
|
227
|
+
id
|
|
228
|
+
userId
|
|
229
|
+
channel
|
|
230
|
+
type
|
|
231
|
+
priority
|
|
232
|
+
status
|
|
233
|
+
deliveryStatus
|
|
234
|
+
title
|
|
235
|
+
message
|
|
236
|
+
subject
|
|
237
|
+
recipientEmail
|
|
238
|
+
trackOpens
|
|
239
|
+
trackClicks
|
|
240
|
+
openedAt
|
|
241
|
+
clickedAt
|
|
242
|
+
sentAt
|
|
243
|
+
deliveredAt
|
|
244
|
+
createdAt
|
|
245
|
+
updatedAt
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
`;
|
|
250
|
+
const variables = {
|
|
251
|
+
filter: filter ? {
|
|
252
|
+
userId: filter.userId,
|
|
253
|
+
channel: filter.channel,
|
|
254
|
+
type: filter.type,
|
|
255
|
+
status: filter.status,
|
|
256
|
+
priority: filter.priority,
|
|
257
|
+
startDate: filter.startDate?.toISOString(),
|
|
258
|
+
endDate: filter.endDate?.toISOString()
|
|
259
|
+
} : void 0,
|
|
260
|
+
limit: filter?.limit ?? 50,
|
|
261
|
+
offset: filter?.offset ?? 0
|
|
262
|
+
};
|
|
263
|
+
return (await this.client.tenantQuery(query, variables, this.context)).notifications.items;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Get notification template
|
|
267
|
+
*/
|
|
268
|
+
async getTemplate(slug, locale) {
|
|
269
|
+
return (await this.client.tenantQuery(`
|
|
270
|
+
query GetNotificationTemplate($slug: String!, $locale: String) {
|
|
271
|
+
notificationTemplate(slug: $slug, locale: $locale) {
|
|
272
|
+
id
|
|
273
|
+
name
|
|
274
|
+
slug
|
|
275
|
+
description
|
|
276
|
+
channel
|
|
277
|
+
type
|
|
278
|
+
locale
|
|
279
|
+
subject
|
|
280
|
+
bodyTemplate
|
|
281
|
+
htmlTemplate
|
|
282
|
+
variables
|
|
283
|
+
enabled
|
|
284
|
+
version
|
|
285
|
+
createdAt
|
|
286
|
+
updatedAt
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
`, {
|
|
290
|
+
slug,
|
|
291
|
+
locale
|
|
292
|
+
}, this.context)).notificationTemplate;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Get all notification templates
|
|
296
|
+
*/
|
|
297
|
+
async getTemplates(filter) {
|
|
298
|
+
const query = `query GetNotificationTemplates($filter: TemplateFilterInput, $limit: Int!, $offset: Int!) {
|
|
299
|
+
notificationTemplates(filter: $filter, limit: $limit, offset: $offset) {
|
|
300
|
+
items { id name slug description channel type locale subject bodyTemplate htmlTemplate variables enabled version createdAt updatedAt }
|
|
301
|
+
hasMore
|
|
302
|
+
}
|
|
303
|
+
}`;
|
|
304
|
+
const templates = [];
|
|
305
|
+
const seen = /* @__PURE__ */ new Set();
|
|
306
|
+
for (let page = 0; page < 100; page++) {
|
|
307
|
+
const result = (await this.client.tenantQuery(query, {
|
|
308
|
+
filter,
|
|
309
|
+
limit: 100,
|
|
310
|
+
offset: templates.length
|
|
311
|
+
}, this.context)).notificationTemplates;
|
|
312
|
+
if (!result || !Array.isArray(result.items) || typeof result.hasMore !== "boolean") throw new APIError("Notification template page was invalid", { operation: "notificationTemplates" });
|
|
313
|
+
for (const template of result.items) {
|
|
314
|
+
if (!template.id || seen.has(template.id)) throw new APIError("Notification template pagination did not progress", { operation: "notificationTemplates" });
|
|
315
|
+
seen.add(template.id);
|
|
316
|
+
templates.push(template);
|
|
317
|
+
}
|
|
318
|
+
if (!result.hasMore) return templates;
|
|
319
|
+
if (!result.items.length) throw new APIError("Notification template pagination did not progress", { operation: "notificationTemplates" });
|
|
320
|
+
}
|
|
321
|
+
throw new APIError("Notification template pagination exceeded its bounded limit", { operation: "notificationTemplates" });
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Get notification statistics
|
|
325
|
+
*/
|
|
326
|
+
async getStats(filter) {
|
|
327
|
+
const query = `
|
|
328
|
+
query GetNotificationStats($filter: NotificationFilterInput) {
|
|
329
|
+
notificationStats(filter: $filter) {
|
|
330
|
+
total
|
|
331
|
+
pending
|
|
332
|
+
triggered
|
|
333
|
+
scheduled
|
|
334
|
+
cancelled
|
|
335
|
+
sent
|
|
336
|
+
delivered
|
|
337
|
+
failed
|
|
338
|
+
byChannel
|
|
339
|
+
byType
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
`;
|
|
343
|
+
const variables = { filter: filter ? {
|
|
344
|
+
userId: filter.userId,
|
|
345
|
+
startDate: filter.startDate?.toISOString(),
|
|
346
|
+
endDate: filter.endDate?.toISOString()
|
|
347
|
+
} : void 0 };
|
|
348
|
+
return (await this.client.tenantQuery(query, variables, this.context)).notificationStats;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Mark notifications as read
|
|
352
|
+
*/
|
|
353
|
+
async markAsRead(notificationIds) {
|
|
354
|
+
const result = await this.client.tenantQuery(`
|
|
355
|
+
mutation MarkNotificationsAsRead($notificationIds: [ID!]!) {
|
|
356
|
+
markNotificationsAsRead(notificationIds: $notificationIds) { success count failedIds }
|
|
357
|
+
}
|
|
358
|
+
`, { notificationIds }, this.context);
|
|
359
|
+
logger.info("[TenantNotifications] Read request completed", {
|
|
360
|
+
success: result.markNotificationsAsRead.success,
|
|
361
|
+
count: notificationIds.length
|
|
362
|
+
});
|
|
363
|
+
return result.markNotificationsAsRead.success;
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Mark all notifications as read for the current user
|
|
367
|
+
*/
|
|
368
|
+
async markAllAsRead() {
|
|
369
|
+
const result = await this.client.tenantQuery(`
|
|
370
|
+
mutation MarkAllMyNotificationsAsRead {
|
|
371
|
+
markAllMyNotificationsAsRead { success count failedIds }
|
|
372
|
+
}
|
|
373
|
+
`, {}, this.context);
|
|
374
|
+
logger.info("[TenantNotifications] Read-all request completed", { success: result.markAllMyNotificationsAsRead.success });
|
|
375
|
+
return result.markAllMyNotificationsAsRead.success;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Delete notifications
|
|
379
|
+
*/
|
|
380
|
+
async deleteNotifications(notificationIds) {
|
|
381
|
+
const result = await this.client.tenantQuery(`
|
|
382
|
+
mutation DeleteNotifications($notificationIds: [ID!]!) {
|
|
383
|
+
deleteNotifications(notificationIds: $notificationIds)
|
|
384
|
+
}
|
|
385
|
+
`, { notificationIds }, this.context);
|
|
386
|
+
logger.info("[TenantNotifications] Delete request completed", {
|
|
387
|
+
success: result.deleteNotifications,
|
|
388
|
+
count: notificationIds.length
|
|
389
|
+
});
|
|
390
|
+
return result.deleteNotifications;
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Delete all read notifications for the current user
|
|
394
|
+
*/
|
|
395
|
+
async deleteAllReadNotifications() {
|
|
396
|
+
const result = await this.client.tenantQuery(`
|
|
397
|
+
mutation DeleteMyReadNotifications {
|
|
398
|
+
deleteMyReadNotifications
|
|
399
|
+
}
|
|
400
|
+
`, {}, this.context);
|
|
401
|
+
logger.info("[TenantNotifications] Delete-read request completed", { success: result.deleteMyReadNotifications });
|
|
402
|
+
return result.deleteMyReadNotifications;
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Validate send notification input
|
|
406
|
+
*/
|
|
407
|
+
validateSendInput(input) {
|
|
408
|
+
if (!Object.values(NotificationChannel$1).includes(input.channel)) throw new ValidationError("A supported notification channel is required");
|
|
409
|
+
if (!input.recipient || !{
|
|
410
|
+
EMAIL: ["email", "userId"],
|
|
411
|
+
SMS: ["phoneNumber", "userId"],
|
|
412
|
+
PUSH: ["pushToken", "userId"],
|
|
413
|
+
IN_APP: ["userId"],
|
|
414
|
+
WEBHOOK: ["webhookUrl", "userId"],
|
|
415
|
+
WHATSAPP: [
|
|
416
|
+
"whatsappNumber",
|
|
417
|
+
"phoneNumber",
|
|
418
|
+
"userId"
|
|
419
|
+
],
|
|
420
|
+
TEAMS: ["teamsUserId", "userId"],
|
|
421
|
+
SLACK: ["slackUserId", "userId"],
|
|
422
|
+
TELEGRAM: ["userId"],
|
|
423
|
+
DISCORD: ["userId"]
|
|
424
|
+
}[input.channel].some((key) => {
|
|
425
|
+
const value = input.recipient[key];
|
|
426
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
427
|
+
})) throw new ValidationError("A recipient address or userId appropriate for the channel is required");
|
|
428
|
+
if (typeof input.body !== "string" || input.body.trim().length === 0) throw new ValidationError("Notification body is required");
|
|
429
|
+
this.validateDates(input);
|
|
430
|
+
}
|
|
431
|
+
validateDates(input) {
|
|
432
|
+
for (const value of [input.scheduledFor, input.expiresAt]) if (value != null && (!(value instanceof Date) || !Number.isFinite(value.getTime()))) throw new ValidationError("Notification dates must be valid Date values");
|
|
433
|
+
if (input.scheduledFor && input.expiresAt && input.expiresAt <= input.scheduledFor) throw new ValidationError("Notification expiry must follow its scheduled delivery");
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
// src/notifications/index.ts
|
|
438
|
+
let NotificationType = /* @__PURE__ */ function(NotificationType) {
|
|
439
|
+
NotificationType["INFO"] = "info";
|
|
440
|
+
NotificationType["SUCCESS"] = "success";
|
|
441
|
+
NotificationType["WARNING"] = "warning";
|
|
442
|
+
NotificationType["ERROR"] = "error";
|
|
443
|
+
return NotificationType;
|
|
444
|
+
}({});
|
|
445
|
+
let NotificationChannel = /* @__PURE__ */ function(NotificationChannel) {
|
|
446
|
+
NotificationChannel["EMAIL"] = "EMAIL";
|
|
447
|
+
NotificationChannel["SMS"] = "SMS";
|
|
448
|
+
NotificationChannel["WHATSAPP"] = "WHATSAPP";
|
|
449
|
+
NotificationChannel["PUSH"] = "PUSH";
|
|
450
|
+
NotificationChannel["SLACK"] = "SLACK";
|
|
451
|
+
NotificationChannel["TEAMS"] = "TEAMS";
|
|
452
|
+
NotificationChannel["WEBHOOK"] = "WEBHOOK";
|
|
453
|
+
return NotificationChannel;
|
|
454
|
+
}({});
|
|
455
|
+
/**
|
|
456
|
+
* Map the SDK's severity-flavoured `NotificationType` (info/success/warning/error) onto
|
|
457
|
+
* global-notification-svc's delivery-intent `NotificationType`
|
|
458
|
+
* (ALERT | MARKETING | SYSTEM | TRANSACTIONAL).
|
|
459
|
+
*
|
|
460
|
+
* The two enums describe different things and share no values, so an unmapped value would be
|
|
461
|
+
* rejected by the owner. Warnings and errors are alerts; everything else is transactional.
|
|
462
|
+
*/
|
|
463
|
+
function mapNotificationType(type) {
|
|
464
|
+
return type === "warning" || type === "error" ? "ALERT" : "TRANSACTIONAL";
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Choose the delivery channel required by `CreateNotificationInput.channel` (non-nullable).
|
|
468
|
+
*
|
|
469
|
+
* `SendNotificationOptions` expresses channel intent as the legacy `email`/`sms` booleans; the
|
|
470
|
+
* owner expects a single `NotificationChannel`. In-app is the default so a caller that sets
|
|
471
|
+
* neither flag still gets a delivered, visible notification.
|
|
472
|
+
*/
|
|
473
|
+
function resolveChannel(options) {
|
|
474
|
+
if (options.email) return "EMAIL";
|
|
475
|
+
if (options.sms) return "SMS";
|
|
476
|
+
return "IN_APP";
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Notifications Module
|
|
480
|
+
*/
|
|
481
|
+
var NotificationsModule = class {
|
|
482
|
+
client;
|
|
483
|
+
context;
|
|
484
|
+
constructor(client, context) {
|
|
485
|
+
this.client = client;
|
|
486
|
+
this.context = context;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Send notification to users
|
|
490
|
+
*/
|
|
491
|
+
async send(options) {
|
|
492
|
+
if (!options.title || options.title.trim().length === 0) throw new ValidationError("Notification title is required");
|
|
493
|
+
if (!options.message || options.message.trim().length === 0) throw new ValidationError("Notification message is required");
|
|
494
|
+
if (!options.userIds || options.userIds.length === 0) throw new ValidationError("At least one user ID is required");
|
|
495
|
+
if (options.expiresAt && (!(options.expiresAt instanceof Date) || !Number.isFinite(options.expiresAt.getTime()))) throw new ValidationError("Notification expiry must be a valid Date");
|
|
496
|
+
logger.info("[Notifications] Sending notification", {
|
|
497
|
+
userCount: options.userIds.length,
|
|
498
|
+
type: options.type || "info"
|
|
499
|
+
});
|
|
500
|
+
const mutation = `
|
|
501
|
+
mutation TriggerNotification($input: TriggerNotificationInput!) {
|
|
502
|
+
triggerNotification(input: $input) {
|
|
503
|
+
id
|
|
504
|
+
status
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
`;
|
|
508
|
+
const channel = resolveChannel(options);
|
|
509
|
+
const notificationIds = [];
|
|
510
|
+
const errors = [];
|
|
511
|
+
const results = await Promise.allSettled(options.userIds.map(async (userId) => {
|
|
512
|
+
const variables = { input: {
|
|
513
|
+
notification: {
|
|
514
|
+
recipient: { userId },
|
|
515
|
+
channel,
|
|
516
|
+
type: mapNotificationType(options.type),
|
|
517
|
+
subject: options.title,
|
|
518
|
+
body: options.message,
|
|
519
|
+
metadata: options.metadata,
|
|
520
|
+
data: options.data,
|
|
521
|
+
expiresAt: options.expiresAt?.toISOString(),
|
|
522
|
+
...options.redirectUrl ? { redirectUrl: options.redirectUrl } : {},
|
|
523
|
+
...options.appName ? { appName: options.appName } : {}
|
|
524
|
+
},
|
|
525
|
+
platform: channel,
|
|
526
|
+
includeInApp: channel !== "IN_APP"
|
|
527
|
+
} };
|
|
528
|
+
const id = (await this.client.tenantQuery(mutation, variables, this.context)).triggerNotification?.id;
|
|
529
|
+
if (!id) throw new Error(`notification service returned no id for user ${userId}`);
|
|
530
|
+
return id;
|
|
531
|
+
}));
|
|
532
|
+
for (const [index, settled] of results.entries()) if (settled.status === "fulfilled") notificationIds.push(settled.value);
|
|
533
|
+
else {
|
|
534
|
+
const reason = settled.reason instanceof Error ? settled.reason.message : String(settled.reason);
|
|
535
|
+
errors.push(`${options.userIds[index] ?? "unknown user"}: ${reason}`);
|
|
536
|
+
}
|
|
537
|
+
const result = {
|
|
538
|
+
successCount: notificationIds.length,
|
|
539
|
+
failureCount: errors.length,
|
|
540
|
+
errors,
|
|
541
|
+
notificationIds
|
|
542
|
+
};
|
|
543
|
+
logger.info("[Notifications] Notification sent", {
|
|
544
|
+
successCount: result.successCount,
|
|
545
|
+
failureCount: result.failureCount
|
|
546
|
+
});
|
|
547
|
+
return result;
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Send notification to a single user (convenience method)
|
|
551
|
+
*/
|
|
552
|
+
async sendToUser(userId, title, message, options) {
|
|
553
|
+
return this.send({
|
|
554
|
+
title,
|
|
555
|
+
message,
|
|
556
|
+
userIds: [userId],
|
|
557
|
+
...options
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Get notifications for a user
|
|
562
|
+
*/
|
|
563
|
+
async getNotifications(options) {
|
|
564
|
+
logger.debug("[Notifications] Getting notifications", { userId: options.userId });
|
|
565
|
+
const query = `
|
|
566
|
+
query GetNotifications(
|
|
567
|
+
$userId: ID!
|
|
568
|
+
$status: NotificationStatus
|
|
569
|
+
$type: NotificationType
|
|
570
|
+
$appName: String
|
|
571
|
+
$search: String
|
|
572
|
+
$limit: Int
|
|
573
|
+
$offset: Int
|
|
574
|
+
) {
|
|
575
|
+
getNotifications(
|
|
576
|
+
userId: $userId
|
|
577
|
+
status: $status
|
|
578
|
+
type: $type
|
|
579
|
+
appName: $appName
|
|
580
|
+
search: $search
|
|
581
|
+
limit: $limit
|
|
582
|
+
offset: $offset
|
|
583
|
+
) {
|
|
584
|
+
notifications {
|
|
585
|
+
id
|
|
586
|
+
userId
|
|
587
|
+
title
|
|
588
|
+
message
|
|
589
|
+
type
|
|
590
|
+
status
|
|
591
|
+
redirectUrl
|
|
592
|
+
appName
|
|
593
|
+
createdAt
|
|
594
|
+
updatedAt
|
|
595
|
+
}
|
|
596
|
+
total
|
|
597
|
+
unreadCount
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
`;
|
|
601
|
+
const variables = {
|
|
602
|
+
userId: options.userId,
|
|
603
|
+
status: options.status,
|
|
604
|
+
type: options.type,
|
|
605
|
+
appName: options.appName,
|
|
606
|
+
search: options.search,
|
|
607
|
+
limit: options.limit || 20,
|
|
608
|
+
offset: options.offset || 0
|
|
609
|
+
};
|
|
610
|
+
return (await this.client.query(query, variables, this.context)).getNotifications;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Mark notification as read
|
|
614
|
+
*/
|
|
615
|
+
async markAsRead(notificationId) {
|
|
616
|
+
logger.debug("[Notifications] Marking notification as read", { notificationId });
|
|
617
|
+
await this.client.tenantQuery(`
|
|
618
|
+
mutation MarkNotificationAsRead($notificationId: ID!) {
|
|
619
|
+
markNotificationAsRead(notificationId: $notificationId) {
|
|
620
|
+
id
|
|
621
|
+
status
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
`, { notificationId }, this.context);
|
|
625
|
+
logger.info("[Notifications] Notification marked as read", { notificationId });
|
|
626
|
+
return true;
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Mark multiple notifications as read
|
|
630
|
+
*/
|
|
631
|
+
async markMultipleAsRead(notificationIds) {
|
|
632
|
+
logger.debug("[Notifications] Marking multiple notifications as read", { count: notificationIds.length });
|
|
633
|
+
const response = await this.client.query(`
|
|
634
|
+
mutation MarkNotificationsAsRead($notificationIds: [ID!]!) {
|
|
635
|
+
markNotificationsAsRead(notificationIds: $notificationIds) {
|
|
636
|
+
count
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
`, { notificationIds }, this.context);
|
|
640
|
+
logger.info("[Notifications] Notifications marked as read", { count: response.markNotificationsAsRead.count });
|
|
641
|
+
return response.markNotificationsAsRead.count;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Mark all notifications as read for the current user
|
|
645
|
+
*/
|
|
646
|
+
async markAllAsRead() {
|
|
647
|
+
logger.debug("[Notifications] Marking all notifications as read");
|
|
648
|
+
const response = await this.client.query(`
|
|
649
|
+
mutation MarkAllMyNotificationsAsRead {
|
|
650
|
+
markAllMyNotificationsAsRead {
|
|
651
|
+
count
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
`, {}, this.context);
|
|
655
|
+
logger.info("[Notifications] All notifications marked as read", { count: response.markAllMyNotificationsAsRead.count });
|
|
656
|
+
return response.markAllMyNotificationsAsRead.count;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Delete notification
|
|
660
|
+
*/
|
|
661
|
+
async deleteNotification(notificationId) {
|
|
662
|
+
logger.debug("[Notifications] Deleting notification", { notificationId });
|
|
663
|
+
await this.client.tenantQuery(`
|
|
664
|
+
mutation DeleteNotification($notificationId: ID!) {
|
|
665
|
+
deleteNotification(notificationId: $notificationId) {
|
|
666
|
+
success
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
`, { notificationId }, this.context);
|
|
670
|
+
logger.info("[Notifications] Notification deleted", { notificationId });
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Delete multiple notifications
|
|
675
|
+
*/
|
|
676
|
+
async deleteMultiple(notificationIds) {
|
|
677
|
+
logger.debug("[Notifications] Deleting multiple notifications", { count: notificationIds.length });
|
|
678
|
+
const response = await this.client.query(`
|
|
679
|
+
mutation DeleteNotifications($notificationIds: [ID!]!) {
|
|
680
|
+
deleteNotifications(notificationIds: $notificationIds) {
|
|
681
|
+
count
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
`, { notificationIds }, this.context);
|
|
685
|
+
logger.info("[Notifications] Notifications deleted", { count: response.deleteNotifications.count });
|
|
686
|
+
return response.deleteNotifications.count;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Get unread notification count for a user
|
|
690
|
+
*/
|
|
691
|
+
async getUnreadCount(userId) {
|
|
692
|
+
return (await this.getNotifications({
|
|
693
|
+
userId,
|
|
694
|
+
status: "unread",
|
|
695
|
+
limit: 0
|
|
696
|
+
})).unreadCount;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Send notification via specific channel (EMAIL, SMS, WHATSAPP, etc.)
|
|
700
|
+
* with optional in-app notification
|
|
701
|
+
*/
|
|
702
|
+
async sendChannelNotification(options) {
|
|
703
|
+
if (!options.body || options.body.trim().length === 0) throw new ValidationError("Notification body is required");
|
|
704
|
+
if (!options.recipient && !options.recipients) throw new ValidationError("At least one recipient is required");
|
|
705
|
+
if (options.includeInApp && (!options.userIds || options.userIds.length === 0)) throw new ValidationError("User IDs are required when includeInApp is true");
|
|
706
|
+
logger.info("[Notifications] Sending channel notification", {
|
|
707
|
+
platform: options.platform,
|
|
708
|
+
recipientCount: options.recipients ? options.recipients.length : 1,
|
|
709
|
+
includeInApp: options.includeInApp,
|
|
710
|
+
inAppUserCount: options.userIds ? options.userIds.length : 0
|
|
711
|
+
});
|
|
712
|
+
const mutation = `
|
|
713
|
+
mutation TriggerNotification($input: TriggerNotificationInput!) {
|
|
714
|
+
triggerNotification(input: $input) {
|
|
715
|
+
id
|
|
716
|
+
status
|
|
717
|
+
deliveryStatus
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
`;
|
|
721
|
+
const variables = { input: {
|
|
722
|
+
platform: options.platform,
|
|
723
|
+
channelId: options.channelId,
|
|
724
|
+
includeInApp: options.includeInApp || false,
|
|
725
|
+
userIds: options.userIds || [],
|
|
726
|
+
notification: {
|
|
727
|
+
subject: options.subject || "",
|
|
728
|
+
body: options.body,
|
|
729
|
+
htmlBody: options.htmlBody || "",
|
|
730
|
+
channel: options.platform,
|
|
731
|
+
type: options.type || "info",
|
|
732
|
+
recipient: options.recipient,
|
|
733
|
+
appName: options.appName,
|
|
734
|
+
redirectUrl: options.redirectUrl || "",
|
|
735
|
+
metadata: options.metadata || {},
|
|
736
|
+
trackOpens: options.trackOpens || false,
|
|
737
|
+
trackClicks: options.trackClicks || false,
|
|
738
|
+
expiresAt: options.expiresAt?.toISOString()
|
|
739
|
+
}
|
|
740
|
+
} };
|
|
741
|
+
if (options.recipients && options.recipients.length > 1) {
|
|
742
|
+
const results = await Promise.allSettled(options.recipients.map((recipient) => this.client.tenantQuery(mutation, { input: {
|
|
743
|
+
...variables.input,
|
|
744
|
+
notification: {
|
|
745
|
+
...variables.input.notification,
|
|
746
|
+
recipient
|
|
747
|
+
}
|
|
748
|
+
} }, this.context)));
|
|
749
|
+
let successCount = 0;
|
|
750
|
+
let failureCount = 0;
|
|
751
|
+
const errors = [];
|
|
752
|
+
const notificationIds = [];
|
|
753
|
+
results.forEach((result, index) => {
|
|
754
|
+
if (result.status === "fulfilled") {
|
|
755
|
+
successCount++;
|
|
756
|
+
const response = result.value;
|
|
757
|
+
notificationIds.push(response.triggerNotification.id);
|
|
758
|
+
} else {
|
|
759
|
+
failureCount++;
|
|
760
|
+
errors.push(`Recipient ${index + 1}: ${result.reason instanceof Error ? result.reason.message : "Unknown error"}`);
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
const response = {
|
|
764
|
+
successCount,
|
|
765
|
+
failureCount,
|
|
766
|
+
errors,
|
|
767
|
+
notificationIds
|
|
768
|
+
};
|
|
769
|
+
logger.info("[Notifications] Channel notification sent (bulk)", {
|
|
770
|
+
successCount,
|
|
771
|
+
failureCount
|
|
772
|
+
});
|
|
773
|
+
return response;
|
|
774
|
+
} else try {
|
|
775
|
+
const response = await this.client.query(mutation, variables, this.context);
|
|
776
|
+
const result = {
|
|
777
|
+
successCount: 1,
|
|
778
|
+
failureCount: 0,
|
|
779
|
+
errors: [],
|
|
780
|
+
notificationIds: [response.triggerNotification.id]
|
|
781
|
+
};
|
|
782
|
+
logger.info("[Notifications] Channel notification sent", {
|
|
783
|
+
notificationId: response.triggerNotification.id,
|
|
784
|
+
status: response.triggerNotification.status
|
|
785
|
+
});
|
|
786
|
+
return result;
|
|
787
|
+
} catch (error) {
|
|
788
|
+
logger.error("[Notifications] Failed to send channel notification", { error });
|
|
789
|
+
return {
|
|
790
|
+
successCount: 0,
|
|
791
|
+
failureCount: 1,
|
|
792
|
+
errors: [error instanceof Error ? error.message : "Unknown error"],
|
|
793
|
+
notificationIds: []
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Send notification using a template with optional in-app notification
|
|
799
|
+
*/
|
|
800
|
+
async sendTemplateNotification(options) {
|
|
801
|
+
if (!options.templateSlug || options.templateSlug.trim().length === 0) throw new ValidationError("Template slug is required");
|
|
802
|
+
if (!options.variables || typeof options.variables !== "object") throw new ValidationError("Template variables are required");
|
|
803
|
+
if (!options.recipient && !options.recipients) throw new ValidationError("At least one recipient is required");
|
|
804
|
+
if (options.includeInApp && (!options.userIds || options.userIds.length === 0)) throw new ValidationError("User IDs are required when includeInApp is true");
|
|
805
|
+
logger.info("[Notifications] Sending template notification", {
|
|
806
|
+
templateSlug: options.templateSlug,
|
|
807
|
+
platform: options.platform,
|
|
808
|
+
recipientCount: options.recipients ? options.recipients.length : 1,
|
|
809
|
+
includeInApp: options.includeInApp,
|
|
810
|
+
inAppUserCount: options.userIds ? options.userIds.length : 0
|
|
811
|
+
});
|
|
812
|
+
const mutation = `
|
|
813
|
+
mutation TriggerNotificationWithTemplate($input: TriggerNotificationWithTemplateInput!) {
|
|
814
|
+
triggerNotificationWithTemplate(input: $input) {
|
|
815
|
+
totalRequested
|
|
816
|
+
totalTriggered
|
|
817
|
+
totalFailed
|
|
818
|
+
notifications {
|
|
819
|
+
id
|
|
820
|
+
status
|
|
821
|
+
deliveryStatus
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
`;
|
|
826
|
+
const variables = { input: {
|
|
827
|
+
platform: options.platform,
|
|
828
|
+
channelId: options.channelId,
|
|
829
|
+
includeInApp: options.includeInApp || false,
|
|
830
|
+
userIds: options.userIds || [],
|
|
831
|
+
templateSlug: options.templateSlug,
|
|
832
|
+
variables: options.variables,
|
|
833
|
+
recipient: options.recipient,
|
|
834
|
+
recipients: options.recipients,
|
|
835
|
+
trackOpens: options.trackOpens || false,
|
|
836
|
+
trackClicks: options.trackClicks || false,
|
|
837
|
+
expiresAt: options.expiresAt?.toISOString(),
|
|
838
|
+
scheduledFor: options.scheduledFor?.toISOString(),
|
|
839
|
+
timezone: options.timezone
|
|
840
|
+
} };
|
|
841
|
+
try {
|
|
842
|
+
const data = (await this.client.query(mutation, variables, this.context)).triggerNotificationWithTemplate;
|
|
843
|
+
const result = {
|
|
844
|
+
successCount: data.totalTriggered,
|
|
845
|
+
failureCount: data.totalFailed,
|
|
846
|
+
errors: [],
|
|
847
|
+
notificationIds: data.notifications.map((n) => n.id)
|
|
848
|
+
};
|
|
849
|
+
logger.info("[Notifications] Template notification sent", {
|
|
850
|
+
templateSlug: options.templateSlug,
|
|
851
|
+
totalTriggered: data.totalTriggered,
|
|
852
|
+
totalFailed: data.totalFailed,
|
|
853
|
+
notificationIds: result.notificationIds
|
|
854
|
+
});
|
|
855
|
+
return result;
|
|
856
|
+
} catch (error) {
|
|
857
|
+
logger.error("[Notifications] Failed to send template notification", { error });
|
|
858
|
+
return {
|
|
859
|
+
successCount: 0,
|
|
860
|
+
failureCount: 1,
|
|
861
|
+
errors: [error instanceof Error ? error.message : "Unknown error"],
|
|
862
|
+
notificationIds: []
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
export { NotificationPriority as a, tenant_notifications_exports as c, NotificationChannel$1 as i, NotificationType as n, NotificationType$1 as o, NotificationsModule as r, TenantNotificationsModule as s, NotificationChannel as t };
|
|
869
|
+
//# sourceMappingURL=notifications-CdETrtFK.js.map
|