@timothyw/pat-common 1.0.102 → 1.0.103

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.
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { Serialized } from "../../../utils";
3
3
  import { NotificationTemplateData } from "../../models/notification-template-data";
4
4
  export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
5
- entityType: z.ZodEnum<["agenda", "tasks", "habits", "agenda_item", "task_list", "task", "habit"]>;
5
+ entityType: z.ZodEnum<["agenda", "tasks", "habits", "inbox", "agenda_item", "task_list", "task", "habit", "agenda_defaults", "tasks_defaults", "habits_defaults"]>;
6
6
  entityId: z.ZodOptional<z.ZodString>;
7
7
  name: z.ZodString;
8
8
  description: z.ZodOptional<z.ZodString>;
@@ -36,7 +36,7 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
36
36
  inheritedFrom: z.ZodOptional<z.ZodString>;
37
37
  customized: z.ZodDefault<z.ZodBoolean>;
38
38
  }, "strip", z.ZodTypeAny, {
39
- entityType: "agenda" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit";
39
+ entityType: "agenda" | "inbox" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit" | "agenda_defaults" | "tasks_defaults" | "habits_defaults";
40
40
  name: string;
41
41
  trigger: {
42
42
  type: "time_based" | "event_based" | "recurring";
@@ -54,7 +54,7 @@ export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
54
54
  description?: string | undefined;
55
55
  inheritedFrom?: string | undefined;
56
56
  }, {
57
- entityType: "agenda" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit";
57
+ entityType: "agenda" | "inbox" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit" | "agenda_defaults" | "tasks_defaults" | "habits_defaults";
58
58
  name: string;
59
59
  trigger: {
60
60
  type: "time_based" | "event_based" | "recurring";
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { NotificationTemplateId, UserId } from "../id-types";
3
- export declare const notificationEntityTypeSchema: z.ZodEnum<["agenda", "tasks", "habits", "agenda_item", "task_list", "task", "habit"]>;
3
+ export declare const notificationEntityTypeSchema: z.ZodEnum<["agenda", "tasks", "habits", "inbox", "agenda_item", "task_list", "task", "habit", "agenda_defaults", "tasks_defaults", "habits_defaults"]>;
4
4
  export type NotificationEntityType = z.infer<typeof notificationEntityTypeSchema>;
5
5
  export declare const notificationTriggerTypeSchema: z.ZodEnum<["time_based", "event_based", "recurring"]>;
6
6
  export type NotificationTriggerType = z.infer<typeof notificationTriggerTypeSchema>;
@@ -35,7 +35,7 @@ export type NotificationContent = z.infer<typeof notificationContentSchema>;
35
35
  export declare const notificationTemplateDataSchema: z.ZodObject<{
36
36
  _id: z.ZodEffects<z.ZodString, NotificationTemplateId, string>;
37
37
  userId: z.ZodEffects<z.ZodString, UserId, string>;
38
- entityType: z.ZodEnum<["agenda", "tasks", "habits", "agenda_item", "task_list", "task", "habit"]>;
38
+ entityType: z.ZodEnum<["agenda", "tasks", "habits", "inbox", "agenda_item", "task_list", "task", "habit", "agenda_defaults", "tasks_defaults", "habits_defaults"]>;
39
39
  entityId: z.ZodOptional<z.ZodString>;
40
40
  name: z.ZodString;
41
41
  description: z.ZodOptional<z.ZodString>;
@@ -79,7 +79,7 @@ export declare const notificationTemplateDataSchema: z.ZodObject<{
79
79
  userId: string & {
80
80
  readonly __brand: "UserId";
81
81
  };
82
- entityType: "agenda" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit";
82
+ entityType: "agenda" | "inbox" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit" | "agenda_defaults" | "tasks_defaults" | "habits_defaults";
83
83
  name: string;
84
84
  trigger: {
85
85
  type: "time_based" | "event_based" | "recurring";
@@ -101,7 +101,7 @@ export declare const notificationTemplateDataSchema: z.ZodObject<{
101
101
  createdAt: Date;
102
102
  updatedAt: Date;
103
103
  userId: string;
104
- entityType: "agenda" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit";
104
+ entityType: "agenda" | "inbox" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit" | "agenda_defaults" | "tasks_defaults" | "habits_defaults";
105
105
  name: string;
106
106
  trigger: {
107
107
  type: "time_based" | "event_based" | "recurring";
@@ -123,7 +123,7 @@ export type NotificationTemplateData = z.infer<typeof notificationTemplateDataSc
123
123
  export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
124
124
  _id: z.ZodEffects<z.ZodString, NotificationTemplateId, string>;
125
125
  userId: z.ZodEffects<z.ZodString, UserId, string>;
126
- entityType: z.ZodEnum<["agenda", "tasks", "habits", "agenda_item", "task_list", "task", "habit"]>;
126
+ entityType: z.ZodEnum<["agenda", "tasks", "habits", "inbox", "agenda_item", "task_list", "task", "habit", "agenda_defaults", "tasks_defaults", "habits_defaults"]>;
127
127
  entityId: z.ZodOptional<z.ZodString>;
128
128
  name: z.ZodString;
129
129
  description: z.ZodOptional<z.ZodString>;
@@ -162,7 +162,7 @@ export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
162
162
  userId: string & {
163
163
  readonly __brand: "UserId";
164
164
  };
165
- entityType: "agenda" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit";
165
+ entityType: "agenda" | "inbox" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit" | "agenda_defaults" | "tasks_defaults" | "habits_defaults";
166
166
  name: string;
167
167
  trigger: {
168
168
  type: "time_based" | "event_based" | "recurring";
@@ -181,7 +181,7 @@ export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
181
181
  inheritedFrom?: NotificationTemplateId | undefined;
182
182
  }, {
183
183
  userId: string;
184
- entityType: "agenda" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit";
184
+ entityType: "agenda" | "inbox" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit" | "agenda_defaults" | "tasks_defaults" | "habits_defaults";
185
185
  name: string;
186
186
  trigger: {
187
187
  type: "time_based" | "event_based" | "recurring";
@@ -200,3 +200,25 @@ export declare const createNotificationTemplateSchema: z.ZodObject<Omit<{
200
200
  customized?: boolean | undefined;
201
201
  }>;
202
202
  export type CreateNotificationTemplateData = z.infer<typeof createNotificationTemplateSchema>;
203
+ export declare const entitySyncStateSchema: z.ZodObject<{
204
+ userId: z.ZodEffects<z.ZodString, UserId, string>;
205
+ entityType: z.ZodEnum<["agenda", "tasks", "habits", "inbox", "agenda_item", "task_list", "task", "habit", "agenda_defaults", "tasks_defaults", "habits_defaults"]>;
206
+ entityId: z.ZodString;
207
+ synced: z.ZodDefault<z.ZodBoolean>;
208
+ updatedAt: z.ZodDate;
209
+ }, "strip", z.ZodTypeAny, {
210
+ updatedAt: Date;
211
+ userId: string & {
212
+ readonly __brand: "UserId";
213
+ };
214
+ entityType: "agenda" | "inbox" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit" | "agenda_defaults" | "tasks_defaults" | "habits_defaults";
215
+ entityId: string;
216
+ synced: boolean;
217
+ }, {
218
+ updatedAt: Date;
219
+ userId: string;
220
+ entityType: "agenda" | "inbox" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit" | "agenda_defaults" | "tasks_defaults" | "habits_defaults";
221
+ entityId: string;
222
+ synced?: boolean | undefined;
223
+ }>;
224
+ export type EntitySyncState = z.infer<typeof entitySyncStateSchema>;
@@ -1,8 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createNotificationTemplateSchema = exports.notificationTemplateDataSchema = exports.notificationContentSchema = exports.notificationTriggerSchema = exports.notificationTriggerTypeSchema = exports.notificationEntityTypeSchema = void 0;
3
+ exports.entitySyncStateSchema = exports.createNotificationTemplateSchema = exports.notificationTemplateDataSchema = exports.notificationContentSchema = exports.notificationTriggerSchema = exports.notificationTriggerTypeSchema = exports.notificationEntityTypeSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- exports.notificationEntityTypeSchema = zod_1.z.enum(['agenda', 'tasks', 'habits', 'agenda_item', 'task_list', 'task', 'habit']);
5
+ exports.notificationEntityTypeSchema = zod_1.z.enum([
6
+ // Individual entity types (notifications FOR the entity itself)
7
+ 'agenda', 'tasks', 'habits', 'inbox',
8
+ 'agenda_item', 'task_list', 'task', 'habit',
9
+ // Parent template types (default templates for children)
10
+ 'agenda_defaults', 'tasks_defaults', 'habits_defaults'
11
+ ]);
6
12
  exports.notificationTriggerTypeSchema = zod_1.z.enum(['time_based', 'event_based', 'recurring']);
7
13
  exports.notificationTriggerSchema = zod_1.z.object({
8
14
  type: exports.notificationTriggerTypeSchema,
@@ -36,3 +42,11 @@ exports.createNotificationTemplateSchema = exports.notificationTemplateDataSchem
36
42
  createdAt: true,
37
43
  updatedAt: true
38
44
  });
45
+ // Entity sync state for inheritance
46
+ exports.entitySyncStateSchema = zod_1.z.object({
47
+ userId: zod_1.z.string().transform((val) => val),
48
+ entityType: exports.notificationEntityTypeSchema,
49
+ entityId: zod_1.z.string(),
50
+ synced: zod_1.z.boolean().default(true), // true = inheriting from parent, false = has custom templates
51
+ updatedAt: zod_1.z.date()
52
+ });
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.102",
5
+ "version": "1.0.103",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
@@ -1,7 +1,14 @@
1
1
  import { z } from "zod";
2
2
  import { NotificationTemplateId, UserId } from "../id-types";
3
3
 
4
- export const notificationEntityTypeSchema = z.enum(['agenda', 'tasks', 'habits', 'agenda_item', 'task_list', 'task', 'habit']);
4
+ export const notificationEntityTypeSchema = z.enum([
5
+ // Individual entity types (notifications FOR the entity itself)
6
+ 'agenda', 'tasks', 'habits', 'inbox',
7
+ 'agenda_item', 'task_list', 'task', 'habit',
8
+
9
+ // Parent template types (default templates for children)
10
+ 'agenda_defaults', 'tasks_defaults', 'habits_defaults'
11
+ ]);
5
12
  export type NotificationEntityType = z.infer<typeof notificationEntityTypeSchema>;
6
13
 
7
14
  export const notificationTriggerTypeSchema = z.enum(['time_based', 'event_based', 'recurring']);
@@ -47,4 +54,14 @@ export const createNotificationTemplateSchema = notificationTemplateDataSchema.o
47
54
  updatedAt: true
48
55
  });
49
56
 
50
- export type CreateNotificationTemplateData = z.infer<typeof createNotificationTemplateSchema>;
57
+ export type CreateNotificationTemplateData = z.infer<typeof createNotificationTemplateSchema>;
58
+
59
+ // Entity sync state for inheritance
60
+ export const entitySyncStateSchema = z.object({
61
+ userId: z.string().transform((val): UserId => val as UserId),
62
+ entityType: notificationEntityTypeSchema,
63
+ entityId: z.string(),
64
+ synced: z.boolean().default(true), // true = inheriting from parent, false = has custom templates
65
+ updatedAt: z.date()
66
+ });
67
+ export type EntitySyncState = z.infer<typeof entitySyncStateSchema>;