@timothyw/pat-common 1.0.131 → 1.0.132
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.
|
@@ -16,31 +16,66 @@ export declare enum NotificationEntityType {
|
|
|
16
16
|
INBOX_PANEL = "inbox_panel"
|
|
17
17
|
}
|
|
18
18
|
export declare enum NotificationTriggerType {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
RECURRING = "recurring"
|
|
19
|
+
DAY_TIME = "day_time",
|
|
20
|
+
RELATIVE_DATE = "relative_date"
|
|
22
21
|
}
|
|
23
|
-
export declare const
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
export declare const notificationSchedulerDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<NotificationTriggerType.DAY_TIME>;
|
|
24
|
+
days: z.ZodArray<z.ZodNumber, "many">;
|
|
25
|
+
time: z.ZodString;
|
|
26
26
|
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
type: NotificationTriggerType;
|
|
27
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
28
|
+
days: number[];
|
|
29
|
+
time: string;
|
|
28
30
|
}, {
|
|
29
|
-
type: NotificationTriggerType;
|
|
30
|
-
|
|
31
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
32
|
+
days: number[];
|
|
33
|
+
time: string;
|
|
34
|
+
}>, z.ZodObject<{
|
|
35
|
+
type: z.ZodLiteral<NotificationTriggerType.RELATIVE_DATE>;
|
|
36
|
+
date: z.ZodString;
|
|
37
|
+
offsetMinutes: z.ZodNumber;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
40
|
+
date: string;
|
|
41
|
+
offsetMinutes: number;
|
|
42
|
+
}, {
|
|
43
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
44
|
+
date: string;
|
|
45
|
+
offsetMinutes: number;
|
|
46
|
+
}>]>;
|
|
31
47
|
export declare const notificationTemplateSchema: z.ZodObject<{
|
|
32
48
|
_id: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
|
|
33
49
|
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
34
50
|
targetLevel: z.ZodNativeEnum<typeof NotificationTemplateLevel>;
|
|
35
51
|
targetEntityType: z.ZodNativeEnum<typeof NotificationEntityType>;
|
|
36
52
|
targetId: z.ZodString;
|
|
37
|
-
|
|
38
|
-
type: z.
|
|
53
|
+
schedulerData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<NotificationTriggerType.DAY_TIME>;
|
|
55
|
+
days: z.ZodArray<z.ZodNumber, "many">;
|
|
56
|
+
time: z.ZodString;
|
|
39
57
|
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
type: NotificationTriggerType;
|
|
58
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
59
|
+
days: number[];
|
|
60
|
+
time: string;
|
|
41
61
|
}, {
|
|
42
|
-
type: NotificationTriggerType;
|
|
43
|
-
|
|
62
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
63
|
+
days: number[];
|
|
64
|
+
time: string;
|
|
65
|
+
}>, z.ZodObject<{
|
|
66
|
+
type: z.ZodLiteral<NotificationTriggerType.RELATIVE_DATE>;
|
|
67
|
+
date: z.ZodString;
|
|
68
|
+
offsetMinutes: z.ZodNumber;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
71
|
+
date: string;
|
|
72
|
+
offsetMinutes: number;
|
|
73
|
+
}, {
|
|
74
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
75
|
+
date: string;
|
|
76
|
+
offsetMinutes: number;
|
|
77
|
+
}>]>;
|
|
78
|
+
variantData: z.ZodOptional<z.ZodAny>;
|
|
44
79
|
active: z.ZodBoolean;
|
|
45
80
|
createdAt: z.ZodDate;
|
|
46
81
|
updatedAt: z.ZodDate;
|
|
@@ -56,10 +91,17 @@ export declare const notificationTemplateSchema: z.ZodObject<{
|
|
|
56
91
|
targetLevel: NotificationTemplateLevel;
|
|
57
92
|
targetEntityType: NotificationEntityType;
|
|
58
93
|
targetId: string;
|
|
59
|
-
|
|
60
|
-
type: NotificationTriggerType;
|
|
94
|
+
schedulerData: {
|
|
95
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
96
|
+
days: number[];
|
|
97
|
+
time: string;
|
|
98
|
+
} | {
|
|
99
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
100
|
+
date: string;
|
|
101
|
+
offsetMinutes: number;
|
|
61
102
|
};
|
|
62
103
|
active: boolean;
|
|
104
|
+
variantData?: any;
|
|
63
105
|
}, {
|
|
64
106
|
_id: string;
|
|
65
107
|
createdAt: Date;
|
|
@@ -68,58 +110,131 @@ export declare const notificationTemplateSchema: z.ZodObject<{
|
|
|
68
110
|
targetLevel: NotificationTemplateLevel;
|
|
69
111
|
targetEntityType: NotificationEntityType;
|
|
70
112
|
targetId: string;
|
|
71
|
-
|
|
72
|
-
type: NotificationTriggerType;
|
|
113
|
+
schedulerData: {
|
|
114
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
115
|
+
days: number[];
|
|
116
|
+
time: string;
|
|
117
|
+
} | {
|
|
118
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
119
|
+
date: string;
|
|
120
|
+
offsetMinutes: number;
|
|
73
121
|
};
|
|
74
122
|
active: boolean;
|
|
123
|
+
variantData?: any;
|
|
75
124
|
}>;
|
|
76
125
|
export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
|
|
77
126
|
targetLevel: z.ZodNativeEnum<typeof NotificationTemplateLevel>;
|
|
78
127
|
targetEntityType: z.ZodNativeEnum<typeof NotificationEntityType>;
|
|
79
128
|
targetId: z.ZodOptional<z.ZodString>;
|
|
80
|
-
|
|
81
|
-
type: z.
|
|
129
|
+
schedulerData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<NotificationTriggerType.DAY_TIME>;
|
|
131
|
+
days: z.ZodArray<z.ZodNumber, "many">;
|
|
132
|
+
time: z.ZodString;
|
|
82
133
|
}, "strip", z.ZodTypeAny, {
|
|
83
|
-
type: NotificationTriggerType;
|
|
134
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
135
|
+
days: number[];
|
|
136
|
+
time: string;
|
|
84
137
|
}, {
|
|
85
|
-
type: NotificationTriggerType;
|
|
86
|
-
|
|
138
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
139
|
+
days: number[];
|
|
140
|
+
time: string;
|
|
141
|
+
}>, z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<NotificationTriggerType.RELATIVE_DATE>;
|
|
143
|
+
date: z.ZodString;
|
|
144
|
+
offsetMinutes: z.ZodNumber;
|
|
145
|
+
}, "strip", z.ZodTypeAny, {
|
|
146
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
147
|
+
date: string;
|
|
148
|
+
offsetMinutes: number;
|
|
149
|
+
}, {
|
|
150
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
151
|
+
date: string;
|
|
152
|
+
offsetMinutes: number;
|
|
153
|
+
}>]>;
|
|
154
|
+
variantData: z.ZodOptional<z.ZodAny>;
|
|
87
155
|
active: z.ZodDefault<z.ZodBoolean>;
|
|
88
156
|
}, "strip", z.ZodTypeAny, {
|
|
89
157
|
targetLevel: NotificationTemplateLevel;
|
|
90
158
|
targetEntityType: NotificationEntityType;
|
|
91
|
-
|
|
92
|
-
type: NotificationTriggerType;
|
|
159
|
+
schedulerData: {
|
|
160
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
161
|
+
days: number[];
|
|
162
|
+
time: string;
|
|
163
|
+
} | {
|
|
164
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
165
|
+
date: string;
|
|
166
|
+
offsetMinutes: number;
|
|
93
167
|
};
|
|
94
168
|
active: boolean;
|
|
95
169
|
targetId?: string | undefined;
|
|
170
|
+
variantData?: any;
|
|
96
171
|
}, {
|
|
97
172
|
targetLevel: NotificationTemplateLevel;
|
|
98
173
|
targetEntityType: NotificationEntityType;
|
|
99
|
-
|
|
100
|
-
type: NotificationTriggerType;
|
|
174
|
+
schedulerData: {
|
|
175
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
176
|
+
days: number[];
|
|
177
|
+
time: string;
|
|
178
|
+
} | {
|
|
179
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
180
|
+
date: string;
|
|
181
|
+
offsetMinutes: number;
|
|
101
182
|
};
|
|
102
183
|
targetId?: string | undefined;
|
|
184
|
+
variantData?: any;
|
|
103
185
|
active?: boolean | undefined;
|
|
104
186
|
}>;
|
|
105
187
|
export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
|
|
106
|
-
|
|
107
|
-
type: z.
|
|
188
|
+
schedulerData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
189
|
+
type: z.ZodLiteral<NotificationTriggerType.DAY_TIME>;
|
|
190
|
+
days: z.ZodArray<z.ZodNumber, "many">;
|
|
191
|
+
time: z.ZodString;
|
|
192
|
+
}, "strip", z.ZodTypeAny, {
|
|
193
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
194
|
+
days: number[];
|
|
195
|
+
time: string;
|
|
196
|
+
}, {
|
|
197
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
198
|
+
days: number[];
|
|
199
|
+
time: string;
|
|
200
|
+
}>, z.ZodObject<{
|
|
201
|
+
type: z.ZodLiteral<NotificationTriggerType.RELATIVE_DATE>;
|
|
202
|
+
date: z.ZodString;
|
|
203
|
+
offsetMinutes: z.ZodNumber;
|
|
108
204
|
}, "strip", z.ZodTypeAny, {
|
|
109
|
-
type: NotificationTriggerType;
|
|
205
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
206
|
+
date: string;
|
|
207
|
+
offsetMinutes: number;
|
|
110
208
|
}, {
|
|
111
|
-
type: NotificationTriggerType;
|
|
112
|
-
|
|
209
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
210
|
+
date: string;
|
|
211
|
+
offsetMinutes: number;
|
|
212
|
+
}>]>;
|
|
213
|
+
variantData: z.ZodOptional<z.ZodAny>;
|
|
113
214
|
active: z.ZodOptional<z.ZodBoolean>;
|
|
114
215
|
}, "strip", z.ZodTypeAny, {
|
|
115
|
-
|
|
116
|
-
type: NotificationTriggerType;
|
|
117
|
-
|
|
216
|
+
schedulerData: {
|
|
217
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
218
|
+
days: number[];
|
|
219
|
+
time: string;
|
|
220
|
+
} | {
|
|
221
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
222
|
+
date: string;
|
|
223
|
+
offsetMinutes: number;
|
|
224
|
+
};
|
|
225
|
+
variantData?: any;
|
|
118
226
|
active?: boolean | undefined;
|
|
119
227
|
}, {
|
|
120
|
-
|
|
121
|
-
type: NotificationTriggerType;
|
|
122
|
-
|
|
228
|
+
schedulerData: {
|
|
229
|
+
type: NotificationTriggerType.DAY_TIME;
|
|
230
|
+
days: number[];
|
|
231
|
+
time: string;
|
|
232
|
+
} | {
|
|
233
|
+
type: NotificationTriggerType.RELATIVE_DATE;
|
|
234
|
+
date: string;
|
|
235
|
+
offsetMinutes: number;
|
|
236
|
+
};
|
|
237
|
+
variantData?: any;
|
|
123
238
|
active?: boolean | undefined;
|
|
124
239
|
}>;
|
|
125
240
|
export declare const entitySyncRequestSchema: z.ZodObject<{
|
|
@@ -145,7 +260,7 @@ export declare const getEntitySyncRequestSchema: z.ZodObject<{
|
|
|
145
260
|
targetEntityType: NotificationEntityType;
|
|
146
261
|
targetId: string;
|
|
147
262
|
}>;
|
|
148
|
-
export type NotificationTrigger = z.infer<typeof
|
|
263
|
+
export type NotificationTrigger = z.infer<typeof notificationSchedulerDataSchema>;
|
|
149
264
|
export type NotificationTemplateData = z.infer<typeof notificationTemplateSchema>;
|
|
150
265
|
export type CreateNotificationTemplateRequest = z.infer<typeof createNotificationTemplateRequestSchema>;
|
|
151
266
|
export type UpdateNotificationTemplateRequest = z.infer<typeof updateNotificationTemplateRequestSchema>;
|
|
@@ -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.
|
|
3
|
+
exports.getEntitySyncRequestSchema = exports.entitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationTemplateSchema = exports.notificationSchedulerDataSchema = 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
6
|
var NotificationTemplateLevel;
|
|
@@ -16,23 +16,29 @@ var NotificationEntityType;
|
|
|
16
16
|
})(NotificationEntityType || (exports.NotificationEntityType = NotificationEntityType = {}));
|
|
17
17
|
var NotificationTriggerType;
|
|
18
18
|
(function (NotificationTriggerType) {
|
|
19
|
-
NotificationTriggerType["
|
|
20
|
-
NotificationTriggerType["
|
|
21
|
-
NotificationTriggerType["RECURRING"] = "recurring";
|
|
19
|
+
NotificationTriggerType["DAY_TIME"] = "day_time";
|
|
20
|
+
NotificationTriggerType["RELATIVE_DATE"] = "relative_date";
|
|
22
21
|
})(NotificationTriggerType || (exports.NotificationTriggerType = NotificationTriggerType = {}));
|
|
23
|
-
exports.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
exports.notificationSchedulerDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
23
|
+
zod_1.z.object({
|
|
24
|
+
type: zod_1.z.literal(NotificationTriggerType.DAY_TIME),
|
|
25
|
+
days: zod_1.z.array(zod_1.z.number().min(0).max(6)),
|
|
26
|
+
time: zod_1.z.string().regex(/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/), // HH:mm format
|
|
27
|
+
}),
|
|
28
|
+
zod_1.z.object({
|
|
29
|
+
type: zod_1.z.literal(NotificationTriggerType.RELATIVE_DATE),
|
|
30
|
+
date: zod_1.z.string(),
|
|
31
|
+
offsetMinutes: zod_1.z.number().int()
|
|
32
|
+
})
|
|
33
|
+
]);
|
|
27
34
|
exports.notificationTemplateSchema = zod_1.z.object({
|
|
28
35
|
_id: id_types_1.notificationTemplateIdSchema,
|
|
29
36
|
userId: id_types_1.userIdSchema,
|
|
30
37
|
targetLevel: zod_1.z.nativeEnum(NotificationTemplateLevel),
|
|
31
38
|
targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
|
|
32
39
|
targetId: zod_1.z.string(),
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
trigger: exports.notificationTriggerSchema,
|
|
40
|
+
schedulerData: exports.notificationSchedulerDataSchema,
|
|
41
|
+
variantData: zod_1.z.any().optional(),
|
|
36
42
|
active: zod_1.z.boolean(),
|
|
37
43
|
createdAt: zod_1.z.date(),
|
|
38
44
|
updatedAt: zod_1.z.date()
|
|
@@ -41,13 +47,13 @@ exports.createNotificationTemplateRequestSchema = zod_1.z.object({
|
|
|
41
47
|
targetLevel: zod_1.z.nativeEnum(NotificationTemplateLevel),
|
|
42
48
|
targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
|
|
43
49
|
targetId: zod_1.z.string().optional(),
|
|
44
|
-
|
|
50
|
+
schedulerData: exports.notificationSchedulerDataSchema,
|
|
51
|
+
variantData: zod_1.z.any().optional(),
|
|
45
52
|
active: zod_1.z.boolean().default(true)
|
|
46
53
|
});
|
|
47
54
|
exports.updateNotificationTemplateRequestSchema = zod_1.z.object({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}).optional(),
|
|
55
|
+
schedulerData: exports.notificationSchedulerDataSchema,
|
|
56
|
+
variantData: zod_1.z.any().optional(),
|
|
51
57
|
active: zod_1.z.boolean().optional()
|
|
52
58
|
});
|
|
53
59
|
exports.entitySyncRequestSchema = zod_1.z.object({
|
package/package.json
CHANGED
|
@@ -22,16 +22,22 @@ export enum NotificationEntityType {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export enum NotificationTriggerType {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
RECURRING = 'recurring'
|
|
25
|
+
DAY_TIME = 'day_time',
|
|
26
|
+
RELATIVE_DATE = 'relative_date',
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
export const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
export const notificationSchedulerDataSchema = z.discriminatedUnion('type', [
|
|
30
|
+
z.object({
|
|
31
|
+
type: z.literal(NotificationTriggerType.DAY_TIME),
|
|
32
|
+
days: z.array(z.number().min(0).max(6)),
|
|
33
|
+
time: z.string().regex(/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/), // HH:mm format
|
|
34
|
+
}),
|
|
35
|
+
z.object({
|
|
36
|
+
type: z.literal(NotificationTriggerType.RELATIVE_DATE),
|
|
37
|
+
date: z.string(),
|
|
38
|
+
offsetMinutes: z.number().int()
|
|
39
|
+
})
|
|
40
|
+
])
|
|
35
41
|
|
|
36
42
|
export const notificationTemplateSchema = z.object({
|
|
37
43
|
_id: notificationTemplateIdSchema,
|
|
@@ -39,9 +45,8 @@ export const notificationTemplateSchema = z.object({
|
|
|
39
45
|
targetLevel: z.nativeEnum(NotificationTemplateLevel),
|
|
40
46
|
targetEntityType: z.nativeEnum(NotificationEntityType),
|
|
41
47
|
targetId: z.string(),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
trigger: notificationTriggerSchema,
|
|
48
|
+
schedulerData: notificationSchedulerDataSchema,
|
|
49
|
+
variantData: z.any().optional(),
|
|
45
50
|
active: z.boolean(),
|
|
46
51
|
createdAt: z.date(),
|
|
47
52
|
updatedAt: z.date()
|
|
@@ -51,14 +56,14 @@ export const createNotificationTemplateRequestSchema = z.object({
|
|
|
51
56
|
targetLevel: z.nativeEnum(NotificationTemplateLevel),
|
|
52
57
|
targetEntityType: z.nativeEnum(NotificationEntityType),
|
|
53
58
|
targetId: z.string().optional(),
|
|
54
|
-
|
|
59
|
+
schedulerData: notificationSchedulerDataSchema,
|
|
60
|
+
variantData: z.any().optional(),
|
|
55
61
|
active: z.boolean().default(true)
|
|
56
62
|
});
|
|
57
63
|
|
|
58
64
|
export const updateNotificationTemplateRequestSchema = z.object({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}).optional(),
|
|
65
|
+
schedulerData: notificationSchedulerDataSchema,
|
|
66
|
+
variantData: z.any().optional(),
|
|
62
67
|
active: z.boolean().optional()
|
|
63
68
|
});
|
|
64
69
|
|
|
@@ -73,7 +78,7 @@ export const getEntitySyncRequestSchema = z.object({
|
|
|
73
78
|
targetId: z.string()
|
|
74
79
|
});
|
|
75
80
|
|
|
76
|
-
export type NotificationTrigger = z.infer<typeof
|
|
81
|
+
export type NotificationTrigger = z.infer<typeof notificationSchedulerDataSchema>;
|
|
77
82
|
export type NotificationTemplateData = z.infer<typeof notificationTemplateSchema>;
|
|
78
83
|
|
|
79
84
|
export type CreateNotificationTemplateRequest = z.infer<typeof createNotificationTemplateRequestSchema>;
|