@timothyw/pat-common 1.0.125 → 1.0.127

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.
@@ -6,8 +6,11 @@ export interface NotificationContext<T = any> {
6
6
  entityData: T;
7
7
  userId: string;
8
8
  }
9
- export declare enum NotificationParentType {
10
- AGENDA_PANEL = "agenda_panel"
9
+ export declare enum TargetType {
10
+ PARENT = "parent",
11
+ INBOX_PANEL = "inbox_panel",
12
+ AGENDA_PANEL = "agenda_item",
13
+ AGENDA_ITEM = "agenda_item"
11
14
  }
12
15
  export declare enum NotificationEntityType {
13
16
  INBOX_PANEL = "inbox_panel",
@@ -30,8 +33,8 @@ export declare const notificationTriggerSchema: z.ZodObject<{
30
33
  export declare const notificationTemplateSchema: z.ZodObject<{
31
34
  _id: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
32
35
  userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
33
- entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
34
- entityId: z.ZodOptional<z.ZodString>;
36
+ targetType: z.ZodNativeEnum<typeof TargetType>;
37
+ targetId: z.ZodString;
35
38
  trigger: z.ZodObject<{
36
39
  type: z.ZodNativeEnum<typeof NotificationTriggerType>;
37
40
  }, "strip", z.ZodTypeAny, {
@@ -51,23 +54,23 @@ export declare const notificationTemplateSchema: z.ZodObject<{
51
54
  userId: string & {
52
55
  readonly __brand: "UserId";
53
56
  };
54
- entityType: NotificationEntityType;
57
+ targetType: TargetType;
58
+ targetId: string;
55
59
  trigger: {
56
60
  type: NotificationTriggerType;
57
61
  };
58
62
  active: boolean;
59
- entityId?: string | undefined;
60
63
  }, {
61
64
  _id: string;
62
65
  createdAt: Date;
63
66
  updatedAt: Date;
64
67
  userId: string;
65
- entityType: NotificationEntityType;
68
+ targetType: TargetType;
69
+ targetId: string;
66
70
  trigger: {
67
71
  type: NotificationTriggerType;
68
72
  };
69
73
  active: boolean;
70
- entityId?: string | undefined;
71
74
  }>;
72
75
  export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
73
76
  entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
@@ -81,19 +84,19 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
81
84
  }>;
82
85
  active: z.ZodDefault<z.ZodBoolean>;
83
86
  }, "strip", z.ZodTypeAny, {
84
- entityType: NotificationEntityType;
85
87
  trigger: {
86
88
  type: NotificationTriggerType;
87
89
  };
88
90
  active: boolean;
91
+ entityType: NotificationEntityType;
89
92
  entityId?: string | undefined;
90
93
  }, {
91
- entityType: NotificationEntityType;
92
94
  trigger: {
93
95
  type: NotificationTriggerType;
94
96
  };
95
- entityId?: string | undefined;
97
+ entityType: NotificationEntityType;
96
98
  active?: boolean | undefined;
99
+ entityId?: string | undefined;
97
100
  }>;
98
101
  export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
99
102
  trigger: z.ZodOptional<z.ZodObject<{
@@ -1,12 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEntitySyncRequestSchema = exports.entitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationTemplateSchema = exports.notificationTriggerSchema = exports.notificationTriggerTypeSchema = exports.NotificationTriggerType = exports.NotificationEntityType = exports.NotificationParentType = void 0;
3
+ exports.getEntitySyncRequestSchema = exports.entitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationTemplateSchema = exports.notificationTriggerSchema = exports.notificationTriggerTypeSchema = exports.NotificationTriggerType = exports.NotificationEntityType = exports.TargetType = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const id_types_1 = require("./id-types");
6
- var NotificationParentType;
7
- (function (NotificationParentType) {
8
- NotificationParentType["AGENDA_PANEL"] = "agenda_panel";
9
- })(NotificationParentType || (exports.NotificationParentType = NotificationParentType = {}));
6
+ // should always include all values from NotificationEntityType
7
+ var TargetType;
8
+ (function (TargetType) {
9
+ TargetType["PARENT"] = "parent";
10
+ TargetType["INBOX_PANEL"] = "inbox_panel";
11
+ TargetType["AGENDA_PANEL"] = "agenda_item";
12
+ TargetType["AGENDA_ITEM"] = "agenda_item";
13
+ })(TargetType || (exports.TargetType = TargetType = {}));
14
+ // update TargetType after modifying
10
15
  var NotificationEntityType;
11
16
  (function (NotificationEntityType) {
12
17
  NotificationEntityType["INBOX_PANEL"] = "inbox_panel";
@@ -26,8 +31,10 @@ exports.notificationTriggerSchema = zod_1.z.object({
26
31
  exports.notificationTemplateSchema = zod_1.z.object({
27
32
  _id: id_types_1.notificationTemplateIdSchema,
28
33
  userId: id_types_1.userIdSchema,
29
- entityType: zod_1.z.nativeEnum(NotificationEntityType),
30
- entityId: zod_1.z.string().optional(),
34
+ targetType: zod_1.z.nativeEnum(TargetType),
35
+ targetId: zod_1.z.string(),
36
+ // entityType: z.nativeEnum(NotificationEntityType),
37
+ // entityId: z.string().optional(),
31
38
  trigger: exports.notificationTriggerSchema,
32
39
  active: zod_1.z.boolean(),
33
40
  createdAt: zod_1.z.date(),
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@timothyw/pat-common",
3
3
  "description": "",
4
4
  "author": "Timothy Washburn",
5
- "version": "1.0.125",
5
+ "version": "1.0.127",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -9,10 +9,16 @@ export interface NotificationContext<T = any> {
9
9
  userId: string;
10
10
  }
11
11
 
12
- export enum NotificationParentType {
13
- AGENDA_PANEL = 'agenda_panel',
12
+ // should always include all values from NotificationEntityType
13
+ export enum TargetType {
14
+ PARENT = 'parent',
15
+
16
+ INBOX_PANEL = 'inbox_panel',
17
+ AGENDA_PANEL = 'agenda_item',
18
+ AGENDA_ITEM = 'agenda_item',
14
19
  }
15
20
 
21
+ // update TargetType after modifying
16
22
  export enum NotificationEntityType {
17
23
  INBOX_PANEL = 'inbox_panel',
18
24
  AGENDA_PANEL = 'agenda_item',
@@ -34,8 +40,10 @@ export const notificationTriggerSchema = z.object({
34
40
  export const notificationTemplateSchema = z.object({
35
41
  _id: notificationTemplateIdSchema,
36
42
  userId: userIdSchema,
37
- entityType: z.nativeEnum(NotificationEntityType),
38
- entityId: z.string().optional(),
43
+ targetType: z.nativeEnum(TargetType),
44
+ targetId: z.string(),
45
+ // entityType: z.nativeEnum(NotificationEntityType),
46
+ // entityId: z.string().optional(),
39
47
  trigger: notificationTriggerSchema,
40
48
  active: z.boolean(),
41
49
  createdAt: z.date(),