@anantagnanam/lms 0.1.0 → 0.2.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 -21
- package/README.md +23 -2
- package/astro/client.ts +73 -151
- package/astro/components/CourseOverview.astro +25 -3
- package/astro/components/LearnerDashboard.astro +6 -0
- package/astro/components/LearningShell.astro +10 -1
- package/astro/components/LessonAvailabilityNote.astro +26 -0
- package/astro/components/LessonContent.astro +53 -0
- package/astro/components/LessonPlayer.astro +40 -61
- package/astro/components/MediaPlayer.astro +55 -4
- package/astro/media-player.ts +99 -0
- package/astro/pages/author-preview.astro +71 -0
- package/astro/pages/course.astro +10 -0
- package/astro/pages/lesson.astro +3 -0
- package/astro/pages/library.astro +173 -0
- package/astro/pages/paths.astro +73 -0
- package/astro/quiz-drafts.ts +87 -0
- package/astro/quiz-player.ts +362 -0
- package/astro/styles.css +12 -0
- package/dist/admin.d.ts +3 -1
- package/dist/admin.js +585 -116
- package/dist/admin.js.map +1 -1
- package/dist/astro.js +3 -0
- package/dist/astro.js.map +1 -1
- package/dist/{constants-C0kT94tc.js → constants-Cnx7k82Z.js} +25 -3
- package/dist/constants-Cnx7k82Z.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/runtime.d.ts +104 -12
- package/dist/runtime.js +896 -116
- package/dist/runtime.js.map +1 -1
- package/dist/schemas.d.ts +68 -1
- package/dist/schemas.js +34 -2
- package/dist/schemas.js.map +1 -1
- package/dist/server.d.ts +11 -1
- package/dist/server.js +13 -2
- package/dist/server.js.map +1 -1
- package/dist/types.d.ts +107 -4
- package/package.json +1 -1
- package/dist/constants-C0kT94tc.js.map +0 -1
package/dist/astro.js
CHANGED
|
@@ -24,8 +24,11 @@ function lmsAstro(options = {}) {
|
|
|
24
24
|
[`${basePath}/courses/[slug]`, "course.astro"],
|
|
25
25
|
[`${basePath}/courses/[slug]/lessons/[lessonId]`, "lesson.astro"],
|
|
26
26
|
[`${basePath}/my-learning`, "dashboard.astro"],
|
|
27
|
+
[`${basePath}/my-learning/library`, "library.astro"],
|
|
28
|
+
[`${basePath}/paths`, "paths.astro"],
|
|
27
29
|
[`${basePath}/certificates/[certificateId]`, "certificate.astro"],
|
|
28
30
|
[`${basePath}/teach`, "teach.astro"],
|
|
31
|
+
[`${basePath}/teach/courses/[courseId]/lessons/[lessonId]`, "author-preview.astro"],
|
|
29
32
|
[`${basePath}/cohorts/[cohortId]`, "cohort.astro"]
|
|
30
33
|
];
|
|
31
34
|
for (const [pattern, file] of pages) injectRoute({
|
package/dist/astro.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"astro.js","names":[],"sources":["../src/astro.ts"],"sourcesContent":["import type { AstroIntegration } from \"astro\";\nimport { fileURLToPath } from \"node:url\";\nimport type { LmsOptions } from \"./types.js\";\nimport { normalizeLmsOptions } from \"./config.js\";\n\nexport interface LmsAstroOptions extends LmsOptions {\n layout?: string;\n}\n\nexport function lmsAstro(options: LmsAstroOptions = {}): AstroIntegration {\n const { basePath, loginPath } = normalizeLmsOptions(options);\n return {\n name: \"@anantagnanam/lms\",\n hooks: {\n \"astro:config:setup\": ({ config, injectRoute, updateConfig }) => {\n if (config.output !== \"server\") throw new Error(\"The LMS requires Astro output: server.\");\n const layouts = options.layout\n ? fileURLToPath(new URL(options.layout, config.root))\n : fileURLToPath(new URL(\"../astro/layouts/AcademyLayout.astro\", import.meta.url));\n const virtual = {\n \"virtual:anantagnanam-lms/config\": `export const basePath = ${JSON.stringify(basePath)}; export const loginPath = ${JSON.stringify(loginPath)};`,\n \"virtual:anantagnanam-lms/layout\": `export { default } from ${JSON.stringify(layouts.replaceAll(\"\\\\\", \"/\"))};`,\n };\n updateConfig({\n vite: {\n plugins: [\n {\n name: \"anantagnanam-lms-pages\",\n resolveId: (id) => (id in virtual ? `\\0${id}` : undefined),\n load: (id) => virtual[id.replace(/^\\0/, \"\") as keyof typeof virtual],\n },\n ],\n },\n });\n const pages = [\n [basePath, \"index.astro\"],\n [`${basePath}/courses/[slug]`, \"course.astro\"],\n [`${basePath}/courses/[slug]/lessons/[lessonId]`, \"lesson.astro\"],\n [`${basePath}/my-learning`, \"dashboard.astro\"],\n [`${basePath}/certificates/[certificateId]`, \"certificate.astro\"],\n [`${basePath}/teach`, \"teach.astro\"],\n [`${basePath}/cohorts/[cohortId]`, \"cohort.astro\"],\n ];\n for (const [pattern, file] of pages)\n injectRoute({\n pattern: pattern!,\n entrypoint: fileURLToPath(new URL(`../astro/pages/${file}`, import.meta.url)),\n prerender: false,\n });\n },\n \"astro:config:done\": ({ injectTypes }) => {\n injectTypes({\n filename: \"anantagnanam-lms.d.ts\",\n content:\n 'declare module \"virtual:anantagnanam-lms/config\" { export const basePath: string; export const loginPath: string; }\\ndeclare module \"virtual:anantagnanam-lms/layout\" { const Layout: import(\"astro/runtime/server/index.js\").AstroComponentFactory; export default Layout; }',\n });\n },\n },\n };\n}\nexport default lmsAstro;\n"],"mappings":";;;;AASA,SAAgB,SAAS,UAA2B,EAAE,EAAoB;CACxE,MAAM,EAAE,UAAU,cAAc,oBAAoB,QAAQ;AAC5D,QAAO;EACL,MAAM;EACN,OAAO;GACL,uBAAuB,EAAE,QAAQ,aAAa,mBAAmB;AAC/D,QAAI,OAAO,WAAW,SAAU,OAAM,IAAI,MAAM,yCAAyC;IACzF,MAAM,UAAU,QAAQ,SACpB,cAAc,IAAI,IAAI,QAAQ,QAAQ,OAAO,KAAK,CAAC,GACnD,cAAc,IAAI,IAAI,wCAAwC,OAAO,KAAK,IAAI,CAAC;IACnF,MAAM,UAAU;KACd,mCAAmC,2BAA2B,KAAK,UAAU,SAAS,CAAC,6BAA6B,KAAK,UAAU,UAAU,CAAC;KAC9I,mCAAmC,2BAA2B,KAAK,UAAU,QAAQ,WAAW,MAAM,IAAI,CAAC,CAAC;KAC7G;AACD,iBAAa,EACX,MAAM,EACJ,SAAS,CACP;KACE,MAAM;KACN,YAAY,OAAQ,MAAM,UAAU,KAAK,OAAO;KAChD,OAAO,OAAO,QAAQ,GAAG,QAAQ,OAAO,GAAG;KAC5C,CACF,EACF,EACF,CAAC;IACF,MAAM,QAAQ;KACZ,CAAC,UAAU,cAAc;KACzB,CAAC,GAAG,SAAS,kBAAkB,eAAe;KAC9C,CAAC,GAAG,SAAS,qCAAqC,eAAe;KACjE,CAAC,GAAG,SAAS,eAAe,kBAAkB;KAC9C,CAAC,GAAG,SAAS,gCAAgC,oBAAoB;KACjE,CAAC,GAAG,SAAS,SAAS,cAAc;KACpC,CAAC,GAAG,SAAS,sBAAsB,eAAe;KACnD;AACD,SAAK,MAAM,CAAC,SAAS,SAAS,MAC5B,aAAY;KACD;KACT,YAAY,cAAc,IAAI,IAAI,kBAAkB,QAAQ,OAAO,KAAK,IAAI,CAAC;KAC7E,WAAW;KACZ,CAAC;;GAEN,sBAAsB,EAAE,kBAAkB;AACxC,gBAAY;KACV,UAAU;KACV,SACE;KACH,CAAC;;GAEL;EACF"}
|
|
1
|
+
{"version":3,"file":"astro.js","names":[],"sources":["../src/astro.ts"],"sourcesContent":["import type { AstroIntegration } from \"astro\";\nimport { fileURLToPath } from \"node:url\";\nimport type { LmsOptions } from \"./types.js\";\nimport { normalizeLmsOptions } from \"./config.js\";\n\nexport interface LmsAstroOptions extends LmsOptions {\n layout?: string;\n}\n\nexport function lmsAstro(options: LmsAstroOptions = {}): AstroIntegration {\n const { basePath, loginPath } = normalizeLmsOptions(options);\n return {\n name: \"@anantagnanam/lms\",\n hooks: {\n \"astro:config:setup\": ({ config, injectRoute, updateConfig }) => {\n if (config.output !== \"server\") throw new Error(\"The LMS requires Astro output: server.\");\n const layouts = options.layout\n ? fileURLToPath(new URL(options.layout, config.root))\n : fileURLToPath(new URL(\"../astro/layouts/AcademyLayout.astro\", import.meta.url));\n const virtual = {\n \"virtual:anantagnanam-lms/config\": `export const basePath = ${JSON.stringify(basePath)}; export const loginPath = ${JSON.stringify(loginPath)};`,\n \"virtual:anantagnanam-lms/layout\": `export { default } from ${JSON.stringify(layouts.replaceAll(\"\\\\\", \"/\"))};`,\n };\n updateConfig({\n vite: {\n plugins: [\n {\n name: \"anantagnanam-lms-pages\",\n resolveId: (id) => (id in virtual ? `\\0${id}` : undefined),\n load: (id) => virtual[id.replace(/^\\0/, \"\") as keyof typeof virtual],\n },\n ],\n },\n });\n const pages = [\n [basePath, \"index.astro\"],\n [`${basePath}/courses/[slug]`, \"course.astro\"],\n [`${basePath}/courses/[slug]/lessons/[lessonId]`, \"lesson.astro\"],\n [`${basePath}/my-learning`, \"dashboard.astro\"],\n [`${basePath}/my-learning/library`, \"library.astro\"],\n [`${basePath}/paths`, \"paths.astro\"],\n [`${basePath}/certificates/[certificateId]`, \"certificate.astro\"],\n [`${basePath}/teach`, \"teach.astro\"],\n [`${basePath}/teach/courses/[courseId]/lessons/[lessonId]`, \"author-preview.astro\"],\n [`${basePath}/cohorts/[cohortId]`, \"cohort.astro\"],\n ];\n for (const [pattern, file] of pages)\n injectRoute({\n pattern: pattern!,\n entrypoint: fileURLToPath(new URL(`../astro/pages/${file}`, import.meta.url)),\n prerender: false,\n });\n },\n \"astro:config:done\": ({ injectTypes }) => {\n injectTypes({\n filename: \"anantagnanam-lms.d.ts\",\n content:\n 'declare module \"virtual:anantagnanam-lms/config\" { export const basePath: string; export const loginPath: string; }\\ndeclare module \"virtual:anantagnanam-lms/layout\" { const Layout: import(\"astro/runtime/server/index.js\").AstroComponentFactory; export default Layout; }',\n });\n },\n },\n };\n}\nexport default lmsAstro;\n"],"mappings":";;;;AASA,SAAgB,SAAS,UAA2B,EAAE,EAAoB;CACxE,MAAM,EAAE,UAAU,cAAc,oBAAoB,QAAQ;AAC5D,QAAO;EACL,MAAM;EACN,OAAO;GACL,uBAAuB,EAAE,QAAQ,aAAa,mBAAmB;AAC/D,QAAI,OAAO,WAAW,SAAU,OAAM,IAAI,MAAM,yCAAyC;IACzF,MAAM,UAAU,QAAQ,SACpB,cAAc,IAAI,IAA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0";
|
|
4
4
|
const API_BASE = `/_emdash/api/plugins/${PLUGIN_ID}`;
|
|
5
5
|
const MAX_DOCUMENT_BYTES = 95e4;
|
|
6
6
|
const storage = {
|
|
@@ -13,10 +13,26 @@ const storage = {
|
|
|
13
13
|
"level",
|
|
14
14
|
"language",
|
|
15
15
|
"updatedAt",
|
|
16
|
-
"createdBy"
|
|
16
|
+
"createdBy",
|
|
17
|
+
"createdAt"
|
|
17
18
|
],
|
|
18
19
|
uniqueIndexes: ["slug"]
|
|
19
20
|
},
|
|
21
|
+
course_revisions: { indexes: ["courseId", "createdAt"] },
|
|
22
|
+
course_editions: { indexes: ["courseId", "createdAt"] },
|
|
23
|
+
migrations: { indexes: ["phase"] },
|
|
24
|
+
preferences: { indexes: [] },
|
|
25
|
+
saved_courses: { indexes: [
|
|
26
|
+
"userId",
|
|
27
|
+
"saved",
|
|
28
|
+
"updatedAt"
|
|
29
|
+
] },
|
|
30
|
+
learning_paths: { indexes: ["status", "updatedAt"] },
|
|
31
|
+
path_enrollments: { indexes: [
|
|
32
|
+
"userId",
|
|
33
|
+
"pathId",
|
|
34
|
+
"joinedAt"
|
|
35
|
+
] },
|
|
20
36
|
enrollments: { indexes: [
|
|
21
37
|
"userId",
|
|
22
38
|
"courseId",
|
|
@@ -108,6 +124,12 @@ const adminPages = [
|
|
|
108
124
|
icon: "users-three",
|
|
109
125
|
group: "Learning"
|
|
110
126
|
},
|
|
127
|
+
{
|
|
128
|
+
path: "/paths",
|
|
129
|
+
label: "Learning paths",
|
|
130
|
+
icon: "books",
|
|
131
|
+
group: "Learning"
|
|
132
|
+
},
|
|
111
133
|
{
|
|
112
134
|
path: "/reports",
|
|
113
135
|
label: "Reports",
|
|
@@ -136,4 +158,4 @@ const adminPages = [
|
|
|
136
158
|
|
|
137
159
|
//#endregion
|
|
138
160
|
export { adminPages as a, PLUGIN_VERSION as i, MAX_DOCUMENT_BYTES as n, storage as o, PLUGIN_ID as r, API_BASE as t };
|
|
139
|
-
//# sourceMappingURL=constants-
|
|
161
|
+
//# sourceMappingURL=constants-Cnx7k82Z.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants-Cnx7k82Z.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const PLUGIN_ID = \"anantagnanam-lms\";\nexport const PLUGIN_VERSION = \"0.2.0\";\nexport const API_BASE = `/_emdash/api/plugins/${PLUGIN_ID}`;\nexport const MAX_DOCUMENT_BYTES = 950_000;\n\nimport type { PluginStorageConfig } from \"emdash\";\n\nexport const storage = {\n courses: {\n indexes: [\n \"status\",\n \"title\",\n \"searchTitle\",\n \"category\",\n \"level\",\n \"language\",\n \"updatedAt\",\n \"createdBy\",\n \"createdAt\",\n ],\n uniqueIndexes: [\"slug\"],\n },\n course_revisions: { indexes: [\"courseId\", \"createdAt\"] },\n course_editions: { indexes: [\"courseId\", \"createdAt\"] },\n migrations: { indexes: [\"phase\"] },\n preferences: { indexes: [] },\n saved_courses: { indexes: [\"userId\", \"saved\", \"updatedAt\"] },\n learning_paths: { indexes: [\"status\", \"updatedAt\"] },\n path_enrollments: { indexes: [\"userId\", \"pathId\", \"joinedAt\"] },\n enrollments: {\n indexes: [\n \"userId\",\n \"courseId\",\n \"status\",\n \"accessStatus\",\n \"accessSource\",\n \"enrolledAt\",\n \"completedAt\",\n \"lastActivityAt\",\n \"cohortId\",\n [\"courseId\", \"status\"],\n [\"userId\", \"status\"],\n ],\n },\n certificates: { indexes: [\"userId\", \"courseId\"] },\n discussions: {\n indexes: [\n \"courseId\",\n \"lessonId\",\n \"authorId\",\n \"status\",\n \"createdAt\",\n \"parentId\",\n [\"courseId\", \"createdAt\"],\n ],\n },\n reviews: { indexes: [\"courseId\", \"userId\", \"status\", \"createdAt\"] },\n cohorts: { indexes: [\"title\", \"createdAt\", \"createdBy\"] },\n cohort_enrollments: { indexes: [\"cohortId\", \"userId\", \"status\", \"requestedAt\"] },\n notifications: { indexes: [\"userId\", \"read\", \"createdAt\", \"emailStatus\", \"claimedAt\"] },\n audit: { indexes: [\"actorId\", \"action\", \"resourceId\", \"createdAt\"] },\n} satisfies PluginStorageConfig;\n\nexport const adminPages = [\n { path: \"/\", label: \"Learning overview\", icon: \"graduation-cap\", group: \"Learning\" },\n { path: \"/courses\", label: \"Courses\", icon: \"books\", group: \"Learning\" },\n { path: \"/learners\", label: \"Enrollments\", icon: \"users\", group: \"Learning\" },\n { path: \"/assignments\", label: \"Assignments\", icon: \"exam\", group: \"Learning\" },\n { path: \"/community\", label: \"Community\", icon: \"chats\", group: \"Learning\" },\n { path: \"/cohorts\", label: \"Cohorts\", icon: \"users-three\", group: \"Learning\" },\n { path: \"/paths\", label: \"Learning paths\", icon: \"books\", group: \"Learning\" },\n { path: \"/reports\", label: \"Reports\", icon: \"chart-bar\", group: \"Learning\" },\n { path: \"/notifications\", label: \"Notifications\", icon: \"bell\", group: \"Learning\" },\n { path: \"/audit\", label: \"Audit history\", icon: \"clock-counter-clockwise\", group: \"Learning\" },\n { path: \"/settings\", label: \"LMS settings\", icon: \"gear\", group: \"Learning\" },\n];\n"],"mappings":";AAAA,MAAa,YAAY;AACzB,MAAa,iBAAiB;AAC9B,MAAa,WAAW,wBAAwB;AAChD,MAAa,qBAAqB;AAIlC,MAAa,UAAU;CACrB,SAAS;EACP,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACD;EACD,eAAe,CAAC,OAAO;EACxB;CACD,kBAAkB,EAAE,SAAS,CAAC,YAAY,YAAY,EAAE;CACxD,iBAAiB,EAAE,SAAS,CAAC,YAAY,YAAY,EAAE;CACvD,YAAY,EAAE,SAAS,CAAC,QAAQ,EAAE;CAClC,aAAa,EAAE,SAAS,EAAE,EAAE;CAC5B,eAAe,EAAE,SAAS;EAAC;EAAU;EAAS;EAAY,EAAE;CAC5D,gBAAgB,EAAE,SAAS,CAAC,UAAU,YAAY,EAAE;CACpD,kBAAkB,EAAE,SAAS;EAAC;EAAU;EAAU;EAAW,EAAE;CAC/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EAAgB,MAAM;EAAQ,OAAO;EAAY;CAC9E"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { PluginDescriptor } from "emdash";
|
|
|
3
3
|
|
|
4
4
|
//#region src/constants.d.ts
|
|
5
5
|
declare const PLUGIN_ID = "anantagnanam-lms";
|
|
6
|
-
declare const PLUGIN_VERSION = "0.
|
|
6
|
+
declare const PLUGIN_VERSION = "0.2.0";
|
|
7
7
|
declare const API_BASE = "/_emdash/api/plugins/anantagnanam-lms";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/index.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as adminPages, i as PLUGIN_VERSION, r as PLUGIN_ID, t as API_BASE } from "./constants-
|
|
1
|
+
import { a as adminPages, i as PLUGIN_VERSION, r as PLUGIN_ID, t as API_BASE } from "./constants-Cnx7k82Z.js";
|
|
2
2
|
import { t as normalizeLmsOptions } from "./config-BX3beTpM.js";
|
|
3
3
|
|
|
4
4
|
//#region src/index.ts
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessGrant, Acquisition, Actor, AuditRecord, Certificate, CertificateIndex, Cohort, CohortMembership, Course, CourseCard, CourseData, CourseDetail, CurriculumModule, Discussion, Enrollment, Lesson, LessonProgress, LmsOptions, LmsSettings, Notification, Page, ProgressSummary, PublicEnrollment, PublicLesson, PublicQuizAttempt, Review } from "./types.js";
|
|
1
|
+
import { AccessGrant, Acquisition, Actor, AuditRecord, Certificate, CertificateIndex, Cohort, CohortMembership, Course, CourseCard, CourseData, CourseDetail, CourseEdition, CourseRevision, CurriculumModule, Discussion, Enrollment, LearnerPreferences, LearningPath, Lesson, LessonProgress, LmsOptions, LmsSettings, MigrationState, Notification, Page, PathEnrollment, ProgressSummary, PublicEnrollment, PublicLesson, PublicQuizAttempt, Review, RevisionSummary, SavedCourse, Versioned } from "./types.js";
|
|
2
2
|
import * as emdash from "emdash";
|
|
3
3
|
import { PluginContext, StorageCollection } from "emdash";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -6,6 +6,13 @@ import { z } from "zod";
|
|
|
6
6
|
//#region src/store.d.ts
|
|
7
7
|
interface LmsCollections {
|
|
8
8
|
courses: StorageCollection<Course>;
|
|
9
|
+
course_revisions: StorageCollection<CourseRevision>;
|
|
10
|
+
course_editions: StorageCollection<CourseEdition>;
|
|
11
|
+
migrations: StorageCollection<MigrationState>;
|
|
12
|
+
preferences: StorageCollection<LearnerPreferences>;
|
|
13
|
+
saved_courses: StorageCollection<SavedCourse>;
|
|
14
|
+
learning_paths: StorageCollection<LearningPath>;
|
|
15
|
+
path_enrollments: StorageCollection<PathEnrollment>;
|
|
9
16
|
enrollments: StorageCollection<Enrollment>;
|
|
10
17
|
certificates: StorageCollection<CertificateIndex>;
|
|
11
18
|
discussions: StorageCollection<Discussion>;
|
|
@@ -16,6 +23,28 @@ interface LmsCollections {
|
|
|
16
23
|
audit: StorageCollection<AuditRecord>;
|
|
17
24
|
}
|
|
18
25
|
//#endregion
|
|
26
|
+
//#region src/editions.d.ts
|
|
27
|
+
/** Child snapshots are immutable. Only the root CAS makes a revision visible. */
|
|
28
|
+
declare class CourseEditions {
|
|
29
|
+
readonly stores: LmsCollections;
|
|
30
|
+
readonly time: () => string;
|
|
31
|
+
readonly resolveContent: (lesson: Lesson) => Promise<Lesson>;
|
|
32
|
+
constructor(stores: LmsCollections, time: () => string, resolveContent: (lesson: Lesson) => Promise<Lesson>);
|
|
33
|
+
snapshot(courseId: string, data: CourseData): Promise<string>;
|
|
34
|
+
revision(course: Course, data: CourseData, actorId: string, kind: CourseRevision["kind"], extra?: Partial<Pick<CourseRevision, "editionId" | "restoredFrom">>): Promise<CourseRevision>;
|
|
35
|
+
commit(current: Versioned<Course> | null, course: Course): Promise<Versioned<Course>>;
|
|
36
|
+
ensure(id: string, expectedRevision?: string): Promise<Versioned<Course>>;
|
|
37
|
+
draft(course: Course): Promise<Course>;
|
|
38
|
+
learning(course: Course, enrollment: Enrollment | null): Promise<Course>;
|
|
39
|
+
history(course: Course, cursor?: string): Promise<{
|
|
40
|
+
items: RevisionSummary[];
|
|
41
|
+
cursor?: string;
|
|
42
|
+
hasMore: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
migrationStatus(): Promise<MigrationState>;
|
|
45
|
+
migrateBatch(limit: number): Promise<MigrationState>;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
19
48
|
//#region src/curriculum.d.ts
|
|
20
49
|
declare function findLesson(course: Course, lessonId: string): Lesson;
|
|
21
50
|
//#endregion
|
|
@@ -24,6 +53,7 @@ declare class LmsService {
|
|
|
24
53
|
readonly ctx: PluginContext;
|
|
25
54
|
readonly now: () => Date;
|
|
26
55
|
readonly stores: LmsCollections;
|
|
56
|
+
readonly editions: CourseEditions;
|
|
27
57
|
constructor(ctx: PluginContext, now?: () => Date);
|
|
28
58
|
time(): string;
|
|
29
59
|
settings(): Promise<LmsSettings>;
|
|
@@ -32,6 +62,10 @@ declare class LmsService {
|
|
|
32
62
|
course(id: string): Promise<Course>;
|
|
33
63
|
accessEnrollment(enrollment: Enrollment | null): Promise<Enrollment | null>;
|
|
34
64
|
enrollmentView(enrollment: Enrollment): Promise<PublicEnrollment>;
|
|
65
|
+
learningState(course: Course, enrollment: Enrollment | null): Promise<{
|
|
66
|
+
enrollment: PublicEnrollment | null;
|
|
67
|
+
progress: ProgressSummary;
|
|
68
|
+
}>;
|
|
35
69
|
lessonAccess(course: Course, lessonId: string, enrollment: Enrollment | null): Promise<{
|
|
36
70
|
id: string;
|
|
37
71
|
title: string;
|
|
@@ -45,6 +79,12 @@ declare class LmsService {
|
|
|
45
79
|
field: string;
|
|
46
80
|
} | null;
|
|
47
81
|
mediaUrl: string | null;
|
|
82
|
+
transcript: string;
|
|
83
|
+
captions: {
|
|
84
|
+
src: string;
|
|
85
|
+
language: string;
|
|
86
|
+
label: string;
|
|
87
|
+
}[];
|
|
48
88
|
liveStartsAt: string | null;
|
|
49
89
|
durationMinutes: number;
|
|
50
90
|
minStudySeconds: number;
|
|
@@ -89,6 +129,25 @@ declare class LmsService {
|
|
|
89
129
|
course: Course;
|
|
90
130
|
revision: string;
|
|
91
131
|
}>;
|
|
132
|
+
publishCourse(actor: Actor | undefined, id: string, expectedRevision: string): Promise<{
|
|
133
|
+
course: Course;
|
|
134
|
+
revision: string;
|
|
135
|
+
}>;
|
|
136
|
+
courseHistory(actor: Actor | undefined, id: string, cursor?: string): Promise<{
|
|
137
|
+
items: RevisionSummary[];
|
|
138
|
+
cursor?: string;
|
|
139
|
+
hasMore: boolean;
|
|
140
|
+
}>;
|
|
141
|
+
restoreCourse(actor: Actor | undefined, id: string, expectedRevision: string, revisionId: string): Promise<{
|
|
142
|
+
course: Course;
|
|
143
|
+
revision: string;
|
|
144
|
+
}>;
|
|
145
|
+
archiveCourse(actor: Actor | undefined, id: string, expectedRevision: string): Promise<{
|
|
146
|
+
course: Course;
|
|
147
|
+
revision: string;
|
|
148
|
+
}>;
|
|
149
|
+
migrationStatus(actor: Actor | undefined): Promise<MigrationState>;
|
|
150
|
+
migrateBatch(actor: Actor | undefined, limit: number): Promise<MigrationState>;
|
|
92
151
|
assertPrerequisiteGraph(courseId: string, prerequisites: string[]): Promise<void>;
|
|
93
152
|
editableCourse(actor: Actor | undefined, id: string): Promise<{
|
|
94
153
|
course: Course;
|
|
@@ -163,6 +222,10 @@ declare class LmsService {
|
|
|
163
222
|
lesson: PublicLesson;
|
|
164
223
|
}>;
|
|
165
224
|
resolveContent(lesson: ReturnType<typeof findLesson>): Promise<ReturnType<typeof findLesson>>;
|
|
225
|
+
authorLessonPreview(actor: Actor | undefined, courseId: string, lessonId: string): Promise<{
|
|
226
|
+
course: CourseDetail;
|
|
227
|
+
lesson: PublicLesson;
|
|
228
|
+
}>;
|
|
166
229
|
assertPrerequisites(course: Course, actorId: string): Promise<void>;
|
|
167
230
|
newEnrollment(course: Course, actor: Actor, status: Enrollment["status"]): Enrollment;
|
|
168
231
|
enroll(actor: Actor | undefined, courseId: string, options?: {
|
|
@@ -170,6 +233,8 @@ declare class LmsService {
|
|
|
170
233
|
}): Promise<PublicEnrollment>;
|
|
171
234
|
adminEnrollment(actor: Actor | undefined, input: unknown): Promise<PublicEnrollment>;
|
|
172
235
|
learnerCourse(actor: Actor | undefined, courseId: string): Promise<{
|
|
236
|
+
enrollment: PublicEnrollment | null;
|
|
237
|
+
progress: ProgressSummary;
|
|
173
238
|
course: {
|
|
174
239
|
prerequisites: {
|
|
175
240
|
id: string;
|
|
@@ -199,10 +264,10 @@ declare class LmsService {
|
|
|
199
264
|
lessonCount: number;
|
|
200
265
|
durationMinutes: number;
|
|
201
266
|
};
|
|
202
|
-
enrollment: PublicEnrollment | null;
|
|
203
|
-
progress: ProgressSummary;
|
|
204
267
|
}>;
|
|
205
268
|
learnerCourseBySlug(actor: Actor | undefined, slug: string): Promise<{
|
|
269
|
+
enrollment: PublicEnrollment | null;
|
|
270
|
+
progress: ProgressSummary;
|
|
206
271
|
course: {
|
|
207
272
|
prerequisites: {
|
|
208
273
|
id: string;
|
|
@@ -232,42 +297,41 @@ declare class LmsService {
|
|
|
232
297
|
lessonCount: number;
|
|
233
298
|
durationMinutes: number;
|
|
234
299
|
};
|
|
235
|
-
enrollment: PublicEnrollment | null;
|
|
236
|
-
progress: ProgressSummary;
|
|
237
300
|
}>;
|
|
238
301
|
dashboard(actor: Actor | undefined, options?: {
|
|
239
302
|
cursor?: string;
|
|
240
303
|
limit?: number;
|
|
241
304
|
}): Promise<{
|
|
242
305
|
items: {
|
|
243
|
-
|
|
244
|
-
enrollment: PublicEnrollment;
|
|
306
|
+
enrollment: PublicEnrollment | null;
|
|
245
307
|
progress: ProgressSummary;
|
|
308
|
+
course: CourseCard;
|
|
246
309
|
}[];
|
|
247
310
|
cursor?: string;
|
|
248
311
|
hasMore: boolean;
|
|
249
312
|
}>;
|
|
250
313
|
learnerLesson(actor: Actor | undefined, courseId: string, lessonId: string): Promise<{
|
|
314
|
+
enrollment: PublicEnrollment | null;
|
|
315
|
+
progress: ProgressSummary;
|
|
251
316
|
course: CourseDetail;
|
|
252
317
|
lesson: PublicLesson;
|
|
253
|
-
enrollment: PublicEnrollment;
|
|
254
|
-
progress: ProgressSummary;
|
|
255
318
|
}>;
|
|
256
319
|
startLesson(actor: Actor | undefined, courseId: string, lessonId: string): Promise<PublicEnrollment>;
|
|
257
320
|
completeLesson(actor: Actor | undefined, courseId: string, lessonId: string): Promise<{
|
|
258
|
-
enrollment: PublicEnrollment;
|
|
321
|
+
enrollment: PublicEnrollment | null;
|
|
259
322
|
progress: ProgressSummary;
|
|
260
323
|
}>;
|
|
261
324
|
finish(course: Course, enrollment: Enrollment, settings: LmsSettings): void;
|
|
262
325
|
projectCompletion(enrollment: Enrollment): Promise<void>;
|
|
263
326
|
startQuiz(actor: Actor | undefined, courseId: string, lessonId: string): Promise<PublicQuizAttempt>;
|
|
264
327
|
submitQuiz(actor: Actor | undefined, input: unknown): Promise<{
|
|
265
|
-
|
|
266
|
-
enrollment: PublicEnrollment;
|
|
328
|
+
enrollment: PublicEnrollment | null;
|
|
267
329
|
progress: ProgressSummary;
|
|
330
|
+
attempt: PublicQuizAttempt;
|
|
268
331
|
}>;
|
|
269
332
|
saveQuizDraft(actor: Actor | undefined, input: unknown): Promise<{
|
|
270
333
|
saved: boolean;
|
|
334
|
+
draftRevision: number;
|
|
271
335
|
}>;
|
|
272
336
|
submitAssignment(actor: Actor | undefined, input: unknown): Promise<PublicEnrollment>;
|
|
273
337
|
gradeAssignment(actor: Actor | undefined, input: unknown): Promise<PublicEnrollment>;
|
|
@@ -407,6 +471,7 @@ declare class LmsService {
|
|
|
407
471
|
enrolledAt: string;
|
|
408
472
|
completedAt: string | null;
|
|
409
473
|
lastActivityAt: string;
|
|
474
|
+
courseEditionId?: string | undefined;
|
|
410
475
|
learnerName: string;
|
|
411
476
|
grants: Record<string, AccessGrant>;
|
|
412
477
|
cohortIds: string[];
|
|
@@ -581,6 +646,12 @@ declare class LmsService {
|
|
|
581
646
|
field: string;
|
|
582
647
|
} | null;
|
|
583
648
|
mediaUrl: string | null;
|
|
649
|
+
transcript: string;
|
|
650
|
+
captions: {
|
|
651
|
+
src: string;
|
|
652
|
+
language: string;
|
|
653
|
+
label: string;
|
|
654
|
+
}[];
|
|
584
655
|
liveStartsAt: string | null;
|
|
585
656
|
durationMinutes: number;
|
|
586
657
|
minStudySeconds: number;
|
|
@@ -651,6 +722,27 @@ declare function createPlugin(_options?: LmsOptions): emdash.ResolvedPlugin<{
|
|
|
651
722
|
indexes: string[];
|
|
652
723
|
uniqueIndexes: string[];
|
|
653
724
|
};
|
|
725
|
+
course_revisions: {
|
|
726
|
+
indexes: string[];
|
|
727
|
+
};
|
|
728
|
+
course_editions: {
|
|
729
|
+
indexes: string[];
|
|
730
|
+
};
|
|
731
|
+
migrations: {
|
|
732
|
+
indexes: string[];
|
|
733
|
+
};
|
|
734
|
+
preferences: {
|
|
735
|
+
indexes: never[];
|
|
736
|
+
};
|
|
737
|
+
saved_courses: {
|
|
738
|
+
indexes: string[];
|
|
739
|
+
};
|
|
740
|
+
learning_paths: {
|
|
741
|
+
indexes: string[];
|
|
742
|
+
};
|
|
743
|
+
path_enrollments: {
|
|
744
|
+
indexes: string[];
|
|
745
|
+
};
|
|
654
746
|
enrollments: {
|
|
655
747
|
indexes: (string | string[])[];
|
|
656
748
|
};
|