@lssm/module.notifications 0.0.0-canary-20251217083314 → 1.41.1

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 (134) hide show
  1. package/dist/channels/index.js +1 -126
  2. package/dist/contracts/index.js +1 -436
  3. package/dist/entities/index.js +1 -254
  4. package/dist/index.js +1 -7
  5. package/dist/notifications.feature.js +1 -68
  6. package/dist/templates/index.js +3 -195
  7. package/package.json +12 -12
  8. package/dist/channels/index.d.ts +0 -106
  9. package/dist/contracts/index.d.ts +0 -637
  10. package/dist/entities/index.d.ts +0 -182
  11. package/dist/index.d.ts +0 -6
  12. package/dist/libs/contracts/dist/capabilities/openbanking.js +0 -88
  13. package/dist/libs/contracts/dist/client/index.js +0 -5
  14. package/dist/libs/contracts/dist/client/react/feature-render.js +0 -2
  15. package/dist/libs/contracts/dist/client/react/form-render.js +0 -4
  16. package/dist/libs/contracts/dist/client/react/index.js +0 -4
  17. package/dist/libs/contracts/dist/contract-registry/index.js +0 -1
  18. package/dist/libs/contracts/dist/contract-registry/schemas.js +0 -60
  19. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  20. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
  21. package/dist/libs/contracts/dist/docs/index.js +0 -29
  22. package/dist/libs/contracts/dist/docs/presentations.js +0 -71
  23. package/dist/libs/contracts/dist/docs/registry.js +0 -44
  24. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  25. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  26. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  27. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  28. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
  29. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
  30. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
  31. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
  32. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
  33. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
  34. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
  35. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
  36. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
  37. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
  38. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
  39. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
  40. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
  41. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
  42. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
  43. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
  44. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
  45. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
  46. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
  47. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
  48. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
  49. package/dist/libs/contracts/dist/events.js +0 -1
  50. package/dist/libs/contracts/dist/experiments/evaluator.js +0 -1
  51. package/dist/libs/contracts/dist/index.js +0 -71
  52. package/dist/libs/contracts/dist/install.js +0 -2
  53. package/dist/libs/contracts/dist/integrations/contracts.js +0 -377
  54. package/dist/libs/contracts/dist/integrations/index.js +0 -18
  55. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
  56. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
  57. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
  58. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
  59. package/dist/libs/contracts/dist/integrations/openbanking/models.js +0 -242
  60. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +0 -13
  61. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +0 -52
  62. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +0 -75
  63. package/dist/libs/contracts/dist/integrations/providers/gmail.js +0 -87
  64. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +0 -66
  65. package/dist/libs/contracts/dist/integrations/providers/index.js +0 -11
  66. package/dist/libs/contracts/dist/integrations/providers/mistral.js +0 -68
  67. package/dist/libs/contracts/dist/integrations/providers/postmark.js +0 -68
  68. package/dist/libs/contracts/dist/integrations/providers/powens.js +0 -116
  69. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +0 -73
  70. package/dist/libs/contracts/dist/integrations/providers/registry.js +0 -10
  71. package/dist/libs/contracts/dist/integrations/providers/stripe.js +0 -83
  72. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +0 -61
  73. package/dist/libs/contracts/dist/jsonschema.js +0 -1
  74. package/dist/libs/contracts/dist/knowledge/contracts.js +0 -306
  75. package/dist/libs/contracts/dist/knowledge/index.js +0 -7
  76. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +0 -34
  77. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
  78. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
  79. package/dist/libs/contracts/dist/knowledge/spaces/index.js +0 -6
  80. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +0 -34
  81. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +0 -37
  82. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
  83. package/dist/libs/contracts/dist/llm/exporters.js +0 -19
  84. package/dist/libs/contracts/dist/llm/index.js +0 -2
  85. package/dist/libs/contracts/dist/llm/prompts.js +0 -1
  86. package/dist/libs/contracts/dist/onboarding-base.js +0 -196
  87. package/dist/libs/contracts/dist/openapi.js +0 -1
  88. package/dist/libs/contracts/dist/ownership.js +0 -21
  89. package/dist/libs/contracts/dist/presentations.js +0 -1
  90. package/dist/libs/contracts/dist/presentations.v2.js +0 -11
  91. package/dist/libs/contracts/dist/prompt.js +0 -1
  92. package/dist/libs/contracts/dist/promptRegistry.js +0 -1
  93. package/dist/libs/contracts/dist/regenerator/index.js +0 -1
  94. package/dist/libs/contracts/dist/regenerator/service.js +0 -6
  95. package/dist/libs/contracts/dist/registry.js +0 -2
  96. package/dist/libs/contracts/dist/resources.js +0 -1
  97. package/dist/libs/contracts/dist/schema/dist/EnumType.js +0 -2
  98. package/dist/libs/contracts/dist/schema/dist/FieldType.js +0 -49
  99. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
  100. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +0 -39
  101. package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
  102. package/dist/libs/contracts/dist/schema/dist/entity/index.js +0 -2
  103. package/dist/libs/contracts/dist/schema/dist/entity/types.js +0 -1
  104. package/dist/libs/contracts/dist/schema/dist/index.js +0 -6
  105. package/dist/libs/contracts/dist/server/graphql-pothos.js +0 -6
  106. package/dist/libs/contracts/dist/server/index.js +0 -8
  107. package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +0 -4
  108. package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +0 -2
  109. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +0 -1
  110. package/dist/libs/contracts/dist/server/mcp/registerResources.js +0 -2
  111. package/dist/libs/contracts/dist/server/mcp/registerTools.js +0 -1
  112. package/dist/libs/contracts/dist/server/provider-mcp.js +0 -1
  113. package/dist/libs/contracts/dist/server/rest-elysia.js +0 -1
  114. package/dist/libs/contracts/dist/server/rest-express.js +0 -1
  115. package/dist/libs/contracts/dist/server/rest-generic.js +0 -1
  116. package/dist/libs/contracts/dist/server/rest-next-app.js +0 -1
  117. package/dist/libs/contracts/dist/server/rest-next-pages.js +0 -1
  118. package/dist/libs/contracts/dist/spec.js +0 -34
  119. package/dist/libs/contracts/dist/telemetry/index.js +0 -1
  120. package/dist/libs/contracts/dist/telemetry/tracker.js +0 -1
  121. package/dist/libs/contracts/dist/tests/index.js +0 -1
  122. package/dist/libs/contracts/dist/tests/runner.js +0 -2
  123. package/dist/libs/contracts/dist/workflow/index.js +0 -1
  124. package/dist/libs/contracts/dist/workflow/runner.js +0 -1
  125. package/dist/libs/schema/dist/EnumType.js +0 -56
  126. package/dist/libs/schema/dist/FieldType.js +0 -49
  127. package/dist/libs/schema/dist/ScalarTypeEnum.js +0 -236
  128. package/dist/libs/schema/dist/SchemaModel.js +0 -3
  129. package/dist/libs/schema/dist/entity/defineEntity.js +0 -236
  130. package/dist/libs/schema/dist/entity/index.js +0 -2
  131. package/dist/libs/schema/dist/entity/types.js +0 -1
  132. package/dist/libs/schema/dist/index.js +0 -6
  133. package/dist/notifications.feature.d.ts +0 -11
  134. package/dist/templates/index.d.ts +0 -91
@@ -1,254 +1 @@
1
- import { defineEntity, defineEntityEnum, field, index } from "../libs/schema/dist/entity/defineEntity.js";
2
- import "../libs/schema/dist/index.js";
3
-
4
- //#region src/entities/index.ts
5
- /**
6
- * Notification status enum.
7
- */
8
- const NotificationStatusEnum = defineEntityEnum({
9
- name: "NotificationStatus",
10
- values: [
11
- "PENDING",
12
- "SENT",
13
- "DELIVERED",
14
- "READ",
15
- "FAILED",
16
- "CANCELLED"
17
- ],
18
- schema: "lssm_notifications",
19
- description: "Status of a notification."
20
- });
21
- /**
22
- * Notification channel enum.
23
- */
24
- const NotificationChannelEnum = defineEntityEnum({
25
- name: "NotificationChannel",
26
- values: [
27
- "EMAIL",
28
- "IN_APP",
29
- "PUSH",
30
- "WEBHOOK",
31
- "SMS"
32
- ],
33
- schema: "lssm_notifications",
34
- description: "Delivery channel for notifications."
35
- });
36
- /**
37
- * Notification entity - individual notification instance.
38
- */
39
- const NotificationEntity = defineEntity({
40
- name: "Notification",
41
- description: "An individual notification to be delivered to a user.",
42
- schema: "lssm_notifications",
43
- map: "notification",
44
- fields: {
45
- id: field.id({ description: "Unique notification ID" }),
46
- userId: field.foreignKey({ description: "Target user ID" }),
47
- orgId: field.string({
48
- isOptional: true,
49
- description: "Organization context"
50
- }),
51
- templateId: field.string({
52
- isOptional: true,
53
- description: "Template used"
54
- }),
55
- title: field.string({ description: "Notification title" }),
56
- body: field.string({ description: "Notification body" }),
57
- actionUrl: field.string({
58
- isOptional: true,
59
- description: "Action URL"
60
- }),
61
- imageUrl: field.string({
62
- isOptional: true,
63
- description: "Image URL"
64
- }),
65
- type: field.string({ description: "Notification type (e.g., mention, update)" }),
66
- category: field.string({
67
- isOptional: true,
68
- description: "Notification category"
69
- }),
70
- priority: field.enum("NotificationPriority", { default: "NORMAL" }),
71
- channels: field.string({
72
- isArray: true,
73
- description: "Target delivery channels"
74
- }),
75
- status: field.enum("NotificationStatus", { default: "PENDING" }),
76
- sentAt: field.dateTime({ isOptional: true }),
77
- deliveredAt: field.dateTime({ isOptional: true }),
78
- readAt: field.dateTime({ isOptional: true }),
79
- metadata: field.json({
80
- isOptional: true,
81
- description: "Additional metadata"
82
- }),
83
- variables: field.json({
84
- isOptional: true,
85
- description: "Template variables used"
86
- }),
87
- triggeredBy: field.string({
88
- isOptional: true,
89
- description: "Event/action that triggered"
90
- }),
91
- sourceId: field.string({
92
- isOptional: true,
93
- description: "Source entity ID"
94
- }),
95
- sourceType: field.string({
96
- isOptional: true,
97
- description: "Source entity type"
98
- }),
99
- createdAt: field.createdAt(),
100
- updatedAt: field.updatedAt(),
101
- expiresAt: field.dateTime({
102
- isOptional: true,
103
- description: "Notification expiry"
104
- }),
105
- deliveryLogs: field.hasMany("DeliveryLog")
106
- },
107
- indexes: [
108
- index.on([
109
- "userId",
110
- "status",
111
- "createdAt"
112
- ]),
113
- index.on(["userId", "readAt"]),
114
- index.on(["orgId", "createdAt"]),
115
- index.on(["type", "createdAt"])
116
- ],
117
- enums: [NotificationStatusEnum, NotificationChannelEnum]
118
- });
119
- /**
120
- * Notification priority enum.
121
- */
122
- const NotificationPriorityEnum = defineEntityEnum({
123
- name: "NotificationPriority",
124
- values: [
125
- "LOW",
126
- "NORMAL",
127
- "HIGH",
128
- "URGENT"
129
- ],
130
- schema: "lssm_notifications",
131
- description: "Priority level of a notification."
132
- });
133
- /**
134
- * NotificationTemplate entity - reusable notification templates.
135
- */
136
- const NotificationTemplateEntity = defineEntity({
137
- name: "NotificationTemplate",
138
- description: "Reusable notification template.",
139
- schema: "lssm_notifications",
140
- map: "notification_template",
141
- fields: {
142
- id: field.id(),
143
- templateId: field.string({
144
- isUnique: true,
145
- description: "Template identifier"
146
- }),
147
- name: field.string({ description: "Template display name" }),
148
- description: field.string({ isOptional: true }),
149
- emailSubject: field.string({ isOptional: true }),
150
- emailBody: field.string({ isOptional: true }),
151
- inAppTitle: field.string({ isOptional: true }),
152
- inAppBody: field.string({ isOptional: true }),
153
- pushTitle: field.string({ isOptional: true }),
154
- pushBody: field.string({ isOptional: true }),
155
- defaultChannels: field.string({ isArray: true }),
156
- category: field.string({ isOptional: true }),
157
- priority: field.enum("NotificationPriority", { default: "NORMAL" }),
158
- variablesSchema: field.json({
159
- isOptional: true,
160
- description: "JSON schema for variables"
161
- }),
162
- enabled: field.boolean({ default: true }),
163
- createdAt: field.createdAt(),
164
- updatedAt: field.updatedAt()
165
- },
166
- enums: [NotificationPriorityEnum]
167
- });
168
- /**
169
- * NotificationPreference entity - user notification preferences.
170
- */
171
- const NotificationPreferenceEntity = defineEntity({
172
- name: "NotificationPreference",
173
- description: "User notification preferences by type and channel.",
174
- schema: "lssm_notifications",
175
- map: "notification_preference",
176
- fields: {
177
- id: field.id(),
178
- userId: field.foreignKey(),
179
- globalEnabled: field.boolean({ default: true }),
180
- quietHoursStart: field.string({
181
- isOptional: true,
182
- description: "Quiet hours start (HH:MM)"
183
- }),
184
- quietHoursEnd: field.string({
185
- isOptional: true,
186
- description: "Quiet hours end (HH:MM)"
187
- }),
188
- timezone: field.string({ default: "\"UTC\"" }),
189
- channelPreferences: field.json({ description: "Channel-level preferences" }),
190
- typePreferences: field.json({ description: "Type-level preferences" }),
191
- digestEnabled: field.boolean({ default: false }),
192
- digestFrequency: field.string({
193
- isOptional: true,
194
- description: "daily, weekly, etc."
195
- }),
196
- digestTime: field.string({
197
- isOptional: true,
198
- description: "Digest send time (HH:MM)"
199
- }),
200
- createdAt: field.createdAt(),
201
- updatedAt: field.updatedAt()
202
- },
203
- indexes: [index.unique(["userId"])]
204
- });
205
- /**
206
- * DeliveryLog entity - track delivery attempts per channel.
207
- */
208
- const DeliveryLogEntity = defineEntity({
209
- name: "DeliveryLog",
210
- description: "Log of notification delivery attempts.",
211
- schema: "lssm_notifications",
212
- map: "delivery_log",
213
- fields: {
214
- id: field.id(),
215
- notificationId: field.foreignKey(),
216
- channel: field.enum("NotificationChannel"),
217
- status: field.enum("NotificationStatus"),
218
- attemptedAt: field.dateTime(),
219
- deliveredAt: field.dateTime({ isOptional: true }),
220
- responseCode: field.string({ isOptional: true }),
221
- responseMessage: field.string({ isOptional: true }),
222
- externalId: field.string({
223
- isOptional: true,
224
- description: "Provider message ID"
225
- }),
226
- metadata: field.json({ isOptional: true }),
227
- notification: field.belongsTo("Notification", ["notificationId"], ["id"], { onDelete: "Cascade" })
228
- },
229
- indexes: [index.on(["notificationId", "channel"])]
230
- });
231
- /**
232
- * All notification entities for schema composition.
233
- */
234
- const notificationEntities = [
235
- NotificationEntity,
236
- NotificationTemplateEntity,
237
- NotificationPreferenceEntity,
238
- DeliveryLogEntity
239
- ];
240
- /**
241
- * Module schema contribution for notifications.
242
- */
243
- const notificationsSchemaContribution = {
244
- moduleId: "@lssm/module.notifications",
245
- entities: notificationEntities,
246
- enums: [
247
- NotificationStatusEnum,
248
- NotificationChannelEnum,
249
- NotificationPriorityEnum
250
- ]
251
- };
252
-
253
- //#endregion
254
- export { DeliveryLogEntity, NotificationChannelEnum, NotificationEntity, NotificationPreferenceEntity, NotificationPriorityEnum, NotificationStatusEnum, NotificationTemplateEntity, notificationEntities, notificationsSchemaContribution };
1
+ import{defineEntity as e,defineEntityEnum as t,field as n,index as r}from"@lssm/lib.schema";const i=t({name:`NotificationStatus`,values:[`PENDING`,`SENT`,`DELIVERED`,`READ`,`FAILED`,`CANCELLED`],schema:`lssm_notifications`,description:`Status of a notification.`}),a=t({name:`NotificationChannel`,values:[`EMAIL`,`IN_APP`,`PUSH`,`WEBHOOK`,`SMS`],schema:`lssm_notifications`,description:`Delivery channel for notifications.`}),o=e({name:`Notification`,description:`An individual notification to be delivered to a user.`,schema:`lssm_notifications`,map:`notification`,fields:{id:n.id({description:`Unique notification ID`}),userId:n.foreignKey({description:`Target user ID`}),orgId:n.string({isOptional:!0,description:`Organization context`}),templateId:n.string({isOptional:!0,description:`Template used`}),title:n.string({description:`Notification title`}),body:n.string({description:`Notification body`}),actionUrl:n.string({isOptional:!0,description:`Action URL`}),imageUrl:n.string({isOptional:!0,description:`Image URL`}),type:n.string({description:`Notification type (e.g., mention, update)`}),category:n.string({isOptional:!0,description:`Notification category`}),priority:n.enum(`NotificationPriority`,{default:`NORMAL`}),channels:n.string({isArray:!0,description:`Target delivery channels`}),status:n.enum(`NotificationStatus`,{default:`PENDING`}),sentAt:n.dateTime({isOptional:!0}),deliveredAt:n.dateTime({isOptional:!0}),readAt:n.dateTime({isOptional:!0}),metadata:n.json({isOptional:!0,description:`Additional metadata`}),variables:n.json({isOptional:!0,description:`Template variables used`}),triggeredBy:n.string({isOptional:!0,description:`Event/action that triggered`}),sourceId:n.string({isOptional:!0,description:`Source entity ID`}),sourceType:n.string({isOptional:!0,description:`Source entity type`}),createdAt:n.createdAt(),updatedAt:n.updatedAt(),expiresAt:n.dateTime({isOptional:!0,description:`Notification expiry`}),deliveryLogs:n.hasMany(`DeliveryLog`)},indexes:[r.on([`userId`,`status`,`createdAt`]),r.on([`userId`,`readAt`]),r.on([`orgId`,`createdAt`]),r.on([`type`,`createdAt`])],enums:[i,a]}),s=t({name:`NotificationPriority`,values:[`LOW`,`NORMAL`,`HIGH`,`URGENT`],schema:`lssm_notifications`,description:`Priority level of a notification.`}),c=e({name:`NotificationTemplate`,description:`Reusable notification template.`,schema:`lssm_notifications`,map:`notification_template`,fields:{id:n.id(),templateId:n.string({isUnique:!0,description:`Template identifier`}),name:n.string({description:`Template display name`}),description:n.string({isOptional:!0}),emailSubject:n.string({isOptional:!0}),emailBody:n.string({isOptional:!0}),inAppTitle:n.string({isOptional:!0}),inAppBody:n.string({isOptional:!0}),pushTitle:n.string({isOptional:!0}),pushBody:n.string({isOptional:!0}),defaultChannels:n.string({isArray:!0}),category:n.string({isOptional:!0}),priority:n.enum(`NotificationPriority`,{default:`NORMAL`}),variablesSchema:n.json({isOptional:!0,description:`JSON schema for variables`}),enabled:n.boolean({default:!0}),createdAt:n.createdAt(),updatedAt:n.updatedAt()},enums:[s]}),l=e({name:`NotificationPreference`,description:`User notification preferences by type and channel.`,schema:`lssm_notifications`,map:`notification_preference`,fields:{id:n.id(),userId:n.foreignKey(),globalEnabled:n.boolean({default:!0}),quietHoursStart:n.string({isOptional:!0,description:`Quiet hours start (HH:MM)`}),quietHoursEnd:n.string({isOptional:!0,description:`Quiet hours end (HH:MM)`}),timezone:n.string({default:`"UTC"`}),channelPreferences:n.json({description:`Channel-level preferences`}),typePreferences:n.json({description:`Type-level preferences`}),digestEnabled:n.boolean({default:!1}),digestFrequency:n.string({isOptional:!0,description:`daily, weekly, etc.`}),digestTime:n.string({isOptional:!0,description:`Digest send time (HH:MM)`}),createdAt:n.createdAt(),updatedAt:n.updatedAt()},indexes:[r.unique([`userId`])]}),u=e({name:`DeliveryLog`,description:`Log of notification delivery attempts.`,schema:`lssm_notifications`,map:`delivery_log`,fields:{id:n.id(),notificationId:n.foreignKey(),channel:n.enum(`NotificationChannel`),status:n.enum(`NotificationStatus`),attemptedAt:n.dateTime(),deliveredAt:n.dateTime({isOptional:!0}),responseCode:n.string({isOptional:!0}),responseMessage:n.string({isOptional:!0}),externalId:n.string({isOptional:!0,description:`Provider message ID`}),metadata:n.json({isOptional:!0}),notification:n.belongsTo(`Notification`,[`notificationId`],[`id`],{onDelete:`Cascade`})},indexes:[r.on([`notificationId`,`channel`])]}),d=[o,c,l,u],f={moduleId:`@lssm/module.notifications`,entities:d,enums:[i,a,s]};export{u as DeliveryLogEntity,a as NotificationChannelEnum,o as NotificationEntity,l as NotificationPreferenceEntity,s as NotificationPriorityEnum,i as NotificationStatusEnum,c as NotificationTemplateEntity,d as notificationEntities,f as notificationsSchemaContribution};
package/dist/index.js CHANGED
@@ -1,7 +1 @@
1
- import { DeliveryLogEntity, NotificationChannelEnum, NotificationEntity, NotificationPreferenceEntity, NotificationPriorityEnum, NotificationStatusEnum, NotificationTemplateEntity, notificationEntities, notificationsSchemaContribution } from "./entities/index.js";
2
- import { DeleteNotificationContract, GetNotificationPreferencesContract, ListNotificationsContract, ListNotificationsInputModel, ListNotificationsOutputModel, MarkAllNotificationsReadContract, MarkNotificationReadContract, NotificationFilterEnum, NotificationModel, NotificationPreferenceModel, SendNotificationContract, SendNotificationInputModel, UpdateNotificationPreferencesContract, UpdatePreferencesInputModel } from "./contracts/index.js";
3
- import { ChannelRegistry, ConsoleChannel, EmailChannel, InAppChannel, PushChannel, WebhookChannel, createChannelRegistry } from "./channels/index.js";
4
- import { MentionTemplate, OrgInviteTemplate, TemplateRegistry, WelcomeTemplate, createTemplateRegistry, defineTemplate, renderNotificationTemplate, renderTemplate } from "./templates/index.js";
5
- import { NotificationsFeature } from "./notifications.feature.js";
6
-
7
- export { ChannelRegistry, ConsoleChannel, DeleteNotificationContract, DeliveryLogEntity, EmailChannel, GetNotificationPreferencesContract, InAppChannel, ListNotificationsContract, ListNotificationsInputModel, ListNotificationsOutputModel, MarkAllNotificationsReadContract, MarkNotificationReadContract, MentionTemplate, NotificationChannelEnum, NotificationEntity, NotificationFilterEnum, NotificationModel, NotificationPreferenceEntity, NotificationPreferenceModel, NotificationPriorityEnum, NotificationStatusEnum, NotificationTemplateEntity, NotificationsFeature, OrgInviteTemplate, PushChannel, SendNotificationContract, SendNotificationInputModel, TemplateRegistry, UpdateNotificationPreferencesContract, UpdatePreferencesInputModel, WebhookChannel, WelcomeTemplate, createChannelRegistry, createTemplateRegistry, defineTemplate, notificationEntities, notificationsSchemaContribution, renderNotificationTemplate, renderTemplate };
1
+ import{DeliveryLogEntity as e,NotificationChannelEnum as t,NotificationEntity as n,NotificationPreferenceEntity as r,NotificationPriorityEnum as i,NotificationStatusEnum as a,NotificationTemplateEntity as o,notificationEntities as s,notificationsSchemaContribution as c}from"./entities/index.js";import{DeleteNotificationContract as l,GetNotificationPreferencesContract as u,ListNotificationsContract as d,ListNotificationsInputModel as f,ListNotificationsOutputModel as p,MarkAllNotificationsReadContract as m,MarkNotificationReadContract as h,NotificationFilterEnum as g,NotificationModel as _,NotificationPreferenceModel as v,SendNotificationContract as y,SendNotificationInputModel as b,UpdateNotificationPreferencesContract as x,UpdatePreferencesInputModel as S}from"./contracts/index.js";import{ChannelRegistry as C,ConsoleChannel as w,EmailChannel as T,InAppChannel as E,PushChannel as D,WebhookChannel as O,createChannelRegistry as k}from"./channels/index.js";import{MentionTemplate as A,OrgInviteTemplate as j,TemplateRegistry as M,WelcomeTemplate as N,createTemplateRegistry as P,defineTemplate as F,renderNotificationTemplate as I,renderTemplate as L}from"./templates/index.js";import{NotificationsFeature as R}from"./notifications.feature.js";export{C as ChannelRegistry,w as ConsoleChannel,l as DeleteNotificationContract,e as DeliveryLogEntity,T as EmailChannel,u as GetNotificationPreferencesContract,E as InAppChannel,d as ListNotificationsContract,f as ListNotificationsInputModel,p as ListNotificationsOutputModel,m as MarkAllNotificationsReadContract,h as MarkNotificationReadContract,A as MentionTemplate,t as NotificationChannelEnum,n as NotificationEntity,g as NotificationFilterEnum,_ as NotificationModel,r as NotificationPreferenceEntity,v as NotificationPreferenceModel,i as NotificationPriorityEnum,a as NotificationStatusEnum,o as NotificationTemplateEntity,R as NotificationsFeature,j as OrgInviteTemplate,D as PushChannel,y as SendNotificationContract,b as SendNotificationInputModel,M as TemplateRegistry,x as UpdateNotificationPreferencesContract,S as UpdatePreferencesInputModel,O as WebhookChannel,N as WelcomeTemplate,k as createChannelRegistry,P as createTemplateRegistry,F as defineTemplate,s as notificationEntities,c as notificationsSchemaContribution,I as renderNotificationTemplate,L as renderTemplate};
@@ -1,68 +1 @@
1
- //#region src/notifications.feature.ts
2
- /**
3
- * Notifications feature module that bundles notification sending,
4
- * listing, marking as read, and preference management capabilities.
5
- */
6
- const NotificationsFeature = {
7
- meta: {
8
- key: "notifications",
9
- title: "Notifications",
10
- description: "Multi-channel notification delivery with preference management",
11
- domain: "platform",
12
- owners: ["@platform.notifications"],
13
- tags: [
14
- "notifications",
15
- "email",
16
- "push",
17
- "in-app"
18
- ],
19
- stability: "stable"
20
- },
21
- operations: [
22
- {
23
- name: "notifications.send",
24
- version: 1
25
- },
26
- {
27
- name: "notifications.markRead",
28
- version: 1
29
- },
30
- {
31
- name: "notifications.markAllRead",
32
- version: 1
33
- },
34
- {
35
- name: "notifications.delete",
36
- version: 1
37
- },
38
- {
39
- name: "notifications.list",
40
- version: 1
41
- },
42
- {
43
- name: "notifications.preferences.update",
44
- version: 1
45
- },
46
- {
47
- name: "notifications.preferences.get",
48
- version: 1
49
- }
50
- ],
51
- events: [],
52
- presentations: [],
53
- opToPresentation: [],
54
- presentationsTargets: [],
55
- capabilities: {
56
- provides: [{
57
- key: "notifications",
58
- version: 1
59
- }],
60
- requires: [{
61
- key: "identity",
62
- version: 1
63
- }]
64
- }
65
- };
66
-
67
- //#endregion
68
- export { NotificationsFeature };
1
+ const e={meta:{key:`notifications`,title:`Notifications`,description:`Multi-channel notification delivery with preference management`,domain:`platform`,owners:[`@platform.notifications`],tags:[`notifications`,`email`,`push`,`in-app`],stability:`stable`},operations:[{name:`notifications.send`,version:1},{name:`notifications.markRead`,version:1},{name:`notifications.markAllRead`,version:1},{name:`notifications.delete`,version:1},{name:`notifications.list`,version:1},{name:`notifications.preferences.update`,version:1},{name:`notifications.preferences.get`,version:1}],events:[],presentations:[],opToPresentation:[],presentationsTargets:[],capabilities:{provides:[{key:`notifications`,version:1}],requires:[{key:`identity`,version:1}]}};export{e as NotificationsFeature};
@@ -1,201 +1,9 @@
1
- //#region src/templates/index.ts
2
- /**
3
- * Define a notification template.
4
- */
5
- function defineTemplate(def) {
6
- return def;
7
- }
8
- /**
9
- * Render a template with variables.
10
- */
11
- function renderTemplate(content, variables) {
12
- return content.replace(/\{\{(\w+)\}\}/g, (match, key) => {
13
- const value = variables[key];
14
- if (value === void 0 || value === null) return match;
15
- return String(value);
16
- });
17
- }
18
- /**
19
- * Render a notification template for a specific channel.
20
- */
21
- function renderNotificationTemplate(template, channel, variables) {
22
- const channelContent = template.channels[channel];
23
- if (!channelContent) return null;
24
- const title = channelContent.title ? renderTemplate(channelContent.title, variables) : template.name;
25
- const body = renderTemplate(channelContent.body, variables);
26
- const result = {
27
- title,
28
- body,
29
- actionUrl: channelContent.actionUrl ? renderTemplate(channelContent.actionUrl, variables) : void 0
30
- };
31
- if (channel === "email" && channelContent.subject) result.email = {
32
- subject: renderTemplate(channelContent.subject, variables),
33
- html: body,
34
- text: stripHtml(body)
35
- };
36
- return result;
37
- }
38
- /**
39
- * Strip HTML tags from content (for plain text).
40
- */
41
- function stripHtml(html) {
42
- return html.replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
43
- }
44
- /**
45
- * Template registry for managing templates.
46
- */
47
- var TemplateRegistry = class {
48
- templates = /* @__PURE__ */ new Map();
49
- register(template) {
50
- this.templates.set(template.id, template);
51
- }
52
- get(templateId) {
53
- return this.templates.get(templateId);
54
- }
55
- getAll() {
56
- return Array.from(this.templates.values());
57
- }
58
- getByCategory(category) {
59
- return this.getAll().filter((t) => t.category === category);
60
- }
61
- };
62
- /**
63
- * Create a template registry.
64
- */
65
- function createTemplateRegistry() {
66
- return new TemplateRegistry();
67
- }
68
- /**
69
- * Welcome email template.
70
- */
71
- const WelcomeTemplate = defineTemplate({
72
- id: "welcome",
73
- name: "Welcome",
74
- description: "Sent when a user signs up.",
75
- category: "onboarding",
76
- variables: [
77
- {
78
- name: "name",
79
- type: "string",
80
- required: true
81
- },
82
- {
83
- name: "appName",
84
- type: "string",
85
- default: "ContractSpec"
86
- },
87
- {
88
- name: "actionUrl",
89
- type: "url"
90
- }
91
- ],
92
- defaultChannels: ["EMAIL", "IN_APP"],
93
- channels: {
94
- email: {
95
- subject: "Welcome to {{appName}}, {{name}}!",
96
- body: `
1
+ function e(e){return e}function t(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>{let r=t[n];return r==null?e:String(r)})}function n(e,n,i){let a=e.channels[n];if(!a)return null;let o=a.title?t(a.title,i):e.name,s=t(a.body,i),c={title:o,body:s,actionUrl:a.actionUrl?t(a.actionUrl,i):void 0};return n===`email`&&a.subject&&(c.email={subject:t(a.subject,i),html:s,text:r(s)}),c}function r(e){return e.replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim()}var i=class{templates=new Map;register(e){this.templates.set(e.id,e)}get(e){return this.templates.get(e)}getAll(){return Array.from(this.templates.values())}getByCategory(e){return this.getAll().filter(t=>t.category===e)}};function a(){return new i}const o=e({id:`welcome`,name:`Welcome`,description:`Sent when a user signs up.`,category:`onboarding`,variables:[{name:`name`,type:`string`,required:!0},{name:`appName`,type:`string`,default:`ContractSpec`},{name:`actionUrl`,type:`url`}],defaultChannels:[`EMAIL`,`IN_APP`],channels:{email:{subject:`Welcome to {{appName}}, {{name}}!`,body:`
97
2
  <h1>Welcome, {{name}}!</h1>
98
3
  <p>Thanks for joining {{appName}}. We're excited to have you on board.</p>
99
4
  <p><a href="{{actionUrl}}">Get started now</a></p>
100
- `
101
- },
102
- inApp: {
103
- title: "Welcome to {{appName}}!",
104
- body: "Thanks for joining. Click to complete your profile.",
105
- actionUrl: "{{actionUrl}}"
106
- }
107
- }
108
- });
109
- /**
110
- * Organization invite template.
111
- */
112
- const OrgInviteTemplate = defineTemplate({
113
- id: "org-invite",
114
- name: "Organization Invitation",
115
- description: "Sent when a user is invited to an organization.",
116
- category: "organization",
117
- variables: [
118
- {
119
- name: "inviterName",
120
- type: "string",
121
- required: true
122
- },
123
- {
124
- name: "orgName",
125
- type: "string",
126
- required: true
127
- },
128
- {
129
- name: "role",
130
- type: "string",
131
- default: "member"
132
- },
133
- {
134
- name: "actionUrl",
135
- type: "url",
136
- required: true
137
- }
138
- ],
139
- defaultChannels: ["EMAIL"],
140
- channels: {
141
- email: {
142
- subject: "{{inviterName}} invited you to join {{orgName}}",
143
- body: `
5
+ `},inApp:{title:`Welcome to {{appName}}!`,body:`Thanks for joining. Click to complete your profile.`,actionUrl:`{{actionUrl}}`}}}),s=e({id:`org-invite`,name:`Organization Invitation`,description:`Sent when a user is invited to an organization.`,category:`organization`,variables:[{name:`inviterName`,type:`string`,required:!0},{name:`orgName`,type:`string`,required:!0},{name:`role`,type:`string`,default:`member`},{name:`actionUrl`,type:`url`,required:!0}],defaultChannels:[`EMAIL`],channels:{email:{subject:`{{inviterName}} invited you to join {{orgName}}`,body:`
144
6
  <h1>You've been invited!</h1>
145
7
  <p>{{inviterName}} has invited you to join <strong>{{orgName}}</strong> as a {{role}}.</p>
146
8
  <p><a href="{{actionUrl}}">Accept invitation</a></p>
147
- `
148
- },
149
- inApp: {
150
- title: "Invitation to {{orgName}}",
151
- body: "{{inviterName}} invited you to join as {{role}}.",
152
- actionUrl: "{{actionUrl}}",
153
- actionText: "Accept"
154
- }
155
- }
156
- });
157
- /**
158
- * Mention template.
159
- */
160
- const MentionTemplate = defineTemplate({
161
- id: "mention",
162
- name: "Mention",
163
- description: "Sent when a user is mentioned.",
164
- category: "social",
165
- variables: [
166
- {
167
- name: "mentionerName",
168
- type: "string",
169
- required: true
170
- },
171
- {
172
- name: "context",
173
- type: "string",
174
- required: true
175
- },
176
- {
177
- name: "preview",
178
- type: "string"
179
- },
180
- {
181
- name: "actionUrl",
182
- type: "url",
183
- required: true
184
- }
185
- ],
186
- defaultChannels: ["IN_APP", "PUSH"],
187
- channels: {
188
- inApp: {
189
- title: "{{mentionerName}} mentioned you",
190
- body: "In {{context}}: \"{{preview}}\"",
191
- actionUrl: "{{actionUrl}}"
192
- },
193
- push: {
194
- title: "{{mentionerName}} mentioned you",
195
- body: "{{preview}}"
196
- }
197
- }
198
- });
199
-
200
- //#endregion
201
- export { MentionTemplate, OrgInviteTemplate, TemplateRegistry, WelcomeTemplate, createTemplateRegistry, defineTemplate, renderNotificationTemplate, renderTemplate };
9
+ `},inApp:{title:`Invitation to {{orgName}}`,body:`{{inviterName}} invited you to join as {{role}}.`,actionUrl:`{{actionUrl}}`,actionText:`Accept`}}}),c=e({id:`mention`,name:`Mention`,description:`Sent when a user is mentioned.`,category:`social`,variables:[{name:`mentionerName`,type:`string`,required:!0},{name:`context`,type:`string`,required:!0},{name:`preview`,type:`string`},{name:`actionUrl`,type:`url`,required:!0}],defaultChannels:[`IN_APP`,`PUSH`],channels:{inApp:{title:`{{mentionerName}} mentioned you`,body:`In {{context}}: "{{preview}}"`,actionUrl:`{{actionUrl}}`},push:{title:`{{mentionerName}} mentioned you`,body:`{{preview}}`}}});export{c as MentionTemplate,s as OrgInviteTemplate,i as TemplateRegistry,o as WelcomeTemplate,a as createTemplateRegistry,e as defineTemplate,n as renderNotificationTemplate,t as renderTemplate};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/module.notifications",
3
- "version": "0.0.0-canary-20251217083314",
3
+ "version": "1.41.1",
4
4
  "description": "Notification center module for ContractSpec applications",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -18,23 +18,23 @@
18
18
  "lint:check": "eslint src"
19
19
  },
20
20
  "dependencies": {
21
- "@lssm/lib.schema": "0.0.0-canary-20251217083314",
22
- "@lssm/lib.contracts": "0.0.0-canary-20251217083314",
23
- "@lssm/lib.bus": "0.0.0-canary-20251217083314",
21
+ "@lssm/lib.schema": "1.41.1",
22
+ "@lssm/lib.contracts": "1.41.1",
23
+ "@lssm/lib.bus": "1.41.1",
24
24
  "zod": "^4.1.13"
25
25
  },
26
26
  "devDependencies": {
27
- "@lssm/tool.typescript": "0.0.0-canary-20251217083314",
28
- "@lssm/tool.tsdown": "0.0.0-canary-20251217083314",
27
+ "@lssm/tool.typescript": "1.41.1",
28
+ "@lssm/tool.tsdown": "1.41.1",
29
29
  "typescript": "^5.9.3"
30
30
  },
31
31
  "exports": {
32
- ".": "./dist/index.js",
33
- "./channels": "./dist/channels/index.js",
34
- "./contracts": "./dist/contracts/index.js",
35
- "./entities": "./dist/entities/index.js",
36
- "./notifications.feature": "./dist/notifications.feature.js",
37
- "./templates": "./dist/templates/index.js",
32
+ ".": "./src/index.ts",
33
+ "./channels": "./src/channels/index.ts",
34
+ "./contracts": "./src/contracts/index.ts",
35
+ "./entities": "./src/entities/index.ts",
36
+ "./notifications.feature": "./src/notifications.feature.ts",
37
+ "./templates": "./src/templates/index.ts",
38
38
  "./*": "./*"
39
39
  },
40
40
  "module": "./dist/index.js",