@lessonkit/lxpack 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -30,14 +30,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ LESSONKIT_TELEMETRY_EVENTS: () => import_tracking_schema2.LESSONKIT_TELEMETRY_EVENTS,
33
34
  assessmentDescriptorToLxpack: () => assessmentDescriptorToLxpack,
34
35
  buildLessonkitProject: () => buildLessonkitProject,
35
36
  descriptorToInterchange: () => descriptorToInterchange,
36
37
  extractAssessments: () => extractAssessments,
38
+ lessonkitInterchangeSchema: () => import_validators2.lessonkitInterchangeSchema,
37
39
  mapLessonkitIds: () => mapLessonkitIds,
40
+ mapLessonkitTelemetryToBridgeAction: () => import_tracking_schema2.mapLessonkitTelemetryToBridgeAction,
41
+ mapLessonkitTelemetryToLxpack: () => import_tracking_schema2.mapLessonkitTelemetryToLxpack,
42
+ materializeLessonkitProject: () => import_validators2.materializeLessonkitProject,
38
43
  packageLessonkitCourse: () => packageLessonkitCourse,
44
+ parseLessonkitInterchange: () => import_validators2.parseLessonkitInterchange,
39
45
  resolveSafePackageOutputOverride: () => resolveSafePackageOutputOverride,
40
46
  resolveSpaLessons: () => resolveSpaLessons,
47
+ telemetryEventToLessonkit: () => telemetryEventToLessonkit,
41
48
  themeToLxpackRuntime: () => themeToLxpackRuntime,
42
49
  validateDescriptor: () => validateDescriptor,
43
50
  validateLessonkitProject: () => validateLessonkitProject,
@@ -316,6 +323,37 @@ function mapLessonkitIds(descriptor) {
316
323
  return { courseId, lessonIds, checkIds };
317
324
  }
318
325
 
326
+ // src/assessments.ts
327
+ function slugChoiceId(text, index) {
328
+ const base = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 32);
329
+ const stem = base.length ? base : "choice";
330
+ return `${stem}-${index + 1}`;
331
+ }
332
+ function assessmentDescriptorToLxpack(assessment) {
333
+ const choices = assessment.choices.map((text, index) => {
334
+ const id = slugChoiceId(text, index);
335
+ return {
336
+ id,
337
+ text,
338
+ correct: text === assessment.answer
339
+ };
340
+ });
341
+ return {
342
+ id: assessment.checkId,
343
+ passingScore: assessment.passingScore ?? 1,
344
+ questions: [
345
+ {
346
+ id: "q1",
347
+ prompt: assessment.question,
348
+ choices
349
+ }
350
+ ]
351
+ };
352
+ }
353
+ function extractAssessments(descriptor) {
354
+ return (descriptor.assessments ?? []).map(assessmentDescriptorToLxpack);
355
+ }
356
+
319
357
  // src/interchange.ts
320
358
  function resolveSpaLessons(descriptor) {
321
359
  const mapped = mapLessonkitIds(descriptor);
@@ -339,6 +377,8 @@ function resolveSpaLessons(descriptor) {
339
377
  function descriptorToInterchange(descriptor) {
340
378
  const mapped = mapLessonkitIds(descriptor);
341
379
  const spaLessons = resolveSpaLessons(descriptor);
380
+ const runtime = descriptor.theme ? themeToLxpackRuntime(descriptor.theme) : void 0;
381
+ const assessments = extractAssessments(descriptor);
342
382
  return {
343
383
  format: "lessonkit",
344
384
  version: "1",
@@ -352,121 +392,52 @@ function descriptorToInterchange(descriptor) {
352
392
  type: "spa",
353
393
  path: l.path
354
394
  })),
355
- tracking: descriptor.tracking
395
+ tracking: descriptor.tracking,
396
+ runtime: runtime ? {
397
+ theme: runtime.theme,
398
+ cssVariables: runtime.cssVariables
399
+ } : void 0,
400
+ assessments: assessments.length ? assessments : void 0
356
401
  };
357
402
  }
358
403
 
359
- // src/assessments.ts
360
- function slugChoiceId(text, index) {
361
- const base = text.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 32);
362
- const stem = base.length ? base : "choice";
363
- return `${stem}-${index + 1}`;
364
- }
365
- function assessmentDescriptorToLxpack(assessment) {
366
- const choices = assessment.choices.map((text, index) => {
367
- const id = slugChoiceId(text, index);
368
- return {
369
- id,
370
- text,
371
- correct: text === assessment.answer
372
- };
373
- });
374
- return {
375
- id: assessment.checkId,
376
- passingScore: assessment.passingScore ?? 1,
377
- questions: [
378
- {
379
- id: "q1",
380
- prompt: assessment.question,
381
- choices
382
- }
383
- ]
384
- };
385
- }
386
- function extractAssessments(descriptor) {
387
- return (descriptor.assessments ?? []).map(assessmentDescriptorToLxpack);
388
- }
389
-
390
404
  // src/writeProject.ts
405
+ var import_node_path4 = require("path");
406
+ var import_validators = require("@lxpack/validators");
407
+
408
+ // src/spaDirs.ts
391
409
  var import_promises = require("fs/promises");
392
410
  var import_node_path3 = require("path");
393
-
394
- // src/assessmentYaml.ts
395
- function yamlQuote(value) {
396
- return JSON.stringify(value);
397
- }
398
- function emitAssessmentYaml(assessment) {
399
- const lx = assessmentDescriptorToLxpack(assessment);
400
- const lines = [];
401
- lines.push(`id: ${lx.id}`);
402
- lines.push(`passingScore: ${lx.passingScore}`);
403
- lines.push("questions:");
404
- for (const question of lx.questions) {
405
- lines.push(` - id: ${question.id}`);
406
- lines.push(` prompt: ${yamlQuote(question.prompt)}`);
407
- lines.push(" choices:");
408
- for (const choice of question.choices) {
409
- lines.push(` - id: ${choice.id}`);
410
- lines.push(` text: ${yamlQuote(choice.text)}`);
411
- if (choice.correct) lines.push(" correct: true");
411
+ async function resolveSpaDirs(options) {
412
+ const { descriptor, spaDistDir, lessonSpaDirs, projectRoot } = options;
413
+ const spaLessons = resolveSpaLessons(descriptor);
414
+ if (descriptor.layout === "single-spa") {
415
+ const spaDistRelative = spaDistDir ?? descriptor.spaDistDir ?? "dist";
416
+ const srcDist = projectRoot ? (0, import_node_path3.resolve)(projectRoot, spaDistRelative) : (0, import_node_path3.resolve)(spaDistRelative);
417
+ if (projectRoot) {
418
+ assertResolvedPathUnderRoot((0, import_node_path3.resolve)(projectRoot), srcDist);
412
419
  }
413
- }
414
- return `${lines.join("\n")}
415
- `;
416
- }
417
-
418
- // src/yaml.ts
419
- function yamlQuote2(value) {
420
- if (/[:#\n\r]/.test(value) || value.startsWith(" ") || value.endsWith(" ")) {
421
- return JSON.stringify(value);
422
- }
423
- return value;
424
- }
425
- function emitCourseYaml(opts) {
426
- const lines = [];
427
- lines.push(`title: ${yamlQuote2(opts.title)}`);
428
- lines.push(`version: ${yamlQuote2(opts.version)}`);
429
- if (opts.description) lines.push(`description: ${yamlQuote2(opts.description)}`);
430
- if (opts.runtime) {
431
- lines.push("runtime:");
432
- lines.push(` theme: ${yamlQuote2(opts.runtime.theme)}`);
433
- if (opts.runtime.cssVariables && Object.keys(opts.runtime.cssVariables).length) {
434
- lines.push(" cssVariables:");
435
- for (const [key, value] of Object.entries(opts.runtime.cssVariables).sort(
436
- ([a], [b]) => a.localeCompare(b)
437
- )) {
438
- lines.push(` ${key}: ${JSON.stringify(String(value))}`);
439
- }
420
+ try {
421
+ await (0, import_promises.access)(srcDist);
422
+ } catch {
423
+ throw new Error(`spaDistDir not found: ${srcDist}`);
440
424
  }
441
- }
442
- if (opts.tracking?.completion?.threshold !== void 0) {
443
- lines.push("tracking:");
444
- lines.push(" completion:");
445
- lines.push(` threshold: ${opts.tracking.completion.threshold}`);
446
- }
447
- lines.push("lessons:");
448
- for (const lesson of opts.lessons) {
449
- lines.push(` - id: ${lesson.id}`);
450
- lines.push(` title: ${yamlQuote2(lesson.title)}`);
451
- lines.push(` type: spa`);
452
- lines.push(` path: ${lesson.path}`);
453
- }
454
- if (opts.assessments.length) {
455
- lines.push("assessments:");
456
- for (const assessment of opts.assessments) {
457
- lines.push(` - id: ${assessment.id}`);
458
- lines.push(` file: ${assessment.file}`);
425
+ const lessonId = spaLessons[0]?.id ?? "main";
426
+ return { [lessonId]: srcDist };
427
+ }
428
+ const dirs = {};
429
+ const lessonDirs = lessonSpaDirs ?? {};
430
+ for (const lesson of descriptor.lessons) {
431
+ const src = lessonDirs[lesson.id];
432
+ if (!src) {
433
+ throw new Error(`lessonSpaDirs missing build output for lesson "${lesson.id}"`);
459
434
  }
435
+ dirs[lesson.id] = (0, import_node_path3.resolve)(src);
460
436
  }
461
- return `${lines.join("\n")}
462
- `;
437
+ return dirs;
463
438
  }
464
439
 
465
440
  // src/writeProject.ts
466
- async function copyDir(src, dest) {
467
- await (0, import_promises.mkdir)((0, import_node_path3.dirname)(dest), { recursive: true });
468
- await (0, import_promises.cp)(src, dest, { recursive: true });
469
- }
470
441
  async function writeLxpackProject(options) {
471
442
  const validation = validateDescriptor(options.descriptor);
472
443
  if (!validation.ok) {
@@ -475,94 +446,42 @@ async function writeLxpackProject(options) {
475
446
  );
476
447
  }
477
448
  const descriptor = validation.descriptor;
478
- const outDir = (0, import_node_path3.resolve)(options.outDir);
479
- await (0, import_promises.mkdir)(outDir, { recursive: true });
480
- const spaLessons = resolveSpaLessons(descriptor);
481
- const runtime = descriptor.theme ? themeToLxpackRuntime(descriptor.theme) : void 0;
482
- const assessments = (descriptor.assessments ?? []).map((a) => ({
483
- id: a.checkId,
484
- file: `assessments/${a.checkId}.yaml`
485
- }));
486
- if (descriptor.layout === "single-spa") {
487
- const spaDistRelative = options.spaDistDir ?? descriptor.spaDistDir ?? "dist";
488
- const srcDist = options.projectRoot ? (0, import_node_path3.resolve)(options.projectRoot, spaDistRelative) : (0, import_node_path3.resolve)(spaDistRelative);
489
- if (options.projectRoot) {
490
- assertResolvedPathUnderRoot((0, import_node_path3.resolve)(options.projectRoot), srcDist);
491
- }
492
- try {
493
- await (0, import_promises.access)(srcDist);
494
- } catch {
495
- throw new Error(`spaDistDir not found: ${srcDist}`);
496
- }
497
- const destDist = (0, import_node_path3.join)(outDir, "dist");
498
- await (0, import_promises.rm)(destDist, { recursive: true, force: true });
499
- await copyDir(srcDist, destDist);
500
- } else {
501
- const lessonDirs = options.lessonSpaDirs ?? {};
502
- for (const lesson of descriptor.lessons) {
503
- const src = lessonDirs[lesson.id];
504
- if (!src) {
505
- throw new Error(`lessonSpaDirs missing build output for lesson "${lesson.id}"`);
506
- }
507
- const dest = (0, import_node_path3.join)(outDir, lesson.spaPath);
508
- assertResolvedPathUnderRoot(outDir, dest);
509
- await (0, import_promises.rm)(dest, { recursive: true, force: true });
510
- await copyDir((0, import_node_path3.resolve)(src), dest);
511
- }
512
- }
513
- if (assessments.length) {
514
- const assessmentsDir = (0, import_node_path3.join)(outDir, "assessments");
515
- await (0, import_promises.mkdir)(assessmentsDir, { recursive: true });
516
- for (const assessment of descriptor.assessments ?? []) {
517
- await (0, import_promises.writeFile)(
518
- (0, import_node_path3.join)(outDir, `assessments/${assessment.checkId}.yaml`),
519
- emitAssessmentYaml(assessment),
520
- "utf-8"
521
- );
522
- }
449
+ const outDir = (0, import_node_path4.resolve)(options.outDir);
450
+ const spaDirs = await resolveSpaDirs({ ...options, descriptor });
451
+ const interchange = descriptorToInterchange(descriptor);
452
+ const materialized = await (0, import_validators.materializeLessonkitProject)({
453
+ interchange,
454
+ spaDirs,
455
+ courseDir: outDir,
456
+ writeAuthoringFiles: true
457
+ });
458
+ if (!materialized.ok) {
459
+ throw new Error(
460
+ materialized.issues.map((i) => `${i.path ?? ""}: ${i.message}`.trim()).join("; ")
461
+ );
523
462
  }
524
- const courseYamlPath = (0, import_node_path3.join)(outDir, "course.yaml");
525
- await (0, import_promises.writeFile)(
526
- courseYamlPath,
527
- emitCourseYaml({
528
- title: descriptor.title,
529
- version: descriptor.version ?? "1.0.0",
530
- runtime,
531
- tracking: descriptor.tracking,
532
- lessons: spaLessons.map((l) => ({
533
- id: l.id,
534
- title: l.title,
535
- type: "spa",
536
- path: l.path
537
- })),
538
- assessments
539
- }),
540
- "utf-8"
541
- );
542
- const lessonkitJsonPath = (0, import_node_path3.join)(outDir, "lessonkit.json");
543
- await (0, import_promises.writeFile)(
544
- lessonkitJsonPath,
545
- `${JSON.stringify(descriptorToInterchange(descriptor), null, 2)}
546
- `,
547
- "utf-8"
548
- );
549
- return { outDir, courseYamlPath, lessonkitJsonPath };
463
+ const courseDir = materialized.courseDir;
464
+ return {
465
+ outDir: courseDir,
466
+ courseYamlPath: (0, import_node_path4.join)(courseDir, "course.yaml"),
467
+ lessonkitJsonPath: (0, import_node_path4.join)(courseDir, "lessonkit.json")
468
+ };
550
469
  }
551
470
 
552
471
  // src/packageCourse.ts
553
472
  var fsp = __toESM(require("fs/promises"), 1);
554
- var import_node_path4 = require("path");
473
+ var import_node_path5 = require("path");
555
474
  var import_node_os = require("os");
556
475
  var import_api = require("@lxpack/api");
557
476
  async function validateLessonkitProject(options) {
558
477
  return (0, import_api.validateCourse)({
559
- courseDir: (0, import_node_path4.resolve)(options.courseDir),
478
+ courseDir: (0, import_node_path5.resolve)(options.courseDir),
560
479
  target: options.target
561
480
  });
562
481
  }
563
482
  async function buildLessonkitProject(options) {
564
483
  return (0, import_api.buildCourse)({
565
- courseDir: (0, import_node_path4.resolve)(options.courseDir),
484
+ courseDir: (0, import_node_path5.resolve)(options.courseDir),
566
485
  target: options.target,
567
486
  output: options.output,
568
487
  dir: options.dir,
@@ -601,7 +520,7 @@ async function promoteStagingToOutDir(stagingDir, outDir) {
601
520
  }
602
521
  async function packageLessonkitCourse(options) {
603
522
  const { target, output, dir, outputBaseDir, ...writeOpts } = options;
604
- const outDir = (0, import_node_path4.resolve)(writeOpts.outDir);
523
+ const outDir = (0, import_node_path5.resolve)(writeOpts.outDir);
605
524
  const descriptorValidation = validateDescriptor(writeOpts.descriptor);
606
525
  if (!descriptorValidation.ok) {
607
526
  return {
@@ -615,42 +534,50 @@ async function packageLessonkitCourse(options) {
615
534
  };
616
535
  }
617
536
  const descriptor = descriptorValidation.descriptor;
618
- const stagingDir = await fsp.mkdtemp((0, import_node_path4.join)((0, import_node_os.tmpdir)(), "lessonkit-lxpack-"));
537
+ const stagingDir = await fsp.mkdtemp((0, import_node_path5.join)((0, import_node_os.tmpdir)(), "lessonkit-lxpack-"));
619
538
  let promoted = false;
620
539
  try {
621
- const written = await writeLxpackProject({ ...writeOpts, descriptor, outDir: stagingDir });
622
- const courseDir = written.outDir;
623
- const assessments = extractAssessments(descriptor);
624
- const validation = await validateLessonkitProject({ courseDir, target });
625
- if (!validation.ok) {
540
+ let spaDirs;
541
+ try {
542
+ spaDirs = await resolveSpaDirs({ ...writeOpts, descriptor });
543
+ } catch (err) {
626
544
  return {
627
545
  ok: false,
628
546
  courseDir: outDir,
629
547
  target,
630
- validation,
631
- issues: validation.issues.map((i) => ({
632
- path: i.path,
633
- message: i.message,
634
- severity: i.severity
635
- }))
548
+ issues: [
549
+ {
550
+ path: "spaDirs",
551
+ message: err instanceof Error ? err.message : String(err)
552
+ }
553
+ ]
636
554
  };
637
555
  }
556
+ const interchange = descriptorToInterchange(descriptor);
638
557
  const outputBase = outputBaseDir ?? ".lxpack/out";
639
- await fsp.mkdir((0, import_node_path4.join)(courseDir, outputBase), { recursive: true });
640
- const defaultOutput = output ?? (dir ? (0, import_node_path4.join)(outputBase, target) : (0, import_node_path4.join)(outputBase, `course-${target}.zip`));
641
- const build = await buildLessonkitProject({
642
- courseDir,
558
+ await fsp.mkdir((0, import_node_path5.join)(stagingDir, outputBase), { recursive: true });
559
+ const defaultOutput = output ?? (dir ? (0, import_node_path5.join)(outputBase, target) : (0, import_node_path5.join)(outputBase, `course-${target}.zip`));
560
+ const build = await (0, import_api.packageLessonkit)({
561
+ interchange,
562
+ spaDirs,
643
563
  target,
644
- output: defaultOutput.startsWith("/") ? defaultOutput : (0, import_node_path4.join)(courseDir, defaultOutput),
564
+ courseDir: stagingDir,
565
+ output: defaultOutput,
645
566
  dir,
646
- assessments: assessments.length ? assessments : void 0
567
+ outputBaseDir,
568
+ outputAnchorDir: stagingDir,
569
+ writeAuthoringFiles: true
647
570
  });
648
571
  if (!build.ok) {
572
+ const validation2 = {
573
+ ok: false,
574
+ issues: build.issues
575
+ };
649
576
  return {
650
577
  ok: false,
651
578
  courseDir: outDir,
652
579
  target,
653
- validation,
580
+ validation: validation2,
654
581
  build,
655
582
  issues: build.issues.map((i) => ({
656
583
  path: i.path,
@@ -659,15 +586,17 @@ async function packageLessonkitCourse(options) {
659
586
  }))
660
587
  };
661
588
  }
662
- await fsp.mkdir((0, import_node_path4.dirname)(outDir), { recursive: true });
663
- await promoteStagingToOutDir(stagingDir, outDir);
664
- promoted = true;
589
+ const validation = {
590
+ ok: true,
591
+ manifest: build.manifest,
592
+ issues: build.issues
593
+ };
594
+ const stagingRoot = await fsp.realpath(stagingDir);
665
595
  const remapArtifactPath = (artifactPath) => {
666
596
  if (!artifactPath) return void 0;
667
- const resolved = (0, import_node_path4.resolve)(artifactPath);
668
- const stagingResolved = (0, import_node_path4.resolve)(stagingDir);
669
- if (resolved === stagingResolved || resolved.startsWith(stagingResolved + "/")) {
670
- return (0, import_node_path4.join)(outDir, resolved.slice(stagingResolved.length + 1));
597
+ const resolved = (0, import_node_path5.resolve)(artifactPath);
598
+ if (resolved === stagingRoot || resolved.startsWith(`${stagingRoot}/`)) {
599
+ return (0, import_node_path5.join)(outDir, resolved.slice(stagingRoot.length + 1));
671
600
  }
672
601
  return artifactPath;
673
602
  };
@@ -675,6 +604,9 @@ async function packageLessonkitCourse(options) {
675
604
  "outputPath" in build ? build.outputPath : void 0
676
605
  );
677
606
  const remappedOutputDir = remapArtifactPath("outputDir" in build ? build.outputDir : void 0);
607
+ await fsp.mkdir((0, import_node_path5.dirname)(outDir), { recursive: true });
608
+ await promoteStagingToOutDir(stagingDir, outDir);
609
+ promoted = true;
678
610
  const remappedBuild = { ...build };
679
611
  if ("outputPath" in remappedBuild && remappedOutputPath !== void 0) {
680
612
  remappedBuild.outputPath = remappedOutputPath;
@@ -698,16 +630,58 @@ async function packageLessonkitCourse(options) {
698
630
  }
699
631
  }
700
632
  }
633
+
634
+ // src/index.ts
635
+ var import_tracking_schema2 = require("@lxpack/tracking-schema");
636
+
637
+ // src/telemetry.ts
638
+ var import_tracking_schema = require("@lxpack/tracking-schema");
639
+ var SUPPORTED = new Set(import_tracking_schema.LESSONKIT_TELEMETRY_EVENTS);
640
+ function telemetryEventToLessonkit(event) {
641
+ if (!SUPPORTED.has(event.name)) {
642
+ return null;
643
+ }
644
+ const name = event.name;
645
+ const mapped = {
646
+ name,
647
+ lessonId: event.lessonId
648
+ };
649
+ if (name === "quiz_completed" || name === "quiz_answered") {
650
+ const data = event.data;
651
+ mapped.assessmentId = data?.checkId;
652
+ if (data && "score" in data) {
653
+ mapped.score = data.score;
654
+ mapped.maxScore = data.maxScore;
655
+ mapped.passingScore = data.passingScore;
656
+ }
657
+ if (data) {
658
+ mapped.data = data;
659
+ }
660
+ } else if (name === "interaction" && event.data) {
661
+ mapped.data = event.data;
662
+ }
663
+ return mapped;
664
+ }
665
+
666
+ // src/index.ts
667
+ var import_validators2 = require("@lxpack/validators");
701
668
  // Annotate the CommonJS export names for ESM import in node:
702
669
  0 && (module.exports = {
670
+ LESSONKIT_TELEMETRY_EVENTS,
703
671
  assessmentDescriptorToLxpack,
704
672
  buildLessonkitProject,
705
673
  descriptorToInterchange,
706
674
  extractAssessments,
675
+ lessonkitInterchangeSchema,
707
676
  mapLessonkitIds,
677
+ mapLessonkitTelemetryToBridgeAction,
678
+ mapLessonkitTelemetryToLxpack,
679
+ materializeLessonkitProject,
708
680
  packageLessonkitCourse,
681
+ parseLessonkitInterchange,
709
682
  resolveSafePackageOutputOverride,
710
683
  resolveSpaLessons,
684
+ telemetryEventToLessonkit,
711
685
  themeToLxpackRuntime,
712
686
  validateDescriptor,
713
687
  validateLessonkitProject,
package/dist/index.d.cts CHANGED
@@ -1,7 +1,11 @@
1
1
  import { CheckId, CourseId, LessonId } from '@lessonkit/core';
2
2
  import { ThemePresetName, LessonkitThemeV1 } from '@lessonkit/themes';
3
+ import { LessonkitInterchangeV1 } from '@lxpack/validators';
4
+ export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
3
5
  import { ExportTarget, ValidateCourseResult, BuildCourseResult } from '@lxpack/api';
4
6
  export { ExportTarget } from '@lxpack/api';
7
+ export { LESSONKIT_TELEMETRY_EVENTS, LessonkitBridgeAction, LessonkitTelemetryEvent, LessonkitTelemetryEventName, TrackingSchemaEvent, mapLessonkitTelemetryToBridgeAction, mapLessonkitTelemetryToLxpack } from '@lxpack/tracking-schema';
8
+ export { t as telemetryEventToLessonkit } from './telemetry-gCxlwc7I.cjs';
5
9
 
6
10
  type SpaLayout = "single-spa" | "per-lesson-spa";
7
11
  type LessonDescriptor = {
@@ -38,25 +42,7 @@ type LessonkitCourseDescriptor = {
38
42
  /** LXPack SPA lesson id for `single-spa` (default: first lesson id or `main`). */
39
43
  spaLessonId?: string;
40
44
  };
41
- type LessonkitInterchangeV1 = {
42
- format: "lessonkit";
43
- version: "1";
44
- course: {
45
- id: CourseId;
46
- title: string;
47
- };
48
- lessons: Array<{
49
- id: LessonId;
50
- title: string;
51
- type: "spa";
52
- path: string;
53
- }>;
54
- tracking?: {
55
- completion?: {
56
- threshold?: number;
57
- };
58
- };
59
- };
45
+
60
46
  type MappedLessonkitIds = {
61
47
  courseId: CourseId;
62
48
  lessonIds: LessonId[];
@@ -149,6 +135,9 @@ type WriteLxpackProjectResult = {
149
135
  courseYamlPath: string;
150
136
  lessonkitJsonPath: string;
151
137
  };
138
+ /**
139
+ * Materialize an LXPack project tree from a LessonKit descriptor (delegates to LXPack 0.6+).
140
+ */
152
141
  declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
153
142
 
154
143
  type ValidateLessonkitProjectOptions = {
@@ -195,4 +184,4 @@ declare function validateLessonkitProject(options: ValidateLessonkitProjectOptio
195
184
  declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
196
185
  declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
197
186
 
198
- export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type DescriptorValidationIssue, type DescriptorValidationResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitInterchangeV1, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type MappedLessonkitIds, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type ProjectPathsInput, type SpaLayout, type SpaLessonEntry, type ValidateLessonkitProjectOptions, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, descriptorToInterchange, extractAssessments, mapLessonkitIds, packageLessonkitCourse, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateLessonkitProject, validateProjectPaths, writeLxpackProject };
187
+ export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type DescriptorValidationIssue, type DescriptorValidationResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type MappedLessonkitIds, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type ProjectPathsInput, type SpaLayout, type SpaLessonEntry, type ValidateLessonkitProjectOptions, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, descriptorToInterchange, extractAssessments, mapLessonkitIds, packageLessonkitCourse, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateLessonkitProject, validateProjectPaths, writeLxpackProject };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import { CheckId, CourseId, LessonId } from '@lessonkit/core';
2
2
  import { ThemePresetName, LessonkitThemeV1 } from '@lessonkit/themes';
3
+ import { LessonkitInterchangeV1 } from '@lxpack/validators';
4
+ export { LessonkitInterchangeV1, MaterializeLessonkitOptions, MaterializeLessonkitResult, lessonkitInterchangeSchema, materializeLessonkitProject, parseLessonkitInterchange } from '@lxpack/validators';
3
5
  import { ExportTarget, ValidateCourseResult, BuildCourseResult } from '@lxpack/api';
4
6
  export { ExportTarget } from '@lxpack/api';
7
+ export { LESSONKIT_TELEMETRY_EVENTS, LessonkitBridgeAction, LessonkitTelemetryEvent, LessonkitTelemetryEventName, TrackingSchemaEvent, mapLessonkitTelemetryToBridgeAction, mapLessonkitTelemetryToLxpack } from '@lxpack/tracking-schema';
8
+ export { t as telemetryEventToLessonkit } from './telemetry-gCxlwc7I.js';
5
9
 
6
10
  type SpaLayout = "single-spa" | "per-lesson-spa";
7
11
  type LessonDescriptor = {
@@ -38,25 +42,7 @@ type LessonkitCourseDescriptor = {
38
42
  /** LXPack SPA lesson id for `single-spa` (default: first lesson id or `main`). */
39
43
  spaLessonId?: string;
40
44
  };
41
- type LessonkitInterchangeV1 = {
42
- format: "lessonkit";
43
- version: "1";
44
- course: {
45
- id: CourseId;
46
- title: string;
47
- };
48
- lessons: Array<{
49
- id: LessonId;
50
- title: string;
51
- type: "spa";
52
- path: string;
53
- }>;
54
- tracking?: {
55
- completion?: {
56
- threshold?: number;
57
- };
58
- };
59
- };
45
+
60
46
  type MappedLessonkitIds = {
61
47
  courseId: CourseId;
62
48
  lessonIds: LessonId[];
@@ -149,6 +135,9 @@ type WriteLxpackProjectResult = {
149
135
  courseYamlPath: string;
150
136
  lessonkitJsonPath: string;
151
137
  };
138
+ /**
139
+ * Materialize an LXPack project tree from a LessonKit descriptor (delegates to LXPack 0.6+).
140
+ */
152
141
  declare function writeLxpackProject(options: WriteLxpackProjectOptions): Promise<WriteLxpackProjectResult>;
153
142
 
154
143
  type ValidateLessonkitProjectOptions = {
@@ -195,4 +184,4 @@ declare function validateLessonkitProject(options: ValidateLessonkitProjectOptio
195
184
  declare function buildLessonkitProject(options: BuildLessonkitProjectOptions): Promise<BuildCourseResult>;
196
185
  declare function packageLessonkitCourse(options: PackageLessonkitCourseOptions): Promise<PackageLessonkitCourseResult>;
197
186
 
198
- export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type DescriptorValidationIssue, type DescriptorValidationResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LessonkitInterchangeV1, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type MappedLessonkitIds, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type ProjectPathsInput, type SpaLayout, type SpaLessonEntry, type ValidateLessonkitProjectOptions, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, descriptorToInterchange, extractAssessments, mapLessonkitIds, packageLessonkitCourse, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateLessonkitProject, validateProjectPaths, writeLxpackProject };
187
+ export { type AssessmentDescriptor, type BuildLessonkitProjectOptions, type DescriptorValidationIssue, type DescriptorValidationResult, type LessonDescriptor, type LessonkitCourseDescriptor, type LxpackInjectedAssessment, type LxpackRuntimeTheme, type MappedLessonkitIds, type PackageLessonkitCourseOptions, type PackageLessonkitCourseResult, type ProjectPathsInput, type SpaLayout, type SpaLessonEntry, type ValidateLessonkitProjectOptions, type WriteLxpackProjectOptions, type WriteLxpackProjectResult, assessmentDescriptorToLxpack, buildLessonkitProject, descriptorToInterchange, extractAssessments, mapLessonkitIds, packageLessonkitCourse, resolveSafePackageOutputOverride, resolveSpaLessons, themeToLxpackRuntime, validateDescriptor, validateLessonkitProject, validateProjectPaths, writeLxpackProject };