@timothyw/pat-common 1.0.122 → 1.0.123

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.
@@ -144,18 +144,18 @@ class NotificationEntityRegistry {
144
144
  * Register default entity configurations
145
145
  */
146
146
  registerDefaultEntities() {
147
- // Agenda Panel (static parent of agenda items)
147
+ // Agenda Panel (dynamic parent for agenda items based on category)
148
148
  this.registerEntity({
149
149
  entityType: 'agenda_panel',
150
150
  parentResolver: {
151
151
  type: 'static',
152
- parentType: 'agenda_panel' // Self-referencing for panel level
152
+ parentType: 'agenda_panel' // Panel level templates
153
153
  },
154
154
  displayName: 'Agenda Panel',
155
155
  icon: 'calendar',
156
- description: 'Default notification templates for all agenda items'
156
+ description: 'Default agenda panel templates'
157
157
  });
158
- // Agenda Item (can have dynamic parent based on category)
158
+ // Agenda Item (dynamic parent based on category)
159
159
  this.registerEntity({
160
160
  entityType: 'agenda_item',
161
161
  parentResolver: {
@@ -168,16 +168,38 @@ class NotificationEntityRegistry {
168
168
  icon: 'calendar',
169
169
  description: 'Individual agenda item notifications'
170
170
  });
171
- // Inbox Panel
171
+ // Habits Panel (static parent for habits)
172
+ this.registerEntity({
173
+ entityType: 'habits_panel',
174
+ parentResolver: {
175
+ type: 'static',
176
+ parentType: 'habits_panel'
177
+ },
178
+ displayName: 'Habits Panel',
179
+ icon: 'fitness',
180
+ description: 'Default habits panel templates'
181
+ });
182
+ // Habit (static parent - all habits inherit from habits panel)
183
+ this.registerEntity({
184
+ entityType: 'habit',
185
+ parentResolver: {
186
+ type: 'static',
187
+ parentType: 'habits_panel'
188
+ },
189
+ displayName: 'Habit',
190
+ icon: 'fitness',
191
+ description: 'Individual habit notifications'
192
+ });
193
+ // Inbox Panel (no parent - top level)
172
194
  this.registerEntity({
173
195
  entityType: 'inbox_panel',
174
196
  parentResolver: {
175
197
  type: 'static',
176
- parentType: 'inbox_panel' // Self-referencing for panel level
198
+ parentType: '' // No parent - this is a top-level entity
177
199
  },
178
200
  displayName: 'Inbox Panel',
179
201
  icon: 'mail',
180
- description: 'Inbox notification templates'
202
+ description: 'Inbox notifications'
181
203
  });
182
204
  }
183
205
  }
@@ -53,15 +53,12 @@ export declare const notificationTriggerSchema: z.ZodObject<{
53
53
  export declare const notificationContentSchema: z.ZodObject<{
54
54
  title: z.ZodString;
55
55
  body: z.ZodString;
56
- variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
57
56
  }, "strip", z.ZodTypeAny, {
58
57
  title: string;
59
58
  body: string;
60
- variables?: Record<string, string> | undefined;
61
59
  }, {
62
60
  title: string;
63
61
  body: string;
64
- variables?: Record<string, string> | undefined;
65
62
  }>;
66
63
  export declare const notificationTemplateSchema: z.ZodObject<{
67
64
  _id: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
@@ -86,19 +83,14 @@ export declare const notificationTemplateSchema: z.ZodObject<{
86
83
  content: z.ZodObject<{
87
84
  title: z.ZodString;
88
85
  body: z.ZodString;
89
- variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
90
86
  }, "strip", z.ZodTypeAny, {
91
87
  title: string;
92
88
  body: string;
93
- variables?: Record<string, string> | undefined;
94
89
  }, {
95
90
  title: string;
96
91
  body: string;
97
- variables?: Record<string, string> | undefined;
98
92
  }>;
99
93
  active: z.ZodBoolean;
100
- inheritedFrom: z.ZodOptional<z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>>;
101
- customized: z.ZodBoolean;
102
94
  createdAt: z.ZodDate;
103
95
  updatedAt: z.ZodDate;
104
96
  }, "strip", z.ZodTypeAny, {
@@ -114,7 +106,6 @@ export declare const notificationTemplateSchema: z.ZodObject<{
114
106
  content: {
115
107
  title: string;
116
108
  body: string;
117
- variables?: Record<string, string> | undefined;
118
109
  };
119
110
  entityType: string;
120
111
  trigger: {
@@ -123,10 +114,8 @@ export declare const notificationTemplateSchema: z.ZodObject<{
123
114
  timing: Record<string, any>;
124
115
  };
125
116
  active: boolean;
126
- customized: boolean;
127
117
  description?: string | undefined;
128
118
  entityId?: string | undefined;
129
- inheritedFrom?: import("./id-types").NotificationTemplateId | undefined;
130
119
  }, {
131
120
  _id: string;
132
121
  createdAt: Date;
@@ -136,7 +125,6 @@ export declare const notificationTemplateSchema: z.ZodObject<{
136
125
  content: {
137
126
  title: string;
138
127
  body: string;
139
- variables?: Record<string, string> | undefined;
140
128
  };
141
129
  entityType: string;
142
130
  trigger: {
@@ -145,10 +133,8 @@ export declare const notificationTemplateSchema: z.ZodObject<{
145
133
  timing: Record<string, any>;
146
134
  };
147
135
  active: boolean;
148
- customized: boolean;
149
136
  description?: string | undefined;
150
137
  entityId?: string | undefined;
151
- inheritedFrom?: string | undefined;
152
138
  }>;
153
139
  export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
154
140
  _id: z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>;
@@ -173,19 +159,14 @@ export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
173
159
  content: z.ZodObject<{
174
160
  title: z.ZodString;
175
161
  body: z.ZodString;
176
- variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
177
162
  }, "strip", z.ZodTypeAny, {
178
163
  title: string;
179
164
  body: string;
180
- variables?: Record<string, string> | undefined;
181
165
  }, {
182
166
  title: string;
183
167
  body: string;
184
- variables?: Record<string, string> | undefined;
185
168
  }>;
186
169
  active: z.ZodBoolean;
187
- inheritedFrom: z.ZodOptional<z.ZodEffects<z.ZodString, import("./id-types").NotificationTemplateId, string>>;
188
- customized: z.ZodBoolean;
189
170
  createdAt: z.ZodDate;
190
171
  updatedAt: z.ZodDate;
191
172
  }, "_id" | "createdAt" | "updatedAt">, "strip", z.ZodTypeAny, {
@@ -196,7 +177,6 @@ export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
196
177
  content: {
197
178
  title: string;
198
179
  body: string;
199
- variables?: Record<string, string> | undefined;
200
180
  };
201
181
  entityType: string;
202
182
  trigger: {
@@ -205,17 +185,14 @@ export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
205
185
  timing: Record<string, any>;
206
186
  };
207
187
  active: boolean;
208
- customized: boolean;
209
188
  description?: string | undefined;
210
189
  entityId?: string | undefined;
211
- inheritedFrom?: import("./id-types").NotificationTemplateId | undefined;
212
190
  }, {
213
191
  userId: string;
214
192
  name: string;
215
193
  content: {
216
194
  title: string;
217
195
  body: string;
218
- variables?: Record<string, string> | undefined;
219
196
  };
220
197
  entityType: string;
221
198
  trigger: {
@@ -224,10 +201,8 @@ export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
224
201
  timing: Record<string, any>;
225
202
  };
226
203
  active: boolean;
227
- customized: boolean;
228
204
  description?: string | undefined;
229
205
  entityId?: string | undefined;
230
- inheritedFrom?: string | undefined;
231
206
  }>;
232
207
  export declare const entitySyncStateSchema: z.ZodObject<{
233
208
  userId: z.ZodEffects<z.ZodString, import("./id-types").UserId, string>;
@@ -337,25 +312,19 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
337
312
  content: z.ZodObject<{
338
313
  title: z.ZodString;
339
314
  body: z.ZodString;
340
- variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
341
315
  }, "strip", z.ZodTypeAny, {
342
316
  title: string;
343
317
  body: string;
344
- variables?: Record<string, string> | undefined;
345
318
  }, {
346
319
  title: string;
347
320
  body: string;
348
- variables?: Record<string, string> | undefined;
349
321
  }>;
350
322
  active: z.ZodDefault<z.ZodBoolean>;
351
- inheritedFrom: z.ZodOptional<z.ZodString>;
352
- customized: z.ZodDefault<z.ZodBoolean>;
353
323
  }, "strip", z.ZodTypeAny, {
354
324
  name: string;
355
325
  content: {
356
326
  title: string;
357
327
  body: string;
358
- variables?: Record<string, string> | undefined;
359
328
  };
360
329
  entityType: string;
361
330
  trigger: {
@@ -364,16 +333,13 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
364
333
  timing: Record<string, any>;
365
334
  };
366
335
  active: boolean;
367
- customized: boolean;
368
336
  description?: string | undefined;
369
337
  entityId?: string | undefined;
370
- inheritedFrom?: string | undefined;
371
338
  }, {
372
339
  name: string;
373
340
  content: {
374
341
  title: string;
375
342
  body: string;
376
- variables?: Record<string, string> | undefined;
377
343
  };
378
344
  entityType: string;
379
345
  trigger: {
@@ -384,8 +350,6 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
384
350
  description?: string | undefined;
385
351
  entityId?: string | undefined;
386
352
  active?: boolean | undefined;
387
- inheritedFrom?: string | undefined;
388
- customized?: boolean | undefined;
389
353
  }>;
390
354
  export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
391
355
  name: z.ZodOptional<z.ZodString>;
@@ -406,25 +370,20 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
406
370
  content: z.ZodOptional<z.ZodObject<{
407
371
  title: z.ZodString;
408
372
  body: z.ZodString;
409
- variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
410
373
  }, "strip", z.ZodTypeAny, {
411
374
  title: string;
412
375
  body: string;
413
- variables?: Record<string, string> | undefined;
414
376
  }, {
415
377
  title: string;
416
378
  body: string;
417
- variables?: Record<string, string> | undefined;
418
379
  }>>;
419
380
  active: z.ZodOptional<z.ZodBoolean>;
420
- customized: z.ZodOptional<z.ZodBoolean>;
421
381
  }, "strip", z.ZodTypeAny, {
422
382
  name?: string | undefined;
423
383
  description?: string | undefined;
424
384
  content?: {
425
385
  title: string;
426
386
  body: string;
427
- variables?: Record<string, string> | undefined;
428
387
  } | undefined;
429
388
  trigger?: {
430
389
  type: NotificationTriggerType;
@@ -432,14 +391,12 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
432
391
  timing: Record<string, any>;
433
392
  } | undefined;
434
393
  active?: boolean | undefined;
435
- customized?: boolean | undefined;
436
394
  }, {
437
395
  name?: string | undefined;
438
396
  description?: string | undefined;
439
397
  content?: {
440
398
  title: string;
441
399
  body: string;
442
- variables?: Record<string, string> | undefined;
443
400
  } | undefined;
444
401
  trigger?: {
445
402
  type: NotificationTriggerType;
@@ -447,7 +404,6 @@ export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
447
404
  timing: Record<string, any>;
448
405
  } | undefined;
449
406
  active?: boolean | undefined;
450
- customized?: boolean | undefined;
451
407
  }>;
452
408
  export declare const syncNotificationTemplateRequestSchema: z.ZodObject<{
453
409
  sync: z.ZodBoolean;
@@ -461,19 +417,16 @@ export declare const previewNotificationTemplateRequestSchema: z.ZodObject<{
461
417
  templateBody: z.ZodString;
462
418
  entityType: z.ZodString;
463
419
  entityId: z.ZodString;
464
- variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
465
420
  }, "strip", z.ZodTypeAny, {
466
421
  entityType: string;
467
422
  entityId: string;
468
423
  templateTitle: string;
469
424
  templateBody: string;
470
- variables?: Record<string, any> | undefined;
471
425
  }, {
472
426
  entityType: string;
473
427
  entityId: string;
474
428
  templateTitle: string;
475
429
  templateBody: string;
476
- variables?: Record<string, any> | undefined;
477
430
  }>;
478
431
  export declare const getNotificationInstancesRequestSchema: z.ZodObject<{
479
432
  status: z.ZodOptional<z.ZodString>;
@@ -551,9 +504,7 @@ export interface PreviewNotificationTemplateResponse {
551
504
  preview: {
552
505
  title: string;
553
506
  body: string;
554
- variables: Record<string, any>;
555
507
  };
556
- missingVariables: string[];
557
508
  }
558
509
  export interface GetNotificationInstancesResponse {
559
510
  success: boolean;
@@ -45,8 +45,7 @@ exports.notificationTriggerSchema = zod_1.z.object({
45
45
  });
46
46
  exports.notificationContentSchema = zod_1.z.object({
47
47
  title: zod_1.z.string(),
48
- body: zod_1.z.string(),
49
- variables: zod_1.z.record(zod_1.z.string()).optional()
48
+ body: zod_1.z.string()
50
49
  });
51
50
  exports.notificationTemplateSchema = zod_1.z.object({
52
51
  _id: id_types_1.notificationTemplateIdSchema,
@@ -58,8 +57,6 @@ exports.notificationTemplateSchema = zod_1.z.object({
58
57
  trigger: exports.notificationTriggerSchema,
59
58
  content: exports.notificationContentSchema,
60
59
  active: zod_1.z.boolean(),
61
- inheritedFrom: id_types_1.notificationTemplateIdSchema.optional(),
62
- customized: zod_1.z.boolean(),
63
60
  createdAt: zod_1.z.date(),
64
61
  updatedAt: zod_1.z.date()
65
62
  });
@@ -105,12 +102,9 @@ exports.createNotificationTemplateRequestSchema = zod_1.z.object({
105
102
  }),
106
103
  content: zod_1.z.object({
107
104
  title: zod_1.z.string().min(1).max(200),
108
- body: zod_1.z.string().min(1).max(1000),
109
- variables: zod_1.z.record(zod_1.z.string()).optional()
105
+ body: zod_1.z.string().min(1).max(1000)
110
106
  }),
111
- active: zod_1.z.boolean().default(true),
112
- inheritedFrom: zod_1.z.string().optional(),
113
- customized: zod_1.z.boolean().default(false)
107
+ active: zod_1.z.boolean().default(true)
114
108
  });
115
109
  exports.updateNotificationTemplateRequestSchema = zod_1.z.object({
116
110
  name: zod_1.z.string().optional(),
@@ -122,11 +116,9 @@ exports.updateNotificationTemplateRequestSchema = zod_1.z.object({
122
116
  }).optional(),
123
117
  content: zod_1.z.object({
124
118
  title: zod_1.z.string(),
125
- body: zod_1.z.string(),
126
- variables: zod_1.z.record(zod_1.z.string()).optional()
119
+ body: zod_1.z.string()
127
120
  }).optional(),
128
- active: zod_1.z.boolean().optional(),
129
- customized: zod_1.z.boolean().optional()
121
+ active: zod_1.z.boolean().optional()
130
122
  });
131
123
  exports.syncNotificationTemplateRequestSchema = zod_1.z.object({
132
124
  sync: zod_1.z.boolean()
@@ -135,8 +127,7 @@ exports.previewNotificationTemplateRequestSchema = zod_1.z.object({
135
127
  templateTitle: zod_1.z.string(),
136
128
  templateBody: zod_1.z.string(),
137
129
  entityType: zod_1.z.string(),
138
- entityId: zod_1.z.string(),
139
- variables: zod_1.z.record(zod_1.z.any()).optional()
130
+ entityId: zod_1.z.string()
140
131
  });
141
132
  exports.getNotificationInstancesRequestSchema = zod_1.z.object({
142
133
  status: zod_1.z.string().optional(),
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.122",
5
+ "version": "1.0.123",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -169,19 +169,19 @@ export class NotificationEntityRegistry {
169
169
  * Register default entity configurations
170
170
  */
171
171
  private registerDefaultEntities(): void {
172
- // Agenda Panel (static parent of agenda items)
172
+ // Agenda Panel (dynamic parent for agenda items based on category)
173
173
  this.registerEntity({
174
174
  entityType: 'agenda_panel',
175
175
  parentResolver: {
176
176
  type: 'static',
177
- parentType: 'agenda_panel' // Self-referencing for panel level
177
+ parentType: 'agenda_panel' // Panel level templates
178
178
  },
179
179
  displayName: 'Agenda Panel',
180
180
  icon: 'calendar',
181
- description: 'Default notification templates for all agenda items'
181
+ description: 'Default agenda panel templates'
182
182
  });
183
183
 
184
- // Agenda Item (can have dynamic parent based on category)
184
+ // Agenda Item (dynamic parent based on category)
185
185
  this.registerEntity({
186
186
  entityType: 'agenda_item',
187
187
  parentResolver: {
@@ -195,16 +195,40 @@ export class NotificationEntityRegistry {
195
195
  description: 'Individual agenda item notifications'
196
196
  });
197
197
 
198
- // Inbox Panel
198
+ // Habits Panel (static parent for habits)
199
+ this.registerEntity({
200
+ entityType: 'habits_panel',
201
+ parentResolver: {
202
+ type: 'static',
203
+ parentType: 'habits_panel'
204
+ },
205
+ displayName: 'Habits Panel',
206
+ icon: 'fitness',
207
+ description: 'Default habits panel templates'
208
+ });
209
+
210
+ // Habit (static parent - all habits inherit from habits panel)
211
+ this.registerEntity({
212
+ entityType: 'habit',
213
+ parentResolver: {
214
+ type: 'static',
215
+ parentType: 'habits_panel'
216
+ },
217
+ displayName: 'Habit',
218
+ icon: 'fitness',
219
+ description: 'Individual habit notifications'
220
+ });
221
+
222
+ // Inbox Panel (no parent - top level)
199
223
  this.registerEntity({
200
224
  entityType: 'inbox_panel',
201
225
  parentResolver: {
202
226
  type: 'static',
203
- parentType: 'inbox_panel' // Self-referencing for panel level
227
+ parentType: '' // No parent - this is a top-level entity
204
228
  },
205
229
  displayName: 'Inbox Panel',
206
230
  icon: 'mail',
207
- description: 'Inbox notification templates'
231
+ description: 'Inbox notifications'
208
232
  });
209
233
  }
210
234
  }
@@ -55,8 +55,7 @@ export const notificationTriggerSchema = z.object({
55
55
 
56
56
  export const notificationContentSchema = z.object({
57
57
  title: z.string(),
58
- body: z.string(),
59
- variables: z.record(z.string()).optional()
58
+ body: z.string()
60
59
  });
61
60
 
62
61
  export const notificationTemplateSchema = z.object({
@@ -69,8 +68,6 @@ export const notificationTemplateSchema = z.object({
69
68
  trigger: notificationTriggerSchema,
70
69
  content: notificationContentSchema,
71
70
  active: z.boolean(),
72
- inheritedFrom: notificationTemplateIdSchema.optional(),
73
- customized: z.boolean(),
74
71
  createdAt: z.date(),
75
72
  updatedAt: z.date()
76
73
  });
@@ -120,12 +117,9 @@ export const createNotificationTemplateRequestSchema = z.object({
120
117
  }),
121
118
  content: z.object({
122
119
  title: z.string().min(1).max(200),
123
- body: z.string().min(1).max(1000),
124
- variables: z.record(z.string()).optional()
120
+ body: z.string().min(1).max(1000)
125
121
  }),
126
- active: z.boolean().default(true),
127
- inheritedFrom: z.string().optional(),
128
- customized: z.boolean().default(false)
122
+ active: z.boolean().default(true)
129
123
  });
130
124
 
131
125
  export const updateNotificationTemplateRequestSchema = z.object({
@@ -138,11 +132,9 @@ export const updateNotificationTemplateRequestSchema = z.object({
138
132
  }).optional(),
139
133
  content: z.object({
140
134
  title: z.string(),
141
- body: z.string(),
142
- variables: z.record(z.string()).optional()
135
+ body: z.string()
143
136
  }).optional(),
144
- active: z.boolean().optional(),
145
- customized: z.boolean().optional()
137
+ active: z.boolean().optional()
146
138
  });
147
139
 
148
140
  export const syncNotificationTemplateRequestSchema = z.object({
@@ -153,8 +145,7 @@ export const previewNotificationTemplateRequestSchema = z.object({
153
145
  templateTitle: z.string(),
154
146
  templateBody: z.string(),
155
147
  entityType: z.string(),
156
- entityId: z.string(),
157
- variables: z.record(z.any()).optional()
148
+ entityId: z.string()
158
149
  });
159
150
 
160
151
  export const getNotificationInstancesRequestSchema = z.object({
@@ -217,9 +208,7 @@ export interface PreviewNotificationTemplateResponse {
217
208
  preview: {
218
209
  title: string;
219
210
  body: string;
220
- variables: Record<string, any>;
221
211
  };
222
- missingVariables: string[];
223
212
  }
224
213
 
225
214
  export interface GetNotificationInstancesResponse {