@lessonkit/lxpack 1.6.0 → 1.7.1
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/README.md +1 -1
- package/dist/bridge.cjs +4 -0
- package/dist/bridge.js +4 -0
- package/dist/index.cjs +426 -129
- package/dist/index.d.cts +51 -2
- package/dist/index.d.ts +51 -2
- package/dist/index.js +417 -121
- package/lessonkit-manifest.v1.json +69 -2
- package/package.json +10 -10
package/dist/index.d.cts
CHANGED
|
@@ -53,8 +53,31 @@ type FindMultipleHotspotsAssessmentDescriptor = {
|
|
|
53
53
|
correctTargetIds: string[];
|
|
54
54
|
passingScore?: number;
|
|
55
55
|
};
|
|
56
|
+
type SortParagraphsAssessmentDescriptor = {
|
|
57
|
+
kind: "sortParagraphs";
|
|
58
|
+
checkId: CheckId;
|
|
59
|
+
question: string;
|
|
60
|
+
paragraphs: string[];
|
|
61
|
+
correctOrder: number[];
|
|
62
|
+
passingScore?: number;
|
|
63
|
+
};
|
|
64
|
+
type GuessTheAnswerAssessmentDescriptor = {
|
|
65
|
+
kind: "guessTheAnswer";
|
|
66
|
+
checkId: CheckId;
|
|
67
|
+
question: string;
|
|
68
|
+
answer: string;
|
|
69
|
+
passingScore?: number;
|
|
70
|
+
};
|
|
71
|
+
type MultimediaChoiceAssessmentDescriptor = {
|
|
72
|
+
kind: "multimediaChoice";
|
|
73
|
+
checkId: CheckId;
|
|
74
|
+
question: string;
|
|
75
|
+
choices: string[];
|
|
76
|
+
answer: string;
|
|
77
|
+
passingScore?: number;
|
|
78
|
+
};
|
|
56
79
|
/** Discriminated assessment entries in lessonkit.json (defaults to MCQ when kind omitted). */
|
|
57
|
-
type AssessmentDescriptor = McqAssessmentDescriptor | TrueFalseAssessmentDescriptor | FillInBlanksAssessmentDescriptor | FindHotspotAssessmentDescriptor | FindMultipleHotspotsAssessmentDescriptor;
|
|
80
|
+
type AssessmentDescriptor = McqAssessmentDescriptor | TrueFalseAssessmentDescriptor | FillInBlanksAssessmentDescriptor | FindHotspotAssessmentDescriptor | FindMultipleHotspotsAssessmentDescriptor | SortParagraphsAssessmentDescriptor | GuessTheAnswerAssessmentDescriptor | MultimediaChoiceAssessmentDescriptor;
|
|
58
81
|
type LessonkitCourseDescriptor = {
|
|
59
82
|
courseId: CourseId;
|
|
60
83
|
title: string;
|
|
@@ -127,6 +150,8 @@ type ProjectPathsInput = {
|
|
|
127
150
|
lxpackOutDir?: string;
|
|
128
151
|
outputBaseDir?: string;
|
|
129
152
|
};
|
|
153
|
+
/** Validate lessonkit.json `name` for safe default export/archive paths. */
|
|
154
|
+
declare function validateManifestName(name: string): string | null;
|
|
130
155
|
/** Validate lessonkit.json paths.* entries stay under projectRoot. */
|
|
131
156
|
declare function validateProjectPaths(projectRoot: string, paths: ProjectPathsInput): DescriptorValidationIssue[];
|
|
132
157
|
/**
|
|
@@ -171,9 +196,14 @@ type LxpackInjectedAssessment = {
|
|
|
171
196
|
id: string;
|
|
172
197
|
title?: string;
|
|
173
198
|
passingScore: number;
|
|
199
|
+
maxAttempts?: number;
|
|
200
|
+
shuffleChoices?: boolean;
|
|
201
|
+
showFeedback?: "never" | "immediate" | "end";
|
|
174
202
|
questions: Array<{
|
|
175
203
|
id: string;
|
|
176
204
|
prompt: string;
|
|
205
|
+
explanation?: string;
|
|
206
|
+
selectionMode?: "single" | "multiple";
|
|
177
207
|
choices: Array<{
|
|
178
208
|
id: string;
|
|
179
209
|
text: string;
|
|
@@ -247,6 +277,9 @@ type BuildStagingPackageResult = {
|
|
|
247
277
|
}>;
|
|
248
278
|
outputPath?: string;
|
|
249
279
|
outputDir?: string;
|
|
280
|
+
/** Absolute project-root output path when `output` was explicitly requested. */
|
|
281
|
+
requestedOutputPath?: string;
|
|
282
|
+
requestedOutputDir?: string;
|
|
250
283
|
} | {
|
|
251
284
|
ok: false;
|
|
252
285
|
stagingDir: string;
|
|
@@ -306,6 +339,19 @@ type PackageLessonkitCourseResult = {
|
|
|
306
339
|
severity?: string;
|
|
307
340
|
}>;
|
|
308
341
|
};
|
|
342
|
+
/**
|
|
343
|
+
* Validate an on-disk LXPack course directory before packaging.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* import { validateLessonkitProject } from "@lessonkit/lxpack";
|
|
348
|
+
*
|
|
349
|
+
* const result = await validateLessonkitProject({
|
|
350
|
+
* courseDir: ".lxpack/course",
|
|
351
|
+
* target: "scorm12",
|
|
352
|
+
* });
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
309
355
|
declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
|
|
310
356
|
declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
|
|
311
357
|
|
|
@@ -327,6 +373,9 @@ declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): P
|
|
|
327
373
|
* });
|
|
328
374
|
* if (!result.ok) console.error(result.issues);
|
|
329
375
|
* ```
|
|
376
|
+
*
|
|
377
|
+
* @remarks Returns `{ ok: false, issues }` (does not throw) for manifest parity failures,
|
|
378
|
+
* missing `dist/`, LXPack validation errors, or `strictBuild` / `strictParity` warnings.
|
|
330
379
|
*/
|
|
331
380
|
declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
|
|
332
381
|
|
|
@@ -501,4 +550,4 @@ declare function validateLkcourse(archivePath: string): ValidateLkcourseResult;
|
|
|
501
550
|
*/
|
|
502
551
|
declare function importLkcourse(options: ImportLkcourseOptions): Promise<ImportLkcourseResult>;
|
|
503
552
|
|
|
504
|
-
export { type AssessmentDescriptor, type BlockTreeNodeV1, type BlockTreeV1, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type ExportLkcourseOptions, type ExportLkcourseResult, type ExtractBlockTreeOptions, type FillInBlanksAssessmentDescriptor, type ImportLkcourseOptions, type ImportLkcourseResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitExportTarget, type LessonkitManifest, type LessonkitManifestPaths, type LkcourseEnvelopeV1, type LkcourseValidationIssue, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type McqAssessmentDescriptor, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type ReactParityIssue, type SpaLayout, type SpaLessonEntry, type TrueFalseAssessmentDescriptor, type ValidateLessonkitProjectOptions, type ValidateLkcourseResult, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assertSpaDistContentsSafe, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, escapeShellText, exportLkcourse, extractAssessments, extractBlockTree, importLkcourse, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, parseLkcourseEnvelope, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validateLkcourse, validateLkcourseArchiveEntries, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
|
|
553
|
+
export { type AssessmentDescriptor, type BlockTreeNodeV1, type BlockTreeV1, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type ExportLkcourseOptions, type ExportLkcourseResult, type ExtractBlockTreeOptions, type FillInBlanksAssessmentDescriptor, type ImportLkcourseOptions, type ImportLkcourseResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitExportTarget, type LessonkitManifest, type LessonkitManifestPaths, type LkcourseEnvelopeV1, type LkcourseValidationIssue, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type McqAssessmentDescriptor, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type ReactParityIssue, type SpaLayout, type SpaLessonEntry, type TrueFalseAssessmentDescriptor, type ValidateLessonkitProjectOptions, type ValidateLkcourseResult, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assertSpaDistContentsSafe, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, escapeShellText, exportLkcourse, extractAssessments, extractBlockTree, importLkcourse, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, parseLkcourseEnvelope, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validateLkcourse, validateLkcourseArchiveEntries, validateManifestName, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
|
package/dist/index.d.ts
CHANGED
|
@@ -53,8 +53,31 @@ type FindMultipleHotspotsAssessmentDescriptor = {
|
|
|
53
53
|
correctTargetIds: string[];
|
|
54
54
|
passingScore?: number;
|
|
55
55
|
};
|
|
56
|
+
type SortParagraphsAssessmentDescriptor = {
|
|
57
|
+
kind: "sortParagraphs";
|
|
58
|
+
checkId: CheckId;
|
|
59
|
+
question: string;
|
|
60
|
+
paragraphs: string[];
|
|
61
|
+
correctOrder: number[];
|
|
62
|
+
passingScore?: number;
|
|
63
|
+
};
|
|
64
|
+
type GuessTheAnswerAssessmentDescriptor = {
|
|
65
|
+
kind: "guessTheAnswer";
|
|
66
|
+
checkId: CheckId;
|
|
67
|
+
question: string;
|
|
68
|
+
answer: string;
|
|
69
|
+
passingScore?: number;
|
|
70
|
+
};
|
|
71
|
+
type MultimediaChoiceAssessmentDescriptor = {
|
|
72
|
+
kind: "multimediaChoice";
|
|
73
|
+
checkId: CheckId;
|
|
74
|
+
question: string;
|
|
75
|
+
choices: string[];
|
|
76
|
+
answer: string;
|
|
77
|
+
passingScore?: number;
|
|
78
|
+
};
|
|
56
79
|
/** Discriminated assessment entries in lessonkit.json (defaults to MCQ when kind omitted). */
|
|
57
|
-
type AssessmentDescriptor = McqAssessmentDescriptor | TrueFalseAssessmentDescriptor | FillInBlanksAssessmentDescriptor | FindHotspotAssessmentDescriptor | FindMultipleHotspotsAssessmentDescriptor;
|
|
80
|
+
type AssessmentDescriptor = McqAssessmentDescriptor | TrueFalseAssessmentDescriptor | FillInBlanksAssessmentDescriptor | FindHotspotAssessmentDescriptor | FindMultipleHotspotsAssessmentDescriptor | SortParagraphsAssessmentDescriptor | GuessTheAnswerAssessmentDescriptor | MultimediaChoiceAssessmentDescriptor;
|
|
58
81
|
type LessonkitCourseDescriptor = {
|
|
59
82
|
courseId: CourseId;
|
|
60
83
|
title: string;
|
|
@@ -127,6 +150,8 @@ type ProjectPathsInput = {
|
|
|
127
150
|
lxpackOutDir?: string;
|
|
128
151
|
outputBaseDir?: string;
|
|
129
152
|
};
|
|
153
|
+
/** Validate lessonkit.json `name` for safe default export/archive paths. */
|
|
154
|
+
declare function validateManifestName(name: string): string | null;
|
|
130
155
|
/** Validate lessonkit.json paths.* entries stay under projectRoot. */
|
|
131
156
|
declare function validateProjectPaths(projectRoot: string, paths: ProjectPathsInput): DescriptorValidationIssue[];
|
|
132
157
|
/**
|
|
@@ -171,9 +196,14 @@ type LxpackInjectedAssessment = {
|
|
|
171
196
|
id: string;
|
|
172
197
|
title?: string;
|
|
173
198
|
passingScore: number;
|
|
199
|
+
maxAttempts?: number;
|
|
200
|
+
shuffleChoices?: boolean;
|
|
201
|
+
showFeedback?: "never" | "immediate" | "end";
|
|
174
202
|
questions: Array<{
|
|
175
203
|
id: string;
|
|
176
204
|
prompt: string;
|
|
205
|
+
explanation?: string;
|
|
206
|
+
selectionMode?: "single" | "multiple";
|
|
177
207
|
choices: Array<{
|
|
178
208
|
id: string;
|
|
179
209
|
text: string;
|
|
@@ -247,6 +277,9 @@ type BuildStagingPackageResult = {
|
|
|
247
277
|
}>;
|
|
248
278
|
outputPath?: string;
|
|
249
279
|
outputDir?: string;
|
|
280
|
+
/** Absolute project-root output path when `output` was explicitly requested. */
|
|
281
|
+
requestedOutputPath?: string;
|
|
282
|
+
requestedOutputDir?: string;
|
|
250
283
|
} | {
|
|
251
284
|
ok: false;
|
|
252
285
|
stagingDir: string;
|
|
@@ -306,6 +339,19 @@ type PackageLessonkitCourseResult = {
|
|
|
306
339
|
severity?: string;
|
|
307
340
|
}>;
|
|
308
341
|
};
|
|
342
|
+
/**
|
|
343
|
+
* Validate an on-disk LXPack course directory before packaging.
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* ```ts
|
|
347
|
+
* import { validateLessonkitProject } from "@lessonkit/lxpack";
|
|
348
|
+
*
|
|
349
|
+
* const result = await validateLessonkitProject({
|
|
350
|
+
* courseDir: ".lxpack/course",
|
|
351
|
+
* target: "scorm12",
|
|
352
|
+
* });
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
309
355
|
declare function validateLessonkitProject(options: ValidateLessonkitProjectOptions): Promise<ValidateCourseResult>;
|
|
310
356
|
declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
|
|
311
357
|
|
|
@@ -327,6 +373,9 @@ declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): P
|
|
|
327
373
|
* });
|
|
328
374
|
* if (!result.ok) console.error(result.issues);
|
|
329
375
|
* ```
|
|
376
|
+
*
|
|
377
|
+
* @remarks Returns `{ ok: false, issues }` (does not throw) for manifest parity failures,
|
|
378
|
+
* missing `dist/`, LXPack validation errors, or `strictBuild` / `strictParity` warnings.
|
|
330
379
|
*/
|
|
331
380
|
declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
|
|
332
381
|
|
|
@@ -501,4 +550,4 @@ declare function validateLkcourse(archivePath: string): ValidateLkcourseResult;
|
|
|
501
550
|
*/
|
|
502
551
|
declare function importLkcourse(options: ImportLkcourseOptions): Promise<ImportLkcourseResult>;
|
|
503
552
|
|
|
504
|
-
export { type AssessmentDescriptor, type BlockTreeNodeV1, type BlockTreeV1, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type ExportLkcourseOptions, type ExportLkcourseResult, type ExtractBlockTreeOptions, type FillInBlanksAssessmentDescriptor, type ImportLkcourseOptions, type ImportLkcourseResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitExportTarget, type LessonkitManifest, type LessonkitManifestPaths, type LkcourseEnvelopeV1, type LkcourseValidationIssue, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type McqAssessmentDescriptor, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type ReactParityIssue, type SpaLayout, type SpaLessonEntry, type TrueFalseAssessmentDescriptor, type ValidateLessonkitProjectOptions, type ValidateLkcourseResult, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assertSpaDistContentsSafe, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, escapeShellText, exportLkcourse, extractAssessments, extractBlockTree, importLkcourse, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, parseLkcourseEnvelope, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validateLkcourse, validateLkcourseArchiveEntries, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
|
|
553
|
+
export { type AssessmentDescriptor, type BlockTreeNodeV1, type BlockTreeV1, type BuildLessonkitProjectOptions, type BuildStagingPackageOptions, type BuildStagingPackageResult, type DescriptorValidationIssue, type DescriptorValidationResult, type ExportLkcourseOptions, type ExportLkcourseResult, type ExtractBlockTreeOptions, type FillInBlanksAssessmentDescriptor, type ImportLkcourseOptions, type ImportLkcourseResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitExportTarget, type LessonkitManifest, type LessonkitManifestPaths, type LkcourseEnvelopeV1, type LkcourseValidationIssue, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type ManifestParseIssue, type MappedLessonkitIds, type McqAssessmentDescriptor, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type PackageValidationIssue, type ParseManifestResult, type ProjectPathsInput, type ReactParityIssue, type SpaLayout, type SpaLessonEntry, type TrueFalseAssessmentDescriptor, type ValidateLessonkitProjectOptions, type ValidateLkcourseResult, type ValidatePackageInputsResult, type ValidationIssue, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assertSpaDistContentsSafe, assessmentDescriptorToLxpack, buildLessonkitProject, buildStagingPackage, descriptorToInterchange, ensureOutDirParent, escapeShellText, exportLkcourse, extractAssessments, extractBlockTree, importLkcourse, loadLessonkitManifestFromFile, mapLessonkitIds, packageLessonkitCourse, parseLessonkitManifest, parseLkcourseEnvelope, promoteStagingToOutDir, remapArtifactPaths, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateDescriptorForTarget, validateLessonkitProject, validateLkcourse, validateLkcourseArchiveEntries, validateManifestName, validatePackageInputs, validateProjectPaths, validateReactManifestParity, writeLxpackProject };
|