@timothyw/pat-common 1.0.127 → 1.0.129

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,11 +6,9 @@ export interface NotificationContext<T = any> {
6
6
  entityData: T;
7
7
  userId: string;
8
8
  }
9
- export declare enum TargetType {
9
+ export declare enum NotificationTemplateLevel {
10
10
  PARENT = "parent",
11
- INBOX_PANEL = "inbox_panel",
12
- AGENDA_PANEL = "agenda_item",
13
- AGENDA_ITEM = "agenda_item"
11
+ ENTITY = "entity"
14
12
  }
15
13
  export declare enum NotificationEntityType {
16
14
  INBOX_PANEL = "inbox_panel",
@@ -33,7 +31,8 @@ export declare const notificationTriggerSchema: z.ZodObject<{
33
31
  export declare const notificationTemplateSchema: z.ZodObject<{
34
32
  _id: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
35
33
  userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
36
- targetType: z.ZodNativeEnum<typeof TargetType>;
34
+ targetLevel: z.ZodNativeEnum<typeof NotificationTemplateLevel>;
35
+ targetEntityType: z.ZodNativeEnum<typeof NotificationEntityType>;
37
36
  targetId: z.ZodString;
38
37
  trigger: z.ZodObject<{
39
38
  type: z.ZodNativeEnum<typeof NotificationTriggerType>;
@@ -54,7 +53,8 @@ export declare const notificationTemplateSchema: z.ZodObject<{
54
53
  userId: string & {
55
54
  readonly __brand: "UserId";
56
55
  };
57
- targetType: TargetType;
56
+ targetLevel: NotificationTemplateLevel;
57
+ targetEntityType: NotificationEntityType;
58
58
  targetId: string;
59
59
  trigger: {
60
60
  type: NotificationTriggerType;
@@ -65,7 +65,8 @@ export declare const notificationTemplateSchema: z.ZodObject<{
65
65
  createdAt: Date;
66
66
  updatedAt: Date;
67
67
  userId: string;
68
- targetType: TargetType;
68
+ targetLevel: NotificationTemplateLevel;
69
+ targetEntityType: NotificationEntityType;
69
70
  targetId: string;
70
71
  trigger: {
71
72
  type: NotificationTriggerType;
@@ -1,17 +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.TargetType = void 0;
3
+ exports.getEntitySyncRequestSchema = exports.entitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationTemplateSchema = exports.notificationTriggerSchema = exports.notificationTriggerTypeSchema = exports.NotificationTriggerType = exports.NotificationEntityType = exports.NotificationTemplateLevel = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const id_types_1 = require("./id-types");
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
6
+ var NotificationTemplateLevel;
7
+ (function (NotificationTemplateLevel) {
8
+ NotificationTemplateLevel["PARENT"] = "parent";
9
+ NotificationTemplateLevel["ENTITY"] = "entity";
10
+ })(NotificationTemplateLevel || (exports.NotificationTemplateLevel = NotificationTemplateLevel = {}));
15
11
  var NotificationEntityType;
16
12
  (function (NotificationEntityType) {
17
13
  NotificationEntityType["INBOX_PANEL"] = "inbox_panel";
@@ -31,7 +27,8 @@ exports.notificationTriggerSchema = zod_1.z.object({
31
27
  exports.notificationTemplateSchema = zod_1.z.object({
32
28
  _id: id_types_1.notificationTemplateIdSchema,
33
29
  userId: id_types_1.userIdSchema,
34
- targetType: zod_1.z.nativeEnum(TargetType),
30
+ targetLevel: zod_1.z.nativeEnum(NotificationTemplateLevel),
31
+ targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
35
32
  targetId: zod_1.z.string(),
36
33
  // entityType: z.nativeEnum(NotificationEntityType),
37
34
  // entityId: z.string().optional(),
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.127",
5
+ "version": "1.0.129",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -9,16 +9,11 @@ export interface NotificationContext<T = any> {
9
9
  userId: string;
10
10
  }
11
11
 
12
- // should always include all values from NotificationEntityType
13
- export enum TargetType {
12
+ export enum NotificationTemplateLevel {
14
13
  PARENT = 'parent',
15
-
16
- INBOX_PANEL = 'inbox_panel',
17
- AGENDA_PANEL = 'agenda_item',
18
- AGENDA_ITEM = 'agenda_item',
14
+ ENTITY = 'entity'
19
15
  }
20
16
 
21
- // update TargetType after modifying
22
17
  export enum NotificationEntityType {
23
18
  INBOX_PANEL = 'inbox_panel',
24
19
  AGENDA_PANEL = 'agenda_item',
@@ -40,7 +35,8 @@ export const notificationTriggerSchema = z.object({
40
35
  export const notificationTemplateSchema = z.object({
41
36
  _id: notificationTemplateIdSchema,
42
37
  userId: userIdSchema,
43
- targetType: z.nativeEnum(TargetType),
38
+ targetLevel: z.nativeEnum(NotificationTemplateLevel),
39
+ targetEntityType: z.nativeEnum(NotificationEntityType),
44
40
  targetId: z.string(),
45
41
  // entityType: z.nativeEnum(NotificationEntityType),
46
42
  // entityId: z.string().optional(),