@marinoscar/platform-api 0.1.0-next.21 → 0.1.0-next.23
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 +28 -0
- package/dist/ai/features/ai-feature.registry.d.ts +7 -0
- package/dist/ai/features/ai-feature.registry.d.ts.map +1 -1
- package/dist/ai/features/ai-feature.registry.js +3 -0
- package/dist/ai/features/ai-feature.registry.js.map +1 -1
- package/dist/ai/keys/ai-key-resolver.service.d.ts +16 -0
- package/dist/ai/keys/ai-key-resolver.service.d.ts.map +1 -1
- package/dist/ai/keys/ai-key-resolver.service.js +44 -0
- package/dist/ai/keys/ai-key-resolver.service.js.map +1 -1
- package/dist/ai/keys/usable-models.service.d.ts +13 -1
- package/dist/ai/keys/usable-models.service.d.ts.map +1 -1
- package/dist/ai/keys/usable-models.service.js +37 -12
- package/dist/ai/keys/usable-models.service.js.map +1 -1
- package/dist/ai/runtime/ai-limits.service.d.ts +2 -1
- package/dist/ai/runtime/ai-limits.service.d.ts.map +1 -1
- package/dist/ai/runtime/ai-limits.service.js +7 -2
- package/dist/ai/runtime/ai-limits.service.js.map +1 -1
- package/dist/ai/runtime/ai-runtime.types.d.ts +46 -1
- package/dist/ai/runtime/ai-runtime.types.d.ts.map +1 -1
- package/dist/ai/runtime/ai-runtime.types.js.map +1 -1
- package/dist/ai/runtime/ai.service.d.ts +142 -5
- package/dist/ai/runtime/ai.service.d.ts.map +1 -1
- package/dist/ai/runtime/ai.service.js +353 -46
- package/dist/ai/runtime/ai.service.js.map +1 -1
- package/dist/ai/runtime/index.d.ts +1 -1
- package/dist/ai/runtime/index.d.ts.map +1 -1
- package/dist/ai/runtime/target-resolver.d.ts +2 -2
- package/dist/ai/runtime/target-resolver.d.ts.map +1 -1
- package/dist/ai/runtime/target-resolver.js +2 -1
- package/dist/ai/runtime/target-resolver.js.map +1 -1
- package/dist/ai/testing/conformance/ai-key-policy.suite.d.ts.map +1 -1
- package/dist/ai/testing/conformance/ai-key-policy.suite.js +54 -0
- package/dist/ai/testing/conformance/ai-key-policy.suite.js.map +1 -1
- package/dist/ai/testing/conformance/ai-secret-egress.suite.d.ts.map +1 -1
- package/dist/ai/testing/conformance/ai-secret-egress.suite.js +59 -0
- package/dist/ai/testing/conformance/ai-secret-egress.suite.js.map +1 -1
- package/dist/identity/device-auth/device-auth.service.d.ts +9 -2
- package/dist/identity/device-auth/device-auth.service.d.ts.map +1 -1
- package/dist/identity/device-auth/device-auth.service.js +44 -4
- package/dist/identity/device-auth/device-auth.service.js.map +1 -1
- package/dist/identity/device-auth/dto/device-code-request.dto.d.ts +12 -0
- package/dist/identity/device-auth/dto/device-code-request.dto.d.ts.map +1 -1
- package/dist/identity/identity.options.d.ts +25 -0
- package/dist/identity/identity.options.d.ts.map +1 -1
- package/dist/identity/identity.options.js +11 -0
- package/dist/identity/identity.options.js.map +1 -1
- package/dist/identity/index.d.ts +1 -1
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/nodes/current-node.decorator.d.ts +18 -0
- package/dist/nodes/current-node.decorator.d.ts.map +1 -0
- package/dist/nodes/current-node.decorator.js +28 -0
- package/dist/nodes/current-node.decorator.js.map +1 -0
- package/dist/nodes/index.d.ts +8 -0
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +21 -2
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/node-ownership.d.ts +34 -0
- package/dist/nodes/node-ownership.d.ts.map +1 -0
- package/dist/nodes/node-ownership.js +92 -0
- package/dist/nodes/node-ownership.js.map +1 -0
- package/dist/nodes/node-route.decorator.d.ts +31 -0
- package/dist/nodes/node-route.decorator.d.ts.map +1 -0
- package/dist/nodes/node-route.decorator.js +54 -0
- package/dist/nodes/node-route.decorator.js.map +1 -0
- package/dist/nodes/node-route.guard.d.ts +22 -0
- package/dist/nodes/node-route.guard.d.ts.map +1 -0
- package/dist/nodes/node-route.guard.js +74 -0
- package/dist/nodes/node-route.guard.js.map +1 -0
- package/dist/nodes/node-route.module.d.ts +21 -0
- package/dist/nodes/node-route.module.d.ts.map +1 -0
- package/dist/nodes/node-route.module.js +99 -0
- package/dist/nodes/node-route.module.js.map +1 -0
- package/dist/nodes/node-route.options.d.ts +59 -0
- package/dist/nodes/node-route.options.d.ts.map +1 -0
- package/dist/nodes/node-route.options.js +29 -0
- package/dist/nodes/node-route.options.js.map +1 -0
- package/dist/nodes/node-route.paths.d.ts +47 -0
- package/dist/nodes/node-route.paths.d.ts.map +1 -0
- package/dist/nodes/node-route.paths.js +129 -0
- package/dist/nodes/node-route.paths.js.map +1 -0
- package/dist/nodes/nodes.service.d.ts.map +1 -1
- package/dist/nodes/nodes.service.js +3 -15
- package/dist/nodes/nodes.service.js.map +1 -1
- package/dist/nodes/testing/conformance.d.ts +86 -0
- package/dist/nodes/testing/conformance.d.ts.map +1 -0
- package/dist/nodes/testing/conformance.js +230 -0
- package/dist/nodes/testing/conformance.js.map +1 -0
- package/dist/nodes/testing/discover.d.ts +13 -0
- package/dist/nodes/testing/discover.d.ts.map +1 -0
- package/dist/nodes/testing/discover.js +42 -0
- package/dist/nodes/testing/discover.js.map +1 -0
- package/dist/nodes/testing/index.d.ts +3 -0
- package/dist/nodes/testing/index.d.ts.map +1 -0
- package/dist/nodes/testing/index.js +13 -0
- package/dist/nodes/testing/index.js.map +1 -0
- package/dist/notifications/channels/browser-notification.channel.d.ts +11 -0
- package/dist/notifications/channels/browser-notification.channel.d.ts.map +1 -1
- package/dist/notifications/channels/browser-notification.channel.js +71 -48
- package/dist/notifications/channels/browser-notification.channel.js.map +1 -1
- package/dist/notifications/data/notifications-db.d.ts +19 -0
- package/dist/notifications/data/notifications-db.d.ts.map +1 -1
- package/dist/notifications/dto/notification.dto.d.ts +4 -0
- package/dist/notifications/dto/notification.dto.d.ts.map +1 -1
- package/dist/notifications/index.d.ts +1 -1
- package/dist/notifications/index.d.ts.map +1 -1
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications/notification-inbox-writer.d.ts +112 -0
- package/dist/notifications/notification-inbox-writer.d.ts.map +1 -0
- package/dist/notifications/notification-inbox-writer.js +217 -0
- package/dist/notifications/notification-inbox-writer.js.map +1 -0
- package/dist/notifications/notification-store.service.d.ts +10 -0
- package/dist/notifications/notification-store.service.d.ts.map +1 -1
- package/dist/notifications/notification-store.service.js +55 -10
- package/dist/notifications/notification-store.service.js.map +1 -1
- package/dist/notifications/notification-stream.service.d.ts +8 -0
- package/dist/notifications/notification-stream.service.d.ts.map +1 -1
- package/dist/notifications/notification-stream.service.js.map +1 -1
- package/dist/notifications/notification.types.d.ts +74 -0
- package/dist/notifications/notification.types.d.ts.map +1 -1
- package/dist/notifications/notification.types.js.map +1 -1
- package/dist/notifications/notifications.controller.d.ts +1 -0
- package/dist/notifications/notifications.controller.d.ts.map +1 -1
- package/dist/notifications/notifications.controller.js +23 -0
- package/dist/notifications/notifications.controller.js.map +1 -1
- package/dist/notifications/notifications.service.d.ts +56 -1
- package/dist/notifications/notifications.service.d.ts.map +1 -1
- package/dist/notifications/notifications.service.js +122 -0
- package/dist/notifications/notifications.service.js.map +1 -1
- package/dist/notifications/registry/event.registry.d.ts +15 -0
- package/dist/notifications/registry/event.registry.d.ts.map +1 -1
- package/dist/notifications/registry/event.registry.js +3 -0
- package/dist/notifications/registry/event.registry.js.map +1 -1
- package/dist/notifications/retention/notification-inbox-purge.handler.d.ts.map +1 -1
- package/dist/notifications/retention/notification-inbox-purge.handler.js +16 -4
- package/dist/notifications/retention/notification-inbox-purge.handler.js.map +1 -1
- package/dist/notifications/testing/index.d.ts +2 -0
- package/dist/notifications/testing/index.d.ts.map +1 -1
- package/dist/notifications/testing/index.js +5 -1
- package/dist/notifications/testing/index.js.map +1 -1
- package/dist/storage/config/storage-config.service.d.ts +24 -0
- package/dist/storage/config/storage-config.service.d.ts.map +1 -1
- package/dist/storage/config/storage-config.service.js +31 -5
- package/dist/storage/config/storage-config.service.js.map +1 -1
- package/dist/storage/handlers/storage-cleanup.handler.d.ts +3 -1
- package/dist/storage/handlers/storage-cleanup.handler.d.ts.map +1 -1
- package/dist/storage/handlers/storage-cleanup.handler.js +10 -3
- package/dist/storage/handlers/storage-cleanup.handler.js.map +1 -1
- package/dist/storage/index.d.ts +5 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +12 -3
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/objects/dto/get-part-urls.dto.d.ts +26 -0
- package/dist/storage/objects/dto/get-part-urls.dto.d.ts.map +1 -0
- package/dist/storage/objects/dto/get-part-urls.dto.js +25 -0
- package/dist/storage/objects/dto/get-part-urls.dto.js.map +1 -0
- package/dist/storage/objects/dto/init-upload.dto.d.ts +2 -1
- package/dist/storage/objects/dto/init-upload.dto.d.ts.map +1 -1
- package/dist/storage/objects/objects.controller.d.ts +13 -1
- package/dist/storage/objects/objects.controller.d.ts.map +1 -1
- package/dist/storage/objects/objects.controller.js +88 -1
- package/dist/storage/objects/objects.controller.js.map +1 -1
- package/dist/storage/objects/objects.service.d.ts +46 -1
- package/dist/storage/objects/objects.service.d.ts.map +1 -1
- package/dist/storage/objects/objects.service.js +277 -23
- package/dist/storage/objects/objects.service.js.map +1 -1
- package/dist/storage/objects/part-body-parser.d.ts +30 -0
- package/dist/storage/objects/part-body-parser.d.ts.map +1 -0
- package/dist/storage/objects/part-body-parser.js +45 -0
- package/dist/storage/objects/part-body-parser.js.map +1 -0
- package/dist/storage/objects/part-body.d.ts +23 -0
- package/dist/storage/objects/part-body.d.ts.map +1 -0
- package/dist/storage/objects/part-body.js +48 -0
- package/dist/storage/objects/part-body.js.map +1 -0
- package/dist/storage/processing/object-processing.service.d.ts +4 -1
- package/dist/storage/processing/object-processing.service.d.ts.map +1 -1
- package/dist/storage/processing/object-processing.service.js +11 -3
- package/dist/storage/processing/object-processing.service.js.map +1 -1
- package/dist/storage/profile-image/avatar.service.d.ts +3 -1
- package/dist/storage/profile-image/avatar.service.d.ts.map +1 -1
- package/dist/storage/profile-image/avatar.service.js +8 -3
- package/dist/storage/profile-image/avatar.service.js.map +1 -1
- package/dist/storage/profile-image/profile-image.service.d.ts +4 -1
- package/dist/storage/profile-image/profile-image.service.d.ts.map +1 -1
- package/dist/storage/profile-image/profile-image.service.js +11 -5
- package/dist/storage/profile-image/profile-image.service.js.map +1 -1
- package/dist/storage/providers/index.d.ts +3 -1
- package/dist/storage/providers/index.d.ts.map +1 -1
- package/dist/storage/providers/index.js +8 -1
- package/dist/storage/providers/index.js.map +1 -1
- package/dist/storage/providers/resolving-storage.provider.d.ts +11 -0
- package/dist/storage/providers/resolving-storage.provider.d.ts.map +1 -1
- package/dist/storage/providers/resolving-storage.provider.js +13 -0
- package/dist/storage/providers/resolving-storage.provider.js.map +1 -1
- package/dist/storage/providers/s3/s3-storage.provider.d.ts +9 -1
- package/dist/storage/providers/s3/s3-storage.provider.d.ts.map +1 -1
- package/dist/storage/providers/s3/s3-storage.provider.js +37 -0
- package/dist/storage/providers/s3/s3-storage.provider.js.map +1 -1
- package/dist/storage/providers/storage-provider-router.d.ts +64 -0
- package/dist/storage/providers/storage-provider-router.d.ts.map +1 -0
- package/dist/storage/providers/storage-provider-router.js +161 -0
- package/dist/storage/providers/storage-provider-router.js.map +1 -0
- package/dist/storage/providers/storage-provider.interface.d.ts +34 -1
- package/dist/storage/providers/storage-provider.interface.d.ts.map +1 -1
- package/dist/storage/providers/storage-provider.interface.js.map +1 -1
- package/dist/storage/providers/storage-provider.types.d.ts +86 -0
- package/dist/storage/providers/storage-provider.types.d.ts.map +1 -1
- package/dist/storage/providers/storage-provider.types.js +78 -0
- package/dist/storage/providers/storage-provider.types.js.map +1 -1
- package/dist/storage/providers/storage-providers.module.d.ts.map +1 -1
- package/dist/storage/providers/storage-providers.module.js +3 -1
- package/dist/storage/providers/storage-providers.module.js.map +1 -1
- package/dist/storage/testing/conformance.d.ts +12 -0
- package/dist/storage/testing/conformance.d.ts.map +1 -1
- package/dist/storage/testing/conformance.js +112 -0
- package/dist/storage/testing/conformance.js.map +1 -1
- package/dist/storage/testing/driver-conformance.d.ts +13 -1
- package/dist/storage/testing/driver-conformance.d.ts.map +1 -1
- package/dist/storage/testing/driver-conformance.js +134 -0
- package/dist/storage/testing/driver-conformance.js.map +1 -1
- package/dist/storage/testing/index.d.ts +1 -1
- package/dist/storage/testing/index.d.ts.map +1 -1
- package/dist/storage/testing/index.js +2 -1
- package/dist/storage/testing/index.js.map +1 -1
- package/dist/telemetry/stack/dto/telemetry-stack.dto.d.ts +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationInboxWriter = void 0;
|
|
4
|
+
exports.stateDedupKey = stateDedupKey;
|
|
5
|
+
exports.countedDedupKey = countedDedupKey;
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
/** Longest dedup key stored; longer keys are hashed. */
|
|
8
|
+
const MAX_DEDUP_KEY_LENGTH = 200;
|
|
9
|
+
/** Prisma's unique-violation code. */
|
|
10
|
+
const UNIQUE_VIOLATION = 'P2002';
|
|
11
|
+
/**
|
|
12
|
+
* Builds the dedup key of a STATE row: one per `(eventKey, scopeId)`.
|
|
13
|
+
*
|
|
14
|
+
* @stability experimental
|
|
15
|
+
*/
|
|
16
|
+
function stateDedupKey(eventKey, scopeId) {
|
|
17
|
+
return capKey(`state:${eventKey}:${scopeId ?? '-'}`);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Builds the dedup key of a COUNTED row: one per `(eventKey, scopeId, match)`.
|
|
21
|
+
* The match object is serialised with sorted keys, so `{a, b}` and `{b, a}`
|
|
22
|
+
* fold together.
|
|
23
|
+
*
|
|
24
|
+
* @stability experimental
|
|
25
|
+
*/
|
|
26
|
+
function countedDedupKey(eventKey, scopeId, match) {
|
|
27
|
+
const entries = Object.entries(match ?? {}).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
|
|
28
|
+
const suffix = entries.length === 0 ? '' : `:${JSON.stringify(entries)}`;
|
|
29
|
+
return capKey(`counted:${eventKey}:${scopeId ?? '-'}${suffix}`);
|
|
30
|
+
}
|
|
31
|
+
function capKey(key) {
|
|
32
|
+
if (key.length <= MAX_DEDUP_KEY_LENGTH)
|
|
33
|
+
return key;
|
|
34
|
+
return `${key.slice(0, 120)}#${(0, node_crypto_1.createHash)('sha256').update(key).digest('hex').slice(0, 40)}`;
|
|
35
|
+
}
|
|
36
|
+
function asRecord(value) {
|
|
37
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) ? { ...value } : {};
|
|
38
|
+
}
|
|
39
|
+
function asCount(value) {
|
|
40
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null;
|
|
41
|
+
}
|
|
42
|
+
function isUniqueViolation(err) {
|
|
43
|
+
return typeof err === 'object' && err !== null && err.code === UNIQUE_VIOLATION;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Writes STATE and COUNTED inbox rows.
|
|
47
|
+
*
|
|
48
|
+
* Exported for an app's own unit tests (`@marinoscar/platform-api/notifications/testing`); not an extension point: reach it through `NotificationsService.notifyState` and `notifyCounted`.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
class NotificationInboxWriter {
|
|
53
|
+
prisma;
|
|
54
|
+
constructor(prisma) {
|
|
55
|
+
this.prisma = prisma;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Upserts the single live STATE row, or returns null when `mode.count` is
|
|
59
|
+
* not positive (use {@link dismissLive} for that).
|
|
60
|
+
*
|
|
61
|
+
* The refresh replaces title, body, link and `data` wholesale, carrying
|
|
62
|
+
* `countAtRead` forward (replacing `data` would otherwise silently disable the
|
|
63
|
+
* re-unread rule until the row is next read). A READ row is re-marked unread
|
|
64
|
+
* only when `reunreadWhen` is `count-increased`, the new count exceeds a
|
|
65
|
+
* recorded `countAtRead`, and nothing else: never on a decrease, never on an
|
|
66
|
+
* equal count, never on a row with no `countAtRead` (absent means "already
|
|
67
|
+
* seen"; re-unreading on it would re-nag every legacy row on every refresh).
|
|
68
|
+
*/
|
|
69
|
+
async upsertState(userId, eventKey, mode, data, render) {
|
|
70
|
+
return this.withRetry(() => this.locked(userId, mode.dedupKey, async (tx) => {
|
|
71
|
+
const live = await this.findLive(tx, userId, mode.dedupKey);
|
|
72
|
+
const payload = { ...data, count: mode.count };
|
|
73
|
+
if (!live) {
|
|
74
|
+
const content = render(payload);
|
|
75
|
+
const created = await tx.notification.create({
|
|
76
|
+
data: {
|
|
77
|
+
userId,
|
|
78
|
+
eventKey,
|
|
79
|
+
...content,
|
|
80
|
+
scopeId: mode.scopeId,
|
|
81
|
+
data: payload,
|
|
82
|
+
dedupKey: mode.dedupKey,
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
return result(created, mode.count, 'created', false);
|
|
86
|
+
}
|
|
87
|
+
const previous = asRecord(live.data);
|
|
88
|
+
const previousCount = asCount(previous['count']);
|
|
89
|
+
const countAtRead = asCount(previous['countAtRead']);
|
|
90
|
+
const grew = previousCount === null ? true : mode.count > previousCount;
|
|
91
|
+
const reunread = live.readAt !== null &&
|
|
92
|
+
mode.reunreadWhen === 'count-increased' &&
|
|
93
|
+
countAtRead !== null &&
|
|
94
|
+
mode.count > countAtRead;
|
|
95
|
+
const merged = { ...payload };
|
|
96
|
+
if (countAtRead !== null)
|
|
97
|
+
merged['countAtRead'] = countAtRead;
|
|
98
|
+
const content = render(merged);
|
|
99
|
+
const updated = await tx.notification.update({
|
|
100
|
+
where: { id: live.id },
|
|
101
|
+
data: {
|
|
102
|
+
...content,
|
|
103
|
+
scopeId: mode.scopeId,
|
|
104
|
+
data: merged,
|
|
105
|
+
...(reunread ? { readAt: null } : {}),
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
// Quiet: nothing for the user to notice (same count, still as read or
|
|
109
|
+
// unread as before). The row is refreshed but no stream frame is sent.
|
|
110
|
+
const quiet = !reunread && !(grew && live.readAt === null);
|
|
111
|
+
return result(updated, mode.count, reunread ? 'reunread' : 'incremented', quiet);
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Folds one occurrence into the live COUNTED row, or starts a new row.
|
|
116
|
+
*
|
|
117
|
+
* Inside the window (or with none) the live row's `data.count` grows by
|
|
118
|
+
* `increment`, its text is re-rendered with the new total, and `readAt` is
|
|
119
|
+
* cleared so continued activity re-badges the bell. Outside the window the
|
|
120
|
+
* old row is RETIRED (its `dedup_key` becomes `retired:<id>` so the key is free; it stays in
|
|
121
|
+
* the inbox as the record of that batch) and a fresh row starts at
|
|
122
|
+
* `increment`.
|
|
123
|
+
*/
|
|
124
|
+
async upsertCounted(userId, eventKey, mode, data, render, now = new Date()) {
|
|
125
|
+
return this.withRetry(() => this.locked(userId, mode.dedupKey, async (tx) => {
|
|
126
|
+
let live = await this.findLive(tx, userId, mode.dedupKey);
|
|
127
|
+
if (live && mode.windowMs !== null && now.getTime() - live.updatedAt.getTime() > mode.windowMs) {
|
|
128
|
+
// Retire, do not delete or dismiss: the user still sees that batch.
|
|
129
|
+
// The key becomes 'retired:<id>', unique to the row, so the live key
|
|
130
|
+
// is free and the row still reads as a folded one (non-null key) to
|
|
131
|
+
// the retention sweep. Raw: Prisma's `update` would also bump
|
|
132
|
+
// `updated_at`, rewriting the timestamp this row is evidence of.
|
|
133
|
+
await tx.$executeRaw `UPDATE notifications SET dedup_key = ${`retired:${live.id}`} WHERE id = ${live.id}::uuid`;
|
|
134
|
+
live = null;
|
|
135
|
+
}
|
|
136
|
+
if (!live) {
|
|
137
|
+
const payload = { ...data, count: mode.increment };
|
|
138
|
+
const content = render(payload);
|
|
139
|
+
const created = await tx.notification.create({
|
|
140
|
+
data: {
|
|
141
|
+
userId,
|
|
142
|
+
eventKey,
|
|
143
|
+
...content,
|
|
144
|
+
scopeId: mode.scopeId,
|
|
145
|
+
data: payload,
|
|
146
|
+
dedupKey: mode.dedupKey,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
return result(created, mode.increment, 'created', false);
|
|
150
|
+
}
|
|
151
|
+
const previous = asRecord(live.data);
|
|
152
|
+
const total = (asCount(previous['count']) ?? 0) + mode.increment;
|
|
153
|
+
// The latest occurrence's fields win; the count accumulates and any
|
|
154
|
+
// `countAtRead` is untouched.
|
|
155
|
+
const merged = { ...previous, ...data, count: total };
|
|
156
|
+
const content = render(merged);
|
|
157
|
+
const wasRead = live.readAt !== null;
|
|
158
|
+
const updated = await tx.notification.update({
|
|
159
|
+
where: { id: live.id },
|
|
160
|
+
data: {
|
|
161
|
+
...content,
|
|
162
|
+
data: merged,
|
|
163
|
+
readAt: null,
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
return result(updated, total, wasRead ? 'reunread' : 'incremented', false);
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Dismisses the live row of `dedupKey` (a STATE row whose count drained to
|
|
171
|
+
* zero). Dismissal implies read. Returns whether a row was dismissed.
|
|
172
|
+
*/
|
|
173
|
+
async dismissLive(userId, dedupKey) {
|
|
174
|
+
return this.locked(userId, dedupKey, async (tx) => {
|
|
175
|
+
const touched = await tx.$executeRaw `
|
|
176
|
+
UPDATE notifications
|
|
177
|
+
SET dismissed_at = now(), read_at = COALESCE(read_at, now()), updated_at = now()
|
|
178
|
+
WHERE user_id = ${userId}::uuid AND dedup_key = ${dedupKey} AND dismissed_at IS NULL`;
|
|
179
|
+
return touched > 0;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/** Runs `work` in a transaction holding the advisory lock of `(userId, dedupKey)`. */
|
|
183
|
+
locked(userId, dedupKey, work) {
|
|
184
|
+
const lockKey = `${userId}|${dedupKey}`;
|
|
185
|
+
return this.prisma.$transaction(async (tx) => {
|
|
186
|
+
await tx.$executeRaw `SELECT pg_advisory_xact_lock(hashtext(${lockKey}))`;
|
|
187
|
+
return work(tx);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/** One retry on a unique violation: the winner's row exists now, so the retry folds into it. */
|
|
191
|
+
async withRetry(attempt) {
|
|
192
|
+
try {
|
|
193
|
+
return await attempt();
|
|
194
|
+
}
|
|
195
|
+
catch (err) {
|
|
196
|
+
if (!isUniqueViolation(err))
|
|
197
|
+
throw err;
|
|
198
|
+
return attempt();
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
findLive(tx, userId, dedupKey) {
|
|
202
|
+
return tx.notification.findFirst({ where: { userId, dedupKey, dismissedAt: null } });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
exports.NotificationInboxWriter = NotificationInboxWriter;
|
|
206
|
+
function result(row, count, reason, quiet) {
|
|
207
|
+
return {
|
|
208
|
+
id: row.id,
|
|
209
|
+
createdAt: row.createdAt,
|
|
210
|
+
updatedAt: row.updatedAt,
|
|
211
|
+
count,
|
|
212
|
+
scopeId: row.scopeId ?? null,
|
|
213
|
+
reason,
|
|
214
|
+
quiet,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=notification-inbox-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-inbox-writer.js","sourceRoot":"","sources":["../../src/notifications/notification-inbox-writer.ts"],"names":[],"mappings":";;;AA6HA,sCAEC;AASD,0CAQC;AAhJD,6CAAyC;AAkHzC,wDAAwD;AACxD,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAEjC,sCAAsC;AACtC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAEjC;;;;GAIG;AACH,SAAgB,aAAa,CAAC,QAAgB,EAAE,OAAsB;IACpE,OAAO,MAAM,CAAC,SAAS,QAAQ,IAAI,OAAO,IAAI,GAAG,EAAE,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAC7B,QAAgB,EAChB,OAAsB,EACtB,KAAsE;IAEtE,MAAM,OAAO,GAAG,MAAM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,CAAC,OAAO,IAAI,IAAI;QAC5B,MAAM;QACN,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -68,5 +68,15 @@ export declare class NotificationStoreService {
|
|
|
68
68
|
* be showing 1.
|
|
69
69
|
*/
|
|
70
70
|
markAllRead(userId: string): Promise<number>;
|
|
71
|
+
/**
|
|
72
|
+
* Dismiss one notification ("stop showing me this") and report the badge.
|
|
73
|
+
*
|
|
74
|
+
* Dismissal implies read, so the row never lingers in the unread count. The
|
|
75
|
+
* row leaves the list; the retention sweep deletes it by age. Idempotent, and
|
|
76
|
+
* ownership-scoped exactly like {@link markRead}: another user's id is a 404.
|
|
77
|
+
*
|
|
78
|
+
* @throws NotFoundException when the id belongs to nobody, or to somebody else.
|
|
79
|
+
*/
|
|
80
|
+
dismiss(userId: string, id: string): Promise<number>;
|
|
71
81
|
}
|
|
72
82
|
//# 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;
|
|
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;IA+BpC;;;;;;;;;;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;CAgB3D"}
|
|
@@ -66,6 +66,10 @@ const NOTIFICATION_FIELDS = {
|
|
|
66
66
|
link: true,
|
|
67
67
|
readAt: true,
|
|
68
68
|
createdAt: true,
|
|
69
|
+
data: true,
|
|
70
|
+
scopeId: true,
|
|
71
|
+
dismissedAt: true,
|
|
72
|
+
updatedAt: true,
|
|
69
73
|
};
|
|
70
74
|
/**
|
|
71
75
|
* 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.
|
|
@@ -95,8 +99,10 @@ let NotificationStoreService = class NotificationStoreService {
|
|
|
95
99
|
async list(userId, query) {
|
|
96
100
|
const { page, pageSize, unreadOnly } = query;
|
|
97
101
|
// `userId` is in the where clause, not applied afterwards. See the header.
|
|
102
|
+
// A dismissed row is "stop showing me this": never listed (issue #1077).
|
|
98
103
|
const where = {
|
|
99
104
|
userId,
|
|
105
|
+
dismissedAt: null,
|
|
100
106
|
...(unreadOnly ? { readAt: null } : {}),
|
|
101
107
|
};
|
|
102
108
|
const [items, total] = await this.prisma.$transaction([
|
|
@@ -130,7 +136,7 @@ let NotificationStoreService = class NotificationStoreService {
|
|
|
130
136
|
*/
|
|
131
137
|
async unreadCount(userId) {
|
|
132
138
|
return this.prisma.notification.count({
|
|
133
|
-
where: { userId, readAt: null },
|
|
139
|
+
where: { userId, readAt: null, dismissedAt: null },
|
|
134
140
|
});
|
|
135
141
|
}
|
|
136
142
|
/**
|
|
@@ -153,11 +159,19 @@ let NotificationStoreService = class NotificationStoreService {
|
|
|
153
159
|
* else. The two are deliberately indistinguishable.
|
|
154
160
|
*/
|
|
155
161
|
async markRead(userId, id) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
162
|
+
// Raw, for two reasons. `data.countAtRead` snapshots the count the user
|
|
163
|
+
// saw (the re-unread rule of a STATE row compares against it), which
|
|
164
|
+
// `updateMany` cannot do per row; and Prisma's `@updatedAt` would move
|
|
165
|
+
// `updated_at`, the rolling-window anchor of a COUNTED row, so merely
|
|
166
|
+
// reading a row would keep its window open.
|
|
167
|
+
const touched = await this.prisma.$executeRaw `
|
|
168
|
+
UPDATE notifications
|
|
169
|
+
SET read_at = now(),
|
|
170
|
+
data = CASE WHEN jsonb_typeof(data -> 'count') = 'number'
|
|
171
|
+
THEN jsonb_set(data, '{countAtRead}', data -> 'count')
|
|
172
|
+
ELSE data END
|
|
173
|
+
WHERE id = ${id}::uuid AND user_id = ${userId}::uuid AND read_at IS NULL`;
|
|
174
|
+
if (touched === 0) {
|
|
161
175
|
// Nothing was updated: either the notification is already read (fine,
|
|
162
176
|
// idempotent) or it is not this user's to touch. Distinguished by a
|
|
163
177
|
// second query that is ITSELF scoped to the user, so the answer never
|
|
@@ -187,10 +201,36 @@ let NotificationStoreService = class NotificationStoreService {
|
|
|
187
201
|
* be showing 1.
|
|
188
202
|
*/
|
|
189
203
|
async markAllRead(userId) {
|
|
190
|
-
await this.prisma
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
204
|
+
await this.prisma.$executeRaw `
|
|
205
|
+
UPDATE notifications
|
|
206
|
+
SET read_at = now(),
|
|
207
|
+
data = CASE WHEN jsonb_typeof(data -> 'count') = 'number'
|
|
208
|
+
THEN jsonb_set(data, '{countAtRead}', data -> 'count')
|
|
209
|
+
ELSE data END
|
|
210
|
+
WHERE user_id = ${userId}::uuid AND read_at IS NULL AND dismissed_at IS NULL`;
|
|
211
|
+
return this.unreadCount(userId);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Dismiss one notification ("stop showing me this") and report the badge.
|
|
215
|
+
*
|
|
216
|
+
* Dismissal implies read, so the row never lingers in the unread count. The
|
|
217
|
+
* row leaves the list; the retention sweep deletes it by age. Idempotent, and
|
|
218
|
+
* ownership-scoped exactly like {@link markRead}: another user's id is a 404.
|
|
219
|
+
*
|
|
220
|
+
* @throws NotFoundException when the id belongs to nobody, or to somebody else.
|
|
221
|
+
*/
|
|
222
|
+
async dismiss(userId, id) {
|
|
223
|
+
const touched = await this.prisma.$executeRaw `
|
|
224
|
+
UPDATE notifications
|
|
225
|
+
SET dismissed_at = now(),
|
|
226
|
+
read_at = COALESCE(read_at, now())
|
|
227
|
+
WHERE id = ${id}::uuid AND user_id = ${userId}::uuid AND dismissed_at IS NULL`;
|
|
228
|
+
if (touched === 0) {
|
|
229
|
+
const exists = await this.prisma.notification.count({ where: { id, userId } });
|
|
230
|
+
if (exists === 0) {
|
|
231
|
+
throw new common_1.NotFoundException('Notification not found');
|
|
232
|
+
}
|
|
233
|
+
}
|
|
194
234
|
return this.unreadCount(userId);
|
|
195
235
|
}
|
|
196
236
|
};
|
|
@@ -209,6 +249,7 @@ exports.NotificationStoreService = NotificationStoreService = __decorate([
|
|
|
209
249
|
* into the list it fetched without a second mapping.
|
|
210
250
|
*/
|
|
211
251
|
function toResponse(row) {
|
|
252
|
+
const count = row.data?.count;
|
|
212
253
|
return {
|
|
213
254
|
id: row.id,
|
|
214
255
|
eventKey: row.eventKey,
|
|
@@ -217,6 +258,10 @@ function toResponse(row) {
|
|
|
217
258
|
link: row.link,
|
|
218
259
|
readAt: row.readAt ? row.readAt.toISOString() : null,
|
|
219
260
|
createdAt: row.createdAt.toISOString(),
|
|
261
|
+
count: typeof count === 'number' ? count : null,
|
|
262
|
+
scopeId: row.scopeId,
|
|
263
|
+
dismissedAt: row.dismissedAt ? row.dismissedAt.toISOString() : null,
|
|
264
|
+
updatedAt: row.updatedAt.toISOString(),
|
|
220
265
|
};
|
|
221
266
|
}
|
|
222
267
|
//# sourceMappingURL=notification-store.service.js.map
|
|
@@ -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;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;QAE7C,2EAA2E;QAC3E,MAAM,KAAK,GAAG;YACZ,MAAM;YACN,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACxC,CAAC;QAEF,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,MAAO,IAAI,CAAC,MAAmD,CAAC,YAAY,CAAC;YAClG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC;gBAChC,KAAK;gBACL,MAAM,EAAE,mBAAmB;gBAC3B,OAAO,EAAE,EAAE,SAAS,EAAE,MAAe,EAAE;gBACvC,IAAI,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ;gBAC3B,IAAI,EAAE,QAAQ;aACf,CAAC;YACF,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC;SAC1C,CAAC,CAAC;QAEH,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC;YAC5B,KAAK;YACL,IAAI;YACJ,QAAQ;YACR,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;SACxC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,WAAW,CAAC,MAAc;QAC9B,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC;YACpC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE;
|
|
1
|
+
{"version":3,"file":"notification-store.service.js","sourceRoot":"","sources":["../../src/notifications/notification-store.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;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,CAAC,CAAC;IAClC,CAAC;CACF,CAAA;AA3KY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;IAEE,WAAA,IAAA,eAAM,EAAC,uBAAe,CAAC,CAAA;;GADzB,wBAAwB,CA2KpC;AAED;;;;;;;GAOG;AACH,SAAS,UAAU,CAAC,GAYnB;IACC,MAAM,KAAK,GAAI,GAAG,CAAC,IAAmC,EAAE,KAAK,CAAC;IAC9D,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,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"}
|
|
@@ -76,6 +76,14 @@ export interface NotificationStreamEvent {
|
|
|
76
76
|
* change what `toast` means.
|
|
77
77
|
*/
|
|
78
78
|
pushed: boolean;
|
|
79
|
+
/** The occurrence count of a STATE or COUNTED row (issue #1077); absent for a plain row. */
|
|
80
|
+
count?: number | null;
|
|
81
|
+
/** The scope of a STATE or COUNTED row, or null. */
|
|
82
|
+
scopeId?: string | null;
|
|
83
|
+
/** Last refresh (ISO 8601). */
|
|
84
|
+
updatedAt?: string;
|
|
85
|
+
/** Why the frame was sent; absent means `created`. */
|
|
86
|
+
reason?: 'created' | 'incremented' | 'reunread';
|
|
79
87
|
}
|
|
80
88
|
/**
|
|
81
89
|
* SSE `event:` name carrying a new notification.
|
|
@@ -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;
|
|
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;AA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KAAK,EAAE,uBAAuB,GAAG,MAAM;IAY/D;;;OAGG;IACH,OAAO,CAAC,aAAa;IAOrB;;;OAGG;IACH;;;OAGG;IACH,OAAO,CAAC,kBAAkB;YASZ,YAAY;IAqB1B;;;;;;OAMG;YACW,gBAAgB;IAkC9B;;;OAGG;IACH,OAAO,CAAC,YAAY;IA0BpB;;OAEG;IACH,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAIvC;;;;;;;;;;;;OAYG;IACG,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAsBvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-stream.service.js","sourceRoot":"","sources":["../../src/notifications/notification-stream.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
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,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d3B,yBAAyB,CA+TrC"}
|
|
@@ -137,6 +137,73 @@ export interface NotifyOptions {
|
|
|
137
137
|
*/
|
|
138
138
|
timeZone?: string | null;
|
|
139
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Options of {@link NotificationsService.notifyState}.
|
|
142
|
+
*
|
|
143
|
+
* Everything in {@link NotifyOptions} applies unchanged (channels narrow,
|
|
144
|
+
* `orgId`, `timeZone`).
|
|
145
|
+
*
|
|
146
|
+
* @stability experimental
|
|
147
|
+
*/
|
|
148
|
+
export interface NotifyStateOptions extends NotifyOptions {
|
|
149
|
+
/**
|
|
150
|
+
* The scope this row belongs to (a group, an organization, a workspace).
|
|
151
|
+
* One user holds one live row per `(eventKey, scopeId)`. Not authorization:
|
|
152
|
+
* the producer decides who is notified.
|
|
153
|
+
*/
|
|
154
|
+
scopeId?: string | null;
|
|
155
|
+
/**
|
|
156
|
+
* When a refresh re-marks a READ row unread. `count-increased` (default):
|
|
157
|
+
* only when `data.count` is greater than the count the user saw when they
|
|
158
|
+
* read it (`data.countAtRead`); a row with no recorded `countAtRead` is
|
|
159
|
+
* treated as already seen. `never`: a refresh never touches `readAt`.
|
|
160
|
+
*/
|
|
161
|
+
reunreadWhen?: 'count-increased' | 'never';
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Options of {@link NotificationsService.notifyCounted}.
|
|
165
|
+
*
|
|
166
|
+
* @stability experimental
|
|
167
|
+
*/
|
|
168
|
+
export interface NotifyCountedOptions extends NotifyOptions {
|
|
169
|
+
/** The scope this row belongs to; see {@link NotifyStateOptions.scopeId}. */
|
|
170
|
+
scopeId?: string | null;
|
|
171
|
+
/**
|
|
172
|
+
* The rolling window in milliseconds, anchored on the row's last update:
|
|
173
|
+
* an occurrence inside it folds into the live row, one after it starts a new
|
|
174
|
+
* row (the old row stays in the inbox, retired). Absent or `null`: no window,
|
|
175
|
+
* the live row keeps accumulating until the user dismisses it.
|
|
176
|
+
*/
|
|
177
|
+
windowMs?: number | null;
|
|
178
|
+
/**
|
|
179
|
+
* Partitions the rows beyond `(user, eventKey, scope)`: two occurrences fold
|
|
180
|
+
* together only when their `match` objects are equal (key order does not
|
|
181
|
+
* matter), for example `{ jobType: 'export' }`.
|
|
182
|
+
*/
|
|
183
|
+
match?: Readonly<Record<string, string | number | boolean>>;
|
|
184
|
+
/** How much this occurrence adds to `data.count`. Default 1; a positive integer. */
|
|
185
|
+
increment?: number;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* How the in-app inbox row of one dispatch is written, when it is not a plain
|
|
189
|
+
* append. Set by `notifyState` and `notifyCounted`; read by the browser
|
|
190
|
+
* channel. Not part of the public surface.
|
|
191
|
+
*
|
|
192
|
+
* @internal
|
|
193
|
+
*/
|
|
194
|
+
export type InboxWrite = {
|
|
195
|
+
readonly kind: 'state';
|
|
196
|
+
readonly dedupKey: string;
|
|
197
|
+
readonly scopeId: string | null;
|
|
198
|
+
readonly count: number;
|
|
199
|
+
readonly reunreadWhen: 'count-increased' | 'never';
|
|
200
|
+
} | {
|
|
201
|
+
readonly kind: 'counted';
|
|
202
|
+
readonly dedupKey: string;
|
|
203
|
+
readonly scopeId: string | null;
|
|
204
|
+
readonly windowMs: number | null;
|
|
205
|
+
readonly increment: number;
|
|
206
|
+
};
|
|
140
207
|
/**
|
|
141
208
|
* Per-dispatch options for the permission-addressed entry points
|
|
142
209
|
* ({@link NotificationsService.notifyPermissionHolders} and its awaited
|
|
@@ -223,6 +290,13 @@ export interface NotificationDispatchContext {
|
|
|
223
290
|
* independent and are attempted in isolation.
|
|
224
291
|
*/
|
|
225
292
|
readonly channels: readonly NotificationChannel[];
|
|
293
|
+
/**
|
|
294
|
+
* Set by `notifyState` / `notifyCounted`: the browser channel upserts the
|
|
295
|
+
* inbox row instead of appending one. Absent for `notify()`.
|
|
296
|
+
*
|
|
297
|
+
* @internal
|
|
298
|
+
*/
|
|
299
|
+
readonly inbox?: InboxWrite;
|
|
226
300
|
}
|
|
227
301
|
/**
|
|
228
302
|
* The outcome of one channel's attempt at one delivery.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.types.d.ts","sourceRoot":"","sources":["../../src/notifications/notification.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAY1E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;;;;;;;OASG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;;;;;;OAOG;IACH,WAAW,EAAE,uBAAuB,CAAC;IAErC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAE1C;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,8BAA+B,SAAQ,aAAa;IACnE;;;;;;;OAOG;IACH,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,sFAAsF;IACtF,KAAK,EAAE,oBAAoB,CAAC;IAE5B,uEAAuE;IACvE,SAAS,EAAE,qBAAqB,CAAC;IAEjC;;;;;;;;;;;OAWG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAE5B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"notification.types.d.ts","sourceRoot":"","sources":["../../src/notifications/notification.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAY1E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,qBAAqB;IACpC,qEAAqE;IACrE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;;;;;;;OASG;IACH,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB;;;;;;;OAOG;IACH,WAAW,EAAE,uBAAuB,CAAC;IAErC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAE1C;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED;;;;;;;GA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C;IAClC,QAAQ,CAAC,KAAK,EAAE,oBAAoB,CAAC;IACrC;;;;OAIG;IACH,MAAM,IAAI,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IAEtC;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,CAAC,SAAS,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI,CAAC;IAE5D;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,gBAAgB,CAAC,CAAC,SAAS,EAAE,qBAAqB,EAAE,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAEzH;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CACL,OAAO,EAAE,2BAA2B,EACpC,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACnC;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,4BAA4B,iCAAiC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification.types.js","sourceRoot":"","sources":["../../src/notifications/notification.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"notification.types.js","sourceRoot":"","sources":["../../src/notifications/notification.types.ts"],"names":[],"mappings":";;;AAijBA;;;;;;;;;;;;GAYG;AACU,QAAA,4BAA4B,GAAG,8BAA8B,CAAC"}
|
|
@@ -125,6 +125,7 @@ export declare class NotificationsController {
|
|
|
125
125
|
* not accept it.
|
|
126
126
|
*/
|
|
127
127
|
markRead(userId: string, id: string): Promise<UnreadCountResponse>;
|
|
128
|
+
dismiss(userId: string, id: string): Promise<UnreadCountResponse>;
|
|
128
129
|
markAllRead(userId: string): Promise<UnreadCountResponse>;
|
|
129
130
|
subscribePush(userId: string, dto: PushSubscribeDto, userAgent: string | undefined): Promise<PushSubscriptionResponse>;
|
|
130
131
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.controller.d.ts","sourceRoot":"","sources":["../../src/notifications/notifications.controller.ts"],"names":[],"mappings":"AAuBA,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,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,wBAAwB,EAExB,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,EACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,gBAAgB,EAEhB,kBAAkB,EAClB,KAAK,wBAAwB,EAC9B,MAAM,6BAA6B,CAAC;AA2BrC;;;;GAIG;AACH,qBAEa,uBAAuB;IAEhC,OAAO,CAAC,QAAQ,CAAC,KAAK;IAGtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAGxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAGvB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBATjB,KAAK,EAAE,wBAAwB,EAG/B,OAAO,EAAE,yBAAyB,EAGlC,MAAM,EAAE,yBAAyB,EAGjC,iBAAiB,EAAE,uBAAuB;IAiCvD,UAAU,CAAgB,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,yBAAyB,EAAE,CAAC;IA0DzF,YAAY,IAAI,qCAAqC,EAAE;IAIvD;;;;;;;;;;;;;;;OAeG;IAiCG,MAAM,CAAgB,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,0BAA0B,CAAC;IA0BpF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuEG;IA+CH,MAAM,CAAoB,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC;IA0C3D,IAAI,CACW,MAAM,EAAE,MAAM,EACxB,KAAK,EAAE,wBAAwB,GACvC,OAAO,CAAC,wBAAwB,CAAC;IAgB9B,WAAW,CACI,MAAM,EAAE,MAAM,GAChC,OAAO,CAAC,mBAAmB,CAAC;IAI/B;;;;;;;;;OASG;IAiBG,QAAQ,CACO,MAAM,EAAE,MAAM,EACL,EAAE,EAAE,MAAM,GACrC,OAAO,CAAC,mBAAmB,CAAC;IAmBzB,WAAW,CACI,MAAM,EAAE,MAAM,GAChC,OAAO,CAAC,mBAAmB,CAAC;IAoCzB,aAAa,CACE,MAAM,EAAE,MAAM,EACzB,GAAG,EAAE,gBAAgB,EACN,SAAS,EAAE,MAAM,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC;IAepC;;;;;;;;OAQG;IAeG,eAAe,CACA,MAAM,EAAE,MAAM,EACzB,GAAG,EAAE,kBAAkB,GAC9B,OAAO,CAAC,IAAI,CAAC;CAGjB"}
|
|
1
|
+
{"version":3,"file":"notifications.controller.d.ts","sourceRoot":"","sources":["../../src/notifications/notifications.controller.ts"],"names":[],"mappings":"AAuBA,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,y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ACW,MAAM,EAAE,MAAM,EACxB,KAAK,EAAE,wBAAwB,GACvC,OAAO,CAAC,wBAAwB,CAAC;IAgB9B,WAAW,CACI,MAAM,EAAE,MAAM,GAChC,OAAO,CAAC,mBAAmB,CAAC;IAI/B;;;;;;;;;OASG;IAiBG,QAAQ,CACO,MAAM,EAAE,MAAM,EACL,EAAE,EAAE,MAAM,GACrC,OAAO,CAAC,mBAAmB,CAAC;IAkBzB,OAAO,CACQ,MAAM,EAAE,MAAM,EACL,EAAE,EAAE,MAAM,GACrC,OAAO,CAAC,mBAAmB,CAAC;IAmBzB,WAAW,CACI,MAAM,EAAE,MAAM,GAChC,OAAO,CAAC,mBAAmB,CAAC;IAoCzB,aAAa,CACE,MAAM,EAAE,MAAM,EACzB,GAAG,EAAE,gBAAgB,EACN,SAAS,EAAE,MAAM,GAAG,SAAS,GACnD,OAAO,CAAC,wBAAwB,CAAC;IAepC;;;;;;;;OAQG;IAeG,eAAe,CACA,MAAM,EAAE,MAAM,EACzB,GAAG,EAAE,kBAAkB,GAC9B,OAAO,CAAC,IAAI,CAAC;CAGjB"}
|
|
@@ -263,6 +263,9 @@ let NotificationsController = class NotificationsController {
|
|
|
263
263
|
async markRead(userId, id) {
|
|
264
264
|
return { unreadCount: await this.store.markRead(userId, id) };
|
|
265
265
|
}
|
|
266
|
+
async dismiss(userId, id) {
|
|
267
|
+
return { unreadCount: await this.store.dismiss(userId, id) };
|
|
268
|
+
}
|
|
266
269
|
async markAllRead(userId) {
|
|
267
270
|
return { unreadCount: await this.store.markAllRead(userId) };
|
|
268
271
|
}
|
|
@@ -507,6 +510,26 @@ __decorate([
|
|
|
507
510
|
__metadata("design:paramtypes", [String, String]),
|
|
508
511
|
__metadata("design:returntype", Promise)
|
|
509
512
|
], NotificationsController.prototype, "markRead", null);
|
|
513
|
+
__decorate([
|
|
514
|
+
(0, common_1.Post)(':id/dismiss'),
|
|
515
|
+
(0, index_2.Auth)(),
|
|
516
|
+
(0, swagger_1.ApiOperation)({
|
|
517
|
+
summary: 'Dismiss one notification',
|
|
518
|
+
description: 'Removes a notification from the caller’s list and unread count ("stop showing me this"); ' +
|
|
519
|
+
'dismissal implies read, and the retention sweep deletes the row by age. Returns the ' +
|
|
520
|
+
'caller’s resulting unread count.\n\n' +
|
|
521
|
+
'**Idempotent.** **Ownership.** An id belonging to another user returns `404`, identical to ' +
|
|
522
|
+
'an id that does not exist.',
|
|
523
|
+
}),
|
|
524
|
+
(0, swagger_1.ApiParam)({ name: 'id', type: String, format: 'uuid' }),
|
|
525
|
+
(0, index_1.ApiDataResponse)(notification_dto_1.UnreadCountDto, { description: 'The new unread count' }),
|
|
526
|
+
(0, swagger_1.ApiResponse)({ status: 404, description: 'No such notification for this user' }),
|
|
527
|
+
__param(0, (0, index_2.CurrentUser)('id')),
|
|
528
|
+
__param(1, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
|
|
529
|
+
__metadata("design:type", Function),
|
|
530
|
+
__metadata("design:paramtypes", [String, String]),
|
|
531
|
+
__metadata("design:returntype", Promise)
|
|
532
|
+
], NotificationsController.prototype, "dismiss", null);
|
|
510
533
|
__decorate([
|
|
511
534
|
(0, common_1.Post)('read-all'),
|
|
512
535
|
(0, index_2.Auth)()
|