lens-content-processor 0.78.0 → 0.80.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.
Files changed (133) hide show
  1. package/dist/authoring-markup.d.ts +22 -0
  2. package/dist/authoring-markup.js +24 -0
  3. package/dist/authoring-markup.js.map +1 -1
  4. package/dist/cache.d.ts +10 -0
  5. package/dist/cache.js +6 -5
  6. package/dist/cache.js.map +1 -1
  7. package/dist/cli-steps.d.ts +37 -0
  8. package/dist/cli-steps.js +80 -0
  9. package/dist/cli-steps.js.map +1 -0
  10. package/dist/cli.d.ts +7 -0
  11. package/dist/cli.js +52 -70
  12. package/dist/cli.js.map +1 -1
  13. package/dist/course-graph.d.ts +2 -2
  14. package/dist/course-graph.js +7 -2
  15. package/dist/course-graph.js.map +1 -1
  16. package/dist/criticmarkup-forms.d.ts +8 -6
  17. package/dist/criticmarkup-forms.js +22 -19
  18. package/dist/criticmarkup-forms.js.map +1 -1
  19. package/dist/dedupe-errors.d.ts +16 -0
  20. package/dist/dedupe-errors.js +23 -9
  21. package/dist/dedupe-errors.js.map +1 -1
  22. package/dist/dependency-cache.d.ts +15 -5
  23. package/dist/dependency-cache.js +33 -74
  24. package/dist/dependency-cache.js.map +1 -1
  25. package/dist/dropped.d.ts +114 -0
  26. package/dist/dropped.js +253 -0
  27. package/dist/dropped.js.map +1 -0
  28. package/dist/engine/assemble.d.ts +44 -0
  29. package/dist/engine/assemble.js +132 -0
  30. package/dist/engine/assemble.js.map +1 -0
  31. package/dist/engine/build.d.ts +8 -0
  32. package/dist/engine/build.js +558 -0
  33. package/dist/engine/build.js.map +1 -0
  34. package/dist/engine/file-facts.d.ts +26 -0
  35. package/dist/engine/file-facts.js +63 -0
  36. package/dist/engine/file-facts.js.map +1 -0
  37. package/dist/engine/git-source.d.ts +35 -0
  38. package/dist/engine/git-source.js +242 -0
  39. package/dist/engine/git-source.js.map +1 -0
  40. package/dist/engine/overlay.d.ts +43 -0
  41. package/dist/engine/overlay.js +167 -0
  42. package/dist/engine/overlay.js.map +1 -0
  43. package/dist/engine/protocol.d.ts +146 -0
  44. package/dist/engine/protocol.js +40 -0
  45. package/dist/engine/protocol.js.map +1 -0
  46. package/dist/engine/reader.d.ts +133 -0
  47. package/dist/engine/reader.js +298 -0
  48. package/dist/engine/reader.js.map +1 -0
  49. package/dist/engine/sources.d.ts +39 -0
  50. package/dist/engine/sources.js +137 -0
  51. package/dist/engine/sources.js.map +1 -0
  52. package/dist/engine/sqlite-store.d.ts +99 -0
  53. package/dist/engine/sqlite-store.js +452 -0
  54. package/dist/engine/sqlite-store.js.map +1 -0
  55. package/dist/engine/store.d.ts +85 -0
  56. package/dist/engine/store.js +31 -0
  57. package/dist/engine/store.js.map +1 -0
  58. package/dist/engine/tables.d.ts +15 -0
  59. package/dist/engine/tables.js +70 -0
  60. package/dist/engine/tables.js.map +1 -0
  61. package/dist/engine/units.d.ts +58 -0
  62. package/dist/engine/units.js +186 -0
  63. package/dist/engine/units.js.map +1 -0
  64. package/dist/engine/version.d.ts +6 -0
  65. package/dist/engine/version.js +21 -0
  66. package/dist/engine/version.js.map +1 -0
  67. package/dist/engine/worker.d.ts +1 -0
  68. package/dist/engine/worker.js +220 -0
  69. package/dist/engine/worker.js.map +1 -0
  70. package/dist/flattener/index.d.ts +34 -17
  71. package/dist/flattener/index.js +247 -116
  72. package/dist/flattener/index.js.map +1 -1
  73. package/dist/flattener/resolve-text-links.d.ts +15 -14
  74. package/dist/flattener/resolve-text-links.js +24 -25
  75. package/dist/flattener/resolve-text-links.js.map +1 -1
  76. package/dist/glossary.d.ts +2 -2
  77. package/dist/glossary.js.map +1 -1
  78. package/dist/index.d.ts +168 -2
  79. package/dist/index.js +888 -616
  80. package/dist/index.js.map +1 -1
  81. package/dist/markdown-parse.d.ts +6 -0
  82. package/dist/markdown-parse.js +14 -0
  83. package/dist/markdown-parse.js.map +1 -1
  84. package/dist/parser/learning-outcome.js +11 -2
  85. package/dist/parser/learning-outcome.js.map +1 -1
  86. package/dist/parser/lens.d.ts +15 -2
  87. package/dist/parser/lens.js +38 -11
  88. package/dist/parser/lens.js.map +1 -1
  89. package/dist/parser/meeting-doc.d.ts +2 -1
  90. package/dist/parser/meeting-doc.js +2 -1
  91. package/dist/parser/meeting-doc.js.map +1 -1
  92. package/dist/parser/module.d.ts +3 -1
  93. package/dist/parser/module.js +7 -5
  94. package/dist/parser/module.js.map +1 -1
  95. package/dist/parser/question-embeds.d.ts +46 -0
  96. package/dist/parser/question-embeds.js +302 -0
  97. package/dist/parser/question-embeds.js.map +1 -0
  98. package/dist/parser/response-segments.js +12 -0
  99. package/dist/parser/response-segments.js.map +1 -1
  100. package/dist/parser/sections.d.ts +18 -0
  101. package/dist/parser/sections.js +31 -3
  102. package/dist/parser/sections.js.map +1 -1
  103. package/dist/parser/widget.d.ts +2 -1
  104. package/dist/parser/widget.js.map +1 -1
  105. package/dist/parser/wikilink.d.ts +13 -3
  106. package/dist/parser/wikilink.js +55 -34
  107. package/dist/parser/wikilink.js.map +1 -1
  108. package/dist/reference-graph.d.ts +21 -3
  109. package/dist/reference-graph.js +35 -12
  110. package/dist/reference-graph.js.map +1 -1
  111. package/dist/same-page-links.d.ts +11 -1
  112. package/dist/same-page-links.js +9 -0
  113. package/dist/same-page-links.js.map +1 -1
  114. package/dist/skill-tree.d.ts +2 -1
  115. package/dist/skill-tree.js.map +1 -1
  116. package/dist/source-location.d.ts +0 -4
  117. package/dist/source-location.js +0 -43
  118. package/dist/source-location.js.map +1 -1
  119. package/dist/validator/card-module-membership.d.ts +17 -1
  120. package/dist/validator/card-module-membership.js +60 -56
  121. package/dist/validator/card-module-membership.js.map +1 -1
  122. package/dist/validator/criticmarkup.js +1 -1
  123. package/dist/validator/criticmarkup.js.map +1 -1
  124. package/dist/validator/field-typos.d.ts +1 -1
  125. package/dist/validator/field-typos.js +21 -21
  126. package/dist/validator/field-typos.js.map +1 -1
  127. package/dist/validator/output-integrity.d.ts +9 -5
  128. package/dist/validator/output-integrity.js +43 -45
  129. package/dist/validator/output-integrity.js.map +1 -1
  130. package/dist/validator/tier.d.ts +2 -2
  131. package/dist/validator/tier.js.map +1 -1
  132. package/dist/validator/uuid.d.ts +1 -1
  133. package/package.json +2 -1
package/dist/index.d.ts CHANGED
@@ -358,15 +358,181 @@ export interface Frame {
358
358
  export type Segment = (TextSegment | ChatSegment | ArticleSegment | VideoSegment | QuestionSegment | RoleplaySegment | InterviewSegment | EmbedSegment | WidgetSegment) & {
359
359
  frames?: Frame[];
360
360
  };
361
+ import { type ImportedOutcome } from "./flattener/index.js";
362
+ import { type DroppedEntry } from "./dropped.js";
363
+ import { type ErrorCandidate } from "./dedupe-errors.js";
364
+ import { type ParsedLearningOutcome } from "./parser/learning-outcome.js";
365
+ import { type UuidEntry } from "./validator/uuid.js";
361
366
  import { type TranscriptSentence, type VideoSkip } from "./bundler/video.js";
362
367
  export type { TranscriptSentence, VideoSkip } from "./bundler/video.js";
363
368
  export { parseWidget, isWidgetPath, isWidgetFile } from "./parser/widget.js";
364
- import { type GlossaryDefinition, type GlossaryMark } from "./glossary.js";
369
+ import { type GlossaryDefinition, type GlossaryEntry, type GlossaryMark } from "./glossary.js";
365
370
  import { type OptionalLensSet } from "./validator/optional-lens-sets.js";
366
371
  export type { ContentTier } from "./validator/tier.js";
367
372
  export { checkTierViolation } from "./validator/tier.js";
368
- import { type SkillTree } from "./skill-tree.js";
373
+ import { type SkillTree, type SkillTreeModule } from "./skill-tree.js";
369
374
  export type { SkillTree, SkillTreeCard, SkillTreeDomain, SkillTreeTopic, TaughtByCourse, TaughtByModule, } from "./skill-tree.js";
375
+ import { type ParsedDomainMetadata, type ParsedTopicFile } from "./parser/domain.js";
370
376
  import { FileResultCache } from "./cache.js";
377
+ import { RunInputs } from "./dependency-cache.js";
371
378
  export { FileResultCache } from "./cache.js";
379
+ import { type ContentViews, type TierMap } from "./engine/reader.js";
380
+ /** A Learning Outcome a module file imports, and the submodule it sits in. */
381
+ interface ModuleLoRef {
382
+ lo: string;
383
+ submodule: {
384
+ slug: string;
385
+ title: string;
386
+ } | null;
387
+ }
388
+ /**
389
+ * What one content file adds to the whole content: its errors and pages, and
390
+ * its entries in the tables that wholeContentStep builds across files. A unit
391
+ * reads other files only through its views and never another unit's result,
392
+ * so units are independent: they can run in any order, alone, or be reused
393
+ * from an earlier build (src/engine/build.ts). Arrays keep the order today's
394
+ * single pass pushed in; the other fields are keyed by this file's path.
395
+ */
396
+ export interface PathContribution {
397
+ path: string;
398
+ errors: ContentError[];
399
+ /** The pages this file produces, in output order. */
400
+ modules: FlattenedModule[];
401
+ urls: UrlToValidate[];
402
+ uuids: UuidEntry[];
403
+ course?: Course;
404
+ survey?: FlattenedSurvey;
405
+ meetingDoc?: string;
406
+ articleSegments?: Segment[];
407
+ /** A module file's slug in course progressions (a split module's parent slug). */
408
+ moduleSlug?: string;
409
+ skillTreeModule?: SkillTreeModule;
410
+ learningOutcome?: ParsedLearningOutcome;
411
+ loRefs?: ModuleLoRef[];
412
+ /** The `Domains and Topics/` folder this file is in. */
413
+ domainFolder?: {
414
+ dir: string;
415
+ number: number;
416
+ title: string;
417
+ metadata?: ParsedDomainMetadata;
418
+ };
419
+ topic?: ParsedTopicFile & {
420
+ domainDir: string;
421
+ };
422
+ glossaryEntry?: GlossaryEntry;
423
+ /** What errors left out of this file's pages, or the page it could not make (src/dropped.ts). */
424
+ dropped?: DroppedEntry[];
425
+ }
426
+ /** One file's pass: parse it, run its own checks, and flatten its pages. */
427
+ export declare function runPathUnit(path: string, { files, tierMap, tagMap }: ContentViews, steps?: RunInputs): PathContribution;
372
428
  export declare function processContent(files: Map<string, string>, cache?: FileResultCache): ProcessResult;
429
+ /**
430
+ * Everything after the file units: the whole-content step, every page
431
+ * finished, and the errors in today's order. `units` holds one entry per
432
+ * content file, in path order; their pages are finished in place. The engine
433
+ * runs the same three steps on stored results (engine/build.ts), so a rule
434
+ * changes in one place for both.
435
+ */
436
+ export declare function assembleContent(units: PathContribution[], views: ContentViews): ProcessResult;
437
+ /** What the whole-content step needs to know of one flattened page. */
438
+ export interface PageFacts {
439
+ slug: string;
440
+ parentSlug?: string;
441
+ /** The contentId of every section that has one, in section order. */
442
+ contentIds: string[];
443
+ /** Every test section that names its outcome file: the outcomes it tests. */
444
+ tests: {
445
+ sourcePath: string;
446
+ outcomes: LearningOutcomeRef[];
447
+ }[];
448
+ }
449
+ /** A unit's contribution as the whole-content step reads it: no page bodies. */
450
+ export type UnitSummary = Omit<PathContribution, "modules"> & {
451
+ pages: PageFacts[];
452
+ };
453
+ export declare function summarizeUnit({ modules, ...unit }: PathContribution): UnitSummary;
454
+ /**
455
+ * The whole-content tables that finishing a page reads. The engine reads
456
+ * them through recording views (engine/tables.ts), so a page is finished
457
+ * again when an entry it used changes.
458
+ */
459
+ export interface FinishTables {
460
+ /** Lens content id → the module page that holds it (the last in page order; standalone lens pages never). */
461
+ contentIdToModule: ReadonlyMap<string, string>;
462
+ /** Glossary entry file → its entry. */
463
+ glossary: ReadonlyMap<string, GlossaryEntry>;
464
+ /** Module group (`parentSlug ?? slug`) → the content ids of its sections. */
465
+ moduleContentIds: ReadonlyMap<string, string[]>;
466
+ /** Page slug → its file (the last page with the slug wins). */
467
+ slugToPath: ReadonlyMap<string, string>;
468
+ /** Page key → for each course the page is in, in course order, the outcomes tested in that course. */
469
+ courseOutcomes: ReadonlyMap<string, ImportedOutcome[][]>;
470
+ /** Learning outcome id → its primary skill-tree topic. */
471
+ topics: ReadonlyMap<string, NonNullable<LearningOutcomeRef["topic"]>>;
472
+ }
473
+ /** What the whole-content step builds: tables, outputs, and its checks' errors. */
474
+ export interface WholeContent {
475
+ /** Errors of the checks across files, by their place in today's order (assembleErrors). */
476
+ errors: {
477
+ glossaryAliases: ContentError[];
478
+ courses: ContentError[];
479
+ uuids: ContentError[];
480
+ slugsAndTranscripts: ContentError[];
481
+ skillTree: ContentError[];
482
+ };
483
+ tables: FinishTables;
484
+ courses: Course[];
485
+ surveys: FlattenedSurvey[];
486
+ meetingDocs: Record<string, string>;
487
+ urlsToValidate: UrlToValidate[];
488
+ skillTree: SkillTree;
489
+ articleSegments: Record<string, Segment[]>;
490
+ }
491
+ /**
492
+ * The whole-content step: merge every file's summary into the tables that
493
+ * span files and run the checks across files. It reads facts and page
494
+ * summaries, never a page body. `units` holds one entry per content file, in
495
+ * path order; their courses and question entries are changed in place.
496
+ */
497
+ export declare function wholeContentStep(units: Iterable<UnitSummary>, { files, tierMap, tagMap }: ContentViews): WholeContent;
498
+ /** What finishing one page reports, by each list's place in today's order (assembleErrors). */
499
+ export interface PageFinish {
500
+ glossary: ContentError[];
501
+ cardMembership: ContentError[];
502
+ optionalLensSets: ContentError[];
503
+ sharedQuestions: ErrorCandidate[];
504
+ integrity: ErrorCandidate[];
505
+ }
506
+ /**
507
+ * Finish one flattened page with what other pages contribute: a card's and a
508
+ * lens link's module, glossary marks, optional-lens lists, outcomes tested
509
+ * elsewhere in a course, and outcome topics; and run the checks on the
510
+ * finished page. Changes `page` in place, so it starts from a page fresh
511
+ * from flattening: a card's module, once set, is never cleared. `key` is
512
+ * pageKey of the page.
513
+ *
514
+ * Anything a page takes from other pages belongs here, never in flattening.
515
+ * Flattening runs in one file's unit before the other units have run, so a
516
+ * value it took from another page would go stale when that page changes,
517
+ * with no test failing at once.
518
+ */
519
+ export declare function finishPage(page: FlattenedModule, key: string, tables: FinishTables, { files, tierMap }: ContentViews): PageFinish;
520
+ /**
521
+ * The final error list in today's order: every unit's errors in path order,
522
+ * then the checks after the file units in the order they ran, the page
523
+ * checks in page order within their step. Each error gets its category (the
524
+ * tier of its file), and dedupeErrors' rule keeps the first copy. `sources`
525
+ * names, for each final error, the sources (as given) that reported it.
526
+ */
527
+ export declare function assembleErrors(units: Iterable<{
528
+ source: string;
529
+ errors: ContentError[];
530
+ }>, whole: WholeContent["errors"], pages: readonly {
531
+ source: string;
532
+ finish: PageFinish;
533
+ }[], tierMap: TierMap): {
534
+ errors: ContentError[];
535
+ sources: string[][];
536
+ };
537
+ /** The ProcessResult of finished pages, the whole-content step and the final errors. */
538
+ export declare function processResult(modules: FlattenedModule[], whole: WholeContent, errors: ContentError[]): ProcessResult;