@timothyw/pat-common 1.0.149 → 1.0.150

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.
@@ -0,0 +1,10 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Read(//Users/timothy/Documents/_development/webstorm-projects/pat-app/src/**)",
5
+ "Read(//Users/timothy/Documents/_development/webstorm-projects/pat-app/**)"
6
+ ],
7
+ "deny": [],
8
+ "ask": []
9
+ }
10
+ }
@@ -26,8 +26,9 @@ export declare enum NotificationSchedulerType {
26
26
  RELATIVE_DATE = "relative_date"
27
27
  }
28
28
  export declare enum NotificationVariantType {
29
- AGENDA_ITEM_UPCOMING_DEADLINE = "agenda_item_upcoming_deadline",
30
- HABIT_INCOMPLETE = "habit_incomplete"
29
+ AGENDA_ITEM_DUE = "agenda_item_due",
30
+ HABIT_TIMED_REMINDER = "habit_timed_reminder",
31
+ HABIT_DUE = "habit_due"
31
32
  }
32
33
  export declare const ENTITY_TYPE_VARIANT_MAP: Record<NotificationEntityType, NotificationVariantType[]>;
33
34
  export declare const notificationSchedulerDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
@@ -52,6 +53,25 @@ export declare const notificationSchedulerDataSchema: z.ZodDiscriminatedUnion<"t
52
53
  type: NotificationSchedulerType.RELATIVE_DATE;
53
54
  offsetMinutes: number;
54
55
  }>]>;
56
+ export declare const notificationVariantDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
57
+ type: z.ZodLiteral<NotificationVariantType.AGENDA_ITEM_DUE>;
58
+ }, "strip", z.ZodTypeAny, {
59
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
60
+ }, {
61
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
62
+ }>, z.ZodObject<{
63
+ type: z.ZodLiteral<NotificationVariantType.HABIT_TIMED_REMINDER>;
64
+ }, "strip", z.ZodTypeAny, {
65
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
66
+ }, {
67
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
68
+ }>, z.ZodObject<{
69
+ type: z.ZodLiteral<NotificationVariantType.HABIT_DUE>;
70
+ }, "strip", z.ZodTypeAny, {
71
+ type: NotificationVariantType.HABIT_DUE;
72
+ }, {
73
+ type: NotificationVariantType.HABIT_DUE;
74
+ }>]>;
55
75
  export declare const notificationTemplateSchema: z.ZodObject<{
56
76
  _id: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
57
77
  userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
@@ -80,7 +100,25 @@ export declare const notificationTemplateSchema: z.ZodObject<{
80
100
  type: NotificationSchedulerType.RELATIVE_DATE;
81
101
  offsetMinutes: number;
82
102
  }>]>;
83
- variantData: z.ZodAny;
103
+ variantData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
104
+ type: z.ZodLiteral<NotificationVariantType.AGENDA_ITEM_DUE>;
105
+ }, "strip", z.ZodTypeAny, {
106
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
107
+ }, {
108
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
109
+ }>, z.ZodObject<{
110
+ type: z.ZodLiteral<NotificationVariantType.HABIT_TIMED_REMINDER>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
113
+ }, {
114
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
115
+ }>, z.ZodObject<{
116
+ type: z.ZodLiteral<NotificationVariantType.HABIT_DUE>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ type: NotificationVariantType.HABIT_DUE;
119
+ }, {
120
+ type: NotificationVariantType.HABIT_DUE;
121
+ }>]>;
84
122
  active: z.ZodBoolean;
85
123
  createdAt: z.ZodDate;
86
124
  updatedAt: z.ZodDate;
@@ -104,8 +142,14 @@ export declare const notificationTemplateSchema: z.ZodObject<{
104
142
  type: NotificationSchedulerType.RELATIVE_DATE;
105
143
  offsetMinutes: number;
106
144
  };
145
+ variantData: {
146
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
147
+ } | {
148
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
149
+ } | {
150
+ type: NotificationVariantType.HABIT_DUE;
151
+ };
107
152
  active: boolean;
108
- variantData?: any;
109
153
  }, {
110
154
  _id: string;
111
155
  createdAt: Date;
@@ -122,8 +166,14 @@ export declare const notificationTemplateSchema: z.ZodObject<{
122
166
  type: NotificationSchedulerType.RELATIVE_DATE;
123
167
  offsetMinutes: number;
124
168
  };
169
+ variantData: {
170
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
171
+ } | {
172
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
173
+ } | {
174
+ type: NotificationVariantType.HABIT_DUE;
175
+ };
125
176
  active: boolean;
126
- variantData?: any;
127
177
  }>;
128
178
  export declare const notificationDesyncSchema: z.ZodObject<{
129
179
  _id: z.ZodEffects<z.ZodString, import("./id-types").NotificationSyncId, string>;
@@ -174,7 +224,25 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
174
224
  type: NotificationSchedulerType.RELATIVE_DATE;
175
225
  offsetMinutes: number;
176
226
  }>]>;
177
- variantData: z.ZodAny;
227
+ variantData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
228
+ type: z.ZodLiteral<NotificationVariantType.AGENDA_ITEM_DUE>;
229
+ }, "strip", z.ZodTypeAny, {
230
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
231
+ }, {
232
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
233
+ }>, z.ZodObject<{
234
+ type: z.ZodLiteral<NotificationVariantType.HABIT_TIMED_REMINDER>;
235
+ }, "strip", z.ZodTypeAny, {
236
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
237
+ }, {
238
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
239
+ }>, z.ZodObject<{
240
+ type: z.ZodLiteral<NotificationVariantType.HABIT_DUE>;
241
+ }, "strip", z.ZodTypeAny, {
242
+ type: NotificationVariantType.HABIT_DUE;
243
+ }, {
244
+ type: NotificationVariantType.HABIT_DUE;
245
+ }>]>;
178
246
  active: z.ZodDefault<z.ZodBoolean>;
179
247
  }, "strip", z.ZodTypeAny, {
180
248
  targetLevel: NotificationTemplateLevel;
@@ -187,9 +255,15 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
187
255
  type: NotificationSchedulerType.RELATIVE_DATE;
188
256
  offsetMinutes: number;
189
257
  };
258
+ variantData: {
259
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
260
+ } | {
261
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
262
+ } | {
263
+ type: NotificationVariantType.HABIT_DUE;
264
+ };
190
265
  active: boolean;
191
266
  targetId?: string | undefined;
192
- variantData?: any;
193
267
  }, {
194
268
  targetLevel: NotificationTemplateLevel;
195
269
  targetEntityType: NotificationEntityType;
@@ -201,8 +275,14 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
201
275
  type: NotificationSchedulerType.RELATIVE_DATE;
202
276
  offsetMinutes: number;
203
277
  };
278
+ variantData: {
279
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
280
+ } | {
281
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
282
+ } | {
283
+ type: NotificationVariantType.HABIT_DUE;
284
+ };
204
285
  targetId?: string | undefined;
205
- variantData?: any;
206
286
  active?: boolean | undefined;
207
287
  }>;
208
288
  export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
@@ -228,7 +308,25 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
228
308
  type: NotificationSchedulerType.RELATIVE_DATE;
229
309
  offsetMinutes: number;
230
310
  }>]>>;
231
- variantData: z.ZodOptional<z.ZodAny>;
311
+ variantData: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
312
+ type: z.ZodLiteral<NotificationVariantType.AGENDA_ITEM_DUE>;
313
+ }, "strip", z.ZodTypeAny, {
314
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
315
+ }, {
316
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
317
+ }>, z.ZodObject<{
318
+ type: z.ZodLiteral<NotificationVariantType.HABIT_TIMED_REMINDER>;
319
+ }, "strip", z.ZodTypeAny, {
320
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
321
+ }, {
322
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
323
+ }>, z.ZodObject<{
324
+ type: z.ZodLiteral<NotificationVariantType.HABIT_DUE>;
325
+ }, "strip", z.ZodTypeAny, {
326
+ type: NotificationVariantType.HABIT_DUE;
327
+ }, {
328
+ type: NotificationVariantType.HABIT_DUE;
329
+ }>]>>;
232
330
  active: z.ZodOptional<z.ZodBoolean>;
233
331
  }, "strip", z.ZodTypeAny, {
234
332
  schedulerData?: {
@@ -239,7 +337,13 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
239
337
  type: NotificationSchedulerType.RELATIVE_DATE;
240
338
  offsetMinutes: number;
241
339
  } | undefined;
242
- variantData?: any;
340
+ variantData?: {
341
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
342
+ } | {
343
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
344
+ } | {
345
+ type: NotificationVariantType.HABIT_DUE;
346
+ } | undefined;
243
347
  active?: boolean | undefined;
244
348
  }, {
245
349
  schedulerData?: {
@@ -250,7 +354,13 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
250
354
  type: NotificationSchedulerType.RELATIVE_DATE;
251
355
  offsetMinutes: number;
252
356
  } | undefined;
253
- variantData?: any;
357
+ variantData?: {
358
+ type: NotificationVariantType.AGENDA_ITEM_DUE;
359
+ } | {
360
+ type: NotificationVariantType.HABIT_TIMED_REMINDER;
361
+ } | {
362
+ type: NotificationVariantType.HABIT_DUE;
363
+ } | undefined;
254
364
  active?: boolean | undefined;
255
365
  }>;
256
366
  export declare const getEntitySyncRequestSchema: z.ZodObject<{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setEntitySyncRequestSchema = exports.getEntitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationDesyncSchema = exports.notificationTemplateSchema = exports.notificationSchedulerDataSchema = exports.ENTITY_TYPE_VARIANT_MAP = exports.NotificationVariantType = exports.NotificationSchedulerType = exports.NotificationEntityType = exports.NotificationTemplateLevel = exports.NotificationTemplateSyncState = void 0;
3
+ exports.setEntitySyncRequestSchema = exports.getEntitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationDesyncSchema = exports.notificationTemplateSchema = exports.notificationVariantDataSchema = exports.notificationSchedulerDataSchema = exports.ENTITY_TYPE_VARIANT_MAP = exports.NotificationVariantType = exports.NotificationSchedulerType = exports.NotificationEntityType = exports.NotificationTemplateLevel = exports.NotificationTemplateSyncState = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const id_types_1 = require("./id-types");
6
6
  var NotificationTemplateSyncState;
@@ -28,15 +28,17 @@ var NotificationSchedulerType;
28
28
  })(NotificationSchedulerType || (exports.NotificationSchedulerType = NotificationSchedulerType = {}));
29
29
  var NotificationVariantType;
30
30
  (function (NotificationVariantType) {
31
- NotificationVariantType["AGENDA_ITEM_UPCOMING_DEADLINE"] = "agenda_item_upcoming_deadline";
32
- NotificationVariantType["HABIT_INCOMPLETE"] = "habit_incomplete";
31
+ NotificationVariantType["AGENDA_ITEM_DUE"] = "agenda_item_due";
32
+ NotificationVariantType["HABIT_TIMED_REMINDER"] = "habit_timed_reminder";
33
+ NotificationVariantType["HABIT_DUE"] = "habit_due";
33
34
  })(NotificationVariantType || (exports.NotificationVariantType = NotificationVariantType = {}));
34
35
  exports.ENTITY_TYPE_VARIANT_MAP = {
35
36
  [NotificationEntityType.AGENDA_ITEM]: [
36
- NotificationVariantType.AGENDA_ITEM_UPCOMING_DEADLINE,
37
+ NotificationVariantType.AGENDA_ITEM_DUE,
37
38
  ],
38
39
  [NotificationEntityType.HABIT]: [
39
- NotificationVariantType.HABIT_INCOMPLETE,
40
+ NotificationVariantType.HABIT_TIMED_REMINDER,
41
+ NotificationVariantType.HABIT_DUE,
40
42
  ],
41
43
  [NotificationEntityType.AGENDA_PANEL]: [],
42
44
  [NotificationEntityType.INBOX_PANEL]: [],
@@ -52,6 +54,17 @@ exports.notificationSchedulerDataSchema = zod_1.z.discriminatedUnion('type', [
52
54
  offsetMinutes: zod_1.z.number().int()
53
55
  })
54
56
  ]);
57
+ exports.notificationVariantDataSchema = zod_1.z.discriminatedUnion('type', [
58
+ zod_1.z.object({
59
+ type: zod_1.z.literal(NotificationVariantType.AGENDA_ITEM_DUE),
60
+ }),
61
+ zod_1.z.object({
62
+ type: zod_1.z.literal(NotificationVariantType.HABIT_TIMED_REMINDER),
63
+ }),
64
+ zod_1.z.object({
65
+ type: zod_1.z.literal(NotificationVariantType.HABIT_DUE),
66
+ })
67
+ ]);
55
68
  exports.notificationTemplateSchema = zod_1.z.object({
56
69
  _id: id_types_1.notificationTemplateIdSchema,
57
70
  userId: id_types_1.userIdSchema,
@@ -59,7 +72,7 @@ exports.notificationTemplateSchema = zod_1.z.object({
59
72
  targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
60
73
  targetId: zod_1.z.string(),
61
74
  schedulerData: exports.notificationSchedulerDataSchema,
62
- variantData: zod_1.z.any(),
75
+ variantData: exports.notificationVariantDataSchema,
63
76
  active: zod_1.z.boolean(),
64
77
  createdAt: zod_1.z.date(),
65
78
  updatedAt: zod_1.z.date()
@@ -76,12 +89,12 @@ exports.createNotificationTemplateRequestSchema = zod_1.z.object({
76
89
  targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
77
90
  targetId: zod_1.z.string().optional(),
78
91
  schedulerData: exports.notificationSchedulerDataSchema,
79
- variantData: zod_1.z.any(),
92
+ variantData: exports.notificationVariantDataSchema,
80
93
  active: zod_1.z.boolean().default(true)
81
94
  });
82
95
  exports.updateNotificationTemplateRequestSchema = zod_1.z.object({
83
96
  schedulerData: exports.notificationSchedulerDataSchema.optional(),
84
- variantData: zod_1.z.any().optional(),
97
+ variantData: exports.notificationVariantDataSchema.optional(),
85
98
  active: zod_1.z.boolean().optional()
86
99
  });
87
100
  exports.getEntitySyncRequestSchema = zod_1.z.object({
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.149",
5
+ "version": "1.0.150",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -34,16 +34,18 @@ export enum NotificationSchedulerType {
34
34
  }
35
35
 
36
36
  export enum NotificationVariantType {
37
- AGENDA_ITEM_UPCOMING_DEADLINE = 'agenda_item_upcoming_deadline',
38
- HABIT_INCOMPLETE = 'habit_incomplete',
37
+ AGENDA_ITEM_DUE = 'agenda_item_due',
38
+ HABIT_TIMED_REMINDER = 'habit_timed_reminder',
39
+ HABIT_DUE = 'habit_due',
39
40
  }
40
41
 
41
42
  export const ENTITY_TYPE_VARIANT_MAP: Record<NotificationEntityType, NotificationVariantType[]> = {
42
43
  [NotificationEntityType.AGENDA_ITEM]: [
43
- NotificationVariantType.AGENDA_ITEM_UPCOMING_DEADLINE,
44
+ NotificationVariantType.AGENDA_ITEM_DUE,
44
45
  ],
45
46
  [NotificationEntityType.HABIT]: [
46
- NotificationVariantType.HABIT_INCOMPLETE,
47
+ NotificationVariantType.HABIT_TIMED_REMINDER,
48
+ NotificationVariantType.HABIT_DUE,
47
49
  ],
48
50
  [NotificationEntityType.AGENDA_PANEL]: [],
49
51
  [NotificationEntityType.INBOX_PANEL]: [],
@@ -59,7 +61,19 @@ export const notificationSchedulerDataSchema = z.discriminatedUnion('type', [
59
61
  type: z.literal(NotificationSchedulerType.RELATIVE_DATE),
60
62
  offsetMinutes: z.number().int()
61
63
  })
62
- ])
64
+ ]);
65
+
66
+ export const notificationVariantDataSchema = z.discriminatedUnion('type', [
67
+ z.object({
68
+ type: z.literal(NotificationVariantType.AGENDA_ITEM_DUE),
69
+ }),
70
+ z.object({
71
+ type: z.literal(NotificationVariantType.HABIT_TIMED_REMINDER),
72
+ }),
73
+ z.object({
74
+ type: z.literal(NotificationVariantType.HABIT_DUE),
75
+ })
76
+ ]);
63
77
 
64
78
  export const notificationTemplateSchema = z.object({
65
79
  _id: notificationTemplateIdSchema,
@@ -68,7 +82,7 @@ export const notificationTemplateSchema = z.object({
68
82
  targetEntityType: z.nativeEnum(NotificationEntityType),
69
83
  targetId: z.string(),
70
84
  schedulerData: notificationSchedulerDataSchema,
71
- variantData: z.any(),
85
+ variantData: notificationVariantDataSchema,
72
86
  active: z.boolean(),
73
87
  createdAt: z.date(),
74
88
  updatedAt: z.date()
@@ -87,13 +101,13 @@ export const createNotificationTemplateRequestSchema = z.object({
87
101
  targetEntityType: z.nativeEnum(NotificationEntityType),
88
102
  targetId: z.string().optional(),
89
103
  schedulerData: notificationSchedulerDataSchema,
90
- variantData: z.any(),
104
+ variantData: notificationVariantDataSchema,
91
105
  active: z.boolean().default(true)
92
106
  });
93
107
 
94
108
  export const updateNotificationTemplateRequestSchema = z.object({
95
109
  schedulerData: notificationSchedulerDataSchema.optional(),
96
- variantData: z.any().optional(),
110
+ variantData: notificationVariantDataSchema.optional(),
97
111
  active: z.boolean().optional()
98
112
  });
99
113