@contractspec/module.notifications 1.46.2 → 1.48.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/channels/index.js.map +1 -1
- package/dist/contracts/index.d.ts +161 -161
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/entities/index.d.ts +144 -144
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js.map +1 -1
- 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 +2 -2
- package/dist/notifications.feature.d.ts.map +1 -1
- package/dist/notifications.feature.js +9 -2
- package/dist/notifications.feature.js.map +1 -1
- package/dist/templates/index.js.map +1 -1
- package/package.json +8 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":[],"mappings":";;;;cA6Ba,wBAIX,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/contracts/index.ts"],"sourcesContent":[],"mappings":";;;;cA6Ba,wBAIX,2BAAA,CAJiC;cAQtB,+CAAiB;;UAmB5B,2BAAA,CAAA;IA3BW,UAAA,EAAA,KAAA;EAQA,CAAA;EAmBX,MAAA,EAAA;;;;;;;;;;;;;IAnB4B,IAAA,uCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAqBjB,UAAA,EAAA,KAAA;EAuBX,CAAA;;;;;;;;;;;;;;EAvBsC,MAAA,EAAA;IAyB3B,IAAA,uCAkBX,KAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;;;;;;;cA3CW,yDAA2B;;UAuBtC,2BAAA,CAAA;;;;+CAEqC,CAAA,OAAA,EAAA,OAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAoB1B,CAAA;EAiBX,kBAAA,EAAA;;;;;IAjBsC,IAAA,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2
|
import { ModuleSchemaContribution } from "@contractspec/lib.schema";
|
|
3
3
|
|
|
4
4
|
//#region src/entities/index.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Notification status enum.
|
|
7
7
|
*/
|
|
8
|
-
declare const NotificationStatusEnum:
|
|
8
|
+
declare const NotificationStatusEnum: _contractspec_lib_schema0.EntityEnumDef;
|
|
9
9
|
/**
|
|
10
10
|
* Notification channel enum.
|
|
11
11
|
*/
|
|
12
|
-
declare const NotificationChannelEnum:
|
|
12
|
+
declare const NotificationChannelEnum: _contractspec_lib_schema0.EntityEnumDef;
|
|
13
13
|
/**
|
|
14
14
|
* Notification entity - individual notification instance.
|
|
15
15
|
*/
|
|
16
|
-
declare const NotificationEntity:
|
|
17
|
-
id:
|
|
18
|
-
userId:
|
|
19
|
-
orgId:
|
|
20
|
-
templateId:
|
|
21
|
-
title:
|
|
22
|
-
body:
|
|
23
|
-
actionUrl:
|
|
24
|
-
imageUrl:
|
|
25
|
-
type:
|
|
26
|
-
category:
|
|
27
|
-
priority:
|
|
28
|
-
channels:
|
|
29
|
-
status:
|
|
30
|
-
sentAt:
|
|
31
|
-
deliveredAt:
|
|
32
|
-
readAt:
|
|
33
|
-
metadata:
|
|
34
|
-
variables:
|
|
35
|
-
triggeredBy:
|
|
36
|
-
sourceId:
|
|
37
|
-
sourceType:
|
|
38
|
-
createdAt:
|
|
39
|
-
updatedAt:
|
|
40
|
-
expiresAt:
|
|
41
|
-
deliveryLogs:
|
|
16
|
+
declare const NotificationEntity: _contractspec_lib_schema0.EntitySpec<{
|
|
17
|
+
id: _contractspec_lib_schema0.EntityScalarField;
|
|
18
|
+
userId: _contractspec_lib_schema0.EntityScalarField;
|
|
19
|
+
orgId: _contractspec_lib_schema0.EntityScalarField;
|
|
20
|
+
templateId: _contractspec_lib_schema0.EntityScalarField;
|
|
21
|
+
title: _contractspec_lib_schema0.EntityScalarField;
|
|
22
|
+
body: _contractspec_lib_schema0.EntityScalarField;
|
|
23
|
+
actionUrl: _contractspec_lib_schema0.EntityScalarField;
|
|
24
|
+
imageUrl: _contractspec_lib_schema0.EntityScalarField;
|
|
25
|
+
type: _contractspec_lib_schema0.EntityScalarField;
|
|
26
|
+
category: _contractspec_lib_schema0.EntityScalarField;
|
|
27
|
+
priority: _contractspec_lib_schema0.EntityEnumField;
|
|
28
|
+
channels: _contractspec_lib_schema0.EntityScalarField;
|
|
29
|
+
status: _contractspec_lib_schema0.EntityEnumField;
|
|
30
|
+
sentAt: _contractspec_lib_schema0.EntityScalarField;
|
|
31
|
+
deliveredAt: _contractspec_lib_schema0.EntityScalarField;
|
|
32
|
+
readAt: _contractspec_lib_schema0.EntityScalarField;
|
|
33
|
+
metadata: _contractspec_lib_schema0.EntityScalarField;
|
|
34
|
+
variables: _contractspec_lib_schema0.EntityScalarField;
|
|
35
|
+
triggeredBy: _contractspec_lib_schema0.EntityScalarField;
|
|
36
|
+
sourceId: _contractspec_lib_schema0.EntityScalarField;
|
|
37
|
+
sourceType: _contractspec_lib_schema0.EntityScalarField;
|
|
38
|
+
createdAt: _contractspec_lib_schema0.EntityScalarField;
|
|
39
|
+
updatedAt: _contractspec_lib_schema0.EntityScalarField;
|
|
40
|
+
expiresAt: _contractspec_lib_schema0.EntityScalarField;
|
|
41
|
+
deliveryLogs: _contractspec_lib_schema0.EntityRelationField;
|
|
42
42
|
}>;
|
|
43
43
|
/**
|
|
44
44
|
* Notification priority enum.
|
|
45
45
|
*/
|
|
46
|
-
declare const NotificationPriorityEnum:
|
|
46
|
+
declare const NotificationPriorityEnum: _contractspec_lib_schema0.EntityEnumDef;
|
|
47
47
|
/**
|
|
48
48
|
* NotificationTemplate entity - reusable notification templates.
|
|
49
49
|
*/
|
|
50
|
-
declare const NotificationTemplateEntity:
|
|
51
|
-
id:
|
|
52
|
-
templateId:
|
|
53
|
-
name:
|
|
54
|
-
description:
|
|
55
|
-
emailSubject:
|
|
56
|
-
emailBody:
|
|
57
|
-
inAppTitle:
|
|
58
|
-
inAppBody:
|
|
59
|
-
pushTitle:
|
|
60
|
-
pushBody:
|
|
61
|
-
defaultChannels:
|
|
62
|
-
category:
|
|
63
|
-
priority:
|
|
64
|
-
variablesSchema:
|
|
65
|
-
enabled:
|
|
66
|
-
createdAt:
|
|
67
|
-
updatedAt:
|
|
50
|
+
declare const NotificationTemplateEntity: _contractspec_lib_schema0.EntitySpec<{
|
|
51
|
+
id: _contractspec_lib_schema0.EntityScalarField;
|
|
52
|
+
templateId: _contractspec_lib_schema0.EntityScalarField;
|
|
53
|
+
name: _contractspec_lib_schema0.EntityScalarField;
|
|
54
|
+
description: _contractspec_lib_schema0.EntityScalarField;
|
|
55
|
+
emailSubject: _contractspec_lib_schema0.EntityScalarField;
|
|
56
|
+
emailBody: _contractspec_lib_schema0.EntityScalarField;
|
|
57
|
+
inAppTitle: _contractspec_lib_schema0.EntityScalarField;
|
|
58
|
+
inAppBody: _contractspec_lib_schema0.EntityScalarField;
|
|
59
|
+
pushTitle: _contractspec_lib_schema0.EntityScalarField;
|
|
60
|
+
pushBody: _contractspec_lib_schema0.EntityScalarField;
|
|
61
|
+
defaultChannels: _contractspec_lib_schema0.EntityScalarField;
|
|
62
|
+
category: _contractspec_lib_schema0.EntityScalarField;
|
|
63
|
+
priority: _contractspec_lib_schema0.EntityEnumField;
|
|
64
|
+
variablesSchema: _contractspec_lib_schema0.EntityScalarField;
|
|
65
|
+
enabled: _contractspec_lib_schema0.EntityScalarField;
|
|
66
|
+
createdAt: _contractspec_lib_schema0.EntityScalarField;
|
|
67
|
+
updatedAt: _contractspec_lib_schema0.EntityScalarField;
|
|
68
68
|
}>;
|
|
69
69
|
/**
|
|
70
70
|
* NotificationPreference entity - user notification preferences.
|
|
71
71
|
*/
|
|
72
|
-
declare const NotificationPreferenceEntity:
|
|
73
|
-
id:
|
|
74
|
-
userId:
|
|
75
|
-
globalEnabled:
|
|
76
|
-
quietHoursStart:
|
|
77
|
-
quietHoursEnd:
|
|
78
|
-
timezone:
|
|
79
|
-
channelPreferences:
|
|
80
|
-
typePreferences:
|
|
81
|
-
digestEnabled:
|
|
82
|
-
digestFrequency:
|
|
83
|
-
digestTime:
|
|
84
|
-
createdAt:
|
|
85
|
-
updatedAt:
|
|
72
|
+
declare const NotificationPreferenceEntity: _contractspec_lib_schema0.EntitySpec<{
|
|
73
|
+
id: _contractspec_lib_schema0.EntityScalarField;
|
|
74
|
+
userId: _contractspec_lib_schema0.EntityScalarField;
|
|
75
|
+
globalEnabled: _contractspec_lib_schema0.EntityScalarField;
|
|
76
|
+
quietHoursStart: _contractspec_lib_schema0.EntityScalarField;
|
|
77
|
+
quietHoursEnd: _contractspec_lib_schema0.EntityScalarField;
|
|
78
|
+
timezone: _contractspec_lib_schema0.EntityScalarField;
|
|
79
|
+
channelPreferences: _contractspec_lib_schema0.EntityScalarField;
|
|
80
|
+
typePreferences: _contractspec_lib_schema0.EntityScalarField;
|
|
81
|
+
digestEnabled: _contractspec_lib_schema0.EntityScalarField;
|
|
82
|
+
digestFrequency: _contractspec_lib_schema0.EntityScalarField;
|
|
83
|
+
digestTime: _contractspec_lib_schema0.EntityScalarField;
|
|
84
|
+
createdAt: _contractspec_lib_schema0.EntityScalarField;
|
|
85
|
+
updatedAt: _contractspec_lib_schema0.EntityScalarField;
|
|
86
86
|
}>;
|
|
87
87
|
/**
|
|
88
88
|
* DeliveryLog entity - track delivery attempts per channel.
|
|
89
89
|
*/
|
|
90
|
-
declare const DeliveryLogEntity:
|
|
91
|
-
id:
|
|
92
|
-
notificationId:
|
|
93
|
-
channel:
|
|
94
|
-
status:
|
|
95
|
-
attemptedAt:
|
|
96
|
-
deliveredAt:
|
|
97
|
-
responseCode:
|
|
98
|
-
responseMessage:
|
|
99
|
-
externalId:
|
|
100
|
-
metadata:
|
|
101
|
-
notification:
|
|
90
|
+
declare const DeliveryLogEntity: _contractspec_lib_schema0.EntitySpec<{
|
|
91
|
+
id: _contractspec_lib_schema0.EntityScalarField;
|
|
92
|
+
notificationId: _contractspec_lib_schema0.EntityScalarField;
|
|
93
|
+
channel: _contractspec_lib_schema0.EntityEnumField;
|
|
94
|
+
status: _contractspec_lib_schema0.EntityEnumField;
|
|
95
|
+
attemptedAt: _contractspec_lib_schema0.EntityScalarField;
|
|
96
|
+
deliveredAt: _contractspec_lib_schema0.EntityScalarField;
|
|
97
|
+
responseCode: _contractspec_lib_schema0.EntityScalarField;
|
|
98
|
+
responseMessage: _contractspec_lib_schema0.EntityScalarField;
|
|
99
|
+
externalId: _contractspec_lib_schema0.EntityScalarField;
|
|
100
|
+
metadata: _contractspec_lib_schema0.EntityScalarField;
|
|
101
|
+
notification: _contractspec_lib_schema0.EntityRelationField;
|
|
102
102
|
}>;
|
|
103
103
|
/**
|
|
104
104
|
* All notification entities for schema composition.
|
|
105
105
|
*/
|
|
106
|
-
declare const notificationEntities: (
|
|
107
|
-
id:
|
|
108
|
-
userId:
|
|
109
|
-
orgId:
|
|
110
|
-
templateId:
|
|
111
|
-
title:
|
|
112
|
-
body:
|
|
113
|
-
actionUrl:
|
|
114
|
-
imageUrl:
|
|
115
|
-
type:
|
|
116
|
-
category:
|
|
117
|
-
priority:
|
|
118
|
-
channels:
|
|
119
|
-
status:
|
|
120
|
-
sentAt:
|
|
121
|
-
deliveredAt:
|
|
122
|
-
readAt:
|
|
123
|
-
metadata:
|
|
124
|
-
variables:
|
|
125
|
-
triggeredBy:
|
|
126
|
-
sourceId:
|
|
127
|
-
sourceType:
|
|
128
|
-
createdAt:
|
|
129
|
-
updatedAt:
|
|
130
|
-
expiresAt:
|
|
131
|
-
deliveryLogs:
|
|
132
|
-
}> |
|
|
133
|
-
id:
|
|
134
|
-
templateId:
|
|
135
|
-
name:
|
|
136
|
-
description:
|
|
137
|
-
emailSubject:
|
|
138
|
-
emailBody:
|
|
139
|
-
inAppTitle:
|
|
140
|
-
inAppBody:
|
|
141
|
-
pushTitle:
|
|
142
|
-
pushBody:
|
|
143
|
-
defaultChannels:
|
|
144
|
-
category:
|
|
145
|
-
priority:
|
|
146
|
-
variablesSchema:
|
|
147
|
-
enabled:
|
|
148
|
-
createdAt:
|
|
149
|
-
updatedAt:
|
|
150
|
-
}> |
|
|
151
|
-
id:
|
|
152
|
-
userId:
|
|
153
|
-
globalEnabled:
|
|
154
|
-
quietHoursStart:
|
|
155
|
-
quietHoursEnd:
|
|
156
|
-
timezone:
|
|
157
|
-
channelPreferences:
|
|
158
|
-
typePreferences:
|
|
159
|
-
digestEnabled:
|
|
160
|
-
digestFrequency:
|
|
161
|
-
digestTime:
|
|
162
|
-
createdAt:
|
|
163
|
-
updatedAt:
|
|
164
|
-
}> |
|
|
165
|
-
id:
|
|
166
|
-
notificationId:
|
|
167
|
-
channel:
|
|
168
|
-
status:
|
|
169
|
-
attemptedAt:
|
|
170
|
-
deliveredAt:
|
|
171
|
-
responseCode:
|
|
172
|
-
responseMessage:
|
|
173
|
-
externalId:
|
|
174
|
-
metadata:
|
|
175
|
-
notification:
|
|
106
|
+
declare const notificationEntities: (_contractspec_lib_schema0.EntitySpec<{
|
|
107
|
+
id: _contractspec_lib_schema0.EntityScalarField;
|
|
108
|
+
userId: _contractspec_lib_schema0.EntityScalarField;
|
|
109
|
+
orgId: _contractspec_lib_schema0.EntityScalarField;
|
|
110
|
+
templateId: _contractspec_lib_schema0.EntityScalarField;
|
|
111
|
+
title: _contractspec_lib_schema0.EntityScalarField;
|
|
112
|
+
body: _contractspec_lib_schema0.EntityScalarField;
|
|
113
|
+
actionUrl: _contractspec_lib_schema0.EntityScalarField;
|
|
114
|
+
imageUrl: _contractspec_lib_schema0.EntityScalarField;
|
|
115
|
+
type: _contractspec_lib_schema0.EntityScalarField;
|
|
116
|
+
category: _contractspec_lib_schema0.EntityScalarField;
|
|
117
|
+
priority: _contractspec_lib_schema0.EntityEnumField;
|
|
118
|
+
channels: _contractspec_lib_schema0.EntityScalarField;
|
|
119
|
+
status: _contractspec_lib_schema0.EntityEnumField;
|
|
120
|
+
sentAt: _contractspec_lib_schema0.EntityScalarField;
|
|
121
|
+
deliveredAt: _contractspec_lib_schema0.EntityScalarField;
|
|
122
|
+
readAt: _contractspec_lib_schema0.EntityScalarField;
|
|
123
|
+
metadata: _contractspec_lib_schema0.EntityScalarField;
|
|
124
|
+
variables: _contractspec_lib_schema0.EntityScalarField;
|
|
125
|
+
triggeredBy: _contractspec_lib_schema0.EntityScalarField;
|
|
126
|
+
sourceId: _contractspec_lib_schema0.EntityScalarField;
|
|
127
|
+
sourceType: _contractspec_lib_schema0.EntityScalarField;
|
|
128
|
+
createdAt: _contractspec_lib_schema0.EntityScalarField;
|
|
129
|
+
updatedAt: _contractspec_lib_schema0.EntityScalarField;
|
|
130
|
+
expiresAt: _contractspec_lib_schema0.EntityScalarField;
|
|
131
|
+
deliveryLogs: _contractspec_lib_schema0.EntityRelationField;
|
|
132
|
+
}> | _contractspec_lib_schema0.EntitySpec<{
|
|
133
|
+
id: _contractspec_lib_schema0.EntityScalarField;
|
|
134
|
+
templateId: _contractspec_lib_schema0.EntityScalarField;
|
|
135
|
+
name: _contractspec_lib_schema0.EntityScalarField;
|
|
136
|
+
description: _contractspec_lib_schema0.EntityScalarField;
|
|
137
|
+
emailSubject: _contractspec_lib_schema0.EntityScalarField;
|
|
138
|
+
emailBody: _contractspec_lib_schema0.EntityScalarField;
|
|
139
|
+
inAppTitle: _contractspec_lib_schema0.EntityScalarField;
|
|
140
|
+
inAppBody: _contractspec_lib_schema0.EntityScalarField;
|
|
141
|
+
pushTitle: _contractspec_lib_schema0.EntityScalarField;
|
|
142
|
+
pushBody: _contractspec_lib_schema0.EntityScalarField;
|
|
143
|
+
defaultChannels: _contractspec_lib_schema0.EntityScalarField;
|
|
144
|
+
category: _contractspec_lib_schema0.EntityScalarField;
|
|
145
|
+
priority: _contractspec_lib_schema0.EntityEnumField;
|
|
146
|
+
variablesSchema: _contractspec_lib_schema0.EntityScalarField;
|
|
147
|
+
enabled: _contractspec_lib_schema0.EntityScalarField;
|
|
148
|
+
createdAt: _contractspec_lib_schema0.EntityScalarField;
|
|
149
|
+
updatedAt: _contractspec_lib_schema0.EntityScalarField;
|
|
150
|
+
}> | _contractspec_lib_schema0.EntitySpec<{
|
|
151
|
+
id: _contractspec_lib_schema0.EntityScalarField;
|
|
152
|
+
userId: _contractspec_lib_schema0.EntityScalarField;
|
|
153
|
+
globalEnabled: _contractspec_lib_schema0.EntityScalarField;
|
|
154
|
+
quietHoursStart: _contractspec_lib_schema0.EntityScalarField;
|
|
155
|
+
quietHoursEnd: _contractspec_lib_schema0.EntityScalarField;
|
|
156
|
+
timezone: _contractspec_lib_schema0.EntityScalarField;
|
|
157
|
+
channelPreferences: _contractspec_lib_schema0.EntityScalarField;
|
|
158
|
+
typePreferences: _contractspec_lib_schema0.EntityScalarField;
|
|
159
|
+
digestEnabled: _contractspec_lib_schema0.EntityScalarField;
|
|
160
|
+
digestFrequency: _contractspec_lib_schema0.EntityScalarField;
|
|
161
|
+
digestTime: _contractspec_lib_schema0.EntityScalarField;
|
|
162
|
+
createdAt: _contractspec_lib_schema0.EntityScalarField;
|
|
163
|
+
updatedAt: _contractspec_lib_schema0.EntityScalarField;
|
|
164
|
+
}> | _contractspec_lib_schema0.EntitySpec<{
|
|
165
|
+
id: _contractspec_lib_schema0.EntityScalarField;
|
|
166
|
+
notificationId: _contractspec_lib_schema0.EntityScalarField;
|
|
167
|
+
channel: _contractspec_lib_schema0.EntityEnumField;
|
|
168
|
+
status: _contractspec_lib_schema0.EntityEnumField;
|
|
169
|
+
attemptedAt: _contractspec_lib_schema0.EntityScalarField;
|
|
170
|
+
deliveredAt: _contractspec_lib_schema0.EntityScalarField;
|
|
171
|
+
responseCode: _contractspec_lib_schema0.EntityScalarField;
|
|
172
|
+
responseMessage: _contractspec_lib_schema0.EntityScalarField;
|
|
173
|
+
externalId: _contractspec_lib_schema0.EntityScalarField;
|
|
174
|
+
metadata: _contractspec_lib_schema0.EntityScalarField;
|
|
175
|
+
notification: _contractspec_lib_schema0.EntityRelationField;
|
|
176
176
|
}>)[];
|
|
177
177
|
/**
|
|
178
178
|
* Module schema contribution for notifications.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/entities/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWa,cAAA,sBAYX,EAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/entities/index.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWa,cAAA,sBAYX,EAAA,yBAAA,CAZiC,aAYjC;AAKF;AAUA;;cAVa,yBAKX,yBAAA,CALkC;;;;cAUvB,8CAAkB;MAyF7B,yBAAA,CAAA;;;;;;;;;;;;;;;;;;;uDAzF6B;EAAA,UAAA,6CAAA;EA8FlB,SAAA,6CAKX;EAKW,SAAA,6CAyCX;EAAA,SAAA,6CAAA;;;;;;cAnDW,0BAKX,yBAAA,CALmC;;;;cAUxB,sDAA0B;MAyCrC,yBAAA,CAAA;;;;;;yDAzCqC;EAAA,SAAA,6CAAA;EA8C1B,SAAA,6CA6CX;EAAA,QAAA,6CAAA;;;;;;;;;;;;cA7CW,wDAA4B;MA6CvC,yBAAA,CAAA,iBA7CuC;EAAA,MAAA,6CAAA;EAkD5B,aAAA,6CAoCX;EAAA,eAAA,6CAAA;;;;;;;;;;;;;AAKF;AAKC,cA9CY,iBA8CZ,4BA9C6B,UA8C7B,CAAA;MAVC,yBAAA,CAAA;;;;;;;;;;;;;;;cAKW,iDAAoB;MAKhC,yBAAA,CAAA;;;;;;;;mDALgC;EAAA,QAAA,6CAAA;;;;;;;;;;;;;;;;;MAAA,yBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUpB,UAAA,6CAAiC;;;;;;;;;;;;;;;;;;;cAAjC,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["notificationsSchemaContribution: ModuleSchemaContribution"],"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,MAAM,OAAO;GACrB,YAAY;GACZ,aAAa;GACd,CAAC;EACF,UAAU,MAAM,KAAK,wBAAwB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a,0BAA0B,CAAC;EAGtE,eAAe,MAAM,QAAQ,EAAE,SAAS,OAAO,CAAC;EAChD,iBAAiB,MAAM,OAAO;GAC5B,YAAY;GACZ,aAAa;GACd,CAAC;EACF,YAAY,MAAM,OAAO;GACvB,YAAY;GACZ,aAAa;GACd,CAAC;EAGF,WAAW,MAAM,WAAW;EAC5B,WAAW,MAAM,WAAW;EAC7B;CACD,SAAS,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;CACpC,CAAC;;;;AAKF,MAAa,oBAAoB,aAAa;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,IAAI,MAAM,IAAI;EACd,gBAAgB,MAAM,YAAY;EAGlC,SAAS,MAAM,KAAK,sBAAsB;EAC1C,QAAQ,MAAM,KAAK,qBAAqB;EAGxC,aAAa,MAAM,UAAU;EAC7B,aAAa,MAAM,SAAS,EAAE,YAAY,MAAM,CAAC;EAGjD,cAAc,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAChD,iBAAiB,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAGnD,YAAY,MAAM,OAAO;GACvB,YAAY;GACZ,aAAa;GACd,CAAC;EAGF,UAAU,MAAM,KAAK,EAAE,YAAY,MAAM,CAAC;EAG1C,cAAc,MAAM,UAAU,gBAAgB,CAAC,iBAAiB,EAAE,CAAC,KAAK,EAAE,EACxE,UAAU,WACX,CAAC;EACH;CACD,SAAS,CAAC,MAAM,GAAG,CAAC,kBAAkB,UAAU,CAAC,CAAC;CACnD,CAAC;;;;AAKF,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACD;;;;AAKD,MAAaA,kCAA4D;CACvE,UAAU;CACV,UAAU;CACV,OAAO;EACL;EACA;EACA;EACD;CACF"}
|
|
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,MAAM,OAAO;GACrB,YAAY;GACZ,aAAa;GACd,CAAC;EACF,UAAU,MAAM,KAAK,wBAAwB,EAA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+
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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
|
|
2
2
|
|
|
3
3
|
//#region src/notifications.feature.d.ts
|
|
4
4
|
|
|
@@ -6,7 +6,7 @@ import { FeatureModuleSpec } from "@contractspec/lib.contracts";
|
|
|
6
6
|
* Notifications feature module that bundles notification sending,
|
|
7
7
|
* listing, marking as read, and preference management capabilities.
|
|
8
8
|
*/
|
|
9
|
-
declare const NotificationsFeature: FeatureModuleSpec;
|
|
9
|
+
declare const NotificationsFeature: _contractspec_lib_contracts0.FeatureModuleSpec;
|
|
10
10
|
//#endregion
|
|
11
11
|
export { NotificationsFeature };
|
|
12
12
|
//# sourceMappingURL=notifications.feature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.feature.d.ts","names":[],"sources":["../src/notifications.feature.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notifications.feature.d.ts","names":[],"sources":["../src/notifications.feature.ts"],"sourcesContent":[],"mappings":";;;;;;;AAWA;cAAa,sBAqCX,4BAAA,CArC+B"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import { defineFeature } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
1
3
|
//#region src/notifications.feature.ts
|
|
2
4
|
/**
|
|
5
|
+
* Notifications Feature Module Specification
|
|
6
|
+
*
|
|
7
|
+
* Defines the feature module for notification management.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
3
10
|
* Notifications feature module that bundles notification sending,
|
|
4
11
|
* listing, marking as read, and preference management capabilities.
|
|
5
12
|
*/
|
|
6
|
-
const NotificationsFeature = {
|
|
13
|
+
const NotificationsFeature = defineFeature({
|
|
7
14
|
meta: {
|
|
8
15
|
key: "notifications",
|
|
9
16
|
title: "Notifications",
|
|
@@ -63,7 +70,7 @@ const NotificationsFeature = {
|
|
|
63
70
|
version: "1.0.0"
|
|
64
71
|
}]
|
|
65
72
|
}
|
|
66
|
-
};
|
|
73
|
+
});
|
|
67
74
|
|
|
68
75
|
//#endregion
|
|
69
76
|
export { NotificationsFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.feature.js","names":[
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/templates/index.ts"],"sourcesContent":["/**\n * Template variable definition.\n */\nexport interface TemplateVariable {\n name: string;\n type: 'string' | 'number' | 'boolean' | 'date' | 'url';\n required?: boolean;\n default?: string | number | boolean;\n description?: string;\n}\n\n/**\n * Channel-specific template content.\n */\nexport interface ChannelTemplateContent {\n title?: string;\n subject?: string;\n body: string;\n actionUrl?: string;\n actionText?: string;\n}\n\n/**\n * Notification template definition.\n */\nexport interface NotificationTemplateDefinition {\n id: string;\n name: string;\n description?: string;\n category?: string;\n variables?: TemplateVariable[];\n defaultChannels?: string[];\n channels: {\n email?: ChannelTemplateContent;\n inApp?: ChannelTemplateContent;\n push?: ChannelTemplateContent;\n webhook?: ChannelTemplateContent;\n };\n}\n\n/**\n * Rendered notification content.\n */\nexport interface RenderedNotification {\n title: string;\n body: string;\n actionUrl?: string;\n email?: {\n subject: string;\n html: string;\n text: string;\n };\n}\n\n/**\n * Define a notification template.\n */\nexport function defineTemplate(\n def: NotificationTemplateDefinition\n): NotificationTemplateDefinition {\n return def;\n}\n\n/**\n * Render a template with variables.\n */\nexport function renderTemplate(\n content: string,\n variables: Record<string, unknown>\n): string {\n return content.replace(/\\{\\{(\\w+)\\}\\}/g, (match, key) => {\n const value = variables[key];\n if (value === undefined || value === null) {\n return match; // Keep placeholder if no value\n }\n return String(value);\n });\n}\n\n/**\n * Render a notification template for a specific channel.\n */\nexport function renderNotificationTemplate(\n template: NotificationTemplateDefinition,\n channel: keyof NotificationTemplateDefinition['channels'],\n variables: Record<string, unknown>\n): RenderedNotification | null {\n const channelContent = template.channels[channel];\n if (!channelContent) {\n return null;\n }\n\n const title = channelContent.title\n ? renderTemplate(channelContent.title, variables)\n : template.name;\n\n const body = renderTemplate(channelContent.body, variables);\n\n const actionUrl = channelContent.actionUrl\n ? renderTemplate(channelContent.actionUrl, variables)\n : undefined;\n\n const result: RenderedNotification = {\n title,\n body,\n actionUrl,\n };\n\n // Add email-specific rendering\n if (channel === 'email' && channelContent.subject) {\n result.email = {\n subject: renderTemplate(channelContent.subject, variables),\n html: body,\n text: stripHtml(body),\n };\n }\n\n return result;\n}\n\n/**\n * Strip HTML tags from content (for plain text).\n */\nfunction stripHtml(html: string): string {\n return html\n .replace(/<[^>]*>/g, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\n/**\n * Template registry for managing templates.\n */\nexport class TemplateRegistry {\n private templates = new Map<string, NotificationTemplateDefinition>();\n\n register(template: NotificationTemplateDefinition): void {\n this.templates.set(template.id, template);\n }\n\n get(templateId: string): NotificationTemplateDefinition | undefined {\n return this.templates.get(templateId);\n }\n\n getAll(): NotificationTemplateDefinition[] {\n return Array.from(this.templates.values());\n }\n\n getByCategory(category: string): NotificationTemplateDefinition[] {\n return this.getAll().filter((t) => t.category === category);\n }\n}\n\n/**\n * Create a template registry.\n */\nexport function createTemplateRegistry(): TemplateRegistry {\n return new TemplateRegistry();\n}\n\n// ============ Standard Templates ============\n\n/**\n * Welcome email template.\n */\nexport const WelcomeTemplate = defineTemplate({\n id: 'welcome',\n name: 'Welcome',\n description: 'Sent when a user signs up.',\n category: 'onboarding',\n variables: [\n { name: 'name', type: 'string', required: true },\n { name: 'appName', type: 'string', default: 'ContractSpec' },\n { name: 'actionUrl', type: 'url' },\n ],\n defaultChannels: ['EMAIL', 'IN_APP'],\n channels: {\n email: {\n subject: 'Welcome to {{appName}}, {{name}}!',\n body: `\n <h1>Welcome, {{name}}!</h1>\n <p>Thanks for joining {{appName}}. We're excited to have you on board.</p>\n <p><a href=\"{{actionUrl}}\">Get started now</a></p>\n `,\n },\n inApp: {\n title: 'Welcome to {{appName}}!',\n body: 'Thanks for joining. Click to complete your profile.',\n actionUrl: '{{actionUrl}}',\n },\n },\n});\n\n/**\n * Organization invite template.\n */\nexport const OrgInviteTemplate = defineTemplate({\n id: 'org-invite',\n name: 'Organization Invitation',\n description: 'Sent when a user is invited to an organization.',\n category: 'organization',\n variables: [\n { name: 'inviterName', type: 'string', required: true },\n { name: 'orgName', type: 'string', required: true },\n { name: 'role', type: 'string', default: 'member' },\n { name: 'actionUrl', type: 'url', required: true },\n ],\n defaultChannels: ['EMAIL'],\n channels: {\n email: {\n subject: '{{inviterName}} invited you to join {{orgName}}',\n body: `\n <h1>You've been invited!</h1>\n <p>{{inviterName}} has invited you to join <strong>{{orgName}}</strong> as a {{role}}.</p>\n <p><a href=\"{{actionUrl}}\">Accept invitation</a></p>\n `,\n },\n inApp: {\n title: 'Invitation to {{orgName}}',\n body: '{{inviterName}} invited you to join as {{role}}.',\n actionUrl: '{{actionUrl}}',\n actionText: 'Accept',\n },\n },\n});\n\n/**\n * Mention template.\n */\nexport const MentionTemplate = defineTemplate({\n id: 'mention',\n name: 'Mention',\n description: 'Sent when a user is mentioned.',\n category: 'social',\n variables: [\n { name: 'mentionerName', type: 'string', required: true },\n { name: 'context', type: 'string', required: true },\n { name: 'preview', type: 'string' },\n { name: 'actionUrl', type: 'url', required: true },\n ],\n defaultChannels: ['IN_APP', 'PUSH'],\n channels: {\n inApp: {\n title: '{{mentionerName}} mentioned you',\n body: 'In {{context}}: \"{{preview}}\"',\n actionUrl: '{{actionUrl}}',\n },\n push: {\n title: '{{mentionerName}} mentioned you',\n body: '{{preview}}',\n },\n },\n});\n"],"mappings":";;;;AAyDA,SAAgB,eACd,KACgC;AAChC,QAAO;;;;;AAMT,SAAgB,eACd,SACA,WACQ;AACR,QAAO,QAAQ,QAAQ,mBAAmB,OAAO,QAAQ;EACvD,MAAM,QAAQ,UAAU;AACxB,MAAI,UAAU,UAAa,UAAU,KACnC,QAAO;AAET,SAAO,OAAO,MAAM;GACpB;;;;;AAMJ,SAAgB,2BACd,UACA,SACA,WAC6B;CAC7B,MAAM,iBAAiB,SAAS,SAAS;AACzC,KAAI,CAAC,eACH,QAAO;CAGT,MAAM,QAAQ,eAAe,QACzB,eAAe,eAAe,OAAO,UAAU,GAC/C,SAAS;CAEb,MAAM,OAAO,eAAe,eAAe,MAAM,UAAU;CAM3D,MAAM,SAA+B;EACnC;EACA;EACA,WAPgB,eAAe,YAC7B,eAAe,eAAe,WAAW,UAAU,GACnD;EAMH;AAGD,KAAI,YAAY,WAAW,eAAe,QACxC,QAAO,QAAQ;EACb,SAAS,eAAe,eAAe,SAAS,UAAU;EAC1D,MAAM;EACN,MAAM,UAAU,KAAK;EACtB;AAGH,QAAO;;;;;AAMT,SAAS,UAAU,MAAsB;AACvC,QAAO,KACJ,QAAQ,YAAY,GAAG,CACvB,QAAQ,QAAQ,IAAI,CACpB,MAAM;;;;;AAMX,IAAa,mBAAb,MAA8B;CAC5B,AAAQ,4BAAY,IAAI,KAA6C;CAErE,SAAS,UAAgD;AACvD,OAAK,UAAU,IAAI,SAAS,IAAI,SAAS;;CAG3C,IAAI,YAAgE;AAClE,SAAO,KAAK,UAAU,IAAI,WAAW;;CAGvC,SAA2C;AACzC,SAAO,MAAM,KAAK,KAAK,UAAU,QAAQ,CAAC;;CAG5C,cAAc,UAAoD;AAChE,SAAO,KAAK,QAAQ,CAAC,QAAQ,MAAM,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L,OAAO;GACP,MAAM;GACN,WAAW;GACZ;EACD,MAAM;GACJ,OAAO;GACP,MAAM;GACP;EACF;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/module.notifications",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.0",
|
|
4
4
|
"description": "Notification center module for ContractSpec applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contractspec",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"email",
|
|
11
11
|
"typescript"
|
|
12
12
|
],
|
|
13
|
-
"main": "./dist/index.js",
|
|
14
13
|
"types": "./dist/index.d.ts",
|
|
15
14
|
"type": "module",
|
|
16
15
|
"scripts": {
|
|
@@ -26,14 +25,14 @@
|
|
|
26
25
|
"lint:check": "eslint src"
|
|
27
26
|
},
|
|
28
27
|
"dependencies": {
|
|
29
|
-
"@contractspec/lib.schema": "1.
|
|
30
|
-
"@contractspec/lib.contracts": "1.
|
|
31
|
-
"@contractspec/lib.bus": "1.
|
|
32
|
-
"zod": "^4.
|
|
28
|
+
"@contractspec/lib.schema": "1.48.0",
|
|
29
|
+
"@contractspec/lib.contracts": "1.48.0",
|
|
30
|
+
"@contractspec/lib.bus": "1.48.0",
|
|
31
|
+
"zod": "^4.3.5"
|
|
33
32
|
},
|
|
34
33
|
"devDependencies": {
|
|
35
|
-
"@contractspec/tool.typescript": "1.
|
|
36
|
-
"@contractspec/tool.tsdown": "1.
|
|
34
|
+
"@contractspec/tool.typescript": "1.48.0",
|
|
35
|
+
"@contractspec/tool.tsdown": "1.48.0",
|
|
37
36
|
"typescript": "^5.9.3"
|
|
38
37
|
},
|
|
39
38
|
"exports": {
|
|
@@ -41,11 +40,11 @@
|
|
|
41
40
|
"./channels": "./dist/channels/index.js",
|
|
42
41
|
"./contracts": "./dist/contracts/index.js",
|
|
43
42
|
"./entities": "./dist/entities/index.js",
|
|
43
|
+
"./notifications.capability": "./dist/notifications.capability.js",
|
|
44
44
|
"./notifications.feature": "./dist/notifications.feature.js",
|
|
45
45
|
"./templates": "./dist/templates/index.js",
|
|
46
46
|
"./*": "./*"
|
|
47
47
|
},
|
|
48
|
-
"module": "./dist/index.js",
|
|
49
48
|
"files": [
|
|
50
49
|
"dist",
|
|
51
50
|
"README.md"
|