@contractspec/module.notifications 1.57.0 → 1.58.0
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/dist/browser/channels/index.js +124 -0
- package/dist/browser/contracts/index.js +340 -0
- package/dist/browser/entities/index.js +223 -0
- package/dist/browser/index.js +864 -0
- package/dist/browser/notifications.capability.js +16 -0
- package/dist/browser/notifications.feature.js +34 -0
- package/dist/browser/templates/index.js +147 -0
- package/dist/channels/index.d.ts +64 -67
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +123 -125
- package/dist/contracts/index.d.ts +571 -577
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +324 -416
- package/dist/entities/index.d.ts +145 -150
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +215 -245
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +864 -6
- package/dist/node/channels/index.js +124 -0
- package/dist/node/contracts/index.js +340 -0
- package/dist/node/entities/index.js +223 -0
- package/dist/node/index.js +864 -0
- package/dist/node/notifications.capability.js +16 -0
- package/dist/node/notifications.feature.js +34 -0
- package/dist/node/templates/index.js +147 -0
- package/dist/notifications.capability.d.ts +1 -6
- package/dist/notifications.capability.d.ts.map +1 -1
- package/dist/notifications.capability.js +17 -20
- package/dist/notifications.feature.d.ts +1 -6
- package/dist/notifications.feature.d.ts.map +1 -1
- package/dist/notifications.feature.js +33 -75
- package/dist/templates/index.d.ts +47 -50
- package/dist/templates/index.d.ts.map +1 -1
- package/dist/templates/index.js +127 -181
- package/package.json +102 -27
- package/dist/channels/index.js.map +0 -1
- package/dist/contracts/index.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/notifications.capability.js.map +0 -1
- package/dist/notifications.feature.js.map +0 -1
- package/dist/templates/index.js.map +0 -1
package/dist/entities/index.js
CHANGED
|
@@ -1,254 +1,224 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/entities/index.ts
|
|
3
|
+
import {
|
|
4
|
+
defineEntity,
|
|
5
|
+
defineEntityEnum,
|
|
6
|
+
field,
|
|
7
|
+
index
|
|
8
|
+
} from "@contractspec/lib.schema";
|
|
9
|
+
var NotificationStatusEnum = defineEntityEnum({
|
|
10
|
+
name: "NotificationStatus",
|
|
11
|
+
values: [
|
|
12
|
+
"PENDING",
|
|
13
|
+
"SENT",
|
|
14
|
+
"DELIVERED",
|
|
15
|
+
"READ",
|
|
16
|
+
"FAILED",
|
|
17
|
+
"CANCELLED"
|
|
18
|
+
],
|
|
19
|
+
schema: "lssm_notifications",
|
|
20
|
+
description: "Status of a notification."
|
|
19
21
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
values: [
|
|
26
|
-
"EMAIL",
|
|
27
|
-
"IN_APP",
|
|
28
|
-
"PUSH",
|
|
29
|
-
"WEBHOOK",
|
|
30
|
-
"SMS"
|
|
31
|
-
],
|
|
32
|
-
schema: "lssm_notifications",
|
|
33
|
-
description: "Delivery channel for notifications."
|
|
22
|
+
var NotificationChannelEnum = defineEntityEnum({
|
|
23
|
+
name: "NotificationChannel",
|
|
24
|
+
values: ["EMAIL", "IN_APP", "PUSH", "WEBHOOK", "SMS"],
|
|
25
|
+
schema: "lssm_notifications",
|
|
26
|
+
description: "Delivery channel for notifications."
|
|
34
27
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
indexes: [
|
|
107
|
-
index.on([
|
|
108
|
-
"userId",
|
|
109
|
-
"status",
|
|
110
|
-
"createdAt"
|
|
111
|
-
]),
|
|
112
|
-
index.on(["userId", "readAt"]),
|
|
113
|
-
index.on(["orgId", "createdAt"]),
|
|
114
|
-
index.on(["type", "createdAt"])
|
|
115
|
-
],
|
|
116
|
-
enums: [NotificationStatusEnum, NotificationChannelEnum]
|
|
28
|
+
var NotificationEntity = defineEntity({
|
|
29
|
+
name: "Notification",
|
|
30
|
+
description: "An individual notification to be delivered to a user.",
|
|
31
|
+
schema: "lssm_notifications",
|
|
32
|
+
map: "notification",
|
|
33
|
+
fields: {
|
|
34
|
+
id: field.id({ description: "Unique notification ID" }),
|
|
35
|
+
userId: field.foreignKey({ description: "Target user ID" }),
|
|
36
|
+
orgId: field.string({
|
|
37
|
+
isOptional: true,
|
|
38
|
+
description: "Organization context"
|
|
39
|
+
}),
|
|
40
|
+
templateId: field.string({
|
|
41
|
+
isOptional: true,
|
|
42
|
+
description: "Template used"
|
|
43
|
+
}),
|
|
44
|
+
title: field.string({ description: "Notification title" }),
|
|
45
|
+
body: field.string({ description: "Notification body" }),
|
|
46
|
+
actionUrl: field.string({ isOptional: true, description: "Action URL" }),
|
|
47
|
+
imageUrl: field.string({ isOptional: true, description: "Image URL" }),
|
|
48
|
+
type: field.string({
|
|
49
|
+
description: "Notification type (e.g., mention, update)"
|
|
50
|
+
}),
|
|
51
|
+
category: field.string({
|
|
52
|
+
isOptional: true,
|
|
53
|
+
description: "Notification category"
|
|
54
|
+
}),
|
|
55
|
+
priority: field.enum("NotificationPriority", { default: "NORMAL" }),
|
|
56
|
+
channels: field.string({
|
|
57
|
+
isArray: true,
|
|
58
|
+
description: "Target delivery channels"
|
|
59
|
+
}),
|
|
60
|
+
status: field.enum("NotificationStatus", { default: "PENDING" }),
|
|
61
|
+
sentAt: field.dateTime({ isOptional: true }),
|
|
62
|
+
deliveredAt: field.dateTime({ isOptional: true }),
|
|
63
|
+
readAt: field.dateTime({ isOptional: true }),
|
|
64
|
+
metadata: field.json({
|
|
65
|
+
isOptional: true,
|
|
66
|
+
description: "Additional metadata"
|
|
67
|
+
}),
|
|
68
|
+
variables: field.json({
|
|
69
|
+
isOptional: true,
|
|
70
|
+
description: "Template variables used"
|
|
71
|
+
}),
|
|
72
|
+
triggeredBy: field.string({
|
|
73
|
+
isOptional: true,
|
|
74
|
+
description: "Event/action that triggered"
|
|
75
|
+
}),
|
|
76
|
+
sourceId: field.string({
|
|
77
|
+
isOptional: true,
|
|
78
|
+
description: "Source entity ID"
|
|
79
|
+
}),
|
|
80
|
+
sourceType: field.string({
|
|
81
|
+
isOptional: true,
|
|
82
|
+
description: "Source entity type"
|
|
83
|
+
}),
|
|
84
|
+
createdAt: field.createdAt(),
|
|
85
|
+
updatedAt: field.updatedAt(),
|
|
86
|
+
expiresAt: field.dateTime({
|
|
87
|
+
isOptional: true,
|
|
88
|
+
description: "Notification expiry"
|
|
89
|
+
}),
|
|
90
|
+
deliveryLogs: field.hasMany("DeliveryLog")
|
|
91
|
+
},
|
|
92
|
+
indexes: [
|
|
93
|
+
index.on(["userId", "status", "createdAt"]),
|
|
94
|
+
index.on(["userId", "readAt"]),
|
|
95
|
+
index.on(["orgId", "createdAt"]),
|
|
96
|
+
index.on(["type", "createdAt"])
|
|
97
|
+
],
|
|
98
|
+
enums: [NotificationStatusEnum, NotificationChannelEnum]
|
|
117
99
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
values: [
|
|
124
|
-
"LOW",
|
|
125
|
-
"NORMAL",
|
|
126
|
-
"HIGH",
|
|
127
|
-
"URGENT"
|
|
128
|
-
],
|
|
129
|
-
schema: "lssm_notifications",
|
|
130
|
-
description: "Priority level of a notification."
|
|
100
|
+
var NotificationPriorityEnum = defineEntityEnum({
|
|
101
|
+
name: "NotificationPriority",
|
|
102
|
+
values: ["LOW", "NORMAL", "HIGH", "URGENT"],
|
|
103
|
+
schema: "lssm_notifications",
|
|
104
|
+
description: "Priority level of a notification."
|
|
131
105
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
updatedAt: field.updatedAt()
|
|
164
|
-
},
|
|
165
|
-
enums: [NotificationPriorityEnum]
|
|
106
|
+
var NotificationTemplateEntity = defineEntity({
|
|
107
|
+
name: "NotificationTemplate",
|
|
108
|
+
description: "Reusable notification template.",
|
|
109
|
+
schema: "lssm_notifications",
|
|
110
|
+
map: "notification_template",
|
|
111
|
+
fields: {
|
|
112
|
+
id: field.id(),
|
|
113
|
+
templateId: field.string({
|
|
114
|
+
isUnique: true,
|
|
115
|
+
description: "Template identifier"
|
|
116
|
+
}),
|
|
117
|
+
name: field.string({ description: "Template display name" }),
|
|
118
|
+
description: field.string({ isOptional: true }),
|
|
119
|
+
emailSubject: field.string({ isOptional: true }),
|
|
120
|
+
emailBody: field.string({ isOptional: true }),
|
|
121
|
+
inAppTitle: field.string({ isOptional: true }),
|
|
122
|
+
inAppBody: field.string({ isOptional: true }),
|
|
123
|
+
pushTitle: field.string({ isOptional: true }),
|
|
124
|
+
pushBody: field.string({ isOptional: true }),
|
|
125
|
+
defaultChannels: field.string({ isArray: true }),
|
|
126
|
+
category: field.string({ isOptional: true }),
|
|
127
|
+
priority: field.enum("NotificationPriority", { default: "NORMAL" }),
|
|
128
|
+
variablesSchema: field.json({
|
|
129
|
+
isOptional: true,
|
|
130
|
+
description: "JSON schema for variables"
|
|
131
|
+
}),
|
|
132
|
+
enabled: field.boolean({ default: true }),
|
|
133
|
+
createdAt: field.createdAt(),
|
|
134
|
+
updatedAt: field.updatedAt()
|
|
135
|
+
},
|
|
136
|
+
enums: [NotificationPriorityEnum]
|
|
166
137
|
});
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
indexes: [index.unique(["userId"])]
|
|
138
|
+
var NotificationPreferenceEntity = defineEntity({
|
|
139
|
+
name: "NotificationPreference",
|
|
140
|
+
description: "User notification preferences by type and channel.",
|
|
141
|
+
schema: "lssm_notifications",
|
|
142
|
+
map: "notification_preference",
|
|
143
|
+
fields: {
|
|
144
|
+
id: field.id(),
|
|
145
|
+
userId: field.foreignKey(),
|
|
146
|
+
globalEnabled: field.boolean({ default: true }),
|
|
147
|
+
quietHoursStart: field.string({
|
|
148
|
+
isOptional: true,
|
|
149
|
+
description: "Quiet hours start (HH:MM)"
|
|
150
|
+
}),
|
|
151
|
+
quietHoursEnd: field.string({
|
|
152
|
+
isOptional: true,
|
|
153
|
+
description: "Quiet hours end (HH:MM)"
|
|
154
|
+
}),
|
|
155
|
+
timezone: field.string({ default: '"UTC"' }),
|
|
156
|
+
channelPreferences: field.json({
|
|
157
|
+
description: "Channel-level preferences"
|
|
158
|
+
}),
|
|
159
|
+
typePreferences: field.json({ description: "Type-level preferences" }),
|
|
160
|
+
digestEnabled: field.boolean({ default: false }),
|
|
161
|
+
digestFrequency: field.string({
|
|
162
|
+
isOptional: true,
|
|
163
|
+
description: "daily, weekly, etc."
|
|
164
|
+
}),
|
|
165
|
+
digestTime: field.string({
|
|
166
|
+
isOptional: true,
|
|
167
|
+
description: "Digest send time (HH:MM)"
|
|
168
|
+
}),
|
|
169
|
+
createdAt: field.createdAt(),
|
|
170
|
+
updatedAt: field.updatedAt()
|
|
171
|
+
},
|
|
172
|
+
indexes: [index.unique(["userId"])]
|
|
203
173
|
});
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
indexes: [index.on(["notificationId", "channel"])]
|
|
174
|
+
var DeliveryLogEntity = defineEntity({
|
|
175
|
+
name: "DeliveryLog",
|
|
176
|
+
description: "Log of notification delivery attempts.",
|
|
177
|
+
schema: "lssm_notifications",
|
|
178
|
+
map: "delivery_log",
|
|
179
|
+
fields: {
|
|
180
|
+
id: field.id(),
|
|
181
|
+
notificationId: field.foreignKey(),
|
|
182
|
+
channel: field.enum("NotificationChannel"),
|
|
183
|
+
status: field.enum("NotificationStatus"),
|
|
184
|
+
attemptedAt: field.dateTime(),
|
|
185
|
+
deliveredAt: field.dateTime({ isOptional: true }),
|
|
186
|
+
responseCode: field.string({ isOptional: true }),
|
|
187
|
+
responseMessage: field.string({ isOptional: true }),
|
|
188
|
+
externalId: field.string({
|
|
189
|
+
isOptional: true,
|
|
190
|
+
description: "Provider message ID"
|
|
191
|
+
}),
|
|
192
|
+
metadata: field.json({ isOptional: true }),
|
|
193
|
+
notification: field.belongsTo("Notification", ["notificationId"], ["id"], {
|
|
194
|
+
onDelete: "Cascade"
|
|
195
|
+
})
|
|
196
|
+
},
|
|
197
|
+
indexes: [index.on(["notificationId", "channel"])]
|
|
229
198
|
});
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
NotificationTemplateEntity,
|
|
236
|
-
NotificationPreferenceEntity,
|
|
237
|
-
DeliveryLogEntity
|
|
199
|
+
var notificationEntities = [
|
|
200
|
+
NotificationEntity,
|
|
201
|
+
NotificationTemplateEntity,
|
|
202
|
+
NotificationPreferenceEntity,
|
|
203
|
+
DeliveryLogEntity
|
|
238
204
|
];
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
205
|
+
var notificationsSchemaContribution = {
|
|
206
|
+
moduleId: "@contractspec/module.notifications",
|
|
207
|
+
entities: notificationEntities,
|
|
208
|
+
enums: [
|
|
209
|
+
NotificationStatusEnum,
|
|
210
|
+
NotificationChannelEnum,
|
|
211
|
+
NotificationPriorityEnum
|
|
212
|
+
]
|
|
213
|
+
};
|
|
214
|
+
export {
|
|
215
|
+
notificationsSchemaContribution,
|
|
216
|
+
notificationEntities,
|
|
217
|
+
NotificationTemplateEntity,
|
|
218
|
+
NotificationStatusEnum,
|
|
219
|
+
NotificationPriorityEnum,
|
|
220
|
+
NotificationPreferenceEntity,
|
|
221
|
+
NotificationEntity,
|
|
222
|
+
NotificationChannelEnum,
|
|
223
|
+
DeliveryLogEntity
|
|
250
224
|
};
|
|
251
|
-
|
|
252
|
-
//#endregion
|
|
253
|
-
export { DeliveryLogEntity, NotificationChannelEnum, NotificationEntity, NotificationPreferenceEntity, NotificationPriorityEnum, NotificationStatusEnum, NotificationTemplateEntity, notificationEntities, notificationsSchemaContribution };
|
|
254
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
export * from './entities';
|
|
2
|
+
export * from './contracts';
|
|
3
|
+
export * from './channels';
|
|
4
|
+
export * from './templates';
|
|
5
|
+
export * from './notifications.feature';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,yBAAyB,CAAC"}
|