@timothyw/pat-common 1.0.154 → 1.0.156

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.
@@ -35,15 +35,15 @@ export declare const ENTITY_TYPE_VARIANT_MAP: Record<NotificationEntityType, Not
35
35
  export declare const notificationSchedulerDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
36
36
  type: z.ZodLiteral<NotificationSchedulerType.DAY_TIME>;
37
37
  days: z.ZodArray<z.ZodNumber, "many">;
38
- time: z.ZodString;
38
+ offsetMinutes: z.ZodNumber;
39
39
  }, "strip", z.ZodTypeAny, {
40
40
  type: NotificationSchedulerType.DAY_TIME;
41
41
  days: number[];
42
- time: string;
42
+ offsetMinutes: number;
43
43
  }, {
44
44
  type: NotificationSchedulerType.DAY_TIME;
45
45
  days: number[];
46
- time: string;
46
+ offsetMinutes: number;
47
47
  }>, z.ZodObject<{
48
48
  type: z.ZodLiteral<NotificationSchedulerType.RELATIVE_DATE>;
49
49
  offsetMinutes: z.ZodNumber;
@@ -82,15 +82,15 @@ export declare const notificationTemplateSchema: z.ZodObject<{
82
82
  schedulerData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
83
83
  type: z.ZodLiteral<NotificationSchedulerType.DAY_TIME>;
84
84
  days: z.ZodArray<z.ZodNumber, "many">;
85
- time: z.ZodString;
85
+ offsetMinutes: z.ZodNumber;
86
86
  }, "strip", z.ZodTypeAny, {
87
87
  type: NotificationSchedulerType.DAY_TIME;
88
88
  days: number[];
89
- time: string;
89
+ offsetMinutes: number;
90
90
  }, {
91
91
  type: NotificationSchedulerType.DAY_TIME;
92
92
  days: number[];
93
- time: string;
93
+ offsetMinutes: number;
94
94
  }>, z.ZodObject<{
95
95
  type: z.ZodLiteral<NotificationSchedulerType.RELATIVE_DATE>;
96
96
  offsetMinutes: z.ZodNumber;
@@ -138,7 +138,7 @@ export declare const notificationTemplateSchema: z.ZodObject<{
138
138
  schedulerData: {
139
139
  type: NotificationSchedulerType.DAY_TIME;
140
140
  days: number[];
141
- time: string;
141
+ offsetMinutes: number;
142
142
  } | {
143
143
  type: NotificationSchedulerType.RELATIVE_DATE;
144
144
  offsetMinutes: number;
@@ -162,7 +162,7 @@ export declare const notificationTemplateSchema: z.ZodObject<{
162
162
  schedulerData: {
163
163
  type: NotificationSchedulerType.DAY_TIME;
164
164
  days: number[];
165
- time: string;
165
+ offsetMinutes: number;
166
166
  } | {
167
167
  type: NotificationSchedulerType.RELATIVE_DATE;
168
168
  offsetMinutes: number;
@@ -176,29 +176,6 @@ export declare const notificationTemplateSchema: z.ZodObject<{
176
176
  };
177
177
  active: boolean;
178
178
  }>;
179
- export declare const notificationDesyncSchema: z.ZodObject<{
180
- _id: z.ZodEffects<z.ZodString, import("./id-types").NotificationSyncId, string>;
181
- userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
182
- targetId: z.ZodString;
183
- createdAt: z.ZodDate;
184
- updatedAt: z.ZodDate;
185
- }, "strip", z.ZodTypeAny, {
186
- _id: string & {
187
- readonly __brand: "NotificationSyncId";
188
- };
189
- createdAt: Date;
190
- updatedAt: Date;
191
- userId: string & {
192
- readonly __brand: "UserId";
193
- };
194
- targetId: string;
195
- }, {
196
- _id: string;
197
- createdAt: Date;
198
- updatedAt: Date;
199
- userId: string;
200
- targetId: string;
201
- }>;
202
179
  export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
203
180
  targetLevel: z.ZodNativeEnum<typeof NotificationTemplateLevel>;
204
181
  targetEntityType: z.ZodNativeEnum<typeof NotificationEntityType>;
@@ -206,15 +183,15 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
206
183
  schedulerData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
207
184
  type: z.ZodLiteral<NotificationSchedulerType.DAY_TIME>;
208
185
  days: z.ZodArray<z.ZodNumber, "many">;
209
- time: z.ZodString;
186
+ offsetMinutes: z.ZodNumber;
210
187
  }, "strip", z.ZodTypeAny, {
211
188
  type: NotificationSchedulerType.DAY_TIME;
212
189
  days: number[];
213
- time: string;
190
+ offsetMinutes: number;
214
191
  }, {
215
192
  type: NotificationSchedulerType.DAY_TIME;
216
193
  days: number[];
217
- time: string;
194
+ offsetMinutes: number;
218
195
  }>, z.ZodObject<{
219
196
  type: z.ZodLiteral<NotificationSchedulerType.RELATIVE_DATE>;
220
197
  offsetMinutes: z.ZodNumber;
@@ -251,7 +228,7 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
251
228
  schedulerData: {
252
229
  type: NotificationSchedulerType.DAY_TIME;
253
230
  days: number[];
254
- time: string;
231
+ offsetMinutes: number;
255
232
  } | {
256
233
  type: NotificationSchedulerType.RELATIVE_DATE;
257
234
  offsetMinutes: number;
@@ -271,7 +248,7 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
271
248
  schedulerData: {
272
249
  type: NotificationSchedulerType.DAY_TIME;
273
250
  days: number[];
274
- time: string;
251
+ offsetMinutes: number;
275
252
  } | {
276
253
  type: NotificationSchedulerType.RELATIVE_DATE;
277
254
  offsetMinutes: number;
@@ -290,15 +267,15 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
290
267
  schedulerData: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
291
268
  type: z.ZodLiteral<NotificationSchedulerType.DAY_TIME>;
292
269
  days: z.ZodArray<z.ZodNumber, "many">;
293
- time: z.ZodString;
270
+ offsetMinutes: z.ZodNumber;
294
271
  }, "strip", z.ZodTypeAny, {
295
272
  type: NotificationSchedulerType.DAY_TIME;
296
273
  days: number[];
297
- time: string;
274
+ offsetMinutes: number;
298
275
  }, {
299
276
  type: NotificationSchedulerType.DAY_TIME;
300
277
  days: number[];
301
- time: string;
278
+ offsetMinutes: number;
302
279
  }>, z.ZodObject<{
303
280
  type: z.ZodLiteral<NotificationSchedulerType.RELATIVE_DATE>;
304
281
  offsetMinutes: z.ZodNumber;
@@ -333,7 +310,7 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
333
310
  schedulerData?: {
334
311
  type: NotificationSchedulerType.DAY_TIME;
335
312
  days: number[];
336
- time: string;
313
+ offsetMinutes: number;
337
314
  } | {
338
315
  type: NotificationSchedulerType.RELATIVE_DATE;
339
316
  offsetMinutes: number;
@@ -350,7 +327,7 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
350
327
  schedulerData?: {
351
328
  type: NotificationSchedulerType.DAY_TIME;
352
329
  days: number[];
353
- time: string;
330
+ offsetMinutes: number;
354
331
  } | {
355
332
  type: NotificationSchedulerType.RELATIVE_DATE;
356
333
  offsetMinutes: number;
@@ -364,33 +341,56 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
364
341
  } | undefined;
365
342
  active?: boolean | undefined;
366
343
  }>;
344
+ export declare const notificationEntityDesyncSchema: z.ZodObject<{
345
+ _id: z.ZodEffects<z.ZodString, import("./id-types").NotificationSyncId, string>;
346
+ userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
347
+ entityId: z.ZodString;
348
+ createdAt: z.ZodDate;
349
+ updatedAt: z.ZodDate;
350
+ }, "strip", z.ZodTypeAny, {
351
+ _id: string & {
352
+ readonly __brand: "NotificationSyncId";
353
+ };
354
+ createdAt: Date;
355
+ updatedAt: Date;
356
+ userId: string & {
357
+ readonly __brand: "UserId";
358
+ };
359
+ entityId: string;
360
+ }, {
361
+ _id: string;
362
+ createdAt: Date;
363
+ updatedAt: Date;
364
+ userId: string;
365
+ entityId: string;
366
+ }>;
367
367
  export declare const getEntitySyncRequestSchema: z.ZodObject<{
368
- targetEntityType: z.ZodNativeEnum<typeof NotificationEntityType>;
369
- targetId: z.ZodString;
368
+ entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
369
+ entityId: z.ZodString;
370
370
  }, "strip", z.ZodTypeAny, {
371
- targetEntityType: NotificationEntityType;
372
- targetId: string;
371
+ entityId: string;
372
+ entityType: NotificationEntityType;
373
373
  }, {
374
- targetEntityType: NotificationEntityType;
375
- targetId: string;
374
+ entityId: string;
375
+ entityType: NotificationEntityType;
376
376
  }>;
377
377
  export declare const setEntitySyncRequestSchema: z.ZodObject<{
378
- targetEntityType: z.ZodNativeEnum<typeof NotificationEntityType>;
379
- targetId: z.ZodString;
378
+ entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
379
+ entityId: z.ZodString;
380
380
  synced: z.ZodBoolean;
381
381
  }, "strip", z.ZodTypeAny, {
382
382
  synced: boolean;
383
- targetEntityType: NotificationEntityType;
384
- targetId: string;
383
+ entityId: string;
384
+ entityType: NotificationEntityType;
385
385
  }, {
386
386
  synced: boolean;
387
- targetEntityType: NotificationEntityType;
388
- targetId: string;
387
+ entityId: string;
388
+ entityType: NotificationEntityType;
389
389
  }>;
390
390
  export type NotificationTemplateData = z.infer<typeof notificationTemplateSchema>;
391
- export type NotificationDesyncData = z.infer<typeof notificationDesyncSchema>;
392
391
  export type CreateNotificationTemplateRequest = z.infer<typeof createNotificationTemplateRequestSchema>;
393
392
  export type UpdateNotificationTemplateRequest = z.infer<typeof updateNotificationTemplateRequestSchema>;
393
+ export type NotificationDesyncData = z.infer<typeof notificationEntityDesyncSchema>;
394
394
  export type GetEntitySyncRequest = z.infer<typeof getEntitySyncRequestSchema>;
395
395
  export type SetEntitySyncRequest = z.infer<typeof setEntitySyncRequestSchema>;
396
396
  export interface CreateNotificationTemplateResponse {
@@ -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.notificationVariantDataSchema = 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.notificationEntityDesyncSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = 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;
@@ -49,7 +49,7 @@ exports.notificationSchedulerDataSchema = zod_1.z.discriminatedUnion('type', [
49
49
  zod_1.z.object({
50
50
  type: zod_1.z.literal(NotificationSchedulerType.DAY_TIME),
51
51
  days: zod_1.z.array(zod_1.z.number().min(0).max(6)),
52
- time: zod_1.z.string().regex(/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/), // HH:mm format
52
+ offsetMinutes: zod_1.z.number().int()
53
53
  }),
54
54
  zod_1.z.object({
55
55
  type: zod_1.z.literal(NotificationSchedulerType.RELATIVE_DATE),
@@ -79,13 +79,6 @@ exports.notificationTemplateSchema = zod_1.z.object({
79
79
  createdAt: zod_1.z.date(),
80
80
  updatedAt: zod_1.z.date()
81
81
  });
82
- exports.notificationDesyncSchema = zod_1.z.object({
83
- _id: id_types_1.notificationDesyncIdSchema,
84
- userId: id_types_1.userIdSchema,
85
- targetId: zod_1.z.string(),
86
- createdAt: zod_1.z.date(),
87
- updatedAt: zod_1.z.date()
88
- });
89
82
  exports.createNotificationTemplateRequestSchema = zod_1.z.object({
90
83
  targetLevel: zod_1.z.nativeEnum(NotificationTemplateLevel),
91
84
  targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
@@ -99,12 +92,19 @@ exports.updateNotificationTemplateRequestSchema = zod_1.z.object({
99
92
  variantData: exports.notificationVariantDataSchema.optional(),
100
93
  active: zod_1.z.boolean().optional()
101
94
  });
95
+ exports.notificationEntityDesyncSchema = zod_1.z.object({
96
+ _id: id_types_1.notificationDesyncIdSchema,
97
+ userId: id_types_1.userIdSchema,
98
+ entityId: zod_1.z.string(),
99
+ createdAt: zod_1.z.date(),
100
+ updatedAt: zod_1.z.date()
101
+ });
102
102
  exports.getEntitySyncRequestSchema = zod_1.z.object({
103
- targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
104
- targetId: zod_1.z.string()
103
+ entityType: zod_1.z.nativeEnum(NotificationEntityType),
104
+ entityId: zod_1.z.string()
105
105
  });
106
106
  exports.setEntitySyncRequestSchema = zod_1.z.object({
107
- targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
108
- targetId: zod_1.z.string(),
107
+ entityType: zod_1.z.nativeEnum(NotificationEntityType),
108
+ entityId: zod_1.z.string(),
109
109
  synced: zod_1.z.boolean()
110
110
  });
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.154",
5
+ "version": "1.0.156",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -57,7 +57,7 @@ export const notificationSchedulerDataSchema = z.discriminatedUnion('type', [
57
57
  z.object({
58
58
  type: z.literal(NotificationSchedulerType.DAY_TIME),
59
59
  days: z.array(z.number().min(0).max(6)),
60
- time: z.string().regex(/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/), // HH:mm format
60
+ offsetMinutes: z.number().int()
61
61
  }),
62
62
  z.object({
63
63
  type: z.literal(NotificationSchedulerType.RELATIVE_DATE),
@@ -90,14 +90,6 @@ export const notificationTemplateSchema = z.object({
90
90
  updatedAt: z.date()
91
91
  });
92
92
 
93
- export const notificationDesyncSchema = z.object({
94
- _id: notificationDesyncIdSchema,
95
- userId: userIdSchema,
96
- targetId: z.string(),
97
- createdAt: z.date(),
98
- updatedAt: z.date()
99
- });
100
-
101
93
  export const createNotificationTemplateRequestSchema = z.object({
102
94
  targetLevel: z.nativeEnum(NotificationTemplateLevel),
103
95
  targetEntityType: z.nativeEnum(NotificationEntityType),
@@ -113,23 +105,31 @@ export const updateNotificationTemplateRequestSchema = z.object({
113
105
  active: z.boolean().optional()
114
106
  });
115
107
 
108
+ export const notificationEntityDesyncSchema = z.object({
109
+ _id: notificationDesyncIdSchema,
110
+ userId: userIdSchema,
111
+ entityId: z.string(),
112
+ createdAt: z.date(),
113
+ updatedAt: z.date()
114
+ });
115
+
116
116
  export const getEntitySyncRequestSchema = z.object({
117
- targetEntityType: z.nativeEnum(NotificationEntityType),
118
- targetId: z.string()
117
+ entityType: z.nativeEnum(NotificationEntityType),
118
+ entityId: z.string()
119
119
  });
120
120
 
121
121
  export const setEntitySyncRequestSchema = z.object({
122
- targetEntityType: z.nativeEnum(NotificationEntityType),
123
- targetId: z.string(),
122
+ entityType: z.nativeEnum(NotificationEntityType),
123
+ entityId: z.string(),
124
124
  synced: z.boolean()
125
125
  });
126
126
 
127
127
  export type NotificationTemplateData = z.infer<typeof notificationTemplateSchema>;
128
- export type NotificationDesyncData = z.infer<typeof notificationDesyncSchema>;
129
-
130
128
  export type CreateNotificationTemplateRequest = z.infer<typeof createNotificationTemplateRequestSchema>;
131
129
  export type UpdateNotificationTemplateRequest = z.infer<typeof updateNotificationTemplateRequestSchema>;
132
130
 
131
+ export type NotificationDesyncData = z.infer<typeof notificationEntityDesyncSchema>;
132
+
133
133
  export type GetEntitySyncRequest = z.infer<typeof getEntitySyncRequestSchema>;
134
134
  export type SetEntitySyncRequest = z.infer<typeof setEntitySyncRequestSchema>;
135
135