@timothyw/pat-common 1.0.123 → 1.0.125
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.
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/notification-entity-registry.d.ts +0 -77
- package/dist/notification-entity-registry.js +0 -211
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/types/notifications-types.d.ts +14 -368
- package/dist/types/notifications-types.js +6 -95
- package/package.json +1 -1
- package/src/index.ts +1 -2
- package/src/types/index.ts +2 -2
- package/src/types/notifications-types.ts +6 -129
- package/src/notification-entity-registry.ts +0 -241
- package/src/types/notification-entity-config.ts +0 -78
|
@@ -2,93 +2,42 @@ import { z } from 'zod';
|
|
|
2
2
|
import { Serialized } from '../utils';
|
|
3
3
|
export interface NotificationContext<T = any> {
|
|
4
4
|
entityId: string;
|
|
5
|
-
entityType:
|
|
5
|
+
entityType: NotificationEntityType;
|
|
6
6
|
entityData: T;
|
|
7
7
|
userId: string;
|
|
8
|
-
variables: Record<string, any>;
|
|
9
8
|
}
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated Use string types with NotificationEntityRegistry instead
|
|
12
|
-
* These enums are kept for backward compatibility during migration
|
|
13
|
-
*/
|
|
14
9
|
export declare enum NotificationParentType {
|
|
15
10
|
AGENDA_PANEL = "agenda_panel"
|
|
16
11
|
}
|
|
17
|
-
/**
|
|
18
|
-
* @deprecated Use string types with NotificationEntityRegistry instead
|
|
19
|
-
* These enums are kept for backward compatibility during migration
|
|
20
|
-
*/
|
|
21
12
|
export declare enum NotificationEntityType {
|
|
22
13
|
INBOX_PANEL = "inbox_panel",
|
|
23
|
-
AGENDA_PANEL = "
|
|
14
|
+
AGENDA_PANEL = "agenda_item",
|
|
24
15
|
AGENDA_ITEM = "agenda_item"
|
|
25
16
|
}
|
|
26
|
-
export declare const notificationEntityTypeSchema: z.ZodString;
|
|
27
|
-
export declare enum NotificationStatus {
|
|
28
|
-
SCHEDULED = "scheduled",
|
|
29
|
-
SENT = "sent",
|
|
30
|
-
FAILED = "failed",
|
|
31
|
-
CANCELLED = "cancelled"
|
|
32
|
-
}
|
|
33
17
|
export declare enum NotificationTriggerType {
|
|
34
18
|
TIME_BASED = "time_based",
|
|
35
19
|
EVENT_BASED = "event_based",
|
|
36
20
|
RECURRING = "recurring"
|
|
37
21
|
}
|
|
38
|
-
export declare const notificationStatusSchema: z.ZodNativeEnum<typeof NotificationStatus>;
|
|
39
22
|
export declare const notificationTriggerTypeSchema: z.ZodNativeEnum<typeof NotificationTriggerType>;
|
|
40
23
|
export declare const notificationTriggerSchema: z.ZodObject<{
|
|
41
24
|
type: z.ZodNativeEnum<typeof NotificationTriggerType>;
|
|
42
|
-
conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
43
|
-
timing: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
44
25
|
}, "strip", z.ZodTypeAny, {
|
|
45
26
|
type: NotificationTriggerType;
|
|
46
|
-
conditions: Record<string, any>;
|
|
47
|
-
timing: Record<string, any>;
|
|
48
27
|
}, {
|
|
49
28
|
type: NotificationTriggerType;
|
|
50
|
-
conditions: Record<string, any>;
|
|
51
|
-
timing: Record<string, any>;
|
|
52
|
-
}>;
|
|
53
|
-
export declare const notificationContentSchema: z.ZodObject<{
|
|
54
|
-
title: z.ZodString;
|
|
55
|
-
body: z.ZodString;
|
|
56
|
-
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
title: string;
|
|
58
|
-
body: string;
|
|
59
|
-
}, {
|
|
60
|
-
title: string;
|
|
61
|
-
body: string;
|
|
62
29
|
}>;
|
|
63
30
|
export declare const notificationTemplateSchema: z.ZodObject<{
|
|
64
31
|
_id: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
|
|
65
32
|
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
66
|
-
entityType: z.
|
|
33
|
+
entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
|
|
67
34
|
entityId: z.ZodOptional<z.ZodString>;
|
|
68
|
-
name: z.ZodString;
|
|
69
|
-
description: z.ZodOptional<z.ZodString>;
|
|
70
35
|
trigger: z.ZodObject<{
|
|
71
36
|
type: z.ZodNativeEnum<typeof NotificationTriggerType>;
|
|
72
|
-
conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
73
|
-
timing: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
74
37
|
}, "strip", z.ZodTypeAny, {
|
|
75
38
|
type: NotificationTriggerType;
|
|
76
|
-
conditions: Record<string, any>;
|
|
77
|
-
timing: Record<string, any>;
|
|
78
39
|
}, {
|
|
79
40
|
type: NotificationTriggerType;
|
|
80
|
-
conditions: Record<string, any>;
|
|
81
|
-
timing: Record<string, any>;
|
|
82
|
-
}>;
|
|
83
|
-
content: z.ZodObject<{
|
|
84
|
-
title: z.ZodString;
|
|
85
|
-
body: z.ZodString;
|
|
86
|
-
}, "strip", z.ZodTypeAny, {
|
|
87
|
-
title: string;
|
|
88
|
-
body: string;
|
|
89
|
-
}, {
|
|
90
|
-
title: string;
|
|
91
|
-
body: string;
|
|
92
41
|
}>;
|
|
93
42
|
active: z.ZodBoolean;
|
|
94
43
|
createdAt: z.ZodDate;
|
|
@@ -102,385 +51,97 @@ export declare const notificationTemplateSchema: z.ZodObject<{
|
|
|
102
51
|
userId: string & {
|
|
103
52
|
readonly __brand: "UserId";
|
|
104
53
|
};
|
|
105
|
-
|
|
106
|
-
content: {
|
|
107
|
-
title: string;
|
|
108
|
-
body: string;
|
|
109
|
-
};
|
|
110
|
-
entityType: string;
|
|
54
|
+
entityType: NotificationEntityType;
|
|
111
55
|
trigger: {
|
|
112
56
|
type: NotificationTriggerType;
|
|
113
|
-
conditions: Record<string, any>;
|
|
114
|
-
timing: Record<string, any>;
|
|
115
57
|
};
|
|
116
58
|
active: boolean;
|
|
117
|
-
description?: string | undefined;
|
|
118
59
|
entityId?: string | undefined;
|
|
119
60
|
}, {
|
|
120
61
|
_id: string;
|
|
121
62
|
createdAt: Date;
|
|
122
63
|
updatedAt: Date;
|
|
123
64
|
userId: string;
|
|
124
|
-
|
|
125
|
-
content: {
|
|
126
|
-
title: string;
|
|
127
|
-
body: string;
|
|
128
|
-
};
|
|
129
|
-
entityType: string;
|
|
130
|
-
trigger: {
|
|
131
|
-
type: NotificationTriggerType;
|
|
132
|
-
conditions: Record<string, any>;
|
|
133
|
-
timing: Record<string, any>;
|
|
134
|
-
};
|
|
135
|
-
active: boolean;
|
|
136
|
-
description?: string | undefined;
|
|
137
|
-
entityId?: string | undefined;
|
|
138
|
-
}>;
|
|
139
|
-
export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
|
|
140
|
-
_id: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
|
|
141
|
-
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
142
|
-
entityType: z.ZodString;
|
|
143
|
-
entityId: z.ZodOptional<z.ZodString>;
|
|
144
|
-
name: z.ZodString;
|
|
145
|
-
description: z.ZodOptional<z.ZodString>;
|
|
146
|
-
trigger: z.ZodObject<{
|
|
147
|
-
type: z.ZodNativeEnum<typeof NotificationTriggerType>;
|
|
148
|
-
conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
149
|
-
timing: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
150
|
-
}, "strip", z.ZodTypeAny, {
|
|
151
|
-
type: NotificationTriggerType;
|
|
152
|
-
conditions: Record<string, any>;
|
|
153
|
-
timing: Record<string, any>;
|
|
154
|
-
}, {
|
|
155
|
-
type: NotificationTriggerType;
|
|
156
|
-
conditions: Record<string, any>;
|
|
157
|
-
timing: Record<string, any>;
|
|
158
|
-
}>;
|
|
159
|
-
content: z.ZodObject<{
|
|
160
|
-
title: z.ZodString;
|
|
161
|
-
body: z.ZodString;
|
|
162
|
-
}, "strip", z.ZodTypeAny, {
|
|
163
|
-
title: string;
|
|
164
|
-
body: string;
|
|
165
|
-
}, {
|
|
166
|
-
title: string;
|
|
167
|
-
body: string;
|
|
168
|
-
}>;
|
|
169
|
-
active: z.ZodBoolean;
|
|
170
|
-
createdAt: z.ZodDate;
|
|
171
|
-
updatedAt: z.ZodDate;
|
|
172
|
-
}, "_id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
|
|
173
|
-
userId: string & {
|
|
174
|
-
readonly __brand: "UserId";
|
|
175
|
-
};
|
|
176
|
-
name: string;
|
|
177
|
-
content: {
|
|
178
|
-
title: string;
|
|
179
|
-
body: string;
|
|
180
|
-
};
|
|
181
|
-
entityType: string;
|
|
182
|
-
trigger: {
|
|
183
|
-
type: NotificationTriggerType;
|
|
184
|
-
conditions: Record<string, any>;
|
|
185
|
-
timing: Record<string, any>;
|
|
186
|
-
};
|
|
187
|
-
active: boolean;
|
|
188
|
-
description?: string | undefined;
|
|
189
|
-
entityId?: string | undefined;
|
|
190
|
-
}, {
|
|
191
|
-
userId: string;
|
|
192
|
-
name: string;
|
|
193
|
-
content: {
|
|
194
|
-
title: string;
|
|
195
|
-
body: string;
|
|
196
|
-
};
|
|
197
|
-
entityType: string;
|
|
65
|
+
entityType: NotificationEntityType;
|
|
198
66
|
trigger: {
|
|
199
67
|
type: NotificationTriggerType;
|
|
200
|
-
conditions: Record<string, any>;
|
|
201
|
-
timing: Record<string, any>;
|
|
202
68
|
};
|
|
203
69
|
active: boolean;
|
|
204
|
-
description?: string | undefined;
|
|
205
70
|
entityId?: string | undefined;
|
|
206
71
|
}>;
|
|
207
|
-
export declare const entitySyncStateSchema: z.ZodObject<{
|
|
208
|
-
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
209
|
-
entityType: z.ZodString;
|
|
210
|
-
entityId: z.ZodString;
|
|
211
|
-
synced: z.ZodBoolean;
|
|
212
|
-
updatedAt: z.ZodDate;
|
|
213
|
-
}, "strip", z.ZodTypeAny, {
|
|
214
|
-
updatedAt: Date;
|
|
215
|
-
userId: string & {
|
|
216
|
-
readonly __brand: "UserId";
|
|
217
|
-
};
|
|
218
|
-
entityType: string;
|
|
219
|
-
entityId: string;
|
|
220
|
-
synced: boolean;
|
|
221
|
-
}, {
|
|
222
|
-
updatedAt: Date;
|
|
223
|
-
userId: string;
|
|
224
|
-
entityType: string;
|
|
225
|
-
entityId: string;
|
|
226
|
-
synced: boolean;
|
|
227
|
-
}>;
|
|
228
|
-
export declare const notificationInstanceSchema: z.ZodObject<{
|
|
229
|
-
_id: z.ZodEffects<z.ZodString, import("./id-types").NotificationInstanceId, string>;
|
|
230
|
-
templateId: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
|
|
231
|
-
userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
|
|
232
|
-
entityId: z.ZodString;
|
|
233
|
-
scheduledFor: z.ZodDate;
|
|
234
|
-
status: z.ZodNativeEnum<typeof NotificationStatus>;
|
|
235
|
-
sentAt: z.ZodOptional<z.ZodDate>;
|
|
236
|
-
content: z.ZodObject<{
|
|
237
|
-
title: z.ZodString;
|
|
238
|
-
body: z.ZodString;
|
|
239
|
-
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
240
|
-
}, "strip", z.ZodTypeAny, {
|
|
241
|
-
title: string;
|
|
242
|
-
body: string;
|
|
243
|
-
data?: Record<string, any> | undefined;
|
|
244
|
-
}, {
|
|
245
|
-
title: string;
|
|
246
|
-
body: string;
|
|
247
|
-
data?: Record<string, any> | undefined;
|
|
248
|
-
}>;
|
|
249
|
-
redisId: z.ZodString;
|
|
250
|
-
error: z.ZodOptional<z.ZodString>;
|
|
251
|
-
createdAt: z.ZodDate;
|
|
252
|
-
updatedAt: z.ZodDate;
|
|
253
|
-
}, "strip", z.ZodTypeAny, {
|
|
254
|
-
status: NotificationStatus;
|
|
255
|
-
_id: string & {
|
|
256
|
-
readonly __brand: "NotificationInstanceId";
|
|
257
|
-
};
|
|
258
|
-
createdAt: Date;
|
|
259
|
-
updatedAt: Date;
|
|
260
|
-
userId: string & {
|
|
261
|
-
readonly __brand: "UserId";
|
|
262
|
-
};
|
|
263
|
-
content: {
|
|
264
|
-
title: string;
|
|
265
|
-
body: string;
|
|
266
|
-
data?: Record<string, any> | undefined;
|
|
267
|
-
};
|
|
268
|
-
entityId: string;
|
|
269
|
-
templateId: string & {
|
|
270
|
-
readonly __brand: "NotificationTemplateId";
|
|
271
|
-
};
|
|
272
|
-
scheduledFor: Date;
|
|
273
|
-
redisId: string;
|
|
274
|
-
sentAt?: Date | undefined;
|
|
275
|
-
error?: string | undefined;
|
|
276
|
-
}, {
|
|
277
|
-
status: NotificationStatus;
|
|
278
|
-
_id: string;
|
|
279
|
-
createdAt: Date;
|
|
280
|
-
updatedAt: Date;
|
|
281
|
-
userId: string;
|
|
282
|
-
content: {
|
|
283
|
-
title: string;
|
|
284
|
-
body: string;
|
|
285
|
-
data?: Record<string, any> | undefined;
|
|
286
|
-
};
|
|
287
|
-
entityId: string;
|
|
288
|
-
templateId: string;
|
|
289
|
-
scheduledFor: Date;
|
|
290
|
-
redisId: string;
|
|
291
|
-
sentAt?: Date | undefined;
|
|
292
|
-
error?: string | undefined;
|
|
293
|
-
}>;
|
|
294
72
|
export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
|
|
295
|
-
entityType: z.
|
|
73
|
+
entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
|
|
296
74
|
entityId: z.ZodOptional<z.ZodString>;
|
|
297
|
-
name: z.ZodString;
|
|
298
|
-
description: z.ZodOptional<z.ZodString>;
|
|
299
75
|
trigger: z.ZodObject<{
|
|
300
76
|
type: z.ZodNativeEnum<typeof NotificationTriggerType>;
|
|
301
|
-
conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
302
|
-
timing: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
303
77
|
}, "strip", z.ZodTypeAny, {
|
|
304
78
|
type: NotificationTriggerType;
|
|
305
|
-
conditions: Record<string, any>;
|
|
306
|
-
timing: Record<string, any>;
|
|
307
79
|
}, {
|
|
308
80
|
type: NotificationTriggerType;
|
|
309
|
-
conditions: Record<string, any>;
|
|
310
|
-
timing: Record<string, any>;
|
|
311
|
-
}>;
|
|
312
|
-
content: z.ZodObject<{
|
|
313
|
-
title: z.ZodString;
|
|
314
|
-
body: z.ZodString;
|
|
315
|
-
}, "strip", z.ZodTypeAny, {
|
|
316
|
-
title: string;
|
|
317
|
-
body: string;
|
|
318
|
-
}, {
|
|
319
|
-
title: string;
|
|
320
|
-
body: string;
|
|
321
81
|
}>;
|
|
322
82
|
active: z.ZodDefault<z.ZodBoolean>;
|
|
323
83
|
}, "strip", z.ZodTypeAny, {
|
|
324
|
-
|
|
325
|
-
content: {
|
|
326
|
-
title: string;
|
|
327
|
-
body: string;
|
|
328
|
-
};
|
|
329
|
-
entityType: string;
|
|
84
|
+
entityType: NotificationEntityType;
|
|
330
85
|
trigger: {
|
|
331
86
|
type: NotificationTriggerType;
|
|
332
|
-
conditions: Record<string, any>;
|
|
333
|
-
timing: Record<string, any>;
|
|
334
87
|
};
|
|
335
88
|
active: boolean;
|
|
336
|
-
description?: string | undefined;
|
|
337
89
|
entityId?: string | undefined;
|
|
338
90
|
}, {
|
|
339
|
-
|
|
340
|
-
content: {
|
|
341
|
-
title: string;
|
|
342
|
-
body: string;
|
|
343
|
-
};
|
|
344
|
-
entityType: string;
|
|
91
|
+
entityType: NotificationEntityType;
|
|
345
92
|
trigger: {
|
|
346
93
|
type: NotificationTriggerType;
|
|
347
|
-
conditions: Record<string, any>;
|
|
348
|
-
timing: Record<string, any>;
|
|
349
94
|
};
|
|
350
|
-
description?: string | undefined;
|
|
351
95
|
entityId?: string | undefined;
|
|
352
96
|
active?: boolean | undefined;
|
|
353
97
|
}>;
|
|
354
98
|
export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
|
|
355
|
-
name: z.ZodOptional<z.ZodString>;
|
|
356
|
-
description: z.ZodOptional<z.ZodString>;
|
|
357
99
|
trigger: z.ZodOptional<z.ZodObject<{
|
|
358
100
|
type: z.ZodNativeEnum<typeof NotificationTriggerType>;
|
|
359
|
-
conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
360
|
-
timing: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
361
101
|
}, "strip", z.ZodTypeAny, {
|
|
362
102
|
type: NotificationTriggerType;
|
|
363
|
-
conditions: Record<string, any>;
|
|
364
|
-
timing: Record<string, any>;
|
|
365
103
|
}, {
|
|
366
104
|
type: NotificationTriggerType;
|
|
367
|
-
conditions: Record<string, any>;
|
|
368
|
-
timing: Record<string, any>;
|
|
369
|
-
}>>;
|
|
370
|
-
content: z.ZodOptional<z.ZodObject<{
|
|
371
|
-
title: z.ZodString;
|
|
372
|
-
body: z.ZodString;
|
|
373
|
-
}, "strip", z.ZodTypeAny, {
|
|
374
|
-
title: string;
|
|
375
|
-
body: string;
|
|
376
|
-
}, {
|
|
377
|
-
title: string;
|
|
378
|
-
body: string;
|
|
379
105
|
}>>;
|
|
380
106
|
active: z.ZodOptional<z.ZodBoolean>;
|
|
381
107
|
}, "strip", z.ZodTypeAny, {
|
|
382
|
-
name?: string | undefined;
|
|
383
|
-
description?: string | undefined;
|
|
384
|
-
content?: {
|
|
385
|
-
title: string;
|
|
386
|
-
body: string;
|
|
387
|
-
} | undefined;
|
|
388
108
|
trigger?: {
|
|
389
109
|
type: NotificationTriggerType;
|
|
390
|
-
conditions: Record<string, any>;
|
|
391
|
-
timing: Record<string, any>;
|
|
392
110
|
} | undefined;
|
|
393
111
|
active?: boolean | undefined;
|
|
394
112
|
}, {
|
|
395
|
-
name?: string | undefined;
|
|
396
|
-
description?: string | undefined;
|
|
397
|
-
content?: {
|
|
398
|
-
title: string;
|
|
399
|
-
body: string;
|
|
400
|
-
} | undefined;
|
|
401
113
|
trigger?: {
|
|
402
114
|
type: NotificationTriggerType;
|
|
403
|
-
conditions: Record<string, any>;
|
|
404
|
-
timing: Record<string, any>;
|
|
405
115
|
} | undefined;
|
|
406
116
|
active?: boolean | undefined;
|
|
407
117
|
}>;
|
|
408
|
-
export declare const syncNotificationTemplateRequestSchema: z.ZodObject<{
|
|
409
|
-
sync: z.ZodBoolean;
|
|
410
|
-
}, "strip", z.ZodTypeAny, {
|
|
411
|
-
sync: boolean;
|
|
412
|
-
}, {
|
|
413
|
-
sync: boolean;
|
|
414
|
-
}>;
|
|
415
|
-
export declare const previewNotificationTemplateRequestSchema: z.ZodObject<{
|
|
416
|
-
templateTitle: z.ZodString;
|
|
417
|
-
templateBody: z.ZodString;
|
|
418
|
-
entityType: z.ZodString;
|
|
419
|
-
entityId: z.ZodString;
|
|
420
|
-
}, "strip", z.ZodTypeAny, {
|
|
421
|
-
entityType: string;
|
|
422
|
-
entityId: string;
|
|
423
|
-
templateTitle: string;
|
|
424
|
-
templateBody: string;
|
|
425
|
-
}, {
|
|
426
|
-
entityType: string;
|
|
427
|
-
entityId: string;
|
|
428
|
-
templateTitle: string;
|
|
429
|
-
templateBody: string;
|
|
430
|
-
}>;
|
|
431
|
-
export declare const getNotificationInstancesRequestSchema: z.ZodObject<{
|
|
432
|
-
status: z.ZodOptional<z.ZodString>;
|
|
433
|
-
templateId: z.ZodOptional<z.ZodString>;
|
|
434
|
-
entityId: z.ZodOptional<z.ZodString>;
|
|
435
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
436
|
-
offset: z.ZodOptional<z.ZodNumber>;
|
|
437
|
-
}, "strip", z.ZodTypeAny, {
|
|
438
|
-
status?: string | undefined;
|
|
439
|
-
entityId?: string | undefined;
|
|
440
|
-
templateId?: string | undefined;
|
|
441
|
-
limit?: number | undefined;
|
|
442
|
-
offset?: number | undefined;
|
|
443
|
-
}, {
|
|
444
|
-
status?: string | undefined;
|
|
445
|
-
entityId?: string | undefined;
|
|
446
|
-
templateId?: string | undefined;
|
|
447
|
-
limit?: number | undefined;
|
|
448
|
-
offset?: number | undefined;
|
|
449
|
-
}>;
|
|
450
118
|
export declare const entitySyncRequestSchema: z.ZodObject<{
|
|
451
|
-
entityType: z.
|
|
119
|
+
entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
|
|
452
120
|
entityId: z.ZodString;
|
|
453
121
|
synced: z.ZodBoolean;
|
|
454
122
|
}, "strip", z.ZodTypeAny, {
|
|
455
|
-
entityType:
|
|
123
|
+
entityType: NotificationEntityType;
|
|
456
124
|
entityId: string;
|
|
457
125
|
synced: boolean;
|
|
458
126
|
}, {
|
|
459
|
-
entityType:
|
|
127
|
+
entityType: NotificationEntityType;
|
|
460
128
|
entityId: string;
|
|
461
129
|
synced: boolean;
|
|
462
130
|
}>;
|
|
463
131
|
export declare const getEntitySyncRequestSchema: z.ZodObject<{
|
|
464
|
-
entityType: z.
|
|
132
|
+
entityType: z.ZodNativeEnum<typeof NotificationEntityType>;
|
|
465
133
|
entityId: z.ZodString;
|
|
466
134
|
}, "strip", z.ZodTypeAny, {
|
|
467
|
-
entityType:
|
|
135
|
+
entityType: NotificationEntityType;
|
|
468
136
|
entityId: string;
|
|
469
137
|
}, {
|
|
470
|
-
entityType:
|
|
138
|
+
entityType: NotificationEntityType;
|
|
471
139
|
entityId: string;
|
|
472
140
|
}>;
|
|
473
141
|
export type NotificationTrigger = z.infer<typeof notificationTriggerSchema>;
|
|
474
|
-
export type NotificationContent = z.infer<typeof notificationContentSchema>;
|
|
475
142
|
export type NotificationTemplateData = z.infer<typeof notificationTemplateSchema>;
|
|
476
|
-
export type CreateNotificationTemplateData = z.infer<typeof createNotificationTemplateSchema>;
|
|
477
|
-
export type EntitySyncState = z.infer<typeof entitySyncStateSchema>;
|
|
478
|
-
export type NotificationInstanceData = z.infer<typeof notificationInstanceSchema>;
|
|
479
143
|
export type CreateNotificationTemplateRequest = z.infer<typeof createNotificationTemplateRequestSchema>;
|
|
480
144
|
export type UpdateNotificationTemplateRequest = z.infer<typeof updateNotificationTemplateRequestSchema>;
|
|
481
|
-
export type SyncNotificationTemplateRequest = z.infer<typeof syncNotificationTemplateRequestSchema>;
|
|
482
|
-
export type PreviewNotificationTemplateRequest = z.infer<typeof previewNotificationTemplateRequestSchema>;
|
|
483
|
-
export type GetNotificationInstancesRequest = z.infer<typeof getNotificationInstancesRequestSchema>;
|
|
484
145
|
export type EntitySyncRequest = z.infer<typeof entitySyncRequestSchema>;
|
|
485
146
|
export type GetEntitySyncRequest = z.infer<typeof getEntitySyncRequestSchema>;
|
|
486
147
|
export interface CreateNotificationTemplateResponse {
|
|
@@ -497,21 +158,6 @@ export interface UpdateNotificationTemplateResponse {
|
|
|
497
158
|
}
|
|
498
159
|
export interface DeleteNotificationTemplateResponse {
|
|
499
160
|
}
|
|
500
|
-
export interface SyncNotificationTemplateResponse {
|
|
501
|
-
synced: boolean;
|
|
502
|
-
}
|
|
503
|
-
export interface PreviewNotificationTemplateResponse {
|
|
504
|
-
preview: {
|
|
505
|
-
title: string;
|
|
506
|
-
body: string;
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
export interface GetNotificationInstancesResponse {
|
|
510
|
-
success: boolean;
|
|
511
|
-
instances?: Serialized<NotificationInstanceData>[];
|
|
512
|
-
total?: number;
|
|
513
|
-
error?: string;
|
|
514
|
-
}
|
|
515
161
|
export interface EntitySyncResponse {
|
|
516
162
|
success: boolean;
|
|
517
163
|
synced: boolean;
|
|
@@ -1,147 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getEntitySyncRequestSchema = exports.entitySyncRequestSchema = exports.
|
|
3
|
+
exports.getEntitySyncRequestSchema = exports.entitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationTemplateSchema = exports.notificationTriggerSchema = exports.notificationTriggerTypeSchema = exports.NotificationTriggerType = exports.NotificationEntityType = exports.NotificationParentType = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const id_types_1 = require("./id-types");
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Use string types with NotificationEntityRegistry instead
|
|
8
|
-
* These enums are kept for backward compatibility during migration
|
|
9
|
-
*/
|
|
10
6
|
var NotificationParentType;
|
|
11
7
|
(function (NotificationParentType) {
|
|
12
8
|
NotificationParentType["AGENDA_PANEL"] = "agenda_panel";
|
|
13
9
|
})(NotificationParentType || (exports.NotificationParentType = NotificationParentType = {}));
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Use string types with NotificationEntityRegistry instead
|
|
16
|
-
* These enums are kept for backward compatibility during migration
|
|
17
|
-
*/
|
|
18
10
|
var NotificationEntityType;
|
|
19
11
|
(function (NotificationEntityType) {
|
|
20
12
|
NotificationEntityType["INBOX_PANEL"] = "inbox_panel";
|
|
21
|
-
NotificationEntityType["AGENDA_PANEL"] = "
|
|
13
|
+
NotificationEntityType["AGENDA_PANEL"] = "agenda_item";
|
|
22
14
|
NotificationEntityType["AGENDA_ITEM"] = "agenda_item";
|
|
23
15
|
})(NotificationEntityType || (exports.NotificationEntityType = NotificationEntityType = {}));
|
|
24
|
-
// Updated to use string instead of enum
|
|
25
|
-
exports.notificationEntityTypeSchema = zod_1.z.string();
|
|
26
|
-
var NotificationStatus;
|
|
27
|
-
(function (NotificationStatus) {
|
|
28
|
-
NotificationStatus["SCHEDULED"] = "scheduled";
|
|
29
|
-
NotificationStatus["SENT"] = "sent";
|
|
30
|
-
NotificationStatus["FAILED"] = "failed";
|
|
31
|
-
NotificationStatus["CANCELLED"] = "cancelled";
|
|
32
|
-
})(NotificationStatus || (exports.NotificationStatus = NotificationStatus = {}));
|
|
33
16
|
var NotificationTriggerType;
|
|
34
17
|
(function (NotificationTriggerType) {
|
|
35
18
|
NotificationTriggerType["TIME_BASED"] = "time_based";
|
|
36
19
|
NotificationTriggerType["EVENT_BASED"] = "event_based";
|
|
37
20
|
NotificationTriggerType["RECURRING"] = "recurring";
|
|
38
21
|
})(NotificationTriggerType || (exports.NotificationTriggerType = NotificationTriggerType = {}));
|
|
39
|
-
exports.notificationStatusSchema = zod_1.z.nativeEnum(NotificationStatus);
|
|
40
22
|
exports.notificationTriggerTypeSchema = zod_1.z.nativeEnum(NotificationTriggerType);
|
|
41
23
|
exports.notificationTriggerSchema = zod_1.z.object({
|
|
42
24
|
type: exports.notificationTriggerTypeSchema,
|
|
43
|
-
conditions: zod_1.z.record(zod_1.z.any()),
|
|
44
|
-
timing: zod_1.z.record(zod_1.z.any())
|
|
45
|
-
});
|
|
46
|
-
exports.notificationContentSchema = zod_1.z.object({
|
|
47
|
-
title: zod_1.z.string(),
|
|
48
|
-
body: zod_1.z.string()
|
|
49
25
|
});
|
|
50
26
|
exports.notificationTemplateSchema = zod_1.z.object({
|
|
51
27
|
_id: id_types_1.notificationTemplateIdSchema,
|
|
52
28
|
userId: id_types_1.userIdSchema,
|
|
53
|
-
entityType:
|
|
29
|
+
entityType: zod_1.z.nativeEnum(NotificationEntityType),
|
|
54
30
|
entityId: zod_1.z.string().optional(),
|
|
55
|
-
name: zod_1.z.string(),
|
|
56
|
-
description: zod_1.z.string().optional(),
|
|
57
31
|
trigger: exports.notificationTriggerSchema,
|
|
58
|
-
content: exports.notificationContentSchema,
|
|
59
32
|
active: zod_1.z.boolean(),
|
|
60
33
|
createdAt: zod_1.z.date(),
|
|
61
34
|
updatedAt: zod_1.z.date()
|
|
62
35
|
});
|
|
63
|
-
exports.createNotificationTemplateSchema = exports.notificationTemplateSchema.omit({
|
|
64
|
-
_id: true,
|
|
65
|
-
createdAt: true,
|
|
66
|
-
updatedAt: true
|
|
67
|
-
});
|
|
68
|
-
exports.entitySyncStateSchema = zod_1.z.object({
|
|
69
|
-
userId: id_types_1.userIdSchema,
|
|
70
|
-
entityType: exports.notificationEntityTypeSchema,
|
|
71
|
-
entityId: zod_1.z.string(),
|
|
72
|
-
synced: zod_1.z.boolean(),
|
|
73
|
-
updatedAt: zod_1.z.date()
|
|
74
|
-
});
|
|
75
|
-
exports.notificationInstanceSchema = zod_1.z.object({
|
|
76
|
-
_id: id_types_1.notificationInstanceIdSchema,
|
|
77
|
-
templateId: id_types_1.notificationTemplateIdSchema,
|
|
78
|
-
userId: id_types_1.userIdSchema,
|
|
79
|
-
entityId: zod_1.z.string(),
|
|
80
|
-
scheduledFor: zod_1.z.date(),
|
|
81
|
-
status: exports.notificationStatusSchema,
|
|
82
|
-
sentAt: zod_1.z.date().optional(),
|
|
83
|
-
content: zod_1.z.object({
|
|
84
|
-
title: zod_1.z.string(),
|
|
85
|
-
body: zod_1.z.string(),
|
|
86
|
-
data: zod_1.z.record(zod_1.z.any()).optional()
|
|
87
|
-
}),
|
|
88
|
-
redisId: zod_1.z.string(),
|
|
89
|
-
error: zod_1.z.string().optional(),
|
|
90
|
-
createdAt: zod_1.z.date(),
|
|
91
|
-
updatedAt: zod_1.z.date()
|
|
92
|
-
});
|
|
93
36
|
exports.createNotificationTemplateRequestSchema = zod_1.z.object({
|
|
94
|
-
entityType:
|
|
37
|
+
entityType: zod_1.z.nativeEnum(NotificationEntityType),
|
|
95
38
|
entityId: zod_1.z.string().optional(),
|
|
96
|
-
name: zod_1.z.string().min(1).max(100),
|
|
97
|
-
description: zod_1.z.string().max(500).optional(),
|
|
98
39
|
trigger: zod_1.z.object({
|
|
99
40
|
type: exports.notificationTriggerTypeSchema,
|
|
100
|
-
conditions: zod_1.z.record(zod_1.z.any()),
|
|
101
|
-
timing: zod_1.z.record(zod_1.z.any())
|
|
102
|
-
}),
|
|
103
|
-
content: zod_1.z.object({
|
|
104
|
-
title: zod_1.z.string().min(1).max(200),
|
|
105
|
-
body: zod_1.z.string().min(1).max(1000)
|
|
106
41
|
}),
|
|
107
42
|
active: zod_1.z.boolean().default(true)
|
|
108
43
|
});
|
|
109
44
|
exports.updateNotificationTemplateRequestSchema = zod_1.z.object({
|
|
110
|
-
name: zod_1.z.string().optional(),
|
|
111
|
-
description: zod_1.z.string().optional(),
|
|
112
45
|
trigger: zod_1.z.object({
|
|
113
46
|
type: exports.notificationTriggerTypeSchema,
|
|
114
|
-
conditions: zod_1.z.record(zod_1.z.any()),
|
|
115
|
-
timing: zod_1.z.record(zod_1.z.any())
|
|
116
|
-
}).optional(),
|
|
117
|
-
content: zod_1.z.object({
|
|
118
|
-
title: zod_1.z.string(),
|
|
119
|
-
body: zod_1.z.string()
|
|
120
47
|
}).optional(),
|
|
121
48
|
active: zod_1.z.boolean().optional()
|
|
122
49
|
});
|
|
123
|
-
exports.syncNotificationTemplateRequestSchema = zod_1.z.object({
|
|
124
|
-
sync: zod_1.z.boolean()
|
|
125
|
-
});
|
|
126
|
-
exports.previewNotificationTemplateRequestSchema = zod_1.z.object({
|
|
127
|
-
templateTitle: zod_1.z.string(),
|
|
128
|
-
templateBody: zod_1.z.string(),
|
|
129
|
-
entityType: zod_1.z.string(),
|
|
130
|
-
entityId: zod_1.z.string()
|
|
131
|
-
});
|
|
132
|
-
exports.getNotificationInstancesRequestSchema = zod_1.z.object({
|
|
133
|
-
status: zod_1.z.string().optional(),
|
|
134
|
-
templateId: zod_1.z.string().optional(),
|
|
135
|
-
entityId: zod_1.z.string().optional(),
|
|
136
|
-
limit: zod_1.z.number().optional(),
|
|
137
|
-
offset: zod_1.z.number().optional()
|
|
138
|
-
});
|
|
139
50
|
exports.entitySyncRequestSchema = zod_1.z.object({
|
|
140
|
-
entityType: zod_1.z.
|
|
51
|
+
entityType: zod_1.z.nativeEnum(NotificationEntityType),
|
|
141
52
|
entityId: zod_1.z.string(),
|
|
142
53
|
synced: zod_1.z.boolean()
|
|
143
54
|
});
|
|
144
55
|
exports.getEntitySyncRequestSchema = zod_1.z.object({
|
|
145
|
-
entityType: zod_1.z.
|
|
56
|
+
entityType: zod_1.z.nativeEnum(NotificationEntityType),
|
|
146
57
|
entityId: zod_1.z.string()
|
|
147
58
|
});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/types/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ export * from './id-types';
|
|
|
6
6
|
export * from './people-types';
|
|
7
7
|
export * from './lists-types';
|
|
8
8
|
export * from './notifications-types';
|
|
9
|
-
export * from './notification-entity-config';
|
|
10
9
|
export * from './auth-types';
|
|
11
10
|
export * from './user-types';
|
|
12
|
-
export * from './program-config-types';
|
|
11
|
+
export * from './program-config-types';
|
|
12
|
+
export * from './misc';
|