@classytic/arc-notifications 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -3
- package/dist/index.mjs +2 -2
- package/package.json +5 -4
package/dist/index.d.mts
CHANGED
|
@@ -5,7 +5,6 @@ import { PermissionCheck } from "@classytic/arc/permissions";
|
|
|
5
5
|
import { FastifyInstance, FastifyRequest } from "fastify";
|
|
6
6
|
import { DomainEvent } from "@classytic/primitives/events";
|
|
7
7
|
import { RepositoryLike } from "@classytic/repo-core/adapter";
|
|
8
|
-
|
|
9
8
|
//#region src/inApp.d.ts
|
|
10
9
|
/**
|
|
11
10
|
* In-app notification content — the shared seam between a `notifyOn` trigger's
|
|
@@ -278,9 +277,9 @@ interface InAppChannelConfig extends ChannelConfig {
|
|
|
278
277
|
}
|
|
279
278
|
declare class InAppChannel extends BaseChannel<InAppChannelConfig> {
|
|
280
279
|
private readonly repository;
|
|
281
|
-
private readonly port
|
|
280
|
+
private readonly port;
|
|
282
281
|
private readonly eventName;
|
|
283
|
-
private readonly unreadCache
|
|
282
|
+
private readonly unreadCache;
|
|
284
283
|
constructor(config: InAppChannelConfig);
|
|
285
284
|
/** Skip (not fail) when this payload isn't an in-app notification. */
|
|
286
285
|
canSend(payload: NotificationPayload): SendResult | null;
|
package/dist/index.mjs
CHANGED
|
@@ -251,7 +251,7 @@ var InAppChannel = class extends BaseChannel {
|
|
|
251
251
|
function createUnreadCountCache(options = {}) {
|
|
252
252
|
const { ttlMs = 3e4, maxEntries = 1e4 } = options;
|
|
253
253
|
const entries = /* @__PURE__ */ new Map();
|
|
254
|
-
const keyOf = (organizationId, userId) => `${organizationId}
|
|
254
|
+
const keyOf = (organizationId, userId) => `${organizationId}\u0000${userId}`;
|
|
255
255
|
return {
|
|
256
256
|
get(organizationId, userId) {
|
|
257
257
|
const key = keyOf(organizationId, userId);
|
|
@@ -577,7 +577,7 @@ function notificationsModule(config) {
|
|
|
577
577
|
const bus = fastify;
|
|
578
578
|
if (!bus.events) throw new Error(`[arc-notifications] module "${name}" declares ${triggers.length} notifyOn trigger(s) but \`fastify.events\` is not decorated — register arc's eventPlugin (or drop notifyOn).`);
|
|
579
579
|
for (const trigger of triggers) {
|
|
580
|
-
const unsubscribe = await subscribeWithBoundary(bus, trigger.event, async (event) => dispatchTrigger(service, trigger, event, { recipientResolver }), { name: `arc-notifications:${trigger.event}` });
|
|
580
|
+
const unsubscribe = await subscribeWithBoundary(bus, trigger.event, async (event) => dispatchTrigger(service, trigger, event, { ...recipientResolver ? { recipientResolver } : {} }), { name: `arc-notifications:${trigger.event}` });
|
|
581
581
|
unsubscribes.push(unsubscribe);
|
|
582
582
|
}
|
|
583
583
|
fastify.log.debug(`[arc-notifications] ${triggers.length} trigger(s) subscribed`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/arc-notifications",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Notifications module for @classytic/arc — domain events → multi-channel notifications via @classytic/notifications, with DB-draftable templates, repo-backed delivery log, and a templates resource",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -24,14 +24,15 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsdown",
|
|
26
26
|
"typecheck": "tsc --noEmit",
|
|
27
|
+
"test": "vitest run --root ../.. packages/arc-notifications/tests",
|
|
27
28
|
"lint": "biome check src/",
|
|
28
29
|
"prepublishOnly": "node ../../scripts/prepublish-gate.mjs"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
|
-
"@classytic/arc": ">=2.
|
|
32
|
+
"@classytic/arc": ">=2.23.0",
|
|
32
33
|
"@classytic/notifications": ">=2.2.0",
|
|
33
|
-
"@classytic/primitives": ">=0.
|
|
34
|
-
"@classytic/repo-core": ">=0.
|
|
34
|
+
"@classytic/primitives": ">=0.14.0",
|
|
35
|
+
"@classytic/repo-core": ">=0.14.0"
|
|
35
36
|
},
|
|
36
37
|
"keywords": [
|
|
37
38
|
"arc",
|