@headless-lms/core 0.2.0 → 0.4.0
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/assets/events.d.ts +42 -24
- package/dist/assets/events.js +1 -1
- package/dist/assets/events.js.map +1 -1
- package/dist/assets/file-urls.d.ts +20 -0
- package/dist/assets/file-urls.js +25 -0
- package/dist/assets/file-urls.js.map +1 -0
- package/dist/assets/index.d.ts +6 -4
- package/dist/assets/index.js +4 -2
- package/dist/assets/jobs.d.ts +15 -0
- package/dist/assets/jobs.js +30 -0
- package/dist/assets/jobs.js.map +1 -0
- package/dist/assets/model.d.ts +2 -2
- package/dist/assets/ports.d.ts +46 -15
- package/dist/assets/service.d.ts +38 -7
- package/dist/assets/service.js +287 -38
- package/dist/assets/service.js.map +1 -1
- package/dist/automations/actions.d.ts +13 -24
- package/dist/automations/actions.js +106 -42
- package/dist/automations/actions.js.map +1 -1
- package/dist/automations/catalog.js +226 -3
- package/dist/automations/catalog.js.map +1 -1
- package/dist/automations/community-derivations.d.ts +14 -0
- package/dist/automations/community-derivations.js +439 -0
- package/dist/automations/community-derivations.js.map +1 -0
- package/dist/automations/community-mail.d.ts +98 -0
- package/dist/automations/community-mail.js +70 -0
- package/dist/automations/community-mail.js.map +1 -0
- package/dist/automations/events.d.ts +18 -0
- package/dist/automations/index.d.ts +13 -4
- package/dist/automations/index.js +10 -2
- package/dist/automations/model.d.ts +10 -3
- package/dist/automations/model.js +15 -2
- package/dist/automations/model.js.map +1 -1
- package/dist/automations/notifications/debounce.d.ts +25 -0
- package/dist/automations/notifications/debounce.js +93 -0
- package/dist/automations/notifications/debounce.js.map +1 -0
- package/dist/automations/notifications/defaults.d.ts +8 -0
- package/dist/automations/notifications/defaults.js +316 -0
- package/dist/automations/notifications/defaults.js.map +1 -0
- package/dist/automations/notifications/delivery.d.ts +28 -0
- package/dist/automations/notifications/delivery.js +88 -0
- package/dist/automations/notifications/delivery.js.map +1 -0
- package/dist/automations/notifications/processor.d.ts +64 -0
- package/dist/automations/notifications/processor.js +270 -0
- package/dist/automations/notifications/processor.js.map +1 -0
- package/dist/automations/notifications/rules/content.d.ts +6 -0
- package/dist/automations/notifications/rules/content.js +39 -0
- package/dist/automations/notifications/rules/content.js.map +1 -0
- package/dist/automations/notifications/rules/discussion.d.ts +7 -0
- package/dist/automations/notifications/rules/discussion.js +678 -0
- package/dist/automations/notifications/rules/discussion.js.map +1 -0
- package/dist/automations/notifications/rules/entitlements.d.ts +6 -0
- package/dist/automations/notifications/rules/entitlements.js +249 -0
- package/dist/automations/notifications/rules/entitlements.js.map +1 -0
- package/dist/automations/notifications/rules/index.d.ts +6 -0
- package/dist/automations/notifications/rules/index.js +15 -0
- package/dist/automations/notifications/rules/index.js.map +1 -0
- package/dist/automations/notifications/rules/organizations.d.ts +6 -0
- package/dist/automations/notifications/rules/organizations.js +28 -0
- package/dist/automations/notifications/rules/organizations.js.map +1 -0
- package/dist/automations/notifications/rules/recipients.d.ts +32 -0
- package/dist/automations/notifications/rules/recipients.js +99 -0
- package/dist/automations/notifications/rules/recipients.js.map +1 -0
- package/dist/automations/notifications/service.d.ts +27 -0
- package/dist/automations/notifications/service.js +45 -0
- package/dist/automations/notifications/service.js.map +1 -0
- package/dist/automations/notifications/types.d.ts +7 -0
- package/dist/automations/notifications/types.js +473 -0
- package/dist/automations/notifications/types.js.map +1 -0
- package/dist/automations/ports.d.ts +121 -3
- package/dist/automations/schedule.d.ts +6 -0
- package/dist/automations/schedule.js +41 -0
- package/dist/automations/schedule.js.map +1 -0
- package/dist/automations/service.d.ts +20 -4
- package/dist/automations/service.js +246 -45
- package/dist/automations/service.js.map +1 -1
- package/dist/content/events.d.ts +712 -50
- package/dist/content/events.js +55 -1
- package/dist/content/events.js.map +1 -1
- package/dist/content/index.d.ts +6 -4
- package/dist/content/index.js +3 -1
- package/dist/content/model.d.ts +2 -2
- package/dist/content/notification-categories.d.ts +36 -0
- package/dist/content/notification-categories.js +64 -0
- package/dist/content/notification-categories.js.map +1 -0
- package/dist/content/ports.d.ts +90 -18
- package/dist/content/service.d.ts +57 -18
- package/dist/content/service.js +520 -25
- package/dist/content/service.js.map +1 -1
- package/dist/content/titles.d.ts +22 -0
- package/dist/content/titles.js +69 -0
- package/dist/content/titles.js.map +1 -0
- package/dist/content/types.d.ts +2 -2
- package/dist/discussion/authors.d.ts +10 -0
- package/dist/discussion/authors.js +23 -0
- package/dist/discussion/authors.js.map +1 -0
- package/dist/discussion/chats.d.ts +109 -0
- package/dist/discussion/chats.js +831 -0
- package/dist/discussion/chats.js.map +1 -0
- package/dist/discussion/digests.d.ts +24 -0
- package/dist/discussion/digests.js +104 -0
- package/dist/discussion/digests.js.map +1 -0
- package/dist/discussion/events.d.ts +785 -56
- package/dist/discussion/events.js +165 -5
- package/dist/discussion/events.js.map +1 -1
- package/dist/discussion/index.d.ts +12 -3
- package/dist/discussion/index.js +9 -1
- package/dist/discussion/jobs.d.ts +16 -0
- package/dist/discussion/jobs.js +40 -0
- package/dist/discussion/jobs.js.map +1 -0
- package/dist/discussion/mentions.d.ts +11 -0
- package/dist/discussion/mentions.js +35 -0
- package/dist/discussion/mentions.js.map +1 -0
- package/dist/discussion/ports.d.ts +372 -28
- package/dist/discussion/ports.js +6 -1
- package/dist/discussion/ports.js.map +1 -0
- package/dist/discussion/posts.d.ts +113 -0
- package/dist/discussion/posts.js +775 -0
- package/dist/discussion/posts.js.map +1 -0
- package/dist/discussion/service.d.ts +42 -11
- package/dist/discussion/service.js +364 -85
- package/dist/discussion/service.js.map +1 -1
- package/dist/discussion/subscriptions.d.ts +37 -0
- package/dist/discussion/subscriptions.js +99 -0
- package/dist/discussion/subscriptions.js.map +1 -0
- package/dist/discussion/titles.d.ts +26 -0
- package/dist/discussion/titles.js +84 -0
- package/dist/discussion/titles.js.map +1 -0
- package/dist/entitlements/events.d.ts +178 -11
- package/dist/entitlements/events.js +28 -1
- package/dist/entitlements/events.js.map +1 -1
- package/dist/entitlements/index.d.ts +6 -4
- package/dist/entitlements/index.js +3 -1
- package/dist/entitlements/jobs.d.ts +12 -0
- package/dist/entitlements/jobs.js +18 -0
- package/dist/entitlements/jobs.js.map +1 -0
- package/dist/entitlements/model.d.ts +3 -2
- package/dist/entitlements/ports.d.ts +128 -11
- package/dist/entitlements/rules.d.ts +12 -0
- package/dist/entitlements/rules.js +17 -0
- package/dist/entitlements/rules.js.map +1 -0
- package/dist/entitlements/service.d.ts +57 -3
- package/dist/entitlements/service.js +492 -2
- package/dist/entitlements/service.js.map +1 -1
- package/dist/identity/access.d.ts +6 -0
- package/dist/identity/access.js +7 -0
- package/dist/identity/access.js.map +1 -0
- package/dist/identity/devices.d.ts +30 -0
- package/dist/identity/devices.js +107 -0
- package/dist/identity/devices.js.map +1 -0
- package/dist/identity/events.d.ts +2 -2
- package/dist/identity/index.d.ts +7 -4
- package/dist/identity/index.js +4 -1
- package/dist/identity/model.d.ts +2 -1
- package/dist/identity/notification-settings.d.ts +28 -0
- package/dist/identity/notification-settings.js +113 -0
- package/dist/identity/notification-settings.js.map +1 -0
- package/dist/identity/ports.d.ts +97 -3
- package/dist/identity/service.d.ts +14 -3
- package/dist/identity/service.js +62 -5
- package/dist/identity/service.js.map +1 -1
- package/dist/integrations/events.d.ts +3 -3
- package/dist/integrations/model.js +1 -1
- package/dist/integrations/model.js.map +1 -1
- package/dist/integrations/service.js +2 -2
- package/dist/integrations/service.js.map +1 -1
- package/dist/organizations/access-scopes.d.ts +19 -0
- package/dist/organizations/access-scopes.js +89 -0
- package/dist/organizations/access-scopes.js.map +1 -0
- package/dist/organizations/events.d.ts +75 -33
- package/dist/organizations/events.js +6 -0
- package/dist/organizations/events.js.map +1 -1
- package/dist/organizations/index.d.ts +8 -6
- package/dist/organizations/index.js +5 -3
- package/dist/organizations/members.d.ts +8 -5
- package/dist/organizations/members.js.map +1 -1
- package/dist/organizations/notification-categories.d.ts +32 -0
- package/dist/organizations/notification-categories.js +51 -0
- package/dist/organizations/notification-categories.js.map +1 -0
- package/dist/organizations/ports.d.ts +17 -11
- package/dist/organizations/roles.d.ts +6 -10
- package/dist/organizations/roles.js +19 -7
- package/dist/organizations/roles.js.map +1 -1
- package/dist/organizations/service.d.ts +22 -11
- package/dist/organizations/service.js +164 -47
- package/dist/organizations/service.js.map +1 -1
- package/dist/organizations/types.d.ts +1 -10
- package/dist/progress/events.d.ts +14 -14
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/ports.d.ts +6 -1
- package/dist/progress/service.d.ts +3 -1
- package/dist/progress/service.js +6 -2
- package/dist/progress/service.js.map +1 -1
- package/dist/reporting/admin/index.d.ts +4 -0
- package/dist/reporting/admin/index.js +2 -0
- package/dist/reporting/admin/model.d.ts +108 -0
- package/dist/reporting/admin/ports.d.ts +27 -0
- package/dist/reporting/admin/service.d.ts +22 -0
- package/dist/reporting/admin/service.js +38 -0
- package/dist/reporting/admin/service.js.map +1 -0
- package/dist/reporting/member/index.d.ts +5 -0
- package/dist/reporting/member/index.js +2 -0
- package/dist/reporting/member/model.d.ts +157 -0
- package/dist/reporting/member/ports.d.ts +48 -0
- package/dist/reporting/member/service.d.ts +92 -0
- package/dist/reporting/member/service.js +364 -0
- package/dist/reporting/member/service.js.map +1 -0
- package/dist/shared/actor.d.ts +9 -0
- package/dist/shared/errors.d.ts +19 -1
- package/dist/shared/errors.js +27 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/id.d.ts +14 -0
- package/dist/shared/id.js +15 -1
- package/dist/shared/id.js.map +1 -1
- package/dist/shared/mailer.d.ts +15 -2
- package/dist/shared/mailer.js +32 -5
- package/dist/shared/mailer.js.map +1 -1
- package/dist/shared/network.d.ts +10 -0
- package/dist/shared/network.js +211 -0
- package/dist/shared/network.js.map +1 -0
- package/dist/shared/notification-categories.d.ts +16 -0
- package/dist/shared/notification-categories.js +94 -0
- package/dist/shared/notification-categories.js.map +1 -0
- package/dist/shared/notification-settings.d.ts +14 -0
- package/dist/shared/notification-settings.js +61 -0
- package/dist/shared/notification-settings.js.map +1 -0
- package/dist/shared/ports.d.ts +48 -2
- package/dist/shared/settings.d.ts +2 -1
- package/dist/shared/settings.js +1 -0
- package/dist/shared/settings.js.map +1 -1
- package/dist/types/assets.d.ts +2 -2
- package/dist/types/automations.d.ts +15 -1
- package/dist/types/content.d.ts +2 -2
- package/dist/types/discussion.d.ts +11 -3
- package/dist/types/email-templates.d.ts +216 -1
- package/dist/types/entitlements.d.ts +2 -2
- package/dist/types/identity.d.ts +48 -2
- package/dist/types/index.d.ts +9 -8
- package/dist/types/notifications.d.ts +157 -0
- package/dist/types/ports.d.ts +6 -0
- package/dist/types/schemas/assets.d.ts +65 -37
- package/dist/types/schemas/assets.js +17 -12
- package/dist/types/schemas/assets.js.map +1 -1
- package/dist/types/schemas/automations.d.ts +9 -1
- package/dist/types/schemas/automations.js +13 -6
- package/dist/types/schemas/automations.js.map +1 -1
- package/dist/types/schemas/content.d.ts +396 -3
- package/dist/types/schemas/content.js +161 -3
- package/dist/types/schemas/content.js.map +1 -1
- package/dist/types/schemas/discussion.d.ts +443 -3
- package/dist/types/schemas/discussion.js +233 -4
- package/dist/types/schemas/discussion.js.map +1 -1
- package/dist/types/schemas/entitlements.d.ts +36 -2
- package/dist/types/schemas/entitlements.js +23 -1
- package/dist/types/schemas/entitlements.js.map +1 -1
- package/dist/types/schemas/identity.d.ts +27 -1
- package/dist/types/schemas/identity.js +14 -2
- package/dist/types/schemas/identity.js.map +1 -1
- package/dist/types/schemas/index.d.ts +9 -8
- package/dist/types/schemas/index.js +9 -8
- package/dist/types/schemas/notifications.d.ts +95 -0
- package/dist/types/schemas/notifications.js +56 -0
- package/dist/types/schemas/notifications.js.map +1 -0
- package/dist/types/schemas/organizations.d.ts +8 -0
- package/dist/types/schemas/organizations.js +2 -0
- package/dist/types/schemas/organizations.js.map +1 -1
- package/dist/types/schemas/progress.d.ts +3 -3
- package/dist/types/schemas/shared.d.ts +3 -1
- package/dist/types/schemas/shared.js +5 -1
- package/dist/types/schemas/shared.js.map +1 -1
- package/package.json +2 -2
- package/dist/reporting/courses/index.d.ts +0 -4
- package/dist/reporting/courses/index.js +0 -2
- package/dist/reporting/courses/model.d.ts +0 -24
- package/dist/reporting/courses/ports.d.ts +0 -13
- package/dist/reporting/courses/service.d.ts +0 -19
- package/dist/reporting/courses/service.js +0 -20
- package/dist/reporting/courses/service.js.map +0 -1
- package/dist/reporting/dashboard/index.d.ts +0 -4
- package/dist/reporting/dashboard/index.js +0 -2
- package/dist/reporting/dashboard/model.d.ts +0 -14
- package/dist/reporting/dashboard/ports.d.ts +0 -13
- package/dist/reporting/dashboard/service.d.ts +0 -19
- package/dist/reporting/dashboard/service.js +0 -20
- package/dist/reporting/dashboard/service.js.map +0 -1
- package/dist/reporting/learn/index.d.ts +0 -5
- package/dist/reporting/learn/index.js +0 -2
- package/dist/reporting/learn/model.d.ts +0 -23
- package/dist/reporting/learn/ports.d.ts +0 -43
- package/dist/reporting/learn/service.d.ts +0 -49
- package/dist/reporting/learn/service.js +0 -116
- package/dist/reporting/learn/service.js.map +0 -1
- package/dist/reporting/students/index.d.ts +0 -4
- package/dist/reporting/students/index.js +0 -2
- package/dist/reporting/students/model.d.ts +0 -51
- package/dist/reporting/students/model.js +0 -1
- package/dist/reporting/students/ports.d.ts +0 -15
- package/dist/reporting/students/ports.js +0 -1
- package/dist/reporting/students/service.d.ts +0 -20
- package/dist/reporting/students/service.js +0 -23
- package/dist/reporting/students/service.js.map +0 -1
- /package/dist/reporting/{courses → admin}/model.js +0 -0
- /package/dist/reporting/{courses → admin}/ports.js +0 -0
- /package/dist/reporting/{dashboard → member}/model.js +0 -0
- /package/dist/reporting/{dashboard → member}/ports.js +0 -0
- /package/dist/{reporting/learn/model.js → shared/actor.js} +0 -0
- /package/dist/{reporting/learn/ports.js → types/notifications.js} +0 -0
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
//#region src/types/schemas/assets.d.ts
|
|
3
3
|
declare const assetKindSchema: z.ZodEnum<{
|
|
4
|
+
image: "image";
|
|
4
5
|
video: "video";
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
audio: "audio";
|
|
7
|
+
document: "document";
|
|
7
8
|
}>;
|
|
8
9
|
type AssetKind = z.infer<typeof assetKindSchema>;
|
|
10
|
+
declare const assetSourceSchema: z.ZodEnum<{
|
|
11
|
+
library: "library";
|
|
12
|
+
member: "member";
|
|
13
|
+
}>;
|
|
14
|
+
type AssetSource = z.infer<typeof assetSourceSchema>;
|
|
9
15
|
declare const assetStatusSchema: z.ZodEnum<{
|
|
10
16
|
pending: "pending";
|
|
11
17
|
ready: "ready";
|
|
@@ -16,9 +22,14 @@ declare const assetSchema: z.ZodObject<{
|
|
|
16
22
|
id: z.ZodString;
|
|
17
23
|
key: z.ZodString;
|
|
18
24
|
kind: z.ZodEnum<{
|
|
25
|
+
image: "image";
|
|
19
26
|
video: "video";
|
|
20
|
-
|
|
21
|
-
|
|
27
|
+
audio: "audio";
|
|
28
|
+
document: "document";
|
|
29
|
+
}>;
|
|
30
|
+
source: z.ZodEnum<{
|
|
31
|
+
library: "library";
|
|
32
|
+
member: "member";
|
|
22
33
|
}>;
|
|
23
34
|
filename: z.ZodString;
|
|
24
35
|
contentType: z.ZodString;
|
|
@@ -33,14 +44,43 @@ declare const assetSchema: z.ZodObject<{
|
|
|
33
44
|
}, z.core.$strict>;
|
|
34
45
|
type Asset = z.output<typeof assetSchema>;
|
|
35
46
|
type AssetInput = z.input<typeof assetSchema>;
|
|
47
|
+
declare const assetViewSchema: z.ZodObject<{
|
|
48
|
+
orgId: z.ZodString;
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
key: z.ZodString;
|
|
51
|
+
kind: z.ZodEnum<{
|
|
52
|
+
image: "image";
|
|
53
|
+
video: "video";
|
|
54
|
+
audio: "audio";
|
|
55
|
+
document: "document";
|
|
56
|
+
}>;
|
|
57
|
+
source: z.ZodEnum<{
|
|
58
|
+
library: "library";
|
|
59
|
+
member: "member";
|
|
60
|
+
}>;
|
|
61
|
+
filename: z.ZodString;
|
|
62
|
+
contentType: z.ZodString;
|
|
63
|
+
size: z.ZodNumber;
|
|
64
|
+
status: z.ZodEnum<{
|
|
65
|
+
pending: "pending";
|
|
66
|
+
ready: "ready";
|
|
67
|
+
}>;
|
|
68
|
+
uploadedBy: z.ZodString;
|
|
69
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
70
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
71
|
+
url: z.ZodNullable<z.ZodString>;
|
|
72
|
+
downloadUrl: z.ZodNullable<z.ZodString>;
|
|
73
|
+
}, z.core.$strict>;
|
|
74
|
+
type AssetView = z.output<typeof assetViewSchema>;
|
|
75
|
+
declare const assetUrlsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
76
|
+
type AssetUrls = z.infer<typeof assetUrlsSchema>;
|
|
36
77
|
declare const requestUploadInputSchema: z.ZodObject<{
|
|
37
78
|
uploadedBy: z.ZodString;
|
|
38
79
|
filename: z.ZodString;
|
|
39
80
|
contentType: z.ZodString;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
content: "content";
|
|
81
|
+
source: z.ZodEnum<{
|
|
82
|
+
library: "library";
|
|
83
|
+
member: "member";
|
|
44
84
|
}>;
|
|
45
85
|
}, z.core.$strict>;
|
|
46
86
|
type RequestUploadInput = z.infer<typeof requestUploadInputSchema>;
|
|
@@ -50,9 +90,14 @@ declare const uploadTicketSchema: z.ZodObject<{
|
|
|
50
90
|
id: z.ZodString;
|
|
51
91
|
key: z.ZodString;
|
|
52
92
|
kind: z.ZodEnum<{
|
|
93
|
+
image: "image";
|
|
53
94
|
video: "video";
|
|
54
|
-
|
|
55
|
-
|
|
95
|
+
audio: "audio";
|
|
96
|
+
document: "document";
|
|
97
|
+
}>;
|
|
98
|
+
source: z.ZodEnum<{
|
|
99
|
+
library: "library";
|
|
100
|
+
member: "member";
|
|
56
101
|
}>;
|
|
57
102
|
filename: z.ZodString;
|
|
58
103
|
contentType: z.ZodString;
|
|
@@ -64,6 +109,8 @@ declare const uploadTicketSchema: z.ZodObject<{
|
|
|
64
109
|
uploadedBy: z.ZodString;
|
|
65
110
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
66
111
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
112
|
+
url: z.ZodNullable<z.ZodString>;
|
|
113
|
+
downloadUrl: z.ZodNullable<z.ZodString>;
|
|
67
114
|
}, z.core.$strict>;
|
|
68
115
|
uploadUrl: z.ZodString;
|
|
69
116
|
method: z.ZodLiteral<"PUT">;
|
|
@@ -71,42 +118,23 @@ declare const uploadTicketSchema: z.ZodObject<{
|
|
|
71
118
|
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
72
119
|
}, z.core.$strict>;
|
|
73
120
|
type UploadTicket = z.infer<typeof uploadTicketSchema>;
|
|
74
|
-
declare const downloadTicketSchema: z.ZodObject<{
|
|
75
|
-
url: z.ZodString;
|
|
76
|
-
asset: z.ZodObject<{
|
|
77
|
-
orgId: z.ZodString;
|
|
78
|
-
id: z.ZodString;
|
|
79
|
-
key: z.ZodString;
|
|
80
|
-
kind: z.ZodEnum<{
|
|
81
|
-
video: "video";
|
|
82
|
-
download: "download";
|
|
83
|
-
content: "content";
|
|
84
|
-
}>;
|
|
85
|
-
filename: z.ZodString;
|
|
86
|
-
contentType: z.ZodString;
|
|
87
|
-
size: z.ZodNumber;
|
|
88
|
-
status: z.ZodEnum<{
|
|
89
|
-
pending: "pending";
|
|
90
|
-
ready: "ready";
|
|
91
|
-
}>;
|
|
92
|
-
uploadedBy: z.ZodString;
|
|
93
|
-
createdAt: z.ZodCoercedDate<unknown>;
|
|
94
|
-
updatedAt: z.ZodCoercedDate<unknown>;
|
|
95
|
-
}, z.core.$strict>;
|
|
96
|
-
}, z.core.$strict>;
|
|
97
|
-
type DownloadTicket = z.infer<typeof downloadTicketSchema>;
|
|
98
121
|
declare const assetsQuerySchema: z.ZodObject<{
|
|
99
122
|
page: z.ZodNumber;
|
|
100
123
|
pageSize: z.ZodNumber;
|
|
101
124
|
search: z.ZodOptional<z.ZodString>;
|
|
102
125
|
sort: z.ZodOptional<z.ZodString>;
|
|
103
126
|
kind: z.ZodOptional<z.ZodEnum<{
|
|
127
|
+
image: "image";
|
|
104
128
|
video: "video";
|
|
105
|
-
|
|
106
|
-
|
|
129
|
+
audio: "audio";
|
|
130
|
+
document: "document";
|
|
131
|
+
}>>;
|
|
132
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
133
|
+
library: "library";
|
|
134
|
+
member: "member";
|
|
107
135
|
}>>;
|
|
108
136
|
}, z.core.$strict>;
|
|
109
137
|
type AssetsQuery = z.infer<typeof assetsQuerySchema>;
|
|
110
138
|
//#endregion
|
|
111
|
-
export { Asset, AssetInput, AssetKind, AssetStatus,
|
|
139
|
+
export { Asset, AssetInput, AssetKind, AssetSource, AssetStatus, AssetUrls, AssetView, AssetsQuery, RequestUploadInput, UploadTicket, assetKindSchema, assetSchema, assetSourceSchema, assetStatusSchema, assetUrlsSchema, assetViewSchema, assetsQuerySchema, requestUploadInputSchema, uploadTicketSchema };
|
|
112
140
|
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -2,16 +2,19 @@ import { idSchema } from "./shared.js";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/types/schemas/assets.ts
|
|
4
4
|
const assetKindSchema = z.enum([
|
|
5
|
+
"image",
|
|
5
6
|
"video",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
7
|
+
"audio",
|
|
8
|
+
"document"
|
|
8
9
|
]);
|
|
10
|
+
const assetSourceSchema = z.enum(["library", "member"]);
|
|
9
11
|
const assetStatusSchema = z.enum(["pending", "ready"]);
|
|
10
12
|
const assetSchema = z.object({
|
|
11
13
|
orgId: idSchema,
|
|
12
14
|
id: idSchema,
|
|
13
15
|
key: z.string().trim().min(1),
|
|
14
16
|
kind: assetKindSchema,
|
|
17
|
+
source: assetSourceSchema,
|
|
15
18
|
filename: z.string().trim().min(1),
|
|
16
19
|
contentType: z.string().trim().min(1),
|
|
17
20
|
size: z.number().int().min(0),
|
|
@@ -20,31 +23,33 @@ const assetSchema = z.object({
|
|
|
20
23
|
createdAt: z.coerce.date(),
|
|
21
24
|
updatedAt: z.coerce.date()
|
|
22
25
|
}).strict();
|
|
26
|
+
const assetViewSchema = assetSchema.extend({
|
|
27
|
+
url: z.string().nullable(),
|
|
28
|
+
downloadUrl: z.string().nullable()
|
|
29
|
+
}).strict();
|
|
30
|
+
const assetUrlsSchema = z.record(idSchema, z.string());
|
|
23
31
|
const requestUploadInputSchema = z.object({
|
|
24
32
|
uploadedBy: idSchema,
|
|
25
|
-
filename: z.string().trim().min(1),
|
|
26
|
-
contentType: z.string().trim().min(1),
|
|
27
|
-
|
|
33
|
+
filename: z.string().trim().min(1).max(255),
|
|
34
|
+
contentType: z.string().trim().min(1).max(255),
|
|
35
|
+
source: assetSourceSchema
|
|
28
36
|
}).strict();
|
|
29
37
|
const uploadTicketSchema = z.object({
|
|
30
|
-
asset:
|
|
38
|
+
asset: assetViewSchema,
|
|
31
39
|
uploadUrl: z.string().trim().min(1),
|
|
32
40
|
method: z.literal("PUT"),
|
|
33
41
|
expiresInSeconds: z.number().int().positive(),
|
|
34
42
|
headers: z.record(z.string(), z.string())
|
|
35
43
|
}).strict();
|
|
36
|
-
const downloadTicketSchema = z.object({
|
|
37
|
-
url: z.string().trim().min(1),
|
|
38
|
-
asset: assetSchema
|
|
39
|
-
}).strict();
|
|
40
44
|
const assetsQuerySchema = z.object({
|
|
41
45
|
page: z.number().int().min(1),
|
|
42
46
|
pageSize: z.number().int().min(1),
|
|
43
47
|
search: z.string().optional(),
|
|
44
48
|
sort: z.string().optional(),
|
|
45
|
-
kind: assetKindSchema.optional()
|
|
49
|
+
kind: assetKindSchema.optional(),
|
|
50
|
+
source: assetSourceSchema.optional()
|
|
46
51
|
}).strict();
|
|
47
52
|
//#endregion
|
|
48
|
-
export { assetKindSchema, assetSchema, assetStatusSchema,
|
|
53
|
+
export { assetKindSchema, assetSchema, assetSourceSchema, assetStatusSchema, assetUrlsSchema, assetViewSchema, assetsQuerySchema, requestUploadInputSchema, uploadTicketSchema };
|
|
49
54
|
|
|
50
55
|
//# sourceMappingURL=assets.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.js","names":[],"sources":["../../../src/types/schemas/assets.ts"],"sourcesContent":["import { z } from 'zod';\nimport { idSchema } from './shared.js';\n\nexport const assetKindSchema = z.enum(['video', '
|
|
1
|
+
{"version":3,"file":"assets.js","names":[],"sources":["../../../src/types/schemas/assets.ts"],"sourcesContent":["import { z } from 'zod';\nimport { idSchema } from './shared.js';\n\nexport const assetKindSchema = z.enum(['image', 'video', 'audio', 'document']);\nexport type AssetKind = z.infer<typeof assetKindSchema>;\n\nexport const assetSourceSchema = z.enum(['library', 'member']);\nexport type AssetSource = z.infer<typeof assetSourceSchema>;\n\nexport const assetStatusSchema = z.enum(['pending', 'ready']);\nexport type AssetStatus = z.infer<typeof assetStatusSchema>;\n\nexport const assetSchema = z\n .object({\n orgId: idSchema,\n id: idSchema,\n key: z.string().trim().min(1),\n kind: assetKindSchema,\n source: assetSourceSchema,\n filename: z.string().trim().min(1),\n contentType: z.string().trim().min(1),\n size: z.number().int().min(0),\n status: assetStatusSchema,\n uploadedBy: idSchema,\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Asset = z.output<typeof assetSchema>;\nexport type AssetInput = z.input<typeof assetSchema>;\n\nexport const assetViewSchema = assetSchema\n .extend({ url: z.string().nullable(), downloadUrl: z.string().nullable() })\n .strict();\nexport type AssetView = z.output<typeof assetViewSchema>;\n\nexport const assetUrlsSchema = z.record(idSchema, z.string());\nexport type AssetUrls = z.infer<typeof assetUrlsSchema>;\n\nexport const requestUploadInputSchema = z\n .object({\n uploadedBy: idSchema,\n filename: z.string().trim().min(1).max(255),\n contentType: z.string().trim().min(1).max(255),\n source: assetSourceSchema,\n })\n .strict();\nexport type RequestUploadInput = z.infer<typeof requestUploadInputSchema>;\n\nexport const uploadTicketSchema = z\n .object({\n asset: assetViewSchema,\n uploadUrl: z.string().trim().min(1),\n method: z.literal('PUT'),\n expiresInSeconds: z.number().int().positive(),\n headers: z.record(z.string(), z.string()),\n })\n .strict();\nexport type UploadTicket = z.infer<typeof uploadTicketSchema>;\n\nexport const assetsQuerySchema = z\n .object({\n page: z.number().int().min(1),\n pageSize: z.number().int().min(1),\n search: z.string().optional(),\n sort: z.string().optional(),\n kind: assetKindSchema.optional(),\n source: assetSourceSchema.optional(),\n })\n .strict();\nexport type AssetsQuery = z.infer<typeof assetsQuerySchema>;\n"],"mappings":";;;AAGA,MAAa,kBAAkB,EAAE,KAAK;CAAC;CAAS;CAAS;CAAS;AAAU,CAAC;AAG7E,MAAa,oBAAoB,EAAE,KAAK,CAAC,WAAW,QAAQ,CAAC;AAG7D,MAAa,oBAAoB,EAAE,KAAK,CAAC,WAAW,OAAO,CAAC;AAG5D,MAAa,cAAc,EACxB,OAAO;CACN,OAAO;CACP,IAAI;CACJ,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAC5B,MAAM;CACN,QAAQ;CACR,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACjC,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACpC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAC5B,QAAQ;CACR,YAAY;CACZ,WAAW,EAAE,OAAO,KAAK;CACzB,WAAW,EAAE,OAAO,KAAK;AAC3B,CAAC,CAAC,CACD,OAAO;AAIV,MAAa,kBAAkB,YAC5B,OAAO;CAAE,KAAK,EAAE,OAAO,CAAC,CAAC,SAAS;CAAG,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;AAAE,CAAC,CAAC,CAC1E,OAAO;AAGV,MAAa,kBAAkB,EAAE,OAAO,UAAU,EAAE,OAAO,CAAC;AAG5D,MAAa,2BAA2B,EACrC,OAAO;CACN,YAAY;CACZ,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC1C,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC7C,QAAQ;AACV,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,qBAAqB,EAC/B,OAAO;CACN,OAAO;CACP,WAAW,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAClC,QAAQ,EAAE,QAAQ,KAAK;CACvB,kBAAkB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CAC5C,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC;AAC1C,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,oBAAoB,EAC9B,OAAO;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAC5B,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;CAChC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;CAC5B,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS;CAC1B,MAAM,gBAAgB,SAAS;CAC/B,QAAQ,kBAAkB,SAAS;AACrC,CAAC,CAAC,CACD,OAAO"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { DomainEvent, JsonValue } from "../shared.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/types/schemas/automations.d.ts
|
|
4
|
+
declare const MAX_AUTOMATION_TRIGGERS = 20;
|
|
5
|
+
declare const MAX_AUTOMATION_ACTIONS = 20;
|
|
6
|
+
declare const MAX_WEBHOOK_EVENTS = 100;
|
|
4
7
|
declare const automationTriggerSchema: z.ZodString;
|
|
5
8
|
type AutomationTrigger = z.infer<typeof automationTriggerSchema>;
|
|
6
9
|
declare const automationTriggersSchema: z.ZodArray<z.ZodString>;
|
|
@@ -29,6 +32,7 @@ declare const automationSchema: z.ZodObject<{
|
|
|
29
32
|
input: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
30
33
|
}, z.core.$strict>>;
|
|
31
34
|
enabled: z.ZodBoolean;
|
|
35
|
+
filter: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
32
36
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
33
37
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
34
38
|
}, z.core.$strict>;
|
|
@@ -42,6 +46,7 @@ declare const createAutomationInputSchema: z.ZodObject<{
|
|
|
42
46
|
type: z.ZodString;
|
|
43
47
|
input: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
44
48
|
}, z.core.$strict>>;
|
|
49
|
+
filter: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>;
|
|
45
50
|
}, z.core.$strict>;
|
|
46
51
|
type CreateAutomationInput = z.infer<typeof createAutomationInputSchema>;
|
|
47
52
|
declare const updateAutomationInputSchema: z.ZodObject<{
|
|
@@ -52,6 +57,7 @@ declare const updateAutomationInputSchema: z.ZodObject<{
|
|
|
52
57
|
type: z.ZodString;
|
|
53
58
|
input: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
54
59
|
}, z.core.$strict>>>;
|
|
60
|
+
filter: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>>>;
|
|
55
61
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
56
62
|
}, z.core.$strict>;
|
|
57
63
|
type UpdateAutomationInput = z.infer<typeof updateAutomationInputSchema>;
|
|
@@ -87,6 +93,7 @@ declare const automationActionResultSchema: z.ZodObject<{
|
|
|
87
93
|
failed: "failed";
|
|
88
94
|
}>;
|
|
89
95
|
error: z.ZodOptional<z.ZodString>;
|
|
96
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
97
|
}, z.core.$strict>;
|
|
91
98
|
type AutomationActionResult = z.infer<typeof automationActionResultSchema>;
|
|
92
99
|
declare const automationRunSchema: z.ZodObject<{
|
|
@@ -109,6 +116,7 @@ declare const automationRunSchema: z.ZodObject<{
|
|
|
109
116
|
failed: "failed";
|
|
110
117
|
}>;
|
|
111
118
|
error: z.ZodOptional<z.ZodString>;
|
|
119
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
112
120
|
}, z.core.$strict>>;
|
|
113
121
|
startedAt: z.ZodCoercedDate<unknown>;
|
|
114
122
|
finishedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
@@ -181,5 +189,5 @@ declare const createdWebhookSchema: z.ZodObject<{
|
|
|
181
189
|
}, z.core.$strict>;
|
|
182
190
|
type CreatedWebhook = z.output<typeof createdWebhookSchema>;
|
|
183
191
|
//#endregion
|
|
184
|
-
export { Automation, AutomationAction, AutomationActionResult, AutomationInput, AutomationKind, AutomationRun, AutomationRunInput, AutomationRunStatus, AutomationRunsQuery, AutomationTrigger, AutomationsQuery, AvailableAction, AvailableActions, AvailableTriggers, CreateAutomationInput, CreateWebhookInput, CreatedWebhook, DeliverWebhookInput, UpdateAutomationInput, UpdateWebhookInput, Webhook, WebhookSecret, automationActionResultSchema, automationActionSchema, automationKindSchema, automationRunSchema, automationRunStatusSchema, automationRunsQuerySchema, automationSchema, automationTriggerSchema, automationTriggersSchema, automationsQuerySchema, availableActionSchema, availableTriggersSchema, createAutomationInputSchema, createWebhookInputSchema, createdWebhookSchema, deliverWebhookInputSchema, updateAutomationInputSchema, updateWebhookInputSchema, webhookSchema, webhookSecretSchema, webhookUrlSchema };
|
|
192
|
+
export { Automation, AutomationAction, AutomationActionResult, AutomationInput, AutomationKind, AutomationRun, AutomationRunInput, AutomationRunStatus, AutomationRunsQuery, AutomationTrigger, AutomationsQuery, AvailableAction, AvailableActions, AvailableTriggers, CreateAutomationInput, CreateWebhookInput, CreatedWebhook, DeliverWebhookInput, MAX_AUTOMATION_ACTIONS, MAX_AUTOMATION_TRIGGERS, MAX_WEBHOOK_EVENTS, UpdateAutomationInput, UpdateWebhookInput, Webhook, WebhookSecret, automationActionResultSchema, automationActionSchema, automationKindSchema, automationRunSchema, automationRunStatusSchema, automationRunsQuerySchema, automationSchema, automationTriggerSchema, automationTriggersSchema, automationsQuerySchema, availableActionSchema, availableTriggersSchema, createAutomationInputSchema, createWebhookInputSchema, createdWebhookSchema, deliverWebhookInputSchema, updateAutomationInputSchema, updateWebhookInputSchema, webhookSchema, webhookSecretSchema, webhookUrlSchema };
|
|
185
193
|
//# sourceMappingURL=automations.d.ts.map
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { domainEventSchema, idSchema, jsonRecordSchema } from "./shared.js";
|
|
2
|
+
import { isPublicHostname } from "../../shared/network.js";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
//#region src/types/schemas/automations.ts
|
|
5
|
+
const MAX_AUTOMATION_TRIGGERS = 20;
|
|
6
|
+
const MAX_AUTOMATION_ACTIONS = 20;
|
|
7
|
+
const MAX_WEBHOOK_EVENTS = 100;
|
|
4
8
|
const automationTriggerSchema = z.string().trim().min(1);
|
|
5
|
-
const automationTriggersSchema = z.array(automationTriggerSchema).min(1);
|
|
9
|
+
const automationTriggersSchema = z.array(automationTriggerSchema).min(1).max(20);
|
|
6
10
|
const automationKindSchema = z.enum(["workflow", "webhook"]);
|
|
7
11
|
const automationActionSchema = z.object({
|
|
8
12
|
type: z.string().trim().min(1),
|
|
@@ -17,6 +21,7 @@ const automationSchema = z.object({
|
|
|
17
21
|
triggers: z.array(automationTriggerSchema),
|
|
18
22
|
actions: z.array(automationActionSchema),
|
|
19
23
|
enabled: z.boolean(),
|
|
24
|
+
filter: jsonRecordSchema.nullable(),
|
|
20
25
|
createdAt: z.coerce.date(),
|
|
21
26
|
updatedAt: z.coerce.date()
|
|
22
27
|
}).strict();
|
|
@@ -24,7 +29,8 @@ const createAutomationInputSchema = z.object({
|
|
|
24
29
|
name: z.string(),
|
|
25
30
|
description: z.string().optional(),
|
|
26
31
|
triggers: automationTriggersSchema,
|
|
27
|
-
actions: z.array(automationActionSchema)
|
|
32
|
+
actions: z.array(automationActionSchema).min(1).max(20),
|
|
33
|
+
filter: jsonRecordSchema.nullable().optional()
|
|
28
34
|
}).strict();
|
|
29
35
|
const updateAutomationInputSchema = createAutomationInputSchema.partial().extend({ enabled: z.boolean().optional() });
|
|
30
36
|
const automationsQuerySchema = z.object({ kind: automationKindSchema.optional() }).strict();
|
|
@@ -47,7 +53,8 @@ const automationActionResultSchema = z.object({
|
|
|
47
53
|
index: z.number().int().min(0),
|
|
48
54
|
type: z.string().trim().min(1),
|
|
49
55
|
status: z.enum(["completed", "failed"]),
|
|
50
|
-
error: z.string().optional()
|
|
56
|
+
error: z.string().optional(),
|
|
57
|
+
recipients: z.array(z.string()).optional()
|
|
51
58
|
}).strict();
|
|
52
59
|
const automationRunSchema = z.object({
|
|
53
60
|
orgId: idSchema,
|
|
@@ -79,7 +86,7 @@ const deliverWebhookInputSchema = z.object({
|
|
|
79
86
|
url: z.string(),
|
|
80
87
|
secretRef: idSchema
|
|
81
88
|
}).strict();
|
|
82
|
-
const webhookUrlSchema = z.url({ protocol: /^https?$/ });
|
|
89
|
+
const webhookUrlSchema = z.url({ protocol: /^https?$/ }).refine((value) => isPublicHostname(new URL(value).hostname), { message: "Webhook URL must be a public address, not localhost or a private network address" });
|
|
83
90
|
const webhookSchema = z.object({
|
|
84
91
|
orgId: idSchema,
|
|
85
92
|
id: idSchema,
|
|
@@ -92,13 +99,13 @@ const webhookSchema = z.object({
|
|
|
92
99
|
}).strict();
|
|
93
100
|
const createWebhookInputSchema = z.object({
|
|
94
101
|
url: webhookUrlSchema,
|
|
95
|
-
events:
|
|
102
|
+
events: z.array(automationTriggerSchema).min(1).max(100),
|
|
96
103
|
description: z.string().optional()
|
|
97
104
|
}).strict();
|
|
98
105
|
const updateWebhookInputSchema = createWebhookInputSchema.partial().extend({ enabled: z.boolean().optional() });
|
|
99
106
|
const webhookSecretSchema = z.object({ secret: z.string() }).strict();
|
|
100
107
|
const createdWebhookSchema = webhookSchema.extend({ secret: z.string() }).strict();
|
|
101
108
|
//#endregion
|
|
102
|
-
export { automationActionResultSchema, automationActionSchema, automationKindSchema, automationRunSchema, automationRunStatusSchema, automationRunsQuerySchema, automationSchema, automationTriggerSchema, automationTriggersSchema, automationsQuerySchema, availableActionSchema, availableTriggersSchema, createAutomationInputSchema, createWebhookInputSchema, createdWebhookSchema, deliverWebhookInputSchema, updateAutomationInputSchema, updateWebhookInputSchema, webhookSchema, webhookSecretSchema, webhookUrlSchema };
|
|
109
|
+
export { MAX_AUTOMATION_ACTIONS, MAX_AUTOMATION_TRIGGERS, MAX_WEBHOOK_EVENTS, automationActionResultSchema, automationActionSchema, automationKindSchema, automationRunSchema, automationRunStatusSchema, automationRunsQuerySchema, automationSchema, automationTriggerSchema, automationTriggersSchema, automationsQuerySchema, availableActionSchema, availableTriggersSchema, createAutomationInputSchema, createWebhookInputSchema, createdWebhookSchema, deliverWebhookInputSchema, updateAutomationInputSchema, updateWebhookInputSchema, webhookSchema, webhookSecretSchema, webhookUrlSchema };
|
|
103
110
|
|
|
104
111
|
//# sourceMappingURL=automations.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automations.js","names":[],"sources":["../../../src/types/schemas/automations.ts"],"sourcesContent":["import { z } from 'zod';\nimport { domainEventSchema, idSchema, jsonRecordSchema } from './shared.js';\n\nexport const automationTriggerSchema = z.string().trim().min(1);\nexport type AutomationTrigger = z.infer<typeof automationTriggerSchema>;\n\nexport const automationTriggersSchema = z.array(automationTriggerSchema).min(1);\n\nexport const automationKindSchema = z.enum(['workflow', 'webhook']);\nexport type AutomationKind = z.infer<typeof automationKindSchema>;\n\nexport const automationActionSchema = z\n .object({\n type: z.string().trim().min(1),\n input: jsonRecordSchema,\n })\n .strict();\nexport type AutomationAction = z.infer<typeof automationActionSchema>;\n\nexport const automationSchema = z\n .object({\n orgId: idSchema,\n id: idSchema,\n name: z.string(),\n kind: automationKindSchema,\n description: z.string().nullable(),\n triggers: z.array(automationTriggerSchema),\n actions: z.array(automationActionSchema),\n enabled: z.boolean(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Automation = z.output<typeof automationSchema>;\nexport type AutomationInput = z.input<typeof automationSchema>;\n\nexport const createAutomationInputSchema = z\n .object({\n name: z.string(),\n description: z.string().optional(),\n triggers: automationTriggersSchema,\n actions: z.array(automationActionSchema),\n })\n .strict();\nexport type CreateAutomationInput = z.infer<typeof createAutomationInputSchema>;\n\nexport const updateAutomationInputSchema = createAutomationInputSchema.partial().extend({\n enabled: z.boolean().optional(),\n});\nexport type UpdateAutomationInput = z.infer<typeof updateAutomationInputSchema>;\n\nexport const automationsQuerySchema = z\n .object({\n kind: automationKindSchema.optional(),\n })\n .strict();\nexport type AutomationsQuery = z.infer<typeof automationsQuerySchema>;\n\nexport const automationRunsQuerySchema = z\n .object({\n page: z.number().int().min(1),\n pageSize: z.number().int().min(1),\n status: z.enum(['running', 'completed', 'failed']).optional(),\n sort: z.string().optional(),\n })\n .strict();\nexport type AutomationRunsQuery = z.infer<typeof automationRunsQuerySchema>;\n\nexport const automationRunStatusSchema = z.enum(['running', 'completed', 'failed']);\nexport type AutomationRunStatus = z.infer<typeof automationRunStatusSchema>;\n\nexport const automationActionResultSchema = z\n .object({\n index: z.number().int().min(0),\n type: z.string().trim().min(1),\n status: z.enum(['completed', 'failed']),\n error: z.string().optional(),\n })\n .strict();\nexport type AutomationActionResult = z.infer<typeof automationActionResultSchema>;\n\nexport const automationRunSchema = z\n .object({\n orgId: idSchema,\n id: idSchema,\n automationId: idSchema,\n trigger: automationTriggerSchema,\n eventId: idSchema,\n event: domainEventSchema,\n status: automationRunStatusSchema,\n actionResults: z.array(automationActionResultSchema),\n startedAt: z.coerce.date(),\n finishedAt: z.coerce.date().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type AutomationRun = z.output<typeof automationRunSchema>;\nexport type AutomationRunInput = z.input<typeof automationRunSchema>;\n\nexport const availableActionSchema = z\n .object({\n type: z.string().trim().min(1),\n description: z.string(),\n inputSchema: jsonRecordSchema,\n source: z.string(),\n })\n .strict();\nexport type AvailableAction = z.infer<typeof availableActionSchema>;\nexport type AvailableActions = AvailableAction[];\n\nexport const availableTriggersSchema = z\n .object({\n triggers: z.array(\n z\n .object({\n type: z.string().trim().min(1),\n label: z.string().min(1),\n category: z.string().min(1),\n description: z.string(),\n })\n .strict(),\n ),\n })\n .strict();\nexport type AvailableTriggers = z.infer<typeof availableTriggersSchema>;\n\nexport const deliverWebhookInputSchema = z\n .object({\n url: z.string(),\n secretRef: idSchema,\n })\n .strict();\nexport type DeliverWebhookInput = z.infer<typeof deliverWebhookInputSchema>;\n\nexport const webhookUrlSchema = z.url({ protocol: /^https?$/ });\n\nexport const webhookSchema = z\n .object({\n orgId: idSchema,\n id: idSchema,\n url: z.string(),\n events: z.array(automationTriggerSchema),\n description: z.string().nullable(),\n enabled: z.boolean(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Webhook = z.output<typeof webhookSchema>;\n\nexport const createWebhookInputSchema = z\n .object({\n url: webhookUrlSchema,\n events:
|
|
1
|
+
{"version":3,"file":"automations.js","names":[],"sources":["../../../src/types/schemas/automations.ts"],"sourcesContent":["import { z } from 'zod';\nimport { isPublicHostname } from '../../shared/network.js';\nimport { domainEventSchema, idSchema, jsonRecordSchema } from './shared.js';\n\nexport const MAX_AUTOMATION_TRIGGERS = 20;\nexport const MAX_AUTOMATION_ACTIONS = 20;\nexport const MAX_WEBHOOK_EVENTS = 100;\n\nexport const automationTriggerSchema = z.string().trim().min(1);\nexport type AutomationTrigger = z.infer<typeof automationTriggerSchema>;\n\nexport const automationTriggersSchema = z\n .array(automationTriggerSchema)\n .min(1)\n .max(MAX_AUTOMATION_TRIGGERS);\n\nexport const automationKindSchema = z.enum(['workflow', 'webhook']);\nexport type AutomationKind = z.infer<typeof automationKindSchema>;\n\nexport const automationActionSchema = z\n .object({\n type: z.string().trim().min(1),\n input: jsonRecordSchema,\n })\n .strict();\nexport type AutomationAction = z.infer<typeof automationActionSchema>;\n\nexport const automationSchema = z\n .object({\n orgId: idSchema,\n id: idSchema,\n name: z.string(),\n kind: automationKindSchema,\n description: z.string().nullable(),\n triggers: z.array(automationTriggerSchema),\n actions: z.array(automationActionSchema),\n enabled: z.boolean(),\n filter: jsonRecordSchema.nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Automation = z.output<typeof automationSchema>;\nexport type AutomationInput = z.input<typeof automationSchema>;\n\nexport const createAutomationInputSchema = z\n .object({\n name: z.string(),\n description: z.string().optional(),\n triggers: automationTriggersSchema,\n actions: z.array(automationActionSchema).min(1).max(MAX_AUTOMATION_ACTIONS),\n filter: jsonRecordSchema.nullable().optional(),\n })\n .strict();\nexport type CreateAutomationInput = z.infer<typeof createAutomationInputSchema>;\n\nexport const updateAutomationInputSchema = createAutomationInputSchema.partial().extend({\n enabled: z.boolean().optional(),\n});\nexport type UpdateAutomationInput = z.infer<typeof updateAutomationInputSchema>;\n\nexport const automationsQuerySchema = z\n .object({\n kind: automationKindSchema.optional(),\n })\n .strict();\nexport type AutomationsQuery = z.infer<typeof automationsQuerySchema>;\n\nexport const automationRunsQuerySchema = z\n .object({\n page: z.number().int().min(1),\n pageSize: z.number().int().min(1),\n status: z.enum(['running', 'completed', 'failed']).optional(),\n sort: z.string().optional(),\n })\n .strict();\nexport type AutomationRunsQuery = z.infer<typeof automationRunsQuerySchema>;\n\nexport const automationRunStatusSchema = z.enum(['running', 'completed', 'failed']);\nexport type AutomationRunStatus = z.infer<typeof automationRunStatusSchema>;\n\nexport const automationActionResultSchema = z\n .object({\n index: z.number().int().min(0),\n type: z.string().trim().min(1),\n status: z.enum(['completed', 'failed']),\n error: z.string().optional(),\n recipients: z.array(z.string()).optional(),\n })\n .strict();\nexport type AutomationActionResult = z.infer<typeof automationActionResultSchema>;\n\nexport const automationRunSchema = z\n .object({\n orgId: idSchema,\n id: idSchema,\n automationId: idSchema,\n trigger: automationTriggerSchema,\n eventId: idSchema,\n event: domainEventSchema,\n status: automationRunStatusSchema,\n actionResults: z.array(automationActionResultSchema),\n startedAt: z.coerce.date(),\n finishedAt: z.coerce.date().nullable(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type AutomationRun = z.output<typeof automationRunSchema>;\nexport type AutomationRunInput = z.input<typeof automationRunSchema>;\n\nexport const availableActionSchema = z\n .object({\n type: z.string().trim().min(1),\n description: z.string(),\n inputSchema: jsonRecordSchema,\n source: z.string(),\n })\n .strict();\nexport type AvailableAction = z.infer<typeof availableActionSchema>;\nexport type AvailableActions = AvailableAction[];\n\nexport const availableTriggersSchema = z\n .object({\n triggers: z.array(\n z\n .object({\n type: z.string().trim().min(1),\n label: z.string().min(1),\n category: z.string().min(1),\n description: z.string(),\n })\n .strict(),\n ),\n })\n .strict();\nexport type AvailableTriggers = z.infer<typeof availableTriggersSchema>;\n\nexport const deliverWebhookInputSchema = z\n .object({\n url: z.string(),\n secretRef: idSchema,\n })\n .strict();\nexport type DeliverWebhookInput = z.infer<typeof deliverWebhookInputSchema>;\n\nexport const webhookUrlSchema = z\n .url({ protocol: /^https?$/ })\n .refine((value) => isPublicHostname(new URL(value).hostname), {\n message: 'Webhook URL must be a public address, not localhost or a private network address',\n });\n\nexport const webhookSchema = z\n .object({\n orgId: idSchema,\n id: idSchema,\n url: z.string(),\n events: z.array(automationTriggerSchema),\n description: z.string().nullable(),\n enabled: z.boolean(),\n createdAt: z.coerce.date(),\n updatedAt: z.coerce.date(),\n })\n .strict();\nexport type Webhook = z.output<typeof webhookSchema>;\n\nexport const createWebhookInputSchema = z\n .object({\n url: webhookUrlSchema,\n events: z.array(automationTriggerSchema).min(1).max(MAX_WEBHOOK_EVENTS),\n description: z.string().optional(),\n })\n .strict();\nexport type CreateWebhookInput = z.infer<typeof createWebhookInputSchema>;\n\nexport const updateWebhookInputSchema = createWebhookInputSchema.partial().extend({\n enabled: z.boolean().optional(),\n});\nexport type UpdateWebhookInput = z.infer<typeof updateWebhookInputSchema>;\n\nexport const webhookSecretSchema = z\n .object({\n secret: z.string(),\n })\n .strict();\nexport type WebhookSecret = z.infer<typeof webhookSecretSchema>;\n\nexport const createdWebhookSchema = webhookSchema.extend({ secret: z.string() }).strict();\nexport type CreatedWebhook = z.output<typeof createdWebhookSchema>;\n"],"mappings":"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"}
|