@headless-lms/core 0.3.0 → 0.5.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 +24 -18
- package/dist/assets/file-urls.d.ts +11 -7
- package/dist/assets/file-urls.js +14 -4
- package/dist/assets/file-urls.js.map +1 -1
- package/dist/assets/index.d.ts +5 -4
- package/dist/assets/index.js +4 -3
- 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/ports.d.ts +37 -17
- package/dist/assets/service.d.ts +30 -15
- package/dist/assets/service.js +229 -59
- package/dist/assets/service.js.map +1 -1
- package/dist/automations/actions.js +2 -63
- package/dist/automations/actions.js.map +1 -1
- package/dist/automations/catalog.d.ts +1 -2
- package/dist/automations/catalog.js +137 -65
- package/dist/automations/catalog.js.map +1 -1
- package/dist/automations/community-derivations.js +20 -20
- package/dist/automations/community-derivations.js.map +1 -1
- package/dist/automations/community-mail.d.ts +36 -20
- package/dist/automations/community-mail.js +32 -24
- package/dist/automations/community-mail.js.map +1 -1
- package/dist/automations/event-permissions.d.ts +12 -0
- package/dist/automations/event-permissions.js +38 -0
- package/dist/automations/event-permissions.js.map +1 -0
- package/dist/automations/events.d.ts +0 -10
- package/dist/automations/index.d.ts +12 -4
- package/dist/automations/index.js +9 -1
- package/dist/automations/notifications/applicable.d.ts +8 -0
- package/dist/automations/notifications/applicable.js +12 -0
- package/dist/automations/notifications/applicable.js.map +1 -0
- 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 +346 -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 +96 -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 +276 -0
- package/dist/automations/notifications/rules/entitlements.js.map +1 -0
- package/dist/automations/notifications/rules/events.d.ts +9 -0
- package/dist/automations/notifications/rules/events.js +27 -0
- package/dist/automations/notifications/rules/events.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 +35 -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 +98 -0
- package/dist/automations/notifications/rules/recipients.js.map +1 -0
- package/dist/automations/notifications/service.d.ts +29 -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 +560 -0
- package/dist/automations/notifications/types.js.map +1 -0
- package/dist/automations/ports.d.ts +134 -21
- package/dist/automations/service.d.ts +30 -30
- package/dist/automations/service.js +111 -144
- package/dist/automations/service.js.map +1 -1
- package/dist/content/event-sight.d.ts +11 -0
- package/dist/content/event-sight.js +11 -0
- package/dist/content/event-sight.js.map +1 -0
- package/dist/content/events.d.ts +437 -46
- package/dist/content/events.js +45 -1
- package/dist/content/events.js.map +1 -1
- package/dist/content/index.d.ts +8 -4
- package/dist/content/index.js +5 -1
- package/dist/content/jobs.d.ts +16 -0
- package/dist/content/jobs.js +37 -0
- package/dist/content/jobs.js.map +1 -0
- package/dist/content/model.d.ts +2 -2
- package/dist/content/notification-categories.d.ts +37 -0
- package/dist/content/notification-categories.js +73 -0
- package/dist/content/notification-categories.js.map +1 -0
- package/dist/content/ports.d.ts +132 -68
- package/dist/content/service.d.ts +100 -68
- package/dist/content/service.js +703 -146
- package/dist/content/service.js.map +1 -1
- package/dist/content/titles.d.ts +25 -0
- package/dist/content/titles.js +82 -0
- package/dist/content/titles.js.map +1 -0
- package/dist/content/types.d.ts +2 -2
- package/dist/discussion/authors.d.ts +4 -2
- package/dist/discussion/authors.js +9 -5
- package/dist/discussion/authors.js.map +1 -1
- package/dist/discussion/chats.d.ts +63 -39
- package/dist/discussion/chats.js +455 -190
- package/dist/discussion/chats.js.map +1 -1
- 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 +227 -23
- package/dist/discussion/events.js +114 -19
- package/dist/discussion/events.js.map +1 -1
- package/dist/discussion/index.d.ts +12 -4
- package/dist/discussion/index.js +9 -2
- 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/live.d.ts +106 -0
- package/dist/discussion/live.js +642 -0
- package/dist/discussion/live.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 +279 -114
- package/dist/discussion/ports.js.map +1 -1
- package/dist/discussion/posts.d.ts +60 -44
- package/dist/discussion/posts.js +453 -287
- package/dist/discussion/posts.js.map +1 -1
- package/dist/discussion/rules.d.ts +18 -0
- package/dist/discussion/rules.js +22 -0
- package/dist/discussion/rules.js.map +1 -0
- package/dist/discussion/service.d.ts +50 -35
- package/dist/discussion/service.js +333 -205
- package/dist/discussion/service.js.map +1 -1
- package/dist/discussion/subscriptions.d.ts +37 -0
- package/dist/discussion/subscriptions.js +115 -0
- package/dist/discussion/subscriptions.js.map +1 -0
- package/dist/discussion/titles.d.ts +28 -0
- package/dist/discussion/titles.js +98 -0
- package/dist/discussion/titles.js.map +1 -0
- package/dist/entitlements/events.d.ts +20 -20
- package/dist/entitlements/index.d.ts +5 -4
- package/dist/entitlements/index.js +3 -2
- 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 +2 -2
- package/dist/entitlements/ports.d.ts +68 -38
- package/dist/entitlements/rules.d.ts +3 -6
- package/dist/entitlements/rules.js +5 -10
- package/dist/entitlements/rules.js.map +1 -1
- package/dist/entitlements/service.d.ts +43 -28
- package/dist/entitlements/service.js +387 -160
- package/dist/entitlements/service.js.map +1 -1
- package/dist/identity/devices.d.ts +30 -0
- package/dist/identity/devices.js +109 -0
- package/dist/identity/devices.js.map +1 -0
- package/dist/identity/index.d.ts +6 -5
- package/dist/identity/index.js +4 -3
- package/dist/identity/model.d.ts +2 -2
- package/dist/identity/notification-settings.d.ts +28 -0
- package/dist/identity/notification-settings.js +114 -0
- package/dist/identity/notification-settings.js.map +1 -0
- package/dist/identity/ports.d.ts +80 -56
- package/dist/identity/service.d.ts +8 -7
- package/dist/identity/service.js +17 -13
- package/dist/identity/service.js.map +1 -1
- package/dist/integrations/ports.d.ts +9 -8
- package/dist/integrations/service.d.ts +9 -8
- package/dist/integrations/service.js +33 -16
- package/dist/integrations/service.js.map +1 -1
- package/dist/organizations/default-roles.d.ts +22 -0
- package/dist/organizations/default-roles.js +89 -0
- package/dist/organizations/default-roles.js.map +1 -0
- package/dist/organizations/effective-permissions.d.ts +45 -0
- package/dist/organizations/effective-permissions.js +113 -0
- package/dist/organizations/effective-permissions.js.map +1 -0
- package/dist/organizations/events.d.ts +320 -181
- package/dist/organizations/events.js +90 -18
- package/dist/organizations/events.js.map +1 -1
- package/dist/organizations/index.d.ts +15 -10
- package/dist/organizations/index.js +8 -3
- package/dist/organizations/members.d.ts +66 -8
- package/dist/organizations/members.js.map +1 -1
- package/dist/organizations/notification-catalog.d.ts +31 -0
- package/dist/organizations/notification-catalog.js +32 -0
- package/dist/organizations/notification-catalog.js.map +1 -0
- package/dist/organizations/notification-categories.d.ts +34 -0
- package/dist/organizations/notification-categories.js +66 -0
- package/dist/organizations/notification-categories.js.map +1 -0
- package/dist/organizations/org-roles.d.ts +33 -0
- package/dist/organizations/org-roles.js +49 -0
- package/dist/organizations/org-roles.js.map +1 -0
- package/dist/organizations/permissions.d.ts +311 -0
- package/dist/organizations/permissions.js +327 -0
- package/dist/organizations/permissions.js.map +1 -0
- package/dist/organizations/ports.d.ts +187 -65
- package/dist/organizations/service.d.ts +104 -35
- package/dist/organizations/service.js +1247 -323
- package/dist/organizations/service.js.map +1 -1
- package/dist/organizations/testing.d.ts +18 -0
- package/dist/organizations/testing.js +37 -0
- package/dist/organizations/testing.js.map +1 -0
- package/dist/organizations/types.d.ts +5 -16
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/ports.d.ts +11 -3
- package/dist/progress/service.d.ts +6 -5
- package/dist/progress/service.js +23 -8
- package/dist/progress/service.js.map +1 -1
- package/dist/reporting/admin/index.d.ts +6 -4
- package/dist/reporting/admin/model.d.ts +36 -3
- package/dist/reporting/admin/ports.d.ts +39 -14
- package/dist/reporting/admin/service.d.ts +32 -11
- package/dist/reporting/admin/service.js +102 -18
- package/dist/reporting/admin/service.js.map +1 -1
- package/dist/reporting/events/index.d.ts +27 -0
- package/dist/reporting/events/index.js +20 -0
- package/dist/reporting/events/index.js.map +1 -0
- package/dist/reporting/member/calendar.d.ts +11 -0
- package/dist/reporting/member/calendar.js +75 -0
- package/dist/reporting/member/calendar.js.map +1 -0
- package/dist/reporting/member/index.d.ts +3 -2
- package/dist/reporting/member/model.d.ts +80 -26
- package/dist/reporting/member/ports.d.ts +50 -28
- package/dist/reporting/member/service.d.ts +81 -35
- package/dist/reporting/member/service.js +438 -145
- package/dist/reporting/member/service.js.map +1 -1
- package/dist/shared/actor.d.ts +22 -3
- package/dist/shared/errors.d.ts +15 -2
- package/dist/shared/errors.js +21 -2
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/id.d.ts +7 -0
- package/dist/shared/id.js +8 -1
- package/dist/shared/id.js.map +1 -1
- package/dist/shared/logger.d.ts +2 -1
- package/dist/shared/logger.js +10 -1
- package/dist/shared/logger.js.map +1 -1
- package/dist/shared/mailer.d.ts +11 -1
- package/dist/shared/mailer.js +32 -5
- package/dist/shared/mailer.js.map +1 -1
- 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 +68 -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/automations.d.ts +8 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/discussion.d.ts +4 -5
- package/dist/types/email-templates.d.ts +119 -6
- package/dist/types/entitlements.d.ts +2 -2
- package/dist/types/identity.d.ts +14 -17
- package/dist/types/index.d.ts +13 -12
- package/dist/types/index.js +2 -1
- package/dist/types/notifications.d.ts +157 -0
- package/dist/types/notifications.js +1 -0
- package/dist/types/organizations.d.ts +3 -2
- package/dist/types/ports.d.ts +8 -1
- package/dist/types/ports.js +7 -1
- package/dist/types/ports.js.map +1 -0
- package/dist/types/schemas/assets.d.ts +5 -5
- package/dist/types/schemas/assets.js +4 -3
- package/dist/types/schemas/assets.js.map +1 -1
- package/dist/types/schemas/automations.d.ts +1 -10
- package/dist/types/schemas/automations.js +1 -3
- package/dist/types/schemas/automations.js.map +1 -1
- package/dist/types/schemas/content.d.ts +596 -11
- package/dist/types/schemas/content.js +225 -9
- package/dist/types/schemas/content.js.map +1 -1
- package/dist/types/schemas/discussion.d.ts +362 -66
- package/dist/types/schemas/discussion.js +123 -15
- package/dist/types/schemas/discussion.js.map +1 -1
- package/dist/types/schemas/entitlements.d.ts +14 -1
- package/dist/types/schemas/entitlements.js +11 -4
- package/dist/types/schemas/entitlements.js.map +1 -1
- package/dist/types/schemas/identity.d.ts +1 -85
- package/dist/types/schemas/identity.js +1 -42
- package/dist/types/schemas/identity.js.map +1 -1
- package/dist/types/schemas/index.d.ts +8 -7
- package/dist/types/schemas/index.js +8 -7
- package/dist/types/schemas/notifications.d.ts +96 -0
- package/dist/types/schemas/notifications.js +57 -0
- package/dist/types/schemas/notifications.js.map +1 -0
- package/dist/types/schemas/organizations.d.ts +96 -60
- package/dist/types/schemas/organizations.js +78 -27
- package/dist/types/schemas/organizations.js.map +1 -1
- package/dist/types/schemas/progress.d.ts +0 -1
- package/dist/types/schemas/progress.js +0 -1
- package/dist/types/schemas/progress.js.map +1 -1
- package/package.json +1 -1
- package/dist/automations/community-notifications.d.ts +0 -16
- package/dist/automations/community-notifications.js +0 -84
- package/dist/automations/community-notifications.js.map +0 -1
- package/dist/automations/seeds.d.ts +0 -17
- package/dist/automations/seeds.js +0 -235
- package/dist/automations/seeds.js.map +0 -1
- package/dist/identity/notifications.d.ts +0 -27
- package/dist/identity/notifications.js +0 -101
- package/dist/identity/notifications.js.map +0 -1
- package/dist/organizations/access-scopes.d.ts +0 -19
- package/dist/organizations/access-scopes.js +0 -89
- package/dist/organizations/access-scopes.js.map +0 -1
- package/dist/organizations/roles.d.ts +0 -19
- package/dist/organizations/roles.js +0 -82
- package/dist/organizations/roles.js.map +0 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { JsonValue } from "./shared.js";
|
|
2
|
+
import { EmailTemplateId } from "./email-templates.js";
|
|
3
|
+
//#region src/types/notifications.d.ts
|
|
4
|
+
type Reason = 'subject' | 'post_author' | 'comment_author' | 'message_author' | 'follower' | 'thread_participant' | 'mentioned' | 'participant' | 'space_member' | 'community_member' | 'course_member' | 'event_member' | 'moderator';
|
|
5
|
+
type Scope = 'org' | 'community' | 'space' | 'chat';
|
|
6
|
+
interface SubjectRef {
|
|
7
|
+
type: 'post' | 'comment' | 'chat' | 'message' | 'space' | 'community' | 'course' | 'download' | 'event' | 'bundle' | 'activity';
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
interface NotificationTypeDeclaration {
|
|
11
|
+
type: string;
|
|
12
|
+
scopes: Scope[];
|
|
13
|
+
reasons: Reason[];
|
|
14
|
+
display: Partial<Record<Scope, string[]>>;
|
|
15
|
+
email?: Partial<Record<Scope, {
|
|
16
|
+
template: EmailTemplateId;
|
|
17
|
+
byReason?: Partial<Record<Reason, EmailTemplateId>>;
|
|
18
|
+
}>>;
|
|
19
|
+
push?: Partial<Record<Scope, {
|
|
20
|
+
title: string;
|
|
21
|
+
body: string;
|
|
22
|
+
}>>;
|
|
23
|
+
}
|
|
24
|
+
interface NotificationCategory {
|
|
25
|
+
key: string;
|
|
26
|
+
covers: {
|
|
27
|
+
type: string;
|
|
28
|
+
reasons: Reason[];
|
|
29
|
+
}[];
|
|
30
|
+
channels: Record<string, {
|
|
31
|
+
default: boolean;
|
|
32
|
+
locked: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
perSpace?: boolean;
|
|
35
|
+
spaceDefaults?: Record<string, Record<string, boolean>>;
|
|
36
|
+
}
|
|
37
|
+
interface StoredNotification {
|
|
38
|
+
id: string;
|
|
39
|
+
orgId: string;
|
|
40
|
+
userId: string;
|
|
41
|
+
type: string;
|
|
42
|
+
scope: Scope;
|
|
43
|
+
reasons: Reason[];
|
|
44
|
+
matchedReason: Reason;
|
|
45
|
+
category: string;
|
|
46
|
+
communityId: string | null;
|
|
47
|
+
spaceId: string | null;
|
|
48
|
+
actorId: string | null;
|
|
49
|
+
subject: SubjectRef | null;
|
|
50
|
+
parent: SubjectRef | null;
|
|
51
|
+
display: Record<string, JsonValue>;
|
|
52
|
+
createdAt: Date;
|
|
53
|
+
}
|
|
54
|
+
type DeliveryStatus = 'pending' | 'sent' | 'failed';
|
|
55
|
+
interface Delivery {
|
|
56
|
+
id: string;
|
|
57
|
+
notificationId: string;
|
|
58
|
+
channel: string;
|
|
59
|
+
status: DeliveryStatus;
|
|
60
|
+
lastError: string | null;
|
|
61
|
+
createdAt: Date;
|
|
62
|
+
sentAt: Date | null;
|
|
63
|
+
}
|
|
64
|
+
interface StoredSetting {
|
|
65
|
+
communityId: string | null;
|
|
66
|
+
spaceId: string | null;
|
|
67
|
+
category: string;
|
|
68
|
+
channel: string;
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
}
|
|
71
|
+
type SettingsScope = {
|
|
72
|
+
communityId: string;
|
|
73
|
+
} | 'org';
|
|
74
|
+
interface PushDevice {
|
|
75
|
+
id: string;
|
|
76
|
+
provider: 'apns' | 'fcm' | 'webpush';
|
|
77
|
+
token: string;
|
|
78
|
+
p256dh: string | null;
|
|
79
|
+
auth: string | null;
|
|
80
|
+
appId: string | null;
|
|
81
|
+
environment: 'production' | 'sandbox' | null;
|
|
82
|
+
}
|
|
83
|
+
interface PushMessage {
|
|
84
|
+
title: string;
|
|
85
|
+
body: string;
|
|
86
|
+
data: {
|
|
87
|
+
notificationId: string;
|
|
88
|
+
type: string;
|
|
89
|
+
subject: SubjectRef | null;
|
|
90
|
+
parent: SubjectRef | null;
|
|
91
|
+
communityId: string | null;
|
|
92
|
+
spaceId: string | null;
|
|
93
|
+
courseId: string | null;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
interface ChannelRecipient {
|
|
97
|
+
email?: string;
|
|
98
|
+
devices?: PushDevice[];
|
|
99
|
+
address?: JsonValue;
|
|
100
|
+
}
|
|
101
|
+
interface DeliveryResult {
|
|
102
|
+
accepted: boolean;
|
|
103
|
+
deadDeviceIds: string[];
|
|
104
|
+
error?: string;
|
|
105
|
+
}
|
|
106
|
+
interface NotificationFilter {
|
|
107
|
+
scope?: 'org' | 'community';
|
|
108
|
+
communityId?: string;
|
|
109
|
+
includeOrg?: boolean;
|
|
110
|
+
category?: string[];
|
|
111
|
+
reason?: Reason[];
|
|
112
|
+
type?: string[];
|
|
113
|
+
unread?: boolean;
|
|
114
|
+
}
|
|
115
|
+
interface RecipientList {
|
|
116
|
+
type: string;
|
|
117
|
+
scope: Scope;
|
|
118
|
+
actorId: string | null;
|
|
119
|
+
communityId: string | null;
|
|
120
|
+
spaceId: string | null;
|
|
121
|
+
subject: SubjectRef | null;
|
|
122
|
+
parent: SubjectRef | null;
|
|
123
|
+
display: Record<string, JsonValue>;
|
|
124
|
+
recipients?: {
|
|
125
|
+
orgUserId: string;
|
|
126
|
+
userId: string;
|
|
127
|
+
reasons: Reason[];
|
|
128
|
+
}[];
|
|
129
|
+
audience?: {
|
|
130
|
+
reason: 'space_member';
|
|
131
|
+
spaceId: string;
|
|
132
|
+
exclude: string[];
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
type PushProvider = PushDevice['provider'];
|
|
136
|
+
interface DeviceView extends PushDevice {
|
|
137
|
+
lastSeenAt: Date;
|
|
138
|
+
}
|
|
139
|
+
interface PushConfig {
|
|
140
|
+
apns?: {
|
|
141
|
+
teamId: string;
|
|
142
|
+
keyId: string;
|
|
143
|
+
key: string;
|
|
144
|
+
bundleIds: string[];
|
|
145
|
+
};
|
|
146
|
+
fcm?: {
|
|
147
|
+
serviceAccount: Record<string, unknown>;
|
|
148
|
+
};
|
|
149
|
+
webpush?: {
|
|
150
|
+
publicKey: string;
|
|
151
|
+
privateKey: string;
|
|
152
|
+
subject: string;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { ChannelRecipient, Delivery, DeliveryResult, DeliveryStatus, DeviceView, NotificationCategory, NotificationFilter, NotificationTypeDeclaration, PushConfig, PushDevice, PushMessage, PushProvider, Reason, RecipientList, Scope, SettingsScope, StoredNotification, StoredSetting, SubjectRef };
|
|
157
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput,
|
|
1
|
+
import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput, Level, NewOrganizationInput, OrgRoleRow, OrgUser, OrgUserInput, OrgUserProfile, OrgUserStatus, Organization, OrganizationInput, Permission, RoleAssignment, RoleKey, UpdateOrgUserInput } from "./schemas/organizations.js";
|
|
2
2
|
//#region src/types/organizations.d.ts
|
|
3
|
+
type ContentId = string;
|
|
3
4
|
type OrganizationId = string;
|
|
4
5
|
type OrgUserId = string;
|
|
5
6
|
type InviteId = string;
|
|
@@ -11,5 +12,5 @@ interface CreateOrganizationInput {
|
|
|
11
12
|
ownerId: string;
|
|
12
13
|
}
|
|
13
14
|
//#endregion
|
|
14
|
-
export { type AcceptInviteInput, type AddOrgUserInput, type CreateInviteInput, type CreateOrgUserInput, CreateOrganizationInput, type Invite, InviteId, type InviteInput, type
|
|
15
|
+
export { type AcceptInviteInput, type AddOrgUserInput, ContentId, type CreateInviteInput, type CreateOrgUserInput, CreateOrganizationInput, type Invite, InviteId, type InviteInput, type Level, type NewOrganizationInput, type OrgRoleRow, type OrgUser, OrgUserId, type OrgUserInput, type OrgUserProfile, type OrgUserStatus, type Organization, OrganizationId, type OrganizationInput, type Permission, type RoleAssignment, type RoleKey, type UpdateOrgUserInput };
|
|
15
16
|
//# sourceMappingURL=organizations.d.ts.map
|
package/dist/types/ports.d.ts
CHANGED
|
@@ -55,9 +55,16 @@ interface ObjectStorage {
|
|
|
55
55
|
from: string;
|
|
56
56
|
to: string;
|
|
57
57
|
}): Promise<void>;
|
|
58
|
+
publish(input: {
|
|
59
|
+
from: string;
|
|
60
|
+
to: string;
|
|
61
|
+
}): Promise<void>;
|
|
62
|
+
publicUrl(key: string): string;
|
|
58
63
|
/** Permanently remove an object. */
|
|
59
64
|
remove(key: string): Promise<void>;
|
|
60
65
|
}
|
|
66
|
+
declare const PUBLIC_PREFIX = "public/";
|
|
67
|
+
declare const PUBLIC_CACHE_CONTROL = "public, max-age=31536000, immutable";
|
|
61
68
|
//#endregion
|
|
62
|
-
export { EmailMessage, EmailSender, Logger, ObjectStorage, PresignDownloadInput, PresignedUpload, StoredObjectInfo };
|
|
69
|
+
export { EmailMessage, EmailSender, Logger, ObjectStorage, PUBLIC_CACHE_CONTROL, PUBLIC_PREFIX, PresignDownloadInput, PresignedUpload, StoredObjectInfo };
|
|
63
70
|
//# sourceMappingURL=ports.d.ts.map
|
package/dist/types/ports.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ports.js","names":[],"sources":["../../src/types/ports.ts"],"sourcesContent":["// Deployment-swappable ports, implemented by @headless-lms/adapter-* packages.\n\nexport interface Logger {\n debug(msg: string, meta?: Record<string, unknown>): void;\n info(msg: string, meta?: Record<string, unknown>): void;\n warn(msg: string, meta?: Record<string, unknown>): void;\n error(msg: string, meta?: Record<string, unknown>): void;\n /** A logger whose every entry carries `bindings` (call-site meta wins on key clash). */\n child(bindings: Record<string, unknown>): Logger;\n}\n\nexport interface EmailMessage {\n to: string;\n subject: string;\n text: string;\n /** Optional rendered HTML body; transports fall back to text when absent. */\n html?: string;\n}\n\nexport interface EmailSender {\n send(message: EmailMessage): Promise<void>;\n}\n\n// --- Object storage (S3-compatible, opaque keys) ----------------------------\n\n/** A presigned URL the browser uses to PUT a file straight to the store. */\nexport interface PresignedUpload {\n url: string;\n method: 'PUT';\n key: string;\n expiresInSeconds: number;\n /** Headers the client must send on the PUT (e.g. Content-Type). */\n headers: Record<string, string>;\n}\n\nexport interface StoredObjectInfo {\n key: string;\n size: number;\n contentType?: string;\n lastModified?: string;\n}\n\nexport interface PresignDownloadInput {\n key: string;\n expiresInSeconds?: number;\n /** Force a download with this filename (Content-Disposition: attachment). */\n downloadFilename?: string;\n}\n\nexport interface ObjectStorage {\n readonly uploadExpirySeconds: number;\n /** Presigned URL for a direct browser upload (temporary, expiring). */\n presignUpload(input: {\n key: string;\n contentType?: string;\n expiresInSeconds?: number;\n }): Promise<PresignedUpload>;\n /** Presigned URL to fetch/serve a private object (temporary, expiring). */\n presignDownload(input: PresignDownloadInput): Promise<string>;\n /** Object metadata, or null if it does not exist. */\n stat(key: string): Promise<StoredObjectInfo | null>;\n list(prefix: string): Promise<StoredObjectInfo[]>;\n copy(input: { from: string; to: string }): Promise<void>;\n publish(input: { from: string; to: string }): Promise<void>;\n publicUrl(key: string): string;\n /** Permanently remove an object. */\n remove(key: string): Promise<void>;\n}\n\nexport const PUBLIC_PREFIX = 'public/';\nexport const PUBLIC_CACHE_CONTROL = 'public, max-age=31536000, immutable';\n"],"mappings":";AAqEA,MAAa,gBAAgB;AAC7B,MAAa,uBAAuB"}
|
|
@@ -39,6 +39,7 @@ declare const assetSchema: z.ZodObject<{
|
|
|
39
39
|
ready: "ready";
|
|
40
40
|
}>;
|
|
41
41
|
uploadedBy: z.ZodString;
|
|
42
|
+
contentId: z.ZodNullable<z.ZodString>;
|
|
42
43
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
43
44
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
44
45
|
}, z.core.$strict>;
|
|
@@ -66,6 +67,7 @@ declare const assetViewSchema: z.ZodObject<{
|
|
|
66
67
|
ready: "ready";
|
|
67
68
|
}>;
|
|
68
69
|
uploadedBy: z.ZodString;
|
|
70
|
+
contentId: z.ZodNullable<z.ZodString>;
|
|
69
71
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
70
72
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
71
73
|
url: z.ZodNullable<z.ZodString>;
|
|
@@ -75,13 +77,9 @@ type AssetView = z.output<typeof assetViewSchema>;
|
|
|
75
77
|
declare const assetUrlsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
76
78
|
type AssetUrls = z.infer<typeof assetUrlsSchema>;
|
|
77
79
|
declare const requestUploadInputSchema: z.ZodObject<{
|
|
78
|
-
uploadedBy: z.ZodString;
|
|
79
80
|
filename: z.ZodString;
|
|
80
81
|
contentType: z.ZodString;
|
|
81
|
-
|
|
82
|
-
library: "library";
|
|
83
|
-
member: "member";
|
|
84
|
-
}>;
|
|
82
|
+
contentId: z.ZodOptional<z.ZodString>;
|
|
85
83
|
}, z.core.$strict>;
|
|
86
84
|
type RequestUploadInput = z.infer<typeof requestUploadInputSchema>;
|
|
87
85
|
declare const uploadTicketSchema: z.ZodObject<{
|
|
@@ -107,6 +105,7 @@ declare const uploadTicketSchema: z.ZodObject<{
|
|
|
107
105
|
ready: "ready";
|
|
108
106
|
}>;
|
|
109
107
|
uploadedBy: z.ZodString;
|
|
108
|
+
contentId: z.ZodNullable<z.ZodString>;
|
|
110
109
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
111
110
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
112
111
|
url: z.ZodNullable<z.ZodString>;
|
|
@@ -133,6 +132,7 @@ declare const assetsQuerySchema: z.ZodObject<{
|
|
|
133
132
|
library: "library";
|
|
134
133
|
member: "member";
|
|
135
134
|
}>>;
|
|
135
|
+
contentId: z.ZodOptional<z.ZodString>;
|
|
136
136
|
}, z.core.$strict>;
|
|
137
137
|
type AssetsQuery = z.infer<typeof assetsQuerySchema>;
|
|
138
138
|
//#endregion
|
|
@@ -20,6 +20,7 @@ const assetSchema = z.object({
|
|
|
20
20
|
size: z.number().int().min(0),
|
|
21
21
|
status: assetStatusSchema,
|
|
22
22
|
uploadedBy: idSchema,
|
|
23
|
+
contentId: idSchema.nullable(),
|
|
23
24
|
createdAt: z.coerce.date(),
|
|
24
25
|
updatedAt: z.coerce.date()
|
|
25
26
|
}).strict();
|
|
@@ -29,10 +30,9 @@ const assetViewSchema = assetSchema.extend({
|
|
|
29
30
|
}).strict();
|
|
30
31
|
const assetUrlsSchema = z.record(idSchema, z.string());
|
|
31
32
|
const requestUploadInputSchema = z.object({
|
|
32
|
-
uploadedBy: idSchema,
|
|
33
33
|
filename: z.string().trim().min(1).max(255),
|
|
34
34
|
contentType: z.string().trim().min(1).max(255),
|
|
35
|
-
|
|
35
|
+
contentId: idSchema.optional()
|
|
36
36
|
}).strict();
|
|
37
37
|
const uploadTicketSchema = z.object({
|
|
38
38
|
asset: assetViewSchema,
|
|
@@ -47,7 +47,8 @@ const assetsQuerySchema = z.object({
|
|
|
47
47
|
search: z.string().optional(),
|
|
48
48
|
sort: z.string().optional(),
|
|
49
49
|
kind: assetKindSchema.optional(),
|
|
50
|
-
source: assetSourceSchema.optional()
|
|
50
|
+
source: assetSourceSchema.optional(),
|
|
51
|
+
contentId: idSchema.optional()
|
|
51
52
|
}).strict();
|
|
52
53
|
//#endregion
|
|
53
54
|
export { assetKindSchema, assetSchema, assetSourceSchema, assetStatusSchema, assetUrlsSchema, assetViewSchema, assetsQuerySchema, requestUploadInputSchema, uploadTicketSchema };
|
|
@@ -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(['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
|
|
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 contentId: idSchema.nullable(),\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 filename: z.string().trim().min(1).max(255),\n contentType: z.string().trim().min(1).max(255),\n contentId: idSchema.optional(),\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 contentId: idSchema.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,SAAS,SAAS;CAC7B,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,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,WAAW,SAAS,SAAS;AAC/B,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;CACnC,WAAW,SAAS,SAAS;AAC/B,CAAC,CAAC,CACD,OAAO"}
|
|
@@ -12,11 +12,6 @@ declare const automationKindSchema: z.ZodEnum<{
|
|
|
12
12
|
webhook: "webhook";
|
|
13
13
|
}>;
|
|
14
14
|
type AutomationKind = z.infer<typeof automationKindSchema>;
|
|
15
|
-
declare const automationSourceSchema: z.ZodEnum<{
|
|
16
|
-
system: "system";
|
|
17
|
-
user: "user";
|
|
18
|
-
}>;
|
|
19
|
-
type AutomationSource = z.infer<typeof automationSourceSchema>;
|
|
20
15
|
declare const automationActionSchema: z.ZodObject<{
|
|
21
16
|
type: z.ZodString;
|
|
22
17
|
input: z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>;
|
|
@@ -38,10 +33,6 @@ declare const automationSchema: z.ZodObject<{
|
|
|
38
33
|
}, z.core.$strict>>;
|
|
39
34
|
enabled: z.ZodBoolean;
|
|
40
35
|
filter: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
|
|
41
|
-
source: z.ZodEnum<{
|
|
42
|
-
system: "system";
|
|
43
|
-
user: "user";
|
|
44
|
-
}>;
|
|
45
36
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
46
37
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
47
38
|
}, z.core.$strict>;
|
|
@@ -198,5 +189,5 @@ declare const createdWebhookSchema: z.ZodObject<{
|
|
|
198
189
|
}, z.core.$strict>;
|
|
199
190
|
type CreatedWebhook = z.output<typeof createdWebhookSchema>;
|
|
200
191
|
//#endregion
|
|
201
|
-
export { Automation, AutomationAction, AutomationActionResult, AutomationInput, AutomationKind, AutomationRun, AutomationRunInput, AutomationRunStatus, AutomationRunsQuery,
|
|
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 };
|
|
202
193
|
//# sourceMappingURL=automations.d.ts.map
|
|
@@ -8,7 +8,6 @@ const MAX_WEBHOOK_EVENTS = 100;
|
|
|
8
8
|
const automationTriggerSchema = z.string().trim().min(1);
|
|
9
9
|
const automationTriggersSchema = z.array(automationTriggerSchema).min(1).max(20);
|
|
10
10
|
const automationKindSchema = z.enum(["workflow", "webhook"]);
|
|
11
|
-
const automationSourceSchema = z.enum(["system", "user"]);
|
|
12
11
|
const automationActionSchema = z.object({
|
|
13
12
|
type: z.string().trim().min(1),
|
|
14
13
|
input: jsonRecordSchema
|
|
@@ -23,7 +22,6 @@ const automationSchema = z.object({
|
|
|
23
22
|
actions: z.array(automationActionSchema),
|
|
24
23
|
enabled: z.boolean(),
|
|
25
24
|
filter: jsonRecordSchema.nullable(),
|
|
26
|
-
source: automationSourceSchema,
|
|
27
25
|
createdAt: z.coerce.date(),
|
|
28
26
|
updatedAt: z.coerce.date()
|
|
29
27
|
}).strict();
|
|
@@ -108,6 +106,6 @@ const updateWebhookInputSchema = createWebhookInputSchema.partial().extend({ ena
|
|
|
108
106
|
const webhookSecretSchema = z.object({ secret: z.string() }).strict();
|
|
109
107
|
const createdWebhookSchema = webhookSchema.extend({ secret: z.string() }).strict();
|
|
110
108
|
//#endregion
|
|
111
|
-
export { MAX_AUTOMATION_ACTIONS, MAX_AUTOMATION_TRIGGERS, MAX_WEBHOOK_EVENTS, automationActionResultSchema, automationActionSchema, automationKindSchema, automationRunSchema, automationRunStatusSchema, automationRunsQuerySchema, automationSchema,
|
|
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 };
|
|
112
110
|
|
|
113
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 { 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
|
|
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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"}
|