@contractspec/module.notifications 0.0.0-canary-20260113162409
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/LICENSE +21 -0
- package/README.md +121 -0
- package/dist/channels/index.d.ts +107 -0
- package/dist/channels/index.d.ts.map +1 -0
- package/dist/channels/index.js +127 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/contracts/index.d.ts +638 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +433 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/entities/index.d.ts +183 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +254 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/notifications.capability.d.ts +7 -0
- package/dist/notifications.capability.d.ts.map +1 -0
- package/dist/notifications.capability.js +20 -0
- package/dist/notifications.capability.js.map +1 -0
- package/dist/notifications.feature.d.ts +12 -0
- package/dist/notifications.feature.d.ts.map +1 -0
- package/dist/notifications.feature.js +77 -0
- package/dist/notifications.feature.js.map +1 -0
- package/dist/templates/index.d.ts +92 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +202 -0
- package/dist/templates/index.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { defineEntity, defineEntityEnum, field, index } from "@contractspec/lib.schema";
|
|
2
|
+
|
|
3
|
+
//#region src/entities/index.ts
|
|
4
|
+
/**
|
|
5
|
+
* Notification status enum.
|
|
6
|
+
*/
|
|
7
|
+
const NotificationStatusEnum = defineEntityEnum({
|
|
8
|
+
name: "NotificationStatus",
|
|
9
|
+
values: [
|
|
10
|
+
"PENDING",
|
|
11
|
+
"SENT",
|
|
12
|
+
"DELIVERED",
|
|
13
|
+
"READ",
|
|
14
|
+
"FAILED",
|
|
15
|
+
"CANCELLED"
|
|
16
|
+
],
|
|
17
|
+
schema: "lssm_notifications",
|
|
18
|
+
description: "Status of a notification."
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Notification channel enum.
|
|
22
|
+
*/
|
|
23
|
+
const NotificationChannelEnum = defineEntityEnum({
|
|
24
|
+
name: "NotificationChannel",
|
|
25
|
+
values: [
|
|
26
|
+
"EMAIL",
|
|
27
|
+
"IN_APP",
|
|
28
|
+
"PUSH",
|
|
29
|
+
"WEBHOOK",
|
|
30
|
+
"SMS"
|
|
31
|
+
],
|
|
32
|
+
schema: "lssm_notifications",
|
|
33
|
+
description: "Delivery channel for notifications."
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Notification entity - individual notification instance.
|
|
37
|
+
*/
|
|
38
|
+
const NotificationEntity = defineEntity({
|
|
39
|
+
name: "Notification",
|
|
40
|
+
description: "An individual notification to be delivered to a user.",
|
|
41
|
+
schema: "lssm_notifications",
|
|
42
|
+
map: "notification",
|
|
43
|
+
fields: {
|
|
44
|
+
id: field.id({ description: "Unique notification ID" }),
|
|
45
|
+
userId: field.foreignKey({ description: "Target user ID" }),
|
|
46
|
+
orgId: field.string({
|
|
47
|
+
isOptional: true,
|
|
48
|
+
description: "Organization context"
|
|
49
|
+
}),
|
|
50
|
+
templateId: field.string({
|
|
51
|
+
isOptional: true,
|
|
52
|
+
description: "Template used"
|
|
53
|
+
}),
|
|
54
|
+
title: field.string({ description: "Notification title" }),
|
|
55
|
+
body: field.string({ description: "Notification body" }),
|
|
56
|
+
actionUrl: field.string({
|
|
57
|
+
isOptional: true,
|
|
58
|
+
description: "Action URL"
|
|
59
|
+
}),
|
|
60
|
+
imageUrl: field.string({
|
|
61
|
+
isOptional: true,
|
|
62
|
+
description: "Image URL"
|
|
63
|
+
}),
|
|
64
|
+
type: field.string({ description: "Notification type (e.g., mention, update)" }),
|
|
65
|
+
category: field.string({
|
|
66
|
+
isOptional: true,
|
|
67
|
+
description: "Notification category"
|
|
68
|
+
}),
|
|
69
|
+
priority: field.enum("NotificationPriority", { default: "NORMAL" }),
|
|
70
|
+
channels: field.string({
|
|
71
|
+
isArray: true,
|
|
72
|
+
description: "Target delivery channels"
|
|
73
|
+
}),
|
|
74
|
+
status: field.enum("NotificationStatus", { default: "PENDING" }),
|
|
75
|
+
sentAt: field.dateTime({ isOptional: true }),
|
|
76
|
+
deliveredAt: field.dateTime({ isOptional: true }),
|
|
77
|
+
readAt: field.dateTime({ isOptional: true }),
|
|
78
|
+
metadata: field.json({
|
|
79
|
+
isOptional: true,
|
|
80
|
+
description: "Additional metadata"
|
|
81
|
+
}),
|
|
82
|
+
variables: field.json({
|
|
83
|
+
isOptional: true,
|
|
84
|
+
description: "Template variables used"
|
|
85
|
+
}),
|
|
86
|
+
triggeredBy: field.string({
|
|
87
|
+
isOptional: true,
|
|
88
|
+
description: "Event/action that triggered"
|
|
89
|
+
}),
|
|
90
|
+
sourceId: field.string({
|
|
91
|
+
isOptional: true,
|
|
92
|
+
description: "Source entity ID"
|
|
93
|
+
}),
|
|
94
|
+
sourceType: field.string({
|
|
95
|
+
isOptional: true,
|
|
96
|
+
description: "Source entity type"
|
|
97
|
+
}),
|
|
98
|
+
createdAt: field.createdAt(),
|
|
99
|
+
updatedAt: field.updatedAt(),
|
|
100
|
+
expiresAt: field.dateTime({
|
|
101
|
+
isOptional: true,
|
|
102
|
+
description: "Notification expiry"
|
|
103
|
+
}),
|
|
104
|
+
deliveryLogs: field.hasMany("DeliveryLog")
|
|
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]
|
|
117
|
+
});
|
|
118
|
+
/**
|
|
119
|
+
* Notification priority enum.
|
|
120
|
+
*/
|
|
121
|
+
const NotificationPriorityEnum = defineEntityEnum({
|
|
122
|
+
name: "NotificationPriority",
|
|
123
|
+
values: [
|
|
124
|
+
"LOW",
|
|
125
|
+
"NORMAL",
|
|
126
|
+
"HIGH",
|
|
127
|
+
"URGENT"
|
|
128
|
+
],
|
|
129
|
+
schema: "lssm_notifications",
|
|
130
|
+
description: "Priority level of a notification."
|
|
131
|
+
});
|
|
132
|
+
/**
|
|
133
|
+
* NotificationTemplate entity - reusable notification templates.
|
|
134
|
+
*/
|
|
135
|
+
const NotificationTemplateEntity = defineEntity({
|
|
136
|
+
name: "NotificationTemplate",
|
|
137
|
+
description: "Reusable notification template.",
|
|
138
|
+
schema: "lssm_notifications",
|
|
139
|
+
map: "notification_template",
|
|
140
|
+
fields: {
|
|
141
|
+
id: field.id(),
|
|
142
|
+
templateId: field.string({
|
|
143
|
+
isUnique: true,
|
|
144
|
+
description: "Template identifier"
|
|
145
|
+
}),
|
|
146
|
+
name: field.string({ description: "Template display name" }),
|
|
147
|
+
description: field.string({ isOptional: true }),
|
|
148
|
+
emailSubject: field.string({ isOptional: true }),
|
|
149
|
+
emailBody: field.string({ isOptional: true }),
|
|
150
|
+
inAppTitle: field.string({ isOptional: true }),
|
|
151
|
+
inAppBody: field.string({ isOptional: true }),
|
|
152
|
+
pushTitle: field.string({ isOptional: true }),
|
|
153
|
+
pushBody: field.string({ isOptional: true }),
|
|
154
|
+
defaultChannels: field.string({ isArray: true }),
|
|
155
|
+
category: field.string({ isOptional: true }),
|
|
156
|
+
priority: field.enum("NotificationPriority", { default: "NORMAL" }),
|
|
157
|
+
variablesSchema: field.json({
|
|
158
|
+
isOptional: true,
|
|
159
|
+
description: "JSON schema for variables"
|
|
160
|
+
}),
|
|
161
|
+
enabled: field.boolean({ default: true }),
|
|
162
|
+
createdAt: field.createdAt(),
|
|
163
|
+
updatedAt: field.updatedAt()
|
|
164
|
+
},
|
|
165
|
+
enums: [NotificationPriorityEnum]
|
|
166
|
+
});
|
|
167
|
+
/**
|
|
168
|
+
* NotificationPreference entity - user notification preferences.
|
|
169
|
+
*/
|
|
170
|
+
const NotificationPreferenceEntity = defineEntity({
|
|
171
|
+
name: "NotificationPreference",
|
|
172
|
+
description: "User notification preferences by type and channel.",
|
|
173
|
+
schema: "lssm_notifications",
|
|
174
|
+
map: "notification_preference",
|
|
175
|
+
fields: {
|
|
176
|
+
id: field.id(),
|
|
177
|
+
userId: field.foreignKey(),
|
|
178
|
+
globalEnabled: field.boolean({ default: true }),
|
|
179
|
+
quietHoursStart: field.string({
|
|
180
|
+
isOptional: true,
|
|
181
|
+
description: "Quiet hours start (HH:MM)"
|
|
182
|
+
}),
|
|
183
|
+
quietHoursEnd: field.string({
|
|
184
|
+
isOptional: true,
|
|
185
|
+
description: "Quiet hours end (HH:MM)"
|
|
186
|
+
}),
|
|
187
|
+
timezone: field.string({ default: "\"UTC\"" }),
|
|
188
|
+
channelPreferences: field.json({ description: "Channel-level preferences" }),
|
|
189
|
+
typePreferences: field.json({ description: "Type-level preferences" }),
|
|
190
|
+
digestEnabled: field.boolean({ default: false }),
|
|
191
|
+
digestFrequency: field.string({
|
|
192
|
+
isOptional: true,
|
|
193
|
+
description: "daily, weekly, etc."
|
|
194
|
+
}),
|
|
195
|
+
digestTime: field.string({
|
|
196
|
+
isOptional: true,
|
|
197
|
+
description: "Digest send time (HH:MM)"
|
|
198
|
+
}),
|
|
199
|
+
createdAt: field.createdAt(),
|
|
200
|
+
updatedAt: field.updatedAt()
|
|
201
|
+
},
|
|
202
|
+
indexes: [index.unique(["userId"])]
|
|
203
|
+
});
|
|
204
|
+
/**
|
|
205
|
+
* DeliveryLog entity - track delivery attempts per channel.
|
|
206
|
+
*/
|
|
207
|
+
const DeliveryLogEntity = defineEntity({
|
|
208
|
+
name: "DeliveryLog",
|
|
209
|
+
description: "Log of notification delivery attempts.",
|
|
210
|
+
schema: "lssm_notifications",
|
|
211
|
+
map: "delivery_log",
|
|
212
|
+
fields: {
|
|
213
|
+
id: field.id(),
|
|
214
|
+
notificationId: field.foreignKey(),
|
|
215
|
+
channel: field.enum("NotificationChannel"),
|
|
216
|
+
status: field.enum("NotificationStatus"),
|
|
217
|
+
attemptedAt: field.dateTime(),
|
|
218
|
+
deliveredAt: field.dateTime({ isOptional: true }),
|
|
219
|
+
responseCode: field.string({ isOptional: true }),
|
|
220
|
+
responseMessage: field.string({ isOptional: true }),
|
|
221
|
+
externalId: field.string({
|
|
222
|
+
isOptional: true,
|
|
223
|
+
description: "Provider message ID"
|
|
224
|
+
}),
|
|
225
|
+
metadata: field.json({ isOptional: true }),
|
|
226
|
+
notification: field.belongsTo("Notification", ["notificationId"], ["id"], { onDelete: "Cascade" })
|
|
227
|
+
},
|
|
228
|
+
indexes: [index.on(["notificationId", "channel"])]
|
|
229
|
+
});
|
|
230
|
+
/**
|
|
231
|
+
* All notification entities for schema composition.
|
|
232
|
+
*/
|
|
233
|
+
const notificationEntities = [
|
|
234
|
+
NotificationEntity,
|
|
235
|
+
NotificationTemplateEntity,
|
|
236
|
+
NotificationPreferenceEntity,
|
|
237
|
+
DeliveryLogEntity
|
|
238
|
+
];
|
|
239
|
+
/**
|
|
240
|
+
* Module schema contribution for notifications.
|
|
241
|
+
*/
|
|
242
|
+
const notificationsSchemaContribution = {
|
|
243
|
+
moduleId: "@contractspec/module.notifications",
|
|
244
|
+
entities: notificationEntities,
|
|
245
|
+
enums: [
|
|
246
|
+
NotificationStatusEnum,
|
|
247
|
+
NotificationChannelEnum,
|
|
248
|
+
NotificationPriorityEnum
|
|
249
|
+
]
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
//#endregion
|
|
253
|
+
export { DeliveryLogEntity, NotificationChannelEnum, NotificationEntity, NotificationPreferenceEntity, NotificationPriorityEnum, NotificationStatusEnum, NotificationTemplateEntity, notificationEntities, notificationsSchemaContribution };
|
|
254
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/entities/index.ts"],"sourcesContent":["import {\n defineEntity,\n defineEntityEnum,\n field,\n index,\n} from '@contractspec/lib.schema';\nimport type { ModuleSchemaContribution } from '@contractspec/lib.schema';\n\n/**\n * Notification status enum.\n */\nexport const NotificationStatusEnum = defineEntityEnum({\n name: 'NotificationStatus',\n values: [\n 'PENDING',\n 'SENT',\n 'DELIVERED',\n 'READ',\n 'FAILED',\n 'CANCELLED',\n ] as const,\n schema: 'lssm_notifications',\n description: 'Status of a notification.',\n});\n\n/**\n * Notification channel enum.\n */\nexport const NotificationChannelEnum = defineEntityEnum({\n name: 'NotificationChannel',\n values: ['EMAIL', 'IN_APP', 'PUSH', 'WEBHOOK', 'SMS'] as const,\n schema: 'lssm_notifications',\n description: 'Delivery channel for notifications.',\n});\n\n/**\n * Notification entity - individual notification instance.\n */\nexport const NotificationEntity = defineEntity({\n name: 'Notification',\n description: 'An individual notification to be delivered to a user.',\n schema: 'lssm_notifications',\n map: 'notification',\n fields: {\n id: field.id({ description: 'Unique notification ID' }),\n\n // Recipient\n userId: field.foreignKey({ description: 'Target user ID' }),\n orgId: field.string({\n isOptional: true,\n description: 'Organization context',\n }),\n\n // Content\n templateId: field.string({\n isOptional: true,\n description: 'Template used',\n }),\n title: field.string({ description: 'Notification title' }),\n body: field.string({ description: 'Notification body' }),\n actionUrl: field.string({ isOptional: true, description: 'Action URL' }),\n imageUrl: field.string({ isOptional: true, description: 'Image URL' }),\n\n // Categorization\n type: field.string({\n description: 'Notification type (e.g., mention, update)',\n }),\n category: field.string({\n isOptional: true,\n description: 'Notification category',\n }),\n priority: field.enum('NotificationPriority', { default: 'NORMAL' }),\n\n // Delivery\n channels: field.string({\n isArray: true,\n description: 'Target delivery channels',\n }),\n status: field.enum('NotificationStatus', { default: 'PENDING' }),\n\n // Tracking\n sentAt: field.dateTime({ isOptional: true }),\n deliveredAt: field.dateTime({ isOptional: true }),\n readAt: field.dateTime({ isOptional: true }),\n\n // Metadata\n metadata: field.json({\n isOptional: true,\n description: 'Additional metadata',\n }),\n variables: field.json({\n isOptional: true,\n description: 'Template variables used',\n }),\n\n // Source\n triggeredBy: field.string({\n isOptional: true,\n description: 'Event/action that triggered',\n }),\n sourceId: field.string({\n isOptional: true,\n description: 'Source entity ID',\n }),\n sourceType: field.string({\n isOptional: true,\n description: 'Source entity type',\n }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n expiresAt: field.dateTime({\n isOptional: true,\n description: 'Notification expiry',\n }),\n\n // Relations\n deliveryLogs: field.hasMany('DeliveryLog'),\n },\n indexes: [\n index.on(['userId', 'status', 'createdAt']),\n index.on(['userId', 'readAt']),\n index.on(['orgId', 'createdAt']),\n index.on(['type', 'createdAt']),\n ],\n enums: [NotificationStatusEnum, NotificationChannelEnum],\n});\n\n/**\n * Notification priority enum.\n */\nexport const NotificationPriorityEnum = defineEntityEnum({\n name: 'NotificationPriority',\n values: ['LOW', 'NORMAL', 'HIGH', 'URGENT'] as const,\n schema: 'lssm_notifications',\n description: 'Priority level of a notification.',\n});\n\n/**\n * NotificationTemplate entity - reusable notification templates.\n */\nexport const NotificationTemplateEntity = defineEntity({\n name: 'NotificationTemplate',\n description: 'Reusable notification template.',\n schema: 'lssm_notifications',\n map: 'notification_template',\n fields: {\n id: field.id(),\n templateId: field.string({\n isUnique: true,\n description: 'Template identifier',\n }),\n name: field.string({ description: 'Template display name' }),\n description: field.string({ isOptional: true }),\n\n // Content by channel\n emailSubject: field.string({ isOptional: true }),\n emailBody: field.string({ isOptional: true }),\n inAppTitle: field.string({ isOptional: true }),\n inAppBody: field.string({ isOptional: true }),\n pushTitle: field.string({ isOptional: true }),\n pushBody: field.string({ isOptional: true }),\n\n // Settings\n defaultChannels: field.string({ isArray: true }),\n category: field.string({ isOptional: true }),\n priority: field.enum('NotificationPriority', { default: 'NORMAL' }),\n\n // Variables schema\n variablesSchema: field.json({\n isOptional: true,\n description: 'JSON schema for variables',\n }),\n\n // State\n enabled: field.boolean({ default: true }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n },\n enums: [NotificationPriorityEnum],\n});\n\n/**\n * NotificationPreference entity - user notification preferences.\n */\nexport const NotificationPreferenceEntity = defineEntity({\n name: 'NotificationPreference',\n description: 'User notification preferences by type and channel.',\n schema: 'lssm_notifications',\n map: 'notification_preference',\n fields: {\n id: field.id(),\n userId: field.foreignKey(),\n\n // Global settings\n globalEnabled: field.boolean({ default: true }),\n quietHoursStart: field.string({\n isOptional: true,\n description: 'Quiet hours start (HH:MM)',\n }),\n quietHoursEnd: field.string({\n isOptional: true,\n description: 'Quiet hours end (HH:MM)',\n }),\n timezone: field.string({ default: '\"UTC\"' }),\n\n // Channel preferences (JSON object: { email: true, push: false, ... })\n channelPreferences: field.json({\n description: 'Channel-level preferences',\n }),\n\n // Type preferences (JSON object: { mention: true, update: false, ... })\n typePreferences: field.json({ description: 'Type-level preferences' }),\n\n // Digest settings\n digestEnabled: field.boolean({ default: false }),\n digestFrequency: field.string({\n isOptional: true,\n description: 'daily, weekly, etc.',\n }),\n digestTime: field.string({\n isOptional: true,\n description: 'Digest send time (HH:MM)',\n }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n },\n indexes: [index.unique(['userId'])],\n});\n\n/**\n * DeliveryLog entity - track delivery attempts per channel.\n */\nexport const DeliveryLogEntity = defineEntity({\n name: 'DeliveryLog',\n description: 'Log of notification delivery attempts.',\n schema: 'lssm_notifications',\n map: 'delivery_log',\n fields: {\n id: field.id(),\n notificationId: field.foreignKey(),\n\n // Delivery info\n channel: field.enum('NotificationChannel'),\n status: field.enum('NotificationStatus'),\n\n // Timing\n attemptedAt: field.dateTime(),\n deliveredAt: field.dateTime({ isOptional: true }),\n\n // Response\n responseCode: field.string({ isOptional: true }),\n responseMessage: field.string({ isOptional: true }),\n\n // External IDs\n externalId: field.string({\n isOptional: true,\n description: 'Provider message ID',\n }),\n\n // Metadata\n metadata: field.json({ isOptional: true }),\n\n // Relations\n notification: field.belongsTo('Notification', ['notificationId'], ['id'], {\n onDelete: 'Cascade',\n }),\n },\n indexes: [index.on(['notificationId', 'channel'])],\n});\n\n/**\n * All notification entities for schema composition.\n */\nexport const notificationEntities = [\n NotificationEntity,\n NotificationTemplateEntity,\n NotificationPreferenceEntity,\n DeliveryLogEntity,\n];\n\n/**\n * Module schema contribution for notifications.\n */\nexport const notificationsSchemaContribution: ModuleSchemaContribution = {\n moduleId: '@contractspec/module.notifications',\n entities: notificationEntities,\n enums: [\n NotificationStatusEnum,\n NotificationChannelEnum,\n NotificationPriorityEnum,\n ],\n};\n"],"mappings":";;;;;;AAWA,MAAa,yBAAyB,iBAAiB;CACrD,MAAM;CACN,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACD;CACD,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,0BAA0B,iBAAiB;CACtD,MAAM;CACN,QAAQ;EAAC;EAAS;EAAU;EAAQ;EAAW;EAAM;CACrD,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,qBAAqB,aAAa;CAC7C,MAAM;CACN,aAAa;CACb,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,IAAI,MAAM,GAAG,EAAE,aAAa,0BAA0B,CAAC;EAGvD,QAAQ,MAAM,WAAW,EAAE,aAAa,kBAAkB,CAAC;EAC3D,OAAO,MAAM,OAAO;GAClB,YAAY;GACZ,aAAa;GACd,CAAC;EAGF,YAAY,MAAM,OAAO;GACvB,YAAY;GACZ,aAAa;GACd,CAAC;EACF,OAAO,MAAM,OAAO,EAAE,aAAa,sBAAsB,CAAC;EAC1D,MAAM,MAAM,OAAO,EAAE,aAAa,qBAAqB,CAAC;EACxD,WAAW,MAAM,OAAO;GAAE,YAAY;GAAM,aAAa;GAAc,CAAC;EACxE,UAAU,MAAM,OAAO;GAAE,YAAY;GAAM,aAAa;GAAa,CAAC;EAGtE,MAAM,MAAM,OAAO,EACjB,aAAa,6CACd,CAAC;EACF,UAAU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|
1
|
+
import { ChannelDeliveryResult, ChannelNotification, ChannelRegistry, ConsoleChannel, EmailChannel, InAppChannel, NotificationChannel, PushChannel, WebhookChannel, createChannelRegistry } from "./channels/index.js";
|
|
2
|
+
import { DeleteNotificationContract, GetNotificationPreferencesContract, ListNotificationsContract, ListNotificationsInputModel, ListNotificationsOutputModel, MarkAllNotificationsReadContract, MarkNotificationReadContract, NotificationFilterEnum, NotificationModel, NotificationPreferenceModel, SendNotificationContract, SendNotificationInputModel, UpdateNotificationPreferencesContract, UpdatePreferencesInputModel } from "./contracts/index.js";
|
|
3
|
+
import { DeliveryLogEntity, NotificationChannelEnum, NotificationEntity, NotificationPreferenceEntity, NotificationPriorityEnum, NotificationStatusEnum, NotificationTemplateEntity, notificationEntities, notificationsSchemaContribution } from "./entities/index.js";
|
|
4
|
+
import { ChannelTemplateContent, MentionTemplate, NotificationTemplateDefinition, OrgInviteTemplate, RenderedNotification, TemplateRegistry, TemplateVariable, WelcomeTemplate, createTemplateRegistry, defineTemplate, renderNotificationTemplate, renderTemplate } from "./templates/index.js";
|
|
5
|
+
import { NotificationsFeature } from "./notifications.feature.js";
|
|
6
|
+
export { ChannelDeliveryResult, ChannelNotification, ChannelRegistry, ChannelTemplateContent, ConsoleChannel, DeleteNotificationContract, DeliveryLogEntity, EmailChannel, GetNotificationPreferencesContract, InAppChannel, ListNotificationsContract, ListNotificationsInputModel, ListNotificationsOutputModel, MarkAllNotificationsReadContract, MarkNotificationReadContract, MentionTemplate, NotificationChannel, NotificationChannelEnum, NotificationEntity, NotificationFilterEnum, NotificationModel, NotificationPreferenceEntity, NotificationPreferenceModel, NotificationPriorityEnum, NotificationStatusEnum, NotificationTemplateDefinition, NotificationTemplateEntity, NotificationsFeature, OrgInviteTemplate, PushChannel, RenderedNotification, SendNotificationContract, SendNotificationInputModel, TemplateRegistry, TemplateVariable, UpdateNotificationPreferencesContract, UpdatePreferencesInputModel, WebhookChannel, WelcomeTemplate, createChannelRegistry, createTemplateRegistry, defineTemplate, notificationEntities, notificationsSchemaContribution, renderNotificationTemplate, renderTemplate };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
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 };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/notifications.capability.d.ts
|
|
4
|
+
declare const NotificationsCapability: _contractspec_lib_contracts0.CapabilitySpec;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { NotificationsCapability };
|
|
7
|
+
//# sourceMappingURL=notifications.capability.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.capability.d.ts","names":[],"sources":["../src/notifications.capability.ts"],"sourcesContent":[],"mappings":";;;cAEa,yBAUX,4BAAA,CAVkC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StabilityEnum, defineCapability } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/notifications.capability.ts
|
|
4
|
+
const NotificationsCapability = defineCapability({ meta: {
|
|
5
|
+
key: "notifications",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
kind: "ui",
|
|
8
|
+
stability: StabilityEnum.Experimental,
|
|
9
|
+
description: "User notifications and alerts",
|
|
10
|
+
owners: ["@platform.messaging"],
|
|
11
|
+
tags: [
|
|
12
|
+
"notifications",
|
|
13
|
+
"messaging",
|
|
14
|
+
"alerts"
|
|
15
|
+
]
|
|
16
|
+
} });
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { NotificationsCapability };
|
|
20
|
+
//# sourceMappingURL=notifications.capability.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.capability.js","names":[],"sources":["../src/notifications.capability.ts"],"sourcesContent":["import { defineCapability, StabilityEnum } from '@contractspec/lib.contracts';\n\nexport const NotificationsCapability = defineCapability({\n meta: {\n key: 'notifications',\n version: '1.0.0',\n kind: 'ui',\n stability: StabilityEnum.Experimental,\n description: 'User notifications and alerts',\n owners: ['@platform.messaging'],\n tags: ['notifications', 'messaging', 'alerts'],\n },\n});\n"],"mappings":";;;AAEA,MAAa,0BAA0B,iBAAiB,EACtD,MAAM;CACJ,KAAK;CACL,SAAS;CACT,MAAM;CACN,WAAW,cAAc;CACzB,aAAa;CACb,QAAQ,CAAC,sBAAsB;CAC/B,MAAM;EAAC;EAAiB;EAAa;EAAS;CAC/C,EACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/notifications.feature.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Notifications feature module that bundles notification sending,
|
|
7
|
+
* listing, marking as read, and preference management capabilities.
|
|
8
|
+
*/
|
|
9
|
+
declare const NotificationsFeature: _contractspec_lib_contracts0.FeatureModuleSpec;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { NotificationsFeature };
|
|
12
|
+
//# sourceMappingURL=notifications.feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.feature.d.ts","names":[],"sources":["../src/notifications.feature.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWA;cAAa,sBAqCX,4BAAA,CArC+B"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { defineFeature } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/notifications.feature.ts
|
|
4
|
+
/**
|
|
5
|
+
* Notifications Feature Module Specification
|
|
6
|
+
*
|
|
7
|
+
* Defines the feature module for notification management.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Notifications feature module that bundles notification sending,
|
|
11
|
+
* listing, marking as read, and preference management capabilities.
|
|
12
|
+
*/
|
|
13
|
+
const NotificationsFeature = defineFeature({
|
|
14
|
+
meta: {
|
|
15
|
+
key: "notifications",
|
|
16
|
+
title: "Notifications",
|
|
17
|
+
description: "Multi-channel notification delivery with preference management",
|
|
18
|
+
domain: "platform",
|
|
19
|
+
version: "1.0.0",
|
|
20
|
+
owners: ["@platform.notifications"],
|
|
21
|
+
tags: [
|
|
22
|
+
"notifications",
|
|
23
|
+
"email",
|
|
24
|
+
"push",
|
|
25
|
+
"in-app"
|
|
26
|
+
],
|
|
27
|
+
stability: "stable"
|
|
28
|
+
},
|
|
29
|
+
operations: [
|
|
30
|
+
{
|
|
31
|
+
key: "notifications.send",
|
|
32
|
+
version: "1.0.0"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
key: "notifications.markRead",
|
|
36
|
+
version: "1.0.0"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
key: "notifications.markAllRead",
|
|
40
|
+
version: "1.0.0"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "notifications.delete",
|
|
44
|
+
version: "1.0.0"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key: "notifications.list",
|
|
48
|
+
version: "1.0.0"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "notifications.preferences.update",
|
|
52
|
+
version: "1.0.0"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: "notifications.preferences.get",
|
|
56
|
+
version: "1.0.0"
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
events: [],
|
|
60
|
+
presentations: [],
|
|
61
|
+
opToPresentation: [],
|
|
62
|
+
presentationsTargets: [],
|
|
63
|
+
capabilities: {
|
|
64
|
+
provides: [{
|
|
65
|
+
key: "notifications",
|
|
66
|
+
version: "1.0.0"
|
|
67
|
+
}],
|
|
68
|
+
requires: [{
|
|
69
|
+
key: "identity",
|
|
70
|
+
version: "1.0.0"
|
|
71
|
+
}]
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { NotificationsFeature };
|
|
77
|
+
//# sourceMappingURL=notifications.feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.feature.js","names":[],"sources":["../src/notifications.feature.ts"],"sourcesContent":["/**\n * Notifications Feature Module Specification\n *\n * Defines the feature module for notification management.\n */\nimport { defineFeature } from '@contractspec/lib.contracts';\n\n/**\n * Notifications feature module that bundles notification sending,\n * listing, marking as read, and preference management capabilities.\n */\nexport const NotificationsFeature = defineFeature({\n meta: {\n key: 'notifications',\n title: 'Notifications',\n description:\n 'Multi-channel notification delivery with preference management',\n domain: 'platform',\n version: '1.0.0',\n owners: ['@platform.notifications'],\n tags: ['notifications', 'email', 'push', 'in-app'],\n stability: 'stable',\n },\n\n // All contract operations included in this feature\n operations: [\n { key: 'notifications.send', version: '1.0.0' },\n { key: 'notifications.markRead', version: '1.0.0' },\n { key: 'notifications.markAllRead', version: '1.0.0' },\n { key: 'notifications.delete', version: '1.0.0' },\n { key: 'notifications.list', version: '1.0.0' },\n { key: 'notifications.preferences.update', version: '1.0.0' },\n { key: 'notifications.preferences.get', version: '1.0.0' },\n ],\n\n // No events for this feature - it consumes events to send notifications\n events: [],\n\n // No presentations for this module feature\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n\n // Capability definitions\n capabilities: {\n provides: [{ key: 'notifications', version: '1.0.0' }],\n requires: [{ key: 'identity', version: '1.0.0' }],\n },\n});\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,uBAAuB,cAAc;CAChD,MAAM;EACJ,KAAK;EACL,OAAO;EACP,aACE;EACF,QAAQ;EACR,SAAS;EACT,QAAQ,CAAC,0BAA0B;EACnC,MAAM;GAAC;GAAiB;GAAS;GAAQ;GAAS;EAClD,WAAW;EACZ;CAGD,YAAY;EACV;GAAE,KAAK;GAAsB,SAAS;GAAS;EAC/C;GAAE,KAAK;GAA0B,SAAS;GAAS;EACnD;GAAE,KAAK;GAA6B,SAAS;GAAS;EACtD;GAAE,KAAK;GAAwB,SAAS;GAAS;EACjD;GAAE,KAAK;GAAsB,SAAS;GAAS;EAC/C;GAAE,KAAK;GAAoC,SAAS;GAAS;EAC7D;GAAE,KAAK;GAAiC,SAAS;GAAS;EAC3D;CAGD,QAAQ,EAAE;CAGV,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CAGxB,cAAc;EACZ,UAAU,CAAC;GAAE,KAAK;GAAiB,SAAS;GAAS,CAAC;EACtD,UAAU,CAAC;GAAE,KAAK;GAAY,SAAS;GAAS,CAAC;EAClD;CACF,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
//#region src/templates/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Template variable definition.
|
|
4
|
+
*/
|
|
5
|
+
interface TemplateVariable {
|
|
6
|
+
name: string;
|
|
7
|
+
type: 'string' | 'number' | 'boolean' | 'date' | 'url';
|
|
8
|
+
required?: boolean;
|
|
9
|
+
default?: string | number | boolean;
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Channel-specific template content.
|
|
14
|
+
*/
|
|
15
|
+
interface ChannelTemplateContent {
|
|
16
|
+
title?: string;
|
|
17
|
+
subject?: string;
|
|
18
|
+
body: string;
|
|
19
|
+
actionUrl?: string;
|
|
20
|
+
actionText?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Notification template definition.
|
|
24
|
+
*/
|
|
25
|
+
interface NotificationTemplateDefinition {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
description?: string;
|
|
29
|
+
category?: string;
|
|
30
|
+
variables?: TemplateVariable[];
|
|
31
|
+
defaultChannels?: string[];
|
|
32
|
+
channels: {
|
|
33
|
+
email?: ChannelTemplateContent;
|
|
34
|
+
inApp?: ChannelTemplateContent;
|
|
35
|
+
push?: ChannelTemplateContent;
|
|
36
|
+
webhook?: ChannelTemplateContent;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Rendered notification content.
|
|
41
|
+
*/
|
|
42
|
+
interface RenderedNotification {
|
|
43
|
+
title: string;
|
|
44
|
+
body: string;
|
|
45
|
+
actionUrl?: string;
|
|
46
|
+
email?: {
|
|
47
|
+
subject: string;
|
|
48
|
+
html: string;
|
|
49
|
+
text: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Define a notification template.
|
|
54
|
+
*/
|
|
55
|
+
declare function defineTemplate(def: NotificationTemplateDefinition): NotificationTemplateDefinition;
|
|
56
|
+
/**
|
|
57
|
+
* Render a template with variables.
|
|
58
|
+
*/
|
|
59
|
+
declare function renderTemplate(content: string, variables: Record<string, unknown>): string;
|
|
60
|
+
/**
|
|
61
|
+
* Render a notification template for a specific channel.
|
|
62
|
+
*/
|
|
63
|
+
declare function renderNotificationTemplate(template: NotificationTemplateDefinition, channel: keyof NotificationTemplateDefinition['channels'], variables: Record<string, unknown>): RenderedNotification | null;
|
|
64
|
+
/**
|
|
65
|
+
* Template registry for managing templates.
|
|
66
|
+
*/
|
|
67
|
+
declare class TemplateRegistry {
|
|
68
|
+
private templates;
|
|
69
|
+
register(template: NotificationTemplateDefinition): void;
|
|
70
|
+
get(templateId: string): NotificationTemplateDefinition | undefined;
|
|
71
|
+
getAll(): NotificationTemplateDefinition[];
|
|
72
|
+
getByCategory(category: string): NotificationTemplateDefinition[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a template registry.
|
|
76
|
+
*/
|
|
77
|
+
declare function createTemplateRegistry(): TemplateRegistry;
|
|
78
|
+
/**
|
|
79
|
+
* Welcome email template.
|
|
80
|
+
*/
|
|
81
|
+
declare const WelcomeTemplate: NotificationTemplateDefinition;
|
|
82
|
+
/**
|
|
83
|
+
* Organization invite template.
|
|
84
|
+
*/
|
|
85
|
+
declare const OrgInviteTemplate: NotificationTemplateDefinition;
|
|
86
|
+
/**
|
|
87
|
+
* Mention template.
|
|
88
|
+
*/
|
|
89
|
+
declare const MentionTemplate: NotificationTemplateDefinition;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { ChannelTemplateContent, MentionTemplate, NotificationTemplateDefinition, OrgInviteTemplate, RenderedNotification, TemplateRegistry, TemplateVariable, WelcomeTemplate, createTemplateRegistry, defineTemplate, renderNotificationTemplate, renderTemplate };
|
|
92
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/templates/index.ts"],"sourcesContent":[],"mappings":";;AAGA;AAWA;AAWiB,UAtBA,gBAAA,CAsBA;EAKH,IAAA,EAAA,MAAA;EAGF,IAAA,EAAA,QAAA,GAAA,QAAA,GAAA,SAAA,GAAA,MAAA,GAAA,KAAA;EACA,QAAA,CAAA,EAAA,OAAA;EACD,OAAA,CAAA,EAAA,MAAA,GAAA,MAAA,GAAA,OAAA;EACG,WAAA,CAAA,EAAA,MAAA;;AAOd;AAcA;AASA;AAgBgB,UApEC,sBAAA,CAoEyB;EAC9B,KAAA,CAAA,EAAA,MAAA;EACK,OAAA,CAAA,EAAA,MAAA;EACJ,IAAA,EAAA,MAAA;EACV,SAAA,CAAA,EAAA,MAAA;EAAoB,UAAA,CAAA,EAAA,MAAA;AA+CvB;;;;AAemC,UA3HlB,8BAAA,CA2HkB;EAA8B,EAAA,EAAA,MAAA;EAQjD,IAAA,EAAA,MAAA;EASH,WAAA,CAAA,EAAA,MA0BX;EAKW,QAAA,CAAA,EAAA,MAAA;EAiCA,SAAA,CAAA,EAvMC,gBA8NZ,EAvB0B;;;YApMhB;YACA;WACD;cACG;;;;;;UAOG,oBAAA;;;;;;;;;;;;;iBAcD,cAAA,MACT,iCACJ;;;;iBAOa,cAAA,6BAEH;;;;iBAcG,0BAAA,WACJ,+CACK,uDACJ,0BACV;;;;cA+CU,gBAAA;;qBAGQ;2BAIM;YAIf;mCAIuB;;;;;iBAQnB,sBAAA,CAAA,GAA0B;;;;cAS7B,iBAAe;;;;cA+Bf,mBAAiB;;;;cAiCjB,iBAAe"}
|