@timothyw/pat-common 1.0.147 → 1.0.149
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.
|
@@ -6,15 +6,15 @@ export interface NotificationContext<T = any> {
|
|
|
6
6
|
entityData: T;
|
|
7
7
|
userId: string;
|
|
8
8
|
}
|
|
9
|
-
export declare enum NotificationTemplateLevel {
|
|
10
|
-
PARENT = "parent",
|
|
11
|
-
ENTITY = "entity"
|
|
12
|
-
}
|
|
13
9
|
export declare enum NotificationTemplateSyncState {
|
|
14
10
|
SYNCED = "synced",
|
|
15
11
|
DESYNCED = "desynced",
|
|
16
12
|
NO_PARENT = "no_parent"
|
|
17
13
|
}
|
|
14
|
+
export declare enum NotificationTemplateLevel {
|
|
15
|
+
PARENT = "parent",
|
|
16
|
+
ENTITY = "entity"
|
|
17
|
+
}
|
|
18
18
|
export declare enum NotificationEntityType {
|
|
19
19
|
AGENDA_ITEM = "agenda_item",
|
|
20
20
|
HABIT = "habit",
|
|
@@ -29,6 +29,7 @@ export declare enum NotificationVariantType {
|
|
|
29
29
|
AGENDA_ITEM_UPCOMING_DEADLINE = "agenda_item_upcoming_deadline",
|
|
30
30
|
HABIT_INCOMPLETE = "habit_incomplete"
|
|
31
31
|
}
|
|
32
|
+
export declare const ENTITY_TYPE_VARIANT_MAP: Record<NotificationEntityType, NotificationVariantType[]>;
|
|
32
33
|
export declare const notificationSchedulerDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
33
34
|
type: z.ZodLiteral<NotificationSchedulerType.DAY_TIME>;
|
|
34
35
|
days: z.ZodArray<z.ZodNumber, "many">;
|
|
@@ -265,15 +266,15 @@ export declare const getEntitySyncRequestSchema: z.ZodObject<{
|
|
|
265
266
|
export declare const setEntitySyncRequestSchema: z.ZodObject<{
|
|
266
267
|
targetEntityType: z.ZodNativeEnum<typeof NotificationEntityType>;
|
|
267
268
|
targetId: z.ZodString;
|
|
268
|
-
|
|
269
|
+
synced: z.ZodBoolean;
|
|
269
270
|
}, "strip", z.ZodTypeAny, {
|
|
271
|
+
synced: boolean;
|
|
270
272
|
targetEntityType: NotificationEntityType;
|
|
271
273
|
targetId: string;
|
|
272
|
-
syncState: NotificationTemplateSyncState;
|
|
273
274
|
}, {
|
|
275
|
+
synced: boolean;
|
|
274
276
|
targetEntityType: NotificationEntityType;
|
|
275
277
|
targetId: string;
|
|
276
|
-
syncState: NotificationTemplateSyncState;
|
|
277
278
|
}>;
|
|
278
279
|
export type NotificationTemplateData = z.infer<typeof notificationTemplateSchema>;
|
|
279
280
|
export type NotificationDesyncData = z.infer<typeof notificationDesyncSchema>;
|
|
@@ -296,5 +297,5 @@ export interface GetEntitySyncResponse {
|
|
|
296
297
|
syncState: NotificationTemplateSyncState;
|
|
297
298
|
}
|
|
298
299
|
export interface SetEntitySyncResponse {
|
|
299
|
-
|
|
300
|
+
synced: boolean;
|
|
300
301
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
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.notificationSchedulerDataSchema = exports.NotificationVariantType = exports.NotificationSchedulerType = exports.NotificationEntityType = exports.
|
|
3
|
+
exports.setEntitySyncRequestSchema = exports.getEntitySyncRequestSchema = exports.updateNotificationTemplateRequestSchema = exports.createNotificationTemplateRequestSchema = exports.notificationDesyncSchema = exports.notificationTemplateSchema = 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
|
-
var NotificationTemplateLevel;
|
|
7
|
-
(function (NotificationTemplateLevel) {
|
|
8
|
-
NotificationTemplateLevel["PARENT"] = "parent";
|
|
9
|
-
NotificationTemplateLevel["ENTITY"] = "entity";
|
|
10
|
-
})(NotificationTemplateLevel || (exports.NotificationTemplateLevel = NotificationTemplateLevel = {}));
|
|
11
6
|
var NotificationTemplateSyncState;
|
|
12
7
|
(function (NotificationTemplateSyncState) {
|
|
13
8
|
NotificationTemplateSyncState["SYNCED"] = "synced";
|
|
14
9
|
NotificationTemplateSyncState["DESYNCED"] = "desynced";
|
|
15
10
|
NotificationTemplateSyncState["NO_PARENT"] = "no_parent";
|
|
16
11
|
})(NotificationTemplateSyncState || (exports.NotificationTemplateSyncState = NotificationTemplateSyncState = {}));
|
|
12
|
+
var NotificationTemplateLevel;
|
|
13
|
+
(function (NotificationTemplateLevel) {
|
|
14
|
+
NotificationTemplateLevel["PARENT"] = "parent";
|
|
15
|
+
NotificationTemplateLevel["ENTITY"] = "entity";
|
|
16
|
+
})(NotificationTemplateLevel || (exports.NotificationTemplateLevel = NotificationTemplateLevel = {}));
|
|
17
17
|
var NotificationEntityType;
|
|
18
18
|
(function (NotificationEntityType) {
|
|
19
19
|
NotificationEntityType["AGENDA_ITEM"] = "agenda_item";
|
|
@@ -31,6 +31,16 @@ var NotificationVariantType;
|
|
|
31
31
|
NotificationVariantType["AGENDA_ITEM_UPCOMING_DEADLINE"] = "agenda_item_upcoming_deadline";
|
|
32
32
|
NotificationVariantType["HABIT_INCOMPLETE"] = "habit_incomplete";
|
|
33
33
|
})(NotificationVariantType || (exports.NotificationVariantType = NotificationVariantType = {}));
|
|
34
|
+
exports.ENTITY_TYPE_VARIANT_MAP = {
|
|
35
|
+
[NotificationEntityType.AGENDA_ITEM]: [
|
|
36
|
+
NotificationVariantType.AGENDA_ITEM_UPCOMING_DEADLINE,
|
|
37
|
+
],
|
|
38
|
+
[NotificationEntityType.HABIT]: [
|
|
39
|
+
NotificationVariantType.HABIT_INCOMPLETE,
|
|
40
|
+
],
|
|
41
|
+
[NotificationEntityType.AGENDA_PANEL]: [],
|
|
42
|
+
[NotificationEntityType.INBOX_PANEL]: [],
|
|
43
|
+
};
|
|
34
44
|
exports.notificationSchedulerDataSchema = zod_1.z.discriminatedUnion('type', [
|
|
35
45
|
zod_1.z.object({
|
|
36
46
|
type: zod_1.z.literal(NotificationSchedulerType.DAY_TIME),
|
|
@@ -81,5 +91,5 @@ exports.getEntitySyncRequestSchema = zod_1.z.object({
|
|
|
81
91
|
exports.setEntitySyncRequestSchema = zod_1.z.object({
|
|
82
92
|
targetEntityType: zod_1.z.nativeEnum(NotificationEntityType),
|
|
83
93
|
targetId: zod_1.z.string(),
|
|
84
|
-
|
|
94
|
+
synced: zod_1.z.boolean()
|
|
85
95
|
});
|
package/package.json
CHANGED
|
@@ -9,17 +9,17 @@ export interface NotificationContext<T = any> {
|
|
|
9
9
|
userId: string;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export enum NotificationTemplateLevel {
|
|
13
|
-
PARENT = 'parent',
|
|
14
|
-
ENTITY = 'entity'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
12
|
export enum NotificationTemplateSyncState {
|
|
18
13
|
SYNCED = 'synced',
|
|
19
14
|
DESYNCED = 'desynced',
|
|
20
15
|
NO_PARENT = 'no_parent'
|
|
21
16
|
}
|
|
22
17
|
|
|
18
|
+
export enum NotificationTemplateLevel {
|
|
19
|
+
PARENT = 'parent',
|
|
20
|
+
ENTITY = 'entity'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
23
|
export enum NotificationEntityType {
|
|
24
24
|
AGENDA_ITEM = 'agenda_item',
|
|
25
25
|
HABIT = 'habit',
|
|
@@ -38,6 +38,17 @@ export enum NotificationVariantType {
|
|
|
38
38
|
HABIT_INCOMPLETE = 'habit_incomplete',
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
export const ENTITY_TYPE_VARIANT_MAP: Record<NotificationEntityType, NotificationVariantType[]> = {
|
|
42
|
+
[NotificationEntityType.AGENDA_ITEM]: [
|
|
43
|
+
NotificationVariantType.AGENDA_ITEM_UPCOMING_DEADLINE,
|
|
44
|
+
],
|
|
45
|
+
[NotificationEntityType.HABIT]: [
|
|
46
|
+
NotificationVariantType.HABIT_INCOMPLETE,
|
|
47
|
+
],
|
|
48
|
+
[NotificationEntityType.AGENDA_PANEL]: [],
|
|
49
|
+
[NotificationEntityType.INBOX_PANEL]: [],
|
|
50
|
+
} as const;
|
|
51
|
+
|
|
41
52
|
export const notificationSchedulerDataSchema = z.discriminatedUnion('type', [
|
|
42
53
|
z.object({
|
|
43
54
|
type: z.literal(NotificationSchedulerType.DAY_TIME),
|
|
@@ -94,7 +105,7 @@ export const getEntitySyncRequestSchema = z.object({
|
|
|
94
105
|
export const setEntitySyncRequestSchema = z.object({
|
|
95
106
|
targetEntityType: z.nativeEnum(NotificationEntityType),
|
|
96
107
|
targetId: z.string(),
|
|
97
|
-
|
|
108
|
+
synced: z.boolean()
|
|
98
109
|
});
|
|
99
110
|
|
|
100
111
|
export type NotificationTemplateData = z.infer<typeof notificationTemplateSchema>;
|
|
@@ -125,5 +136,5 @@ export interface GetEntitySyncResponse {
|
|
|
125
136
|
}
|
|
126
137
|
|
|
127
138
|
export interface SetEntitySyncResponse {
|
|
128
|
-
|
|
139
|
+
synced: boolean;
|
|
129
140
|
}
|