@headless-lms/server 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/README.md +48 -0
- package/dist/app/container.d.ts +124 -0
- package/dist/app/container.js +312 -0
- package/dist/app/container.js.map +1 -0
- package/dist/app/db.d.ts +2 -0
- package/dist/app/db.js +2 -0
- package/dist/app/integrations.d.ts +7 -0
- package/dist/app/integrations.js +44 -0
- package/dist/app/integrations.js.map +1 -0
- package/dist/app/notifications.d.ts +7 -0
- package/dist/app/notifications.js +23 -0
- package/dist/app/notifications.js.map +1 -0
- package/dist/http/config.d.ts +25 -0
- package/dist/http/config.js +1 -0
- package/dist/http/fastify.d.ts +35 -0
- package/dist/http/plugins/auth.d.ts +11 -0
- package/dist/http/plugins/auth.js +47 -0
- package/dist/http/plugins/auth.js.map +1 -0
- package/dist/http/plugins/cors.d.ts +7 -0
- package/dist/http/plugins/cors.js +22 -0
- package/dist/http/plugins/cors.js.map +1 -0
- package/dist/http/plugins/error-handler.d.ts +6 -0
- package/dist/http/plugins/error-handler.js +64 -0
- package/dist/http/plugins/error-handler.js.map +1 -0
- package/dist/http/plugins/openapi.d.ts +7 -0
- package/dist/http/plugins/openapi.js +63 -0
- package/dist/http/plugins/openapi.js.map +1 -0
- package/dist/http/routes/activities.d.ts +7 -0
- package/dist/http/routes/activities.js +163 -0
- package/dist/http/routes/activities.js.map +1 -0
- package/dist/http/routes/assets.d.ts +7 -0
- package/dist/http/routes/assets.js +168 -0
- package/dist/http/routes/assets.js.map +1 -0
- package/dist/http/routes/automations.d.ts +7 -0
- package/dist/http/routes/automations.js +158 -0
- package/dist/http/routes/automations.js.map +1 -0
- package/dist/http/routes/courses.d.ts +7 -0
- package/dist/http/routes/courses.js +130 -0
- package/dist/http/routes/courses.js.map +1 -0
- package/dist/http/routes/dashboard.d.ts +7 -0
- package/dist/http/routes/dashboard.js +42 -0
- package/dist/http/routes/dashboard.js.map +1 -0
- package/dist/http/routes/discussion.d.ts +7 -0
- package/dist/http/routes/discussion.js +122 -0
- package/dist/http/routes/discussion.js.map +1 -0
- package/dist/http/routes/downloads.d.ts +7 -0
- package/dist/http/routes/downloads.js +208 -0
- package/dist/http/routes/downloads.js.map +1 -0
- package/dist/http/routes/entitlements.d.ts +7 -0
- package/dist/http/routes/entitlements.js +69 -0
- package/dist/http/routes/entitlements.js.map +1 -0
- package/dist/http/routes/identity.d.ts +6 -0
- package/dist/http/routes/identity.js +6 -0
- package/dist/http/routes/identity.js.map +1 -0
- package/dist/http/routes/integrations.d.ts +7 -0
- package/dist/http/routes/integrations.js +210 -0
- package/dist/http/routes/integrations.js.map +1 -0
- package/dist/http/routes/learn/assets.d.ts +8 -0
- package/dist/http/routes/learn/assets.js +32 -0
- package/dist/http/routes/learn/assets.js.map +1 -0
- package/dist/http/routes/learn/comments.d.ts +7 -0
- package/dist/http/routes/learn/comments.js +175 -0
- package/dist/http/routes/learn/comments.js.map +1 -0
- package/dist/http/routes/learn/courses.d.ts +7 -0
- package/dist/http/routes/learn/courses.js +75 -0
- package/dist/http/routes/learn/courses.js.map +1 -0
- package/dist/http/routes/learn/downloads.d.ts +7 -0
- package/dist/http/routes/learn/downloads.js +76 -0
- package/dist/http/routes/learn/downloads.js.map +1 -0
- package/dist/http/routes/learn/index.d.ts +7 -0
- package/dist/http/routes/learn/index.js +19 -0
- package/dist/http/routes/learn/index.js.map +1 -0
- package/dist/http/routes/learn/org.d.ts +7 -0
- package/dist/http/routes/learn/org.js +50 -0
- package/dist/http/routes/learn/org.js.map +1 -0
- package/dist/http/routes/learn/progress.d.ts +7 -0
- package/dist/http/routes/learn/progress.js +63 -0
- package/dist/http/routes/learn/progress.js.map +1 -0
- package/dist/http/routes/organizations.d.ts +7 -0
- package/dist/http/routes/organizations.js +219 -0
- package/dist/http/routes/organizations.js.map +1 -0
- package/dist/http/routes/progress.d.ts +6 -0
- package/dist/http/routes/progress.js +6 -0
- package/dist/http/routes/progress.js.map +1 -0
- package/dist/http/routes/students.d.ts +7 -0
- package/dist/http/routes/students.js +125 -0
- package/dist/http/routes/students.js.map +1 -0
- package/dist/http/routes.d.ts +7 -0
- package/dist/http/routes.js +37 -0
- package/dist/http/routes.js.map +1 -0
- package/dist/http/schemas/activities.d.ts +69 -0
- package/dist/http/schemas/activities.js +25 -0
- package/dist/http/schemas/activities.js.map +1 -0
- package/dist/http/schemas/assets.d.ts +142 -0
- package/dist/http/schemas/assets.js +24 -0
- package/dist/http/schemas/assets.js.map +1 -0
- package/dist/http/schemas/automations.d.ts +154 -0
- package/dist/http/schemas/automations.js +26 -0
- package/dist/http/schemas/automations.js.map +1 -0
- package/dist/http/schemas/content.d.ts +113 -0
- package/dist/http/schemas/content.js +29 -0
- package/dist/http/schemas/content.js.map +1 -0
- package/dist/http/schemas/dashboard.d.ts +26 -0
- package/dist/http/schemas/dashboard.js +18 -0
- package/dist/http/schemas/dashboard.js.map +1 -0
- package/dist/http/schemas/discussion.d.ts +340 -0
- package/dist/http/schemas/discussion.js +78 -0
- package/dist/http/schemas/discussion.js.map +1 -0
- package/dist/http/schemas/downloads.d.ts +110 -0
- package/dist/http/schemas/downloads.js +34 -0
- package/dist/http/schemas/downloads.js.map +1 -0
- package/dist/http/schemas/entitlements.d.ts +97 -0
- package/dist/http/schemas/entitlements.js +41 -0
- package/dist/http/schemas/entitlements.js.map +1 -0
- package/dist/http/schemas/index.d.ts +17 -0
- package/dist/http/schemas/index.js +17 -0
- package/dist/http/schemas/integrations.d.ts +93 -0
- package/dist/http/schemas/integrations.js +47 -0
- package/dist/http/schemas/integrations.js.map +1 -0
- package/dist/http/schemas/invites.d.ts +95 -0
- package/dist/http/schemas/invites.js +62 -0
- package/dist/http/schemas/invites.js.map +1 -0
- package/dist/http/schemas/learn.d.ts +142 -0
- package/dist/http/schemas/learn.js +58 -0
- package/dist/http/schemas/learn.js.map +1 -0
- package/dist/http/schemas/members.d.ts +88 -0
- package/dist/http/schemas/members.js +27 -0
- package/dist/http/schemas/members.js.map +1 -0
- package/dist/http/schemas/organizations.d.ts +22 -0
- package/dist/http/schemas/organizations.js +20 -0
- package/dist/http/schemas/organizations.js.map +1 -0
- package/dist/http/schemas/settings.d.ts +23 -0
- package/dist/http/schemas/settings.js +20 -0
- package/dist/http/schemas/settings.js.map +1 -0
- package/dist/http/schemas/shared.d.ts +57 -0
- package/dist/http/schemas/shared.js +54 -0
- package/dist/http/schemas/shared.js.map +1 -0
- package/dist/http/schemas/students.d.ts +64 -0
- package/dist/http/schemas/students.js +25 -0
- package/dist/http/schemas/students.js.map +1 -0
- package/dist/http/scope.d.ts +22 -0
- package/dist/http/scope.js +28 -0
- package/dist/http/scope.js.map +1 -0
- package/dist/http/server.d.ts +8 -0
- package/dist/http/server.js +33 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/web-bridge.d.ts +9 -0
- package/dist/http/web-bridge.js +27 -0
- package/dist/http/web-bridge.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/http/schemas/entitlements.d.ts
|
|
3
|
+
declare const EntitlementStatus: z.ZodEnum<{
|
|
4
|
+
active: "active";
|
|
5
|
+
expired: "expired";
|
|
6
|
+
revoked: "revoked";
|
|
7
|
+
}>;
|
|
8
|
+
type EntitlementStatus = z.infer<typeof EntitlementStatus>;
|
|
9
|
+
declare const ContentType: z.ZodEnum<{
|
|
10
|
+
course: "course";
|
|
11
|
+
download: "download";
|
|
12
|
+
}>;
|
|
13
|
+
type ContentType = z.infer<typeof ContentType>;
|
|
14
|
+
/** Reference to the granted content: identity + display name (join-derived).
|
|
15
|
+
* The full content object lives on its own resource. */
|
|
16
|
+
declare const ContentRef: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
type: z.ZodEnum<{
|
|
19
|
+
course: "course";
|
|
20
|
+
download: "download";
|
|
21
|
+
}>;
|
|
22
|
+
title: z.ZodString;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
type ContentRef = z.infer<typeof ContentRef>;
|
|
25
|
+
declare const Entitlement: z.ZodObject<{
|
|
26
|
+
orgId: z.ZodString;
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
orgUserId: z.ZodString;
|
|
29
|
+
contentId: z.ZodString;
|
|
30
|
+
status: z.ZodEnum<{
|
|
31
|
+
active: "active";
|
|
32
|
+
revoked: "revoked";
|
|
33
|
+
}>;
|
|
34
|
+
source: z.ZodString;
|
|
35
|
+
grantedAt: z.ZodCoercedDate<unknown>;
|
|
36
|
+
expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
37
|
+
}, z.core.$strict>;
|
|
38
|
+
type Entitlement = z.infer<typeof Entitlement>;
|
|
39
|
+
declare const EntitlementsQuery: z.ZodObject<{
|
|
40
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
41
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
42
|
+
search: z.ZodOptional<z.ZodString>;
|
|
43
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
44
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
active: "active";
|
|
46
|
+
expired: "expired";
|
|
47
|
+
revoked: "revoked";
|
|
48
|
+
}>>;
|
|
49
|
+
source: z.ZodOptional<z.ZodString>;
|
|
50
|
+
orgUserId: z.ZodOptional<z.ZodString>;
|
|
51
|
+
contentId: z.ZodOptional<z.ZodString>;
|
|
52
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
course: "course";
|
|
54
|
+
download: "download";
|
|
55
|
+
}>>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
type EntitlementsQuery = z.infer<typeof EntitlementsQuery>;
|
|
58
|
+
declare const EntitlementsPage: z.ZodObject<{
|
|
59
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
60
|
+
orgId: z.ZodString;
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
orgUserId: z.ZodString;
|
|
63
|
+
contentId: z.ZodString;
|
|
64
|
+
status: z.ZodEnum<{
|
|
65
|
+
active: "active";
|
|
66
|
+
revoked: "revoked";
|
|
67
|
+
}>;
|
|
68
|
+
source: z.ZodString;
|
|
69
|
+
grantedAt: z.ZodCoercedDate<unknown>;
|
|
70
|
+
expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
71
|
+
}, z.core.$strict>>;
|
|
72
|
+
total: z.ZodNumber;
|
|
73
|
+
page: z.ZodNumber;
|
|
74
|
+
pageSize: z.ZodNumber;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
type EntitlementsPage = z.infer<typeof EntitlementsPage>;
|
|
77
|
+
declare const GrantEntitlement: z.ZodObject<{
|
|
78
|
+
orgUserId: z.ZodString;
|
|
79
|
+
contentId: z.ZodString;
|
|
80
|
+
expiresAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
type GrantEntitlement = z.infer<typeof GrantEntitlement>;
|
|
83
|
+
/** Revoke/reinstate access by setting the active|revoked status. */
|
|
84
|
+
declare const SetEntitlementStatus: z.ZodObject<{
|
|
85
|
+
status: z.ZodEnum<{
|
|
86
|
+
active: "active";
|
|
87
|
+
revoked: "revoked";
|
|
88
|
+
}>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
type SetEntitlementStatus = z.infer<typeof SetEntitlementStatus>;
|
|
91
|
+
declare const EntitlementIdParam: z.ZodObject<{
|
|
92
|
+
id: z.ZodString;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
type EntitlementIdParam = z.infer<typeof EntitlementIdParam>;
|
|
95
|
+
//#endregion
|
|
96
|
+
export { ContentRef, ContentType, Entitlement, EntitlementIdParam, EntitlementStatus, EntitlementsPage, EntitlementsQuery, GrantEntitlement, SetEntitlementStatus };
|
|
97
|
+
//# sourceMappingURL=entitlements.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ListQuery, paginated } from "./shared.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { entitlementSchema } from "@headless-lms/core/schemas";
|
|
4
|
+
//#region src/http/schemas/entitlements.ts
|
|
5
|
+
const EntitlementStatus = z.enum([
|
|
6
|
+
"active",
|
|
7
|
+
"expired",
|
|
8
|
+
"revoked"
|
|
9
|
+
]);
|
|
10
|
+
const ContentType = z.enum(["course", "download"]);
|
|
11
|
+
/** Reference to the granted content: identity + display name (join-derived).
|
|
12
|
+
* The full content object lives on its own resource. */
|
|
13
|
+
const ContentRef = z.object({
|
|
14
|
+
id: z.string(),
|
|
15
|
+
type: ContentType,
|
|
16
|
+
title: z.string()
|
|
17
|
+
});
|
|
18
|
+
const Entitlement = entitlementSchema;
|
|
19
|
+
const EntitlementsQuery = ListQuery.extend({
|
|
20
|
+
status: EntitlementStatus.optional(),
|
|
21
|
+
source: z.string().optional(),
|
|
22
|
+
/** Scope to a single student (used by the student detail view). */
|
|
23
|
+
orgUserId: z.string().optional(),
|
|
24
|
+
/** Scope to a single piece of content. */
|
|
25
|
+
contentId: z.string().optional(),
|
|
26
|
+
/** Scope to one content type. */
|
|
27
|
+
type: ContentType.optional()
|
|
28
|
+
});
|
|
29
|
+
const EntitlementsPage = paginated(Entitlement);
|
|
30
|
+
const GrantEntitlement = z.object({
|
|
31
|
+
orgUserId: z.string(),
|
|
32
|
+
contentId: z.string(),
|
|
33
|
+
expiresAt: z.coerce.date().nullable()
|
|
34
|
+
});
|
|
35
|
+
/** Revoke/reinstate access by setting the active|revoked status. */
|
|
36
|
+
const SetEntitlementStatus = z.object({ status: z.enum(["active", "revoked"]) });
|
|
37
|
+
const EntitlementIdParam = z.object({ id: z.string() });
|
|
38
|
+
//#endregion
|
|
39
|
+
export { ContentRef, ContentType, Entitlement, EntitlementIdParam, EntitlementStatus, EntitlementsPage, EntitlementsQuery, GrantEntitlement, SetEntitlementStatus };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=entitlements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.js","names":[],"sources":["../../../src/http/schemas/entitlements.ts"],"sourcesContent":["// Entitlements resource schemas. An entitlement is a student's access grant to\n// a piece of content — generic over content types (course today) — its\n// validity + source. Distinct from payment and from completion.\nimport { z } from \"zod\";\nimport { entitlementSchema } from \"@headless-lms/core/schemas\";\nimport { ListQuery, paginated } from \"./shared.js\";\n\nexport const EntitlementStatus = z.enum([\"active\", \"expired\", \"revoked\"]);\nexport type EntitlementStatus = z.infer<typeof EntitlementStatus>;\n\nexport const ContentType = z.enum([\"course\", \"download\"]);\nexport type ContentType = z.infer<typeof ContentType>;\n\n/** Reference to the granted content: identity + display name (join-derived).\n * The full content object lives on its own resource. */\nexport const ContentRef = z.object({\n id: z.string(),\n type: ContentType,\n title: z.string(),\n});\nexport type ContentRef = z.infer<typeof ContentRef>;\n\nexport const Entitlement = entitlementSchema;\nexport type Entitlement = z.infer<typeof Entitlement>;\n\nexport const EntitlementsQuery = ListQuery.extend({\n status: EntitlementStatus.optional(),\n source: z.string().optional(),\n /** Scope to a single student (used by the student detail view). */\n orgUserId: z.string().optional(),\n /** Scope to a single piece of content. */\n contentId: z.string().optional(),\n /** Scope to one content type. */\n type: ContentType.optional(),\n});\nexport type EntitlementsQuery = z.infer<typeof EntitlementsQuery>;\n\nexport const EntitlementsPage = paginated(Entitlement);\nexport type EntitlementsPage = z.infer<typeof EntitlementsPage>;\n\nexport const GrantEntitlement = z.object({\n orgUserId: z.string(),\n contentId: z.string(),\n expiresAt: z.coerce.date().nullable(),\n});\nexport type GrantEntitlement = z.infer<typeof GrantEntitlement>;\n\n/** Revoke/reinstate access by setting the active|revoked status. */\nexport const SetEntitlementStatus = z.object({\n status: z.enum([\"active\", \"revoked\"]),\n});\nexport type SetEntitlementStatus = z.infer<typeof SetEntitlementStatus>;\n\nexport const EntitlementIdParam = z.object({ id: z.string() });\nexport type EntitlementIdParam = z.infer<typeof EntitlementIdParam>;\n"],"mappings":";;;;AAOA,MAAa,oBAAoB,EAAE,KAAK;CAAC;CAAU;CAAW;AAAS,CAAC;AAGxE,MAAa,cAAc,EAAE,KAAK,CAAC,UAAU,UAAU,CAAC;;;AAKxD,MAAa,aAAa,EAAE,OAAO;CACjC,IAAI,EAAE,OAAO;CACb,MAAM;CACN,OAAO,EAAE,OAAO;AAClB,CAAC;AAGD,MAAa,cAAc;AAG3B,MAAa,oBAAoB,UAAU,OAAO;CAChD,QAAQ,kBAAkB,SAAS;CACnC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE5B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE/B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE/B,MAAM,YAAY,SAAS;AAC7B,CAAC;AAGD,MAAa,mBAAmB,UAAU,WAAW;AAGrD,MAAa,mBAAmB,EAAE,OAAO;CACvC,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,OAAO,KAAK,CAAC,CAAC,SAAS;AACtC,CAAC;;AAID,MAAa,uBAAuB,EAAE,OAAO,EAC3C,QAAQ,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC,EACtC,CAAC;AAGD,MAAa,qBAAqB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Activity, ActivityPathParam, CourseIdPathParam, CreateModule, Module, ModuleList, ModulePathParam, ReorderInput, SaveActivity, UpdateModule } from "./activities.js";
|
|
2
|
+
import { Asset, AssetIdParam, AssetKind, AssetStatus, AssetsPage, AssetsQuery, DownloadTicket, RequestDownload, RequestUpload, UploadTicket } from "./assets.js";
|
|
3
|
+
import { Automation, AutomationAction, AutomationActionResult, AutomationIdParam, AutomationRun, AutomationRunStatus, AutomationRunsPage, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableTriggers, CreateAutomationBody, UpdateAutomationBody } from "./automations.js";
|
|
4
|
+
import { Course, CourseIdParam, CourseSettings, CourseStatus, CoursesPage, CoursesQuery, CreateCourse, PatchCourseSettings, UpdateCourse } from "./content.js";
|
|
5
|
+
import { EnrollmentPoint, EnrollmentSeries, EnrollmentSeriesQuery, OverviewStats } from "./dashboard.js";
|
|
6
|
+
import { ActivityComments, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReactions, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, DiscussionActivityParam, EditComment, PatchComment, PostComment, ReactionCounts, ReactionEmoji, ReplyToComment, ReportComment, SetCommentReaction } from "./discussion.js";
|
|
7
|
+
import { AddDownloadAsset, CreateDownload, Download, DownloadAsset, DownloadAssetParams, DownloadIdParam, DownloadStatus, DownloadsPage, DownloadsQuery, RenameDownloadAsset, ReorderDownloadAssets, UpdateDownload } from "./downloads.js";
|
|
8
|
+
import { ContentRef, ContentType, Entitlement, EntitlementIdParam, EntitlementStatus, EntitlementsPage, EntitlementsQuery, GrantEntitlement, SetEntitlementStatus } from "./entitlements.js";
|
|
9
|
+
import { ErrorBody, ListQuery, Matches, OrgRole, OrgUserProfileSchema, UserProfileSchema, paginated } from "./shared.js";
|
|
10
|
+
import { CourseProgress, LearnCourseIdParam, LearnCourses, LearnDownload, LearnDownloads, LearnModules, LearnOrg, LearnViewer, ProgressReportItem, ProgressStatus, ReportProgress } from "./learn.js";
|
|
11
|
+
import { OrgUserStatus, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody } from "./students.js";
|
|
12
|
+
import { CreateOrganization, Organization, UpdateOrganization } from "./organizations.js";
|
|
13
|
+
import { Member, MemberIdParam, MemberStatus, MembersPage, MembersQuery, Role, UpdateMemberRole } from "./members.js";
|
|
14
|
+
import { AcceptInvite, AcceptInviteResult, ActivateInvite, ActivateInviteResult, CreateInvite, GetInviteResult, Invite, InviteRole, InviteTokenParam, RedeemInvite, RedeemInviteResult } from "./invites.js";
|
|
15
|
+
import { ActionInvocationResult, AvailableIntegration, AvailableIntegrationsList, ConfigureRequest, ConnectRequest, Connection, ConnectionActionParams, ConnectionIdParam, ConnectionsList, IntegrationActionInfo, InvokeActionRequest, ReconnectRequest } from "./integrations.js";
|
|
16
|
+
import { PatchSettings, ScopeSettings, SettingsNamespaceParam, SettingsScopeParam, SettingsValue } from "./settings.js";
|
|
17
|
+
export { AcceptInvite, AcceptInviteResult, ActionInvocationResult, ActivateInvite, ActivateInviteResult, Activity, ActivityComments, ActivityPathParam, AddDownloadAsset, Asset, AssetIdParam, AssetKind, AssetStatus, AssetsPage, AssetsQuery, Automation, AutomationAction, AutomationActionResult, AutomationIdParam, AutomationRun, AutomationRunStatus, AutomationRunsPage, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableIntegration, AvailableIntegrationsList, AvailableTriggers, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReactions, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, ConfigureRequest, ConnectRequest, Connection, ConnectionActionParams, ConnectionIdParam, ConnectionsList, ContentRef, ContentType, Course, CourseIdParam, CourseIdPathParam, CourseProgress, CourseSettings, CourseStatus, CoursesPage, CoursesQuery, CreateAutomationBody, CreateCourse, CreateDownload, CreateInvite, CreateModule, CreateOrganization, DiscussionActivityParam, Download, DownloadAsset, DownloadAssetParams, DownloadIdParam, DownloadStatus, DownloadTicket, DownloadsPage, DownloadsQuery, EditComment, EnrollmentPoint, EnrollmentSeries, EnrollmentSeriesQuery, Entitlement, EntitlementIdParam, EntitlementStatus, EntitlementsPage, EntitlementsQuery, ErrorBody, GetInviteResult, GrantEntitlement, IntegrationActionInfo, Invite, InviteRole, InviteTokenParam, InvokeActionRequest, LearnCourseIdParam, LearnCourses, LearnDownload, LearnDownloads, LearnModules, LearnOrg, LearnViewer, ListQuery, Matches, Member, MemberIdParam, MemberStatus, MembersPage, MembersQuery, Module, ModuleList, ModulePathParam, OrgRole, OrgUserProfileSchema, OrgUserStatus, Organization, OverviewStats, PatchComment, PatchCourseSettings, PatchSettings, PostComment, ProgressReportItem, ProgressStatus, ReactionCounts, ReactionEmoji, ReconnectRequest, RedeemInvite, RedeemInviteResult, RenameDownloadAsset, ReorderDownloadAssets, ReorderInput, ReplyToComment, ReportComment, ReportProgress, RequestDownload, RequestUpload, Role, SaveActivity, ScopeSettings, SetCommentReaction, SetEntitlementStatus, SettingsNamespaceParam, SettingsScopeParam, SettingsValue, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateAutomationBody, UpdateCourse, UpdateDownload, UpdateMemberRole, UpdateModule, UpdateOrganization, UpdateStudentBody, UploadTicket, UserProfileSchema, paginated };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ErrorBody, ListQuery, OrgRole, OrgUserProfileSchema, UserProfileSchema, paginated } from "./shared.js";
|
|
2
|
+
import { Course, CourseIdParam, CourseSettings, CourseStatus, CoursesPage, CoursesQuery, CreateCourse, PatchCourseSettings, UpdateCourse } from "./content.js";
|
|
3
|
+
import { AddDownloadAsset, CreateDownload, Download, DownloadAsset, DownloadAssetParams, DownloadIdParam, DownloadStatus, DownloadsPage, DownloadsQuery, RenameDownloadAsset, ReorderDownloadAssets, UpdateDownload } from "./downloads.js";
|
|
4
|
+
import { Activity, ActivityPathParam, CourseIdPathParam, CreateModule, Module, ModuleList, ModulePathParam, ReorderInput, SaveActivity, UpdateModule } from "./activities.js";
|
|
5
|
+
import { CourseProgress, LearnCourseIdParam, LearnCourses, LearnDownload, LearnDownloads, LearnModules, LearnOrg, LearnViewer, ProgressReportItem, ProgressStatus, ReportProgress } from "./learn.js";
|
|
6
|
+
import { OrgUserStatus, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateStudentBody } from "./students.js";
|
|
7
|
+
import { ContentRef, ContentType, Entitlement, EntitlementIdParam, EntitlementStatus, EntitlementsPage, EntitlementsQuery, GrantEntitlement, SetEntitlementStatus } from "./entitlements.js";
|
|
8
|
+
import { Automation, AutomationAction, AutomationActionResult, AutomationIdParam, AutomationRun, AutomationRunStatus, AutomationRunsPage, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableTriggers, CreateAutomationBody, UpdateAutomationBody } from "./automations.js";
|
|
9
|
+
import { CreateOrganization, Organization, UpdateOrganization } from "./organizations.js";
|
|
10
|
+
import { Member, MemberIdParam, MemberStatus, MembersPage, MembersQuery, Role, UpdateMemberRole } from "./members.js";
|
|
11
|
+
import { AcceptInvite, AcceptInviteResult, ActivateInvite, ActivateInviteResult, CreateInvite, GetInviteResult, Invite, InviteRole, InviteTokenParam, RedeemInvite, RedeemInviteResult } from "./invites.js";
|
|
12
|
+
import { EnrollmentPoint, EnrollmentSeries, EnrollmentSeriesQuery, OverviewStats } from "./dashboard.js";
|
|
13
|
+
import { Asset, AssetIdParam, AssetKind, AssetStatus, AssetsPage, AssetsQuery, DownloadTicket, RequestDownload, RequestUpload, UploadTicket } from "./assets.js";
|
|
14
|
+
import { ActionInvocationResult, AvailableIntegration, AvailableIntegrationsList, ConfigureRequest, ConnectRequest, Connection, ConnectionActionParams, ConnectionIdParam, ConnectionsList, IntegrationActionInfo, InvokeActionRequest, ReconnectRequest } from "./integrations.js";
|
|
15
|
+
import { PatchSettings, ScopeSettings, SettingsNamespaceParam, SettingsScopeParam, SettingsValue } from "./settings.js";
|
|
16
|
+
import { ActivityComments, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReactions, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, DiscussionActivityParam, EditComment, PatchComment, PostComment, ReactionCounts, ReactionEmoji, ReplyToComment, ReportComment, SetCommentReaction } from "./discussion.js";
|
|
17
|
+
export { AcceptInvite, AcceptInviteResult, ActionInvocationResult, ActivateInvite, ActivateInviteResult, Activity, ActivityComments, ActivityPathParam, AddDownloadAsset, Asset, AssetIdParam, AssetKind, AssetStatus, AssetsPage, AssetsQuery, Automation, AutomationAction, AutomationActionResult, AutomationIdParam, AutomationRun, AutomationRunStatus, AutomationRunsPage, AutomationRunsQuery, AutomationTrigger, AvailableAction, AvailableIntegration, AvailableIntegrationsList, AvailableTriggers, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReactions, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, ConfigureRequest, ConnectRequest, Connection, ConnectionActionParams, ConnectionIdParam, ConnectionsList, ContentRef, ContentType, Course, CourseIdParam, CourseIdPathParam, CourseProgress, CourseSettings, CourseStatus, CoursesPage, CoursesQuery, CreateAutomationBody, CreateCourse, CreateDownload, CreateInvite, CreateModule, CreateOrganization, DiscussionActivityParam, Download, DownloadAsset, DownloadAssetParams, DownloadIdParam, DownloadStatus, DownloadTicket, DownloadsPage, DownloadsQuery, EditComment, EnrollmentPoint, EnrollmentSeries, EnrollmentSeriesQuery, Entitlement, EntitlementIdParam, EntitlementStatus, EntitlementsPage, EntitlementsQuery, ErrorBody, GetInviteResult, GrantEntitlement, IntegrationActionInfo, Invite, InviteRole, InviteTokenParam, InvokeActionRequest, LearnCourseIdParam, LearnCourses, LearnDownload, LearnDownloads, LearnModules, LearnOrg, LearnViewer, ListQuery, Member, MemberIdParam, MemberStatus, MembersPage, MembersQuery, Module, ModuleList, ModulePathParam, OrgRole, OrgUserProfileSchema, OrgUserStatus, Organization, OverviewStats, PatchComment, PatchCourseSettings, PatchSettings, PostComment, ProgressReportItem, ProgressStatus, ReactionCounts, ReactionEmoji, ReconnectRequest, RedeemInvite, RedeemInviteResult, RenameDownloadAsset, ReorderDownloadAssets, ReorderInput, ReplyToComment, ReportComment, ReportProgress, RequestDownload, RequestUpload, Role, SaveActivity, ScopeSettings, SetCommentReaction, SetEntitlementStatus, SettingsNamespaceParam, SettingsScopeParam, SettingsValue, Student, StudentIdParam, StudentsPage, StudentsQuery, UpdateAutomationBody, UpdateCourse, UpdateDownload, UpdateMemberRole, UpdateModule, UpdateOrganization, UpdateStudentBody, UploadTicket, UserProfileSchema, paginated };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/http/schemas/integrations.d.ts
|
|
3
|
+
/** An action an integration can be invoked with; schemas are JSON Schema. */
|
|
4
|
+
declare const IntegrationActionInfo: z.ZodObject<{
|
|
5
|
+
id: z.ZodString;
|
|
6
|
+
description: z.ZodString;
|
|
7
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
8
|
+
outputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
type IntegrationActionInfo = z.infer<typeof IntegrationActionInfo>;
|
|
11
|
+
/** An integration this deployment supports; configSchema is JSON Schema for its config. */
|
|
12
|
+
declare const AvailableIntegration: z.ZodObject<{
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
15
|
+
secretsSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
16
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
description: z.ZodString;
|
|
19
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
20
|
+
outputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
type AvailableIntegration = z.infer<typeof AvailableIntegration>;
|
|
24
|
+
declare const AvailableIntegrationsList: z.ZodArray<z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
configSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
27
|
+
secretsSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
28
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
description: z.ZodString;
|
|
31
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
32
|
+
outputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
}, z.core.$strip>>;
|
|
35
|
+
type AvailableIntegrationsList = z.infer<typeof AvailableIntegrationsList>;
|
|
36
|
+
/** The connection row minus credentialRef — not even the reference leaks. */
|
|
37
|
+
declare const Connection: z.ZodObject<{
|
|
38
|
+
active: z.ZodBoolean;
|
|
39
|
+
id: z.ZodString;
|
|
40
|
+
orgId: z.ZodString;
|
|
41
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
42
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
43
|
+
config: z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
|
|
44
|
+
integrationId: z.ZodString;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
type Connection = z.infer<typeof Connection>;
|
|
47
|
+
declare const ConnectionsList: z.ZodArray<z.ZodObject<{
|
|
48
|
+
active: z.ZodBoolean;
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
orgId: z.ZodString;
|
|
51
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
52
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
53
|
+
config: z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
|
|
54
|
+
integrationId: z.ZodString;
|
|
55
|
+
}, z.core.$strict>>;
|
|
56
|
+
type ConnectionsList = z.infer<typeof ConnectionsList>;
|
|
57
|
+
declare const ConnectionIdParam: z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
}, z.core.$strip>;
|
|
60
|
+
type ConnectionIdParam = z.infer<typeof ConnectionIdParam>;
|
|
61
|
+
declare const ConnectRequest: z.ZodObject<{
|
|
62
|
+
integrationId: z.ZodString;
|
|
63
|
+
secrets: z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
|
|
64
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
type ConnectRequest = z.infer<typeof ConnectRequest>;
|
|
67
|
+
declare const ReconnectRequest: z.ZodObject<{
|
|
68
|
+
secrets: z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
type ReconnectRequest = z.infer<typeof ReconnectRequest>;
|
|
71
|
+
declare const ConfigureRequest: z.ZodObject<{
|
|
72
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>>;
|
|
73
|
+
active: z.ZodOptional<z.ZodBoolean>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
type ConfigureRequest = z.infer<typeof ConfigureRequest>;
|
|
76
|
+
declare const ConnectionActionParams: z.ZodObject<{
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
actionId: z.ZodString;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
type ConnectionActionParams = z.infer<typeof ConnectionActionParams>;
|
|
81
|
+
/** The action's input, per its declared inputSchema. */
|
|
82
|
+
declare const InvokeActionRequest: z.ZodObject<{
|
|
83
|
+
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
type InvokeActionRequest = z.infer<typeof InvokeActionRequest>;
|
|
86
|
+
/** Whatever the action resolved with, per its declared outputSchema. */
|
|
87
|
+
declare const ActionInvocationResult: z.ZodObject<{
|
|
88
|
+
output: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
type ActionInvocationResult = z.infer<typeof ActionInvocationResult>;
|
|
91
|
+
//#endregion
|
|
92
|
+
export { ActionInvocationResult, AvailableIntegration, AvailableIntegrationsList, ConfigureRequest, ConnectRequest, Connection, ConnectionActionParams, ConnectionIdParam, ConnectionsList, IntegrationActionInfo, InvokeActionRequest, ReconnectRequest };
|
|
93
|
+
//# sourceMappingURL=integrations.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { connectionSchema, jsonRecordSchema } from "@headless-lms/core/schemas";
|
|
3
|
+
//#region src/http/schemas/integrations.ts
|
|
4
|
+
/** An action an integration can be invoked with; schemas are JSON Schema. */
|
|
5
|
+
const IntegrationActionInfo = z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
description: z.string(),
|
|
8
|
+
inputSchema: z.record(z.string(), z.unknown()),
|
|
9
|
+
outputSchema: z.record(z.string(), z.unknown())
|
|
10
|
+
});
|
|
11
|
+
/** An integration this deployment supports; configSchema is JSON Schema for its config. */
|
|
12
|
+
const AvailableIntegration = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
configSchema: z.record(z.string(), z.unknown()),
|
|
15
|
+
/** JSON Schema of the secrets the integration needs (form rendering only). */
|
|
16
|
+
secretsSchema: z.record(z.string(), z.unknown()),
|
|
17
|
+
actions: z.array(IntegrationActionInfo)
|
|
18
|
+
});
|
|
19
|
+
const AvailableIntegrationsList = z.array(AvailableIntegration);
|
|
20
|
+
/** The connection row minus credentialRef — not even the reference leaks. */
|
|
21
|
+
const Connection = connectionSchema.omit({ credentialRef: true });
|
|
22
|
+
const ConnectionsList = z.array(Connection);
|
|
23
|
+
const ConnectionIdParam = z.object({ id: z.string() });
|
|
24
|
+
const ConnectRequest = z.object({
|
|
25
|
+
integrationId: z.string().min(1),
|
|
26
|
+
/** The connection's secrets (API keys, tokens, …). Write-only, never returned;
|
|
27
|
+
* stored as one encrypted JSON document. */
|
|
28
|
+
secrets: jsonRecordSchema,
|
|
29
|
+
config: jsonRecordSchema.optional()
|
|
30
|
+
});
|
|
31
|
+
const ReconnectRequest = z.object({ secrets: jsonRecordSchema });
|
|
32
|
+
const ConfigureRequest = z.object({
|
|
33
|
+
config: jsonRecordSchema.optional(),
|
|
34
|
+
active: z.boolean().optional()
|
|
35
|
+
});
|
|
36
|
+
const ConnectionActionParams = z.object({
|
|
37
|
+
id: z.string(),
|
|
38
|
+
actionId: z.string()
|
|
39
|
+
});
|
|
40
|
+
/** The action's input, per its declared inputSchema. */
|
|
41
|
+
const InvokeActionRequest = z.object({ input: z.record(z.string(), z.unknown()).optional() });
|
|
42
|
+
/** Whatever the action resolved with, per its declared outputSchema. */
|
|
43
|
+
const ActionInvocationResult = z.object({ output: z.record(z.string(), z.unknown()) });
|
|
44
|
+
//#endregion
|
|
45
|
+
export { ActionInvocationResult, AvailableIntegration, AvailableIntegrationsList, ConfigureRequest, ConnectRequest, Connection, ConnectionActionParams, ConnectionIdParam, ConnectionsList, IntegrationActionInfo, InvokeActionRequest, ReconnectRequest };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=integrations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrations.js","names":[],"sources":["../../../src/http/schemas/integrations.ts"],"sourcesContent":["// Integrations resource schemas. A Connection is an org's link to one external\n// service (Stripe, Slack, …). Secrets are WRITE-ONLY: accepted on\n// connect/reconnect, stored encrypted server-side, and never appear in any\n// response — responses carry configuration and state only.\nimport { z } from \"zod\";\nimport { connectionSchema, jsonRecordSchema } from \"@headless-lms/core/schemas\";\n\n/** An action an integration can be invoked with; schemas are JSON Schema. */\nexport const IntegrationActionInfo = z.object({\n id: z.string(),\n description: z.string(),\n inputSchema: z.record(z.string(), z.unknown()),\n outputSchema: z.record(z.string(), z.unknown()),\n});\nexport type IntegrationActionInfo = z.infer<typeof IntegrationActionInfo>;\n\n/** An integration this deployment supports; configSchema is JSON Schema for its config. */\nexport const AvailableIntegration = z.object({\n id: z.string(),\n configSchema: z.record(z.string(), z.unknown()),\n /** JSON Schema of the secrets the integration needs (form rendering only). */\n secretsSchema: z.record(z.string(), z.unknown()),\n actions: z.array(IntegrationActionInfo),\n});\nexport type AvailableIntegration = z.infer<typeof AvailableIntegration>;\n\nexport const AvailableIntegrationsList = z.array(AvailableIntegration);\nexport type AvailableIntegrationsList = z.infer<typeof AvailableIntegrationsList>;\n\n/** The connection row minus credentialRef — not even the reference leaks. */\nexport const Connection = connectionSchema.omit({ credentialRef: true });\nexport type Connection = z.infer<typeof Connection>;\n\nexport const ConnectionsList = z.array(Connection);\nexport type ConnectionsList = z.infer<typeof ConnectionsList>;\n\nexport const ConnectionIdParam = z.object({ id: z.string() });\nexport type ConnectionIdParam = z.infer<typeof ConnectionIdParam>;\n\nexport const ConnectRequest = z.object({\n integrationId: z.string().min(1),\n /** The connection's secrets (API keys, tokens, …). Write-only, never returned;\n * stored as one encrypted JSON document. */\n secrets: jsonRecordSchema,\n config: jsonRecordSchema.optional(),\n});\nexport type ConnectRequest = z.infer<typeof ConnectRequest>;\n\nexport const ReconnectRequest = z.object({\n secrets: jsonRecordSchema,\n});\nexport type ReconnectRequest = z.infer<typeof ReconnectRequest>;\n\nexport const ConfigureRequest = z.object({\n config: jsonRecordSchema.optional(),\n active: z.boolean().optional(),\n});\nexport type ConfigureRequest = z.infer<typeof ConfigureRequest>;\n\nexport const ConnectionActionParams = z.object({ id: z.string(), actionId: z.string() });\nexport type ConnectionActionParams = z.infer<typeof ConnectionActionParams>;\n\n/** The action's input, per its declared inputSchema. */\nexport const InvokeActionRequest = z.object({\n input: z.record(z.string(), z.unknown()).optional(),\n});\nexport type InvokeActionRequest = z.infer<typeof InvokeActionRequest>;\n\n/** Whatever the action resolved with, per its declared outputSchema. */\nexport const ActionInvocationResult = z.object({\n output: z.record(z.string(), z.unknown()),\n});\nexport type ActionInvocationResult = z.infer<typeof ActionInvocationResult>;\n"],"mappings":";;;;AAQA,MAAa,wBAAwB,EAAE,OAAO;CAC5C,IAAI,EAAE,OAAO;CACb,aAAa,EAAE,OAAO;CACtB,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;CAC7C,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;AAChD,CAAC;;AAID,MAAa,uBAAuB,EAAE,OAAO;CAC3C,IAAI,EAAE,OAAO;CACb,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;;CAE9C,eAAe,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;CAC/C,SAAS,EAAE,MAAM,qBAAqB;AACxC,CAAC;AAGD,MAAa,4BAA4B,EAAE,MAAM,oBAAoB;;AAIrE,MAAa,aAAa,iBAAiB,KAAK,EAAE,eAAe,KAAK,CAAC;AAGvE,MAAa,kBAAkB,EAAE,MAAM,UAAU;AAGjD,MAAa,oBAAoB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAG5D,MAAa,iBAAiB,EAAE,OAAO;CACrC,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;;;CAG/B,SAAS;CACT,QAAQ,iBAAiB,SAAS;AACpC,CAAC;AAGD,MAAa,mBAAmB,EAAE,OAAO,EACvC,SAAS,iBACX,CAAC;AAGD,MAAa,mBAAmB,EAAE,OAAO;CACvC,QAAQ,iBAAiB,SAAS;CAClC,QAAQ,EAAE,QAAQ,CAAC,CAAC,SAAS;AAC/B,CAAC;AAGD,MAAa,yBAAyB,EAAE,OAAO;CAAE,IAAI,EAAE,OAAO;CAAG,UAAU,EAAE,OAAO;AAAE,CAAC;;AAIvF,MAAa,sBAAsB,EAAE,OAAO,EAC1C,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,EACpD,CAAC;;AAID,MAAa,yBAAyB,EAAE,OAAO,EAC7C,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,EAC1C,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/http/schemas/invites.d.ts
|
|
3
|
+
/** Roles an invitation can carry. Never owner. */
|
|
4
|
+
declare const InviteRole: z.ZodEnum<{
|
|
5
|
+
admin: "admin";
|
|
6
|
+
instructor: "instructor";
|
|
7
|
+
student: "student";
|
|
8
|
+
}>;
|
|
9
|
+
type InviteRole = z.infer<typeof InviteRole>;
|
|
10
|
+
declare const Invite: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
email: z.ZodString;
|
|
13
|
+
role: z.ZodEnum<{
|
|
14
|
+
admin: "admin";
|
|
15
|
+
instructor: "instructor";
|
|
16
|
+
student: "student";
|
|
17
|
+
}>;
|
|
18
|
+
status: z.ZodString;
|
|
19
|
+
expiresAt: z.ZodNullable<z.ZodDate>;
|
|
20
|
+
createdAt: z.ZodDate;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
type Invite = z.infer<typeof Invite>;
|
|
23
|
+
/** A student is created by this call, not by the acceptance that follows it, so
|
|
24
|
+
* the admin names them here. `sendEmail: false` still creates everything —
|
|
25
|
+
* only delivery is skipped. Both are ignored for staff roles, whose org user
|
|
26
|
+
* is mirrored from the auth provider when they join. */
|
|
27
|
+
declare const CreateInvite: z.ZodObject<{
|
|
28
|
+
email: z.ZodEmail;
|
|
29
|
+
role: z.ZodEnum<{
|
|
30
|
+
admin: "admin";
|
|
31
|
+
instructor: "instructor";
|
|
32
|
+
student: "student";
|
|
33
|
+
}>;
|
|
34
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
35
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
36
|
+
sendEmail: z.ZodDefault<z.ZodBoolean>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
type CreateInvite = z.infer<typeof CreateInvite>;
|
|
39
|
+
declare const ActivateInvite: z.ZodObject<{
|
|
40
|
+
token: z.ZodString;
|
|
41
|
+
}, z.core.$strip>;
|
|
42
|
+
type ActivateInvite = z.infer<typeof ActivateInvite>;
|
|
43
|
+
/** accepted → consumed for the current session; auth-required → sign up/in first.
|
|
44
|
+
* accountExists says which of the two: the invitee's email already has an
|
|
45
|
+
* account (sign in to link it) or it does not (create one). */
|
|
46
|
+
declare const ActivateInviteResult: z.ZodObject<{
|
|
47
|
+
status: z.ZodEnum<{
|
|
48
|
+
accepted: "accepted";
|
|
49
|
+
"auth-required": "auth-required";
|
|
50
|
+
}>;
|
|
51
|
+
email: z.ZodString;
|
|
52
|
+
role: z.ZodEnum<{
|
|
53
|
+
admin: "admin";
|
|
54
|
+
instructor: "instructor";
|
|
55
|
+
student: "student";
|
|
56
|
+
}>;
|
|
57
|
+
accountExists: z.ZodBoolean;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
type ActivateInviteResult = z.infer<typeof ActivateInviteResult>;
|
|
60
|
+
declare const InviteTokenParam: z.ZodObject<{
|
|
61
|
+
token: z.ZodString;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
type InviteTokenParam = z.infer<typeof InviteTokenParam>;
|
|
64
|
+
/** Everything the invite landing page needs to render: who the invitation is
|
|
65
|
+
* for, and the names the admin entered, which prefill sign-up. Whether the
|
|
66
|
+
* address already has a login is not reported — the sign-up form discovers
|
|
67
|
+
* that from a duplicate-signup rejection and switches to sign-in. */
|
|
68
|
+
declare const GetInviteResult: z.ZodObject<{
|
|
69
|
+
email: z.ZodString;
|
|
70
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
71
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
type GetInviteResult = z.infer<typeof GetInviteResult>;
|
|
74
|
+
/** Redeem: mints the session and accepts the invite in one request. `name` is
|
|
75
|
+
* required only when no account exists yet (the sign-up branch). The email is
|
|
76
|
+
* never sent — it is read from the invitation row, so it cannot be steered. */
|
|
77
|
+
declare const RedeemInvite: z.ZodObject<{
|
|
78
|
+
token: z.ZodString;
|
|
79
|
+
password: z.ZodString;
|
|
80
|
+
name: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
type RedeemInvite = z.infer<typeof RedeemInvite>;
|
|
83
|
+
declare const RedeemInviteResult: z.ZodObject<{
|
|
84
|
+
status: z.ZodLiteral<"accepted">;
|
|
85
|
+
}, z.core.$strip>;
|
|
86
|
+
type RedeemInviteResult = z.infer<typeof RedeemInviteResult>;
|
|
87
|
+
declare const AcceptInvite: z.ZodObject<{
|
|
88
|
+
token: z.ZodString;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
type AcceptInvite = z.infer<typeof AcceptInvite>;
|
|
91
|
+
declare const AcceptInviteResult: z.ZodObject<{}, z.core.$strip>;
|
|
92
|
+
type AcceptInviteResult = z.infer<typeof AcceptInviteResult>;
|
|
93
|
+
//#endregion
|
|
94
|
+
export { AcceptInvite, AcceptInviteResult, ActivateInvite, ActivateInviteResult, CreateInvite, GetInviteResult, Invite, InviteRole, InviteTokenParam, RedeemInvite, RedeemInviteResult };
|
|
95
|
+
//# sourceMappingURL=invites.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/http/schemas/invites.ts
|
|
3
|
+
/** Roles an invitation can carry. Never owner. */
|
|
4
|
+
const InviteRole = z.enum([
|
|
5
|
+
"admin",
|
|
6
|
+
"instructor",
|
|
7
|
+
"student"
|
|
8
|
+
]);
|
|
9
|
+
const Invite = z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
email: z.string(),
|
|
12
|
+
role: InviteRole,
|
|
13
|
+
status: z.string(),
|
|
14
|
+
expiresAt: z.date().nullable(),
|
|
15
|
+
createdAt: z.date()
|
|
16
|
+
});
|
|
17
|
+
/** A student is created by this call, not by the acceptance that follows it, so
|
|
18
|
+
* the admin names them here. `sendEmail: false` still creates everything —
|
|
19
|
+
* only delivery is skipped. Both are ignored for staff roles, whose org user
|
|
20
|
+
* is mirrored from the auth provider when they join. */
|
|
21
|
+
const CreateInvite = z.object({
|
|
22
|
+
email: z.email(),
|
|
23
|
+
role: InviteRole,
|
|
24
|
+
firstName: z.string().trim().min(1).optional(),
|
|
25
|
+
lastName: z.string().trim().min(1).optional(),
|
|
26
|
+
sendEmail: z.boolean().default(true)
|
|
27
|
+
});
|
|
28
|
+
const ActivateInvite = z.object({ token: z.string().min(1) });
|
|
29
|
+
/** accepted → consumed for the current session; auth-required → sign up/in first.
|
|
30
|
+
* accountExists says which of the two: the invitee's email already has an
|
|
31
|
+
* account (sign in to link it) or it does not (create one). */
|
|
32
|
+
const ActivateInviteResult = z.object({
|
|
33
|
+
status: z.enum(["accepted", "auth-required"]),
|
|
34
|
+
email: z.string(),
|
|
35
|
+
role: InviteRole,
|
|
36
|
+
accountExists: z.boolean()
|
|
37
|
+
});
|
|
38
|
+
const InviteTokenParam = z.object({ token: z.string().min(1) });
|
|
39
|
+
/** Everything the invite landing page needs to render: who the invitation is
|
|
40
|
+
* for, and the names the admin entered, which prefill sign-up. Whether the
|
|
41
|
+
* address already has a login is not reported — the sign-up form discovers
|
|
42
|
+
* that from a duplicate-signup rejection and switches to sign-in. */
|
|
43
|
+
const GetInviteResult = z.object({
|
|
44
|
+
email: z.string(),
|
|
45
|
+
firstName: z.string().nullable(),
|
|
46
|
+
lastName: z.string().nullable()
|
|
47
|
+
});
|
|
48
|
+
/** Redeem: mints the session and accepts the invite in one request. `name` is
|
|
49
|
+
* required only when no account exists yet (the sign-up branch). The email is
|
|
50
|
+
* never sent — it is read from the invitation row, so it cannot be steered. */
|
|
51
|
+
const RedeemInvite = z.object({
|
|
52
|
+
token: z.string().min(1),
|
|
53
|
+
password: z.string().min(1),
|
|
54
|
+
name: z.string().min(1).optional()
|
|
55
|
+
});
|
|
56
|
+
const RedeemInviteResult = z.object({ status: z.literal("accepted") });
|
|
57
|
+
const AcceptInvite = z.object({ token: z.string().min(1) });
|
|
58
|
+
const AcceptInviteResult = z.object({});
|
|
59
|
+
//#endregion
|
|
60
|
+
export { AcceptInvite, AcceptInviteResult, ActivateInvite, ActivateInviteResult, CreateInvite, GetInviteResult, Invite, InviteRole, InviteTokenParam, RedeemInvite, RedeemInviteResult };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=invites.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invites.js","names":[],"sources":["../../../src/http/schemas/invites.ts"],"sourcesContent":["// Invites resource schemas — domain-owned invites (staff + student).\nimport { z } from \"zod\";\n\n/** Roles an invitation can carry. Never owner. */\nexport const InviteRole = z.enum([\"admin\", \"instructor\", \"student\"]);\nexport type InviteRole = z.infer<typeof InviteRole>;\n\nexport const Invite = z.object({\n id: z.string(),\n email: z.string(),\n role: InviteRole,\n status: z.string(),\n expiresAt: z.date().nullable(),\n createdAt: z.date(),\n});\nexport type Invite = z.infer<typeof Invite>;\n\n/** A student is created by this call, not by the acceptance that follows it, so\n * the admin names them here. `sendEmail: false` still creates everything —\n * only delivery is skipped. Both are ignored for staff roles, whose org user\n * is mirrored from the auth provider when they join. */\nexport const CreateInvite = z.object({\n email: z.email(),\n role: InviteRole,\n firstName: z.string().trim().min(1).optional(),\n lastName: z.string().trim().min(1).optional(),\n sendEmail: z.boolean().default(true),\n});\nexport type CreateInvite = z.infer<typeof CreateInvite>;\n\nexport const ActivateInvite = z.object({ token: z.string().min(1) });\nexport type ActivateInvite = z.infer<typeof ActivateInvite>;\n\n/** accepted → consumed for the current session; auth-required → sign up/in first.\n * accountExists says which of the two: the invitee's email already has an\n * account (sign in to link it) or it does not (create one). */\nexport const ActivateInviteResult = z.object({\n status: z.enum([\"accepted\", \"auth-required\"]),\n email: z.string(),\n role: InviteRole,\n accountExists: z.boolean(),\n});\nexport type ActivateInviteResult = z.infer<typeof ActivateInviteResult>;\n\nexport const InviteTokenParam = z.object({ token: z.string().min(1) });\nexport type InviteTokenParam = z.infer<typeof InviteTokenParam>;\n\n/** Everything the invite landing page needs to render: who the invitation is\n * for, and the names the admin entered, which prefill sign-up. Whether the\n * address already has a login is not reported — the sign-up form discovers\n * that from a duplicate-signup rejection and switches to sign-in. */\nexport const GetInviteResult = z.object({\n email: z.string(),\n firstName: z.string().nullable(),\n lastName: z.string().nullable(),\n});\nexport type GetInviteResult = z.infer<typeof GetInviteResult>;\n\n/** Redeem: mints the session and accepts the invite in one request. `name` is\n * required only when no account exists yet (the sign-up branch). The email is\n * never sent — it is read from the invitation row, so it cannot be steered. */\nexport const RedeemInvite = z.object({\n token: z.string().min(1),\n password: z.string().min(1),\n name: z.string().min(1).optional(),\n});\nexport type RedeemInvite = z.infer<typeof RedeemInvite>;\n\nexport const RedeemInviteResult = z.object({ status: z.literal(\"accepted\") });\nexport type RedeemInviteResult = z.infer<typeof RedeemInviteResult>;\n\nexport const AcceptInvite = z.object({ token: z.string().min(1) });\nexport type AcceptInvite = z.infer<typeof AcceptInvite>;\n\nexport const AcceptInviteResult = z.object({\n\n});\nexport type AcceptInviteResult = z.infer<typeof AcceptInviteResult>;\n"],"mappings":";;;AAIA,MAAa,aAAa,EAAE,KAAK;CAAC;CAAS;CAAc;AAAS,CAAC;AAGnE,MAAa,SAAS,EAAE,OAAO;CAC7B,IAAI,EAAE,OAAO;CACb,OAAO,EAAE,OAAO;CAChB,MAAM;CACN,QAAQ,EAAE,OAAO;CACjB,WAAW,EAAE,KAAK,CAAC,CAAC,SAAS;CAC7B,WAAW,EAAE,KAAK;AACpB,CAAC;;;;;AAOD,MAAa,eAAe,EAAE,OAAO;CACnC,OAAO,EAAE,MAAM;CACf,MAAM;CACN,WAAW,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAC7C,UAAU,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAC5C,WAAW,EAAE,QAAQ,CAAC,CAAC,QAAQ,IAAI;AACrC,CAAC;AAGD,MAAa,iBAAiB,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;;;;AAMnE,MAAa,uBAAuB,EAAE,OAAO;CAC3C,QAAQ,EAAE,KAAK,CAAC,YAAY,eAAe,CAAC;CAC5C,OAAO,EAAE,OAAO;CAChB,MAAM;CACN,eAAe,EAAE,QAAQ;AAC3B,CAAC;AAGD,MAAa,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;;;;;AAOrE,MAAa,kBAAkB,EAAE,OAAO;CACtC,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;AAChC,CAAC;;;;AAMD,MAAa,eAAe,EAAE,OAAO;CACnC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACvB,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAC1B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;AACnC,CAAC;AAGD,MAAa,qBAAqB,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,UAAU,EAAE,CAAC;AAG5E,MAAa,eAAe,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAGjE,MAAa,qBAAqB,EAAE,OAAO,CAE3C,CAAC"}
|