@timothyw/pat-common 1.0.100 → 1.0.102
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/enums/module-type.d.ts +1 -0
- package/dist/enums/module-type.js +1 -0
- package/dist/types/api/account/update-user-types.d.ts +3 -3
- package/dist/types/api/auth/create-account-types.d.ts +2 -1
- package/dist/types/api/habits/create-habit-types.d.ts +2 -2
- package/dist/types/api/habits/update-habit-types.d.ts +2 -2
- package/dist/types/api/index.d.ts +1 -0
- package/dist/types/api/index.js +1 -0
- package/dist/types/api/notifications/create-notification-template-types.d.ts +93 -0
- package/dist/types/api/notifications/create-notification-template-types.js +31 -0
- package/dist/types/api/notifications/delete-notification-template-types.d.ts +14 -0
- package/dist/types/api/notifications/delete-notification-template-types.js +11 -0
- package/dist/types/api/notifications/get-notification-instances-types.d.ts +45 -0
- package/dist/types/api/notifications/get-notification-instances-types.js +19 -0
- package/dist/types/api/notifications/get-notification-templates-types.d.ts +23 -0
- package/dist/types/api/notifications/get-notification-templates-types.js +12 -0
- package/dist/types/api/notifications/index.d.ts +7 -0
- package/dist/types/api/notifications/index.js +23 -0
- package/dist/types/api/notifications/preview-notification-template-types.d.ts +58 -0
- package/dist/types/api/notifications/preview-notification-template-types.js +23 -0
- package/dist/types/api/notifications/sync-notification-template-types.d.ts +29 -0
- package/dist/types/api/notifications/sync-notification-template-types.js +14 -0
- package/dist/types/api/notifications/update-notification-template-types.d.ts +84 -0
- package/dist/types/api/notifications/update-notification-template-types.js +28 -0
- package/dist/types/api/people/create-person-note-types.d.ts +2 -2
- package/dist/types/api/tasks/get-tasks-types.d.ts +1 -1
- package/dist/types/id-types.d.ts +8 -0
- package/dist/types/id-types.js +3 -1
- package/dist/types/models/index.d.ts +3 -0
- package/dist/types/models/index.js +3 -0
- package/dist/types/models/notifiable.d.ts +42 -0
- package/dist/types/models/notifiable.js +2 -0
- package/dist/types/models/notification-instance-data.d.ts +128 -0
- package/dist/types/models/notification-instance-data.js +34 -0
- package/dist/types/models/notification-template-data.d.ts +202 -0
- package/dist/types/models/notification-template-data.js +38 -0
- package/dist/types/models/user-data.d.ts +2 -2
- package/dist/utils/serializing-utils.d.ts +5 -1
- package/dist/utils/serializing-utils.js +12 -0
- package/package.json +1 -1
- package/src/enums/module-type.ts +1 -0
- package/src/types/api/auth/create-account-types.ts +2 -1
- package/src/types/api/index.ts +1 -0
- package/src/types/api/notifications/create-notification-template-types.ts +39 -0
- package/src/types/api/notifications/delete-notification-template-types.ts +14 -0
- package/src/types/api/notifications/get-notification-instances-types.ts +29 -0
- package/src/types/api/notifications/get-notification-templates-types.ts +21 -0
- package/src/types/api/notifications/index.ts +7 -0
- package/src/types/api/notifications/preview-notification-template-types.ts +26 -0
- package/src/types/api/notifications/sync-notification-template-types.ts +23 -0
- package/src/types/api/notifications/update-notification-template-types.ts +36 -0
- package/src/types/api/tasks/get-tasks-types.ts +1 -1
- package/src/types/id-types.ts +7 -1
- package/src/types/models/index.ts +3 -0
- package/src/types/models/notifiable.ts +52 -0
- package/src/types/models/notification-instance-data.ts +40 -0
- package/src/types/models/notification-template-data.ts +50 -0
- package/src/utils/serializing-utils.ts +18 -0
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { UserData } from "../../models";
|
|
3
3
|
import { Serialized } from "../../../utils";
|
|
4
4
|
export declare const updateUserRequestSchema: z.ZodObject<{
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
5
6
|
sandbox: z.ZodOptional<z.ZodObject<{
|
|
6
7
|
discordId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
7
8
|
devices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -22,7 +23,6 @@ export declare const updateUserRequestSchema: z.ZodObject<{
|
|
|
22
23
|
pushToken?: string | undefined;
|
|
23
24
|
}[] | undefined;
|
|
24
25
|
}>>;
|
|
25
|
-
name: z.ZodOptional<z.ZodString>;
|
|
26
26
|
timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
27
27
|
config: z.ZodOptional<z.ZodObject<{
|
|
28
28
|
modules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -78,13 +78,13 @@ export declare const updateUserRequestSchema: z.ZodObject<{
|
|
|
78
78
|
}[] | undefined;
|
|
79
79
|
}>>;
|
|
80
80
|
}, "strict", z.ZodTypeAny, {
|
|
81
|
+
name?: string | undefined;
|
|
81
82
|
sandbox?: {
|
|
82
83
|
discordId?: string | undefined;
|
|
83
84
|
devices?: {
|
|
84
85
|
pushToken?: string | undefined;
|
|
85
86
|
}[] | undefined;
|
|
86
87
|
} | undefined;
|
|
87
|
-
name?: string | undefined;
|
|
88
88
|
timezone?: string | undefined;
|
|
89
89
|
config?: {
|
|
90
90
|
agenda?: {
|
|
@@ -100,13 +100,13 @@ export declare const updateUserRequestSchema: z.ZodObject<{
|
|
|
100
100
|
}[] | undefined;
|
|
101
101
|
} | undefined;
|
|
102
102
|
}, {
|
|
103
|
+
name?: string | undefined;
|
|
103
104
|
sandbox?: {
|
|
104
105
|
discordId?: string | undefined;
|
|
105
106
|
devices?: {
|
|
106
107
|
pushToken?: string | undefined;
|
|
107
108
|
}[] | undefined;
|
|
108
109
|
} | undefined;
|
|
109
|
-
name?: string | undefined;
|
|
110
110
|
timezone?: string | undefined;
|
|
111
111
|
config?: {
|
|
112
112
|
agenda?: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { UserId } from "../../id-types";
|
|
2
3
|
export declare const createAccountRequestSchema: z.ZodObject<{
|
|
3
4
|
name: z.ZodString;
|
|
4
5
|
email: z.ZodString;
|
|
@@ -17,7 +18,7 @@ export declare const createAccountRequestSchema: z.ZodObject<{
|
|
|
17
18
|
}>;
|
|
18
19
|
export type CreateAccountRequest = z.infer<typeof createAccountRequestSchema>;
|
|
19
20
|
export interface CreateAccountResponse {
|
|
20
|
-
id:
|
|
21
|
+
id: UserId;
|
|
21
22
|
name: string;
|
|
22
23
|
email: string;
|
|
23
24
|
}
|
|
@@ -11,14 +11,14 @@ export declare const createHabitRequestSchema: z.ZodObject<{
|
|
|
11
11
|
name: string;
|
|
12
12
|
frequency: HabitFrequency;
|
|
13
13
|
rolloverTime: string;
|
|
14
|
-
notes?: string | undefined;
|
|
15
14
|
description?: string | undefined;
|
|
15
|
+
notes?: string | undefined;
|
|
16
16
|
}, {
|
|
17
17
|
name: string;
|
|
18
18
|
frequency: HabitFrequency;
|
|
19
19
|
rolloverTime: string;
|
|
20
|
-
notes?: string | undefined;
|
|
21
20
|
description?: string | undefined;
|
|
21
|
+
notes?: string | undefined;
|
|
22
22
|
}>;
|
|
23
23
|
export type CreateHabitRequest = z.infer<typeof createHabitRequestSchema>;
|
|
24
24
|
export interface CreateHabitResponse {
|
|
@@ -9,14 +9,14 @@ export declare const updateHabitRequestSchema: z.ZodObject<{
|
|
|
9
9
|
rolloverTime: z.ZodOptional<z.ZodString>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
name?: string | undefined;
|
|
12
|
-
notes?: string | null | undefined;
|
|
13
12
|
description?: string | null | undefined;
|
|
13
|
+
notes?: string | null | undefined;
|
|
14
14
|
frequency?: HabitFrequency | undefined;
|
|
15
15
|
rolloverTime?: string | undefined;
|
|
16
16
|
}, {
|
|
17
17
|
name?: string | undefined;
|
|
18
|
-
notes?: string | null | undefined;
|
|
19
18
|
description?: string | null | undefined;
|
|
19
|
+
notes?: string | null | undefined;
|
|
20
20
|
frequency?: HabitFrequency | undefined;
|
|
21
21
|
rolloverTime?: string | undefined;
|
|
22
22
|
}>;
|
package/dist/types/api/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./auth"), exports);
|
|
|
19
19
|
__exportStar(require("./habits"), exports);
|
|
20
20
|
__exportStar(require("./items"), exports);
|
|
21
21
|
__exportStar(require("./misc"), exports);
|
|
22
|
+
__exportStar(require("./notifications"), exports);
|
|
22
23
|
__exportStar(require("./people"), exports);
|
|
23
24
|
__exportStar(require("./tasks"), exports);
|
|
24
25
|
__exportStar(require("./thoughts"), exports);
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { NotificationTemplateData } from "../../models/notification-template-data";
|
|
4
|
+
export declare const createNotificationTemplateRequestSchema: z.ZodObject<{
|
|
5
|
+
entityType: z.ZodEnum<["agenda", "tasks", "habits", "agenda_item", "task_list", "task", "habit"]>;
|
|
6
|
+
entityId: z.ZodOptional<z.ZodString>;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
description: z.ZodOptional<z.ZodString>;
|
|
9
|
+
trigger: z.ZodObject<{
|
|
10
|
+
type: z.ZodEnum<["time_based", "event_based", "recurring"]>;
|
|
11
|
+
conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
12
|
+
timing: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
type: "time_based" | "event_based" | "recurring";
|
|
15
|
+
conditions: Record<string, any>;
|
|
16
|
+
timing: Record<string, any>;
|
|
17
|
+
}, {
|
|
18
|
+
type: "time_based" | "event_based" | "recurring";
|
|
19
|
+
conditions: Record<string, any>;
|
|
20
|
+
timing: Record<string, any>;
|
|
21
|
+
}>;
|
|
22
|
+
content: z.ZodObject<{
|
|
23
|
+
title: z.ZodString;
|
|
24
|
+
body: z.ZodString;
|
|
25
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
title: string;
|
|
28
|
+
body: string;
|
|
29
|
+
variables?: Record<string, string> | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
title: string;
|
|
32
|
+
body: string;
|
|
33
|
+
variables?: Record<string, string> | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
36
|
+
inheritedFrom: z.ZodOptional<z.ZodString>;
|
|
37
|
+
customized: z.ZodDefault<z.ZodBoolean>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
entityType: "agenda" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit";
|
|
40
|
+
name: string;
|
|
41
|
+
trigger: {
|
|
42
|
+
type: "time_based" | "event_based" | "recurring";
|
|
43
|
+
conditions: Record<string, any>;
|
|
44
|
+
timing: Record<string, any>;
|
|
45
|
+
};
|
|
46
|
+
content: {
|
|
47
|
+
title: string;
|
|
48
|
+
body: string;
|
|
49
|
+
variables?: Record<string, string> | undefined;
|
|
50
|
+
};
|
|
51
|
+
active: boolean;
|
|
52
|
+
customized: boolean;
|
|
53
|
+
entityId?: string | undefined;
|
|
54
|
+
description?: string | undefined;
|
|
55
|
+
inheritedFrom?: string | undefined;
|
|
56
|
+
}, {
|
|
57
|
+
entityType: "agenda" | "tasks" | "habits" | "agenda_item" | "task_list" | "task" | "habit";
|
|
58
|
+
name: string;
|
|
59
|
+
trigger: {
|
|
60
|
+
type: "time_based" | "event_based" | "recurring";
|
|
61
|
+
conditions: Record<string, any>;
|
|
62
|
+
timing: Record<string, any>;
|
|
63
|
+
};
|
|
64
|
+
content: {
|
|
65
|
+
title: string;
|
|
66
|
+
body: string;
|
|
67
|
+
variables?: Record<string, string> | undefined;
|
|
68
|
+
};
|
|
69
|
+
entityId?: string | undefined;
|
|
70
|
+
description?: string | undefined;
|
|
71
|
+
active?: boolean | undefined;
|
|
72
|
+
inheritedFrom?: string | undefined;
|
|
73
|
+
customized?: boolean | undefined;
|
|
74
|
+
}>;
|
|
75
|
+
export type CreateNotificationTemplateRequest = z.infer<typeof createNotificationTemplateRequestSchema>;
|
|
76
|
+
export declare const createNotificationTemplateResponseSchema: z.ZodObject<{
|
|
77
|
+
success: z.ZodBoolean;
|
|
78
|
+
template: z.ZodOptional<z.ZodAny>;
|
|
79
|
+
error: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
success: boolean;
|
|
82
|
+
error?: string | undefined;
|
|
83
|
+
template?: any;
|
|
84
|
+
}, {
|
|
85
|
+
success: boolean;
|
|
86
|
+
error?: string | undefined;
|
|
87
|
+
template?: any;
|
|
88
|
+
}>;
|
|
89
|
+
export type CreateNotificationTemplateResponse = {
|
|
90
|
+
success: boolean;
|
|
91
|
+
template?: Serialized<NotificationTemplateData>;
|
|
92
|
+
error?: string;
|
|
93
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNotificationTemplateResponseSchema = exports.createNotificationTemplateRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const notification_template_data_1 = require("../../models/notification-template-data");
|
|
6
|
+
// Request schema
|
|
7
|
+
exports.createNotificationTemplateRequestSchema = zod_1.z.object({
|
|
8
|
+
entityType: notification_template_data_1.notificationEntityTypeSchema,
|
|
9
|
+
entityId: zod_1.z.string().optional(),
|
|
10
|
+
name: zod_1.z.string().min(1).max(100),
|
|
11
|
+
description: zod_1.z.string().max(500).optional(),
|
|
12
|
+
trigger: zod_1.z.object({
|
|
13
|
+
type: notification_template_data_1.notificationTriggerTypeSchema,
|
|
14
|
+
conditions: zod_1.z.record(zod_1.z.any()),
|
|
15
|
+
timing: zod_1.z.record(zod_1.z.any())
|
|
16
|
+
}),
|
|
17
|
+
content: zod_1.z.object({
|
|
18
|
+
title: zod_1.z.string().min(1).max(200),
|
|
19
|
+
body: zod_1.z.string().min(1).max(1000),
|
|
20
|
+
variables: zod_1.z.record(zod_1.z.string()).optional()
|
|
21
|
+
}),
|
|
22
|
+
active: zod_1.z.boolean().default(true),
|
|
23
|
+
inheritedFrom: zod_1.z.string().optional(),
|
|
24
|
+
customized: zod_1.z.boolean().default(false)
|
|
25
|
+
});
|
|
26
|
+
// Response schema
|
|
27
|
+
exports.createNotificationTemplateResponseSchema = zod_1.z.object({
|
|
28
|
+
success: zod_1.z.boolean(),
|
|
29
|
+
template: zod_1.z.any().optional(), // Will be Serialized<NotificationTemplateData>
|
|
30
|
+
error: zod_1.z.string().optional()
|
|
31
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const deleteNotificationTemplateRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
3
|
+
export type DeleteNotificationTemplateRequest = z.infer<typeof deleteNotificationTemplateRequestSchema>;
|
|
4
|
+
export declare const deleteNotificationTemplateResponseSchema: z.ZodObject<{
|
|
5
|
+
success: z.ZodBoolean;
|
|
6
|
+
error: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
success: boolean;
|
|
9
|
+
error?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
success: boolean;
|
|
12
|
+
error?: string | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
export type DeleteNotificationTemplateResponse = z.infer<typeof deleteNotificationTemplateResponseSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteNotificationTemplateResponseSchema = exports.deleteNotificationTemplateRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Request schema - no body needed for DELETE
|
|
6
|
+
exports.deleteNotificationTemplateRequestSchema = zod_1.z.object({});
|
|
7
|
+
// Response schema
|
|
8
|
+
exports.deleteNotificationTemplateResponseSchema = zod_1.z.object({
|
|
9
|
+
success: zod_1.z.boolean(),
|
|
10
|
+
error: zod_1.z.string().optional()
|
|
11
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { NotificationInstanceData } from "../../models/notification-instance-data";
|
|
4
|
+
export declare const getNotificationInstancesRequestSchema: z.ZodObject<{
|
|
5
|
+
status: z.ZodOptional<z.ZodString>;
|
|
6
|
+
templateId: z.ZodOptional<z.ZodString>;
|
|
7
|
+
entityId: z.ZodOptional<z.ZodString>;
|
|
8
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
9
|
+
offset: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
status?: string | undefined;
|
|
12
|
+
entityId?: string | undefined;
|
|
13
|
+
templateId?: string | undefined;
|
|
14
|
+
limit?: number | undefined;
|
|
15
|
+
offset?: number | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
status?: string | undefined;
|
|
18
|
+
entityId?: string | undefined;
|
|
19
|
+
templateId?: string | undefined;
|
|
20
|
+
limit?: number | undefined;
|
|
21
|
+
offset?: number | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
export type GetNotificationInstancesRequest = z.infer<typeof getNotificationInstancesRequestSchema>;
|
|
24
|
+
export declare const getNotificationInstancesResponseSchema: z.ZodObject<{
|
|
25
|
+
success: z.ZodBoolean;
|
|
26
|
+
instances: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
27
|
+
total: z.ZodOptional<z.ZodNumber>;
|
|
28
|
+
error: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
success: boolean;
|
|
31
|
+
error?: string | undefined;
|
|
32
|
+
instances?: any[] | undefined;
|
|
33
|
+
total?: number | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
success: boolean;
|
|
36
|
+
error?: string | undefined;
|
|
37
|
+
instances?: any[] | undefined;
|
|
38
|
+
total?: number | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export type GetNotificationInstancesResponse = {
|
|
41
|
+
success: boolean;
|
|
42
|
+
instances?: Serialized<NotificationInstanceData>[];
|
|
43
|
+
total?: number;
|
|
44
|
+
error?: string;
|
|
45
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNotificationInstancesResponseSchema = exports.getNotificationInstancesRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Request schema - query parameters
|
|
6
|
+
exports.getNotificationInstancesRequestSchema = zod_1.z.object({
|
|
7
|
+
status: zod_1.z.string().optional(), // filter by status
|
|
8
|
+
templateId: zod_1.z.string().optional(), // filter by template
|
|
9
|
+
entityId: zod_1.z.string().optional(), // filter by entity
|
|
10
|
+
limit: zod_1.z.number().optional(), // pagination
|
|
11
|
+
offset: zod_1.z.number().optional() // pagination
|
|
12
|
+
});
|
|
13
|
+
// Response schema
|
|
14
|
+
exports.getNotificationInstancesResponseSchema = zod_1.z.object({
|
|
15
|
+
success: zod_1.z.boolean(),
|
|
16
|
+
instances: zod_1.z.array(zod_1.z.any()).optional(), // Will be Serialized<NotificationInstanceData>[]
|
|
17
|
+
total: zod_1.z.number().optional(),
|
|
18
|
+
error: zod_1.z.string().optional()
|
|
19
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { NotificationTemplateData } from "../../models/notification-template-data";
|
|
4
|
+
export declare const getNotificationTemplatesRequestSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
5
|
+
export type GetNotificationTemplatesRequest = z.infer<typeof getNotificationTemplatesRequestSchema>;
|
|
6
|
+
export declare const getNotificationTemplatesResponseSchema: z.ZodObject<{
|
|
7
|
+
success: z.ZodBoolean;
|
|
8
|
+
templates: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
9
|
+
error: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
success: boolean;
|
|
12
|
+
error?: string | undefined;
|
|
13
|
+
templates?: any[] | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
success: boolean;
|
|
16
|
+
error?: string | undefined;
|
|
17
|
+
templates?: any[] | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
export type GetNotificationTemplatesResponse = {
|
|
20
|
+
success: boolean;
|
|
21
|
+
templates?: Serialized<NotificationTemplateData>[];
|
|
22
|
+
error?: string;
|
|
23
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNotificationTemplatesResponseSchema = exports.getNotificationTemplatesRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Request schema - no body needed for GET
|
|
6
|
+
exports.getNotificationTemplatesRequestSchema = zod_1.z.object({});
|
|
7
|
+
// Response schema
|
|
8
|
+
exports.getNotificationTemplatesResponseSchema = zod_1.z.object({
|
|
9
|
+
success: zod_1.z.boolean(),
|
|
10
|
+
templates: zod_1.z.array(zod_1.z.any()).optional(), // Will be Serialized<NotificationTemplateData>[]
|
|
11
|
+
error: zod_1.z.string().optional()
|
|
12
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './get-notification-templates-types';
|
|
2
|
+
export * from './create-notification-template-types';
|
|
3
|
+
export * from './update-notification-template-types';
|
|
4
|
+
export * from './delete-notification-template-types';
|
|
5
|
+
export * from './get-notification-instances-types';
|
|
6
|
+
export * from './preview-notification-template-types';
|
|
7
|
+
export * from './sync-notification-template-types';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-notification-templates-types"), exports);
|
|
18
|
+
__exportStar(require("./create-notification-template-types"), exports);
|
|
19
|
+
__exportStar(require("./update-notification-template-types"), exports);
|
|
20
|
+
__exportStar(require("./delete-notification-template-types"), exports);
|
|
21
|
+
__exportStar(require("./get-notification-instances-types"), exports);
|
|
22
|
+
__exportStar(require("./preview-notification-template-types"), exports);
|
|
23
|
+
__exportStar(require("./sync-notification-template-types"), exports);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const previewNotificationTemplateRequestSchema: z.ZodObject<{
|
|
3
|
+
templateTitle: z.ZodString;
|
|
4
|
+
templateBody: z.ZodString;
|
|
5
|
+
entityType: z.ZodString;
|
|
6
|
+
entityId: z.ZodString;
|
|
7
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
entityType: string;
|
|
10
|
+
entityId: string;
|
|
11
|
+
templateTitle: string;
|
|
12
|
+
templateBody: string;
|
|
13
|
+
variables?: Record<string, any> | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
entityType: string;
|
|
16
|
+
entityId: string;
|
|
17
|
+
templateTitle: string;
|
|
18
|
+
templateBody: string;
|
|
19
|
+
variables?: Record<string, any> | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
export type PreviewNotificationTemplateRequest = z.infer<typeof previewNotificationTemplateRequestSchema>;
|
|
22
|
+
export declare const previewNotificationTemplateResponseSchema: z.ZodObject<{
|
|
23
|
+
success: z.ZodBoolean;
|
|
24
|
+
preview: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
title: z.ZodString;
|
|
26
|
+
body: z.ZodString;
|
|
27
|
+
variables: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
title: string;
|
|
30
|
+
body: string;
|
|
31
|
+
variables: Record<string, any>;
|
|
32
|
+
}, {
|
|
33
|
+
title: string;
|
|
34
|
+
body: string;
|
|
35
|
+
variables: Record<string, any>;
|
|
36
|
+
}>>;
|
|
37
|
+
missingVariables: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
38
|
+
error: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
success: boolean;
|
|
41
|
+
error?: string | undefined;
|
|
42
|
+
preview?: {
|
|
43
|
+
title: string;
|
|
44
|
+
body: string;
|
|
45
|
+
variables: Record<string, any>;
|
|
46
|
+
} | undefined;
|
|
47
|
+
missingVariables?: string[] | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
success: boolean;
|
|
50
|
+
error?: string | undefined;
|
|
51
|
+
preview?: {
|
|
52
|
+
title: string;
|
|
53
|
+
body: string;
|
|
54
|
+
variables: Record<string, any>;
|
|
55
|
+
} | undefined;
|
|
56
|
+
missingVariables?: string[] | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
export type PreviewNotificationTemplateResponse = z.infer<typeof previewNotificationTemplateResponseSchema>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.previewNotificationTemplateResponseSchema = exports.previewNotificationTemplateRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Request schema
|
|
6
|
+
exports.previewNotificationTemplateRequestSchema = zod_1.z.object({
|
|
7
|
+
templateTitle: zod_1.z.string(),
|
|
8
|
+
templateBody: zod_1.z.string(),
|
|
9
|
+
entityType: zod_1.z.string(),
|
|
10
|
+
entityId: zod_1.z.string(),
|
|
11
|
+
variables: zod_1.z.record(zod_1.z.any()).optional()
|
|
12
|
+
});
|
|
13
|
+
// Response schema
|
|
14
|
+
exports.previewNotificationTemplateResponseSchema = zod_1.z.object({
|
|
15
|
+
success: zod_1.z.boolean(),
|
|
16
|
+
preview: zod_1.z.object({
|
|
17
|
+
title: zod_1.z.string(),
|
|
18
|
+
body: zod_1.z.string(),
|
|
19
|
+
variables: zod_1.z.record(zod_1.z.any())
|
|
20
|
+
}).optional(),
|
|
21
|
+
missingVariables: zod_1.z.array(zod_1.z.string()).optional(),
|
|
22
|
+
error: zod_1.z.string().optional()
|
|
23
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { NotificationTemplateData } from "../../models/notification-template-data";
|
|
4
|
+
export declare const syncNotificationTemplateRequestSchema: z.ZodObject<{
|
|
5
|
+
sync: z.ZodBoolean;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
sync: boolean;
|
|
8
|
+
}, {
|
|
9
|
+
sync: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
export type SyncNotificationTemplateRequest = z.infer<typeof syncNotificationTemplateRequestSchema>;
|
|
12
|
+
export declare const syncNotificationTemplateResponseSchema: z.ZodObject<{
|
|
13
|
+
success: z.ZodBoolean;
|
|
14
|
+
template: z.ZodOptional<z.ZodAny>;
|
|
15
|
+
error: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
success: boolean;
|
|
18
|
+
error?: string | undefined;
|
|
19
|
+
template?: any;
|
|
20
|
+
}, {
|
|
21
|
+
success: boolean;
|
|
22
|
+
error?: string | undefined;
|
|
23
|
+
template?: any;
|
|
24
|
+
}>;
|
|
25
|
+
export type SyncNotificationTemplateResponse = {
|
|
26
|
+
success: boolean;
|
|
27
|
+
template?: Serialized<NotificationTemplateData>;
|
|
28
|
+
error?: string;
|
|
29
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.syncNotificationTemplateResponseSchema = exports.syncNotificationTemplateRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
// Request schema
|
|
6
|
+
exports.syncNotificationTemplateRequestSchema = zod_1.z.object({
|
|
7
|
+
sync: zod_1.z.boolean() // true to sync with parent, false to unsync
|
|
8
|
+
});
|
|
9
|
+
// Response schema
|
|
10
|
+
exports.syncNotificationTemplateResponseSchema = zod_1.z.object({
|
|
11
|
+
success: zod_1.z.boolean(),
|
|
12
|
+
template: zod_1.z.any().optional(), // Will be Serialized<NotificationTemplateData>
|
|
13
|
+
error: zod_1.z.string().optional()
|
|
14
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { Serialized } from "../../../utils";
|
|
3
|
+
import { NotificationTemplateData } from "../../models/notification-template-data";
|
|
4
|
+
export declare const updateNotificationTemplateRequestSchema: z.ZodObject<{
|
|
5
|
+
name: z.ZodOptional<z.ZodString>;
|
|
6
|
+
description: z.ZodOptional<z.ZodString>;
|
|
7
|
+
trigger: z.ZodOptional<z.ZodObject<{
|
|
8
|
+
type: z.ZodEnum<["time_based", "event_based", "recurring"]>;
|
|
9
|
+
conditions: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
10
|
+
timing: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
type: "time_based" | "event_based" | "recurring";
|
|
13
|
+
conditions: Record<string, any>;
|
|
14
|
+
timing: Record<string, any>;
|
|
15
|
+
}, {
|
|
16
|
+
type: "time_based" | "event_based" | "recurring";
|
|
17
|
+
conditions: Record<string, any>;
|
|
18
|
+
timing: Record<string, any>;
|
|
19
|
+
}>>;
|
|
20
|
+
content: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
title: z.ZodString;
|
|
22
|
+
body: z.ZodString;
|
|
23
|
+
variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
title: string;
|
|
26
|
+
body: string;
|
|
27
|
+
variables?: Record<string, string> | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
title: string;
|
|
30
|
+
body: string;
|
|
31
|
+
variables?: Record<string, string> | undefined;
|
|
32
|
+
}>>;
|
|
33
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
customized: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
name?: string | undefined;
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
trigger?: {
|
|
39
|
+
type: "time_based" | "event_based" | "recurring";
|
|
40
|
+
conditions: Record<string, any>;
|
|
41
|
+
timing: Record<string, any>;
|
|
42
|
+
} | undefined;
|
|
43
|
+
content?: {
|
|
44
|
+
title: string;
|
|
45
|
+
body: string;
|
|
46
|
+
variables?: Record<string, string> | undefined;
|
|
47
|
+
} | undefined;
|
|
48
|
+
active?: boolean | undefined;
|
|
49
|
+
customized?: boolean | undefined;
|
|
50
|
+
}, {
|
|
51
|
+
name?: string | undefined;
|
|
52
|
+
description?: string | undefined;
|
|
53
|
+
trigger?: {
|
|
54
|
+
type: "time_based" | "event_based" | "recurring";
|
|
55
|
+
conditions: Record<string, any>;
|
|
56
|
+
timing: Record<string, any>;
|
|
57
|
+
} | undefined;
|
|
58
|
+
content?: {
|
|
59
|
+
title: string;
|
|
60
|
+
body: string;
|
|
61
|
+
variables?: Record<string, string> | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
active?: boolean | undefined;
|
|
64
|
+
customized?: boolean | undefined;
|
|
65
|
+
}>;
|
|
66
|
+
export type UpdateNotificationTemplateRequest = z.infer<typeof updateNotificationTemplateRequestSchema>;
|
|
67
|
+
export declare const updateNotificationTemplateResponseSchema: z.ZodObject<{
|
|
68
|
+
success: z.ZodBoolean;
|
|
69
|
+
template: z.ZodOptional<z.ZodAny>;
|
|
70
|
+
error: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
success: boolean;
|
|
73
|
+
error?: string | undefined;
|
|
74
|
+
template?: any;
|
|
75
|
+
}, {
|
|
76
|
+
success: boolean;
|
|
77
|
+
error?: string | undefined;
|
|
78
|
+
template?: any;
|
|
79
|
+
}>;
|
|
80
|
+
export type UpdateNotificationTemplateResponse = {
|
|
81
|
+
success: boolean;
|
|
82
|
+
template?: Serialized<NotificationTemplateData>;
|
|
83
|
+
error?: string;
|
|
84
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateNotificationTemplateResponseSchema = exports.updateNotificationTemplateRequestSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const notification_template_data_1 = require("../../models/notification-template-data");
|
|
6
|
+
// Request schema
|
|
7
|
+
exports.updateNotificationTemplateRequestSchema = zod_1.z.object({
|
|
8
|
+
name: zod_1.z.string().min(1).max(100).optional(),
|
|
9
|
+
description: zod_1.z.string().max(500).optional(),
|
|
10
|
+
trigger: zod_1.z.object({
|
|
11
|
+
type: notification_template_data_1.notificationTriggerTypeSchema,
|
|
12
|
+
conditions: zod_1.z.record(zod_1.z.any()),
|
|
13
|
+
timing: zod_1.z.record(zod_1.z.any())
|
|
14
|
+
}).optional(),
|
|
15
|
+
content: zod_1.z.object({
|
|
16
|
+
title: zod_1.z.string().min(1).max(200),
|
|
17
|
+
body: zod_1.z.string().min(1).max(1000),
|
|
18
|
+
variables: zod_1.z.record(zod_1.z.string()).optional()
|
|
19
|
+
}).optional(),
|
|
20
|
+
active: zod_1.z.boolean().optional(),
|
|
21
|
+
customized: zod_1.z.boolean().optional()
|
|
22
|
+
});
|
|
23
|
+
// Response schema
|
|
24
|
+
exports.updateNotificationTemplateResponseSchema = zod_1.z.object({
|
|
25
|
+
success: zod_1.z.boolean(),
|
|
26
|
+
template: zod_1.z.any().optional(), // Will be Serialized<NotificationTemplateData>
|
|
27
|
+
error: zod_1.z.string().optional()
|
|
28
|
+
});
|