@tstdl/base 0.93.99 → 0.93.101
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/authentication/client/authentication.service.d.ts +1 -1
- package/authentication/client/authentication.service.js +23 -11
- package/file/mime-type.d.ts +2 -2
- package/file/mime-type.js +2 -3
- package/file/server/index.d.ts +1 -0
- package/file/server/index.js +1 -0
- package/file/server/mime-type.d.ts +2 -0
- package/file/server/mime-type.js +5 -0
- package/notification/api/index.d.ts +1 -0
- package/notification/api/index.js +1 -0
- package/notification/api/notification.api.d.ts +8 -16
- package/notification/api/notification.api.js +13 -26
- package/notification/index.d.ts +1 -1
- package/notification/index.js +1 -1
- package/notification/models/in-app-notification.model.d.ts +9 -4
- package/notification/models/in-app-notification.model.js +25 -10
- package/notification/models/index.d.ts +1 -1
- package/notification/models/index.js +1 -1
- package/notification/models/notification-log.model.d.ts +42 -5
- package/notification/models/notification-log.model.js +34 -20
- package/notification/models/notification-preference.model.d.ts +2 -2
- package/notification/models/notification-preference.model.js +9 -9
- package/notification/models/notification-type.model.d.ts +17 -0
- package/notification/models/{notification-category.model.js → notification-type.model.js} +12 -13
- package/notification/models/web-push-subscription.model.d.ts +2 -2
- package/notification/models/web-push-subscription.model.js +8 -7
- package/notification/server/api/notification.api-controller.d.ts +2 -2
- package/notification/server/api/notification.api-controller.js +4 -3
- package/notification/server/drizzle/{0000_glorious_randall.sql → 0000_shiny_the_anarchist.sql} +27 -32
- package/notification/server/drizzle/meta/0000_snapshot.json +179 -179
- package/notification/server/drizzle/meta/_journal.json +2 -2
- package/notification/server/module.d.ts +2 -0
- package/notification/server/module.js +1 -0
- package/notification/server/providers/channel-provider.d.ts +4 -3
- package/notification/server/providers/channel-provider.js +2 -1
- package/notification/server/providers/email-channel-provider.d.ts +3 -3
- package/notification/server/providers/email-channel-provider.js +7 -9
- package/notification/server/providers/in-app-channel-provider.d.ts +5 -5
- package/notification/server/providers/in-app-channel-provider.js +15 -16
- package/notification/server/providers/index.d.ts +1 -1
- package/notification/server/providers/index.js +1 -1
- package/notification/server/providers/web-push-channel-provider.d.ts +5 -4
- package/notification/server/providers/web-push-channel-provider.js +8 -7
- package/notification/server/schemas.d.ts +3 -3
- package/notification/server/schemas.js +3 -4
- package/notification/server/services/index.d.ts +2 -4
- package/notification/server/services/index.js +2 -4
- package/notification/server/services/notification-delivery.worker.d.ts +7 -1
- package/notification/server/services/notification-delivery.worker.js +49 -37
- package/notification/server/services/notification-sse.service.d.ts +4 -7
- package/notification/server/services/notification-sse.service.js +4 -11
- package/notification/server/services/notification-template.d.ts +2 -2
- package/notification/server/services/notification-template.js +3 -1
- package/notification/server/services/notification-template.service.d.ts +1 -1
- package/notification/server/services/notification-template.service.js +7 -3
- package/notification/server/services/notification-type.service.d.ts +11 -0
- package/notification/server/services/notification-type.service.js +41 -0
- package/notification/server/services/notification.service.d.ts +4 -5
- package/notification/server/services/notification.service.js +44 -27
- package/notification/tests/notification-api.test.js +95 -0
- package/notification/tests/notification-flow.test.js +174 -28
- package/notification/tests/notification-type.service.test.d.ts +1 -0
- package/notification/tests/notification-type.service.test.js +35 -0
- package/package.json +2 -2
- package/rate-limit/postgres/postgres-rate-limiter.d.ts +9 -4
- package/rate-limit/postgres/postgres-rate-limiter.js +17 -10
- package/rate-limit/rate-limiter.d.ts +6 -6
- package/rate-limit/tests/postgres-rate-limiter.test.js +1 -1
- package/task-queue/postgres/task-queue.js +1 -1
- package/task-queue/task-queue.d.ts +3 -3
- package/task-queue/tests/extensive-dependencies.test.d.ts +1 -0
- package/task-queue/tests/extensive-dependencies.test.js +234 -0
- package/notification/enums.d.ts +0 -22
- package/notification/enums.js +0 -19
- package/notification/models/notification-category.model.d.ts +0 -17
- package/notification/server/services/notification-category.service.d.ts +0 -11
- package/notification/server/services/notification-category.service.js +0 -41
- package/notification/server/services/notification-delivery.task.d.ts +0 -9
- package/notification/server/services/notification-delivery.task.js +0 -1
- package/notification/server/services/singleton.d.ts +0 -3
- package/notification/server/services/singleton.js +0 -10
- package/notification/tests/notification-category.service.test.js +0 -36
- package/notification/tests/test-notification.model.d.ts +0 -4
- package/notification/tests/test-notification.model.js +0 -25
- /package/notification/tests/{notification-category.service.test.d.ts → notification-api.test.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
2
|
+
"id": "8f352123-edd8-491f-a4ad-008d09531722",
|
|
3
3
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
4
4
|
"version": "7",
|
|
5
5
|
"dialect": "postgresql",
|
|
@@ -33,51 +33,54 @@
|
|
|
33
33
|
"primaryKey": false,
|
|
34
34
|
"notNull": true
|
|
35
35
|
},
|
|
36
|
-
"
|
|
37
|
-
"name": "
|
|
36
|
+
"read_timestamp": {
|
|
37
|
+
"name": "read_timestamp",
|
|
38
38
|
"type": "timestamp with time zone",
|
|
39
39
|
"primaryKey": false,
|
|
40
40
|
"notNull": false
|
|
41
41
|
},
|
|
42
|
-
"
|
|
43
|
-
"name": "
|
|
42
|
+
"archive_timestamp": {
|
|
43
|
+
"name": "archive_timestamp",
|
|
44
44
|
"type": "timestamp with time zone",
|
|
45
45
|
"primaryKey": false,
|
|
46
46
|
"notNull": false
|
|
47
|
-
},
|
|
48
|
-
"revision": {
|
|
49
|
-
"name": "revision",
|
|
50
|
-
"type": "integer",
|
|
51
|
-
"primaryKey": false,
|
|
52
|
-
"notNull": true
|
|
53
|
-
},
|
|
54
|
-
"revision_timestamp": {
|
|
55
|
-
"name": "revision_timestamp",
|
|
56
|
-
"type": "timestamp with time zone",
|
|
57
|
-
"primaryKey": false,
|
|
58
|
-
"notNull": true
|
|
59
|
-
},
|
|
60
|
-
"create_timestamp": {
|
|
61
|
-
"name": "create_timestamp",
|
|
62
|
-
"type": "timestamp with time zone",
|
|
63
|
-
"primaryKey": false,
|
|
64
|
-
"notNull": true
|
|
65
|
-
},
|
|
66
|
-
"delete_timestamp": {
|
|
67
|
-
"name": "delete_timestamp",
|
|
68
|
-
"type": "timestamp with time zone",
|
|
69
|
-
"primaryKey": false,
|
|
70
|
-
"notNull": false
|
|
71
|
-
},
|
|
72
|
-
"attributes": {
|
|
73
|
-
"name": "attributes",
|
|
74
|
-
"type": "jsonb",
|
|
75
|
-
"primaryKey": false,
|
|
76
|
-
"notNull": true,
|
|
77
|
-
"default": "'{}'::jsonb"
|
|
78
47
|
}
|
|
79
48
|
},
|
|
80
|
-
"indexes": {
|
|
49
|
+
"indexes": {
|
|
50
|
+
"in_app_tenant_id_user_id_read_timestamp_archive_timestamp_idx": {
|
|
51
|
+
"name": "in_app_tenant_id_user_id_read_timestamp_archive_timestamp_idx",
|
|
52
|
+
"columns": [
|
|
53
|
+
{
|
|
54
|
+
"expression": "tenant_id",
|
|
55
|
+
"isExpression": false,
|
|
56
|
+
"asc": true,
|
|
57
|
+
"nulls": "last"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"expression": "user_id",
|
|
61
|
+
"isExpression": false,
|
|
62
|
+
"asc": true,
|
|
63
|
+
"nulls": "last"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"expression": "read_timestamp",
|
|
67
|
+
"isExpression": false,
|
|
68
|
+
"asc": true,
|
|
69
|
+
"nulls": "last"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"expression": "archive_timestamp",
|
|
73
|
+
"isExpression": false,
|
|
74
|
+
"asc": true,
|
|
75
|
+
"nulls": "last"
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"isUnique": false,
|
|
79
|
+
"concurrently": false,
|
|
80
|
+
"method": "btree",
|
|
81
|
+
"with": {}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
81
84
|
"foreignKeys": {
|
|
82
85
|
"in_app_id_user_fkey": {
|
|
83
86
|
"name": "in_app_id_user_fkey",
|
|
@@ -95,18 +98,20 @@
|
|
|
95
98
|
"onDelete": "no action",
|
|
96
99
|
"onUpdate": "no action"
|
|
97
100
|
},
|
|
98
|
-
"
|
|
99
|
-
"name": "
|
|
101
|
+
"in_app_tenantId_logId_userId_log_fkey": {
|
|
102
|
+
"name": "in_app_tenantId_logId_userId_log_fkey",
|
|
100
103
|
"tableFrom": "in_app",
|
|
101
104
|
"tableTo": "log",
|
|
102
105
|
"schemaTo": "notification",
|
|
103
106
|
"columnsFrom": [
|
|
104
107
|
"tenant_id",
|
|
105
|
-
"log_id"
|
|
108
|
+
"log_id",
|
|
109
|
+
"user_id"
|
|
106
110
|
],
|
|
107
111
|
"columnsTo": [
|
|
108
112
|
"tenant_id",
|
|
109
|
-
"id"
|
|
113
|
+
"id",
|
|
114
|
+
"user_id"
|
|
110
115
|
],
|
|
111
116
|
"onDelete": "no action",
|
|
112
117
|
"onUpdate": "no action"
|
|
@@ -126,104 +131,6 @@
|
|
|
126
131
|
"checkConstraints": {},
|
|
127
132
|
"isRLSEnabled": false
|
|
128
133
|
},
|
|
129
|
-
"notification.category": {
|
|
130
|
-
"name": "category",
|
|
131
|
-
"schema": "notification",
|
|
132
|
-
"columns": {
|
|
133
|
-
"id": {
|
|
134
|
-
"name": "id",
|
|
135
|
-
"type": "uuid",
|
|
136
|
-
"primaryKey": false,
|
|
137
|
-
"notNull": true,
|
|
138
|
-
"default": "gen_random_uuid()"
|
|
139
|
-
},
|
|
140
|
-
"tenant_id": {
|
|
141
|
-
"name": "tenant_id",
|
|
142
|
-
"type": "uuid",
|
|
143
|
-
"primaryKey": false,
|
|
144
|
-
"notNull": true
|
|
145
|
-
},
|
|
146
|
-
"label": {
|
|
147
|
-
"name": "label",
|
|
148
|
-
"type": "text",
|
|
149
|
-
"primaryKey": false,
|
|
150
|
-
"notNull": true
|
|
151
|
-
},
|
|
152
|
-
"key": {
|
|
153
|
-
"name": "key",
|
|
154
|
-
"type": "text",
|
|
155
|
-
"primaryKey": false,
|
|
156
|
-
"notNull": true
|
|
157
|
-
},
|
|
158
|
-
"throttling": {
|
|
159
|
-
"name": "throttling",
|
|
160
|
-
"type": "jsonb",
|
|
161
|
-
"primaryKey": false,
|
|
162
|
-
"notNull": false
|
|
163
|
-
},
|
|
164
|
-
"escalations": {
|
|
165
|
-
"name": "escalations",
|
|
166
|
-
"type": "jsonb",
|
|
167
|
-
"primaryKey": false,
|
|
168
|
-
"notNull": false
|
|
169
|
-
},
|
|
170
|
-
"revision": {
|
|
171
|
-
"name": "revision",
|
|
172
|
-
"type": "integer",
|
|
173
|
-
"primaryKey": false,
|
|
174
|
-
"notNull": true
|
|
175
|
-
},
|
|
176
|
-
"revision_timestamp": {
|
|
177
|
-
"name": "revision_timestamp",
|
|
178
|
-
"type": "timestamp with time zone",
|
|
179
|
-
"primaryKey": false,
|
|
180
|
-
"notNull": true
|
|
181
|
-
},
|
|
182
|
-
"create_timestamp": {
|
|
183
|
-
"name": "create_timestamp",
|
|
184
|
-
"type": "timestamp with time zone",
|
|
185
|
-
"primaryKey": false,
|
|
186
|
-
"notNull": true
|
|
187
|
-
},
|
|
188
|
-
"delete_timestamp": {
|
|
189
|
-
"name": "delete_timestamp",
|
|
190
|
-
"type": "timestamp with time zone",
|
|
191
|
-
"primaryKey": false,
|
|
192
|
-
"notNull": false
|
|
193
|
-
},
|
|
194
|
-
"attributes": {
|
|
195
|
-
"name": "attributes",
|
|
196
|
-
"type": "jsonb",
|
|
197
|
-
"primaryKey": false,
|
|
198
|
-
"notNull": true,
|
|
199
|
-
"default": "'{}'::jsonb"
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
"indexes": {},
|
|
203
|
-
"foreignKeys": {},
|
|
204
|
-
"compositePrimaryKeys": {
|
|
205
|
-
"category_tenant_id_id_pk": {
|
|
206
|
-
"name": "category_tenant_id_id_pk",
|
|
207
|
-
"columns": [
|
|
208
|
-
"tenant_id",
|
|
209
|
-
"id"
|
|
210
|
-
]
|
|
211
|
-
}
|
|
212
|
-
},
|
|
213
|
-
"uniqueConstraints": {
|
|
214
|
-
"category_tenant_id_key_unique": {
|
|
215
|
-
"name": "category_tenant_id_key_unique",
|
|
216
|
-
"nullsNotDistinct": false,
|
|
217
|
-
"columns": [
|
|
218
|
-
"tenant_id",
|
|
219
|
-
"key"
|
|
220
|
-
]
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
"policies": {},
|
|
224
|
-
"checkConstraints": {},
|
|
225
|
-
"isRLSEnabled": false
|
|
226
|
-
},
|
|
227
134
|
"notification.log": {
|
|
228
135
|
"name": "log",
|
|
229
136
|
"schema": "notification",
|
|
@@ -247,12 +154,6 @@
|
|
|
247
154
|
"primaryKey": false,
|
|
248
155
|
"notNull": true
|
|
249
156
|
},
|
|
250
|
-
"category_id": {
|
|
251
|
-
"name": "category_id",
|
|
252
|
-
"type": "uuid",
|
|
253
|
-
"primaryKey": false,
|
|
254
|
-
"notNull": true
|
|
255
|
-
},
|
|
256
157
|
"type": {
|
|
257
158
|
"name": "type",
|
|
258
159
|
"type": "text",
|
|
@@ -319,30 +220,28 @@
|
|
|
319
220
|
},
|
|
320
221
|
"indexes": {},
|
|
321
222
|
"foreignKeys": {
|
|
322
|
-
"
|
|
323
|
-
"name": "
|
|
223
|
+
"log_type_type_key_fk": {
|
|
224
|
+
"name": "log_type_type_key_fk",
|
|
324
225
|
"tableFrom": "log",
|
|
325
|
-
"tableTo": "
|
|
326
|
-
"schemaTo": "
|
|
226
|
+
"tableTo": "type",
|
|
227
|
+
"schemaTo": "notification",
|
|
327
228
|
"columnsFrom": [
|
|
328
|
-
"
|
|
329
|
-
"user_id"
|
|
229
|
+
"type"
|
|
330
230
|
],
|
|
331
231
|
"columnsTo": [
|
|
332
|
-
"
|
|
333
|
-
"id"
|
|
232
|
+
"key"
|
|
334
233
|
],
|
|
335
234
|
"onDelete": "no action",
|
|
336
235
|
"onUpdate": "no action"
|
|
337
236
|
},
|
|
338
|
-
"
|
|
339
|
-
"name": "
|
|
237
|
+
"log_id_user_fkey": {
|
|
238
|
+
"name": "log_id_user_fkey",
|
|
340
239
|
"tableFrom": "log",
|
|
341
|
-
"tableTo": "
|
|
342
|
-
"schemaTo": "
|
|
240
|
+
"tableTo": "user",
|
|
241
|
+
"schemaTo": "authentication",
|
|
343
242
|
"columnsFrom": [
|
|
344
243
|
"tenant_id",
|
|
345
|
-
"
|
|
244
|
+
"user_id"
|
|
346
245
|
],
|
|
347
246
|
"columnsTo": [
|
|
348
247
|
"tenant_id",
|
|
@@ -361,7 +260,17 @@
|
|
|
361
260
|
]
|
|
362
261
|
}
|
|
363
262
|
},
|
|
364
|
-
"uniqueConstraints": {
|
|
263
|
+
"uniqueConstraints": {
|
|
264
|
+
"log_tenant_id_id_user_id_unique": {
|
|
265
|
+
"name": "log_tenant_id_id_user_id_unique",
|
|
266
|
+
"nullsNotDistinct": false,
|
|
267
|
+
"columns": [
|
|
268
|
+
"tenant_id",
|
|
269
|
+
"id",
|
|
270
|
+
"user_id"
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
},
|
|
365
274
|
"policies": {},
|
|
366
275
|
"checkConstraints": {},
|
|
367
276
|
"isRLSEnabled": false
|
|
@@ -389,9 +298,9 @@
|
|
|
389
298
|
"primaryKey": false,
|
|
390
299
|
"notNull": true
|
|
391
300
|
},
|
|
392
|
-
"
|
|
393
|
-
"name": "
|
|
394
|
-
"type": "
|
|
301
|
+
"type": {
|
|
302
|
+
"name": "type",
|
|
303
|
+
"type": "text",
|
|
395
304
|
"primaryKey": false,
|
|
396
305
|
"notNull": true
|
|
397
306
|
},
|
|
@@ -442,30 +351,28 @@
|
|
|
442
351
|
},
|
|
443
352
|
"indexes": {},
|
|
444
353
|
"foreignKeys": {
|
|
445
|
-
"
|
|
446
|
-
"name": "
|
|
354
|
+
"preference_type_type_key_fk": {
|
|
355
|
+
"name": "preference_type_type_key_fk",
|
|
447
356
|
"tableFrom": "preference",
|
|
448
|
-
"tableTo": "
|
|
449
|
-
"schemaTo": "
|
|
357
|
+
"tableTo": "type",
|
|
358
|
+
"schemaTo": "notification",
|
|
450
359
|
"columnsFrom": [
|
|
451
|
-
"
|
|
452
|
-
"user_id"
|
|
360
|
+
"type"
|
|
453
361
|
],
|
|
454
362
|
"columnsTo": [
|
|
455
|
-
"
|
|
456
|
-
"id"
|
|
363
|
+
"key"
|
|
457
364
|
],
|
|
458
365
|
"onDelete": "no action",
|
|
459
366
|
"onUpdate": "no action"
|
|
460
367
|
},
|
|
461
|
-
"
|
|
462
|
-
"name": "
|
|
368
|
+
"preference_id_user_fkey": {
|
|
369
|
+
"name": "preference_id_user_fkey",
|
|
463
370
|
"tableFrom": "preference",
|
|
464
|
-
"tableTo": "
|
|
465
|
-
"schemaTo": "
|
|
371
|
+
"tableTo": "user",
|
|
372
|
+
"schemaTo": "authentication",
|
|
466
373
|
"columnsFrom": [
|
|
467
374
|
"tenant_id",
|
|
468
|
-
"
|
|
375
|
+
"user_id"
|
|
469
376
|
],
|
|
470
377
|
"columnsTo": [
|
|
471
378
|
"tenant_id",
|
|
@@ -485,13 +392,13 @@
|
|
|
485
392
|
}
|
|
486
393
|
},
|
|
487
394
|
"uniqueConstraints": {
|
|
488
|
-
"
|
|
489
|
-
"name": "
|
|
395
|
+
"preference_tenant_id_user_id_type_channel_unique": {
|
|
396
|
+
"name": "preference_tenant_id_user_id_type_channel_unique",
|
|
490
397
|
"nullsNotDistinct": false,
|
|
491
398
|
"columns": [
|
|
492
399
|
"tenant_id",
|
|
493
400
|
"user_id",
|
|
494
|
-
"
|
|
401
|
+
"type",
|
|
495
402
|
"channel"
|
|
496
403
|
]
|
|
497
404
|
}
|
|
@@ -500,6 +407,89 @@
|
|
|
500
407
|
"checkConstraints": {},
|
|
501
408
|
"isRLSEnabled": false
|
|
502
409
|
},
|
|
410
|
+
"notification.type": {
|
|
411
|
+
"name": "type",
|
|
412
|
+
"schema": "notification",
|
|
413
|
+
"columns": {
|
|
414
|
+
"id": {
|
|
415
|
+
"name": "id",
|
|
416
|
+
"type": "uuid",
|
|
417
|
+
"primaryKey": true,
|
|
418
|
+
"notNull": true,
|
|
419
|
+
"default": "gen_random_uuid()"
|
|
420
|
+
},
|
|
421
|
+
"label": {
|
|
422
|
+
"name": "label",
|
|
423
|
+
"type": "text",
|
|
424
|
+
"primaryKey": false,
|
|
425
|
+
"notNull": true
|
|
426
|
+
},
|
|
427
|
+
"key": {
|
|
428
|
+
"name": "key",
|
|
429
|
+
"type": "text",
|
|
430
|
+
"primaryKey": false,
|
|
431
|
+
"notNull": true
|
|
432
|
+
},
|
|
433
|
+
"throttling": {
|
|
434
|
+
"name": "throttling",
|
|
435
|
+
"type": "jsonb",
|
|
436
|
+
"primaryKey": false,
|
|
437
|
+
"notNull": false
|
|
438
|
+
},
|
|
439
|
+
"escalations": {
|
|
440
|
+
"name": "escalations",
|
|
441
|
+
"type": "jsonb",
|
|
442
|
+
"primaryKey": false,
|
|
443
|
+
"notNull": false
|
|
444
|
+
},
|
|
445
|
+
"revision": {
|
|
446
|
+
"name": "revision",
|
|
447
|
+
"type": "integer",
|
|
448
|
+
"primaryKey": false,
|
|
449
|
+
"notNull": true
|
|
450
|
+
},
|
|
451
|
+
"revision_timestamp": {
|
|
452
|
+
"name": "revision_timestamp",
|
|
453
|
+
"type": "timestamp with time zone",
|
|
454
|
+
"primaryKey": false,
|
|
455
|
+
"notNull": true
|
|
456
|
+
},
|
|
457
|
+
"create_timestamp": {
|
|
458
|
+
"name": "create_timestamp",
|
|
459
|
+
"type": "timestamp with time zone",
|
|
460
|
+
"primaryKey": false,
|
|
461
|
+
"notNull": true
|
|
462
|
+
},
|
|
463
|
+
"delete_timestamp": {
|
|
464
|
+
"name": "delete_timestamp",
|
|
465
|
+
"type": "timestamp with time zone",
|
|
466
|
+
"primaryKey": false,
|
|
467
|
+
"notNull": false
|
|
468
|
+
},
|
|
469
|
+
"attributes": {
|
|
470
|
+
"name": "attributes",
|
|
471
|
+
"type": "jsonb",
|
|
472
|
+
"primaryKey": false,
|
|
473
|
+
"notNull": true,
|
|
474
|
+
"default": "'{}'::jsonb"
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
"indexes": {},
|
|
478
|
+
"foreignKeys": {},
|
|
479
|
+
"compositePrimaryKeys": {},
|
|
480
|
+
"uniqueConstraints": {
|
|
481
|
+
"type_key_unique": {
|
|
482
|
+
"name": "type_key_unique",
|
|
483
|
+
"nullsNotDistinct": false,
|
|
484
|
+
"columns": [
|
|
485
|
+
"key"
|
|
486
|
+
]
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
"policies": {},
|
|
490
|
+
"checkConstraints": {},
|
|
491
|
+
"isRLSEnabled": false
|
|
492
|
+
},
|
|
503
493
|
"notification.web_push_subscription": {
|
|
504
494
|
"name": "web_push_subscription",
|
|
505
495
|
"schema": "notification",
|
|
@@ -601,7 +591,17 @@
|
|
|
601
591
|
]
|
|
602
592
|
}
|
|
603
593
|
},
|
|
604
|
-
"uniqueConstraints": {
|
|
594
|
+
"uniqueConstraints": {
|
|
595
|
+
"web_push_subscription_tenant_id_user_id_endpoint_unique": {
|
|
596
|
+
"name": "web_push_subscription_tenant_id_user_id_endpoint_unique",
|
|
597
|
+
"nullsNotDistinct": false,
|
|
598
|
+
"columns": [
|
|
599
|
+
"tenant_id",
|
|
600
|
+
"user_id",
|
|
601
|
+
"endpoint"
|
|
602
|
+
]
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
605
|
"policies": {},
|
|
606
606
|
"checkConstraints": {},
|
|
607
607
|
"isRLSEnabled": false
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Injector } from '../../injector/index.js';
|
|
2
2
|
import { type DatabaseConfig } from '../../orm/server/index.js';
|
|
3
|
+
import type { NotificationChannel } from '../models/index.js';
|
|
3
4
|
export declare class NotificationConfiguration {
|
|
4
5
|
database?: DatabaseConfig;
|
|
6
|
+
defaultChannels?: NotificationChannel[];
|
|
5
7
|
}
|
|
6
8
|
export declare function configureNotification({ injector, ...config }: NotificationConfiguration & {
|
|
7
9
|
injector?: Injector;
|
|
@@ -2,6 +2,7 @@ import { inject, Injector } from '../../injector/index.js';
|
|
|
2
2
|
import { Database, migrate } from '../../orm/server/index.js';
|
|
3
3
|
export class NotificationConfiguration {
|
|
4
4
|
database;
|
|
5
|
+
defaultChannels;
|
|
5
6
|
}
|
|
6
7
|
export function configureNotification({ injector, ...config }) {
|
|
7
8
|
const targetInjector = injector ?? Injector;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Transaction } from '../../../orm/server/index.js';
|
|
2
|
+
import type { NotificationLog } from '../../models/notification-log.model.js';
|
|
3
|
+
export declare abstract class ChannelProvider {
|
|
4
|
+
abstract send(notification: NotificationLog, tx?: Transaction): Promise<void>;
|
|
4
5
|
}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export class ChannelProvider {
|
|
2
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NotificationLog } from '../../models/index.js';
|
|
2
|
-
import
|
|
3
|
-
export declare class EmailChannelProvider
|
|
1
|
+
import type { NotificationLog } from '../../models/index.js';
|
|
2
|
+
import { ChannelProvider } from './channel-provider.js';
|
|
3
|
+
export declare class EmailChannelProvider extends ChannelProvider {
|
|
4
4
|
#private;
|
|
5
5
|
send(notification: NotificationLog): Promise<void>;
|
|
6
6
|
}
|
|
@@ -4,19 +4,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { SubjectService } from '../../../authentication/server/subject.service.js';
|
|
8
|
+
import { inject, Singleton } from '../../../injector/index.js';
|
|
8
9
|
import { MailService } from '../../../mail/mail.service.js';
|
|
9
|
-
import { User } from '../../../authentication/models/user.model.js';
|
|
10
|
-
import { injectRepository } from '../../../orm/server/index.js';
|
|
11
|
-
import { NotificationLog } from '../../models/index.js';
|
|
12
|
-
import { NotificationSingleton } from '../services/singleton.js';
|
|
13
10
|
import { NotificationTemplateService } from '../services/notification-template.service.js';
|
|
14
|
-
|
|
11
|
+
import { ChannelProvider } from './channel-provider.js';
|
|
12
|
+
let EmailChannelProvider = class EmailChannelProvider extends ChannelProvider {
|
|
15
13
|
#mailService = inject(MailService);
|
|
16
|
-
#
|
|
14
|
+
#subjectService = inject(SubjectService);
|
|
17
15
|
#templateService = inject(NotificationTemplateService);
|
|
18
16
|
async send(notification) {
|
|
19
|
-
const user = await this.#
|
|
17
|
+
const user = await this.#subjectService.getUser(notification.tenantId, notification.userId);
|
|
20
18
|
const content = await this.#templateService.render(notification, 'en'); // TODO: get user language
|
|
21
19
|
await this.#mailService.send({
|
|
22
20
|
to: user.email,
|
|
@@ -29,6 +27,6 @@ let EmailChannelProvider = class EmailChannelProvider {
|
|
|
29
27
|
}
|
|
30
28
|
};
|
|
31
29
|
EmailChannelProvider = __decorate([
|
|
32
|
-
|
|
30
|
+
Singleton()
|
|
33
31
|
], EmailChannelProvider);
|
|
34
32
|
export { EmailChannelProvider };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NotificationLog } from '../../models/index.js';
|
|
3
|
-
import
|
|
4
|
-
export declare class InAppChannelProvider extends
|
|
1
|
+
import { type Transaction } from '../../../orm/server/index.js';
|
|
2
|
+
import { type NotificationLog } from '../../models/index.js';
|
|
3
|
+
import { ChannelProvider } from './channel-provider.js';
|
|
4
|
+
export declare class InAppChannelProvider extends ChannelProvider {
|
|
5
5
|
#private;
|
|
6
|
-
send(notification: NotificationLog): Promise<void>;
|
|
6
|
+
send(notification: NotificationLog, tx?: Transaction): Promise<void>;
|
|
7
7
|
}
|
|
@@ -4,28 +4,27 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { inject } from '../../../injector/index.js';
|
|
8
|
-
import { injectRepository
|
|
9
|
-
import { InAppNotification,
|
|
10
|
-
import { NotificationSingleton } from '../services/singleton.js';
|
|
7
|
+
import { inject, Singleton } from '../../../injector/index.js';
|
|
8
|
+
import { injectRepository } from '../../../orm/server/index.js';
|
|
9
|
+
import { InAppNotification, toInAppNotificationView } from '../../models/index.js';
|
|
11
10
|
import { NotificationSseService } from '../services/notification-sse.service.js';
|
|
12
|
-
|
|
11
|
+
import { ChannelProvider } from './channel-provider.js';
|
|
12
|
+
let InAppChannelProvider = class InAppChannelProvider extends ChannelProvider {
|
|
13
13
|
#inAppRepository = injectRepository(InAppNotification);
|
|
14
14
|
#sseService = inject(NotificationSseService);
|
|
15
|
-
async send(notification) {
|
|
16
|
-
const inApp = await this.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
archivedAt: null,
|
|
23
|
-
});
|
|
15
|
+
async send(notification, tx) {
|
|
16
|
+
const inApp = await this.#inAppRepository.withOptionalTransaction(tx).insert({
|
|
17
|
+
tenantId: notification.tenantId,
|
|
18
|
+
userId: notification.userId,
|
|
19
|
+
logId: notification.id,
|
|
20
|
+
readTimestamp: null,
|
|
21
|
+
archiveTimestamp: null,
|
|
24
22
|
});
|
|
25
|
-
|
|
23
|
+
const inAppNotificationView = toInAppNotificationView(inApp, notification);
|
|
24
|
+
await this.#sseService.send(inAppNotificationView);
|
|
26
25
|
}
|
|
27
26
|
};
|
|
28
27
|
InAppChannelProvider = __decorate([
|
|
29
|
-
|
|
28
|
+
Singleton()
|
|
30
29
|
], InAppChannelProvider);
|
|
31
30
|
export { InAppChannelProvider };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type
|
|
3
|
-
|
|
1
|
+
import { type Transaction } from '../../../orm/server/index.js';
|
|
2
|
+
import { type NotificationLog } from '../../models/index.js';
|
|
3
|
+
import { ChannelProvider } from './channel-provider.js';
|
|
4
|
+
export declare class WebPushChannelProvider extends ChannelProvider {
|
|
4
5
|
#private;
|
|
5
|
-
send(notification: NotificationLog): Promise<void>;
|
|
6
|
+
send(notification: NotificationLog, tx?: Transaction): Promise<void>;
|
|
6
7
|
}
|