@headless-lms/core 0.1.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/LICENSE +21 -0
- package/dist/assets/events.d.ts +81 -0
- package/dist/assets/events.js +24 -0
- package/dist/assets/events.js.map +1 -0
- package/dist/assets/index.d.ts +7 -0
- package/dist/assets/index.js +3 -0
- package/dist/assets/model.d.ts +4 -0
- package/dist/assets/model.js +1 -0
- package/dist/assets/ports.d.ts +34 -0
- package/dist/assets/ports.js +1 -0
- package/dist/assets/service.d.ts +29 -0
- package/dist/assets/service.js +130 -0
- package/dist/assets/service.js.map +1 -0
- package/dist/automations/actions.d.ts +24 -0
- package/dist/automations/actions.js +59 -0
- package/dist/automations/actions.js.map +1 -0
- package/dist/automations/catalog.d.ts +12 -0
- package/dist/automations/catalog.js +224 -0
- package/dist/automations/catalog.js.map +1 -0
- package/dist/automations/events.d.ts +264 -0
- package/dist/automations/events.js +54 -0
- package/dist/automations/events.js.map +1 -0
- package/dist/automations/index.d.ts +9 -0
- package/dist/automations/index.js +4 -0
- package/dist/automations/model.d.ts +12 -0
- package/dist/automations/model.js +14 -0
- package/dist/automations/model.js.map +1 -0
- package/dist/automations/ports.d.ts +56 -0
- package/dist/automations/ports.js +1 -0
- package/dist/automations/service.d.ts +53 -0
- package/dist/automations/service.js +225 -0
- package/dist/automations/service.js.map +1 -0
- package/dist/automations/types.d.ts +3 -0
- package/dist/automations/types.js +1 -0
- package/dist/content/events.d.ts +410 -0
- package/dist/content/events.js +105 -0
- package/dist/content/events.js.map +1 -0
- package/dist/content/index.d.ts +8 -0
- package/dist/content/index.js +3 -0
- package/dist/content/model.d.ts +3 -0
- package/dist/content/model.js +1 -0
- package/dist/content/ports.d.ts +85 -0
- package/dist/content/ports.js +1 -0
- package/dist/content/service.d.ts +54 -0
- package/dist/content/service.js +479 -0
- package/dist/content/service.js.map +1 -0
- package/dist/content/types.d.ts +4 -0
- package/dist/content/types.js +1 -0
- package/dist/discussion/events.d.ts +101 -0
- package/dist/discussion/events.js +29 -0
- package/dist/discussion/events.js.map +1 -0
- package/dist/discussion/index.d.ts +8 -0
- package/dist/discussion/index.js +3 -0
- package/dist/discussion/model.d.ts +5 -0
- package/dist/discussion/model.js +1 -0
- package/dist/discussion/ports.d.ts +112 -0
- package/dist/discussion/ports.js +1 -0
- package/dist/discussion/service.d.ts +67 -0
- package/dist/discussion/service.js +343 -0
- package/dist/discussion/service.js.map +1 -0
- package/dist/discussion/types.d.ts +4 -0
- package/dist/discussion/types.js +1 -0
- package/dist/entitlements/events.d.ts +89 -0
- package/dist/entitlements/events.js +29 -0
- package/dist/entitlements/events.js.map +1 -0
- package/dist/entitlements/index.d.ts +7 -0
- package/dist/entitlements/index.js +3 -0
- package/dist/entitlements/model.d.ts +4 -0
- package/dist/entitlements/model.js +1 -0
- package/dist/entitlements/ports.d.ts +34 -0
- package/dist/entitlements/ports.js +1 -0
- package/dist/entitlements/service.d.ts +27 -0
- package/dist/entitlements/service.js +60 -0
- package/dist/entitlements/service.js.map +1 -0
- package/dist/identity/events.d.ts +63 -0
- package/dist/identity/events.js +24 -0
- package/dist/identity/events.js.map +1 -0
- package/dist/identity/index.d.ts +8 -0
- package/dist/identity/index.js +3 -0
- package/dist/identity/model.d.ts +3 -0
- package/dist/identity/model.js +1 -0
- package/dist/identity/ports.d.ts +58 -0
- package/dist/identity/ports.js +1 -0
- package/dist/identity/service.d.ts +38 -0
- package/dist/identity/service.js +79 -0
- package/dist/identity/service.js.map +1 -0
- package/dist/identity/types.d.ts +4 -0
- package/dist/identity/types.js +1 -0
- package/dist/integrations/events.d.ts +70 -0
- package/dist/integrations/events.js +24 -0
- package/dist/integrations/events.js.map +1 -0
- package/dist/integrations/index.d.ts +9 -0
- package/dist/integrations/index.js +6 -0
- package/dist/integrations/model.d.ts +28 -0
- package/dist/integrations/model.js +45 -0
- package/dist/integrations/model.js.map +1 -0
- package/dist/integrations/ports.d.ts +62 -0
- package/dist/integrations/ports.js +1 -0
- package/dist/integrations/registry.d.ts +7 -0
- package/dist/integrations/registry.js +16 -0
- package/dist/integrations/registry.js.map +1 -0
- package/dist/integrations/service.d.ts +47 -0
- package/dist/integrations/service.js +184 -0
- package/dist/integrations/service.js.map +1 -0
- package/dist/integrations/zod.d.ts +29 -0
- package/dist/integrations/zod.js +40 -0
- package/dist/integrations/zod.js.map +1 -0
- package/dist/organizations/events.d.ts +197 -0
- package/dist/organizations/events.js +59 -0
- package/dist/organizations/events.js.map +1 -0
- package/dist/organizations/index.d.ts +11 -0
- package/dist/organizations/index.js +5 -0
- package/dist/organizations/members.d.ts +32 -0
- package/dist/organizations/members.js +12 -0
- package/dist/organizations/members.js.map +1 -0
- package/dist/organizations/model.d.ts +3 -0
- package/dist/organizations/model.js +1 -0
- package/dist/organizations/ports.d.ts +127 -0
- package/dist/organizations/ports.js +1 -0
- package/dist/organizations/roles.d.ts +23 -0
- package/dist/organizations/roles.js +70 -0
- package/dist/organizations/roles.js.map +1 -0
- package/dist/organizations/service.d.ts +58 -0
- package/dist/organizations/service.js +359 -0
- package/dist/organizations/service.js.map +1 -0
- package/dist/organizations/types.d.ts +39 -0
- package/dist/organizations/types.js +1 -0
- package/dist/progress/events.d.ts +55 -0
- package/dist/progress/events.js +19 -0
- package/dist/progress/events.js.map +1 -0
- package/dist/progress/index.d.ts +8 -0
- package/dist/progress/index.js +3 -0
- package/dist/progress/model.d.ts +3 -0
- package/dist/progress/model.js +1 -0
- package/dist/progress/ports.d.ts +37 -0
- package/dist/progress/ports.js +1 -0
- package/dist/progress/service.d.ts +33 -0
- package/dist/progress/service.js +181 -0
- package/dist/progress/service.js.map +1 -0
- package/dist/progress/types.d.ts +4 -0
- package/dist/progress/types.js +1 -0
- package/dist/reporting/dashboard/index.d.ts +4 -0
- package/dist/reporting/dashboard/index.js +2 -0
- package/dist/reporting/dashboard/model.d.ts +14 -0
- package/dist/reporting/dashboard/model.js +1 -0
- package/dist/reporting/dashboard/ports.d.ts +13 -0
- package/dist/reporting/dashboard/ports.js +1 -0
- package/dist/reporting/dashboard/service.d.ts +19 -0
- package/dist/reporting/dashboard/service.js +20 -0
- package/dist/reporting/dashboard/service.js.map +1 -0
- package/dist/reporting/learn/index.d.ts +5 -0
- package/dist/reporting/learn/index.js +2 -0
- package/dist/reporting/learn/model.d.ts +23 -0
- package/dist/reporting/learn/model.js +1 -0
- package/dist/reporting/learn/ports.d.ts +42 -0
- package/dist/reporting/learn/ports.js +1 -0
- package/dist/reporting/learn/service.d.ts +48 -0
- package/dist/reporting/learn/service.js +111 -0
- package/dist/reporting/learn/service.js.map +1 -0
- package/dist/reporting/students/index.d.ts +4 -0
- package/dist/reporting/students/index.js +2 -0
- package/dist/reporting/students/model.d.ts +31 -0
- package/dist/reporting/students/model.js +1 -0
- package/dist/reporting/students/ports.d.ts +13 -0
- package/dist/reporting/students/ports.js +1 -0
- package/dist/reporting/students/service.d.ts +19 -0
- package/dist/reporting/students/service.js +20 -0
- package/dist/reporting/students/service.js.map +1 -0
- package/dist/shared/errors.d.ts +22 -0
- package/dist/shared/errors.js +34 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/events.d.ts +31 -0
- package/dist/shared/events.js +75 -0
- package/dist/shared/events.js.map +1 -0
- package/dist/shared/id.d.ts +44 -0
- package/dist/shared/id.js +53 -0
- package/dist/shared/id.js.map +1 -0
- package/dist/shared/invite-token.d.ts +9 -0
- package/dist/shared/invite-token.js +16 -0
- package/dist/shared/invite-token.js.map +1 -0
- package/dist/shared/logger.d.ts +19 -0
- package/dist/shared/logger.js +44 -0
- package/dist/shared/logger.js.map +1 -0
- package/dist/shared/mailer.d.ts +23 -0
- package/dist/shared/mailer.js +27 -0
- package/dist/shared/mailer.js.map +1 -0
- package/dist/shared/ports.d.ts +62 -0
- package/dist/shared/ports.js +2 -0
- package/dist/shared/settings.d.ts +25 -0
- package/dist/shared/settings.js +21 -0
- package/dist/shared/settings.js.map +1 -0
- package/dist/types/assets.d.ts +2 -0
- package/dist/types/assets.js +1 -0
- package/dist/types/automations.d.ts +23 -0
- package/dist/types/automations.js +1 -0
- package/dist/types/content.d.ts +2 -0
- package/dist/types/content.js +1 -0
- package/dist/types/discussion.d.ts +36 -0
- package/dist/types/discussion.js +1 -0
- package/dist/types/email-templates.d.ts +57 -0
- package/dist/types/email-templates.js +1 -0
- package/dist/types/entitlements.d.ts +3 -0
- package/dist/types/entitlements.js +1 -0
- package/dist/types/events.d.ts +25 -0
- package/dist/types/events.js +1 -0
- package/dist/types/identity.d.ts +37 -0
- package/dist/types/identity.js +1 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/index.js +1 -0
- package/dist/types/integrations.d.ts +45 -0
- package/dist/types/integrations.js +1 -0
- package/dist/types/organizations.d.ts +15 -0
- package/dist/types/organizations.js +1 -0
- package/dist/types/ports.d.ts +57 -0
- package/dist/types/ports.js +1 -0
- package/dist/types/progress.d.ts +6 -0
- package/dist/types/progress.js +1 -0
- package/dist/types/schemas/assets.d.ts +109 -0
- package/dist/types/schemas/assets.js +49 -0
- package/dist/types/schemas/assets.js.map +1 -0
- package/dist/types/schemas/automations.d.ts +118 -0
- package/dist/types/schemas/automations.js +73 -0
- package/dist/types/schemas/automations.js.map +1 -0
- package/dist/types/schemas/content.d.ts +216 -0
- package/dist/types/schemas/content.js +138 -0
- package/dist/types/schemas/content.js.map +1 -0
- package/dist/types/schemas/credentials.d.ts +15 -0
- package/dist/types/schemas/credentials.js +15 -0
- package/dist/types/schemas/credentials.js.map +1 -0
- package/dist/types/schemas/discussion.d.ts +192 -0
- package/dist/types/schemas/discussion.js +100 -0
- package/dist/types/schemas/discussion.js.map +1 -0
- package/dist/types/schemas/entitlements.d.ts +50 -0
- package/dist/types/schemas/entitlements.js +38 -0
- package/dist/types/schemas/entitlements.js.map +1 -0
- package/dist/types/schemas/identity.d.ts +37 -0
- package/dist/types/schemas/identity.js +34 -0
- package/dist/types/schemas/identity.js.map +1 -0
- package/dist/types/schemas/index.d.ts +14 -0
- package/dist/types/schemas/index.js +14 -0
- package/dist/types/schemas/integrations.d.ts +36 -0
- package/dist/types/schemas/integrations.js +30 -0
- package/dist/types/schemas/integrations.js.map +1 -0
- package/dist/types/schemas/organizations.d.ts +135 -0
- package/dist/types/schemas/organizations.js +90 -0
- package/dist/types/schemas/organizations.js.map +1 -0
- package/dist/types/schemas/outbox.d.ts +19 -0
- package/dist/types/schemas/outbox.js +18 -0
- package/dist/types/schemas/outbox.js.map +1 -0
- package/dist/types/schemas/progress.d.ts +53 -0
- package/dist/types/schemas/progress.js +37 -0
- package/dist/types/schemas/progress.js.map +1 -0
- package/dist/types/schemas/settings.d.ts +16 -0
- package/dist/types/schemas/settings.js +15 -0
- package/dist/types/schemas/settings.js.map +1 -0
- package/dist/types/schemas/shared.d.ts +13 -0
- package/dist/types/schemas/shared.js +28 -0
- package/dist/types/schemas/shared.js.map +1 -0
- package/dist/types/shared.d.ts +25 -0
- package/dist/types/shared.js +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DomainEvent } from "./shared.js";
|
|
2
|
+
import { Automation, AutomationAction, AutomationActionResult, AutomationRun, AutomationRunStatus, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableActions, AvailableTriggers, CreateAutomationInput, UpdateAutomationInput } from "./schemas/automations.js";
|
|
3
|
+
//#region src/types/automations.d.ts
|
|
4
|
+
interface AutomationDispatch {
|
|
5
|
+
runId: string;
|
|
6
|
+
orgId: string;
|
|
7
|
+
automationId: string;
|
|
8
|
+
actions: AutomationAction[];
|
|
9
|
+
event: DomainEvent;
|
|
10
|
+
}
|
|
11
|
+
interface AutomationExecutor {
|
|
12
|
+
runAction(d: AutomationDispatch, index: number): Promise<AutomationActionResult>;
|
|
13
|
+
finalize(d: AutomationDispatch, results: AutomationActionResult[]): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
interface AutomationEngine {
|
|
16
|
+
register(executor: AutomationExecutor): void;
|
|
17
|
+
dispatch(d: AutomationDispatch): Promise<void>;
|
|
18
|
+
start(): Promise<void>;
|
|
19
|
+
stop(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { type Automation, type AutomationAction, type AutomationActionResult, AutomationDispatch, AutomationEngine, AutomationExecutor, type AutomationRun, type AutomationRunStatus, type AutomationRunsQuery, type AutomationTrigger, type AvailableAction, type AvailableActions, type AvailableTriggers, type CreateAutomationInput, type UpdateAutomationInput };
|
|
23
|
+
//# sourceMappingURL=automations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Activity, ActivityAsset, ActivityCommentsRule, ActivitySettings, AddDownloadAssetInput, ContentItem, ContentType, Course, CourseSettings, CourseStatus, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, DownloadStatus, ListCoursesQuery, ListDownloadsQuery, Module, ReorderDownloadAssetsInput, SaveActivityInput, UpdateCourseInput, UpdateDownloadInput } from "./schemas/content.js";
|
|
2
|
+
export type { Activity, ActivityAsset, ActivityCommentsRule, ActivitySettings, AddDownloadAssetInput, ContentItem, ContentType, Course, CourseSettings, CourseStatus, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, DownloadStatus, ListCoursesQuery, ListDownloadsQuery, Module, ReorderDownloadAssetsInput, SaveActivityInput, UpdateCourseInput, UpdateDownloadInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Page } from "./shared.js";
|
|
2
|
+
import { Role } from "./schemas/organizations.js";
|
|
3
|
+
import "./organizations.js";
|
|
4
|
+
import { CommentListItem, CommentReaction, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, ListCommentsQuery, ReactionCounts, ReactionEmoji } from "./schemas/discussion.js";
|
|
5
|
+
//#region src/types/discussion.d.ts
|
|
6
|
+
interface Comment {
|
|
7
|
+
readonly id: string;
|
|
8
|
+
readonly orgId: string;
|
|
9
|
+
readonly activityId: string;
|
|
10
|
+
readonly parentId: string | null;
|
|
11
|
+
readonly orgUserId: string;
|
|
12
|
+
body: string;
|
|
13
|
+
status: CommentStatus;
|
|
14
|
+
removedBy: string | null;
|
|
15
|
+
readonly createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
}
|
|
18
|
+
interface CommentAuthor {
|
|
19
|
+
id: string;
|
|
20
|
+
firstName: string | null;
|
|
21
|
+
lastName: string | null;
|
|
22
|
+
image: string | null;
|
|
23
|
+
role: Role;
|
|
24
|
+
}
|
|
25
|
+
interface CommentReport {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly orgId: string;
|
|
28
|
+
readonly commentId: string;
|
|
29
|
+
readonly orgUserId: string;
|
|
30
|
+
readonly reason: string;
|
|
31
|
+
resolvedAt: Date | null;
|
|
32
|
+
readonly createdAt: Date;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Comment, CommentAuthor, type CommentListItem, type CommentReaction, CommentReport, type CommentReportSummary, type CommentSettings, type CommentStatus, type CommentView, type CommentsConfig, type ListCommentsQuery, type Page, type ReactionCounts, type ReactionEmoji };
|
|
36
|
+
//# sourceMappingURL=discussion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region src/types/email-templates.d.ts
|
|
2
|
+
/** Branding threaded into every template. */
|
|
3
|
+
interface TemplateContext {
|
|
4
|
+
/** Product or organization name shown in the email. */
|
|
5
|
+
brandName: string;
|
|
6
|
+
/** Origin links resolve against (e.g. the admin app URL). */
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
/** Origin student-facing links resolve against (the student portal URL). */
|
|
9
|
+
studentPortalUrl: string;
|
|
10
|
+
logoUrl?: string;
|
|
11
|
+
}
|
|
12
|
+
/** A fully rendered email, ready for an EmailSender. */
|
|
13
|
+
interface EmailContent {
|
|
14
|
+
subject: string;
|
|
15
|
+
html: string;
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
/** Template id → params. Adding an email = adding a row here. */
|
|
19
|
+
interface EmailTemplateParams {
|
|
20
|
+
magicLink: {
|
|
21
|
+
url: string;
|
|
22
|
+
};
|
|
23
|
+
studentInvite: {
|
|
24
|
+
inviteUrl: string;
|
|
25
|
+
studentName: string;
|
|
26
|
+
};
|
|
27
|
+
memberInvite: {
|
|
28
|
+
inviteUrl: string;
|
|
29
|
+
inviterName: string;
|
|
30
|
+
role: string;
|
|
31
|
+
};
|
|
32
|
+
passwordReset: {
|
|
33
|
+
resetUrl: string;
|
|
34
|
+
};
|
|
35
|
+
emailVerification: {
|
|
36
|
+
verifyUrl: string;
|
|
37
|
+
};
|
|
38
|
+
accessGranted: {
|
|
39
|
+
contentTitle: string;
|
|
40
|
+
contentId: string;
|
|
41
|
+
};
|
|
42
|
+
accessRevoked: {
|
|
43
|
+
contentTitle: string;
|
|
44
|
+
};
|
|
45
|
+
courseCompleted: {
|
|
46
|
+
courseTitle: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
type EmailTemplateId = keyof EmailTemplateParams;
|
|
50
|
+
/** Resolves a template + data to rendered content. Deployment-swappable;
|
|
51
|
+
* default implementation: @headless-lms/adapter-email-templates. */
|
|
52
|
+
interface TemplateRenderer {
|
|
53
|
+
render<K extends EmailTemplateId>(id: K, ctx: TemplateContext, params: EmailTemplateParams[K]): Promise<EmailContent>;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { EmailContent, EmailTemplateId, EmailTemplateParams, TemplateContext, TemplateRenderer };
|
|
57
|
+
//# sourceMappingURL=email-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ContractNewDomainEvent, DomainEvent, EventMetadata } from "./shared.js";
|
|
2
|
+
//#region src/types/events.d.ts
|
|
3
|
+
interface MakeEventInput<TData> {
|
|
4
|
+
readonly orgId: string;
|
|
5
|
+
readonly data: TData;
|
|
6
|
+
readonly metadata?: EventMetadata | undefined;
|
|
7
|
+
}
|
|
8
|
+
type EventParseResult<E extends DomainEvent> = {
|
|
9
|
+
readonly success: true;
|
|
10
|
+
readonly data: E;
|
|
11
|
+
} | {
|
|
12
|
+
readonly success: false;
|
|
13
|
+
readonly error: Error;
|
|
14
|
+
};
|
|
15
|
+
interface EventDefinition<E extends DomainEvent, TMakeData = E["data"]> {
|
|
16
|
+
readonly type: E["type"];
|
|
17
|
+
readonly version: E["version"];
|
|
18
|
+
make(input: MakeEventInput<TMakeData>): ContractNewDomainEvent<E>;
|
|
19
|
+
is(event: unknown): event is E;
|
|
20
|
+
parse(event: unknown): E;
|
|
21
|
+
safeParse(event: unknown): EventParseResult<E>;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { EventDefinition, EventParseResult, MakeEventInput };
|
|
25
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CreateUserInput, ProvisionUserInput, UpdateUserInput } from "./schemas/identity.js";
|
|
2
|
+
//#region src/types/identity.d.ts
|
|
3
|
+
interface User {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly externalId: string | null;
|
|
6
|
+
readonly email: string;
|
|
7
|
+
readonly firstName: string | null;
|
|
8
|
+
readonly lastName: string | null;
|
|
9
|
+
readonly createdAt: Date;
|
|
10
|
+
readonly updatedAt: Date;
|
|
11
|
+
}
|
|
12
|
+
type ActiveSession = {
|
|
13
|
+
user: User;
|
|
14
|
+
session: {
|
|
15
|
+
activeOrganizationId?: string | null;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
interface SessionVerifier {
|
|
19
|
+
verify(headers: Record<string, string | string[] | undefined>): Promise<ActiveSession | null>;
|
|
20
|
+
}
|
|
21
|
+
interface AccountProvisioner {
|
|
22
|
+
create(input: {
|
|
23
|
+
email: string;
|
|
24
|
+
password?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
externalId: string;
|
|
28
|
+
}>;
|
|
29
|
+
updateEmail(externalId: string, email: string): Promise<void>;
|
|
30
|
+
setPassword(externalId: string, password: string): Promise<void>;
|
|
31
|
+
revokeSessions(externalId: string): Promise<void>;
|
|
32
|
+
delete(externalId: string): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
type UserId = string;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { AccountProvisioner, ActiveSession, type CreateUserInput, type ProvisionUserInput, SessionVerifier, type UpdateUserInput, User, UserId };
|
|
37
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ContractNewDomainEvent, DomainEvent, EventMetadata, JsonValue, NewDomainEvent, Page } from "./shared.js";
|
|
2
|
+
import { EventDefinition, EventParseResult, MakeEventInput } from "./events.js";
|
|
3
|
+
import { EmailMessage, EmailSender, Logger, ObjectStorage, PresignDownloadInput, PresignedUpload, StoredObjectInfo } from "./ports.js";
|
|
4
|
+
import { EmailContent, EmailTemplateId, EmailTemplateParams, TemplateContext, TemplateRenderer } from "./email-templates.js";
|
|
5
|
+
import { CreateUserInput, ProvisionUserInput, UpdateUserInput } from "./schemas/identity.js";
|
|
6
|
+
import { AccountProvisioner, ActiveSession, SessionVerifier, User, UserId } from "./identity.js";
|
|
7
|
+
import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput, InviteRole, NewOrganizationInput, OrgUser, OrgUserInput, OrgUserProfile, OrgUserStatus, Organization, OrganizationInput, Role } from "./schemas/organizations.js";
|
|
8
|
+
import { CreateOrganizationInput, InviteId, OrgUserId, OrganizationId } from "./organizations.js";
|
|
9
|
+
import { Activity, ActivityAsset, ActivityCommentsRule, ActivitySettings, AddDownloadAssetInput, ContentItem, ContentType, Course, CourseSettings, CourseStatus, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, DownloadStatus, ListCoursesQuery, ListDownloadsQuery, Module, ReorderDownloadAssetsInput, SaveActivityInput, UpdateCourseInput, UpdateDownloadInput } from "./schemas/content.js";
|
|
10
|
+
import "./content.js";
|
|
11
|
+
import { Entitlement, EntitlementStatus, EntitlementsQuery, GrantEntitlementInput } from "./schemas/entitlements.js";
|
|
12
|
+
import "./entitlements.js";
|
|
13
|
+
import { ProgressRecord, ProgressRecordInput, ProgressReportItem, ProgressTarget, ProgressTargetType, ReportProgressInput } from "./schemas/progress.js";
|
|
14
|
+
import { ProgressId } from "./progress.js";
|
|
15
|
+
import { Asset, AssetKind, AssetStatus, AssetsQuery, DownloadTicket, RequestUploadInput, UploadTicket } from "./schemas/assets.js";
|
|
16
|
+
import "./assets.js";
|
|
17
|
+
import { ConfigureInput, ConnectInput, Connection, Validation } from "./schemas/integrations.js";
|
|
18
|
+
import { Action, ActionContext, Integration } from "./integrations.js";
|
|
19
|
+
import { Automation, AutomationAction, AutomationActionResult, AutomationRun, AutomationRunStatus, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableActions, AvailableTriggers, CreateAutomationInput, UpdateAutomationInput } from "./schemas/automations.js";
|
|
20
|
+
import { AutomationDispatch, AutomationEngine, AutomationExecutor } from "./automations.js";
|
|
21
|
+
import { CommentListItem, CommentReaction, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, ListCommentsQuery, ReactionCounts, ReactionEmoji } from "./schemas/discussion.js";
|
|
22
|
+
import { Comment, CommentAuthor, CommentReport } from "./discussion.js";
|
|
23
|
+
export { type AcceptInviteInput, AccountProvisioner, Action, ActionContext, ActiveSession, type Activity, type ActivityAsset, type ActivityCommentsRule, type ActivitySettings, type AddDownloadAssetInput, type AddOrgUserInput, type Asset, type AssetKind, type AssetStatus, type AssetsQuery, type Automation, type AutomationAction, type AutomationActionResult, AutomationDispatch, AutomationEngine, AutomationExecutor, type AutomationRun, type AutomationRunStatus, type AutomationRunsQuery, type AutomationTrigger, type AvailableAction, type AvailableActions, type AvailableTriggers, Comment, CommentAuthor, type CommentListItem, type CommentReaction, CommentReport, type CommentReportSummary, type CommentSettings, type CommentStatus, type CommentView, type CommentsConfig, type ConfigureInput, type ConnectInput, type Connection, type ContentItem, type ContentType, ContractNewDomainEvent, type Course, type CourseSettings, type CourseStatus, type CreateAutomationInput, type CreateCourseInput, type CreateDownloadInput, type CreateInviteInput, type CreateOrgUserInput, CreateOrganizationInput, type CreateUserInput, DomainEvent, type Download, type DownloadAsset, type DownloadStatus, type DownloadTicket, EmailContent, EmailMessage, EmailSender, EmailTemplateId, EmailTemplateParams, type Entitlement, type EntitlementStatus, type EntitlementsQuery, EventDefinition, EventMetadata, EventParseResult, type GrantEntitlementInput, Integration, type Invite, InviteId, type InviteInput, type InviteRole, JsonValue, type ListCommentsQuery, type ListCoursesQuery, type ListDownloadsQuery, Logger, MakeEventInput, type Module, NewDomainEvent, type NewOrganizationInput, ObjectStorage, type OrgUser, OrgUserId, type OrgUserInput, type OrgUserProfile, type OrgUserStatus, type Organization, OrganizationId, type OrganizationInput, Page, PresignDownloadInput, PresignedUpload, ProgressId, type ProgressRecord, type ProgressRecordInput, type ProgressReportItem, type ProgressTarget, type ProgressTargetType, type ProvisionUserInput, type ReactionCounts, type ReactionEmoji, type ReorderDownloadAssetsInput, type ReportProgressInput, type RequestUploadInput, type Role, type SaveActivityInput, SessionVerifier, StoredObjectInfo, TemplateContext, TemplateRenderer, type UpdateAutomationInput, type UpdateCourseInput, type UpdateDownloadInput, type UpdateUserInput, type UploadTicket, User, UserId, type Validation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ConfigureInput, ConnectInput, Connection, Validation } from "./schemas/integrations.js";
|
|
2
|
+
//#region src/types/integrations.d.ts
|
|
3
|
+
/** What an action receives when invoked: the connection's secrets (revealed by
|
|
4
|
+
* the caller at point of use) and its configuration. */
|
|
5
|
+
interface ActionContext {
|
|
6
|
+
secrets: Record<string, unknown>;
|
|
7
|
+
config: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A named capability an integration exposes (e.g. slack's postToChannel).
|
|
11
|
+
* Callers (automations) discover actions by id and input/output definitions,
|
|
12
|
+
* then invoke them; the action's code makes the external call.
|
|
13
|
+
*/
|
|
14
|
+
interface Action {
|
|
15
|
+
id: string;
|
|
16
|
+
/** One line, human-readable: what invoking this action does. */
|
|
17
|
+
description: string;
|
|
18
|
+
/** The input the action accepts, as JSON Schema. */
|
|
19
|
+
inputSchema(): Record<string, unknown>;
|
|
20
|
+
/** The output the action resolves with, as JSON Schema. */
|
|
21
|
+
outputSchema(): Record<string, unknown>;
|
|
22
|
+
/** Run the action against the external service. */
|
|
23
|
+
invoke(ctx: ActionContext, input: unknown): Promise<unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An available integration. Each integration is a module (one folder per
|
|
27
|
+
* integration) satisfying this port; the set the system supports is declared
|
|
28
|
+
* at startup by building a registry from them.
|
|
29
|
+
*/
|
|
30
|
+
interface Integration {
|
|
31
|
+
/** Registry key and Connection.integrationId (e.g. "stripe", "slack"). */
|
|
32
|
+
id: string;
|
|
33
|
+
/** The config this integration accepts, as JSON Schema (drives clients/forms). */
|
|
34
|
+
configSchema(): Record<string, unknown>;
|
|
35
|
+
/** The secrets this integration needs, as JSON Schema. Discovery/form
|
|
36
|
+
* rendering only — secrets stay opaque to the domain, never validated. */
|
|
37
|
+
secretsSchema(): Record<string, unknown>;
|
|
38
|
+
/** Validate a connection's config against this integration's schema. */
|
|
39
|
+
validateConfig(config: unknown): Validation;
|
|
40
|
+
/** The actions this integration can be invoked with (may be empty). */
|
|
41
|
+
actions: Action[];
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Action, ActionContext, type ConfigureInput, type ConnectInput, type Connection, Integration, type Validation };
|
|
45
|
+
//# sourceMappingURL=integrations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AcceptInviteInput, AddOrgUserInput, CreateInviteInput, CreateOrgUserInput, Invite, InviteInput, InviteRole, NewOrganizationInput, OrgUser, OrgUserInput, OrgUserProfile, OrgUserStatus, Organization, OrganizationInput, Role } from "./schemas/organizations.js";
|
|
2
|
+
//#region src/types/organizations.d.ts
|
|
3
|
+
type OrganizationId = string;
|
|
4
|
+
type OrgUserId = string;
|
|
5
|
+
type InviteId = string;
|
|
6
|
+
interface CreateOrganizationInput {
|
|
7
|
+
externalId?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
slug?: string;
|
|
10
|
+
logo?: string;
|
|
11
|
+
ownerId: string;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { type AcceptInviteInput, type AddOrgUserInput, type CreateInviteInput, type CreateOrgUserInput, CreateOrganizationInput, type Invite, InviteId, type InviteInput, type InviteRole, type NewOrganizationInput, type OrgUser, OrgUserId, type OrgUserInput, type OrgUserProfile, type OrgUserStatus, type Organization, OrganizationId, type OrganizationInput, type Role };
|
|
15
|
+
//# sourceMappingURL=organizations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region src/types/ports.d.ts
|
|
2
|
+
interface Logger {
|
|
3
|
+
debug(msg: string, meta?: Record<string, unknown>): void;
|
|
4
|
+
info(msg: string, meta?: Record<string, unknown>): void;
|
|
5
|
+
warn(msg: string, meta?: Record<string, unknown>): void;
|
|
6
|
+
error(msg: string, meta?: Record<string, unknown>): void;
|
|
7
|
+
/** A logger whose every entry carries `bindings` (call-site meta wins on key clash). */
|
|
8
|
+
child(bindings: Record<string, unknown>): Logger;
|
|
9
|
+
}
|
|
10
|
+
interface EmailMessage {
|
|
11
|
+
to: string;
|
|
12
|
+
subject: string;
|
|
13
|
+
text: string;
|
|
14
|
+
/** Optional rendered HTML body; transports fall back to text when absent. */
|
|
15
|
+
html?: string;
|
|
16
|
+
}
|
|
17
|
+
interface EmailSender {
|
|
18
|
+
send(message: EmailMessage): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
/** A presigned URL the browser uses to PUT a file straight to the store. */
|
|
21
|
+
interface PresignedUpload {
|
|
22
|
+
url: string;
|
|
23
|
+
method: "PUT";
|
|
24
|
+
key: string;
|
|
25
|
+
expiresInSeconds: number;
|
|
26
|
+
/** Headers the client must send on the PUT (e.g. Content-Type). */
|
|
27
|
+
headers: Record<string, string>;
|
|
28
|
+
}
|
|
29
|
+
interface StoredObjectInfo {
|
|
30
|
+
key: string;
|
|
31
|
+
size: number;
|
|
32
|
+
contentType?: string;
|
|
33
|
+
lastModified?: string;
|
|
34
|
+
}
|
|
35
|
+
interface PresignDownloadInput {
|
|
36
|
+
key: string;
|
|
37
|
+
expiresInSeconds?: number;
|
|
38
|
+
/** Force a download with this filename (Content-Disposition: attachment). */
|
|
39
|
+
downloadFilename?: string;
|
|
40
|
+
}
|
|
41
|
+
interface ObjectStorage {
|
|
42
|
+
/** Presigned URL for a direct browser upload (temporary, expiring). */
|
|
43
|
+
presignUpload(input: {
|
|
44
|
+
key: string;
|
|
45
|
+
contentType?: string;
|
|
46
|
+
expiresInSeconds?: number;
|
|
47
|
+
}): Promise<PresignedUpload>;
|
|
48
|
+
/** Presigned URL to fetch/serve a private object (temporary, expiring). */
|
|
49
|
+
presignDownload(input: PresignDownloadInput): Promise<string>;
|
|
50
|
+
/** Object metadata, or null if it does not exist. */
|
|
51
|
+
stat(key: string): Promise<StoredObjectInfo | null>;
|
|
52
|
+
/** Permanently remove an object. */
|
|
53
|
+
remove(key: string): Promise<void>;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { EmailMessage, EmailSender, Logger, ObjectStorage, PresignDownloadInput, PresignedUpload, StoredObjectInfo };
|
|
57
|
+
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ProgressRecord, ProgressRecordInput, ProgressReportItem, ProgressTarget, ProgressTargetType, ReportProgressInput } from "./schemas/progress.js";
|
|
2
|
+
//#region src/types/progress.d.ts
|
|
3
|
+
type ProgressId = string;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { ProgressId, type ProgressRecord, type ProgressRecordInput, type ProgressReportItem, type ProgressTarget, type ProgressTargetType, type ReportProgressInput };
|
|
6
|
+
//# sourceMappingURL=progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/types/schemas/assets.d.ts
|
|
3
|
+
declare const assetKindSchema: z.ZodEnum<{
|
|
4
|
+
video: "video";
|
|
5
|
+
download: "download";
|
|
6
|
+
content: "content";
|
|
7
|
+
}>;
|
|
8
|
+
type AssetKind = z.infer<typeof assetKindSchema>;
|
|
9
|
+
declare const assetStatusSchema: z.ZodEnum<{
|
|
10
|
+
pending: "pending";
|
|
11
|
+
ready: "ready";
|
|
12
|
+
}>;
|
|
13
|
+
type AssetStatus = z.infer<typeof assetStatusSchema>;
|
|
14
|
+
declare const assetSchema: z.ZodObject<{
|
|
15
|
+
orgId: z.ZodString;
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
key: z.ZodString;
|
|
18
|
+
kind: z.ZodEnum<{
|
|
19
|
+
video: "video";
|
|
20
|
+
download: "download";
|
|
21
|
+
content: "content";
|
|
22
|
+
}>;
|
|
23
|
+
filename: z.ZodString;
|
|
24
|
+
contentType: z.ZodString;
|
|
25
|
+
size: z.ZodNumber;
|
|
26
|
+
status: z.ZodEnum<{
|
|
27
|
+
pending: "pending";
|
|
28
|
+
ready: "ready";
|
|
29
|
+
}>;
|
|
30
|
+
uploadedBy: z.ZodString;
|
|
31
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
type Asset = z.output<typeof assetSchema>;
|
|
34
|
+
type AssetInput = z.input<typeof assetSchema>;
|
|
35
|
+
declare const requestUploadInputSchema: z.ZodObject<{
|
|
36
|
+
uploadedBy: z.ZodString;
|
|
37
|
+
filename: z.ZodString;
|
|
38
|
+
contentType: z.ZodString;
|
|
39
|
+
kind: z.ZodEnum<{
|
|
40
|
+
video: "video";
|
|
41
|
+
download: "download";
|
|
42
|
+
content: "content";
|
|
43
|
+
}>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
type RequestUploadInput = z.infer<typeof requestUploadInputSchema>;
|
|
46
|
+
declare const uploadTicketSchema: z.ZodObject<{
|
|
47
|
+
asset: z.ZodObject<{
|
|
48
|
+
orgId: z.ZodString;
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
key: z.ZodString;
|
|
51
|
+
kind: z.ZodEnum<{
|
|
52
|
+
video: "video";
|
|
53
|
+
download: "download";
|
|
54
|
+
content: "content";
|
|
55
|
+
}>;
|
|
56
|
+
filename: z.ZodString;
|
|
57
|
+
contentType: z.ZodString;
|
|
58
|
+
size: z.ZodNumber;
|
|
59
|
+
status: z.ZodEnum<{
|
|
60
|
+
pending: "pending";
|
|
61
|
+
ready: "ready";
|
|
62
|
+
}>;
|
|
63
|
+
uploadedBy: z.ZodString;
|
|
64
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
65
|
+
}, z.core.$strict>;
|
|
66
|
+
uploadUrl: z.ZodString;
|
|
67
|
+
method: z.ZodLiteral<"PUT">;
|
|
68
|
+
expiresInSeconds: z.ZodNumber;
|
|
69
|
+
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
70
|
+
}, z.core.$strict>;
|
|
71
|
+
type UploadTicket = z.infer<typeof uploadTicketSchema>;
|
|
72
|
+
declare const downloadTicketSchema: z.ZodObject<{
|
|
73
|
+
url: z.ZodString;
|
|
74
|
+
asset: z.ZodObject<{
|
|
75
|
+
orgId: z.ZodString;
|
|
76
|
+
id: z.ZodString;
|
|
77
|
+
key: z.ZodString;
|
|
78
|
+
kind: z.ZodEnum<{
|
|
79
|
+
video: "video";
|
|
80
|
+
download: "download";
|
|
81
|
+
content: "content";
|
|
82
|
+
}>;
|
|
83
|
+
filename: z.ZodString;
|
|
84
|
+
contentType: z.ZodString;
|
|
85
|
+
size: z.ZodNumber;
|
|
86
|
+
status: z.ZodEnum<{
|
|
87
|
+
pending: "pending";
|
|
88
|
+
ready: "ready";
|
|
89
|
+
}>;
|
|
90
|
+
uploadedBy: z.ZodString;
|
|
91
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
type DownloadTicket = z.infer<typeof downloadTicketSchema>;
|
|
95
|
+
declare const assetsQuerySchema: z.ZodObject<{
|
|
96
|
+
page: z.ZodNumber;
|
|
97
|
+
pageSize: z.ZodNumber;
|
|
98
|
+
search: z.ZodOptional<z.ZodString>;
|
|
99
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
100
|
+
kind: z.ZodOptional<z.ZodEnum<{
|
|
101
|
+
video: "video";
|
|
102
|
+
download: "download";
|
|
103
|
+
content: "content";
|
|
104
|
+
}>>;
|
|
105
|
+
}, z.core.$strict>;
|
|
106
|
+
type AssetsQuery = z.infer<typeof assetsQuerySchema>;
|
|
107
|
+
//#endregion
|
|
108
|
+
export { Asset, AssetInput, AssetKind, AssetStatus, AssetsQuery, DownloadTicket, RequestUploadInput, UploadTicket, assetKindSchema, assetSchema, assetStatusSchema, assetsQuerySchema, downloadTicketSchema, requestUploadInputSchema, uploadTicketSchema };
|
|
109
|
+
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { idSchema } from "./shared.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/types/schemas/assets.ts
|
|
4
|
+
const assetKindSchema = z.enum([
|
|
5
|
+
"video",
|
|
6
|
+
"download",
|
|
7
|
+
"content"
|
|
8
|
+
]);
|
|
9
|
+
const assetStatusSchema = z.enum(["pending", "ready"]);
|
|
10
|
+
const assetSchema = z.object({
|
|
11
|
+
orgId: idSchema,
|
|
12
|
+
id: idSchema,
|
|
13
|
+
key: z.string().trim().min(1),
|
|
14
|
+
kind: assetKindSchema,
|
|
15
|
+
filename: z.string().trim().min(1),
|
|
16
|
+
contentType: z.string().trim().min(1),
|
|
17
|
+
size: z.number().int().min(0),
|
|
18
|
+
status: assetStatusSchema,
|
|
19
|
+
uploadedBy: idSchema,
|
|
20
|
+
createdAt: z.coerce.date()
|
|
21
|
+
}).strict();
|
|
22
|
+
const requestUploadInputSchema = z.object({
|
|
23
|
+
uploadedBy: idSchema,
|
|
24
|
+
filename: z.string().trim().min(1),
|
|
25
|
+
contentType: z.string().trim().min(1),
|
|
26
|
+
kind: assetKindSchema
|
|
27
|
+
}).strict();
|
|
28
|
+
const uploadTicketSchema = z.object({
|
|
29
|
+
asset: assetSchema,
|
|
30
|
+
uploadUrl: z.string().trim().min(1),
|
|
31
|
+
method: z.literal("PUT"),
|
|
32
|
+
expiresInSeconds: z.number().int().positive(),
|
|
33
|
+
headers: z.record(z.string(), z.string())
|
|
34
|
+
}).strict();
|
|
35
|
+
const downloadTicketSchema = z.object({
|
|
36
|
+
url: z.string().trim().min(1),
|
|
37
|
+
asset: assetSchema
|
|
38
|
+
}).strict();
|
|
39
|
+
const assetsQuerySchema = z.object({
|
|
40
|
+
page: z.number().int().min(1),
|
|
41
|
+
pageSize: z.number().int().min(1),
|
|
42
|
+
search: z.string().optional(),
|
|
43
|
+
sort: z.string().optional(),
|
|
44
|
+
kind: assetKindSchema.optional()
|
|
45
|
+
}).strict();
|
|
46
|
+
//#endregion
|
|
47
|
+
export { assetKindSchema, assetSchema, assetStatusSchema, assetsQuerySchema, downloadTicketSchema, requestUploadInputSchema, uploadTicketSchema };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +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\", \"download\", \"content\"]);\nexport type AssetKind = z.infer<typeof assetKindSchema>;\n\nexport const assetStatusSchema = z.enum([\"pending\", \"ready\"]);\nexport type AssetStatus = z.infer<typeof assetStatusSchema>;\n\nexport const assetSchema = z.object({\n orgId: idSchema,\n id: idSchema,\n key: z.string().trim().min(1),\n kind: assetKindSchema,\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}).strict();\nexport type Asset = z.output<typeof assetSchema>;\nexport type AssetInput = z.input<typeof assetSchema>;\n\nexport const requestUploadInputSchema = z.object({\n uploadedBy: idSchema,\n filename: z.string().trim().min(1),\n contentType: z.string().trim().min(1),\n kind: assetKindSchema,\n}).strict();\nexport type RequestUploadInput = z.infer<typeof requestUploadInputSchema>;\n\nexport const uploadTicketSchema = z.object({\n asset: assetSchema,\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}).strict();\nexport type UploadTicket = z.infer<typeof uploadTicketSchema>;\n\nexport const downloadTicketSchema = z.object({\n url: z.string().trim().min(1),\n asset: assetSchema,\n}).strict();\nexport type DownloadTicket = z.infer<typeof downloadTicketSchema>;\n\nexport const assetsQuerySchema = z.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}).strict();\nexport type AssetsQuery = z.infer<typeof assetsQuerySchema>;\n"],"mappings":";;;AAGA,MAAa,kBAAkB,EAAE,KAAK;CAAC;CAAS;CAAY;AAAS,CAAC;AAGtE,MAAa,oBAAoB,EAAE,KAAK,CAAC,WAAW,OAAO,CAAC;AAG5D,MAAa,cAAc,EAAE,OAAO;CAClC,OAAO;CACP,IAAI;CACJ,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAC5B,MAAM;CACN,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;AAC3B,CAAC,CAAC,CAAC,OAAO;AAIV,MAAa,2BAA2B,EAAE,OAAO;CAC/C,YAAY;CACZ,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACjC,aAAa,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CACpC,MAAM;AACR,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,qBAAqB,EAAE,OAAO;CACzC,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,CAAC,OAAO;AAGV,MAAa,uBAAuB,EAAE,OAAO;CAC3C,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;CAC5B,OAAO;AACT,CAAC,CAAC,CAAC,OAAO;AAGV,MAAa,oBAAoB,EAAE,OAAO;CACxC,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;AACjC,CAAC,CAAC,CAAC,OAAO"}
|