@primmel/primmel 1.11.1 → 1.13.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 (104) hide show
  1. package/dist/src/check-rules.d.ts.map +1 -1
  2. package/dist/src/check-rules.js +71 -0
  3. package/dist/src/check-rules.js.map +1 -1
  4. package/dist/src/check.d.ts.map +1 -1
  5. package/dist/src/check.js +457 -3
  6. package/dist/src/check.js.map +1 -1
  7. package/dist/src/model-diff.d.ts.map +1 -1
  8. package/dist/src/model-diff.js +22 -0
  9. package/dist/src/model-diff.js.map +1 -1
  10. package/dist/src/ser-des/config/calculation.d.ts.map +1 -1
  11. package/dist/src/ser-des/config/calculation.js +134 -18
  12. package/dist/src/ser-des/config/calculation.js.map +1 -1
  13. package/dist/src/ser-des/config/commonTestCondition.d.ts +5 -0
  14. package/dist/src/ser-des/config/commonTestCondition.d.ts.map +1 -0
  15. package/dist/src/ser-des/config/commonTestCondition.js +75 -0
  16. package/dist/src/ser-des/config/commonTestCondition.js.map +1 -0
  17. package/dist/src/ser-des/config/documentModule.d.ts +5 -0
  18. package/dist/src/ser-des/config/documentModule.d.ts.map +1 -0
  19. package/dist/src/ser-des/config/documentModule.js +109 -0
  20. package/dist/src/ser-des/config/documentModule.js.map +1 -0
  21. package/dist/src/ser-des/config/formulaNote.d.ts +5 -0
  22. package/dist/src/ser-des/config/formulaNote.d.ts.map +1 -0
  23. package/dist/src/ser-des/config/formulaNote.js +66 -0
  24. package/dist/src/ser-des/config/formulaNote.js.map +1 -0
  25. package/dist/src/ser-des/config/index.d.ts.map +1 -1
  26. package/dist/src/ser-des/config/index.js +98 -0
  27. package/dist/src/ser-des/config/index.js.map +1 -1
  28. package/dist/src/ser-des/config/informativeAnnex.d.ts +5 -0
  29. package/dist/src/ser-des/config/informativeAnnex.d.ts.map +1 -0
  30. package/dist/src/ser-des/config/informativeAnnex.js +185 -0
  31. package/dist/src/ser-des/config/informativeAnnex.js.map +1 -0
  32. package/dist/src/ser-des/config/partAnnex.d.ts +5 -0
  33. package/dist/src/ser-des/config/partAnnex.d.ts.map +1 -0
  34. package/dist/src/ser-des/config/partAnnex.js +91 -0
  35. package/dist/src/ser-des/config/partAnnex.js.map +1 -0
  36. package/dist/src/ser-des/config/process.d.ts.map +1 -1
  37. package/dist/src/ser-des/config/process.js +369 -3
  38. package/dist/src/ser-des/config/process.js.map +1 -1
  39. package/dist/src/ser-des/config/processModel.d.ts +13 -0
  40. package/dist/src/ser-des/config/processModel.d.ts.map +1 -0
  41. package/dist/src/ser-des/config/processModel.js +163 -0
  42. package/dist/src/ser-des/config/processModel.js.map +1 -0
  43. package/dist/src/ser-des/config/schemeType.d.ts +7 -0
  44. package/dist/src/ser-des/config/schemeType.d.ts.map +1 -0
  45. package/dist/src/ser-des/config/schemeType.js +232 -0
  46. package/dist/src/ser-des/config/schemeType.js.map +1 -0
  47. package/dist/src/ser-des/config/storyline.d.ts +7 -0
  48. package/dist/src/ser-des/config/storyline.d.ts.map +1 -0
  49. package/dist/src/ser-des/config/storyline.js +264 -0
  50. package/dist/src/ser-des/config/storyline.js.map +1 -0
  51. package/dist/src/ser-des/config/subject.d.ts.map +1 -1
  52. package/dist/src/ser-des/config/subject.js +93 -0
  53. package/dist/src/ser-des/config/subject.js.map +1 -1
  54. package/dist/src/ser-des/package.d.ts.map +1 -1
  55. package/dist/src/ser-des/package.js +36 -8
  56. package/dist/src/ser-des/package.js.map +1 -1
  57. package/dist/src/ser-des/parse.d.ts.map +1 -1
  58. package/dist/src/ser-des/parse.js +13 -0
  59. package/dist/src/ser-des/parse.js.map +1 -1
  60. package/dist/src/ser-des/types.d.ts +22 -0
  61. package/dist/src/ser-des/types.d.ts.map +1 -1
  62. package/dist/src/types/Calculation.d.ts +35 -0
  63. package/dist/src/types/Calculation.d.ts.map +1 -1
  64. package/dist/src/types/CommonTestCondition.d.ts +15 -0
  65. package/dist/src/types/CommonTestCondition.d.ts.map +1 -0
  66. package/dist/src/types/CommonTestCondition.js +22 -0
  67. package/dist/src/types/CommonTestCondition.js.map +1 -0
  68. package/dist/src/types/DocumentModule.d.ts +27 -0
  69. package/dist/src/types/DocumentModule.d.ts.map +1 -0
  70. package/dist/src/types/DocumentModule.js +38 -0
  71. package/dist/src/types/DocumentModule.js.map +1 -0
  72. package/dist/src/types/InformativeAnnex.d.ts +44 -0
  73. package/dist/src/types/InformativeAnnex.d.ts.map +1 -0
  74. package/dist/src/types/InformativeAnnex.js +35 -0
  75. package/dist/src/types/InformativeAnnex.js.map +1 -0
  76. package/dist/src/types/Package.d.ts +7 -3
  77. package/dist/src/types/Package.d.ts.map +1 -1
  78. package/dist/src/types/PartAnnex.d.ts +18 -0
  79. package/dist/src/types/PartAnnex.d.ts.map +1 -0
  80. package/dist/src/types/PartAnnex.js +29 -0
  81. package/dist/src/types/PartAnnex.js.map +1 -0
  82. package/dist/src/types/ProcessModel.d.ts +27 -0
  83. package/dist/src/types/ProcessModel.d.ts.map +1 -0
  84. package/dist/src/types/ProcessModel.js +31 -0
  85. package/dist/src/types/ProcessModel.js.map +1 -0
  86. package/dist/src/types/SchemeType.d.ts +51 -0
  87. package/dist/src/types/SchemeType.d.ts.map +1 -0
  88. package/dist/src/types/SchemeType.js +41 -0
  89. package/dist/src/types/SchemeType.js.map +1 -0
  90. package/dist/src/types/Standard.d.ts +36 -0
  91. package/dist/src/types/Standard.d.ts.map +1 -1
  92. package/dist/src/types/Storyline.d.ts +62 -0
  93. package/dist/src/types/Storyline.d.ts.map +1 -0
  94. package/dist/src/types/Storyline.js +51 -0
  95. package/dist/src/types/Storyline.js.map +1 -0
  96. package/dist/src/types/Subject.d.ts +33 -0
  97. package/dist/src/types/Subject.d.ts.map +1 -1
  98. package/dist/src/types/Symbol.d.ts +17 -0
  99. package/dist/src/types/Symbol.d.ts.map +1 -1
  100. package/dist/src/types/process.d.ts +99 -1
  101. package/dist/src/types/process.d.ts.map +1 -1
  102. package/dist-browser/index.mjs +1791 -988
  103. package/dist-cli/primmel.mjs +2131 -56
  104. package/package.json +1 -1
@@ -195,6 +195,8 @@ function parse(mmelString, parsers, options = {}) {
195
195
  approvals: {},
196
196
  roles: {},
197
197
  processes: {},
198
+ // The abstract-process models (smart TODO.roadmap/40 batch 2)
199
+ processModels: {},
198
200
  pages: {},
199
201
  gateways: {},
200
202
  regs: {},
@@ -218,11 +220,16 @@ function parse(mmelString, parsers, options = {}) {
218
220
  forms: {},
219
221
  subforms: {},
220
222
  symbols: {},
223
+ formulaNotes: {},
221
224
  calculations: {},
222
225
  verdicts: {},
223
226
  referenceMaterials: {},
224
227
  testPointSets: {},
228
+ commonTestConditions: {},
225
229
  competenceKinds: {},
230
+ // The ISO/IEC 17067 scheme-type register (smart TODO.roadmap/40 batch 2)
231
+ schemeActivityKinds: {},
232
+ schemeTypes: {},
226
233
  predicates: {},
227
234
  constraints: {},
228
235
  discrepancyRecords: {},
@@ -261,6 +268,12 @@ function parse(mmelString, parsers, options = {}) {
261
268
  documentPrecedences: {},
262
269
  autoInclusions: {},
263
270
  decisionRules: {},
271
+ // The document modules + informative annexes (smart TODO.roadmap/40 batch 2)
272
+ documentModules: {},
273
+ informativeAnnexes: {},
274
+ partAnnexes: {},
275
+ demoWorlds: {},
276
+ storylines: {},
264
277
  // Primmel v3 twin interface (TODO.roadmap/32)
265
278
  connectorProfiles: {},
266
279
  // Primmel v3 continuous compliance (TODO.roadmap/34)
@@ -2364,15 +2377,18 @@ function parseParamList(block, allowInitial = false) {
2364
2377
  const t = tokenize(block);
2365
2378
  let i = 0;
2366
2379
  while (i < t.length) {
2367
- const name = stripColon(t[i++]);
2380
+ const head = t[i++];
2381
+ const name = stripColon(head);
2368
2382
  if (!name) {
2369
2383
  break;
2370
2384
  }
2371
- let type = "";
2385
+ let typed = head.endsWith(":");
2372
2386
  if (i < t.length && t[i] === ":") {
2387
+ typed = true;
2373
2388
  i++;
2374
2389
  }
2375
- if (i < t.length) {
2390
+ let type = "";
2391
+ if (typed && i < t.length) {
2376
2392
  type = stripWrapping(t[i++]);
2377
2393
  }
2378
2394
  const param = { name, type };
@@ -2532,6 +2548,131 @@ function parseSegregation(block) {
2532
2548
  }
2533
2549
  return out;
2534
2550
  }
2551
+ function parseProcessEvidence(block) {
2552
+ const out = [];
2553
+ const t = tokenize(block);
2554
+ let i = 0;
2555
+ while (i < t.length) {
2556
+ const eid = stripWrapping(t[i++]);
2557
+ if (!eid) {
2558
+ break;
2559
+ }
2560
+ const entry = { id: eid, description: "", required: false };
2561
+ if (i < t.length && t[i].startsWith("{")) {
2562
+ forEachEntry(
2563
+ unwrapBlock(t[i++]),
2564
+ (keyword, value) => {
2565
+ if (keyword === "description") {
2566
+ entry.description = stripWrapping(value());
2567
+ } else if (keyword === "required") {
2568
+ entry.required = stripWrapping(value()) === "true";
2569
+ } else {
2570
+ return false;
2571
+ }
2572
+ return true;
2573
+ },
2574
+ { construct: "process evidence", id: eid }
2575
+ );
2576
+ }
2577
+ out.push(entry);
2578
+ }
2579
+ return out;
2580
+ }
2581
+ function parseProcessDecision(block) {
2582
+ const decision = { rule: "", clause: "" };
2583
+ forEachEntry(
2584
+ block,
2585
+ (keyword, value) => {
2586
+ if (keyword === "rule") {
2587
+ decision.rule = stripWrapping(value());
2588
+ } else if (keyword === "clause") {
2589
+ decision.clause = stripWrapping(value());
2590
+ } else {
2591
+ return false;
2592
+ }
2593
+ return true;
2594
+ },
2595
+ { construct: "process decision", id: "" }
2596
+ );
2597
+ return decision;
2598
+ }
2599
+ function parseProcessDeclaration(block) {
2600
+ const declaration = { kind: "", action: "" };
2601
+ forEachEntry(
2602
+ block,
2603
+ (keyword, value) => {
2604
+ if (keyword === "kind") {
2605
+ declaration.kind = stripWrapping(value());
2606
+ } else if (keyword === "action") {
2607
+ declaration.action = stripWrapping(value());
2608
+ } else {
2609
+ return false;
2610
+ }
2611
+ return true;
2612
+ },
2613
+ { construct: "process declaration", id: "" }
2614
+ );
2615
+ return declaration;
2616
+ }
2617
+ function parseProcessWindows(block) {
2618
+ const out = [];
2619
+ const t = tokenize(block);
2620
+ let i = 0;
2621
+ while (i < t.length) {
2622
+ const cmd = t[i++];
2623
+ if (cmd !== "window") {
2624
+ i = skipUnknownEntry(t, i);
2625
+ continue;
2626
+ }
2627
+ const wid = stripWrapping(t[i++]);
2628
+ const entry = {
2629
+ id: wid,
2630
+ kind: "",
2631
+ clause: "",
2632
+ anchor: "",
2633
+ applies_to: "",
2634
+ windowYears: 0,
2635
+ windowMonths: 0,
2636
+ breach: "",
2637
+ description: ""
2638
+ };
2639
+ if (i < t.length && t[i].startsWith("{")) {
2640
+ forEachEntry(
2641
+ unwrapBlock(t[i++]),
2642
+ (keyword, value) => {
2643
+ if (keyword === "kind") {
2644
+ entry.kind = stripWrapping(value());
2645
+ } else if (keyword === "clause") {
2646
+ entry.clause = stripWrapping(value());
2647
+ } else if (keyword === "anchor") {
2648
+ entry.anchor = stripWrapping(value());
2649
+ } else if (keyword === "applies_to") {
2650
+ entry.applies_to = stripWrapping(value());
2651
+ } else if (keyword === "window") {
2652
+ const wt = tokenizePackage(unwrapBlock(value()));
2653
+ for (let k = 0; k + 1 < wt.length; k += 2) {
2654
+ if (wt[k] === "years") {
2655
+ entry.windowYears = parseInt(stripWrapping(wt[k + 1]), 10) || 0;
2656
+ } else if (wt[k] === "months") {
2657
+ entry.windowMonths = parseInt(stripWrapping(wt[k + 1]), 10) || 0;
2658
+ }
2659
+ }
2660
+ } else if (keyword === "breach") {
2661
+ entry.breach = stripWrapping(value());
2662
+ } else if (keyword === "description") {
2663
+ entry.description = stripWrapping(value());
2664
+ } else {
2665
+ return false;
2666
+ }
2667
+ return true;
2668
+ },
2669
+ { construct: "process window", id: wid }
2670
+ );
2671
+ }
2672
+ out.push(entry);
2673
+ }
2674
+ return out;
2675
+ }
2535
2676
  function parseProcessInstances(block) {
2536
2677
  const out = { by: "", values: {} };
2537
2678
  const t = tokenize(block);
@@ -2783,6 +2924,18 @@ var parseProcess = function(id, data) {
2783
2924
  instances: null,
2784
2925
  childComposition: "all",
2785
2926
  does: null,
2927
+ // The abstract-process model (smart TODO.roadmap/40 batch 2)
2928
+ summary: "",
2929
+ roles: [],
2930
+ organs: [],
2931
+ participantKinds: [],
2932
+ evidence: [],
2933
+ decision: null,
2934
+ declaration: null,
2935
+ dischargesGate: "",
2936
+ realizedBy: [],
2937
+ approvedBy: [],
2938
+ windows: [],
2786
2939
  source: null,
2787
2940
  provisionRefs: [],
2788
2941
  _relations: {
@@ -2863,6 +3016,28 @@ var parseProcess = function(id, data) {
2863
3016
  result.invariants = parseOclList(unwrapBlock(value()));
2864
3017
  } else if (keyword === "activity_kind") {
2865
3018
  result.activityKinds = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3019
+ } else if (keyword === "summary") {
3020
+ result.summary = unwrapped(value);
3021
+ } else if (keyword === "roles") {
3022
+ result.roles = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3023
+ } else if (keyword === "organs") {
3024
+ result.organs = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3025
+ } else if (keyword === "participant_kinds") {
3026
+ result.participantKinds = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3027
+ } else if (keyword === "evidence") {
3028
+ result.evidence = parseProcessEvidence(unwrapBlock(value()));
3029
+ } else if (keyword === "decision") {
3030
+ result.decision = parseProcessDecision(unwrapBlock(value()));
3031
+ } else if (keyword === "declaration") {
3032
+ result.declaration = parseProcessDeclaration(unwrapBlock(value()));
3033
+ } else if (keyword === "discharges_gate") {
3034
+ result.dischargesGate = stripWrapping(value());
3035
+ } else if (keyword === "realized_by") {
3036
+ result.realizedBy = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3037
+ } else if (keyword === "approved_by") {
3038
+ result.approvedBy = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3039
+ } else if (keyword === "windows") {
3040
+ result.windows = parseProcessWindows(unwrapBlock(value()));
2866
3041
  } else if (keyword === "segregation") {
2867
3042
  result.segregation = parseSegregation(unwrapBlock(value()));
2868
3043
  } else if (keyword === "preconditions") {
@@ -3046,6 +3221,9 @@ function dumpDoes(flow) {
3046
3221
  var dumpProcess = function(process2, ctx) {
3047
3222
  let out = "process " + process2.id + " {\n";
3048
3223
  out += ' name "' + escapeString(process2.name) + '"\n';
3224
+ if (process2.summary) {
3225
+ out += ' summary "' + escapeString(process2.summary) + '"\n';
3226
+ }
3049
3227
  if (process2.actor !== null) {
3050
3228
  out += " actor " + process2.actor.id + "\n";
3051
3229
  }
@@ -3096,6 +3274,94 @@ var dumpProcess = function(process2, ctx) {
3096
3274
  if (process2.activityKinds && process2.activityKinds.length > 0) {
3097
3275
  out += " activity_kind { " + process2.activityKinds.map(dumpBareSafe).join(" ") + " }\n";
3098
3276
  }
3277
+ if (process2.roles && process2.roles.length > 0) {
3278
+ out += " roles { " + process2.roles.map(dumpBareSafe).join(" ") + " }\n";
3279
+ }
3280
+ if (process2.organs && process2.organs.length > 0) {
3281
+ out += " organs { " + process2.organs.map(dumpBareSafe).join(" ") + " }\n";
3282
+ }
3283
+ if (process2.participantKinds && process2.participantKinds.length > 0) {
3284
+ out += " participant_kinds { " + process2.participantKinds.map(dumpBareSafe).join(" ") + " }\n";
3285
+ }
3286
+ if (process2.evidence && process2.evidence.length > 0) {
3287
+ out += " evidence {\n";
3288
+ for (const e of process2.evidence) {
3289
+ out += " " + dumpBareSafe(e.id) + " {";
3290
+ if (e.description) {
3291
+ out += ' description "' + escapeString(e.description) + '"';
3292
+ }
3293
+ if (e.required) {
3294
+ out += " required true";
3295
+ }
3296
+ out += " }\n";
3297
+ }
3298
+ out += " }\n";
3299
+ }
3300
+ if (process2.decision) {
3301
+ out += " decision {";
3302
+ if (process2.decision.rule) {
3303
+ out += " rule " + dumpBareSafe(process2.decision.rule);
3304
+ }
3305
+ if (process2.decision.clause) {
3306
+ out += ' clause "' + escapeString(process2.decision.clause) + '"';
3307
+ }
3308
+ out += " }\n";
3309
+ }
3310
+ if (process2.declaration) {
3311
+ out += " declaration {";
3312
+ if (process2.declaration.kind) {
3313
+ out += " kind " + dumpBareSafe(process2.declaration.kind);
3314
+ }
3315
+ if (process2.declaration.action) {
3316
+ out += " action " + dumpBareSafe(process2.declaration.action);
3317
+ }
3318
+ out += " }\n";
3319
+ }
3320
+ if (process2.dischargesGate) {
3321
+ out += " discharges_gate " + dumpBareSafe(process2.dischargesGate) + "\n";
3322
+ }
3323
+ if (process2.realizedBy && process2.realizedBy.length > 0) {
3324
+ out += " realized_by { " + process2.realizedBy.map(dumpBareSafe).join(" ") + " }\n";
3325
+ }
3326
+ if (process2.approvedBy && process2.approvedBy.length > 0) {
3327
+ out += " approved_by { " + process2.approvedBy.map(dumpBareSafe).join(" ") + " }\n";
3328
+ }
3329
+ if (process2.windows && process2.windows.length > 0) {
3330
+ out += " windows {\n";
3331
+ for (const w of process2.windows) {
3332
+ out += " window " + dumpBareSafe(w.id) + " {\n";
3333
+ if (w.kind) {
3334
+ out += " kind " + dumpBareSafe(w.kind) + "\n";
3335
+ }
3336
+ if (w.clause) {
3337
+ out += ' clause "' + escapeString(w.clause) + '"\n';
3338
+ }
3339
+ if (w.anchor) {
3340
+ out += " anchor " + dumpBareSafe(w.anchor) + "\n";
3341
+ }
3342
+ if (w.applies_to) {
3343
+ out += " applies_to " + dumpBareSafe(w.applies_to) + "\n";
3344
+ }
3345
+ if (w.windowYears > 0 || w.windowMonths > 0) {
3346
+ out += " window {";
3347
+ if (w.windowYears > 0) {
3348
+ out += " years " + w.windowYears;
3349
+ }
3350
+ if (w.windowMonths > 0) {
3351
+ out += " months " + w.windowMonths;
3352
+ }
3353
+ out += " }\n";
3354
+ }
3355
+ if (w.breach) {
3356
+ out += " breach " + dumpBareSafe(w.breach) + "\n";
3357
+ }
3358
+ if (w.description) {
3359
+ out += ' description "' + escapeString(w.description) + '"\n';
3360
+ }
3361
+ out += " }\n";
3362
+ }
3363
+ out += " }\n";
3364
+ }
3099
3365
  if (process2.segregation && process2.segregation.length > 0) {
3100
3366
  out += " segregation {\n";
3101
3367
  for (const s of process2.segregation) {
@@ -3180,6 +3446,125 @@ var dumpProcess = function(process2, ctx) {
3180
3446
  return out;
3181
3447
  };
3182
3448
 
3449
+ // src/ser-des/config/processModel.ts
3450
+ function parseProcessSequence(block) {
3451
+ return tokenizePackage(block).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3452
+ }
3453
+ function parseProcessRegister(id, block) {
3454
+ const register = {
3455
+ id,
3456
+ label: "",
3457
+ clause: "",
3458
+ maintainer: "",
3459
+ published: "",
3460
+ entries: ""
3461
+ };
3462
+ forEachEntry(
3463
+ block,
3464
+ (keyword, value) => {
3465
+ if (keyword === "label") {
3466
+ register.label = stripWrapping(value());
3467
+ } else if (keyword === "clause") {
3468
+ register.clause = stripWrapping(value());
3469
+ } else if (keyword === "maintainer") {
3470
+ register.maintainer = stripWrapping(value());
3471
+ } else if (keyword === "published") {
3472
+ register.published = stripWrapping(value());
3473
+ } else if (keyword === "entries") {
3474
+ register.entries = stripWrapping(value());
3475
+ } else {
3476
+ return false;
3477
+ }
3478
+ return true;
3479
+ },
3480
+ { construct: "process_model register", id }
3481
+ );
3482
+ return register;
3483
+ }
3484
+ var parseProcessModel = (id, data) => {
3485
+ const model = {
3486
+ id,
3487
+ sequence: [],
3488
+ registers: [],
3489
+ source: { doc: "", clause: "" }
3490
+ };
3491
+ forEachEntry(
3492
+ data,
3493
+ (keyword, value, peek) => {
3494
+ if (keyword === "sequence") {
3495
+ model.sequence = parseProcessSequence(unwrapBlock(value()));
3496
+ } else if (keyword === "register") {
3497
+ const regId = stripWrapping(value());
3498
+ const head = peek();
3499
+ if (head === void 0 || !head.startsWith("{")) {
3500
+ throw new Error(
3501
+ `Parsing error: process_model. ID ${id}: register ${regId} is missing its block`
3502
+ );
3503
+ }
3504
+ model.registers.push(parseProcessRegister(regId, unwrapBlock(value())));
3505
+ } else if (keyword === "source") {
3506
+ model.source = readSource(unwrapBlock(value()));
3507
+ } else {
3508
+ return false;
3509
+ }
3510
+ return true;
3511
+ },
3512
+ { construct: "process_model", id }
3513
+ );
3514
+ return (ctx) => {
3515
+ ctx.processModels[id] = model;
3516
+ return ctx;
3517
+ };
3518
+ };
3519
+ function dumpProcessSequence(sequence) {
3520
+ if (sequence.length === 0) {
3521
+ return "";
3522
+ }
3523
+ return "sequence { " + sequence.map(dumpBareSafe).join(" ") + " }";
3524
+ }
3525
+ function dumpProcessRegister(r, indent) {
3526
+ let out = indent + "register " + dumpBareSafe(r.id) + " {\n";
3527
+ if (r.label) {
3528
+ out += indent + ' label "' + escapeString(r.label) + '"\n';
3529
+ }
3530
+ if (r.clause) {
3531
+ out += indent + ' clause "' + escapeString(r.clause) + '"\n';
3532
+ }
3533
+ if (r.maintainer) {
3534
+ out += indent + " maintainer " + dumpBareSafe(r.maintainer) + "\n";
3535
+ }
3536
+ if (r.published) {
3537
+ out += indent + ' published "' + escapeString(r.published) + '"\n';
3538
+ }
3539
+ if (r.entries) {
3540
+ out += indent + ' entries "' + escapeString(r.entries) + '"\n';
3541
+ }
3542
+ out += indent + "}\n";
3543
+ return out;
3544
+ }
3545
+ var dumpProcessModel = function(m) {
3546
+ let out = "process_model " + m.id + " {\n";
3547
+ const seq = dumpProcessSequence(m.sequence);
3548
+ if (seq) {
3549
+ out += " " + seq + "\n";
3550
+ }
3551
+ for (const r of m.registers) {
3552
+ out += dumpProcessRegister(r, " ");
3553
+ }
3554
+ if (m.source.doc || m.source.clause) {
3555
+ out += " source {\n";
3556
+ if (m.source.doc) {
3557
+ out += ' doc "' + escapeString(m.source.doc) + '"\n';
3558
+ }
3559
+ if (m.source.clause) {
3560
+ out += ' clause "' + escapeString(m.source.clause) + '"\n';
3561
+ }
3562
+ out += " }\n";
3563
+ }
3564
+ out += "}\n";
3565
+ return out;
3566
+ };
3567
+
3183
3568
  // src/ser-des/config/provision.ts
3184
3569
  var parseProvision = function(id, data) {
3185
3570
  const result = {
@@ -5283,6 +5668,47 @@ var dumpSymbol = function(s) {
5283
5668
  return out;
5284
5669
  };
5285
5670
 
5671
+ // src/ser-des/config/formulaNote.ts
5672
+ function readIdList(block) {
5673
+ return tokenize(stripWrapping(block)).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
5674
+ }
5675
+ var parseFormulaNote = (id, data) => {
5676
+ const note = {
5677
+ id,
5678
+ text: "",
5679
+ appliesTo: []
5680
+ };
5681
+ forEachEntry(
5682
+ data,
5683
+ (keyword, value) => {
5684
+ if (keyword === "text") {
5685
+ note.text = stripWrapping(value());
5686
+ } else if (keyword === "applies_to") {
5687
+ note.appliesTo = readIdList(value());
5688
+ } else {
5689
+ return false;
5690
+ }
5691
+ return true;
5692
+ },
5693
+ { construct: "formula_note", id }
5694
+ );
5695
+ return (ctx) => {
5696
+ ctx.formulaNotes[id] = note;
5697
+ return ctx;
5698
+ };
5699
+ };
5700
+ var dumpFormulaNote = function(n) {
5701
+ let out = "formula_note " + n.id + " {\n";
5702
+ if (n.text) {
5703
+ out += ' text "' + escapeString(n.text) + '"\n';
5704
+ }
5705
+ if (n.appliesTo.length > 0) {
5706
+ out += " applies_to { " + n.appliesTo.map(dumpBareSafe).join(" ") + " }\n";
5707
+ }
5708
+ out += "}\n";
5709
+ return out;
5710
+ };
5711
+
5286
5712
  // src/ser-des/config/calculation.ts
5287
5713
  var parseCalculation = function(id, data) {
5288
5714
  const result = {
@@ -5375,6 +5801,16 @@ var parseCalculation = function(id, data) {
5375
5801
  result.lookup = parseLookup(unwrapBlock(t[i++]));
5376
5802
  } else if (command === "profile") {
5377
5803
  result.profile = stripWrapping(t[i++]);
5804
+ } else if (command === "variant") {
5805
+ const vid = stripWrapping(t[i++]);
5806
+ if (i >= t.length || !t[i].startsWith("{")) {
5807
+ throw new Error(
5808
+ `Parsing error: calculation. ID ${id}: variant ${vid} is missing its block`
5809
+ );
5810
+ }
5811
+ (result.variants ??= []).push(
5812
+ parseVariant(vid, unwrapBlock(t[i++]), id)
5813
+ );
5378
5814
  } else {
5379
5815
  i++;
5380
5816
  }
@@ -5590,6 +6026,102 @@ function parseLookup(block) {
5590
6026
  }
5591
6027
  return lookup;
5592
6028
  }
6029
+ var VARIANT_TYPES = [
6030
+ "expression",
6031
+ "table_lookup",
6032
+ "profile_lookup",
6033
+ "pass_fail"
6034
+ ];
6035
+ function parseVariant(vid, block, calcId) {
6036
+ const variant = {
6037
+ id: vid,
6038
+ type: "",
6039
+ label: "",
6040
+ description: "",
6041
+ params: [],
6042
+ expression: "",
6043
+ lookup: null,
6044
+ profile: ""
6045
+ };
6046
+ const t = tokenizePackage(block);
6047
+ let i = 0;
6048
+ while (i < t.length) {
6049
+ const cmd = t[i++];
6050
+ if (i >= t.length) {
6051
+ break;
6052
+ }
6053
+ if (cmd === "type") {
6054
+ const type = stripWrapping(t[i++]);
6055
+ if (!VARIANT_TYPES.includes(type)) {
6056
+ throw new Error(
6057
+ `Parsing error: calculation. ID ${calcId}: variant ${vid}: Unknown variant type "${type}" (valid: ${VARIANT_TYPES.join(", ")})`
6058
+ );
6059
+ }
6060
+ variant.type = type;
6061
+ } else if (cmd === "label") {
6062
+ variant.label = stripWrapping(t[i++]);
6063
+ } else if (cmd === "description") {
6064
+ variant.description = stripWrapping(t[i++]);
6065
+ } else if (cmd === "params") {
6066
+ variant.params = tokenize(stripWrapping(t[i++])).map(stripWrapping).filter((s) => s.length > 0);
6067
+ } else if (cmd === "expression") {
6068
+ variant.expression = stripWrapping(t[i++]);
6069
+ } else if (cmd === "lookup") {
6070
+ variant.lookup = parseLookup(unwrapBlock(t[i++]));
6071
+ } else if (cmd === "profile") {
6072
+ variant.profile = stripWrapping(t[i++]);
6073
+ } else {
6074
+ unwrapBlock(t[i++]);
6075
+ }
6076
+ }
6077
+ return variant;
6078
+ }
6079
+ function dumpLookupFields(l) {
6080
+ let out = "";
6081
+ if (l.key) {
6082
+ out += "key " + l.key + " ";
6083
+ }
6084
+ if (l.variable) {
6085
+ out += "variable " + l.variable + " ";
6086
+ }
6087
+ if (l.multiplier) {
6088
+ out += "multiplier " + l.multiplier + " ";
6089
+ }
6090
+ if (l.defaultTier) {
6091
+ out += "default_tier { factor " + l.defaultTier.factor;
6092
+ if (l.defaultTier.mode) {
6093
+ out += " mode " + l.defaultTier.mode;
6094
+ }
6095
+ out += " } ";
6096
+ }
6097
+ return out;
6098
+ }
6099
+ function dumpVariant(v) {
6100
+ let out = " variant " + dumpBareSafe(v.id) + " {\n";
6101
+ if (v.type) {
6102
+ out += " type " + v.type + "\n";
6103
+ }
6104
+ if (v.label) {
6105
+ out += ' label "' + escapeString(v.label) + '"\n';
6106
+ }
6107
+ if (v.description) {
6108
+ out += ' description "' + escapeString(v.description) + '"\n';
6109
+ }
6110
+ if (v.params.length > 0) {
6111
+ out += " params { " + v.params.map(dumpBareSafe).join(" ") + " }\n";
6112
+ }
6113
+ if (v.expression) {
6114
+ out += ' expression "' + escapeString(v.expression) + '"\n';
6115
+ }
6116
+ if (v.lookup) {
6117
+ out += " lookup { " + dumpLookupFields(v.lookup) + "}\n";
6118
+ }
6119
+ if (v.profile) {
6120
+ out += " profile " + dumpBareSafe(v.profile) + "\n";
6121
+ }
6122
+ out += " }\n";
6123
+ return out;
6124
+ }
5593
6125
  var resolveCalculation = function(ctx, unresolved) {
5594
6126
  const ref = [];
5595
6127
  for (const id of unresolved._relations.ref) {
@@ -5678,28 +6210,14 @@ var dumpCalculation = function(c) {
5678
6210
  out += " params { " + c.params.join(" ") + " }\n";
5679
6211
  }
5680
6212
  if (c.lookup) {
5681
- out += " lookup { ";
5682
- if (c.lookup.key) {
5683
- out += "key " + c.lookup.key + " ";
5684
- }
5685
- if (c.lookup.variable) {
5686
- out += "variable " + c.lookup.variable + " ";
5687
- }
5688
- if (c.lookup.multiplier) {
5689
- out += "multiplier " + c.lookup.multiplier + " ";
5690
- }
5691
- if (c.lookup.defaultTier) {
5692
- out += "default_tier { factor " + c.lookup.defaultTier.factor;
5693
- if (c.lookup.defaultTier.mode) {
5694
- out += " mode " + c.lookup.defaultTier.mode;
5695
- }
5696
- out += " } ";
5697
- }
5698
- out += "}\n";
6213
+ out += " lookup { " + dumpLookupFields(c.lookup) + "}\n";
5699
6214
  }
5700
6215
  if (c.profile) {
5701
6216
  out += " profile " + c.profile + "\n";
5702
6217
  }
6218
+ for (const v of c.variants ?? []) {
6219
+ out += dumpVariant(v);
6220
+ }
5703
6221
  for (const src of c.sourceRefs ?? (c.sourceRef && (c.sourceRef.doc || c.sourceRef.clause) ? [c.sourceRef] : [])) {
5704
6222
  out += dumpSourceRefAsRef(src, " ", escapeString);
5705
6223
  }
@@ -8072,7 +8590,7 @@ var VALID_SERIES_REDUCTIONS = [
8072
8590
  "worst_case",
8073
8591
  "max_abs_over_window"
8074
8592
  ];
8075
- function readIdList(block) {
8593
+ function readIdList2(block) {
8076
8594
  return tokenize(stripWrapping(block)).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
8077
8595
  }
8078
8596
  var parseVerdict = function(id, data) {
@@ -8112,7 +8630,7 @@ var parseVerdict = function(id, data) {
8112
8630
  } else if (keyword === "derive" || keyword === "expression") {
8113
8631
  result.derive = unwrapped(value);
8114
8632
  } else if (keyword === "inputs" || keyword === "uses") {
8115
- result.inputs = readIdList(value());
8633
+ result.inputs = readIdList2(value());
8116
8634
  } else if (keyword === "series_reduction") {
8117
8635
  const v = value();
8118
8636
  if (!VALID_SERIES_REDUCTIONS.includes(v)) {
@@ -8457,6 +8975,202 @@ var dumpReferenceMaterial = function(m) {
8457
8975
  return out;
8458
8976
  };
8459
8977
 
8978
+ // src/ser-des/config/schemeType.ts
8979
+ var SCHEME_ACTIVITY_FAMILIES = [
8980
+ "common",
8981
+ "determination",
8982
+ "attestation",
8983
+ "surveillance"
8984
+ ];
8985
+ var ATTESTATION_OBJECTS = [
8986
+ "product_type",
8987
+ "batch",
8988
+ "ongoing_production",
8989
+ "service_or_process"
8990
+ ];
8991
+ function parseKindList(value) {
8992
+ return tokenizePackage(unwrapBlock(value)).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
8993
+ }
8994
+ var parseSchemeActivityKind = (id, data) => {
8995
+ const kind = {
8996
+ id,
8997
+ family: "common",
8998
+ row: "",
8999
+ label: "",
9000
+ source: { doc: "", clause: "" }
9001
+ };
9002
+ forEachEntry(
9003
+ data,
9004
+ (keyword, value) => {
9005
+ if (keyword === "family") {
9006
+ const family = stripWrapping(value());
9007
+ if (!SCHEME_ACTIVITY_FAMILIES.includes(family)) {
9008
+ throw new Error(
9009
+ `Parsing error: scheme_activity_kind. ID ${id}: Unknown family "${family}" (valid: ${SCHEME_ACTIVITY_FAMILIES.join(", ")})`
9010
+ );
9011
+ }
9012
+ kind.family = family;
9013
+ } else if (keyword === "row") {
9014
+ kind.row = stripWrapping(value());
9015
+ } else if (keyword === "label") {
9016
+ kind.label = stripWrapping(value());
9017
+ } else if (keyword === "source") {
9018
+ kind.source = readSource(unwrapBlock(value()));
9019
+ } else {
9020
+ return false;
9021
+ }
9022
+ return true;
9023
+ },
9024
+ { construct: "scheme_activity_kind", id }
9025
+ );
9026
+ return (ctx) => {
9027
+ ctx.schemeActivityKinds[id] = kind;
9028
+ return ctx;
9029
+ };
9030
+ };
9031
+ function parseSchemeSurveillance(block) {
9032
+ const surveillance = { required: false, activities: [] };
9033
+ forEachEntry(
9034
+ block,
9035
+ (keyword, value) => {
9036
+ if (keyword === "required") {
9037
+ surveillance.required = stripWrapping(value()) === "true";
9038
+ } else if (keyword === "activities") {
9039
+ surveillance.activities = parseKindList(value());
9040
+ } else {
9041
+ return false;
9042
+ }
9043
+ return true;
9044
+ },
9045
+ { construct: "scheme_type surveillance", id: "" }
9046
+ );
9047
+ return surveillance;
9048
+ }
9049
+ var parseSchemeType = (id, data) => {
9050
+ const type = {
9051
+ id,
9052
+ label: "",
9053
+ clause: "",
9054
+ description: "",
9055
+ sampling: "",
9056
+ attestationObject: "",
9057
+ determination: [],
9058
+ attestation: [],
9059
+ surveillance: null,
9060
+ notes: [],
9061
+ source: { doc: "", clause: "" }
9062
+ };
9063
+ forEachEntry(
9064
+ data,
9065
+ (keyword, value) => {
9066
+ if (keyword === "label") {
9067
+ type.label = stripWrapping(value());
9068
+ } else if (keyword === "clause") {
9069
+ type.clause = stripWrapping(value());
9070
+ } else if (keyword === "description") {
9071
+ type.description = stripWrapping(value());
9072
+ } else if (keyword === "sampling") {
9073
+ type.sampling = stripWrapping(value());
9074
+ } else if (keyword === "attestation_object") {
9075
+ const object = stripWrapping(value());
9076
+ if (!ATTESTATION_OBJECTS.includes(object)) {
9077
+ throw new Error(
9078
+ `Parsing error: scheme_type. ID ${id}: Unknown attestation_object "${object}" (valid: ${ATTESTATION_OBJECTS.join(", ")})`
9079
+ );
9080
+ }
9081
+ type.attestationObject = object;
9082
+ } else if (keyword === "determination") {
9083
+ type.determination = parseKindList(value());
9084
+ } else if (keyword === "attestation") {
9085
+ type.attestation = parseKindList(value());
9086
+ } else if (keyword === "surveillance") {
9087
+ type.surveillance = parseSchemeSurveillance(unwrapBlock(value()));
9088
+ } else if (keyword === "notes") {
9089
+ type.notes = tokenizePackage(unwrapBlock(value())).map(stripWrapping).filter((s) => s.length > 0);
9090
+ } else if (keyword === "source") {
9091
+ type.source = readSource(unwrapBlock(value()));
9092
+ } else {
9093
+ return false;
9094
+ }
9095
+ return true;
9096
+ },
9097
+ { construct: "scheme_type", id }
9098
+ );
9099
+ return (ctx) => {
9100
+ ctx.schemeTypes[id] = type;
9101
+ return ctx;
9102
+ };
9103
+ };
9104
+ function dumpSource(source, indent) {
9105
+ if (!source.doc && !source.clause) {
9106
+ return "";
9107
+ }
9108
+ let out = indent + "source {\n";
9109
+ if (source.doc) {
9110
+ out += indent + ' doc "' + escapeString(source.doc) + '"\n';
9111
+ }
9112
+ if (source.clause) {
9113
+ out += indent + ' clause "' + escapeString(source.clause) + '"\n';
9114
+ }
9115
+ out += indent + "}\n";
9116
+ return out;
9117
+ }
9118
+ var dumpSchemeActivityKind = function(k) {
9119
+ let out = "scheme_activity_kind " + k.id + " {\n";
9120
+ out += " family " + k.family + "\n";
9121
+ if (k.row) {
9122
+ out += ' row "' + escapeString(k.row) + '"\n';
9123
+ }
9124
+ if (k.label) {
9125
+ out += ' label "' + escapeString(k.label) + '"\n';
9126
+ }
9127
+ out += dumpSource(k.source, " ");
9128
+ out += "}\n";
9129
+ return out;
9130
+ };
9131
+ var dumpSchemeType = function(t) {
9132
+ let out = "scheme_type " + t.id + " {\n";
9133
+ if (t.label) {
9134
+ out += ' label "' + escapeString(t.label) + '"\n';
9135
+ }
9136
+ if (t.clause) {
9137
+ out += ' clause "' + escapeString(t.clause) + '"\n';
9138
+ }
9139
+ if (t.description) {
9140
+ out += ' description "' + escapeString(t.description) + '"\n';
9141
+ }
9142
+ if (t.sampling) {
9143
+ out += ' sampling "' + escapeString(t.sampling) + '"\n';
9144
+ }
9145
+ if (t.attestationObject) {
9146
+ out += " attestation_object " + t.attestationObject + "\n";
9147
+ }
9148
+ if (t.determination.length > 0) {
9149
+ out += " determination { " + t.determination.map(dumpBareSafe).join(" ") + " }\n";
9150
+ }
9151
+ if (t.attestation.length > 0) {
9152
+ out += " attestation { " + t.attestation.map(dumpBareSafe).join(" ") + " }\n";
9153
+ }
9154
+ if (t.surveillance) {
9155
+ out += " surveillance {\n";
9156
+ out += " required " + (t.surveillance.required ? "true" : "false") + "\n";
9157
+ if (t.surveillance.activities.length > 0) {
9158
+ out += " activities { " + t.surveillance.activities.map(dumpBareSafe).join(" ") + " }\n";
9159
+ }
9160
+ out += " }\n";
9161
+ }
9162
+ if (t.notes.length > 0) {
9163
+ out += " notes {\n";
9164
+ for (const n of t.notes) {
9165
+ out += ' "' + escapeString(n) + '"\n';
9166
+ }
9167
+ out += " }\n";
9168
+ }
9169
+ out += dumpSource(t.source, " ");
9170
+ out += "}\n";
9171
+ return out;
9172
+ };
9173
+
8460
9174
  // src/ser-des/config/predicate.ts
8461
9175
  var parsePredicate = function(id, data) {
8462
9176
  const result = {
@@ -8889,8 +9603,65 @@ var dumpTestPointSet = function(s) {
8889
9603
  return out;
8890
9604
  };
8891
9605
 
9606
+ // src/ser-des/config/commonTestCondition.ts
9607
+ var parseCommonTestCondition = (id, data) => {
9608
+ const condition = {
9609
+ id,
9610
+ title: "",
9611
+ reference: "",
9612
+ description: "",
9613
+ source: null
9614
+ };
9615
+ forEachEntry(
9616
+ data,
9617
+ (keyword, value) => {
9618
+ if (keyword === "title") {
9619
+ condition.title = stripWrapping(value());
9620
+ } else if (keyword === "reference") {
9621
+ condition.reference = stripWrapping(value());
9622
+ } else if (keyword === "description") {
9623
+ condition.description = stripWrapping(value());
9624
+ } else if (keyword === "source") {
9625
+ condition.source = readSource(unwrapBlock(value()));
9626
+ } else {
9627
+ return false;
9628
+ }
9629
+ return true;
9630
+ },
9631
+ { construct: "common_test_condition", id }
9632
+ );
9633
+ return (ctx) => {
9634
+ ctx.commonTestConditions[id] = condition;
9635
+ return ctx;
9636
+ };
9637
+ };
9638
+ var dumpCommonTestCondition = function(c) {
9639
+ let out = "common_test_condition " + c.id + " {\n";
9640
+ if (c.title) {
9641
+ out += ' title "' + escapeString(c.title) + '"\n';
9642
+ }
9643
+ if (c.reference) {
9644
+ out += ' reference "' + escapeString(c.reference) + '"\n';
9645
+ }
9646
+ if (c.description) {
9647
+ out += ' description "' + escapeString(c.description) + '"\n';
9648
+ }
9649
+ if (c.source && (c.source.doc || c.source.clause)) {
9650
+ out += " source {\n";
9651
+ if (c.source.doc) {
9652
+ out += ' doc "' + escapeString(c.source.doc) + '"\n';
9653
+ }
9654
+ if (c.source.clause) {
9655
+ out += ' clause "' + escapeString(c.source.clause) + '"\n';
9656
+ }
9657
+ out += " }\n";
9658
+ }
9659
+ out += "}\n";
9660
+ return out;
9661
+ };
9662
+
8892
9663
  // src/ser-des/config/requirement.ts
8893
- function readIdList2(block) {
9664
+ function readIdList3(block) {
8894
9665
  return tokenize(stripWrapping(block)).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
8895
9666
  }
8896
9667
  function readAccepts(block) {
@@ -8943,7 +9714,7 @@ function readLimit(block) {
8943
9714
  if (cmd === "expression") {
8944
9715
  limit.expression = stripWrapping(t[i++]);
8945
9716
  } else if (cmd === "uses") {
8946
- limit.uses = readIdList2(t[i++]);
9717
+ limit.uses = readIdList3(t[i++]);
8947
9718
  } else if (cmd === "modality") {
8948
9719
  limit.modality = stripWrapping(t[i++]);
8949
9720
  } else if (cmd === "relative_to") {
@@ -9082,7 +9853,7 @@ function readParameters(block) {
9082
9853
  }
9083
9854
  }
9084
9855
  } else if (pc === "enum_values") {
9085
- param.enumValues = readIdList2(pt[j++]);
9856
+ param.enumValues = readIdList3(pt[j++]);
9086
9857
  } else {
9087
9858
  unwrapBlock(pt[j++]);
9088
9859
  }
@@ -9126,7 +9897,7 @@ var parseRequirement = function(id, data) {
9126
9897
  } else if (cmd === "guidance") {
9127
9898
  result.guidance = stripWrapping(t[i++]);
9128
9899
  } else if (cmd === "binds_to") {
9129
- result.bindsTo = readIdList2(t[i++]);
9900
+ result.bindsTo = readIdList3(t[i++]);
9130
9901
  } else if (cmd === "subjects") {
9131
9902
  result.subjects = readSubjects(unwrapBlock(t[i++]));
9132
9903
  } else if (cmd === "parameters") {
@@ -9161,7 +9932,7 @@ var parseRequirement = function(id, data) {
9161
9932
  }
9162
9933
  }
9163
9934
  } else if (cmd === "dependencies") {
9164
- result.dependencies = readIdList2(t[i++]);
9935
+ result.dependencies = readIdList3(t[i++]);
9165
9936
  } else if (cmd === "source_discrepancy") {
9166
9937
  result.sourceDiscrepancy = parseSourceDiscrepancy(unwrapBlock(t[i++]));
9167
9938
  } else if (cmd === "source" || cmd === "reference") {
@@ -9375,9 +10146,9 @@ var parseRequirementClass = function(id, data) {
9375
10146
  } else if (cmd === "applicability") {
9376
10147
  result.applicability = parseApplicability(unwrapBlock(t[i++]));
9377
10148
  } else if (cmd === "dependencies") {
9378
- result.dependencies = readIdList2(t[i++]);
10149
+ result.dependencies = readIdList3(t[i++]);
9379
10150
  } else if (cmd === "reference") {
9380
- result.referenceIds = readIdList2(t[i++]);
10151
+ result.referenceIds = readIdList3(t[i++]);
9381
10152
  } else {
9382
10153
  i = skipUnknownValue(t, i, cmd);
9383
10154
  }
@@ -10074,7 +10845,7 @@ function dumpComposedOf(decl, indent) {
10074
10845
  }
10075
10846
 
10076
10847
  // src/ser-des/config/subject.ts
10077
- function dumpSource(keyword, src, indent) {
10848
+ function dumpSource2(keyword, src, indent) {
10078
10849
  if (!src || !src.doc && !src.clause) {
10079
10850
  return "";
10080
10851
  }
@@ -10082,7 +10853,7 @@ function dumpSource(keyword, src, indent) {
10082
10853
  return `${indent}${keyword} { doc "${escapeString(src.doc)}" clause "${escapeString(src.clause)}"${frag} }
10083
10854
  `;
10084
10855
  }
10085
- function readIdList3(block) {
10856
+ function readIdList4(block) {
10086
10857
  return tokenize(stripWrapping(block)).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
10087
10858
  }
10088
10859
  function dumpIdList(keyword, ids, indent) {
@@ -10219,9 +10990,9 @@ var parseInstrument = function(id, data) {
10219
10990
  break;
10220
10991
  }
10221
10992
  if (fc === "dimensions") {
10222
- result.familyDefaultDimensions = readIdList3(ft[j++]);
10993
+ result.familyDefaultDimensions = readIdList4(ft[j++]);
10223
10994
  } else if (fc === "parameters") {
10224
- result.familyDefaultParameters = readIdList3(ft[j++]);
10995
+ result.familyDefaultParameters = readIdList4(ft[j++]);
10225
10996
  } else {
10226
10997
  unwrapBlock(ft[j++]);
10227
10998
  }
@@ -10445,7 +11216,7 @@ function parseDimensionValues(block) {
10445
11216
  } else if (cmd === "description") {
10446
11217
  value.description = stripWrapping(vt[j++]);
10447
11218
  } else if (cmd === "implies") {
10448
- value.implies = readIdList3(vt[j++]);
11219
+ value.implies = readIdList4(vt[j++]);
10449
11220
  } else if (cmd === "term_ref") {
10450
11221
  value.termRef = stripWrapping(vt[j++]);
10451
11222
  } else if (cmd === "payload") {
@@ -10509,7 +11280,7 @@ function dumpDimension(d, indent) {
10509
11280
  if (d.description) {
10510
11281
  out += inner + 'description "' + escapeString(d.description) + '"\n';
10511
11282
  }
10512
- out += dumpSource("reference", d.source, inner);
11283
+ out += dumpSource2("reference", d.source, inner);
10513
11284
  if (d.valuesOf) {
10514
11285
  out += inner + "values_of " + d.valuesOf + "\n";
10515
11286
  }
@@ -10575,9 +11346,9 @@ function parseModelGroup(block) {
10575
11346
  if (cmd === "definition") {
10576
11347
  mg.definition = stripWrapping(t[i++]);
10577
11348
  } else if (cmd === "identical_characteristics") {
10578
- mg.identicalCharacteristics = readIdList3(t[i++]);
11349
+ mg.identicalCharacteristics = readIdList4(t[i++]);
10579
11350
  } else if (cmd === "identical_attributes") {
10580
- mg.identicalAttributes = readIdList3(t[i++]);
11351
+ mg.identicalAttributes = readIdList4(t[i++]);
10581
11352
  } else if (cmd === "group_by") {
10582
11353
  mg.groupBy = stripWrapping(t[i++]);
10583
11354
  } else if (cmd === "note") {
@@ -10631,7 +11402,7 @@ var dumpInstrument = function(inst) {
10631
11402
  }
10632
11403
  out += " }\n";
10633
11404
  }
10634
- out += dumpSource("source", m.source, " ");
11405
+ out += dumpSource2("source", m.source, " ");
10635
11406
  out += " }\n";
10636
11407
  }
10637
11408
  for (const c of inst.components ?? []) {
@@ -10671,7 +11442,7 @@ var dumpInstrument = function(inst) {
10671
11442
  if (s.note) {
10672
11443
  out += ' note "' + escapeString(s.note) + '"\n';
10673
11444
  }
10674
- out += dumpSource("source", s.source, " ");
11445
+ out += dumpSource2("source", s.source, " ");
10675
11446
  out += " }\n";
10676
11447
  }
10677
11448
  if (inst.definition) {
@@ -10751,7 +11522,7 @@ var dumpInstrument = function(inst) {
10751
11522
  out += dumpSourceRefAsRef(s, " ", escapeString);
10752
11523
  }
10753
11524
  for (const s of inst.modelGroup.sampleSelection ?? []) {
10754
- out += dumpSource("sample_selection", s, " ");
11525
+ out += dumpSource2("sample_selection", s, " ");
10755
11526
  }
10756
11527
  out += " }\n";
10757
11528
  }
@@ -10770,6 +11541,80 @@ var dumpInstrument = function(inst) {
10770
11541
  out += "}\n";
10771
11542
  return out;
10772
11543
  };
11544
+ function parsePairList(block) {
11545
+ const decl = {
11546
+ key: "",
11547
+ value: "",
11548
+ keyDimension: "",
11549
+ components: []
11550
+ };
11551
+ const t = tokenize(block);
11552
+ let i = 0;
11553
+ while (i < t.length) {
11554
+ const cmd = t[i++];
11555
+ if (i > t.length) {
11556
+ break;
11557
+ }
11558
+ if (cmd === "key") {
11559
+ decl.key = stripWrapping(t[i++]);
11560
+ } else if (cmd === "value") {
11561
+ decl.value = stripWrapping(t[i++]);
11562
+ } else if (cmd === "key_dimension") {
11563
+ decl.keyDimension = stripWrapping(t[i++]);
11564
+ } else if (cmd === "component") {
11565
+ const cid = stripWrapping(t[i++]);
11566
+ const component = { id: cid, name: "", source: null };
11567
+ if (i < t.length && t[i].startsWith("{")) {
11568
+ const et = tokenize(unwrapBlock(t[i++]));
11569
+ let j = 0;
11570
+ while (j < et.length) {
11571
+ const ec = et[j++];
11572
+ if (j >= et.length) {
11573
+ break;
11574
+ }
11575
+ if (ec === "name") {
11576
+ component.name = stripWrapping(et[j++]);
11577
+ } else if (ec === "source") {
11578
+ component.source = readSource(unwrapBlock(et[j++]));
11579
+ } else {
11580
+ unwrapBlock(et[j++]);
11581
+ }
11582
+ }
11583
+ }
11584
+ decl.components.push(component);
11585
+ } else {
11586
+ i = skipUnknownValue(t, i, cmd);
11587
+ }
11588
+ }
11589
+ return decl;
11590
+ }
11591
+ function dumpPairList(decl) {
11592
+ let out = " pair_list {\n";
11593
+ out += " key " + dumpBareSafe(decl.key) + "\n";
11594
+ out += " value " + dumpBareSafe(decl.value) + "\n";
11595
+ if (decl.keyDimension) {
11596
+ out += " key_dimension " + dumpBareSafe(decl.keyDimension) + "\n";
11597
+ }
11598
+ for (const c of decl.components) {
11599
+ out += " component " + dumpBareSafe(c.id) + " {\n";
11600
+ if (c.name) {
11601
+ out += ' name "' + escapeString(c.name) + '"\n';
11602
+ }
11603
+ if (c.source && (c.source.doc || c.source.clause)) {
11604
+ out += " source {\n";
11605
+ if (c.source.doc) {
11606
+ out += ' doc "' + escapeString(c.source.doc) + '"\n';
11607
+ }
11608
+ if (c.source.clause) {
11609
+ out += ' clause "' + escapeString(c.source.clause) + '"\n';
11610
+ }
11611
+ out += " }\n";
11612
+ }
11613
+ out += " }\n";
11614
+ }
11615
+ out += " }\n";
11616
+ return out;
11617
+ }
10773
11618
  var parseAttributeDefinition = function(id, data) {
10774
11619
  const result = {
10775
11620
  id,
@@ -10814,6 +11659,8 @@ var parseAttributeDefinition = function(id, data) {
10814
11659
  result.unit = stripWrapping(t[i++]);
10815
11660
  } else if (cmd === "value_type") {
10816
11661
  result.valueType = stripWrapping(t[i++]);
11662
+ } else if (cmd === "pair_list") {
11663
+ result.pairList = parsePairList(unwrapBlock(t[i++]));
10817
11664
  } else if (cmd === "origin") {
10818
11665
  result.origin = stripWrapping(t[i++]);
10819
11666
  } else if (cmd === "scope") {
@@ -10825,7 +11672,7 @@ var parseAttributeDefinition = function(id, data) {
10825
11672
  } else if (cmd === "enum") {
10826
11673
  result.enumRef = stripWrapping(t[i++]);
10827
11674
  } else if (cmd === "enum_values") {
10828
- result.enumValues = readIdList3(t[i++]);
11675
+ result.enumValues = readIdList4(t[i++]);
10829
11676
  } else if (cmd === "note") {
10830
11677
  result.note = stripWrapping(t[i++]);
10831
11678
  } else if (cmd === "irdi") {
@@ -10885,6 +11732,9 @@ var dumpAttributeDefinition = function(a) {
10885
11732
  if (a.valueType) {
10886
11733
  out += " value_type " + a.valueType + "\n";
10887
11734
  }
11735
+ if (a.pairList) {
11736
+ out += dumpPairList(a.pairList);
11737
+ }
10888
11738
  if (a.origin) {
10889
11739
  out += " origin " + a.origin + "\n";
10890
11740
  }
@@ -10942,11 +11792,11 @@ var parseCapability = function(id, data) {
10942
11792
  } else if (cmd === "abstract") {
10943
11793
  result.abstract = stripWrapping(t[i++]) === "true";
10944
11794
  } else if (cmd === "extends") {
10945
- result.extends = readIdList3(t[i++]);
11795
+ result.extends = readIdList4(t[i++]);
10946
11796
  } else if (cmd === "requires") {
10947
- result.requires = readIdList3(t[i++]);
11797
+ result.requires = readIdList4(t[i++]);
10948
11798
  } else if (cmd === "has_parameters") {
10949
- result.hasParameters = readIdList3(t[i++]);
11799
+ result.hasParameters = readIdList4(t[i++]);
10950
11800
  } else if (cmd === "satisfies_requirements") {
10951
11801
  result.satisfiesRequirements = readReference(t[i++]);
10952
11802
  } else if (cmd === "verified_by_tests" || cmd === "verified_by") {
@@ -11473,7 +12323,7 @@ function readPromises(block) {
11473
12323
  } else if (cmd === "statement") {
11474
12324
  p.statement = stripWrapping(inner[j++]);
11475
12325
  } else if (cmd === "verified_by") {
11476
- p.verifiedBy = readIdList3(inner[j++]);
12326
+ p.verifiedBy = readIdList4(inner[j++]);
11477
12327
  } else if (cmd === "source") {
11478
12328
  p.source = readSource(unwrapBlock(inner[j++]));
11479
12329
  } else {
@@ -11763,7 +12613,7 @@ function dumpSubjectPromises(promises) {
11763
12613
  out += ' statement "' + escapeString(p.statement) + '"\n';
11764
12614
  }
11765
12615
  out += dumpIdList("verified_by", p.verifiedBy, " ");
11766
- out += dumpSource("source", p.source ?? null, " ");
12616
+ out += dumpSource2("source", p.source ?? null, " ");
11767
12617
  out += " }\n";
11768
12618
  }
11769
12619
  out += " }\n";
@@ -11795,7 +12645,7 @@ function dumpSubjectCharacteristics(map) {
11795
12645
  if (c.unit) {
11796
12646
  out += ' unit "' + escapeString(c.unit) + '"\n';
11797
12647
  }
11798
- out += dumpSource("source", c.source ?? null, " ");
12648
+ out += dumpSource2("source", c.source ?? null, " ");
11799
12649
  out += " }\n";
11800
12650
  continue;
11801
12651
  }
@@ -12067,7 +12917,7 @@ var instanceConstruct = {
12067
12917
  };
12068
12918
 
12069
12919
  // src/ser-des/config/artifact.ts
12070
- function readIdList4(block) {
12920
+ function readIdList5(block) {
12071
12921
  return tokenize(stripWrapping(block)).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
12072
12922
  }
12073
12923
  function dumpIdList2(keyword, ids, indent) {
@@ -12128,7 +12978,7 @@ function readContractMedia(block) {
12128
12978
  break;
12129
12979
  }
12130
12980
  if (cmd === "kinds") {
12131
- m.kinds = readIdList4(inner[j++]);
12981
+ m.kinds = readIdList5(inner[j++]);
12132
12982
  } else if (cmd === "role") {
12133
12983
  m.role = stripWrapping(inner[j++]);
12134
12984
  } else {
@@ -12321,7 +13171,7 @@ var parseArtifactInstance = function(id, data) {
12321
13171
  } else if (cmd === "content") {
12322
13172
  result.content = readValueMap2(unwrapBlock(t[i++]));
12323
13173
  } else if (cmd === "links") {
12324
- result.links = readIdList4(t[i++]);
13174
+ result.links = readIdList5(t[i++]);
12325
13175
  } else if (cmd === "reference") {
12326
13176
  result.referenceIds = readReference3(t[i++]);
12327
13177
  } else {
@@ -15247,6 +16097,568 @@ var dumpDecisionRule = function(r) {
15247
16097
  return out;
15248
16098
  };
15249
16099
 
16100
+ // src/ser-des/config/documentModule.ts
16101
+ var parseDocumentModule = (id, data) => {
16102
+ const module = {
16103
+ id,
16104
+ document: "",
16105
+ title: "",
16106
+ edition: "",
16107
+ year: 0,
16108
+ namespace: "",
16109
+ sequence: [],
16110
+ registers: [],
16111
+ source: { doc: "", clause: "" }
16112
+ };
16113
+ forEachEntry(
16114
+ data,
16115
+ (keyword, value, peek) => {
16116
+ if (keyword === "document") {
16117
+ module.document = stripWrapping(value());
16118
+ } else if (keyword === "title") {
16119
+ module.title = stripWrapping(value());
16120
+ } else if (keyword === "edition") {
16121
+ module.edition = stripWrapping(value());
16122
+ } else if (keyword === "year") {
16123
+ module.year = parseInt(stripWrapping(value()), 10) || 0;
16124
+ } else if (keyword === "namespace") {
16125
+ module.namespace = stripWrapping(value());
16126
+ } else if (keyword === "sequence") {
16127
+ module.sequence = parseProcessSequence(unwrapBlock(value()));
16128
+ } else if (keyword === "register") {
16129
+ const regId = stripWrapping(value());
16130
+ const head = peek();
16131
+ if (head === void 0 || !head.startsWith("{")) {
16132
+ throw new Error(
16133
+ `Parsing error: document_module. ID ${id}: register ${regId} is missing its block`
16134
+ );
16135
+ }
16136
+ module.registers.push(
16137
+ parseProcessRegister(regId, unwrapBlock(value()))
16138
+ );
16139
+ } else if (keyword === "source") {
16140
+ module.source = readSource(unwrapBlock(value()));
16141
+ } else {
16142
+ return false;
16143
+ }
16144
+ return true;
16145
+ },
16146
+ { construct: "document_module", id }
16147
+ );
16148
+ return (ctx) => {
16149
+ ctx.documentModules[id] = module;
16150
+ return ctx;
16151
+ };
16152
+ };
16153
+ var dumpDocumentModule = function(m) {
16154
+ let out = "document_module " + m.id + " {\n";
16155
+ if (m.document) {
16156
+ out += ' document "' + escapeString(m.document) + '"\n';
16157
+ }
16158
+ if (m.title) {
16159
+ out += ' title "' + escapeString(m.title) + '"\n';
16160
+ }
16161
+ if (m.edition) {
16162
+ out += ' edition "' + escapeString(m.edition) + '"\n';
16163
+ }
16164
+ if (m.year) {
16165
+ out += " year " + m.year + "\n";
16166
+ }
16167
+ if (m.namespace) {
16168
+ out += " namespace " + dumpBareSafe(m.namespace) + "\n";
16169
+ }
16170
+ const seq = dumpProcessSequence(m.sequence);
16171
+ if (seq) {
16172
+ out += " " + seq + "\n";
16173
+ }
16174
+ for (const r of m.registers) {
16175
+ out += dumpProcessRegister(r, " ");
16176
+ }
16177
+ if (m.source.doc || m.source.clause) {
16178
+ out += " source {\n";
16179
+ if (m.source.doc) {
16180
+ out += ' doc "' + escapeString(m.source.doc) + '"\n';
16181
+ }
16182
+ if (m.source.clause) {
16183
+ out += ' clause "' + escapeString(m.source.clause) + '"\n';
16184
+ }
16185
+ out += " }\n";
16186
+ }
16187
+ out += "}\n";
16188
+ return out;
16189
+ };
16190
+
16191
+ // src/ser-des/config/informativeAnnex.ts
16192
+ var ANNEX_DOCUMENT_ROLES = ["informative"];
16193
+ function parseAnnexDocument(block, annexId) {
16194
+ const doc = {
16195
+ id: "",
16196
+ title: "",
16197
+ edition: 0,
16198
+ year: 0,
16199
+ role: "",
16200
+ source: ""
16201
+ };
16202
+ forEachEntry(
16203
+ block,
16204
+ (keyword, value) => {
16205
+ if (keyword === "id") {
16206
+ doc.id = stripWrapping(value());
16207
+ } else if (keyword === "title") {
16208
+ doc.title = stripWrapping(value());
16209
+ } else if (keyword === "edition") {
16210
+ doc.edition = parseInt(stripWrapping(value()), 10) || 0;
16211
+ } else if (keyword === "year") {
16212
+ doc.year = parseInt(stripWrapping(value()), 10) || 0;
16213
+ } else if (keyword === "role") {
16214
+ const role = stripWrapping(value());
16215
+ if (!ANNEX_DOCUMENT_ROLES.includes(role)) {
16216
+ throw new Error(
16217
+ `Parsing error: informative_annex. ID ${annexId}: Unknown document role "${role}" (valid: ${ANNEX_DOCUMENT_ROLES.join(", ")})`
16218
+ );
16219
+ }
16220
+ doc.role = role;
16221
+ } else if (keyword === "source") {
16222
+ doc.source = stripWrapping(value());
16223
+ } else {
16224
+ return false;
16225
+ }
16226
+ return true;
16227
+ },
16228
+ { construct: "informative_annex document", id: annexId }
16229
+ );
16230
+ return doc;
16231
+ }
16232
+ function parseAnnexHighlight(id, block) {
16233
+ const highlight = {
16234
+ id,
16235
+ clause: "",
16236
+ title: "",
16237
+ statement: "",
16238
+ dischargedBy: ""
16239
+ };
16240
+ forEachEntry(
16241
+ block,
16242
+ (keyword, value) => {
16243
+ if (keyword === "clause") {
16244
+ highlight.clause = stripWrapping(value());
16245
+ } else if (keyword === "title") {
16246
+ highlight.title = stripWrapping(value());
16247
+ } else if (keyword === "statement") {
16248
+ highlight.statement = stripWrapping(value());
16249
+ } else if (keyword === "discharged_by") {
16250
+ highlight.dischargedBy = stripWrapping(value());
16251
+ } else {
16252
+ return false;
16253
+ }
16254
+ return true;
16255
+ },
16256
+ { construct: "informative_annex highlight", id }
16257
+ );
16258
+ return highlight;
16259
+ }
16260
+ var parseInformativeAnnex = (id, data) => {
16261
+ const annex = {
16262
+ id,
16263
+ document: { id: "", title: "", edition: 0, year: 0, role: "", source: "" },
16264
+ appliesTo: "",
16265
+ appliedBy: "",
16266
+ scope: "",
16267
+ numberingCaution: "",
16268
+ highlights: []
16269
+ };
16270
+ forEachEntry(
16271
+ data,
16272
+ (keyword, value, peek) => {
16273
+ if (keyword === "document") {
16274
+ annex.document = parseAnnexDocument(unwrapBlock(value()), id);
16275
+ } else if (keyword === "applies_to") {
16276
+ annex.appliesTo = stripWrapping(value());
16277
+ } else if (keyword === "applied_by") {
16278
+ annex.appliedBy = stripWrapping(value());
16279
+ } else if (keyword === "scope") {
16280
+ annex.scope = stripWrapping(value());
16281
+ } else if (keyword === "numbering_caution") {
16282
+ annex.numberingCaution = stripWrapping(value());
16283
+ } else if (keyword === "highlight") {
16284
+ const hlId = stripWrapping(value());
16285
+ const head = peek();
16286
+ if (head === void 0 || !head.startsWith("{")) {
16287
+ throw new Error(
16288
+ `Parsing error: informative_annex. ID ${id}: highlight ${hlId} is missing its block`
16289
+ );
16290
+ }
16291
+ annex.highlights.push(parseAnnexHighlight(hlId, unwrapBlock(value())));
16292
+ } else {
16293
+ return false;
16294
+ }
16295
+ return true;
16296
+ },
16297
+ { construct: "informative_annex", id }
16298
+ );
16299
+ return (ctx) => {
16300
+ ctx.informativeAnnexes[id] = annex;
16301
+ return ctx;
16302
+ };
16303
+ };
16304
+ var dumpInformativeAnnex = function(a) {
16305
+ let out = "informative_annex " + a.id + " {\n";
16306
+ out += " document {\n";
16307
+ if (a.document.id) {
16308
+ out += ' id "' + escapeString(a.document.id) + '"\n';
16309
+ }
16310
+ if (a.document.title) {
16311
+ out += ' title "' + escapeString(a.document.title) + '"\n';
16312
+ }
16313
+ if (a.document.edition) {
16314
+ out += " edition " + a.document.edition + "\n";
16315
+ }
16316
+ if (a.document.year) {
16317
+ out += " year " + a.document.year + "\n";
16318
+ }
16319
+ if (a.document.role) {
16320
+ out += " role " + dumpBareSafe(a.document.role) + "\n";
16321
+ }
16322
+ if (a.document.source) {
16323
+ out += ' source "' + escapeString(a.document.source) + '"\n';
16324
+ }
16325
+ out += " }\n";
16326
+ if (a.appliesTo) {
16327
+ out += " applies_to " + dumpBareSafe(a.appliesTo) + "\n";
16328
+ }
16329
+ if (a.appliedBy) {
16330
+ out += ' applied_by "' + escapeString(a.appliedBy) + '"\n';
16331
+ }
16332
+ if (a.scope) {
16333
+ out += ' scope "' + escapeString(a.scope) + '"\n';
16334
+ }
16335
+ if (a.numberingCaution) {
16336
+ out += ' numbering_caution "' + escapeString(a.numberingCaution) + '"\n';
16337
+ }
16338
+ for (const h of a.highlights) {
16339
+ out += " highlight " + dumpBareSafe(h.id) + " {\n";
16340
+ if (h.clause) {
16341
+ out += ' clause "' + escapeString(h.clause) + '"\n';
16342
+ }
16343
+ if (h.title) {
16344
+ out += ' title "' + escapeString(h.title) + '"\n';
16345
+ }
16346
+ if (h.statement) {
16347
+ out += ' statement "' + escapeString(h.statement) + '"\n';
16348
+ }
16349
+ if (h.dischargedBy) {
16350
+ out += ' discharged_by "' + escapeString(h.dischargedBy) + '"\n';
16351
+ }
16352
+ out += " }\n";
16353
+ }
16354
+ out += "}\n";
16355
+ return out;
16356
+ };
16357
+
16358
+ // src/ser-des/config/partAnnex.ts
16359
+ var PART_ANNEX_OBLIGATIONS = ["normative", "informative"];
16360
+ var parsePartAnnex = (id, data) => {
16361
+ const annex = {
16362
+ id,
16363
+ letter: "",
16364
+ title: "",
16365
+ obligation: "",
16366
+ summary: "",
16367
+ realization: "",
16368
+ source: { doc: "", clause: "" }
16369
+ };
16370
+ forEachEntry(
16371
+ data,
16372
+ (keyword, value) => {
16373
+ if (keyword === "letter") {
16374
+ annex.letter = stripWrapping(value());
16375
+ } else if (keyword === "title") {
16376
+ annex.title = stripWrapping(value());
16377
+ } else if (keyword === "obligation") {
16378
+ const obligation = stripWrapping(value());
16379
+ if (!PART_ANNEX_OBLIGATIONS.includes(obligation)) {
16380
+ throw new Error(
16381
+ `Parsing error: part_annex. ID ${id}: Unknown obligation "${obligation}" (valid: ${PART_ANNEX_OBLIGATIONS.join(", ")})`
16382
+ );
16383
+ }
16384
+ annex.obligation = obligation;
16385
+ } else if (keyword === "summary") {
16386
+ annex.summary = stripWrapping(value());
16387
+ } else if (keyword === "realization") {
16388
+ annex.realization = stripWrapping(value());
16389
+ } else if (keyword === "source") {
16390
+ annex.source = readSource(unwrapBlock(value()));
16391
+ } else {
16392
+ return false;
16393
+ }
16394
+ return true;
16395
+ },
16396
+ { construct: "part_annex", id }
16397
+ );
16398
+ return (ctx) => {
16399
+ ctx.partAnnexes[id] = annex;
16400
+ return ctx;
16401
+ };
16402
+ };
16403
+ var dumpPartAnnex = function(a) {
16404
+ let out = "part_annex " + a.id + " {\n";
16405
+ if (a.letter) {
16406
+ out += ' letter "' + escapeString(a.letter) + '"\n';
16407
+ }
16408
+ if (a.title) {
16409
+ out += ' title "' + escapeString(a.title) + '"\n';
16410
+ }
16411
+ if (a.obligation) {
16412
+ out += " obligation " + dumpBareSafe(a.obligation) + "\n";
16413
+ }
16414
+ if (a.summary) {
16415
+ out += ' summary "' + escapeString(a.summary) + '"\n';
16416
+ }
16417
+ if (a.realization) {
16418
+ out += ' realization "' + escapeString(a.realization) + '"\n';
16419
+ }
16420
+ if (a.source.doc || a.source.clause) {
16421
+ out += " source {\n";
16422
+ if (a.source.doc) {
16423
+ out += ' doc "' + escapeString(a.source.doc) + '"\n';
16424
+ }
16425
+ if (a.source.clause) {
16426
+ out += ' clause "' + escapeString(a.source.clause) + '"\n';
16427
+ }
16428
+ out += " }\n";
16429
+ }
16430
+ out += "}\n";
16431
+ return out;
16432
+ };
16433
+
16434
+ // src/ser-des/config/storyline.ts
16435
+ function readRecordValue(token) {
16436
+ if (token.startsWith("{")) {
16437
+ return tokenize(unwrapBlock(token)).filter((s) => s.length > 0).map(coerceValueToken);
16438
+ }
16439
+ return coerceValueToken(token);
16440
+ }
16441
+ function readRecordFields(block) {
16442
+ const fields = {};
16443
+ const t = tokenize(block);
16444
+ let i = 0;
16445
+ while (i < t.length) {
16446
+ const key = t[i++];
16447
+ if (i >= t.length) {
16448
+ break;
16449
+ }
16450
+ fields[stripColon(key)] = readRecordValue(t[i++]);
16451
+ }
16452
+ return fields;
16453
+ }
16454
+ function dumpRecordFields(fields, indent) {
16455
+ let out = "";
16456
+ for (const [key, value] of Object.entries(fields)) {
16457
+ if (Array.isArray(value)) {
16458
+ out += indent + key + " { " + value.map(dumpScalarToken).join(" ") + " }\n";
16459
+ } else {
16460
+ out += indent + key + " " + dumpScalarToken(value) + "\n";
16461
+ }
16462
+ }
16463
+ return out;
16464
+ }
16465
+ function parseParticipants(block) {
16466
+ const sections = [];
16467
+ const t = tokenize(block);
16468
+ let i = 0;
16469
+ while (i < t.length) {
16470
+ const sid = stripWrapping(t[i++]);
16471
+ if (i >= t.length || !t[i].startsWith("{")) {
16472
+ break;
16473
+ }
16474
+ const section = { id: sid, entries: [] };
16475
+ const st = tokenize(unwrapBlock(t[i++]));
16476
+ let j = 0;
16477
+ while (j < st.length) {
16478
+ const eid = stripWrapping(st[j++]);
16479
+ if (j >= st.length || !st[j].startsWith("{")) {
16480
+ break;
16481
+ }
16482
+ section.entries.push({
16483
+ id: eid,
16484
+ fields: readRecordFields(unwrapBlock(st[j++]))
16485
+ });
16486
+ }
16487
+ sections.push(section);
16488
+ }
16489
+ return sections;
16490
+ }
16491
+ var parseDemoWorld = (id, data) => {
16492
+ const world = {
16493
+ id,
16494
+ standard: "",
16495
+ description: "",
16496
+ participants: []
16497
+ };
16498
+ forEachEntry(
16499
+ data,
16500
+ (keyword, value) => {
16501
+ if (keyword === "standard") {
16502
+ world.standard = stripWrapping(value());
16503
+ } else if (keyword === "description") {
16504
+ world.description = stripWrapping(value());
16505
+ } else if (keyword === "participants") {
16506
+ world.participants = parseParticipants(unwrapBlock(value()));
16507
+ } else {
16508
+ return false;
16509
+ }
16510
+ return true;
16511
+ },
16512
+ { construct: "demo_world", id }
16513
+ );
16514
+ return (ctx) => {
16515
+ ctx.demoWorlds[id] = world;
16516
+ return ctx;
16517
+ };
16518
+ };
16519
+ var dumpDemoWorld = function(w) {
16520
+ let out = "demo_world " + w.id + " {\n";
16521
+ if (w.standard) {
16522
+ out += " standard " + dumpBareSafe(w.standard) + "\n";
16523
+ }
16524
+ if (w.description) {
16525
+ out += ' description "' + escapeString(w.description) + '"\n';
16526
+ }
16527
+ if (w.participants.length > 0) {
16528
+ out += " participants {\n";
16529
+ for (const s of w.participants) {
16530
+ out += " " + dumpBareSafe(s.id) + " {\n";
16531
+ for (const e of s.entries) {
16532
+ out += " " + dumpBareSafe(e.id) + " {\n";
16533
+ out += dumpRecordFields(e.fields, " ");
16534
+ out += " }\n";
16535
+ }
16536
+ out += " }\n";
16537
+ }
16538
+ out += " }\n";
16539
+ }
16540
+ out += "}\n";
16541
+ return out;
16542
+ };
16543
+ function parseSubjectEntries(block) {
16544
+ const entries = [];
16545
+ const t = tokenize(block);
16546
+ let i = 0;
16547
+ while (i < t.length) {
16548
+ const kind = stripWrapping(t[i++]);
16549
+ if (i >= t.length) {
16550
+ break;
16551
+ }
16552
+ const eid = stripWrapping(t[i++]);
16553
+ const entry = { kind, id: eid, fields: {} };
16554
+ if (i < t.length && t[i].startsWith("{")) {
16555
+ entry.fields = readRecordFields(unwrapBlock(t[i++]));
16556
+ }
16557
+ entries.push(entry);
16558
+ }
16559
+ return entries;
16560
+ }
16561
+ var parseStoryline = (id, data) => {
16562
+ const storyline = {
16563
+ id,
16564
+ name: "",
16565
+ idPrefix: "",
16566
+ party: { laboratory: "", authority: "" },
16567
+ subject: [],
16568
+ records: [],
16569
+ notes: []
16570
+ };
16571
+ forEachEntry(
16572
+ data,
16573
+ (keyword, value, peek) => {
16574
+ if (keyword === "name") {
16575
+ storyline.name = stripWrapping(value());
16576
+ } else if (keyword === "id_prefix") {
16577
+ storyline.idPrefix = stripWrapping(value());
16578
+ } else if (keyword === "party") {
16579
+ const pt = tokenize(unwrapBlock(value()));
16580
+ for (let j = 0; j + 1 < pt.length; j += 2) {
16581
+ if (pt[j] === "laboratory") {
16582
+ storyline.party.laboratory = stripWrapping(pt[j + 1]);
16583
+ } else if (pt[j] === "authority") {
16584
+ storyline.party.authority = stripWrapping(pt[j + 1]);
16585
+ }
16586
+ }
16587
+ } else if (keyword === "subject") {
16588
+ storyline.subject = parseSubjectEntries(unwrapBlock(value()));
16589
+ } else if (keyword === "record") {
16590
+ const store = stripWrapping(value());
16591
+ const idHead = peek();
16592
+ if (idHead === void 0 || idHead.startsWith("{")) {
16593
+ throw new Error(
16594
+ `Parsing error: storyline. ID ${id}: record ${store} is missing its id and block`
16595
+ );
16596
+ }
16597
+ const rid = stripWrapping(value());
16598
+ const blockHead = peek();
16599
+ if (blockHead === void 0 || !blockHead.startsWith("{")) {
16600
+ throw new Error(
16601
+ `Parsing error: storyline. ID ${id}: record ${store} ${rid} is missing its block`
16602
+ );
16603
+ }
16604
+ storyline.records.push({
16605
+ store,
16606
+ id: rid,
16607
+ fields: readRecordFields(unwrapBlock(value()))
16608
+ });
16609
+ } else if (keyword === "note") {
16610
+ storyline.notes.push(stripWrapping(value()));
16611
+ } else {
16612
+ return false;
16613
+ }
16614
+ return true;
16615
+ },
16616
+ { construct: "storyline", id }
16617
+ );
16618
+ return (ctx) => {
16619
+ ctx.storylines[id] = storyline;
16620
+ return ctx;
16621
+ };
16622
+ };
16623
+ var dumpStoryline = function(s) {
16624
+ let out = "storyline " + s.id + " {\n";
16625
+ if (s.name) {
16626
+ out += ' name "' + escapeString(s.name) + '"\n';
16627
+ }
16628
+ if (s.idPrefix) {
16629
+ out += " id_prefix " + dumpBareSafe(s.idPrefix) + "\n";
16630
+ }
16631
+ if (s.party.laboratory || s.party.authority) {
16632
+ out += " party {";
16633
+ if (s.party.laboratory) {
16634
+ out += " laboratory " + dumpBareSafe(s.party.laboratory);
16635
+ }
16636
+ if (s.party.authority) {
16637
+ out += " authority " + dumpBareSafe(s.party.authority);
16638
+ }
16639
+ out += " }\n";
16640
+ }
16641
+ if (s.subject.length > 0) {
16642
+ out += " subject {\n";
16643
+ for (const e of s.subject) {
16644
+ out += " " + dumpBareSafe(e.kind) + " " + dumpBareSafe(e.id) + " {\n";
16645
+ out += dumpRecordFields(e.fields, " ");
16646
+ out += " }\n";
16647
+ }
16648
+ out += " }\n";
16649
+ }
16650
+ for (const r of s.records) {
16651
+ out += " record " + dumpBareSafe(r.store) + " " + dumpBareSafe(r.id) + " {\n";
16652
+ out += dumpRecordFields(r.fields, " ");
16653
+ out += " }\n";
16654
+ }
16655
+ for (const n of s.notes) {
16656
+ out += ' note "' + escapeString(n) + '"\n';
16657
+ }
16658
+ out += "}\n";
16659
+ return out;
16660
+ };
16661
+
15250
16662
  // src/ser-des/config/index.ts
15251
16663
  function defineConstruct(def) {
15252
16664
  return def;
@@ -15275,6 +16687,15 @@ var CONSTRUCTS = [
15275
16687
  resolve: resolveProcess,
15276
16688
  dump: dumpProcess
15277
16689
  }),
16690
+ // The abstract-process model's file-level home (smart TODO.roadmap/40
16691
+ // batch 2): the pipeline sequence + the participant/expert registers.
16692
+ defineConstruct({
16693
+ keyword: "process_model",
16694
+ field: "processModels",
16695
+ takesID: true,
16696
+ parse: parseProcessModel,
16697
+ dump: dumpProcessModel
16698
+ }),
15278
16699
  defineConstruct({
15279
16700
  keyword: "approval",
15280
16701
  field: "approvals",
@@ -15462,6 +16883,16 @@ var CONSTRUCTS = [
15462
16883
  resolve: resolveSymbol,
15463
16884
  dump: dumpSymbol
15464
16885
  }),
16886
+ // The symbol-annotation register (smart TODO.roadmap/40 batch 4) —
16887
+ // one note text applying to many symbols; rides right after the
16888
+ // symbols in the dump order.
16889
+ defineConstruct({
16890
+ keyword: "formula_note",
16891
+ field: "formulaNotes",
16892
+ takesID: true,
16893
+ parse: parseFormulaNote,
16894
+ dump: dumpFormulaNote
16895
+ }),
15465
16896
  defineConstruct({
15466
16897
  keyword: "calculation",
15467
16898
  field: "calculations",
@@ -15491,12 +16922,38 @@ var CONSTRUCTS = [
15491
16922
  parse: parseTestPointSet,
15492
16923
  dump: dumpTestPointSet
15493
16924
  }),
16925
+ // The model-wide common test-conditions register (smart
16926
+ // TODO.roadmap/40 batch 4) — one entry per condition; the citation
16927
+ // string stays free (the linker owns the citation semantics).
16928
+ defineConstruct({
16929
+ keyword: "common_test_condition",
16930
+ field: "commonTestConditions",
16931
+ takesID: true,
16932
+ parse: parseCommonTestCondition,
16933
+ dump: dumpCommonTestCondition
16934
+ }),
16935
+ defineConstruct({
16936
+ keyword: "competence_kind",
16937
+ field: "competenceKinds",
16938
+ takesID: true,
16939
+ parse: parseCompetenceKind,
16940
+ dump: dumpCompetenceKind
16941
+ }),
16942
+ // The ISO/IEC 17067 scheme-type register (smart TODO.roadmap/40 batch
16943
+ // 2): the Table-1 activity menus + the scheme types.
16944
+ defineConstruct({
16945
+ keyword: "scheme_activity_kind",
16946
+ field: "schemeActivityKinds",
16947
+ takesID: true,
16948
+ parse: parseSchemeActivityKind,
16949
+ dump: dumpSchemeActivityKind
16950
+ }),
15494
16951
  defineConstruct({
15495
- keyword: "competence_kind",
15496
- field: "competenceKinds",
16952
+ keyword: "scheme_type",
16953
+ field: "schemeTypes",
15497
16954
  takesID: true,
15498
- parse: parseCompetenceKind,
15499
- dump: dumpCompetenceKind
16955
+ parse: parseSchemeType,
16956
+ dump: dumpSchemeType
15500
16957
  }),
15501
16958
  // The relation registry (docs/primmel/18): declared ref predicates.
15502
16959
  defineConstruct({
@@ -15650,6 +17107,51 @@ var CONSTRUCTS = [
15650
17107
  parse: parseDecisionRule,
15651
17108
  dump: dumpDecisionRule
15652
17109
  }),
17110
+ // The per-document content modules + the informative annexes (smart
17111
+ // TODO.roadmap/40 batch 2) — first-class what the directory convention
17112
+ // carried; the declared namespace pin C119 prefers.
17113
+ defineConstruct({
17114
+ keyword: "document_module",
17115
+ field: "documentModules",
17116
+ takesID: true,
17117
+ parse: parseDocumentModule,
17118
+ dump: dumpDocumentModule
17119
+ }),
17120
+ defineConstruct({
17121
+ keyword: "informative_annex",
17122
+ field: "informativeAnnexes",
17123
+ takesID: true,
17124
+ parse: parseInformativeAnnex,
17125
+ dump: dumpInformativeAnnex
17126
+ }),
17127
+ // The rec's own annex-volume index (smart TODO.roadmap/40 batch 4) —
17128
+ // NOT the external-guidance informative_annex; the normative/
17129
+ // informative obligation mark is the register's point.
17130
+ defineConstruct({
17131
+ keyword: "part_annex",
17132
+ field: "partAnnexes",
17133
+ takesID: true,
17134
+ parse: parsePartAnnex,
17135
+ dump: dumpPartAnnex
17136
+ }),
17137
+ // The demo seeds (smart TODO.roadmap/40 batch 4) — one demo_world per
17138
+ // package (file-level metadata + the OPEN participants registry) and
17139
+ // one storyline per flow; the record-value sub-grammar follows the
17140
+ // quantity.ts dumpScalarToken conventions.
17141
+ defineConstruct({
17142
+ keyword: "demo_world",
17143
+ field: "demoWorlds",
17144
+ takesID: true,
17145
+ parse: parseDemoWorld,
17146
+ dump: dumpDemoWorld
17147
+ }),
17148
+ defineConstruct({
17149
+ keyword: "storyline",
17150
+ field: "storylines",
17151
+ takesID: true,
17152
+ parse: parseStoryline,
17153
+ dump: dumpStoryline
17154
+ }),
15653
17155
  // Primmel v3 twin interface (TODO.roadmap/32 — doctrine ch. 14 §14.4):
15654
17156
  // the connector-profile registry. Endpoints and serve bindings are NOT
15655
17157
  // top-level constructs — they are subject anatomy slots (is.endpoints /
@@ -15992,6 +17494,9 @@ var MERGE_FIELDS = [
15992
17494
  "approvals",
15993
17495
  "roles",
15994
17496
  "processes",
17497
+ // The abstract-process models (smart TODO.roadmap/40 batch 2) compose
17498
+ // like the processes they sequence, with uses-no-redefine semantics.
17499
+ "processModels",
15995
17500
  "pages",
15996
17501
  "gateways",
15997
17502
  "regs",
@@ -16011,11 +17516,18 @@ var MERGE_FIELDS = [
16011
17516
  "forms",
16012
17517
  "subforms",
16013
17518
  "symbols",
17519
+ "formulaNotes",
16014
17520
  "calculations",
16015
17521
  "verdicts",
16016
17522
  "referenceMaterials",
16017
17523
  "testPointSets",
17524
+ "commonTestConditions",
16018
17525
  "competenceKinds",
17526
+ // The ISO/IEC 17067 scheme-type register (smart TODO.roadmap/40 batch
17527
+ // 2) composes like every register — the scheme-side packages resolve
17528
+ // their manifest `scheme_type` against it through `uses` (C122).
17529
+ "schemeActivityKinds",
17530
+ "schemeTypes",
16019
17531
  "constraints",
16020
17532
  "discrepancyRecords",
16021
17533
  "stateMachines",
@@ -16062,6 +17574,13 @@ var MERGE_FIELDS = [
16062
17574
  "documentPrecedences",
16063
17575
  "autoInclusions",
16064
17576
  "decisionRules",
17577
+ // The document modules + informative annexes (smart TODO.roadmap/40
17578
+ // batch 2) compose like the framework registers they sit beside.
17579
+ "documentModules",
17580
+ "informativeAnnexes",
17581
+ "partAnnexes",
17582
+ "demoWorlds",
17583
+ "storylines",
16065
17584
  // The pre-existing drift closed (the packages-as-SSOT epic): these
16066
17585
  // collections existed as constructs but were never merged, so `uses`
16067
17586
  // composition silently dropped them — comments, predicates, the
@@ -16156,6 +17675,11 @@ function composePackage(rootDir, options, rootManifest, withProvenance = false)
16156
17675
  }
16157
17676
  const ownedScopes = /* @__PURE__ */ new Map();
16158
17677
  const harvestScopes = (id, ctx) => {
17678
+ for (const m of Object.values(ctx.documentModules)) {
17679
+ if (m.namespace !== "" && !ownedScopes.has(m.namespace)) {
17680
+ ownedScopes.set(m.namespace, id);
17681
+ }
17682
+ }
16159
17683
  for (const key of Object.keys(ctx.requirementClasses)) {
16160
17684
  if (!ownedScopes.has(key)) {
16161
17685
  ownedScopes.set(key, id);
@@ -16907,6 +18431,11 @@ var TIER_BY_FIELD = {
16907
18431
  variables: "foundations",
16908
18432
  figures: "foundations",
16909
18433
  activityArchetypes: "foundations",
18434
+ // The ISO/IEC 17067 scheme-type register (smart TODO.roadmap/40 batch
18435
+ // 2) is foundations beside the activity archetypes: a vocabulary other
18436
+ // content classifies against.
18437
+ schemeActivityKinds: "foundations",
18438
+ schemeTypes: "foundations",
16910
18439
  connectorProfiles: "foundations",
16911
18440
  subjects: "primary",
16912
18441
  instruments: "primary",
@@ -16925,12 +18454,21 @@ var TIER_BY_FIELD = {
16925
18454
  forms: "secondary",
16926
18455
  subforms: "secondary",
16927
18456
  symbols: "secondary",
18457
+ formulaNotes: "tertiary",
16928
18458
  calculations: "secondary",
16929
18459
  verdicts: "secondary",
16930
18460
  tables: "secondary",
16931
18461
  testPointSets: "secondary",
18462
+ commonTestConditions: "tertiary",
16932
18463
  referenceMaterials: "secondary",
16933
18464
  processes: "tertiary",
18465
+ // Process models (smart TODO.roadmap/40 batch 2) are tertiary beside
18466
+ // processes: the pipeline sequence/registers are the abstract-process
18467
+ // model's file-level furniture.
18468
+ processModels: "tertiary",
18469
+ // Document modules (smart TODO.roadmap/40 batch 2) are tertiary beside
18470
+ // processes: the module is the pipeline's document-level furniture.
18471
+ documentModules: "tertiary",
16934
18472
  pages: "tertiary",
16935
18473
  dataclasses: "tertiary",
16936
18474
  regs: "tertiary",
@@ -16947,6 +18485,14 @@ var TIER_BY_FIELD = {
16947
18485
  viewProfiles: "tertiary",
16948
18486
  provisions: "tertiary",
16949
18487
  notes: "cross-cutting",
18488
+ // Informative annexes (smart TODO.roadmap/40 batch 2) are
18489
+ // cross-cutting beside notes: an annex binds cited guidance into the
18490
+ // module — annotation about the document set, not machinery inside
18491
+ // the model.
18492
+ informativeAnnexes: "cross-cutting",
18493
+ partAnnexes: "cross-cutting",
18494
+ demoWorlds: "tertiary",
18495
+ storylines: "tertiary",
16950
18496
  // Invariants (smart gap-close E9) are cross-cutting beside notes: the
16951
18497
  // typed replacement for the note-family encoding — doctrine about the
16952
18498
  // model, not machinery inside it (the enforcement claims point at the
@@ -18031,6 +19577,140 @@ var CHECK_RULES = [
18031
19577
  "normal",
18032
19578
  "smart TODO.roadmap/40 (the packages-as-SSOT epic)"
18033
19579
  ),
19580
+ // C121 (smart TODO.roadmap/40 batch 2; the packages-as-SSOT epic): the
19581
+ // abstract-process model's framework bindings resolve — the process's
19582
+ // roles / organs / participant_kinds lists, the decision rule, the
19583
+ // declaration kind + the sign|update action vocabulary, the discharged
19584
+ // declaration gate, realized_by → process, approved_by → approval, and
19585
+ // the calendar windows' shape (kind vocabulary; exactly one of
19586
+ // years/months); the process_model's sequence members and register
19587
+ // maintainers ride the same rule. Per-register gating (the C58
19588
+ // doctrine): an edge is checked only when its target register is in
19589
+ // composition scope.
19590
+ R(
19591
+ "C121",
19592
+ "abstract-process-references-resolve",
19593
+ "process",
19594
+ "error",
19595
+ "normal",
19596
+ "smart TODO.roadmap/40 batch 2 (the packages-as-SSOT epic)"
19597
+ ),
19598
+ // C122 (smart TODO.roadmap/40 batch 2; the packages-as-SSOT epic): the
19599
+ // ISO/IEC 17067 register is composable — a manifest's scheme_type
19600
+ // token resolves against the composed scheme_type register when one is
19601
+ // in scope, and a scheme_type's determination / attestation /
19602
+ // surveillance.activities entries resolve against the composed
19603
+ // scheme_activity_kind menus. Per-register gating (the C58 doctrine);
19604
+ // the register-free fallback stays (the C89 spelling precedent), and
19605
+ // C98's hard-coded no-surveillance set defers to the register's
19606
+ // surveillance.required when the register is in scope.
19607
+ R(
19608
+ "C122",
19609
+ "scheme-type-resolves",
19610
+ "composition",
19611
+ "error",
19612
+ "normal",
19613
+ "smart TODO.roadmap/40 batch 2 (the packages-as-SSOT epic)"
19614
+ ),
19615
+ // C123 (smart TODO.roadmap/40 batch 2; the packages-as-SSOT epic): the
19616
+ // document module's edges resolve — sequence members → process,
19617
+ // register maintainers → governance_organ (per-register gated, the C58
19618
+ // doctrine), the declared namespace is an absolute requirement-
19619
+ // namespace path (the pin C119 now prefers over the requirement_class-
19620
+ // id derivation), and the informative annex's applies_to names a known
19621
+ // package (locator-gated, the C97-class resolution discipline).
19622
+ R(
19623
+ "C123",
19624
+ "document-module-references-resolve",
19625
+ "composition",
19626
+ "error",
19627
+ "normal",
19628
+ "smart TODO.roadmap/40 batch 2 (the packages-as-SSOT epic)"
19629
+ ),
19630
+ // C124 (smart TODO.roadmap/40 batch 4; the packages-as-SSOT epic): the
19631
+ // attribute_definition pair_list block's declaration shape — the key
19632
+ // and value slots are required, component ids are unique within the
19633
+ // block, and the key_dimension names a declared applicability
19634
+ // dimension when the dimension register is in composition scope
19635
+ // (per-register gating, the C58 doctrine). The closed-registry-over-
19636
+ // values leg quantifies over app-side records and stays app-side.
19637
+ R(
19638
+ "C124",
19639
+ "pair-list-shape",
19640
+ "base",
19641
+ "error",
19642
+ "normal",
19643
+ "smart TODO.roadmap/40 batch 4 (the packages-as-SSOT epic)"
19644
+ ),
19645
+ // C125 (smart TODO.roadmap/40 batch 4; the packages-as-SSOT epic): the
19646
+ // calculation variant block's declaration shape — variant ids unique
19647
+ // within the owning calculation, and the type-conditional facets
19648
+ // present (expression ⇒ expression, table_lookup ⇒ lookup,
19649
+ // profile_lookup ⇒ profile; the top-level shape discipline mirrored
19650
+ // onto the realization). The variant's params are engine call-site
19651
+ // names and deliberately carry NO params-resolve leg.
19652
+ R(
19653
+ "C125",
19654
+ "formula-variant-shape",
19655
+ "base",
19656
+ "error",
19657
+ "normal",
19658
+ "smart TODO.roadmap/40 batch 4 (the packages-as-SSOT epic)"
19659
+ ),
19660
+ // C126 (smart TODO.roadmap/40 batch 4; the packages-as-SSOT epic): the
19661
+ // formula_note register's reverse applicability resolves — every
19662
+ // applies_to entry names a declared symbol when the symbol register is
19663
+ // in composition scope (per-register gating, the C58 doctrine).
19664
+ R(
19665
+ "C126",
19666
+ "formula-note-targets-resolve",
19667
+ "composition",
19668
+ "error",
19669
+ "normal",
19670
+ "smart TODO.roadmap/40 batch 4 (the packages-as-SSOT epic)"
19671
+ ),
19672
+ // C127 (smart TODO.roadmap/40 batch 4; the packages-as-SSOT epic): the
19673
+ // common_test_condition register's declaration shape — the description
19674
+ // is required (the one facet both YAML shapes carry); the title stays
19675
+ // optional (the r91 keyed-map entries carry none) and the reference a
19676
+ // free citation string (no kernel leg — the linker owns the citation
19677
+ // semantics).
19678
+ R(
19679
+ "C127",
19680
+ "common-test-condition-shape",
19681
+ "base",
19682
+ "error",
19683
+ "normal",
19684
+ "smart TODO.roadmap/40 batch 4 (the packages-as-SSOT epic)"
19685
+ ),
19686
+ // C128 (smart TODO.roadmap/40 batch 4; the packages-as-SSOT epic): the
19687
+ // part_annex register's declaration shape — letters unique per package
19688
+ // (the index keys on the printed letter) and the source provenance
19689
+ // required; the obligation vocabulary is parse-enforced upstream and
19690
+ // carries no check leg.
19691
+ R(
19692
+ "C128",
19693
+ "part-annex-shape",
19694
+ "base",
19695
+ "error",
19696
+ "normal",
19697
+ "smart TODO.roadmap/40 batch 4 (the packages-as-SSOT epic)"
19698
+ ),
19699
+ // C129 (smart TODO.roadmap/40 batch 4; the packages-as-SSOT epic): the
19700
+ // demo-seed shapes — the storyline's id_prefix pattern (register-free),
19701
+ // the party laboratory/authority → the demo_world participant seeds
19702
+ // (gated on that register), the record stores → the entity-class stores
19703
+ // (gated), and the in-construct record cross-references (a record field
19704
+ // keyed by a sibling record's store names a sibling of that store —
19705
+ // ungated). Field-level discipline stays app-side.
19706
+ R(
19707
+ "C129",
19708
+ "storyline-shape",
19709
+ "composition",
19710
+ "error",
19711
+ "normal",
19712
+ "smart TODO.roadmap/40 batch 4 (the packages-as-SSOT epic)"
19713
+ ),
18034
19714
  // ── quantities / time / duality (TODO.roadmap/06) ─────────────────
18035
19715
  R(
18036
19716
  "C32",
@@ -20757,6 +22437,12 @@ function checkPackage(dir, options = {}) {
20757
22437
  );
20758
22438
  continue;
20759
22439
  }
22440
+ if (s.period !== "" || s.barred.length > 0) {
22441
+ err(
22442
+ "C59",
22443
+ `process ${p.id}: segregation constraint "${s.id}" is case_personnel_disjoint but declares ${s.period !== "" ? `period "${s.period}"` : "barred relations"} \u2014 a disjoint constraint is ONLY a pair; the period/barred facets belong to consultancy_bar (segregation-members-resolve)`
22444
+ );
22445
+ }
20760
22446
  const [a, b] = s.pair;
20761
22447
  if (a === b) {
20762
22448
  err(
@@ -20778,9 +22464,151 @@ function checkPackage(dir, options = {}) {
20778
22464
  `process ${p.id}: segregation constraint "${s.id}" is declared on process "${p.id}" but neither pair member is "${p.id}" \u2014 the constrained process owns its segregation constraints (segregation-members-resolve)`
20779
22465
  );
20780
22466
  }
22467
+ } else {
22468
+ if (s.barred.length === 0) {
22469
+ err(
22470
+ "C59",
22471
+ `process ${p.id}: segregation constraint "${s.id}" is consultancy_bar but bars no client relation \u2014 the barred list is required (segregation-members-resolve)`
22472
+ );
22473
+ }
22474
+ if (s.pair.length > 0) {
22475
+ err(
22476
+ "C59",
22477
+ `process ${p.id}: segregation constraint "${s.id}" is consultancy_bar but declares a pair \u2014 the pair is the case_personnel_disjoint shape; a bar carries barred relations and an optional period only (segregation-members-resolve)`
22478
+ );
22479
+ }
22480
+ }
22481
+ }
22482
+ }
22483
+ }
22484
+ {
22485
+ const apRoleIds = new Set((standard.roles ?? []).map((r) => r.id));
22486
+ const apGateIds = new Set((standard.declarationGates ?? []).map((g) => g.id));
22487
+ const apRuleIds = new Set((standard.decisionRules ?? []).map((r) => r.id));
22488
+ const apApprovalIds = new Set((standard.approvals ?? []).map((a) => a.id));
22489
+ const resolveOrganAp = (where, facet, id) => {
22490
+ if (organIds.size > 0 && id !== "" && !organIds.has(id)) {
22491
+ err(
22492
+ "C121",
22493
+ `${where}: ${facet} "${id}" is not a declared governance organ (abstract-process-references-resolve)`
22494
+ );
22495
+ }
22496
+ };
22497
+ const resolveKindAp = (where, facet, id) => {
22498
+ if (kindIds.size > 0 && id !== "" && !kindIds.has(id)) {
22499
+ err(
22500
+ "C121",
22501
+ `${where}: ${facet} "${id}" is not a declared participant kind (abstract-process-references-resolve)`
22502
+ );
22503
+ }
22504
+ };
22505
+ const resolveDeclarationAp = (where, facet, id) => {
22506
+ if (declIds.size > 0 && id !== "" && !declIds.has(id)) {
22507
+ err(
22508
+ "C121",
22509
+ `${where}: ${facet} "${id}" is not a declared declaration kind (abstract-process-references-resolve)`
22510
+ );
22511
+ }
22512
+ };
22513
+ const resolveProcessRef = (where, facet, id) => {
22514
+ if (frameworkProcessIds.size > 0 && !frameworkProcessIds.has(id)) {
22515
+ err(
22516
+ "C121",
22517
+ `${where}: ${facet} "${id}" is not a declared process (abstract-process-references-resolve)`
22518
+ );
22519
+ }
22520
+ };
22521
+ for (const p of standard.processes ?? []) {
22522
+ const where = `process ${p.id}`;
22523
+ if (apRoleIds.size > 0) {
22524
+ for (const r of p.roles ?? []) {
22525
+ if (!apRoleIds.has(r)) {
22526
+ err(
22527
+ "C121",
22528
+ `${where}: roles "${r}" is not a declared role (abstract-process-references-resolve)`
22529
+ );
22530
+ }
22531
+ }
22532
+ }
22533
+ for (const o of p.organs ?? []) {
22534
+ resolveOrganAp(where, "organs", o);
22535
+ }
22536
+ for (const k of p.participantKinds ?? []) {
22537
+ resolveKindAp(where, "participant_kinds", k);
22538
+ }
22539
+ if (p.decision) {
22540
+ if (p.decision.rule === "") {
22541
+ err(
22542
+ "C121",
22543
+ `${where}: the decision facet declares no rule \u2014 a decision names the decision_rule it applies (abstract-process-references-resolve)`
22544
+ );
22545
+ } else if (apRuleIds.size > 0 && !apRuleIds.has(p.decision.rule)) {
22546
+ err(
22547
+ "C121",
22548
+ `${where}: decision.rule "${p.decision.rule}" is not a declared decision rule (abstract-process-references-resolve)`
22549
+ );
22550
+ }
22551
+ }
22552
+ if (p.declaration) {
22553
+ if (p.declaration.kind === "") {
22554
+ err(
22555
+ "C121",
22556
+ `${where}: the declaration facet declares no kind \u2014 a declaration names the declaration_kind it signs or updates (abstract-process-references-resolve)`
22557
+ );
22558
+ } else {
22559
+ resolveDeclarationAp(where, "declaration.kind", p.declaration.kind);
22560
+ }
22561
+ if (p.declaration.action !== "sign" && p.declaration.action !== "update") {
22562
+ err(
22563
+ "C121",
22564
+ `${where}: declaration action "${p.declaration.action || "(none)"}" \u2014 a declaration is signed or updated (valid: sign, update) (abstract-process-references-resolve)`
22565
+ );
22566
+ }
22567
+ }
22568
+ if (p.dischargesGate !== "" && apGateIds.size > 0 && !apGateIds.has(p.dischargesGate)) {
22569
+ err(
22570
+ "C121",
22571
+ `${where}: discharges_gate "${p.dischargesGate}" is not a declared declaration gate (abstract-process-references-resolve)`
22572
+ );
22573
+ }
22574
+ for (const r of p.realizedBy ?? []) {
22575
+ resolveProcessRef(where, "realized_by", r);
22576
+ }
22577
+ if (apApprovalIds.size > 0) {
22578
+ for (const a of p.approvedBy ?? []) {
22579
+ if (!apApprovalIds.has(a)) {
22580
+ err(
22581
+ "C121",
22582
+ `${where}: approved_by "${a}" is not a declared approval (abstract-process-references-resolve)`
22583
+ );
22584
+ }
22585
+ }
22586
+ }
22587
+ for (const w of p.windows ?? []) {
22588
+ const wwhere = `${where} window ${w.id}`;
22589
+ if (w.kind !== "max_elapsed" && w.kind !== "min_elapsed") {
22590
+ err(
22591
+ "C121",
22592
+ `${wwhere}: kind "${w.kind || "(none)"}" \u2014 a calendar window is a deadline or a cooling-off (valid: max_elapsed, min_elapsed) (abstract-process-references-resolve)`
22593
+ );
22594
+ }
22595
+ if (w.windowYears > 0 === w.windowMonths > 0) {
22596
+ err(
22597
+ "C121",
22598
+ `${wwhere}: the window duration declares ${w.windowYears > 0 ? "both years and months" : "neither years nor months"} \u2014 exactly one is required (the scheme_lifecycle window sub-grammar) (abstract-process-references-resolve)`
22599
+ );
20781
22600
  }
20782
22601
  }
20783
22602
  }
22603
+ for (const m of standard.processModels ?? []) {
22604
+ const where = `process_model ${m.id}`;
22605
+ for (const s of m.sequence ?? []) {
22606
+ resolveProcessRef(where, "sequence", s);
22607
+ }
22608
+ for (const r of m.registers ?? []) {
22609
+ resolveOrganAp(`${where} register ${r.id}`, "maintainer", r.maintainer);
22610
+ }
22611
+ }
20784
22612
  }
20785
22613
  {
20786
22614
  const OCL_CHECK = /^ocl\{[\s\S]*\}$/;
@@ -21852,6 +23680,86 @@ function checkPackage(dir, options = {}) {
21852
23680
  }
21853
23681
  }
21854
23682
  }
23683
+ {
23684
+ const schemeTypeIds = new Set((standard.schemeTypes ?? []).map((t) => t.id));
23685
+ const menuIds = new Set(
23686
+ (standard.schemeActivityKinds ?? []).map((k) => k.id)
23687
+ );
23688
+ const manifestSchemeType = standard.packageManifest?.schemeType;
23689
+ if (schemeTypeIds.size > 0 && manifestSchemeType && !schemeTypeIds.has(manifestSchemeType)) {
23690
+ err(
23691
+ "C122",
23692
+ `package "${standard.packageManifest.id}": scheme_type "${manifestSchemeType}" is not a declared scheme type of the in-scope ISO/IEC 17067 register (scheme-type-resolves)`
23693
+ );
23694
+ }
23695
+ if (menuIds.size > 0) {
23696
+ const resolveMenuEntry = (where, facet, id) => {
23697
+ if (!menuIds.has(id)) {
23698
+ err(
23699
+ "C122",
23700
+ `${where}: ${facet} "${id}" is not a declared scheme activity kind (scheme-type-resolves)`
23701
+ );
23702
+ }
23703
+ };
23704
+ for (const t of standard.schemeTypes ?? []) {
23705
+ const where = `scheme_type ${t.id}`;
23706
+ for (const d of t.determination) {
23707
+ resolveMenuEntry(where, "determination", d);
23708
+ }
23709
+ for (const a of t.attestation) {
23710
+ resolveMenuEntry(where, "attestation", a);
23711
+ }
23712
+ for (const s of t.surveillance?.activities ?? []) {
23713
+ resolveMenuEntry(where, "surveillance.activities", s);
23714
+ }
23715
+ }
23716
+ }
23717
+ }
23718
+ {
23719
+ const dmOrganIds = new Set(
23720
+ (standard.governanceOrgans ?? []).map((o) => o.id)
23721
+ );
23722
+ const dmProcessIds = new Set((standard.processes ?? []).map((p) => p.id));
23723
+ for (const m of standard.documentModules ?? []) {
23724
+ const where = `document_module ${m.id}`;
23725
+ if (m.namespace !== "" && !m.namespace.startsWith("/")) {
23726
+ err(
23727
+ "C123",
23728
+ `${where}: namespace "${m.namespace}" is not an absolute requirement-namespace path (e.g. /req/cs/${m.id}) \u2014 the declared pin C119 guards must be a path (document-module-references-resolve)`
23729
+ );
23730
+ }
23731
+ if (dmProcessIds.size > 0) {
23732
+ for (const s of m.sequence ?? []) {
23733
+ if (!dmProcessIds.has(s)) {
23734
+ err(
23735
+ "C123",
23736
+ `${where}: sequence "${s}" is not a declared process (document-module-references-resolve)`
23737
+ );
23738
+ }
23739
+ }
23740
+ }
23741
+ if (dmOrganIds.size > 0) {
23742
+ for (const r of m.registers ?? []) {
23743
+ if (r.maintainer !== "" && !dmOrganIds.has(r.maintainer)) {
23744
+ err(
23745
+ "C123",
23746
+ `${where} register ${r.id}: maintainer "${r.maintainer}" is not a declared governance organ (document-module-references-resolve)`
23747
+ );
23748
+ }
23749
+ }
23750
+ }
23751
+ }
23752
+ if (options.resolvePackage) {
23753
+ for (const a of standard.informativeAnnexes ?? []) {
23754
+ if (a.appliesTo !== "" && !resolveDepManifest(a.appliesTo)) {
23755
+ err(
23756
+ "C123",
23757
+ `informative_annex ${a.id}: applies_to "${a.appliesTo}" does not resolve to a known package \u2014 the CASCO layer the annex applies to must resolve (document-module-references-resolve)`
23758
+ );
23759
+ }
23760
+ }
23761
+ }
23762
+ }
21855
23763
  if (productManifest?.kind === "certification_program") {
21856
23764
  const mapsTo = productManifest.mapsTo ?? [];
21857
23765
  if (mapsTo.length === 0) {
@@ -21880,7 +23788,11 @@ function checkPackage(dir, options = {}) {
21880
23788
  }
21881
23789
  }
21882
23790
  const SCHEME_TYPES_WITHOUT_SURVEILLANCE = /* @__PURE__ */ new Set(["type_1a", "type_1b"]);
21883
- if (productManifest.schemeType && SCHEME_TYPES_WITHOUT_SURVEILLANCE.has(productManifest.schemeType)) {
23791
+ const registerEntry = (standard.schemeTypes ?? []).find(
23792
+ (t) => t.id === productManifest.schemeType
23793
+ );
23794
+ const noSurveillance = registerEntry ? !registerEntry.surveillance?.required : SCHEME_TYPES_WITHOUT_SURVEILLANCE.has(productManifest.schemeType ?? "");
23795
+ if (productManifest.schemeType && noSurveillance) {
21884
23796
  const claims = [];
21885
23797
  if ((standard.monitors ?? []).length > 0) {
21886
23798
  claims.push(
@@ -22502,6 +24414,169 @@ function checkPackage(dir, options = {}) {
22502
24414
  }
22503
24415
  }
22504
24416
  }
24417
+ for (const a of standard.attributeDefinitions ?? []) {
24418
+ const pl = a.pairList;
24419
+ if (!pl) {
24420
+ continue;
24421
+ }
24422
+ const where = `attribute_definition ${a.id}: pair_list`;
24423
+ if (!pl.key) {
24424
+ err("C124", `${where}: the key slot is required (pair-list-shape)`);
24425
+ }
24426
+ if (!pl.value) {
24427
+ err("C124", `${where}: the value slot is required (pair-list-shape)`);
24428
+ }
24429
+ const seen = /* @__PURE__ */ new Set();
24430
+ for (const c of pl.components) {
24431
+ if (seen.has(c.id)) {
24432
+ err(
24433
+ "C124",
24434
+ `${where}: component "${c.id}" is declared twice (pair-list-shape)`
24435
+ );
24436
+ }
24437
+ seen.add(c.id);
24438
+ }
24439
+ if (pl.keyDimension && dimIds.size > 0 && !dimIds.has(pl.keyDimension)) {
24440
+ err(
24441
+ "C124",
24442
+ `${where}: key_dimension "${pl.keyDimension}" is not a declared applicability dimension (pair-list-shape)`
24443
+ );
24444
+ }
24445
+ }
24446
+ for (const c of standard.calculations ?? []) {
24447
+ const seen = /* @__PURE__ */ new Set();
24448
+ for (const v of c.variants ?? []) {
24449
+ const where = `calculation ${c.id}: variant ${v.id}`;
24450
+ if (seen.has(v.id)) {
24451
+ err(
24452
+ "C125",
24453
+ `${where}: the variant id is declared twice (formula-variant-shape)`
24454
+ );
24455
+ }
24456
+ seen.add(v.id);
24457
+ if (v.type === "expression" && !v.expression) {
24458
+ err(
24459
+ "C125",
24460
+ `${where}: type expression requires the expression facet (formula-variant-shape)`
24461
+ );
24462
+ }
24463
+ if (v.type === "table_lookup" && !v.lookup) {
24464
+ err(
24465
+ "C125",
24466
+ `${where}: type table_lookup requires the lookup block (formula-variant-shape)`
24467
+ );
24468
+ }
24469
+ if (v.type === "profile_lookup" && !v.profile) {
24470
+ err(
24471
+ "C125",
24472
+ `${where}: type profile_lookup requires the profile facet (formula-variant-shape)`
24473
+ );
24474
+ }
24475
+ }
24476
+ }
24477
+ if (symbolIds.size > 0) {
24478
+ for (const n of standard.formulaNotes ?? []) {
24479
+ for (const s of n.appliesTo ?? []) {
24480
+ if (!symbolIds.has(s)) {
24481
+ err(
24482
+ "C126",
24483
+ `formula_note ${n.id}: applies_to "${s}" is not a declared symbol (formula-note-targets-resolve)`
24484
+ );
24485
+ }
24486
+ }
24487
+ }
24488
+ }
24489
+ for (const c of standard.commonTestConditions ?? []) {
24490
+ if (!c.description) {
24491
+ err(
24492
+ "C127",
24493
+ `common_test_condition ${c.id}: the description is required \u2014 a condition entry carries its normative text (common-test-condition-shape)`
24494
+ );
24495
+ }
24496
+ }
24497
+ {
24498
+ const seenLetters = /* @__PURE__ */ new Map();
24499
+ for (const a of standard.partAnnexes ?? []) {
24500
+ if (a.letter) {
24501
+ const prior = seenLetters.get(a.letter);
24502
+ if (prior !== void 0) {
24503
+ err(
24504
+ "C128",
24505
+ `part_annex ${a.id}: letter "${a.letter}" is already declared by ${prior} \u2014 the annex-volume index keys on the printed letter (part-annex-shape)`
24506
+ );
24507
+ } else {
24508
+ seenLetters.set(a.letter, a.id);
24509
+ }
24510
+ }
24511
+ if (!a.source?.doc) {
24512
+ err(
24513
+ "C128",
24514
+ `part_annex ${a.id}: the source provenance is required \u2014 a documentary register entry cites its part (part-annex-shape)`
24515
+ );
24516
+ }
24517
+ }
24518
+ }
24519
+ {
24520
+ const participantSeeds = /* @__PURE__ */ new Set();
24521
+ for (const w of standard.demoWorlds ?? []) {
24522
+ for (const section of w.participants ?? []) {
24523
+ for (const e of section.entries ?? []) {
24524
+ participantSeeds.add(e.id);
24525
+ }
24526
+ }
24527
+ }
24528
+ const entityStores = new Set(
24529
+ (standard.dataclasses ?? []).map((c) => c.store).filter((s) => !!s)
24530
+ );
24531
+ for (const s of standard.storylines ?? []) {
24532
+ const where = `storyline ${s.id}`;
24533
+ if (s.idPrefix && !/^[a-z0-9-]+$/.test(s.idPrefix)) {
24534
+ err(
24535
+ "C129",
24536
+ `${where}: id_prefix "${s.idPrefix}" does not match ^[a-z0-9-]+$ \u2014 the id-minting prefix is a lowercase slug (storyline-shape)`
24537
+ );
24538
+ }
24539
+ if (participantSeeds.size > 0) {
24540
+ for (const [slot, ref] of [
24541
+ ["laboratory", s.party.laboratory],
24542
+ ["authority", s.party.authority]
24543
+ ]) {
24544
+ if (ref && !participantSeeds.has(ref)) {
24545
+ err(
24546
+ "C129",
24547
+ `${where}: party ${slot} "${ref}" is not a declared participant seed (storyline-shape)`
24548
+ );
24549
+ }
24550
+ }
24551
+ }
24552
+ const siblingStores = /* @__PURE__ */ new Map();
24553
+ for (const r of s.records ?? []) {
24554
+ if (entityStores.size > 0 && !entityStores.has(r.store)) {
24555
+ err(
24556
+ "C129",
24557
+ `${where}: record store "${r.store}" is not a declared entity-class store (storyline-shape)`
24558
+ );
24559
+ }
24560
+ let ids = siblingStores.get(r.store);
24561
+ if (!ids) {
24562
+ ids = /* @__PURE__ */ new Set();
24563
+ siblingStores.set(r.store, ids);
24564
+ }
24565
+ ids.add(r.id);
24566
+ }
24567
+ for (const r of s.records ?? []) {
24568
+ for (const [key, value] of Object.entries(r.fields)) {
24569
+ const targets = siblingStores.get(key);
24570
+ if (targets !== void 0 && !Array.isArray(value) && !targets.has(String(value))) {
24571
+ err(
24572
+ "C129",
24573
+ `${where}: record ${r.store} ${r.id}: ${key} "${String(value)}" is not a sibling ${key} record of this storyline (storyline-shape)`
24574
+ );
24575
+ }
24576
+ }
24577
+ }
24578
+ }
24579
+ }
22505
24580
  for (const d of standard.duals ?? []) {
22506
24581
  if (d.attribute && !attrIds.has(d.attribute)) {
22507
24582
  err(