@marinoscar/platform-api 0.1.0-next.25 → 0.1.0-next.27
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/CHANGELOG.md +31 -0
- package/dist/identity/auth/decorators/current-user.decorator.d.ts +30 -5
- package/dist/identity/auth/decorators/current-user.decorator.d.ts.map +1 -1
- package/dist/identity/auth/decorators/current-user.decorator.js +31 -6
- package/dist/identity/auth/decorators/current-user.decorator.js.map +1 -1
- package/dist/manifest/platform-model-ownership.d.ts.map +1 -1
- package/dist/manifest/platform-model-ownership.js +19 -0
- package/dist/manifest/platform-model-ownership.js.map +1 -1
- package/dist/manifest/platform-user-owned-models.d.ts.map +1 -1
- package/dist/manifest/platform-user-owned-models.js +15 -0
- package/dist/manifest/platform-user-owned-models.js.map +1 -1
- package/dist/notifications/dto/notification.dto.d.ts +24 -2
- package/dist/notifications/dto/notification.dto.d.ts.map +1 -1
- package/dist/notifications/dto/notification.dto.js +19 -1
- package/dist/notifications/dto/notification.dto.js.map +1 -1
- package/dist/notifications/index.d.ts +3 -2
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js +9 -2
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/notification-dismissal.d.ts +49 -0
- package/dist/notifications/notification-dismissal.d.ts.map +1 -0
- package/dist/notifications/notification-dismissal.js +109 -0
- package/dist/notifications/notification-dismissal.js.map +1 -0
- package/dist/notifications/notification-store.service.d.ts +12 -0
- package/dist/notifications/notification-store.service.d.ts.map +1 -1
- package/dist/notifications/notification-store.service.js +32 -6
- package/dist/notifications/notification-store.service.js.map +1 -1
- package/dist/notifications/notification-stream.service.d.ts +42 -1
- package/dist/notifications/notification-stream.service.d.ts.map +1 -1
- package/dist/notifications/notification-stream.service.js +97 -4
- package/dist/notifications/notification-stream.service.js.map +1 -1
- package/dist/notifications/notifications.controller.d.ts +2 -1
- package/dist/notifications/notifications.controller.d.ts.map +1 -1
- package/dist/notifications/notifications.controller.js +44 -3
- package/dist/notifications/notifications.controller.js.map +1 -1
- package/dist/notifications/notifications.system-settings.d.ts +13 -0
- package/dist/notifications/notifications.system-settings.d.ts.map +1 -1
- package/dist/notifications/notifications.system-settings.js +10 -0
- package/dist/notifications/notifications.system-settings.js.map +1 -1
- package/dist/notifications/notifications.user-settings.d.ts +8 -0
- package/dist/notifications/notifications.user-settings.d.ts.map +1 -1
- package/dist/notifications/notifications.user-settings.js +11 -0
- package/dist/notifications/notifications.user-settings.js.map +1 -1
- package/dist/settings/data/settings-db.d.ts +28 -0
- package/dist/settings/data/settings-db.d.ts.map +1 -1
- package/dist/settings/index.d.ts +2 -1
- package/dist/settings/index.d.ts.map +1 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/settings/registry/system-settings-namespace.d.ts +9 -0
- package/dist/settings/registry/system-settings-namespace.d.ts.map +1 -1
- package/dist/settings/registry/system-settings-namespace.js +2 -0
- package/dist/settings/registry/system-settings-namespace.js.map +1 -1
- package/dist/settings/registry/user-settings-namespace.d.ts +9 -0
- package/dist/settings/registry/user-settings-namespace.d.ts.map +1 -1
- package/dist/settings/registry/user-settings-namespace.js +3 -0
- package/dist/settings/registry/user-settings-namespace.js.map +1 -1
- package/dist/settings/system-settings/system-settings.service.d.ts +7 -0
- package/dist/settings/system-settings/system-settings.service.d.ts.map +1 -1
- package/dist/settings/system-settings/system-settings.service.js +22 -4
- package/dist/settings/system-settings/system-settings.service.js.map +1 -1
- package/dist/settings/user-settings/user-settings.service.d.ts +9 -0
- package/dist/settings/user-settings/user-settings.service.d.ts.map +1 -1
- package/dist/settings/user-settings/user-settings.service.js +24 -4
- package/dist/settings/user-settings/user-settings.service.js.map +1 -1
- package/dist/settings/write-hooks.d.ts +53 -0
- package/dist/settings/write-hooks.d.ts.map +1 -0
- package/dist/settings/write-hooks.js +55 -0
- package/dist/settings/write-hooks.js.map +1 -0
- package/dist/storage/config/storage-config.module.d.ts.map +1 -1
- package/dist/storage/config/storage-config.module.js +10 -1
- package/dist/storage/config/storage-config.module.js.map +1 -1
- package/dist/storage/data/storage-db.d.ts +118 -1
- package/dist/storage/data/storage-db.d.ts.map +1 -1
- package/dist/storage/data/storage-db.js +25 -1
- package/dist/storage/data/storage-db.js.map +1 -1
- package/dist/storage/index.d.ts +5 -2
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +25 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/migration/copy-and-verify.d.ts +39 -0
- package/dist/storage/migration/copy-and-verify.d.ts.map +1 -0
- package/dist/storage/migration/copy-and-verify.js +94 -0
- package/dist/storage/migration/copy-and-verify.js.map +1 -0
- package/dist/storage/migration/dto/storage-migration.dto.d.ts +73 -0
- package/dist/storage/migration/dto/storage-migration.dto.d.ts.map +1 -0
- package/dist/storage/migration/dto/storage-migration.dto.js +34 -0
- package/dist/storage/migration/dto/storage-migration.dto.js.map +1 -0
- package/dist/storage/migration/index.d.ts +11 -0
- package/dist/storage/migration/index.d.ts.map +1 -0
- package/dist/storage/migration/index.js +27 -0
- package/dist/storage/migration/index.js.map +1 -0
- package/dist/storage/migration/storage-migrate-object.handler.d.ts +40 -0
- package/dist/storage/migration/storage-migrate-object.handler.d.ts.map +1 -0
- package/dist/storage/migration/storage-migrate-object.handler.js +177 -0
- package/dist/storage/migration/storage-migrate-object.handler.js.map +1 -0
- package/dist/storage/migration/storage-migrate-plan.handler.d.ts +34 -0
- package/dist/storage/migration/storage-migrate-plan.handler.d.ts.map +1 -0
- package/dist/storage/migration/storage-migrate-plan.handler.js +168 -0
- package/dist/storage/migration/storage-migrate-plan.handler.js.map +1 -0
- package/dist/storage/migration/storage-migration-settled.listener.d.ts +15 -0
- package/dist/storage/migration/storage-migration-settled.listener.d.ts.map +1 -0
- package/dist/storage/migration/storage-migration-settled.listener.js +87 -0
- package/dist/storage/migration/storage-migration-settled.listener.js.map +1 -0
- package/dist/storage/migration/storage-migration.constants.d.ts +69 -0
- package/dist/storage/migration/storage-migration.constants.d.ts.map +1 -0
- package/dist/storage/migration/storage-migration.constants.js +83 -0
- package/dist/storage/migration/storage-migration.constants.js.map +1 -0
- package/dist/storage/migration/storage-migration.controller.d.ts +26 -0
- package/dist/storage/migration/storage-migration.controller.d.ts.map +1 -0
- package/dist/storage/migration/storage-migration.controller.js +135 -0
- package/dist/storage/migration/storage-migration.controller.js.map +1 -0
- package/dist/storage/migration/storage-migration.service.d.ts +182 -0
- package/dist/storage/migration/storage-migration.service.d.ts.map +1 -0
- package/dist/storage/migration/storage-migration.service.js +444 -0
- package/dist/storage/migration/storage-migration.service.js.map +1 -0
- package/dist/storage/ports.d.ts +1 -1
- package/dist/storage/ports.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inboxDisabledEventKeys = inboxDisabledEventKeys;
|
|
4
|
+
exports.dismissibleEventKeys = dismissibleEventKeys;
|
|
5
|
+
exports.dismissEventsForUser = dismissEventsForUser;
|
|
6
|
+
exports.dismissEventsGlobally = dismissEventsGlobally;
|
|
7
|
+
const notification_events_1 = require("./notification-events");
|
|
8
|
+
const notification_preferences_1 = require("./notification-preferences");
|
|
9
|
+
// =============================================================================
|
|
10
|
+
// Dismiss-on-disable (issue #1090)
|
|
11
|
+
// =============================================================================
|
|
12
|
+
//
|
|
13
|
+
// Turning a notification event OFF means "stop showing me this", not "stop
|
|
14
|
+
// showing me this except for the eleven already there". For a STATE row it is
|
|
15
|
+
// the only way out at all: the reconcile that would drain the row to zero is
|
|
16
|
+
// now gated on the same preference, so the row would nag forever.
|
|
17
|
+
//
|
|
18
|
+
// Both functions below take the TRANSACTION CLIENT of the settings write and
|
|
19
|
+
// run inside it, so the settings change and the dismissal commit or roll back
|
|
20
|
+
// together. They are wired as the `onWrite` hooks of the `notifications`
|
|
21
|
+
// system and user settings namespaces (see `notifications.system-settings.ts`
|
|
22
|
+
// and `notifications.user-settings.ts`).
|
|
23
|
+
//
|
|
24
|
+
// RE-ENABLING DOES NOT RESTORE ANYTHING. A dismissed row stays dismissed; the
|
|
25
|
+
// producer raises a fresh one on its next occurrence.
|
|
26
|
+
//
|
|
27
|
+
// MANDATORY EVENTS ARE NEVER DISMISSED: a stored `false` for one is inert (see
|
|
28
|
+
// `isChannelEnabled`), and an audit-relevant inbox entry must outlive any
|
|
29
|
+
// toggle.
|
|
30
|
+
//
|
|
31
|
+
// Raw SQL on purpose: `updated_at` is anchored by the COUNTED rolling window
|
|
32
|
+
// and Prisma's `@updatedAt` is bypassed by raw statements, so it is set
|
|
33
|
+
// explicitly; `updateMany` would also not let one statement dismiss with
|
|
34
|
+
// `COALESCE(read_at, now())`.
|
|
35
|
+
// =============================================================================
|
|
36
|
+
/**
|
|
37
|
+
* The event keys a user has switched off for the in-app inbox (the `browser` channel), from their settings
|
|
38
|
+
* value AFTER a write: every event with a stored `false` that the resolver
|
|
39
|
+
* agrees is disabled, which excludes a mandatory event and any key the registry
|
|
40
|
+
* does not know.
|
|
41
|
+
*
|
|
42
|
+
* @param afterNamespace - the user's `notifications` namespace after the write (or `undefined`).
|
|
43
|
+
* @returns the event keys to dismiss.
|
|
44
|
+
*
|
|
45
|
+
* @stability experimental
|
|
46
|
+
*/
|
|
47
|
+
function inboxDisabledEventKeys(afterNamespace) {
|
|
48
|
+
const preferences = (0, notification_preferences_1.readNotificationPreferences)({ notifications: afterNamespace });
|
|
49
|
+
const stored = preferences.browser ?? {};
|
|
50
|
+
const keys = [];
|
|
51
|
+
for (const eventKey of Object.keys(stored)) {
|
|
52
|
+
const event = (0, notification_events_1.findEvent)(eventKey);
|
|
53
|
+
if (event && !(0, notification_preferences_1.isChannelEnabled)(event, 'browser', preferences))
|
|
54
|
+
keys.push(eventKey);
|
|
55
|
+
}
|
|
56
|
+
return keys;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The non-mandatory event keys among `eventKeys`: what an admin may suppress
|
|
60
|
+
* deployment-wide.
|
|
61
|
+
*
|
|
62
|
+
* @param eventKeys - `notifications.disabledEvents` after the write.
|
|
63
|
+
* @returns the keys whose live rows should be dismissed.
|
|
64
|
+
*
|
|
65
|
+
* @stability experimental
|
|
66
|
+
*/
|
|
67
|
+
function dismissibleEventKeys(eventKeys) {
|
|
68
|
+
return eventKeys.filter((eventKey) => (0, notification_events_1.findEvent)(eventKey)?.mandatory !== true);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Dismisses every live row of the given events for ONE user, inside `tx`.
|
|
72
|
+
*
|
|
73
|
+
* Idempotent: a row already dismissed is untouched, so repeating it (every
|
|
74
|
+
* save does) is a no-op and a stale row is healed by the next save.
|
|
75
|
+
*
|
|
76
|
+
* @param tx - the settings write's transaction client.
|
|
77
|
+
* @param userId - whose rows.
|
|
78
|
+
* @param eventKeys - the events that are now off for this user.
|
|
79
|
+
* @returns how many rows were dismissed.
|
|
80
|
+
*
|
|
81
|
+
* @stability experimental
|
|
82
|
+
*/
|
|
83
|
+
async function dismissEventsForUser(tx, userId, eventKeys) {
|
|
84
|
+
if (eventKeys.length === 0)
|
|
85
|
+
return 0;
|
|
86
|
+
return tx.$executeRaw `
|
|
87
|
+
UPDATE notifications
|
|
88
|
+
SET dismissed_at = now(), read_at = COALESCE(read_at, now()), updated_at = now()
|
|
89
|
+
WHERE user_id = ${userId}::uuid AND event_key = ANY(${[...eventKeys]}::text[]) AND dismissed_at IS NULL`;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Dismisses every live row of the given events for EVERY user, inside `tx`
|
|
93
|
+
* (an admin added them to `notifications.disabledEvents`).
|
|
94
|
+
*
|
|
95
|
+
* @param tx - the settings write's transaction client.
|
|
96
|
+
* @param eventKeys - the (non-mandatory) events now suppressed deployment-wide.
|
|
97
|
+
* @returns how many rows were dismissed.
|
|
98
|
+
*
|
|
99
|
+
* @stability experimental
|
|
100
|
+
*/
|
|
101
|
+
async function dismissEventsGlobally(tx, eventKeys) {
|
|
102
|
+
if (eventKeys.length === 0)
|
|
103
|
+
return 0;
|
|
104
|
+
return tx.$executeRaw `
|
|
105
|
+
UPDATE notifications
|
|
106
|
+
SET dismissed_at = now(), read_at = COALESCE(read_at, now()), updated_at = now()
|
|
107
|
+
WHERE event_key = ANY(${[...eventKeys]}::text[]) AND dismissed_at IS NULL`;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=notification-dismissal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-dismissal.js","sourceRoot":"","sources":["../../src/notifications/notification-dismissal.ts"],"names":[],"mappings":";;AA2CA,wDASC;AAWD,oDAEC;AAeD,oDAMC;AAYD,sDAMC;AAvGD,+DAAkD;AAClD,yEAA2F;AAE3F,gFAAgF;AAChF,mCAAmC;AACnC,gFAAgF;AAChF,EAAE;AACF,2EAA2E;AAC3E,8EAA8E;AAC9E,6EAA6E;AAC7E,kEAAkE;AAClE,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,yEAAyE;AACzE,8EAA8E;AAC9E,yCAAyC;AACzC,EAAE;AACF,8EAA8E;AAC9E,sDAAsD;AACtD,EAAE;AACF,+EAA+E;AAC/E,0EAA0E;AAC1E,UAAU;AACV,EAAE;AACF,6EAA6E;AAC7E,wEAAwE;AACxE,yEAAyE;AACzE,8BAA8B;AAC9B,gFAAgF;AAEhF;;;;;;;;;;GAUG;AACH,SAAgB,sBAAsB,CAAC,cAAuB;IAC5D,MAAM,WAAW,GAAG,IAAA,sDAA2B,EAAC,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC,CAAC;IACnF,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,IAAI,EAAE,CAAC;IACzC,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAG,IAAA,+BAAS,EAAC,QAAQ,CAAC,CAAC;QAClC,IAAI,KAAK,IAAI,CAAC,IAAA,2CAAgB,EAAC,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAC,SAA4B;IAC/D,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAA,+BAAS,EAAC,QAAQ,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC;AACjF,CAAC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,oBAAoB,CAAC,EAAmB,EAAE,MAAc,EAAE,SAA4B;IAC1G,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACrC,OAAO,EAAE,CAAC,WAAW,CAAA;;;sBAGD,MAAM,8BAA8B,CAAC,GAAG,SAAS,CAAC,oCAAoC,CAAC;AAC7G,CAAC;AAED;;;;;;;;;GASG;AACI,KAAK,UAAU,qBAAqB,CAAC,EAAmB,EAAE,SAA4B;IAC3F,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACrC,OAAO,EAAE,CAAC,WAAW,CAAA;;;4BAGK,CAAC,GAAG,SAAS,CAAC,oCAAoC,CAAC;AAC/E,CAAC"}
|
|
@@ -78,5 +78,17 @@ export declare class NotificationStoreService {
|
|
|
78
78
|
* @throws NotFoundException when the id belongs to nobody, or to somebody else.
|
|
79
79
|
*/
|
|
80
80
|
dismiss(userId: string, id: string): Promise<number>;
|
|
81
|
+
/**
|
|
82
|
+
* Dismiss every live notification of this user, optionally only those of one
|
|
83
|
+
* scope (issue #1090), and report how many were dismissed and the badge.
|
|
84
|
+
*
|
|
85
|
+
* Dismissal implies read, as for {@link dismiss}. `updated_at` is set
|
|
86
|
+
* explicitly: the raw statement bypasses Prisma's `@updatedAt`, and a COUNTED
|
|
87
|
+
* row's rolling window is anchored on it.
|
|
88
|
+
*/
|
|
89
|
+
dismissAll(userId: string, scopeId?: string): Promise<{
|
|
90
|
+
dismissed: number;
|
|
91
|
+
unreadCount: number;
|
|
92
|
+
}>;
|
|
81
93
|
}
|
|
82
94
|
//# sourceMappingURL=notification-store.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-store.service.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-store.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiC,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EAEzB,MAAM,wBAAwB,CAAC;AA4DhC;;;;GAIG;AACH,qBACa,wBAAwB;IACE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAEjF;;;;;;;;;;;;;;OAcG;IACG,IAAI,CACR,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"notification-store.service.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-store.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAiC,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EAEzB,MAAM,wBAAwB,CAAC;AA4DhC;;;;GAIG;AACH,qBACa,wBAAwB;IACE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAEjF;;;;;;;;;;;;;;OAcG;IACG,IAAI,CACR,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,wBAAwB,CAAC;IAsCpC;;;;;;;;;;OAUG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAMlD;;;;;;;;;;;;;;;;;;OAkBG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmC3D;;;;;;;;;;OAUG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYlD;;;;;;;;OAQG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAiB1D;;;;;;;OAOG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CAaxG"}
|
|
@@ -98,13 +98,19 @@ let NotificationStoreService = class NotificationStoreService {
|
|
|
98
98
|
*/
|
|
99
99
|
async list(userId, query) {
|
|
100
100
|
const { page, pageSize, unreadOnly } = query;
|
|
101
|
+
// `status` is the richer spelling; the older `unreadOnly` flag maps onto it.
|
|
102
|
+
const status = query.status ?? (unreadOnly ? 'unread' : 'all');
|
|
101
103
|
// `userId` is in the where clause, not applied afterwards. See the header.
|
|
102
|
-
// A dismissed row is "stop showing me this":
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
dismissedAt: null
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
// A dismissed row is "stop showing me this": listed only when asked for by
|
|
105
|
+
// `status=dismissed`, never by the other three (issue #1077, #1090).
|
|
106
|
+
const where = status === 'dismissed'
|
|
107
|
+
? { userId, dismissedAt: { not: null } }
|
|
108
|
+
: {
|
|
109
|
+
userId,
|
|
110
|
+
dismissedAt: null,
|
|
111
|
+
...(status === 'unread' ? { readAt: null } : {}),
|
|
112
|
+
...(status === 'read' ? { readAt: { not: null } } : {}),
|
|
113
|
+
};
|
|
108
114
|
const [items, total] = await this.prisma.$transaction([
|
|
109
115
|
this.prisma.notification.findMany({
|
|
110
116
|
where,
|
|
@@ -233,6 +239,26 @@ let NotificationStoreService = class NotificationStoreService {
|
|
|
233
239
|
}
|
|
234
240
|
return this.unreadCount(userId);
|
|
235
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Dismiss every live notification of this user, optionally only those of one
|
|
244
|
+
* scope (issue #1090), and report how many were dismissed and the badge.
|
|
245
|
+
*
|
|
246
|
+
* Dismissal implies read, as for {@link dismiss}. `updated_at` is set
|
|
247
|
+
* explicitly: the raw statement bypasses Prisma's `@updatedAt`, and a COUNTED
|
|
248
|
+
* row's rolling window is anchored on it.
|
|
249
|
+
*/
|
|
250
|
+
async dismissAll(userId, scopeId) {
|
|
251
|
+
const dismissed = scopeId
|
|
252
|
+
? await this.prisma.$executeRaw `
|
|
253
|
+
UPDATE notifications
|
|
254
|
+
SET dismissed_at = now(), read_at = COALESCE(read_at, now()), updated_at = now()
|
|
255
|
+
WHERE user_id = ${userId}::uuid AND scope_id = ${scopeId}::uuid AND dismissed_at IS NULL`
|
|
256
|
+
: await this.prisma.$executeRaw `
|
|
257
|
+
UPDATE notifications
|
|
258
|
+
SET dismissed_at = now(), read_at = COALESCE(read_at, now()), updated_at = now()
|
|
259
|
+
WHERE user_id = ${userId}::uuid AND dismissed_at IS NULL`;
|
|
260
|
+
return { dismissed, unreadCount: await this.unreadCount(userId) };
|
|
261
|
+
}
|
|
236
262
|
};
|
|
237
263
|
exports.NotificationStoreService = NotificationStoreService;
|
|
238
264
|
exports.NotificationStoreService = NotificationStoreService = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-store.service.js","sourceRoot":"","sources":["../../src/notifications/notification-store.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AAEvE,yCAAgD;AAQhD,gFAAgF;AAChF,wEAAwE;AACxE,0BAA0B;AAC1B,gFAAgF;AAChF,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC9E,QAAQ;AACR,EAAE;AACF,gFAAgF;AAChF,mEAAmE;AACnE,gFAAgF;AAChF,EAAE;AACF,2EAA2E;AAC3E,UAAU;AACV,EAAE;AACF,8EAA8E;AAC9E,+DAA+D;AAC/D,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,yEAAyE;AACzE,+EAA+E;AAC/E,4EAA4E;AAC5E,4DAA4D;AAC5D,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,6EAA6E;AAC7E,+EAA+E;AAC/E,6EAA6E;AAC7E,0EAA0E;AAC1E,uCAAuC;AACvC,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,mBAAmB,GAAG;IAC1B,EAAE,EAAE,IAAI;IACR,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,MAAM,EAAE,IAAI;IACZ,SAAS,EAAE,IAAI;IACf,IAAI,EAAE,IAAI;IACV,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;CACP,CAAC;AAEX;;;;GAIG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACmB;IAAtD,YAAsD,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;IAAG,CAAC;IAErF;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,IAAI,CACR,MAAc,EACd,KAA+B;QAE/B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"notification-store.service.js","sourceRoot":"","sources":["../../src/notifications/notification-store.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AAEvE,yCAAgD;AAQhD,gFAAgF;AAChF,wEAAwE;AACxE,0BAA0B;AAC1B,gFAAgF;AAChF,EAAE;AACF,6EAA6E;AAC7E,8EAA8E;AAC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,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI;QACpD,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE;QACtC,KAAK,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;QAC/C,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI;QACnE,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE;KACvC,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type OnModuleDestroy, type OnModuleInit } from '@nestjs/common';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { type NotificationSyncReason } from '@marinoscar/platform-contract/notifications';
|
|
3
4
|
import { NOTIFICATION_STREAM_BUS_CHANNEL, type NotificationsEventBus } from './ports';
|
|
4
5
|
import type { NotificationsPrisma } from './data/notifications-db';
|
|
5
6
|
/**
|
|
@@ -97,6 +98,14 @@ export interface NotificationStreamEvent {
|
|
|
97
98
|
* @stability experimental
|
|
98
99
|
*/
|
|
99
100
|
export declare const NOTIFICATION_SSE_EVENT = "notification";
|
|
101
|
+
/**
|
|
102
|
+
* SSE `event:` name of a `sync` frame (issue #1090): the user read, dismissed or
|
|
103
|
+
* deleted rows in one tab, so their other tabs refetch the list and the unread
|
|
104
|
+
* count. The frame's `data` is `{ reason }`; it carries no row.
|
|
105
|
+
*
|
|
106
|
+
* @stability experimental
|
|
107
|
+
*/
|
|
108
|
+
export declare const NOTIFICATION_SSE_SYNC_EVENT = "sync";
|
|
100
109
|
/**
|
|
101
110
|
* How often an idle connection is sent a comment line.
|
|
102
111
|
*
|
|
@@ -148,7 +157,7 @@ export { NOTIFICATION_STREAM_BUS_CHANNEL };
|
|
|
148
157
|
*
|
|
149
158
|
* @stability experimental
|
|
150
159
|
*/
|
|
151
|
-
export type NotificationStreamBusMessage = NotificationStreamInlineMessage | NotificationStreamRefMessage;
|
|
160
|
+
export type NotificationStreamBusMessage = NotificationStreamInlineMessage | NotificationStreamRefMessage | NotificationStreamSyncMessage;
|
|
152
161
|
/**
|
|
153
162
|
* A bus message carrying the whole frame.
|
|
154
163
|
*
|
|
@@ -177,8 +186,24 @@ export interface NotificationStreamRefMessage {
|
|
|
177
186
|
toast: boolean;
|
|
178
187
|
/** Whether this dispatch also sent Web Push. */
|
|
179
188
|
pushed: boolean;
|
|
189
|
+
/** Why the frame was sent (issue #1090: preserved on the by-reference path). */
|
|
190
|
+
reason?: NotificationStreamEvent['reason'];
|
|
180
191
|
};
|
|
181
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* A bus message telling the user's tabs on other replicas to refetch (issue
|
|
195
|
+
* #1090): the `sync` frame. Carries no row.
|
|
196
|
+
*
|
|
197
|
+
* @stability experimental
|
|
198
|
+
*/
|
|
199
|
+
export interface NotificationStreamSyncMessage {
|
|
200
|
+
/** The user whose tabs refetch. */
|
|
201
|
+
userId: string;
|
|
202
|
+
/** Always `true`; the discriminator against the two row-carrying shapes. */
|
|
203
|
+
sync: true;
|
|
204
|
+
/** Why it was sent. */
|
|
205
|
+
reason: NotificationSyncReason;
|
|
206
|
+
}
|
|
182
207
|
/**
|
|
183
208
|
* Validates a message received from the bus, or returns `null`.
|
|
184
209
|
*
|
|
@@ -256,6 +281,20 @@ export declare class NotificationStreamService implements OnModuleInit, OnModule
|
|
|
256
281
|
* it, and other replicas' deliveries are not (cannot be) counted.
|
|
257
282
|
*/
|
|
258
283
|
publish(userId: string, event: NotificationStreamEvent): number;
|
|
284
|
+
/**
|
|
285
|
+
* Tell every tab this user has open, on every replica, to refetch the list
|
|
286
|
+
* and the unread count (the `sync` frame, issue #1090).
|
|
287
|
+
*
|
|
288
|
+
* Sent after the user reads, dismisses or deletes rows: their OTHER tabs hold
|
|
289
|
+
* a stale list, and the table (not a frame) is the truth, so the frame
|
|
290
|
+
* carries no row and the response to it is the same refetch a reconnect does.
|
|
291
|
+
* Never throws, like {@link publish}.
|
|
292
|
+
*
|
|
293
|
+
* @param userId - the AUTHENTICATED principal's id.
|
|
294
|
+
* @param reason - why; informational.
|
|
295
|
+
* @returns how many connections on THIS replica it was written to.
|
|
296
|
+
*/
|
|
297
|
+
publishSync(userId: string, reason: NotificationSyncReason): number;
|
|
259
298
|
/**
|
|
260
299
|
* The full event when it fits in a bus envelope, a reference when it does
|
|
261
300
|
* not. See "OVERSIZE EVENTS TRAVEL BY REFERENCE" in the header.
|
|
@@ -284,6 +323,8 @@ export declare class NotificationStreamService implements OnModuleInit, OnModule
|
|
|
284
323
|
* of `publish`, and still the only code that touches a connection.
|
|
285
324
|
*/
|
|
286
325
|
private deliverLocal;
|
|
326
|
+
/** Writes one `sync` frame into ONE user's bucket on THIS replica. */
|
|
327
|
+
private deliverSyncLocal;
|
|
287
328
|
/**
|
|
288
329
|
* Number of open connections for a user. Diagnostics and tests only.
|
|
289
330
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-stream.service.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-stream.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAmB,MAAM,MAAM,CAAC;AAEnD,OAAO,EAEL,+BAA+B,EAE/B,KAAK,qBAAqB,EAE3B,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAmGnE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,gCAAgC;IAChC,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;;;;;;;;;;;OAYG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB,4FAA4F;IAC5F,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,+BAA+B;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,MAAM,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;CACjD;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,sBAAsB,iBAAiB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAQ5C;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,gEAAgE;AAChE,OAAO,EAAE,+BAA+B,EAAE,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"notification-stream.service.d.ts","sourceRoot":"","sources":["../../src/notifications/notification-stream.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAmB,MAAM,MAAM,CAAC;AAEnD,OAAO,EAGL,KAAK,sBAAsB,EA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AE6D,GAAG,CAAC,EAAE,qBAAqB,YAAA,EACnC,MAAM,CAAC,EAAE,mBAAmB,YAAA;IAGpF,4EAA4E;IAC5E,YAAY,IAAI,IAAI;IASpB;;;;;;;;OAQG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkD;IAE9E;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC;IAwEjD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB,GAAG,MAAM;IAY/D;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,GAAG,MAAM;IASnE;;;OAGG;IACH,OAAO,CAAC,aAAa;IAerB;;;OAGG;IACH;;;OAGG;IACH,OAAO,CAAC,kBAAkB;YASZ,YAAY;IA0B1B;;;;;;OAMG;YACW,gBAAgB;IAoD9B;;;OAGG;IACH,OAAO,CAAC,YAAY;IA0BpB,sEAAsE;IACtE,OAAO,CAAC,gBAAgB;IAkBxB;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAIvC;;;;;;;;;;;;OAYG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAsBvC"}
|
|
@@ -13,10 +13,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
var NotificationStreamService_1;
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.NotificationStreamService = exports.NOTIFICATION_STREAM_BUS_CHANNEL = exports.HEARTBEAT_INTERVAL_MS = exports.NOTIFICATION_SSE_EVENT = void 0;
|
|
16
|
+
exports.NotificationStreamService = exports.NOTIFICATION_STREAM_BUS_CHANNEL = exports.HEARTBEAT_INTERVAL_MS = exports.NOTIFICATION_SSE_SYNC_EVENT = exports.NOTIFICATION_SSE_EVENT = void 0;
|
|
17
17
|
exports.parseNotificationStreamBusMessage = parseNotificationStreamBusMessage;
|
|
18
18
|
const common_1 = require("@nestjs/common");
|
|
19
19
|
const rxjs_1 = require("rxjs");
|
|
20
|
+
const notifications_1 = require("@marinoscar/platform-contract/notifications");
|
|
20
21
|
const ports_1 = require("./ports");
|
|
21
22
|
Object.defineProperty(exports, "NOTIFICATION_STREAM_BUS_CHANNEL", { enumerable: true, get: function () { return ports_1.NOTIFICATION_STREAM_BUS_CHANNEL; } });
|
|
22
23
|
const index_1 = require("../core/index");
|
|
@@ -32,6 +33,14 @@ const index_1 = require("../core/index");
|
|
|
32
33
|
* @stability experimental
|
|
33
34
|
*/
|
|
34
35
|
exports.NOTIFICATION_SSE_EVENT = 'notification';
|
|
36
|
+
/**
|
|
37
|
+
* SSE `event:` name of a `sync` frame (issue #1090): the user read, dismissed or
|
|
38
|
+
* deleted rows in one tab, so their other tabs refetch the list and the unread
|
|
39
|
+
* count. The frame's `data` is `{ reason }`; it carries no row.
|
|
40
|
+
*
|
|
41
|
+
* @stability experimental
|
|
42
|
+
*/
|
|
43
|
+
exports.NOTIFICATION_SSE_SYNC_EVENT = 'sync';
|
|
35
44
|
/**
|
|
36
45
|
* How often an idle connection is sent a comment line.
|
|
37
46
|
*
|
|
@@ -65,6 +74,12 @@ const HEARTBEAT_COMMENT = 'heartbeat';
|
|
|
65
74
|
function isNonEmptyString(value) {
|
|
66
75
|
return typeof value === 'string' && value !== '';
|
|
67
76
|
}
|
|
77
|
+
function isSyncReason(value) {
|
|
78
|
+
return typeof value === 'string' && notifications_1.NOTIFICATION_SYNC_REASONS.includes(value);
|
|
79
|
+
}
|
|
80
|
+
function isStreamReason(value) {
|
|
81
|
+
return typeof value === 'string' && notifications_1.NOTIFICATION_STREAM_REASONS.includes(value);
|
|
82
|
+
}
|
|
68
83
|
function isStreamEvent(value) {
|
|
69
84
|
if (typeof value !== 'object' || value === null)
|
|
70
85
|
return false;
|
|
@@ -93,6 +108,11 @@ function parseNotificationStreamBusMessage(raw) {
|
|
|
93
108
|
const message = raw;
|
|
94
109
|
if (!isNonEmptyString(message.userId))
|
|
95
110
|
return null;
|
|
111
|
+
if ('sync' in message) {
|
|
112
|
+
return message.sync === true && isSyncReason(message.reason)
|
|
113
|
+
? { userId: message.userId, sync: true, reason: message.reason }
|
|
114
|
+
: null;
|
|
115
|
+
}
|
|
96
116
|
if ('event' in message) {
|
|
97
117
|
return isStreamEvent(message.event) ? { userId: message.userId, event: message.event } : null;
|
|
98
118
|
}
|
|
@@ -104,7 +124,12 @@ function parseNotificationStreamBusMessage(raw) {
|
|
|
104
124
|
typeof ref.pushed === 'boolean') {
|
|
105
125
|
return {
|
|
106
126
|
userId: message.userId,
|
|
107
|
-
ref: {
|
|
127
|
+
ref: {
|
|
128
|
+
notificationId: ref.notificationId,
|
|
129
|
+
toast: ref.toast,
|
|
130
|
+
pushed: ref.pushed,
|
|
131
|
+
...(isStreamReason(ref.reason) ? { reason: ref.reason } : {}),
|
|
132
|
+
},
|
|
108
133
|
};
|
|
109
134
|
}
|
|
110
135
|
return null;
|
|
@@ -253,6 +278,27 @@ let NotificationStreamService = NotificationStreamService_1 = class Notification
|
|
|
253
278
|
}
|
|
254
279
|
return delivered;
|
|
255
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Tell every tab this user has open, on every replica, to refetch the list
|
|
283
|
+
* and the unread count (the `sync` frame, issue #1090).
|
|
284
|
+
*
|
|
285
|
+
* Sent after the user reads, dismisses or deletes rows: their OTHER tabs hold
|
|
286
|
+
* a stale list, and the table (not a frame) is the truth, so the frame
|
|
287
|
+
* carries no row and the response to it is the same refetch a reconnect does.
|
|
288
|
+
* Never throws, like {@link publish}.
|
|
289
|
+
*
|
|
290
|
+
* @param userId - the AUTHENTICATED principal's id.
|
|
291
|
+
* @param reason - why; informational.
|
|
292
|
+
* @returns how many connections on THIS replica it was written to.
|
|
293
|
+
*/
|
|
294
|
+
publishSync(userId, reason) {
|
|
295
|
+
const delivered = this.deliverSyncLocal(userId, reason);
|
|
296
|
+
if (this.bus) {
|
|
297
|
+
const message = { userId, sync: true, reason };
|
|
298
|
+
void this.bus.publish(ports_1.NOTIFICATION_STREAM_BUS_CHANNEL, message);
|
|
299
|
+
}
|
|
300
|
+
return delivered;
|
|
301
|
+
}
|
|
256
302
|
/**
|
|
257
303
|
* The full event when it fits in a bus envelope, a reference when it does
|
|
258
304
|
* not. See "OVERSIZE EVENTS TRAVEL BY REFERENCE" in the header.
|
|
@@ -261,7 +307,15 @@ let NotificationStreamService = NotificationStreamService_1 = class Notification
|
|
|
261
307
|
const full = { userId, event };
|
|
262
308
|
if (!this.exceedsInlineLimit(full))
|
|
263
309
|
return full;
|
|
264
|
-
return {
|
|
310
|
+
return {
|
|
311
|
+
userId,
|
|
312
|
+
ref: {
|
|
313
|
+
notificationId: event.id,
|
|
314
|
+
toast: event.toast,
|
|
315
|
+
pushed: event.pushed,
|
|
316
|
+
...(event.reason ? { reason: event.reason } : {}),
|
|
317
|
+
},
|
|
318
|
+
};
|
|
265
319
|
}
|
|
266
320
|
/**
|
|
267
321
|
* Another replica's event. Our own (`meta.local`) was already delivered by
|
|
@@ -289,6 +343,10 @@ let NotificationStreamService = NotificationStreamService_1 = class Notification
|
|
|
289
343
|
this.logger.warn(`Dropping a malformed "${ports_1.NOTIFICATION_STREAM_BUS_CHANNEL}" message from the event bus.`);
|
|
290
344
|
return;
|
|
291
345
|
}
|
|
346
|
+
if ('sync' in message) {
|
|
347
|
+
this.deliverSyncLocal(message.userId, message.reason);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
292
350
|
if ('event' in message) {
|
|
293
351
|
this.deliverLocal(message.userId, message.event);
|
|
294
352
|
return;
|
|
@@ -313,10 +371,24 @@ let NotificationStreamService = NotificationStreamService_1 = class Notification
|
|
|
313
371
|
try {
|
|
314
372
|
const row = await this.prisma.notification.findFirst({
|
|
315
373
|
where: { id: ref.notificationId, userId },
|
|
316
|
-
select: {
|
|
374
|
+
select: {
|
|
375
|
+
id: true,
|
|
376
|
+
eventKey: true,
|
|
377
|
+
title: true,
|
|
378
|
+
body: true,
|
|
379
|
+
link: true,
|
|
380
|
+
createdAt: true,
|
|
381
|
+
updatedAt: true,
|
|
382
|
+
scopeId: true,
|
|
383
|
+
data: true,
|
|
384
|
+
},
|
|
317
385
|
});
|
|
318
386
|
if (!row)
|
|
319
387
|
return null;
|
|
388
|
+
// The by-reference path rebuilds the SAME frame the inline path would
|
|
389
|
+
// have carried (issue #1090): `count`, `scopeId` and `updatedAt` come
|
|
390
|
+
// from the row, `reason` from the reference.
|
|
391
|
+
const count = row.data?.count;
|
|
320
392
|
return {
|
|
321
393
|
id: row.id,
|
|
322
394
|
eventKey: row.eventKey,
|
|
@@ -326,6 +398,10 @@ let NotificationStreamService = NotificationStreamService_1 = class Notification
|
|
|
326
398
|
createdAt: row.createdAt.toISOString(),
|
|
327
399
|
toast: ref.toast,
|
|
328
400
|
pushed: ref.pushed,
|
|
401
|
+
...(typeof count === 'number' ? { count } : {}),
|
|
402
|
+
...(row.scopeId ? { scopeId: row.scopeId } : {}),
|
|
403
|
+
...(row.updatedAt ? { updatedAt: row.updatedAt.toISOString() } : {}),
|
|
404
|
+
...(ref.reason ? { reason: ref.reason } : {}),
|
|
329
405
|
};
|
|
330
406
|
}
|
|
331
407
|
catch (err) {
|
|
@@ -357,6 +433,23 @@ let NotificationStreamService = NotificationStreamService_1 = class Notification
|
|
|
357
433
|
}
|
|
358
434
|
return delivered;
|
|
359
435
|
}
|
|
436
|
+
/** Writes one `sync` frame into ONE user's bucket on THIS replica. */
|
|
437
|
+
deliverSyncLocal(userId, reason) {
|
|
438
|
+
const bucket = this.subscribers.get(userId);
|
|
439
|
+
if (!bucket || bucket.size === 0)
|
|
440
|
+
return 0;
|
|
441
|
+
let delivered = 0;
|
|
442
|
+
for (const observer of bucket) {
|
|
443
|
+
try {
|
|
444
|
+
observer.next({ type: exports.NOTIFICATION_SSE_SYNC_EVENT, data: { reason } });
|
|
445
|
+
delivered += 1;
|
|
446
|
+
}
|
|
447
|
+
catch (err) {
|
|
448
|
+
this.logger.debug(`Dropping a sync write for user ${userId}: ${err instanceof Error ? err.message : 'unknown error'}`);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return delivered;
|
|
452
|
+
}
|
|
360
453
|
/**
|
|
361
454
|
* Number of open connections for a user. Diagnostics and tests only.
|
|
362
455
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-stream.service.js","sourceRoot":"","sources":["../../src/notifications/notification-stream.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmVA,8EAwBC;AA3WD,2CAOwB;AACxB,+BAAmD;AAEnD,mCAMiB;AA4PR,gHAhQP,uCAA+B,OAgQO;AA3PxC,yCAAgD;AA2LhD;;;;;;;;;;GAUG;AACU,QAAA,sBAAsB,GAAG,cAAc,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACU,QAAA,qBAAqB,GAAG,MAAM,CAAC;AAE5C;;;GAGG;AACH,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAgEtC,SAAS,gBAAgB,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,OAAO,CACL,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ;QAC9B,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ;QAC3B,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;QAC1B,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,IAA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;IACnB,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,MAAc;QAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,eAAe;QACnB,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAE3B,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO;QAExC,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,+BAA+B,IAAI,CAAC,WAAW,CAAC,IAAI,uBAAuB,CAC5E,CAAC;QAEF,yEAAyE;QACzE,oEAAoE;QACpE,uEAAuE;QACvE,uCAAuC;QACvC,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;YACpD,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC;gBACnC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACF,CAAA;AA/TY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;IAcR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,+BAAuB,CAAC,CAAA;IAC3C,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,uBAAe,CAAC,CAAA;;GAd3B,yBAAyB,CA+TrC"}
|
|
1
|
+
{"version":3,"file":"notification-stream.service.js","sourceRoot":"","sources":["../../src/notifications/notification-stream.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8XA,8EAmCC;AAjaD,2CAOwB;AACxB,+BAAmD;AAEnD,+E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C,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,eAAe;QACnB,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QACxB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAE3B,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC;YAAE,OAAO;QAExC,IAAI,CAAC,MAAM,CAAC,GAAG,CACb,+BAA+B,IAAI,CAAC,WAAW,CAAC,IAAI,uBAAuB,CAC5E,CAAC;QAEF,yEAAyE;QACzE,oEAAoE;QACpE,uEAAuE;QACvE,uCAAuC;QACvC,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;YACpD,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,MAAM,CAAC,EAAE,CAAC;gBACnC,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC3B,CAAC;CACF,CAAA;AAvYY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;IAcR,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,+BAAuB,CAAC,CAAA;IAC3C,WAAA,IAAA,iBAAQ,GAAE,CAAA;IAAE,WAAA,IAAA,eAAM,EAAC,uBAAe,CAAC,CAAA;;GAd3B,yBAAyB,CAuYrC"}
|
|
@@ -7,7 +7,7 @@ import { NotificationStoreService } from './notification-store.service';
|
|
|
7
7
|
import { PushSubscriptionService } from './push-subscription.service';
|
|
8
8
|
import { type NotificationConfigResponse } from './dto/notification-config.dto';
|
|
9
9
|
import { type NotificationEventResponse } from './dto/notification-event.dto';
|
|
10
|
-
import { NotificationListQueryDto, type NotificationListResponse, type UnreadCountResponse } from './dto/notification.dto';
|
|
10
|
+
import { NotificationListQueryDto, type DismissAllResult, type NotificationListResponse, type UnreadCountResponse } from './dto/notification.dto';
|
|
11
11
|
import { PushSubscribeDto, PushUnsubscribeDto, type PushSubscriptionResponse } from './dto/push-subscription.dto';
|
|
12
12
|
/**
|
|
13
13
|
* Exported for an app's own unit tests (`@marinoscar/platform-api/notifications/testing`); not an extension point: reach it through `NotificationsModule` and its documented seams.
|
|
@@ -127,6 +127,7 @@ export declare class NotificationsController {
|
|
|
127
127
|
markRead(userId: string, id: string): Promise<UnreadCountResponse>;
|
|
128
128
|
dismiss(userId: string, id: string): Promise<UnreadCountResponse>;
|
|
129
129
|
markAllRead(userId: string): Promise<UnreadCountResponse>;
|
|
130
|
+
dismissAll(userId: string, body?: unknown): Promise<DismissAllResult>;
|
|
130
131
|
subscribePush(userId: string, dto: PushSubscribeDto, userAgent: string | undefined): Promise<PushSubscriptionResponse>;
|
|
131
132
|
/**
|
|
132
133
|
* `DELETE` with a JSON body — unusual in this codebase's other `DELETE`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.controller.d.ts","sourceRoot":"","sources":["../../src/notifications/notifications.controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notifications.controller.d.ts","sourceRoot":"","sources":["../../src/notifications/notifications.controller.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGvC,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIxE,OAAO,EAAoC,KAAK,qCAAqC,EAAE,MAAM,gCAAgC,CAAC;AAE9H,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACL,yBAAyB,EACzB,KAAK,UAAU,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,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