@ttt-productions/notification-core 0.15.0 → 0.15.1

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.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export type { NotificationDoc, PendingNotification, NotificationCategoryConfig, NotificationTypeConfig, NotificationSystemConfig, UseActiveNotificationsOptions, UseNotificationHistoryOptions, NotificationHistoryItem, UseUnreadCountOptions, UseArchiveNotificationOptions, UseArchiveAllNotificationsOptions, ArchiveAllJobStatus, EnqueueArchiveAllResult, ArchiveAllJobSnapshot, ArchiveAllPollResult, NotificationRowActions, NotificationListProps, NotificationHistoryListProps, NotificationEmptyStateProps, NotificationUnreadBadgeProps, } from './types.js';
2
+ export { NotificationDocSchema, PendingNotificationSchema } from './schemas.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,iCAAiC,EACjC,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,0BAA0B,EAC1B,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,6BAA6B,EAC7B,uBAAuB,EACvB,qBAAqB,EACrB,6BAA6B,EAC7B,iCAAiC,EACjC,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,EAC5B,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,5 @@
1
- export {};
1
+ // Runtime schemas for the generic notification doc shapes (notification-core owns
2
+ // these; consuming apps compose them instead of hand-mirroring). Server- and
3
+ // UI-safe (zod only, no React/firebase).
4
+ export { NotificationDocSchema, PendingNotificationSchema } from './schemas.js';
2
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAuBA,kFAAkF;AAClF,6EAA6E;AAC7E,yCAAyC;AACzC,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @ttt-productions/notification-core — Zod schemas
3
+ *
4
+ * Runtime validation schemas for the generic notification document shapes whose
5
+ * TypeScript types live in `./types.ts`. notification-core OWNS these shapes, so
6
+ * it owns their schemas too — the consuming app (e.g. `@ttt-productions/ttt-core`)
7
+ * composes these rather than hand-mirroring them, so the schema can never drift
8
+ * from the type.
9
+ *
10
+ * The interfaces in `./types.ts` remain the documented public type API. Each
11
+ * schema is compile-time-checked against its interface via
12
+ * `satisfies z.ZodType<Shape>` — a shape drift between the interface and the
13
+ * schema fails the build here.
14
+ *
15
+ * zod-only, no React/firebase: safe for both server (Cloud Functions) and UI.
16
+ */
17
+ import { z } from 'zod';
18
+ /**
19
+ * Active notification document (`NotificationDoc`). Same shape for both the user
20
+ * and admin active collections.
21
+ */
22
+ export declare const NotificationDocSchema: z.ZodObject<{
23
+ id: z.ZodString;
24
+ type: z.ZodString;
25
+ dedupKey: z.ZodString;
26
+ category: z.ZodString;
27
+ targetUserId: z.ZodNullable<z.ZodString>;
28
+ title: z.ZodString;
29
+ message: z.ZodString;
30
+ count: z.ZodNumber;
31
+ latestActorIds: z.ZodArray<z.ZodString>;
32
+ targetPath: z.ZodOptional<z.ZodString>;
33
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
34
+ seenAt: z.ZodNumber;
35
+ activityGeneration: z.ZodOptional<z.ZodString>;
36
+ seenAtGeneration: z.ZodOptional<z.ZodString>;
37
+ createdAt: z.ZodNumber;
38
+ updatedAt: z.ZodNumber;
39
+ }, z.core.$strip>;
40
+ /**
41
+ * Pending notification (`PendingNotification`) — queue item for the batch processor.
42
+ */
43
+ export declare const PendingNotificationSchema: z.ZodObject<{
44
+ id: z.ZodString;
45
+ type: z.ZodString;
46
+ category: z.ZodString;
47
+ targetUserId: z.ZodNullable<z.ZodString>;
48
+ actorId: z.ZodString;
49
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
50
+ createdAt: z.ZodNumber;
51
+ }, z.core.$strip>;
52
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;iBAoBK,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;iBAQK,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @ttt-productions/notification-core — Zod schemas
3
+ *
4
+ * Runtime validation schemas for the generic notification document shapes whose
5
+ * TypeScript types live in `./types.ts`. notification-core OWNS these shapes, so
6
+ * it owns their schemas too — the consuming app (e.g. `@ttt-productions/ttt-core`)
7
+ * composes these rather than hand-mirroring them, so the schema can never drift
8
+ * from the type.
9
+ *
10
+ * The interfaces in `./types.ts` remain the documented public type API. Each
11
+ * schema is compile-time-checked against its interface via
12
+ * `satisfies z.ZodType<Shape>` — a shape drift between the interface and the
13
+ * schema fails the build here.
14
+ *
15
+ * zod-only, no React/firebase: safe for both server (Cloud Functions) and UI.
16
+ */
17
+ import { z } from 'zod';
18
+ /**
19
+ * Active notification document (`NotificationDoc`). Same shape for both the user
20
+ * and admin active collections.
21
+ */
22
+ export const NotificationDocSchema = z.object({
23
+ id: z.string(),
24
+ type: z.string(),
25
+ dedupKey: z.string(),
26
+ category: z.string(),
27
+ targetUserId: z.string().nullable(),
28
+ title: z.string(),
29
+ message: z.string(),
30
+ count: z.number(),
31
+ latestActorIds: z.array(z.string()),
32
+ // Absent on linkless types (no defaultTargetPath in the type config).
33
+ targetPath: z.string().optional(),
34
+ metadata: z.record(z.string(), z.unknown()),
35
+ seenAt: z.number(),
36
+ // Opaque per-generation token rotated on create / material re-light. Optional on
37
+ // the legacy active doc shape; the ledger materializer always sets it.
38
+ activityGeneration: z.string().optional(),
39
+ seenAtGeneration: z.string().optional(),
40
+ createdAt: z.number(),
41
+ updatedAt: z.number(),
42
+ });
43
+ /**
44
+ * Pending notification (`PendingNotification`) — queue item for the batch processor.
45
+ */
46
+ export const PendingNotificationSchema = z.object({
47
+ id: z.string(),
48
+ type: z.string(),
49
+ category: z.string(),
50
+ targetUserId: z.string().nullable(),
51
+ actorId: z.string(),
52
+ metadata: z.record(z.string(), z.unknown()),
53
+ createdAt: z.number(),
54
+ });
55
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,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AC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAA0C,CAAC"}
@@ -9,8 +9,8 @@
9
9
  * replay return the stored result and touch nothing.
10
10
  *
11
11
  * GENERIC: the app constructs the deterministic ids (`historyRef`, `payloadHash`)
12
- * via its own canonical hash (ttt-core) and passes the refs in; this module owns
13
- * only the transactional state machine, not the id formulas.
12
+ * via its own canonical hash (in the consuming app's core package) and passes the
13
+ * refs in; this module owns only the transactional state machine, not the id formulas.
14
14
  */
15
15
  import type { ServerFirestore, ServerDocRef, ServerTransaction } from './types.js';
16
16
  export type MarkSeenOutcome = 'seen' | 'generation-mismatch' | 'missing';
@@ -9,8 +9,8 @@
9
9
  * replay return the stored result and touch nothing.
10
10
  *
11
11
  * GENERIC: the app constructs the deterministic ids (`historyRef`, `payloadHash`)
12
- * via its own canonical hash (ttt-core) and passes the refs in; this module owns
13
- * only the transactional state machine, not the id formulas.
12
+ * via its own canonical hash (in the consuming app's core package) and passes the
13
+ * refs in; this module owns only the transactional state machine, not the id formulas.
14
14
  */
15
15
  /**
16
16
  * Set `seenAt`/`seenAtGeneration` ONLY if the card's current `activityGeneration`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttt-productions/notification-core",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Shared notification system for TTT Productions apps — active/history two-tier architecture with dedup, batch processing, and themed UI components",
5
5
  "repository": {
6
6
  "type": "git",
@@ -37,10 +37,13 @@
37
37
  "typecheck": "tsc --noEmit",
38
38
  "prepublishOnly": "npm run build"
39
39
  },
40
+ "dependencies": {
41
+ "zod": "^4.4.3"
42
+ },
40
43
  "peerDependencies": {
41
44
  "@tanstack/react-query": ">=5.0.0",
42
45
  "@ttt-productions/query-core": "^0.14.0",
43
- "@ttt-productions/ui-core": "^0.11.1",
46
+ "@ttt-productions/ui-core": "^0.11.4",
44
47
  "firebase": ">=12.0.0",
45
48
  "react": ">=19.0.0",
46
49
  "react-dom": ">=19.0.0"
@@ -68,7 +71,7 @@
68
71
  "devDependencies": {
69
72
  "@tanstack/react-query": "^5.0.0",
70
73
  "@ttt-productions/query-core": "^0.14.0",
71
- "@ttt-productions/ui-core": "^0.11.1",
74
+ "@ttt-productions/ui-core": "^0.11.4",
72
75
  "@types/react": "^19.0.0",
73
76
  "@types/react-dom": "^19.0.0",
74
77
  "firebase": "^11.0.0",