@contractspec/module.notifications 3.7.15 → 3.7.17

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 (46) hide show
  1. package/dist/browser/channels/index.js +1 -314
  2. package/dist/browser/contracts/index.js +1 -356
  3. package/dist/browser/entities/index.js +1 -239
  4. package/dist/browser/i18n/catalogs/en.js +1 -68
  5. package/dist/browser/i18n/catalogs/es.js +1 -68
  6. package/dist/browser/i18n/catalogs/fr.js +1 -68
  7. package/dist/browser/i18n/catalogs/index.js +1 -169
  8. package/dist/browser/i18n/index.js +1 -229
  9. package/dist/browser/i18n/keys.js +1 -37
  10. package/dist/browser/i18n/locale.js +1 -29
  11. package/dist/browser/i18n/messages.js +1 -190
  12. package/dist/browser/index.js +7 -1126
  13. package/dist/browser/notifications.capability.js +1 -35
  14. package/dist/browser/notifications.feature.js +1 -50
  15. package/dist/browser/templates/index.js +7 -235
  16. package/dist/channels/index.js +1 -314
  17. package/dist/contracts/index.js +1 -356
  18. package/dist/entities/index.js +1 -239
  19. package/dist/i18n/catalogs/en.js +1 -68
  20. package/dist/i18n/catalogs/es.js +1 -68
  21. package/dist/i18n/catalogs/fr.js +1 -68
  22. package/dist/i18n/catalogs/index.js +1 -169
  23. package/dist/i18n/index.js +1 -229
  24. package/dist/i18n/keys.js +1 -37
  25. package/dist/i18n/locale.js +1 -29
  26. package/dist/i18n/messages.js +1 -190
  27. package/dist/index.js +7 -1126
  28. package/dist/node/channels/index.js +1 -314
  29. package/dist/node/contracts/index.js +1 -356
  30. package/dist/node/entities/index.js +1 -239
  31. package/dist/node/i18n/catalogs/en.js +1 -68
  32. package/dist/node/i18n/catalogs/es.js +1 -68
  33. package/dist/node/i18n/catalogs/fr.js +1 -68
  34. package/dist/node/i18n/catalogs/index.js +1 -169
  35. package/dist/node/i18n/index.js +1 -229
  36. package/dist/node/i18n/keys.js +1 -37
  37. package/dist/node/i18n/locale.js +1 -29
  38. package/dist/node/i18n/messages.js +1 -190
  39. package/dist/node/index.js +7 -1126
  40. package/dist/node/notifications.capability.js +1 -35
  41. package/dist/node/notifications.feature.js +1 -50
  42. package/dist/node/templates/index.js +7 -235
  43. package/dist/notifications.capability.js +1 -35
  44. package/dist/notifications.feature.js +1 -50
  45. package/dist/templates/index.js +7 -235
  46. package/package.json +8 -8
@@ -1,357 +1,2 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
- // src/contracts/index.ts
19
- import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
20
- import {
21
- defineEnum,
22
- defineSchemaModel,
23
- ScalarTypeEnum
24
- } from "@contractspec/lib.schema";
25
- var OWNERS = ["platform.notifications"];
26
- var NotificationStatusSchemaEnum = defineEnum("NotificationStatus", [
27
- "PENDING",
28
- "SENT",
29
- "DELIVERED",
30
- "READ",
31
- "FAILED",
32
- "CANCELLED"
33
- ]);
34
- var NotificationChannelSchemaEnum = defineEnum("NotificationChannel", [
35
- "EMAIL",
36
- "IN_APP",
37
- "PUSH",
38
- "WEBHOOK"
39
- ]);
40
- var NotificationFilterEnum = defineEnum("NotificationFilter", [
41
- "unread",
42
- "read",
43
- "all"
44
- ]);
45
- var NotificationModel = defineSchemaModel({
46
- name: "Notification",
47
- description: "A notification sent to a user",
48
- fields: {
49
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
50
- userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
51
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
52
- body: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
53
- type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
54
- status: { type: NotificationStatusSchemaEnum, isOptional: false },
55
- channels: {
56
- type: NotificationChannelSchemaEnum,
57
- isArray: true,
58
- isOptional: false
59
- },
60
- actionUrl: { type: ScalarTypeEnum.URL(), isOptional: true },
61
- readAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
62
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
63
- }
64
- });
65
- var NotificationPreferenceModel = defineSchemaModel({
66
- name: "NotificationPreference",
67
- description: "User notification preferences",
68
- fields: {
69
- userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
70
- globalEnabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },
71
- channelPreferences: {
72
- type: ScalarTypeEnum.JSONObject(),
73
- isOptional: false
74
- },
75
- typePreferences: { type: ScalarTypeEnum.JSONObject(), isOptional: false },
76
- quietHoursStart: {
77
- type: ScalarTypeEnum.String_unsecure(),
78
- isOptional: true
79
- },
80
- quietHoursEnd: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
81
- timezone: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
82
- digestEnabled: { type: ScalarTypeEnum.Boolean(), isOptional: false },
83
- digestFrequency: {
84
- type: ScalarTypeEnum.String_unsecure(),
85
- isOptional: true
86
- }
87
- }
88
- });
89
- var SendNotificationInputModel = defineSchemaModel({
90
- name: "SendNotificationInput",
91
- description: "Input for sending a notification",
92
- fields: {
93
- userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
94
- templateId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
95
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
96
- body: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
97
- type: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
98
- channels: {
99
- type: NotificationChannelSchemaEnum,
100
- isArray: true,
101
- isOptional: true
102
- },
103
- actionUrl: { type: ScalarTypeEnum.URL(), isOptional: true },
104
- variables: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
105
- metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true }
106
- }
107
- });
108
- var ListNotificationsInputModel = defineSchemaModel({
109
- name: "ListNotificationsInput",
110
- description: "Input for listing notifications",
111
- fields: {
112
- status: { type: NotificationFilterEnum, isOptional: true },
113
- type: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
114
- limit: {
115
- type: ScalarTypeEnum.Int_unsecure(),
116
- isOptional: true,
117
- defaultValue: 20
118
- },
119
- offset: {
120
- type: ScalarTypeEnum.Int_unsecure(),
121
- isOptional: true,
122
- defaultValue: 0
123
- }
124
- }
125
- });
126
- var ListNotificationsOutputModel = defineSchemaModel({
127
- name: "ListNotificationsOutput",
128
- description: "Output for listing notifications",
129
- fields: {
130
- notifications: {
131
- type: NotificationModel,
132
- isArray: true,
133
- isOptional: false
134
- },
135
- total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
136
- unreadCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
137
- }
138
- });
139
- var UpdatePreferencesInputModel = defineSchemaModel({
140
- name: "UpdateNotificationPreferencesInput",
141
- description: "Input for updating notification preferences",
142
- fields: {
143
- globalEnabled: { type: ScalarTypeEnum.Boolean(), isOptional: true },
144
- channelPreferences: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
145
- typePreferences: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
146
- quietHoursStart: {
147
- type: ScalarTypeEnum.String_unsecure(),
148
- isOptional: true
149
- },
150
- quietHoursEnd: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
151
- timezone: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
152
- digestEnabled: { type: ScalarTypeEnum.Boolean(), isOptional: true },
153
- digestFrequency: {
154
- type: ScalarTypeEnum.String_unsecure(),
155
- isOptional: true
156
- }
157
- }
158
- });
159
- var SendNotificationContract = defineCommand({
160
- meta: {
161
- key: "notifications.send",
162
- version: "1.0.0",
163
- stability: "stable",
164
- owners: [...OWNERS],
165
- tags: ["notifications", "send"],
166
- description: "Send a notification to a user.",
167
- goal: "Deliver notifications across multiple channels.",
168
- context: "Called by services when events require user notification."
169
- },
170
- io: {
171
- input: SendNotificationInputModel,
172
- output: NotificationModel,
173
- errors: {
174
- USER_NOT_FOUND: {
175
- description: "Target user does not exist",
176
- http: 404,
177
- gqlCode: "USER_NOT_FOUND",
178
- when: "User ID is invalid"
179
- },
180
- TEMPLATE_NOT_FOUND: {
181
- description: "Notification template does not exist",
182
- http: 404,
183
- gqlCode: "TEMPLATE_NOT_FOUND",
184
- when: "Template ID is invalid"
185
- }
186
- }
187
- },
188
- policy: {
189
- auth: "user"
190
- },
191
- sideEffects: {
192
- emits: [
193
- {
194
- key: "notification.sent",
195
- version: "1.0.0",
196
- when: "Notification is sent",
197
- payload: NotificationModel
198
- }
199
- ]
200
- }
201
- });
202
- var ListNotificationsContract = defineQuery({
203
- meta: {
204
- key: "notifications.list",
205
- version: "1.0.0",
206
- stability: "stable",
207
- owners: [...OWNERS],
208
- tags: ["notifications", "list"],
209
- description: "List notifications for the current user.",
210
- goal: "Show user their notifications.",
211
- context: "Notification center UI."
212
- },
213
- io: {
214
- input: ListNotificationsInputModel,
215
- output: ListNotificationsOutputModel
216
- },
217
- policy: {
218
- auth: "user"
219
- }
220
- });
221
- var MarkNotificationReadContract = defineCommand({
222
- meta: {
223
- key: "notifications.markRead",
224
- version: "1.0.0",
225
- stability: "stable",
226
- owners: [...OWNERS],
227
- tags: ["notifications", "read"],
228
- description: "Mark a notification as read.",
229
- goal: "Track which notifications user has seen.",
230
- context: "User clicks on a notification."
231
- },
232
- io: {
233
- input: defineSchemaModel({
234
- name: "MarkNotificationReadInput",
235
- fields: {
236
- notificationId: {
237
- type: ScalarTypeEnum.String_unsecure(),
238
- isOptional: false
239
- }
240
- }
241
- }),
242
- output: NotificationModel
243
- },
244
- policy: {
245
- auth: "user"
246
- }
247
- });
248
- var MarkAllNotificationsReadContract = defineCommand({
249
- meta: {
250
- key: "notifications.markAllRead",
251
- version: "1.0.0",
252
- stability: "stable",
253
- owners: [...OWNERS],
254
- tags: ["notifications", "read"],
255
- description: "Mark all notifications as read.",
256
- goal: "Clear notification badge.",
257
- context: 'User clicks "mark all as read".'
258
- },
259
- io: {
260
- input: null,
261
- output: defineSchemaModel({
262
- name: "MarkAllNotificationsReadOutput",
263
- fields: {
264
- markedCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
265
- }
266
- })
267
- },
268
- policy: {
269
- auth: "user"
270
- }
271
- });
272
- var GetNotificationPreferencesContract = defineQuery({
273
- meta: {
274
- key: "notifications.preferences.get",
275
- version: "1.0.0",
276
- stability: "stable",
277
- owners: [...OWNERS],
278
- tags: ["notifications", "preferences", "get"],
279
- description: "Get notification preferences for current user.",
280
- goal: "Show user their notification settings.",
281
- context: "Notification settings page."
282
- },
283
- io: {
284
- input: null,
285
- output: NotificationPreferenceModel
286
- },
287
- policy: {
288
- auth: "user"
289
- }
290
- });
291
- var UpdateNotificationPreferencesContract = defineCommand({
292
- meta: {
293
- key: "notifications.preferences.update",
294
- version: "1.0.0",
295
- stability: "stable",
296
- owners: [...OWNERS],
297
- tags: ["notifications", "preferences", "update"],
298
- description: "Update notification preferences.",
299
- goal: "Allow user to control notification delivery.",
300
- context: "Notification settings page."
301
- },
302
- io: {
303
- input: UpdatePreferencesInputModel,
304
- output: NotificationPreferenceModel
305
- },
306
- policy: {
307
- auth: "user"
308
- }
309
- });
310
- var DeleteNotificationContract = defineCommand({
311
- meta: {
312
- key: "notifications.delete",
313
- version: "1.0.0",
314
- stability: "stable",
315
- owners: [...OWNERS],
316
- tags: ["notifications", "delete"],
317
- description: "Delete a notification.",
318
- goal: "Allow user to remove unwanted notifications.",
319
- context: "User dismisses a notification."
320
- },
321
- io: {
322
- input: defineSchemaModel({
323
- name: "DeleteNotificationInput",
324
- fields: {
325
- notificationId: {
326
- type: ScalarTypeEnum.String_unsecure(),
327
- isOptional: false
328
- }
329
- }
330
- }),
331
- output: defineSchemaModel({
332
- name: "DeleteNotificationOutput",
333
- fields: {
334
- success: { type: ScalarTypeEnum.Boolean(), isOptional: false }
335
- }
336
- })
337
- },
338
- policy: {
339
- auth: "user"
340
- }
341
- });
342
- export {
343
- UpdatePreferencesInputModel,
344
- UpdateNotificationPreferencesContract,
345
- SendNotificationInputModel,
346
- SendNotificationContract,
347
- NotificationPreferenceModel,
348
- NotificationModel,
349
- NotificationFilterEnum,
350
- MarkNotificationReadContract,
351
- MarkAllNotificationsReadContract,
352
- ListNotificationsOutputModel,
353
- ListNotificationsInputModel,
354
- ListNotificationsContract,
355
- GetNotificationPreferencesContract,
356
- DeleteNotificationContract
357
- };
2
+ var H=Object.defineProperty;var J=(k)=>k;function K(k,q){this[k]=J.bind(null,q)}var F=(k,q)=>{for(var z in q)H(k,z,{get:q[z],enumerable:!0,configurable:!0,set:K.bind(q,z)})};var U=(k,q)=>()=>(k&&(q=k(k=0)),q);import{defineCommand as w,defineQuery as B}from"@contractspec/lib.contracts-spec";import{defineEnum as A,defineSchemaModel as j,ScalarTypeEnum as g}from"@contractspec/lib.schema";var v=["platform.notifications"],V=A("NotificationStatus",["PENDING","SENT","DELIVERED","READ","FAILED","CANCELLED"]),D=A("NotificationChannel",["EMAIL","IN_APP","PUSH","WEBHOOK"]),X=A("NotificationFilter",["unread","read","all"]),x=j({name:"Notification",description:"A notification sent to a user",fields:{id:{type:g.String_unsecure(),isOptional:!1},userId:{type:g.String_unsecure(),isOptional:!1},title:{type:g.String_unsecure(),isOptional:!1},body:{type:g.String_unsecure(),isOptional:!1},type:{type:g.String_unsecure(),isOptional:!1},status:{type:V,isOptional:!1},channels:{type:D,isArray:!0,isOptional:!1},actionUrl:{type:g.URL(),isOptional:!0},readAt:{type:g.DateTime(),isOptional:!0},createdAt:{type:g.DateTime(),isOptional:!1}}}),G=j({name:"NotificationPreference",description:"User notification preferences",fields:{userId:{type:g.String_unsecure(),isOptional:!1},globalEnabled:{type:g.Boolean(),isOptional:!1},channelPreferences:{type:g.JSONObject(),isOptional:!1},typePreferences:{type:g.JSONObject(),isOptional:!1},quietHoursStart:{type:g.String_unsecure(),isOptional:!0},quietHoursEnd:{type:g.String_unsecure(),isOptional:!0},timezone:{type:g.String_unsecure(),isOptional:!1},digestEnabled:{type:g.Boolean(),isOptional:!1},digestFrequency:{type:g.String_unsecure(),isOptional:!0}}}),Y=j({name:"SendNotificationInput",description:"Input for sending a notification",fields:{userId:{type:g.String_unsecure(),isOptional:!1},templateId:{type:g.String_unsecure(),isOptional:!0},title:{type:g.String_unsecure(),isOptional:!0},body:{type:g.String_unsecure(),isOptional:!0},type:{type:g.String_unsecure(),isOptional:!1},channels:{type:D,isArray:!0,isOptional:!0},actionUrl:{type:g.URL(),isOptional:!0},variables:{type:g.JSONObject(),isOptional:!0},metadata:{type:g.JSONObject(),isOptional:!0}}}),Z=j({name:"ListNotificationsInput",description:"Input for listing notifications",fields:{status:{type:X,isOptional:!0},type:{type:g.String_unsecure(),isOptional:!0},limit:{type:g.Int_unsecure(),isOptional:!0,defaultValue:20},offset:{type:g.Int_unsecure(),isOptional:!0,defaultValue:0}}}),_=j({name:"ListNotificationsOutput",description:"Output for listing notifications",fields:{notifications:{type:x,isArray:!0,isOptional:!1},total:{type:g.Int_unsecure(),isOptional:!1},unreadCount:{type:g.Int_unsecure(),isOptional:!1}}}),$=j({name:"UpdateNotificationPreferencesInput",description:"Input for updating notification preferences",fields:{globalEnabled:{type:g.Boolean(),isOptional:!0},channelPreferences:{type:g.JSONObject(),isOptional:!0},typePreferences:{type:g.JSONObject(),isOptional:!0},quietHoursStart:{type:g.String_unsecure(),isOptional:!0},quietHoursEnd:{type:g.String_unsecure(),isOptional:!0},timezone:{type:g.String_unsecure(),isOptional:!0},digestEnabled:{type:g.Boolean(),isOptional:!0},digestFrequency:{type:g.String_unsecure(),isOptional:!0}}}),I=w({meta:{key:"notifications.send",version:"1.0.0",stability:"stable",owners:[...v],tags:["notifications","send"],description:"Send a notification to a user.",goal:"Deliver notifications across multiple channels.",context:"Called by services when events require user notification."},io:{input:Y,output:x,errors:{USER_NOT_FOUND:{description:"Target user does not exist",http:404,gqlCode:"USER_NOT_FOUND",when:"User ID is invalid"},TEMPLATE_NOT_FOUND:{description:"Notification template does not exist",http:404,gqlCode:"TEMPLATE_NOT_FOUND",when:"Template ID is invalid"}}},policy:{auth:"user"},sideEffects:{emits:[{key:"notification.sent",version:"1.0.0",when:"Notification is sent",payload:x}]}}),P=B({meta:{key:"notifications.list",version:"1.0.0",stability:"stable",owners:[...v],tags:["notifications","list"],description:"List notifications for the current user.",goal:"Show user their notifications.",context:"Notification center UI."},io:{input:Z,output:_},policy:{auth:"user"}}),C=w({meta:{key:"notifications.markRead",version:"1.0.0",stability:"stable",owners:[...v],tags:["notifications","read"],description:"Mark a notification as read.",goal:"Track which notifications user has seen.",context:"User clicks on a notification."},io:{input:j({name:"MarkNotificationReadInput",fields:{notificationId:{type:g.String_unsecure(),isOptional:!1}}}),output:x},policy:{auth:"user"}}),R=w({meta:{key:"notifications.markAllRead",version:"1.0.0",stability:"stable",owners:[...v],tags:["notifications","read"],description:"Mark all notifications as read.",goal:"Clear notification badge.",context:'User clicks "mark all as read".'},io:{input:null,output:j({name:"MarkAllNotificationsReadOutput",fields:{markedCount:{type:g.Int_unsecure(),isOptional:!1}}})},policy:{auth:"user"}}),W=B({meta:{key:"notifications.preferences.get",version:"1.0.0",stability:"stable",owners:[...v],tags:["notifications","preferences","get"],description:"Get notification preferences for current user.",goal:"Show user their notification settings.",context:"Notification settings page."},io:{input:null,output:G},policy:{auth:"user"}}),O=w({meta:{key:"notifications.preferences.update",version:"1.0.0",stability:"stable",owners:[...v],tags:["notifications","preferences","update"],description:"Update notification preferences.",goal:"Allow user to control notification delivery.",context:"Notification settings page."},io:{input:$,output:G},policy:{auth:"user"}}),s=w({meta:{key:"notifications.delete",version:"1.0.0",stability:"stable",owners:[...v],tags:["notifications","delete"],description:"Delete a notification.",goal:"Allow user to remove unwanted notifications.",context:"User dismisses a notification."},io:{input:j({name:"DeleteNotificationInput",fields:{notificationId:{type:g.String_unsecure(),isOptional:!1}}}),output:j({name:"DeleteNotificationOutput",fields:{success:{type:g.Boolean(),isOptional:!1}}})},policy:{auth:"user"}});export{$ as UpdatePreferencesInputModel,O as UpdateNotificationPreferencesContract,Y as SendNotificationInputModel,I as SendNotificationContract,G as NotificationPreferenceModel,x as NotificationModel,X as NotificationFilterEnum,C as MarkNotificationReadContract,R as MarkAllNotificationsReadContract,_ as ListNotificationsOutputModel,Z as ListNotificationsInputModel,P as ListNotificationsContract,W as GetNotificationPreferencesContract,s as DeleteNotificationContract};
@@ -1,240 +1,2 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
- // src/entities/index.ts
19
- import {
20
- defineEntity,
21
- defineEntityEnum,
22
- field,
23
- index
24
- } from "@contractspec/lib.schema";
25
- var NotificationStatusEnum = defineEntityEnum({
26
- name: "NotificationStatus",
27
- values: [
28
- "PENDING",
29
- "SENT",
30
- "DELIVERED",
31
- "READ",
32
- "FAILED",
33
- "CANCELLED"
34
- ],
35
- schema: "lssm_notifications",
36
- description: "Status of a notification."
37
- });
38
- var NotificationChannelEnum = defineEntityEnum({
39
- name: "NotificationChannel",
40
- values: ["EMAIL", "IN_APP", "PUSH", "WEBHOOK", "SMS"],
41
- schema: "lssm_notifications",
42
- description: "Delivery channel for notifications."
43
- });
44
- var NotificationEntity = defineEntity({
45
- name: "Notification",
46
- description: "An individual notification to be delivered to a user.",
47
- schema: "lssm_notifications",
48
- map: "notification",
49
- fields: {
50
- id: field.id({ description: "Unique notification ID" }),
51
- userId: field.foreignKey({ description: "Target user ID" }),
52
- orgId: field.string({
53
- isOptional: true,
54
- description: "Organization context"
55
- }),
56
- templateId: field.string({
57
- isOptional: true,
58
- description: "Template used"
59
- }),
60
- title: field.string({ description: "Notification title" }),
61
- body: field.string({ description: "Notification body" }),
62
- actionUrl: field.string({ isOptional: true, description: "Action URL" }),
63
- imageUrl: field.string({ isOptional: true, description: "Image URL" }),
64
- type: field.string({
65
- description: "Notification type (e.g., mention, update)"
66
- }),
67
- category: field.string({
68
- isOptional: true,
69
- description: "Notification category"
70
- }),
71
- priority: field.enum("NotificationPriority", { default: "NORMAL" }),
72
- channels: field.string({
73
- isArray: true,
74
- description: "Target delivery channels"
75
- }),
76
- status: field.enum("NotificationStatus", { default: "PENDING" }),
77
- sentAt: field.dateTime({ isOptional: true }),
78
- deliveredAt: field.dateTime({ isOptional: true }),
79
- readAt: field.dateTime({ isOptional: true }),
80
- metadata: field.json({
81
- isOptional: true,
82
- description: "Additional metadata"
83
- }),
84
- variables: field.json({
85
- isOptional: true,
86
- description: "Template variables used"
87
- }),
88
- triggeredBy: field.string({
89
- isOptional: true,
90
- description: "Event/action that triggered"
91
- }),
92
- sourceId: field.string({
93
- isOptional: true,
94
- description: "Source entity ID"
95
- }),
96
- sourceType: field.string({
97
- isOptional: true,
98
- description: "Source entity type"
99
- }),
100
- createdAt: field.createdAt(),
101
- updatedAt: field.updatedAt(),
102
- expiresAt: field.dateTime({
103
- isOptional: true,
104
- description: "Notification expiry"
105
- }),
106
- deliveryLogs: field.hasMany("DeliveryLog")
107
- },
108
- indexes: [
109
- index.on(["userId", "status", "createdAt"]),
110
- index.on(["userId", "readAt"]),
111
- index.on(["orgId", "createdAt"]),
112
- index.on(["type", "createdAt"])
113
- ],
114
- enums: [NotificationStatusEnum, NotificationChannelEnum]
115
- });
116
- var NotificationPriorityEnum = defineEntityEnum({
117
- name: "NotificationPriority",
118
- values: ["LOW", "NORMAL", "HIGH", "URGENT"],
119
- schema: "lssm_notifications",
120
- description: "Priority level of a notification."
121
- });
122
- var NotificationTemplateEntity = defineEntity({
123
- name: "NotificationTemplate",
124
- description: "Reusable notification template.",
125
- schema: "lssm_notifications",
126
- map: "notification_template",
127
- fields: {
128
- id: field.id(),
129
- templateId: field.string({
130
- isUnique: true,
131
- description: "Template identifier"
132
- }),
133
- name: field.string({ description: "Template display name" }),
134
- description: field.string({ isOptional: true }),
135
- emailSubject: field.string({ isOptional: true }),
136
- emailBody: field.string({ isOptional: true }),
137
- inAppTitle: field.string({ isOptional: true }),
138
- inAppBody: field.string({ isOptional: true }),
139
- pushTitle: field.string({ isOptional: true }),
140
- pushBody: field.string({ isOptional: true }),
141
- defaultChannels: field.string({ isArray: true }),
142
- category: field.string({ isOptional: true }),
143
- priority: field.enum("NotificationPriority", { default: "NORMAL" }),
144
- variablesSchema: field.json({
145
- isOptional: true,
146
- description: "JSON schema for variables"
147
- }),
148
- enabled: field.boolean({ default: true }),
149
- createdAt: field.createdAt(),
150
- updatedAt: field.updatedAt()
151
- },
152
- enums: [NotificationPriorityEnum]
153
- });
154
- var NotificationPreferenceEntity = defineEntity({
155
- name: "NotificationPreference",
156
- description: "User notification preferences by type and channel.",
157
- schema: "lssm_notifications",
158
- map: "notification_preference",
159
- fields: {
160
- id: field.id(),
161
- userId: field.foreignKey(),
162
- globalEnabled: field.boolean({ default: true }),
163
- quietHoursStart: field.string({
164
- isOptional: true,
165
- description: "Quiet hours start (HH:MM)"
166
- }),
167
- quietHoursEnd: field.string({
168
- isOptional: true,
169
- description: "Quiet hours end (HH:MM)"
170
- }),
171
- timezone: field.string({ default: '"UTC"' }),
172
- channelPreferences: field.json({
173
- description: "Channel-level preferences"
174
- }),
175
- typePreferences: field.json({ description: "Type-level preferences" }),
176
- digestEnabled: field.boolean({ default: false }),
177
- digestFrequency: field.string({
178
- isOptional: true,
179
- description: "daily, weekly, etc."
180
- }),
181
- digestTime: field.string({
182
- isOptional: true,
183
- description: "Digest send time (HH:MM)"
184
- }),
185
- createdAt: field.createdAt(),
186
- updatedAt: field.updatedAt()
187
- },
188
- indexes: [index.unique(["userId"])]
189
- });
190
- var DeliveryLogEntity = defineEntity({
191
- name: "DeliveryLog",
192
- description: "Log of notification delivery attempts.",
193
- schema: "lssm_notifications",
194
- map: "delivery_log",
195
- fields: {
196
- id: field.id(),
197
- notificationId: field.foreignKey(),
198
- channel: field.enum("NotificationChannel"),
199
- status: field.enum("NotificationStatus"),
200
- attemptedAt: field.dateTime(),
201
- deliveredAt: field.dateTime({ isOptional: true }),
202
- responseCode: field.string({ isOptional: true }),
203
- responseMessage: field.string({ isOptional: true }),
204
- externalId: field.string({
205
- isOptional: true,
206
- description: "Provider message ID"
207
- }),
208
- metadata: field.json({ isOptional: true }),
209
- notification: field.belongsTo("Notification", ["notificationId"], ["id"], {
210
- onDelete: "Cascade"
211
- })
212
- },
213
- indexes: [index.on(["notificationId", "channel"])]
214
- });
215
- var notificationEntities = [
216
- NotificationEntity,
217
- NotificationTemplateEntity,
218
- NotificationPreferenceEntity,
219
- DeliveryLogEntity
220
- ];
221
- var notificationsSchemaContribution = {
222
- moduleId: "@contractspec/module.notifications",
223
- entities: notificationEntities,
224
- enums: [
225
- NotificationStatusEnum,
226
- NotificationChannelEnum,
227
- NotificationPriorityEnum
228
- ]
229
- };
230
- export {
231
- notificationsSchemaContribution,
232
- notificationEntities,
233
- NotificationTemplateEntity,
234
- NotificationStatusEnum,
235
- NotificationPriorityEnum,
236
- NotificationPreferenceEntity,
237
- NotificationEntity,
238
- NotificationChannelEnum,
239
- DeliveryLogEntity
240
- };
2
+ var I=Object.defineProperty;var J=(k)=>k;function K(k,q){this[k]=J.bind(null,q)}var W=(k,q)=>{for(var A in q)I(k,A,{get:q[A],enumerable:!0,configurable:!0,set:K.bind(q,A)})};var X=(k,q)=>()=>(k&&(q=k(k=0)),q);import{defineEntity as z,defineEntityEnum as B,field as j,index as w}from"@contractspec/lib.schema";var F=B({name:"NotificationStatus",values:["PENDING","SENT","DELIVERED","READ","FAILED","CANCELLED"],schema:"lssm_notifications",description:"Status of a notification."}),G=B({name:"NotificationChannel",values:["EMAIL","IN_APP","PUSH","WEBHOOK","SMS"],schema:"lssm_notifications",description:"Delivery channel for notifications."}),O=z({name:"Notification",description:"An individual notification to be delivered to a user.",schema:"lssm_notifications",map:"notification",fields:{id:j.id({description:"Unique notification ID"}),userId:j.foreignKey({description:"Target user ID"}),orgId:j.string({isOptional:!0,description:"Organization context"}),templateId:j.string({isOptional:!0,description:"Template used"}),title:j.string({description:"Notification title"}),body:j.string({description:"Notification body"}),actionUrl:j.string({isOptional:!0,description:"Action URL"}),imageUrl:j.string({isOptional:!0,description:"Image URL"}),type:j.string({description:"Notification type (e.g., mention, update)"}),category:j.string({isOptional:!0,description:"Notification category"}),priority:j.enum("NotificationPriority",{default:"NORMAL"}),channels:j.string({isArray:!0,description:"Target delivery channels"}),status:j.enum("NotificationStatus",{default:"PENDING"}),sentAt:j.dateTime({isOptional:!0}),deliveredAt:j.dateTime({isOptional:!0}),readAt:j.dateTime({isOptional:!0}),metadata:j.json({isOptional:!0,description:"Additional metadata"}),variables:j.json({isOptional:!0,description:"Template variables used"}),triggeredBy:j.string({isOptional:!0,description:"Event/action that triggered"}),sourceId:j.string({isOptional:!0,description:"Source entity ID"}),sourceType:j.string({isOptional:!0,description:"Source entity type"}),createdAt:j.createdAt(),updatedAt:j.updatedAt(),expiresAt:j.dateTime({isOptional:!0,description:"Notification expiry"}),deliveryLogs:j.hasMany("DeliveryLog")},indexes:[w.on(["userId","status","createdAt"]),w.on(["userId","readAt"]),w.on(["orgId","createdAt"]),w.on(["type","createdAt"])],enums:[F,G]}),H=B({name:"NotificationPriority",values:["LOW","NORMAL","HIGH","URGENT"],schema:"lssm_notifications",description:"Priority level of a notification."}),Q=z({name:"NotificationTemplate",description:"Reusable notification template.",schema:"lssm_notifications",map:"notification_template",fields:{id:j.id(),templateId:j.string({isUnique:!0,description:"Template identifier"}),name:j.string({description:"Template display name"}),description:j.string({isOptional:!0}),emailSubject:j.string({isOptional:!0}),emailBody:j.string({isOptional:!0}),inAppTitle:j.string({isOptional:!0}),inAppBody:j.string({isOptional:!0}),pushTitle:j.string({isOptional:!0}),pushBody:j.string({isOptional:!0}),defaultChannels:j.string({isArray:!0}),category:j.string({isOptional:!0}),priority:j.enum("NotificationPriority",{default:"NORMAL"}),variablesSchema:j.json({isOptional:!0,description:"JSON schema for variables"}),enabled:j.boolean({default:!0}),createdAt:j.createdAt(),updatedAt:j.updatedAt()},enums:[H]}),R=z({name:"NotificationPreference",description:"User notification preferences by type and channel.",schema:"lssm_notifications",map:"notification_preference",fields:{id:j.id(),userId:j.foreignKey(),globalEnabled:j.boolean({default:!0}),quietHoursStart:j.string({isOptional:!0,description:"Quiet hours start (HH:MM)"}),quietHoursEnd:j.string({isOptional:!0,description:"Quiet hours end (HH:MM)"}),timezone:j.string({default:'"UTC"'}),channelPreferences:j.json({description:"Channel-level preferences"}),typePreferences:j.json({description:"Type-level preferences"}),digestEnabled:j.boolean({default:!1}),digestFrequency:j.string({isOptional:!0,description:"daily, weekly, etc."}),digestTime:j.string({isOptional:!0,description:"Digest send time (HH:MM)"}),createdAt:j.createdAt(),updatedAt:j.updatedAt()},indexes:[w.unique(["userId"])]}),U=z({name:"DeliveryLog",description:"Log of notification delivery attempts.",schema:"lssm_notifications",map:"delivery_log",fields:{id:j.id(),notificationId:j.foreignKey(),channel:j.enum("NotificationChannel"),status:j.enum("NotificationStatus"),attemptedAt:j.dateTime(),deliveredAt:j.dateTime({isOptional:!0}),responseCode:j.string({isOptional:!0}),responseMessage:j.string({isOptional:!0}),externalId:j.string({isOptional:!0,description:"Provider message ID"}),metadata:j.json({isOptional:!0}),notification:j.belongsTo("Notification",["notificationId"],["id"],{onDelete:"Cascade"})},indexes:[w.on(["notificationId","channel"])]}),V=[O,Q,R,U],_={moduleId:"@contractspec/module.notifications",entities:V,enums:[F,G,H]};export{_ as notificationsSchemaContribution,V as notificationEntities,Q as NotificationTemplateEntity,F as NotificationStatusEnum,H as NotificationPriorityEnum,R as NotificationPreferenceEntity,O as NotificationEntity,G as NotificationChannelEnum,U as DeliveryLogEntity};
@@ -1,69 +1,2 @@
1
1
  // @bun
2
- var __defProp = Object.defineProperty;
3
- var __returnValue = (v) => v;
4
- function __exportSetter(name, newValue) {
5
- this[name] = __returnValue.bind(null, newValue);
6
- }
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, {
10
- get: all[name],
11
- enumerable: true,
12
- configurable: true,
13
- set: __exportSetter.bind(all, name)
14
- });
15
- };
16
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
17
-
18
- // src/i18n/catalogs/en.ts
19
- import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
20
- var enMessages;
21
- var init_en = __esm(() => {
22
- enMessages = defineTranslation({
23
- meta: {
24
- key: "notifications.messages",
25
- version: "1.0.0",
26
- domain: "notifications",
27
- description: "Template and channel strings for the notifications module",
28
- owners: ["platform"],
29
- stability: "experimental"
30
- },
31
- locale: "en",
32
- fallback: "en",
33
- messages: {
34
- "template.welcome.name": {
35
- value: "Welcome",
36
- description: "Welcome template display name"
37
- },
38
- "template.welcome.description": {
39
- value: "Sent when a user signs up.",
40
- description: "Welcome template description"
41
- },
42
- "template.orgInvite.name": {
43
- value: "Organization Invitation",
44
- description: "Org invite template display name"
45
- },
46
- "template.orgInvite.description": {
47
- value: "Sent when a user is invited to an organization.",
48
- description: "Org invite template description"
49
- },
50
- "template.mention.name": {
51
- value: "Mention",
52
- description: "Mention template display name"
53
- },
54
- "template.mention.description": {
55
- value: "Sent when a user is mentioned.",
56
- description: "Mention template description"
57
- },
58
- "channel.webhook.noUrl": {
59
- value: "No webhook URL configured",
60
- description: "Error when webhook channel has no URL"
61
- }
62
- }
63
- });
64
- });
65
- init_en();
66
-
67
- export {
68
- enMessages
69
- };
2
+ var k=Object.defineProperty;var m=(g)=>g;function q(g,h){this[g]=m.bind(null,h)}var x=(g,h)=>{for(var j in h)k(g,j,{get:h[j],enumerable:!0,configurable:!0,set:q.bind(h,j)})};var u=(g,h)=>()=>(g&&(h=g(g=0)),h);import{defineTranslation as v}from"@contractspec/lib.contracts-spec/translations";var A;var w=u(()=>{A=v({meta:{key:"notifications.messages",version:"1.0.0",domain:"notifications",description:"Template and channel strings for the notifications module",owners:["platform"],stability:"experimental"},locale:"en",fallback:"en",messages:{"template.welcome.name":{value:"Welcome",description:"Welcome template display name"},"template.welcome.description":{value:"Sent when a user signs up.",description:"Welcome template description"},"template.orgInvite.name":{value:"Organization Invitation",description:"Org invite template display name"},"template.orgInvite.description":{value:"Sent when a user is invited to an organization.",description:"Org invite template description"},"template.mention.name":{value:"Mention",description:"Mention template display name"},"template.mention.description":{value:"Sent when a user is mentioned.",description:"Mention template description"},"channel.webhook.noUrl":{value:"No webhook URL configured",description:"Error when webhook channel has no URL"}}})});w();export{A as enMessages};