@timothyw/pat-common 1.0.132 → 1.0.134

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.
@@ -15,32 +15,35 @@ export declare enum NotificationEntityType {
15
15
  AGENDA_PANEL = "agenda_item",
16
16
  INBOX_PANEL = "inbox_panel"
17
17
  }
18
- export declare enum NotificationTriggerType {
18
+ export declare enum NotificationSchedulerType {
19
19
  DAY_TIME = "day_time",
20
20
  RELATIVE_DATE = "relative_date"
21
21
  }
22
+ export declare enum NotificationVariantType {
23
+ AGENDA_ITEM_UPCOMING_DEADLINE = "agenda_item_upcoming_deadline"
24
+ }
22
25
  export declare const notificationSchedulerDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
23
- type: z.ZodLiteral<NotificationTriggerType.DAY_TIME>;
26
+ type: z.ZodLiteral<NotificationSchedulerType.DAY_TIME>;
24
27
  days: z.ZodArray<z.ZodNumber, "many">;
25
28
  time: z.ZodString;
26
29
  }, "strip", z.ZodTypeAny, {
27
- type: NotificationTriggerType.DAY_TIME;
30
+ type: NotificationSchedulerType.DAY_TIME;
28
31
  days: number[];
29
32
  time: string;
30
33
  }, {
31
- type: NotificationTriggerType.DAY_TIME;
34
+ type: NotificationSchedulerType.DAY_TIME;
32
35
  days: number[];
33
36
  time: string;
34
37
  }>, z.ZodObject<{
35
- type: z.ZodLiteral<NotificationTriggerType.RELATIVE_DATE>;
38
+ type: z.ZodLiteral<NotificationSchedulerType.RELATIVE_DATE>;
36
39
  date: z.ZodString;
37
40
  offsetMinutes: z.ZodNumber;
38
41
  }, "strip", z.ZodTypeAny, {
39
- type: NotificationTriggerType.RELATIVE_DATE;
42
+ type: NotificationSchedulerType.RELATIVE_DATE;
40
43
  date: string;
41
44
  offsetMinutes: number;
42
45
  }, {
43
- type: NotificationTriggerType.RELATIVE_DATE;
46
+ type: NotificationSchedulerType.RELATIVE_DATE;
44
47
  date: string;
45
48
  offsetMinutes: number;
46
49
  }>]>;
@@ -51,31 +54,31 @@ export declare const notificationTemplateSchema: z.ZodObject<{
51
54
  targetEntityType: z.ZodNativeEnum<typeof NotificationEntityType>;
52
55
  targetId: z.ZodString;
53
56
  schedulerData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
54
- type: z.ZodLiteral<NotificationTriggerType.DAY_TIME>;
57
+ type: z.ZodLiteral<NotificationSchedulerType.DAY_TIME>;
55
58
  days: z.ZodArray<z.ZodNumber, "many">;
56
59
  time: z.ZodString;
57
60
  }, "strip", z.ZodTypeAny, {
58
- type: NotificationTriggerType.DAY_TIME;
61
+ type: NotificationSchedulerType.DAY_TIME;
59
62
  days: number[];
60
63
  time: string;
61
64
  }, {
62
- type: NotificationTriggerType.DAY_TIME;
65
+ type: NotificationSchedulerType.DAY_TIME;
63
66
  days: number[];
64
67
  time: string;
65
68
  }>, z.ZodObject<{
66
- type: z.ZodLiteral<NotificationTriggerType.RELATIVE_DATE>;
69
+ type: z.ZodLiteral<NotificationSchedulerType.RELATIVE_DATE>;
67
70
  date: z.ZodString;
68
71
  offsetMinutes: z.ZodNumber;
69
72
  }, "strip", z.ZodTypeAny, {
70
- type: NotificationTriggerType.RELATIVE_DATE;
73
+ type: NotificationSchedulerType.RELATIVE_DATE;
71
74
  date: string;
72
75
  offsetMinutes: number;
73
76
  }, {
74
- type: NotificationTriggerType.RELATIVE_DATE;
77
+ type: NotificationSchedulerType.RELATIVE_DATE;
75
78
  date: string;
76
79
  offsetMinutes: number;
77
80
  }>]>;
78
- variantData: z.ZodOptional<z.ZodAny>;
81
+ variantData: z.ZodAny;
79
82
  active: z.ZodBoolean;
80
83
  createdAt: z.ZodDate;
81
84
  updatedAt: z.ZodDate;
@@ -92,11 +95,11 @@ export declare const notificationTemplateSchema: z.ZodObject<{
92
95
  targetEntityType: NotificationEntityType;
93
96
  targetId: string;
94
97
  schedulerData: {
95
- type: NotificationTriggerType.DAY_TIME;
98
+ type: NotificationSchedulerType.DAY_TIME;
96
99
  days: number[];
97
100
  time: string;
98
101
  } | {
99
- type: NotificationTriggerType.RELATIVE_DATE;
102
+ type: NotificationSchedulerType.RELATIVE_DATE;
100
103
  date: string;
101
104
  offsetMinutes: number;
102
105
  };
@@ -111,11 +114,11 @@ export declare const notificationTemplateSchema: z.ZodObject<{
111
114
  targetEntityType: NotificationEntityType;
112
115
  targetId: string;
113
116
  schedulerData: {
114
- type: NotificationTriggerType.DAY_TIME;
117
+ type: NotificationSchedulerType.DAY_TIME;
115
118
  days: number[];
116
119
  time: string;
117
120
  } | {
118
- type: NotificationTriggerType.RELATIVE_DATE;
121
+ type: NotificationSchedulerType.RELATIVE_DATE;
119
122
  date: string;
120
123
  offsetMinutes: number;
121
124
  };
@@ -127,41 +130,41 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
127
130
  targetEntityType: z.ZodNativeEnum<typeof NotificationEntityType>;
128
131
  targetId: z.ZodOptional<z.ZodString>;
129
132
  schedulerData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
130
- type: z.ZodLiteral<NotificationTriggerType.DAY_TIME>;
133
+ type: z.ZodLiteral<NotificationSchedulerType.DAY_TIME>;
131
134
  days: z.ZodArray<z.ZodNumber, "many">;
132
135
  time: z.ZodString;
133
136
  }, "strip", z.ZodTypeAny, {
134
- type: NotificationTriggerType.DAY_TIME;
137
+ type: NotificationSchedulerType.DAY_TIME;
135
138
  days: number[];
136
139
  time: string;
137
140
  }, {
138
- type: NotificationTriggerType.DAY_TIME;
141
+ type: NotificationSchedulerType.DAY_TIME;
139
142
  days: number[];
140
143
  time: string;
141
144
  }>, z.ZodObject<{
142
- type: z.ZodLiteral<NotificationTriggerType.RELATIVE_DATE>;
145
+ type: z.ZodLiteral<NotificationSchedulerType.RELATIVE_DATE>;
143
146
  date: z.ZodString;
144
147
  offsetMinutes: z.ZodNumber;
145
148
  }, "strip", z.ZodTypeAny, {
146
- type: NotificationTriggerType.RELATIVE_DATE;
149
+ type: NotificationSchedulerType.RELATIVE_DATE;
147
150
  date: string;
148
151
  offsetMinutes: number;
149
152
  }, {
150
- type: NotificationTriggerType.RELATIVE_DATE;
153
+ type: NotificationSchedulerType.RELATIVE_DATE;
151
154
  date: string;
152
155
  offsetMinutes: number;
153
156
  }>]>;
154
- variantData: z.ZodOptional<z.ZodAny>;
157
+ variantData: z.ZodAny;
155
158
  active: z.ZodDefault<z.ZodBoolean>;
156
159
  }, "strip", z.ZodTypeAny, {
157
160
  targetLevel: NotificationTemplateLevel;
158
161
  targetEntityType: NotificationEntityType;
159
162
  schedulerData: {
160
- type: NotificationTriggerType.DAY_TIME;
163
+ type: NotificationSchedulerType.DAY_TIME;
161
164
  days: number[];
162
165
  time: string;
163
166
  } | {
164
- type: NotificationTriggerType.RELATIVE_DATE;
167
+ type: NotificationSchedulerType.RELATIVE_DATE;
165
168
  date: string;
166
169
  offsetMinutes: number;
167
170
  };
@@ -172,11 +175,11 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
172
175
  targetLevel: NotificationTemplateLevel;
173
176
  targetEntityType: NotificationEntityType;
174
177
  schedulerData: {
175
- type: NotificationTriggerType.DAY_TIME;
178
+ type: NotificationSchedulerType.DAY_TIME;
176
179
  days: number[];
177
180
  time: string;
178
181
  } | {
179
- type: NotificationTriggerType.RELATIVE_DATE;
182
+ type: NotificationSchedulerType.RELATIVE_DATE;
180
183
  date: string;
181
184
  offsetMinutes: number;
182
185
  };
@@ -185,55 +188,55 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
185
188
  active?: boolean | undefined;
186
189
  }>;
187
190
  export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
188
- schedulerData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
189
- type: z.ZodLiteral<NotificationTriggerType.DAY_TIME>;
191
+ schedulerData: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
192
+ type: z.ZodLiteral<NotificationSchedulerType.DAY_TIME>;
190
193
  days: z.ZodArray<z.ZodNumber, "many">;
191
194
  time: z.ZodString;
192
195
  }, "strip", z.ZodTypeAny, {
193
- type: NotificationTriggerType.DAY_TIME;
196
+ type: NotificationSchedulerType.DAY_TIME;
194
197
  days: number[];
195
198
  time: string;
196
199
  }, {
197
- type: NotificationTriggerType.DAY_TIME;
200
+ type: NotificationSchedulerType.DAY_TIME;
198
201
  days: number[];
199
202
  time: string;
200
203
  }>, z.ZodObject<{
201
- type: z.ZodLiteral<NotificationTriggerType.RELATIVE_DATE>;
204
+ type: z.ZodLiteral<NotificationSchedulerType.RELATIVE_DATE>;
202
205
  date: z.ZodString;
203
206
  offsetMinutes: z.ZodNumber;
204
207
  }, "strip", z.ZodTypeAny, {
205
- type: NotificationTriggerType.RELATIVE_DATE;
208
+ type: NotificationSchedulerType.RELATIVE_DATE;
206
209
  date: string;
207
210
  offsetMinutes: number;
208
211
  }, {
209
- type: NotificationTriggerType.RELATIVE_DATE;
212
+ type: NotificationSchedulerType.RELATIVE_DATE;
210
213
  date: string;
211
214
  offsetMinutes: number;
212
- }>]>;
215
+ }>]>>;
213
216
  variantData: z.ZodOptional<z.ZodAny>;
214
217
  active: z.ZodOptional<z.ZodBoolean>;
215
218
  }, "strip", z.ZodTypeAny, {
216
- schedulerData: {
217
- type: NotificationTriggerType.DAY_TIME;
219
+ schedulerData?: {
220
+ type: NotificationSchedulerType.DAY_TIME;
218
221
  days: number[];
219
222
  time: string;
220
223
  } | {
221
- type: NotificationTriggerType.RELATIVE_DATE;
224
+ type: NotificationSchedulerType.RELATIVE_DATE;
222
225
  date: string;
223
226
  offsetMinutes: number;
224
- };
227
+ } | undefined;
225
228
  variantData?: any;
226
229
  active?: boolean | undefined;
227
230
  }, {
228
- schedulerData: {
229
- type: NotificationTriggerType.DAY_TIME;
231
+ schedulerData?: {
232
+ type: NotificationSchedulerType.DAY_TIME;
230
233
  days: number[];
231
234
  time: string;
232
235
  } | {
233
- type: NotificationTriggerType.RELATIVE_DATE;
236
+ type: NotificationSchedulerType.RELATIVE_DATE;
234
237
  date: string;
235
238
  offsetMinutes: number;
236
- };
239
+ } | undefined;
237
240
  variantData?: any;
238
241
  active?: boolean | undefined;
239
242
  }>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getEntitySyncRequestSchema = exports.entitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationTemplateSchema = exports.notificationSchedulerDataSchema = exports.NotificationTriggerType = exports.NotificationEntityType = exports.NotificationTemplateLevel = void 0;
3
+ exports.getEntitySyncRequestSchema = exports.entitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationTemplateSchema = exports.notificationSchedulerDataSchema = exports.NotificationVariantType = exports.NotificationSchedulerType = exports.NotificationEntityType = exports.NotificationTemplateLevel = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const id_types_1 = require("./id-types");
6
6
  var NotificationTemplateLevel;
@@ -14,19 +14,23 @@ var NotificationEntityType;
14
14
  NotificationEntityType["AGENDA_PANEL"] = "agenda_item";
15
15
  NotificationEntityType["INBOX_PANEL"] = "inbox_panel";
16
16
  })(NotificationEntityType || (exports.NotificationEntityType = NotificationEntityType = {}));
17
- var NotificationTriggerType;
18
- (function (NotificationTriggerType) {
19
- NotificationTriggerType["DAY_TIME"] = "day_time";
20
- NotificationTriggerType["RELATIVE_DATE"] = "relative_date";
21
- })(NotificationTriggerType || (exports.NotificationTriggerType = NotificationTriggerType = {}));
17
+ var NotificationSchedulerType;
18
+ (function (NotificationSchedulerType) {
19
+ NotificationSchedulerType["DAY_TIME"] = "day_time";
20
+ NotificationSchedulerType["RELATIVE_DATE"] = "relative_date";
21
+ })(NotificationSchedulerType || (exports.NotificationSchedulerType = NotificationSchedulerType = {}));
22
+ var NotificationVariantType;
23
+ (function (NotificationVariantType) {
24
+ NotificationVariantType["AGENDA_ITEM_UPCOMING_DEADLINE"] = "agenda_item_upcoming_deadline";
25
+ })(NotificationVariantType || (exports.NotificationVariantType = NotificationVariantType = {}));
22
26
  exports.notificationSchedulerDataSchema = zod_1.z.discriminatedUnion('type', [
23
27
  zod_1.z.object({
24
- type: zod_1.z.literal(NotificationTriggerType.DAY_TIME),
28
+ type: zod_1.z.literal(NotificationSchedulerType.DAY_TIME),
25
29
  days: zod_1.z.array(zod_1.z.number().min(0).max(6)),
26
30
  time: zod_1.z.string().regex(/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/), // HH:mm format
27
31
  }),
28
32
  zod_1.z.object({
29
- type: zod_1.z.literal(NotificationTriggerType.RELATIVE_DATE),
33
+ type: zod_1.z.literal(NotificationSchedulerType.RELATIVE_DATE),
30
34
  date: zod_1.z.string(),
31
35
  offsetMinutes: zod_1.z.number().int()
32
36
  })
@@ -38,7 +42,7 @@ exports.notificationTemplateSchema = zod_1.z.object({
38
42
  targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
39
43
  targetId: zod_1.z.string(),
40
44
  schedulerData: exports.notificationSchedulerDataSchema,
41
- variantData: zod_1.z.any().optional(),
45
+ variantData: zod_1.z.any(),
42
46
  active: zod_1.z.boolean(),
43
47
  createdAt: zod_1.z.date(),
44
48
  updatedAt: zod_1.z.date()
@@ -48,11 +52,11 @@ exports.createNotificationTemplateRequestSchema = zod_1.z.object({
48
52
  targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
49
53
  targetId: zod_1.z.string().optional(),
50
54
  schedulerData: exports.notificationSchedulerDataSchema,
51
- variantData: zod_1.z.any().optional(),
55
+ variantData: zod_1.z.any(),
52
56
  active: zod_1.z.boolean().default(true)
53
57
  });
54
58
  exports.updateNotificationTemplateRequestSchema = zod_1.z.object({
55
- schedulerData: exports.notificationSchedulerDataSchema,
59
+ schedulerData: exports.notificationSchedulerDataSchema.optional(),
56
60
  variantData: zod_1.z.any().optional(),
57
61
  active: zod_1.z.boolean().optional()
58
62
  });
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.132",
5
+ "version": "1.0.134",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -21,19 +21,23 @@ export enum NotificationEntityType {
21
21
  INBOX_PANEL = 'inbox_panel',
22
22
  }
23
23
 
24
- export enum NotificationTriggerType {
24
+ export enum NotificationSchedulerType {
25
25
  DAY_TIME = 'day_time',
26
26
  RELATIVE_DATE = 'relative_date',
27
27
  }
28
28
 
29
+ export enum NotificationVariantType {
30
+ AGENDA_ITEM_UPCOMING_DEADLINE = 'agenda_item_upcoming_deadline',
31
+ }
32
+
29
33
  export const notificationSchedulerDataSchema = z.discriminatedUnion('type', [
30
34
  z.object({
31
- type: z.literal(NotificationTriggerType.DAY_TIME),
35
+ type: z.literal(NotificationSchedulerType.DAY_TIME),
32
36
  days: z.array(z.number().min(0).max(6)),
33
37
  time: z.string().regex(/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/), // HH:mm format
34
38
  }),
35
39
  z.object({
36
- type: z.literal(NotificationTriggerType.RELATIVE_DATE),
40
+ type: z.literal(NotificationSchedulerType.RELATIVE_DATE),
37
41
  date: z.string(),
38
42
  offsetMinutes: z.number().int()
39
43
  })
@@ -46,7 +50,7 @@ export const notificationTemplateSchema = z.object({
46
50
  targetEntityType: z.nativeEnum(NotificationEntityType),
47
51
  targetId: z.string(),
48
52
  schedulerData: notificationSchedulerDataSchema,
49
- variantData: z.any().optional(),
53
+ variantData: z.any(),
50
54
  active: z.boolean(),
51
55
  createdAt: z.date(),
52
56
  updatedAt: z.date()
@@ -57,12 +61,12 @@ export const createNotificationTemplateRequestSchema = z.object({
57
61
  targetEntityType: z.nativeEnum(NotificationEntityType),
58
62
  targetId: z.string().optional(),
59
63
  schedulerData: notificationSchedulerDataSchema,
60
- variantData: z.any().optional(),
64
+ variantData: z.any(),
61
65
  active: z.boolean().default(true)
62
66
  });
63
67
 
64
68
  export const updateNotificationTemplateRequestSchema = z.object({
65
- schedulerData: notificationSchedulerDataSchema,
69
+ schedulerData: notificationSchedulerDataSchema.optional(),
66
70
  variantData: z.any().optional(),
67
71
  active: z.boolean().optional()
68
72
  });