@timothyw/pat-common 1.0.125 → 1.0.126

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,6 +6,10 @@ export interface NotificationContext<T = any> {
6
6
  entityData: T;
7
7
  userId: string;
8
8
  }
9
+ export declare enum TargetType {
10
+ PARENT = "parent",
11
+ ENTITY = "entity"
12
+ }
9
13
  export declare enum NotificationParentType {
10
14
  AGENDA_PANEL = "agenda_panel"
11
15
  }
@@ -30,8 +34,8 @@ export declare const notificationTriggerSchema: z.ZodObject<{
30
34
  export declare const notificationTemplateSchema: z.ZodObject<{
31
35
  _id: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
32
36
  userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
33
- entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
34
- entityId: z.ZodOptional<z.ZodString>;
37
+ targetType: z.ZodNativeEnum<typeof TargetType>;
38
+ targetId: z.ZodString;
35
39
  trigger: z.ZodObject<{
36
40
  type: z.ZodNativeEnum<typeof NotificationTriggerType>;
37
41
  }, "strip", z.ZodTypeAny, {
@@ -51,23 +55,23 @@ export declare const notificationTemplateSchema: z.ZodObject<{
51
55
  userId: string & {
52
56
  readonly __brand: "UserId";
53
57
  };
54
- entityType: NotificationEntityType;
58
+ targetType: TargetType;
59
+ targetId: string;
55
60
  trigger: {
56
61
  type: NotificationTriggerType;
57
62
  };
58
63
  active: boolean;
59
- entityId?: string | undefined;
60
64
  }, {
61
65
  _id: string;
62
66
  createdAt: Date;
63
67
  updatedAt: Date;
64
68
  userId: string;
65
- entityType: NotificationEntityType;
69
+ targetType: TargetType;
70
+ targetId: string;
66
71
  trigger: {
67
72
  type: NotificationTriggerType;
68
73
  };
69
74
  active: boolean;
70
- entityId?: string | undefined;
71
75
  }>;
72
76
  export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
73
77
  entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
@@ -81,19 +85,19 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
81
85
  }>;
82
86
  active: z.ZodDefault<z.ZodBoolean>;
83
87
  }, "strip", z.ZodTypeAny, {
84
- entityType: NotificationEntityType;
85
88
  trigger: {
86
89
  type: NotificationTriggerType;
87
90
  };
88
91
  active: boolean;
92
+ entityType: NotificationEntityType;
89
93
  entityId?: string | undefined;
90
94
  }, {
91
- entityType: NotificationEntityType;
92
95
  trigger: {
93
96
  type: NotificationTriggerType;
94
97
  };
95
- entityId?: string | undefined;
98
+ entityType: NotificationEntityType;
96
99
  active?: boolean | undefined;
100
+ entityId?: string | undefined;
97
101
  }>;
98
102
  export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
99
103
  trigger: z.ZodOptional<z.ZodObject<{
@@ -1,8 +1,13 @@
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.NotificationParentType = exports.TargetType = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const id_types_1 = require("./id-types");
6
+ var TargetType;
7
+ (function (TargetType) {
8
+ TargetType["PARENT"] = "parent";
9
+ TargetType["ENTITY"] = "entity";
10
+ })(TargetType || (exports.TargetType = TargetType = {}));
6
11
  var NotificationParentType;
7
12
  (function (NotificationParentType) {
8
13
  NotificationParentType["AGENDA_PANEL"] = "agenda_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.126",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -9,6 +9,11 @@ export interface NotificationContext<T = any> {
9
9
  userId: string;
10
10
  }
11
11
 
12
+ export enum TargetType {
13
+ PARENT = 'parent',
14
+ ENTITY = 'entity'
15
+ }
16
+
12
17
  export enum NotificationParentType {
13
18
  AGENDA_PANEL = 'agenda_panel',
14
19
  }
@@ -34,8 +39,10 @@ export const notificationTriggerSchema = z.object({
34
39
  export const notificationTemplateSchema = z.object({
35
40
  _id: notificationTemplateIdSchema,
36
41
  userId: userIdSchema,
37
- entityType: z.nativeEnum(NotificationEntityType),
38
- entityId: z.string().optional(),
42
+ targetType: z.nativeEnum(TargetType),
43
+ targetId: z.string(),
44
+ // entityType: z.nativeEnum(NotificationEntityType),
45
+ // entityId: z.string().optional(),
39
46
  trigger: notificationTriggerSchema,
40
47
  active: z.boolean(),
41
48
  createdAt: z.date(),