@primmel/primmel 1.11.0 → 1.12.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 (64) hide show
  1. package/dist/src/check-rules.d.ts.map +1 -1
  2. package/dist/src/check-rules.js +29 -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 +254 -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 +17 -0
  9. package/dist/src/model-diff.js.map +1 -1
  10. package/dist/src/ser-des/config/documentModule.d.ts +5 -0
  11. package/dist/src/ser-des/config/documentModule.d.ts.map +1 -0
  12. package/dist/src/ser-des/config/documentModule.js +109 -0
  13. package/dist/src/ser-des/config/documentModule.js.map +1 -0
  14. package/dist/src/ser-des/config/index.d.ts.map +1 -1
  15. package/dist/src/ser-des/config/index.js +46 -0
  16. package/dist/src/ser-des/config/index.js.map +1 -1
  17. package/dist/src/ser-des/config/informativeAnnex.d.ts +5 -0
  18. package/dist/src/ser-des/config/informativeAnnex.d.ts.map +1 -0
  19. package/dist/src/ser-des/config/informativeAnnex.js +185 -0
  20. package/dist/src/ser-des/config/informativeAnnex.js.map +1 -0
  21. package/dist/src/ser-des/config/process.d.ts.map +1 -1
  22. package/dist/src/ser-des/config/process.js +369 -3
  23. package/dist/src/ser-des/config/process.js.map +1 -1
  24. package/dist/src/ser-des/config/processModel.d.ts +13 -0
  25. package/dist/src/ser-des/config/processModel.d.ts.map +1 -0
  26. package/dist/src/ser-des/config/processModel.js +163 -0
  27. package/dist/src/ser-des/config/processModel.js.map +1 -0
  28. package/dist/src/ser-des/config/schemeType.d.ts +7 -0
  29. package/dist/src/ser-des/config/schemeType.d.ts.map +1 -0
  30. package/dist/src/ser-des/config/schemeType.js +232 -0
  31. package/dist/src/ser-des/config/schemeType.js.map +1 -0
  32. package/dist/src/ser-des/package.d.ts.map +1 -1
  33. package/dist/src/ser-des/package.js +35 -8
  34. package/dist/src/ser-des/package.js.map +1 -1
  35. package/dist/src/ser-des/parse.d.ts.map +1 -1
  36. package/dist/src/ser-des/parse.js +8 -0
  37. package/dist/src/ser-des/parse.js.map +1 -1
  38. package/dist/src/ser-des/types.d.ts +12 -0
  39. package/dist/src/ser-des/types.d.ts.map +1 -1
  40. package/dist/src/types/DocumentModule.d.ts +27 -0
  41. package/dist/src/types/DocumentModule.d.ts.map +1 -0
  42. package/dist/src/types/DocumentModule.js +38 -0
  43. package/dist/src/types/DocumentModule.js.map +1 -0
  44. package/dist/src/types/InformativeAnnex.d.ts +44 -0
  45. package/dist/src/types/InformativeAnnex.d.ts.map +1 -0
  46. package/dist/src/types/InformativeAnnex.js +35 -0
  47. package/dist/src/types/InformativeAnnex.js.map +1 -0
  48. package/dist/src/types/Package.d.ts +7 -3
  49. package/dist/src/types/Package.d.ts.map +1 -1
  50. package/dist/src/types/ProcessModel.d.ts +27 -0
  51. package/dist/src/types/ProcessModel.d.ts.map +1 -0
  52. package/dist/src/types/ProcessModel.js +31 -0
  53. package/dist/src/types/ProcessModel.js.map +1 -0
  54. package/dist/src/types/SchemeType.d.ts +51 -0
  55. package/dist/src/types/SchemeType.d.ts.map +1 -0
  56. package/dist/src/types/SchemeType.js +41 -0
  57. package/dist/src/types/SchemeType.js.map +1 -0
  58. package/dist/src/types/Standard.d.ts +16 -0
  59. package/dist/src/types/Standard.d.ts.map +1 -1
  60. package/dist/src/types/process.d.ts +99 -1
  61. package/dist/src/types/process.d.ts.map +1 -1
  62. package/dist-browser/index.mjs +1450 -985
  63. package/dist-cli/primmel.mjs +1313 -120
  64. 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: {},
@@ -223,6 +225,9 @@ function parse(mmelString, parsers, options = {}) {
223
225
  referenceMaterials: {},
224
226
  testPointSets: {},
225
227
  competenceKinds: {},
228
+ // The ISO/IEC 17067 scheme-type register (smart TODO.roadmap/40 batch 2)
229
+ schemeActivityKinds: {},
230
+ schemeTypes: {},
226
231
  predicates: {},
227
232
  constraints: {},
228
233
  discrepancyRecords: {},
@@ -261,6 +266,9 @@ function parse(mmelString, parsers, options = {}) {
261
266
  documentPrecedences: {},
262
267
  autoInclusions: {},
263
268
  decisionRules: {},
269
+ // The document modules + informative annexes (smart TODO.roadmap/40 batch 2)
270
+ documentModules: {},
271
+ informativeAnnexes: {},
264
272
  // Primmel v3 twin interface (TODO.roadmap/32)
265
273
  connectorProfiles: {},
266
274
  // Primmel v3 continuous compliance (TODO.roadmap/34)
@@ -2364,15 +2372,18 @@ function parseParamList(block, allowInitial = false) {
2364
2372
  const t = tokenize(block);
2365
2373
  let i = 0;
2366
2374
  while (i < t.length) {
2367
- const name = stripColon(t[i++]);
2375
+ const head = t[i++];
2376
+ const name = stripColon(head);
2368
2377
  if (!name) {
2369
2378
  break;
2370
2379
  }
2371
- let type = "";
2380
+ let typed = head.endsWith(":");
2372
2381
  if (i < t.length && t[i] === ":") {
2382
+ typed = true;
2373
2383
  i++;
2374
2384
  }
2375
- if (i < t.length) {
2385
+ let type = "";
2386
+ if (typed && i < t.length) {
2376
2387
  type = stripWrapping(t[i++]);
2377
2388
  }
2378
2389
  const param = { name, type };
@@ -2532,6 +2543,131 @@ function parseSegregation(block) {
2532
2543
  }
2533
2544
  return out;
2534
2545
  }
2546
+ function parseProcessEvidence(block) {
2547
+ const out = [];
2548
+ const t = tokenize(block);
2549
+ let i = 0;
2550
+ while (i < t.length) {
2551
+ const eid = stripWrapping(t[i++]);
2552
+ if (!eid) {
2553
+ break;
2554
+ }
2555
+ const entry = { id: eid, description: "", required: false };
2556
+ if (i < t.length && t[i].startsWith("{")) {
2557
+ forEachEntry(
2558
+ unwrapBlock(t[i++]),
2559
+ (keyword, value) => {
2560
+ if (keyword === "description") {
2561
+ entry.description = stripWrapping(value());
2562
+ } else if (keyword === "required") {
2563
+ entry.required = stripWrapping(value()) === "true";
2564
+ } else {
2565
+ return false;
2566
+ }
2567
+ return true;
2568
+ },
2569
+ { construct: "process evidence", id: eid }
2570
+ );
2571
+ }
2572
+ out.push(entry);
2573
+ }
2574
+ return out;
2575
+ }
2576
+ function parseProcessDecision(block) {
2577
+ const decision = { rule: "", clause: "" };
2578
+ forEachEntry(
2579
+ block,
2580
+ (keyword, value) => {
2581
+ if (keyword === "rule") {
2582
+ decision.rule = stripWrapping(value());
2583
+ } else if (keyword === "clause") {
2584
+ decision.clause = stripWrapping(value());
2585
+ } else {
2586
+ return false;
2587
+ }
2588
+ return true;
2589
+ },
2590
+ { construct: "process decision", id: "" }
2591
+ );
2592
+ return decision;
2593
+ }
2594
+ function parseProcessDeclaration(block) {
2595
+ const declaration = { kind: "", action: "" };
2596
+ forEachEntry(
2597
+ block,
2598
+ (keyword, value) => {
2599
+ if (keyword === "kind") {
2600
+ declaration.kind = stripWrapping(value());
2601
+ } else if (keyword === "action") {
2602
+ declaration.action = stripWrapping(value());
2603
+ } else {
2604
+ return false;
2605
+ }
2606
+ return true;
2607
+ },
2608
+ { construct: "process declaration", id: "" }
2609
+ );
2610
+ return declaration;
2611
+ }
2612
+ function parseProcessWindows(block) {
2613
+ const out = [];
2614
+ const t = tokenize(block);
2615
+ let i = 0;
2616
+ while (i < t.length) {
2617
+ const cmd = t[i++];
2618
+ if (cmd !== "window") {
2619
+ i = skipUnknownEntry(t, i);
2620
+ continue;
2621
+ }
2622
+ const wid = stripWrapping(t[i++]);
2623
+ const entry = {
2624
+ id: wid,
2625
+ kind: "",
2626
+ clause: "",
2627
+ anchor: "",
2628
+ applies_to: "",
2629
+ windowYears: 0,
2630
+ windowMonths: 0,
2631
+ breach: "",
2632
+ description: ""
2633
+ };
2634
+ if (i < t.length && t[i].startsWith("{")) {
2635
+ forEachEntry(
2636
+ unwrapBlock(t[i++]),
2637
+ (keyword, value) => {
2638
+ if (keyword === "kind") {
2639
+ entry.kind = stripWrapping(value());
2640
+ } else if (keyword === "clause") {
2641
+ entry.clause = stripWrapping(value());
2642
+ } else if (keyword === "anchor") {
2643
+ entry.anchor = stripWrapping(value());
2644
+ } else if (keyword === "applies_to") {
2645
+ entry.applies_to = stripWrapping(value());
2646
+ } else if (keyword === "window") {
2647
+ const wt = tokenizePackage(unwrapBlock(value()));
2648
+ for (let k = 0; k + 1 < wt.length; k += 2) {
2649
+ if (wt[k] === "years") {
2650
+ entry.windowYears = parseInt(stripWrapping(wt[k + 1]), 10) || 0;
2651
+ } else if (wt[k] === "months") {
2652
+ entry.windowMonths = parseInt(stripWrapping(wt[k + 1]), 10) || 0;
2653
+ }
2654
+ }
2655
+ } else if (keyword === "breach") {
2656
+ entry.breach = stripWrapping(value());
2657
+ } else if (keyword === "description") {
2658
+ entry.description = stripWrapping(value());
2659
+ } else {
2660
+ return false;
2661
+ }
2662
+ return true;
2663
+ },
2664
+ { construct: "process window", id: wid }
2665
+ );
2666
+ }
2667
+ out.push(entry);
2668
+ }
2669
+ return out;
2670
+ }
2535
2671
  function parseProcessInstances(block) {
2536
2672
  const out = { by: "", values: {} };
2537
2673
  const t = tokenize(block);
@@ -2783,6 +2919,18 @@ var parseProcess = function(id, data) {
2783
2919
  instances: null,
2784
2920
  childComposition: "all",
2785
2921
  does: null,
2922
+ // The abstract-process model (smart TODO.roadmap/40 batch 2)
2923
+ summary: "",
2924
+ roles: [],
2925
+ organs: [],
2926
+ participantKinds: [],
2927
+ evidence: [],
2928
+ decision: null,
2929
+ declaration: null,
2930
+ dischargesGate: "",
2931
+ realizedBy: [],
2932
+ approvedBy: [],
2933
+ windows: [],
2786
2934
  source: null,
2787
2935
  provisionRefs: [],
2788
2936
  _relations: {
@@ -2863,6 +3011,28 @@ var parseProcess = function(id, data) {
2863
3011
  result.invariants = parseOclList(unwrapBlock(value()));
2864
3012
  } else if (keyword === "activity_kind") {
2865
3013
  result.activityKinds = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3014
+ } else if (keyword === "summary") {
3015
+ result.summary = unwrapped(value);
3016
+ } else if (keyword === "roles") {
3017
+ result.roles = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3018
+ } else if (keyword === "organs") {
3019
+ result.organs = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3020
+ } else if (keyword === "participant_kinds") {
3021
+ result.participantKinds = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3022
+ } else if (keyword === "evidence") {
3023
+ result.evidence = parseProcessEvidence(unwrapBlock(value()));
3024
+ } else if (keyword === "decision") {
3025
+ result.decision = parseProcessDecision(unwrapBlock(value()));
3026
+ } else if (keyword === "declaration") {
3027
+ result.declaration = parseProcessDeclaration(unwrapBlock(value()));
3028
+ } else if (keyword === "discharges_gate") {
3029
+ result.dischargesGate = stripWrapping(value());
3030
+ } else if (keyword === "realized_by") {
3031
+ result.realizedBy = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3032
+ } else if (keyword === "approved_by") {
3033
+ result.approvedBy = tokenize(stripWrapping(value())).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3034
+ } else if (keyword === "windows") {
3035
+ result.windows = parseProcessWindows(unwrapBlock(value()));
2866
3036
  } else if (keyword === "segregation") {
2867
3037
  result.segregation = parseSegregation(unwrapBlock(value()));
2868
3038
  } else if (keyword === "preconditions") {
@@ -3046,6 +3216,9 @@ function dumpDoes(flow) {
3046
3216
  var dumpProcess = function(process2, ctx) {
3047
3217
  let out = "process " + process2.id + " {\n";
3048
3218
  out += ' name "' + escapeString(process2.name) + '"\n';
3219
+ if (process2.summary) {
3220
+ out += ' summary "' + escapeString(process2.summary) + '"\n';
3221
+ }
3049
3222
  if (process2.actor !== null) {
3050
3223
  out += " actor " + process2.actor.id + "\n";
3051
3224
  }
@@ -3096,6 +3269,94 @@ var dumpProcess = function(process2, ctx) {
3096
3269
  if (process2.activityKinds && process2.activityKinds.length > 0) {
3097
3270
  out += " activity_kind { " + process2.activityKinds.map(dumpBareSafe).join(" ") + " }\n";
3098
3271
  }
3272
+ if (process2.roles && process2.roles.length > 0) {
3273
+ out += " roles { " + process2.roles.map(dumpBareSafe).join(" ") + " }\n";
3274
+ }
3275
+ if (process2.organs && process2.organs.length > 0) {
3276
+ out += " organs { " + process2.organs.map(dumpBareSafe).join(" ") + " }\n";
3277
+ }
3278
+ if (process2.participantKinds && process2.participantKinds.length > 0) {
3279
+ out += " participant_kinds { " + process2.participantKinds.map(dumpBareSafe).join(" ") + " }\n";
3280
+ }
3281
+ if (process2.evidence && process2.evidence.length > 0) {
3282
+ out += " evidence {\n";
3283
+ for (const e of process2.evidence) {
3284
+ out += " " + dumpBareSafe(e.id) + " {";
3285
+ if (e.description) {
3286
+ out += ' description "' + escapeString(e.description) + '"';
3287
+ }
3288
+ if (e.required) {
3289
+ out += " required true";
3290
+ }
3291
+ out += " }\n";
3292
+ }
3293
+ out += " }\n";
3294
+ }
3295
+ if (process2.decision) {
3296
+ out += " decision {";
3297
+ if (process2.decision.rule) {
3298
+ out += " rule " + dumpBareSafe(process2.decision.rule);
3299
+ }
3300
+ if (process2.decision.clause) {
3301
+ out += ' clause "' + escapeString(process2.decision.clause) + '"';
3302
+ }
3303
+ out += " }\n";
3304
+ }
3305
+ if (process2.declaration) {
3306
+ out += " declaration {";
3307
+ if (process2.declaration.kind) {
3308
+ out += " kind " + dumpBareSafe(process2.declaration.kind);
3309
+ }
3310
+ if (process2.declaration.action) {
3311
+ out += " action " + dumpBareSafe(process2.declaration.action);
3312
+ }
3313
+ out += " }\n";
3314
+ }
3315
+ if (process2.dischargesGate) {
3316
+ out += " discharges_gate " + dumpBareSafe(process2.dischargesGate) + "\n";
3317
+ }
3318
+ if (process2.realizedBy && process2.realizedBy.length > 0) {
3319
+ out += " realized_by { " + process2.realizedBy.map(dumpBareSafe).join(" ") + " }\n";
3320
+ }
3321
+ if (process2.approvedBy && process2.approvedBy.length > 0) {
3322
+ out += " approved_by { " + process2.approvedBy.map(dumpBareSafe).join(" ") + " }\n";
3323
+ }
3324
+ if (process2.windows && process2.windows.length > 0) {
3325
+ out += " windows {\n";
3326
+ for (const w of process2.windows) {
3327
+ out += " window " + dumpBareSafe(w.id) + " {\n";
3328
+ if (w.kind) {
3329
+ out += " kind " + dumpBareSafe(w.kind) + "\n";
3330
+ }
3331
+ if (w.clause) {
3332
+ out += ' clause "' + escapeString(w.clause) + '"\n';
3333
+ }
3334
+ if (w.anchor) {
3335
+ out += " anchor " + dumpBareSafe(w.anchor) + "\n";
3336
+ }
3337
+ if (w.applies_to) {
3338
+ out += " applies_to " + dumpBareSafe(w.applies_to) + "\n";
3339
+ }
3340
+ if (w.windowYears > 0 || w.windowMonths > 0) {
3341
+ out += " window {";
3342
+ if (w.windowYears > 0) {
3343
+ out += " years " + w.windowYears;
3344
+ }
3345
+ if (w.windowMonths > 0) {
3346
+ out += " months " + w.windowMonths;
3347
+ }
3348
+ out += " }\n";
3349
+ }
3350
+ if (w.breach) {
3351
+ out += " breach " + dumpBareSafe(w.breach) + "\n";
3352
+ }
3353
+ if (w.description) {
3354
+ out += ' description "' + escapeString(w.description) + '"\n';
3355
+ }
3356
+ out += " }\n";
3357
+ }
3358
+ out += " }\n";
3359
+ }
3099
3360
  if (process2.segregation && process2.segregation.length > 0) {
3100
3361
  out += " segregation {\n";
3101
3362
  for (const s of process2.segregation) {
@@ -3180,6 +3441,125 @@ var dumpProcess = function(process2, ctx) {
3180
3441
  return out;
3181
3442
  };
3182
3443
 
3444
+ // src/ser-des/config/processModel.ts
3445
+ function parseProcessSequence(block) {
3446
+ return tokenizePackage(block).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
3447
+ }
3448
+ function parseProcessRegister(id, block) {
3449
+ const register = {
3450
+ id,
3451
+ label: "",
3452
+ clause: "",
3453
+ maintainer: "",
3454
+ published: "",
3455
+ entries: ""
3456
+ };
3457
+ forEachEntry(
3458
+ block,
3459
+ (keyword, value) => {
3460
+ if (keyword === "label") {
3461
+ register.label = stripWrapping(value());
3462
+ } else if (keyword === "clause") {
3463
+ register.clause = stripWrapping(value());
3464
+ } else if (keyword === "maintainer") {
3465
+ register.maintainer = stripWrapping(value());
3466
+ } else if (keyword === "published") {
3467
+ register.published = stripWrapping(value());
3468
+ } else if (keyword === "entries") {
3469
+ register.entries = stripWrapping(value());
3470
+ } else {
3471
+ return false;
3472
+ }
3473
+ return true;
3474
+ },
3475
+ { construct: "process_model register", id }
3476
+ );
3477
+ return register;
3478
+ }
3479
+ var parseProcessModel = (id, data) => {
3480
+ const model = {
3481
+ id,
3482
+ sequence: [],
3483
+ registers: [],
3484
+ source: { doc: "", clause: "" }
3485
+ };
3486
+ forEachEntry(
3487
+ data,
3488
+ (keyword, value, peek) => {
3489
+ if (keyword === "sequence") {
3490
+ model.sequence = parseProcessSequence(unwrapBlock(value()));
3491
+ } else if (keyword === "register") {
3492
+ const regId = stripWrapping(value());
3493
+ const head = peek();
3494
+ if (head === void 0 || !head.startsWith("{")) {
3495
+ throw new Error(
3496
+ `Parsing error: process_model. ID ${id}: register ${regId} is missing its block`
3497
+ );
3498
+ }
3499
+ model.registers.push(parseProcessRegister(regId, unwrapBlock(value())));
3500
+ } else if (keyword === "source") {
3501
+ model.source = readSource(unwrapBlock(value()));
3502
+ } else {
3503
+ return false;
3504
+ }
3505
+ return true;
3506
+ },
3507
+ { construct: "process_model", id }
3508
+ );
3509
+ return (ctx) => {
3510
+ ctx.processModels[id] = model;
3511
+ return ctx;
3512
+ };
3513
+ };
3514
+ function dumpProcessSequence(sequence) {
3515
+ if (sequence.length === 0) {
3516
+ return "";
3517
+ }
3518
+ return "sequence { " + sequence.map(dumpBareSafe).join(" ") + " }";
3519
+ }
3520
+ function dumpProcessRegister(r, indent) {
3521
+ let out = indent + "register " + dumpBareSafe(r.id) + " {\n";
3522
+ if (r.label) {
3523
+ out += indent + ' label "' + escapeString(r.label) + '"\n';
3524
+ }
3525
+ if (r.clause) {
3526
+ out += indent + ' clause "' + escapeString(r.clause) + '"\n';
3527
+ }
3528
+ if (r.maintainer) {
3529
+ out += indent + " maintainer " + dumpBareSafe(r.maintainer) + "\n";
3530
+ }
3531
+ if (r.published) {
3532
+ out += indent + ' published "' + escapeString(r.published) + '"\n';
3533
+ }
3534
+ if (r.entries) {
3535
+ out += indent + ' entries "' + escapeString(r.entries) + '"\n';
3536
+ }
3537
+ out += indent + "}\n";
3538
+ return out;
3539
+ }
3540
+ var dumpProcessModel = function(m) {
3541
+ let out = "process_model " + m.id + " {\n";
3542
+ const seq = dumpProcessSequence(m.sequence);
3543
+ if (seq) {
3544
+ out += " " + seq + "\n";
3545
+ }
3546
+ for (const r of m.registers) {
3547
+ out += dumpProcessRegister(r, " ");
3548
+ }
3549
+ if (m.source.doc || m.source.clause) {
3550
+ out += " source {\n";
3551
+ if (m.source.doc) {
3552
+ out += ' doc "' + escapeString(m.source.doc) + '"\n';
3553
+ }
3554
+ if (m.source.clause) {
3555
+ out += ' clause "' + escapeString(m.source.clause) + '"\n';
3556
+ }
3557
+ out += " }\n";
3558
+ }
3559
+ out += "}\n";
3560
+ return out;
3561
+ };
3562
+
3183
3563
  // src/ser-des/config/provision.ts
3184
3564
  var parseProvision = function(id, data) {
3185
3565
  const result = {
@@ -8457,6 +8837,202 @@ var dumpReferenceMaterial = function(m) {
8457
8837
  return out;
8458
8838
  };
8459
8839
 
8840
+ // src/ser-des/config/schemeType.ts
8841
+ var SCHEME_ACTIVITY_FAMILIES = [
8842
+ "common",
8843
+ "determination",
8844
+ "attestation",
8845
+ "surveillance"
8846
+ ];
8847
+ var ATTESTATION_OBJECTS = [
8848
+ "product_type",
8849
+ "batch",
8850
+ "ongoing_production",
8851
+ "service_or_process"
8852
+ ];
8853
+ function parseKindList(value) {
8854
+ return tokenizePackage(unwrapBlock(value)).map(stripColon).map(stripWrapping).filter((s) => s.length > 0);
8855
+ }
8856
+ var parseSchemeActivityKind = (id, data) => {
8857
+ const kind = {
8858
+ id,
8859
+ family: "common",
8860
+ row: "",
8861
+ label: "",
8862
+ source: { doc: "", clause: "" }
8863
+ };
8864
+ forEachEntry(
8865
+ data,
8866
+ (keyword, value) => {
8867
+ if (keyword === "family") {
8868
+ const family = stripWrapping(value());
8869
+ if (!SCHEME_ACTIVITY_FAMILIES.includes(family)) {
8870
+ throw new Error(
8871
+ `Parsing error: scheme_activity_kind. ID ${id}: Unknown family "${family}" (valid: ${SCHEME_ACTIVITY_FAMILIES.join(", ")})`
8872
+ );
8873
+ }
8874
+ kind.family = family;
8875
+ } else if (keyword === "row") {
8876
+ kind.row = stripWrapping(value());
8877
+ } else if (keyword === "label") {
8878
+ kind.label = stripWrapping(value());
8879
+ } else if (keyword === "source") {
8880
+ kind.source = readSource(unwrapBlock(value()));
8881
+ } else {
8882
+ return false;
8883
+ }
8884
+ return true;
8885
+ },
8886
+ { construct: "scheme_activity_kind", id }
8887
+ );
8888
+ return (ctx) => {
8889
+ ctx.schemeActivityKinds[id] = kind;
8890
+ return ctx;
8891
+ };
8892
+ };
8893
+ function parseSchemeSurveillance(block) {
8894
+ const surveillance = { required: false, activities: [] };
8895
+ forEachEntry(
8896
+ block,
8897
+ (keyword, value) => {
8898
+ if (keyword === "required") {
8899
+ surveillance.required = stripWrapping(value()) === "true";
8900
+ } else if (keyword === "activities") {
8901
+ surveillance.activities = parseKindList(value());
8902
+ } else {
8903
+ return false;
8904
+ }
8905
+ return true;
8906
+ },
8907
+ { construct: "scheme_type surveillance", id: "" }
8908
+ );
8909
+ return surveillance;
8910
+ }
8911
+ var parseSchemeType = (id, data) => {
8912
+ const type = {
8913
+ id,
8914
+ label: "",
8915
+ clause: "",
8916
+ description: "",
8917
+ sampling: "",
8918
+ attestationObject: "",
8919
+ determination: [],
8920
+ attestation: [],
8921
+ surveillance: null,
8922
+ notes: [],
8923
+ source: { doc: "", clause: "" }
8924
+ };
8925
+ forEachEntry(
8926
+ data,
8927
+ (keyword, value) => {
8928
+ if (keyword === "label") {
8929
+ type.label = stripWrapping(value());
8930
+ } else if (keyword === "clause") {
8931
+ type.clause = stripWrapping(value());
8932
+ } else if (keyword === "description") {
8933
+ type.description = stripWrapping(value());
8934
+ } else if (keyword === "sampling") {
8935
+ type.sampling = stripWrapping(value());
8936
+ } else if (keyword === "attestation_object") {
8937
+ const object = stripWrapping(value());
8938
+ if (!ATTESTATION_OBJECTS.includes(object)) {
8939
+ throw new Error(
8940
+ `Parsing error: scheme_type. ID ${id}: Unknown attestation_object "${object}" (valid: ${ATTESTATION_OBJECTS.join(", ")})`
8941
+ );
8942
+ }
8943
+ type.attestationObject = object;
8944
+ } else if (keyword === "determination") {
8945
+ type.determination = parseKindList(value());
8946
+ } else if (keyword === "attestation") {
8947
+ type.attestation = parseKindList(value());
8948
+ } else if (keyword === "surveillance") {
8949
+ type.surveillance = parseSchemeSurveillance(unwrapBlock(value()));
8950
+ } else if (keyword === "notes") {
8951
+ type.notes = tokenizePackage(unwrapBlock(value())).map(stripWrapping).filter((s) => s.length > 0);
8952
+ } else if (keyword === "source") {
8953
+ type.source = readSource(unwrapBlock(value()));
8954
+ } else {
8955
+ return false;
8956
+ }
8957
+ return true;
8958
+ },
8959
+ { construct: "scheme_type", id }
8960
+ );
8961
+ return (ctx) => {
8962
+ ctx.schemeTypes[id] = type;
8963
+ return ctx;
8964
+ };
8965
+ };
8966
+ function dumpSource(source, indent) {
8967
+ if (!source.doc && !source.clause) {
8968
+ return "";
8969
+ }
8970
+ let out = indent + "source {\n";
8971
+ if (source.doc) {
8972
+ out += indent + ' doc "' + escapeString(source.doc) + '"\n';
8973
+ }
8974
+ if (source.clause) {
8975
+ out += indent + ' clause "' + escapeString(source.clause) + '"\n';
8976
+ }
8977
+ out += indent + "}\n";
8978
+ return out;
8979
+ }
8980
+ var dumpSchemeActivityKind = function(k) {
8981
+ let out = "scheme_activity_kind " + k.id + " {\n";
8982
+ out += " family " + k.family + "\n";
8983
+ if (k.row) {
8984
+ out += ' row "' + escapeString(k.row) + '"\n';
8985
+ }
8986
+ if (k.label) {
8987
+ out += ' label "' + escapeString(k.label) + '"\n';
8988
+ }
8989
+ out += dumpSource(k.source, " ");
8990
+ out += "}\n";
8991
+ return out;
8992
+ };
8993
+ var dumpSchemeType = function(t) {
8994
+ let out = "scheme_type " + t.id + " {\n";
8995
+ if (t.label) {
8996
+ out += ' label "' + escapeString(t.label) + '"\n';
8997
+ }
8998
+ if (t.clause) {
8999
+ out += ' clause "' + escapeString(t.clause) + '"\n';
9000
+ }
9001
+ if (t.description) {
9002
+ out += ' description "' + escapeString(t.description) + '"\n';
9003
+ }
9004
+ if (t.sampling) {
9005
+ out += ' sampling "' + escapeString(t.sampling) + '"\n';
9006
+ }
9007
+ if (t.attestationObject) {
9008
+ out += " attestation_object " + t.attestationObject + "\n";
9009
+ }
9010
+ if (t.determination.length > 0) {
9011
+ out += " determination { " + t.determination.map(dumpBareSafe).join(" ") + " }\n";
9012
+ }
9013
+ if (t.attestation.length > 0) {
9014
+ out += " attestation { " + t.attestation.map(dumpBareSafe).join(" ") + " }\n";
9015
+ }
9016
+ if (t.surveillance) {
9017
+ out += " surveillance {\n";
9018
+ out += " required " + (t.surveillance.required ? "true" : "false") + "\n";
9019
+ if (t.surveillance.activities.length > 0) {
9020
+ out += " activities { " + t.surveillance.activities.map(dumpBareSafe).join(" ") + " }\n";
9021
+ }
9022
+ out += " }\n";
9023
+ }
9024
+ if (t.notes.length > 0) {
9025
+ out += " notes {\n";
9026
+ for (const n of t.notes) {
9027
+ out += ' "' + escapeString(n) + '"\n';
9028
+ }
9029
+ out += " }\n";
9030
+ }
9031
+ out += dumpSource(t.source, " ");
9032
+ out += "}\n";
9033
+ return out;
9034
+ };
9035
+
8460
9036
  // src/ser-des/config/predicate.ts
8461
9037
  var parsePredicate = function(id, data) {
8462
9038
  const result = {
@@ -10074,7 +10650,7 @@ function dumpComposedOf(decl, indent) {
10074
10650
  }
10075
10651
 
10076
10652
  // src/ser-des/config/subject.ts
10077
- function dumpSource(keyword, src, indent) {
10653
+ function dumpSource2(keyword, src, indent) {
10078
10654
  if (!src || !src.doc && !src.clause) {
10079
10655
  return "";
10080
10656
  }
@@ -10509,7 +11085,7 @@ function dumpDimension(d, indent) {
10509
11085
  if (d.description) {
10510
11086
  out += inner + 'description "' + escapeString(d.description) + '"\n';
10511
11087
  }
10512
- out += dumpSource("reference", d.source, inner);
11088
+ out += dumpSource2("reference", d.source, inner);
10513
11089
  if (d.valuesOf) {
10514
11090
  out += inner + "values_of " + d.valuesOf + "\n";
10515
11091
  }
@@ -10631,7 +11207,7 @@ var dumpInstrument = function(inst) {
10631
11207
  }
10632
11208
  out += " }\n";
10633
11209
  }
10634
- out += dumpSource("source", m.source, " ");
11210
+ out += dumpSource2("source", m.source, " ");
10635
11211
  out += " }\n";
10636
11212
  }
10637
11213
  for (const c of inst.components ?? []) {
@@ -10671,7 +11247,7 @@ var dumpInstrument = function(inst) {
10671
11247
  if (s.note) {
10672
11248
  out += ' note "' + escapeString(s.note) + '"\n';
10673
11249
  }
10674
- out += dumpSource("source", s.source, " ");
11250
+ out += dumpSource2("source", s.source, " ");
10675
11251
  out += " }\n";
10676
11252
  }
10677
11253
  if (inst.definition) {
@@ -10751,7 +11327,7 @@ var dumpInstrument = function(inst) {
10751
11327
  out += dumpSourceRefAsRef(s, " ", escapeString);
10752
11328
  }
10753
11329
  for (const s of inst.modelGroup.sampleSelection ?? []) {
10754
- out += dumpSource("sample_selection", s, " ");
11330
+ out += dumpSource2("sample_selection", s, " ");
10755
11331
  }
10756
11332
  out += " }\n";
10757
11333
  }
@@ -11763,7 +12339,7 @@ function dumpSubjectPromises(promises) {
11763
12339
  out += ' statement "' + escapeString(p.statement) + '"\n';
11764
12340
  }
11765
12341
  out += dumpIdList("verified_by", p.verifiedBy, " ");
11766
- out += dumpSource("source", p.source ?? null, " ");
12342
+ out += dumpSource2("source", p.source ?? null, " ");
11767
12343
  out += " }\n";
11768
12344
  }
11769
12345
  out += " }\n";
@@ -11795,7 +12371,7 @@ function dumpSubjectCharacteristics(map) {
11795
12371
  if (c.unit) {
11796
12372
  out += ' unit "' + escapeString(c.unit) + '"\n';
11797
12373
  }
11798
- out += dumpSource("source", c.source ?? null, " ");
12374
+ out += dumpSource2("source", c.source ?? null, " ");
11799
12375
  out += " }\n";
11800
12376
  continue;
11801
12377
  }
@@ -15106,140 +15682,398 @@ var parseDecisionRule = (id, data) => {
15106
15682
  const head = peek();
15107
15683
  if (head === void 0 || !head.startsWith("{")) {
15108
15684
  throw new Error(
15109
- `Parsing error: decision_rule. ID ${id}: legacy_kind ${kindId} is missing its block`
15685
+ `Parsing error: decision_rule. ID ${id}: legacy_kind ${kindId} is missing its block`
15686
+ );
15687
+ }
15688
+ rule.legacy_kinds.push(parseLegacyKind(kindId, unwrapBlock(value())));
15689
+ } else if (keyword === "income") {
15690
+ rule.income = stripWrapping(value());
15691
+ } else if (keyword === "no_entrance_fees_for") {
15692
+ rule.no_entrance_fees_for = parseIdList(value());
15693
+ } else if (keyword === "source") {
15694
+ rule.source = readSource(unwrapBlock(value()));
15695
+ } else {
15696
+ return false;
15697
+ }
15698
+ return true;
15699
+ },
15700
+ { construct: "decision_rule", id }
15701
+ );
15702
+ return (ctx) => {
15703
+ ctx.decisionRules[id] = rule;
15704
+ return ctx;
15705
+ };
15706
+ };
15707
+ function dumpVoteRule(label, rule) {
15708
+ let out = " " + label + " {\n";
15709
+ if (rule.threshold > 0) {
15710
+ out += " threshold " + rule.threshold + "\n";
15711
+ }
15712
+ if (rule.base) {
15713
+ out += " base " + dumpBareSafe(rule.base) + "\n";
15714
+ }
15715
+ if (rule.clause) {
15716
+ out += ' clause "' + escapeString(rule.clause) + '"\n';
15717
+ }
15718
+ if (rule.description) {
15719
+ out += ' description "' + escapeString(rule.description) + '"\n';
15720
+ }
15721
+ out += " }\n";
15722
+ return out;
15723
+ }
15724
+ function dumpVoting(v) {
15725
+ let out = " voting {\n";
15726
+ if (v.in_meeting) {
15727
+ out += dumpVoteRule("in_meeting", v.in_meeting);
15728
+ }
15729
+ if (v.by_correspondence) {
15730
+ out += dumpVoteRule("by_correspondence", v.by_correspondence);
15731
+ }
15732
+ if (v.other_proposals) {
15733
+ const o = v.other_proposals;
15734
+ out += " other_proposals {\n";
15735
+ if (o.in_meeting > 0) {
15736
+ out += " in_meeting " + o.in_meeting + "\n";
15737
+ }
15738
+ if (o.by_correspondence) {
15739
+ out += " by_correspondence " + dumpBareSafe(o.by_correspondence) + "\n";
15740
+ }
15741
+ if (o.description) {
15742
+ out += ' description "' + escapeString(o.description) + '"\n';
15743
+ }
15744
+ out += " }\n";
15745
+ }
15746
+ if (v.proxies_max > 0) {
15747
+ out += " proxies_max " + v.proxies_max + "\n";
15748
+ }
15749
+ if (v.abstentions) {
15750
+ out += " abstentions " + dumpBareSafe(v.abstentions) + "\n";
15751
+ }
15752
+ if (v.reason_on_against_or_abstain) {
15753
+ out += " reason_on_against_or_abstain true\n";
15754
+ }
15755
+ out += " }\n";
15756
+ return out;
15757
+ }
15758
+ function dumpIdList3(label, ids, indent) {
15759
+ return indent + label + " { " + ids.map(dumpBareSafe).join(" ") + " }\n";
15760
+ }
15761
+ var dumpDecisionRule = function(r) {
15762
+ let out = "decision_rule " + r.id + " {\n";
15763
+ if (r.organ) {
15764
+ out += " organ " + dumpBareSafe(r.organ) + "\n";
15765
+ }
15766
+ if (r.kind) {
15767
+ out += " kind " + dumpBareSafe(r.kind) + "\n";
15768
+ }
15769
+ if (r.clause) {
15770
+ out += ' clause "' + escapeString(r.clause) + '"\n';
15771
+ }
15772
+ if (r.description) {
15773
+ out += ' description "' + escapeString(r.description) + '"\n';
15774
+ }
15775
+ if (r.on_recommendation_of) {
15776
+ out += " on_recommendation_of " + dumpBareSafe(r.on_recommendation_of) + "\n";
15777
+ }
15778
+ if (r.independent_of) {
15779
+ out += " independent_of " + dumpBareSafe(r.independent_of) + "\n";
15780
+ }
15781
+ if (r.decides.length > 0) {
15782
+ out += dumpIdList3("decides", r.decides, " ");
15783
+ }
15784
+ if (r.voting) {
15785
+ out += dumpVoting(r.voting);
15786
+ }
15787
+ if (r.tasks.length > 0) {
15788
+ out += dumpIdList3("tasks", r.tasks, " ");
15789
+ }
15790
+ if (r.scope.length > 0) {
15791
+ out += dumpIdList3("scope", r.scope, " ");
15792
+ }
15793
+ if (r.principle) {
15794
+ out += " principle " + dumpBareSafe(r.principle) + "\n";
15795
+ }
15796
+ for (const k of r.legacy_kinds) {
15797
+ out += " legacy_kind " + dumpBareSafe(k.id) + " {\n";
15798
+ if (k.clause) {
15799
+ out += ' clause "' + escapeString(k.clause) + '"\n';
15800
+ }
15801
+ if (k.description) {
15802
+ out += ' description "' + escapeString(k.description) + '"\n';
15803
+ }
15804
+ out += " }\n";
15805
+ }
15806
+ if (r.income) {
15807
+ out += " income " + dumpBareSafe(r.income) + "\n";
15808
+ }
15809
+ if (r.no_entrance_fees_for.length > 0) {
15810
+ out += dumpIdList3("no_entrance_fees_for", r.no_entrance_fees_for, " ");
15811
+ }
15812
+ if (r.source.doc || r.source.clause) {
15813
+ out += " source {\n";
15814
+ if (r.source.doc) {
15815
+ out += ' doc "' + escapeString(r.source.doc) + '"\n';
15816
+ }
15817
+ if (r.source.clause) {
15818
+ out += ' clause "' + escapeString(r.source.clause) + '"\n';
15819
+ }
15820
+ out += " }\n";
15821
+ }
15822
+ out += "}\n";
15823
+ return out;
15824
+ };
15825
+
15826
+ // src/ser-des/config/documentModule.ts
15827
+ var parseDocumentModule = (id, data) => {
15828
+ const module = {
15829
+ id,
15830
+ document: "",
15831
+ title: "",
15832
+ edition: "",
15833
+ year: 0,
15834
+ namespace: "",
15835
+ sequence: [],
15836
+ registers: [],
15837
+ source: { doc: "", clause: "" }
15838
+ };
15839
+ forEachEntry(
15840
+ data,
15841
+ (keyword, value, peek) => {
15842
+ if (keyword === "document") {
15843
+ module.document = stripWrapping(value());
15844
+ } else if (keyword === "title") {
15845
+ module.title = stripWrapping(value());
15846
+ } else if (keyword === "edition") {
15847
+ module.edition = stripWrapping(value());
15848
+ } else if (keyword === "year") {
15849
+ module.year = parseInt(stripWrapping(value()), 10) || 0;
15850
+ } else if (keyword === "namespace") {
15851
+ module.namespace = stripWrapping(value());
15852
+ } else if (keyword === "sequence") {
15853
+ module.sequence = parseProcessSequence(unwrapBlock(value()));
15854
+ } else if (keyword === "register") {
15855
+ const regId = stripWrapping(value());
15856
+ const head = peek();
15857
+ if (head === void 0 || !head.startsWith("{")) {
15858
+ throw new Error(
15859
+ `Parsing error: document_module. ID ${id}: register ${regId} is missing its block`
15860
+ );
15861
+ }
15862
+ module.registers.push(
15863
+ parseProcessRegister(regId, unwrapBlock(value()))
15864
+ );
15865
+ } else if (keyword === "source") {
15866
+ module.source = readSource(unwrapBlock(value()));
15867
+ } else {
15868
+ return false;
15869
+ }
15870
+ return true;
15871
+ },
15872
+ { construct: "document_module", id }
15873
+ );
15874
+ return (ctx) => {
15875
+ ctx.documentModules[id] = module;
15876
+ return ctx;
15877
+ };
15878
+ };
15879
+ var dumpDocumentModule = function(m) {
15880
+ let out = "document_module " + m.id + " {\n";
15881
+ if (m.document) {
15882
+ out += ' document "' + escapeString(m.document) + '"\n';
15883
+ }
15884
+ if (m.title) {
15885
+ out += ' title "' + escapeString(m.title) + '"\n';
15886
+ }
15887
+ if (m.edition) {
15888
+ out += ' edition "' + escapeString(m.edition) + '"\n';
15889
+ }
15890
+ if (m.year) {
15891
+ out += " year " + m.year + "\n";
15892
+ }
15893
+ if (m.namespace) {
15894
+ out += " namespace " + dumpBareSafe(m.namespace) + "\n";
15895
+ }
15896
+ const seq = dumpProcessSequence(m.sequence);
15897
+ if (seq) {
15898
+ out += " " + seq + "\n";
15899
+ }
15900
+ for (const r of m.registers) {
15901
+ out += dumpProcessRegister(r, " ");
15902
+ }
15903
+ if (m.source.doc || m.source.clause) {
15904
+ out += " source {\n";
15905
+ if (m.source.doc) {
15906
+ out += ' doc "' + escapeString(m.source.doc) + '"\n';
15907
+ }
15908
+ if (m.source.clause) {
15909
+ out += ' clause "' + escapeString(m.source.clause) + '"\n';
15910
+ }
15911
+ out += " }\n";
15912
+ }
15913
+ out += "}\n";
15914
+ return out;
15915
+ };
15916
+
15917
+ // src/ser-des/config/informativeAnnex.ts
15918
+ var ANNEX_DOCUMENT_ROLES = ["informative"];
15919
+ function parseAnnexDocument(block, annexId) {
15920
+ const doc = {
15921
+ id: "",
15922
+ title: "",
15923
+ edition: 0,
15924
+ year: 0,
15925
+ role: "",
15926
+ source: ""
15927
+ };
15928
+ forEachEntry(
15929
+ block,
15930
+ (keyword, value) => {
15931
+ if (keyword === "id") {
15932
+ doc.id = stripWrapping(value());
15933
+ } else if (keyword === "title") {
15934
+ doc.title = stripWrapping(value());
15935
+ } else if (keyword === "edition") {
15936
+ doc.edition = parseInt(stripWrapping(value()), 10) || 0;
15937
+ } else if (keyword === "year") {
15938
+ doc.year = parseInt(stripWrapping(value()), 10) || 0;
15939
+ } else if (keyword === "role") {
15940
+ const role = stripWrapping(value());
15941
+ if (!ANNEX_DOCUMENT_ROLES.includes(role)) {
15942
+ throw new Error(
15943
+ `Parsing error: informative_annex. ID ${annexId}: Unknown document role "${role}" (valid: ${ANNEX_DOCUMENT_ROLES.join(", ")})`
15944
+ );
15945
+ }
15946
+ doc.role = role;
15947
+ } else if (keyword === "source") {
15948
+ doc.source = stripWrapping(value());
15949
+ } else {
15950
+ return false;
15951
+ }
15952
+ return true;
15953
+ },
15954
+ { construct: "informative_annex document", id: annexId }
15955
+ );
15956
+ return doc;
15957
+ }
15958
+ function parseAnnexHighlight(id, block) {
15959
+ const highlight = {
15960
+ id,
15961
+ clause: "",
15962
+ title: "",
15963
+ statement: "",
15964
+ dischargedBy: ""
15965
+ };
15966
+ forEachEntry(
15967
+ block,
15968
+ (keyword, value) => {
15969
+ if (keyword === "clause") {
15970
+ highlight.clause = stripWrapping(value());
15971
+ } else if (keyword === "title") {
15972
+ highlight.title = stripWrapping(value());
15973
+ } else if (keyword === "statement") {
15974
+ highlight.statement = stripWrapping(value());
15975
+ } else if (keyword === "discharged_by") {
15976
+ highlight.dischargedBy = stripWrapping(value());
15977
+ } else {
15978
+ return false;
15979
+ }
15980
+ return true;
15981
+ },
15982
+ { construct: "informative_annex highlight", id }
15983
+ );
15984
+ return highlight;
15985
+ }
15986
+ var parseInformativeAnnex = (id, data) => {
15987
+ const annex = {
15988
+ id,
15989
+ document: { id: "", title: "", edition: 0, year: 0, role: "", source: "" },
15990
+ appliesTo: "",
15991
+ appliedBy: "",
15992
+ scope: "",
15993
+ numberingCaution: "",
15994
+ highlights: []
15995
+ };
15996
+ forEachEntry(
15997
+ data,
15998
+ (keyword, value, peek) => {
15999
+ if (keyword === "document") {
16000
+ annex.document = parseAnnexDocument(unwrapBlock(value()), id);
16001
+ } else if (keyword === "applies_to") {
16002
+ annex.appliesTo = stripWrapping(value());
16003
+ } else if (keyword === "applied_by") {
16004
+ annex.appliedBy = stripWrapping(value());
16005
+ } else if (keyword === "scope") {
16006
+ annex.scope = stripWrapping(value());
16007
+ } else if (keyword === "numbering_caution") {
16008
+ annex.numberingCaution = stripWrapping(value());
16009
+ } else if (keyword === "highlight") {
16010
+ const hlId = stripWrapping(value());
16011
+ const head = peek();
16012
+ if (head === void 0 || !head.startsWith("{")) {
16013
+ throw new Error(
16014
+ `Parsing error: informative_annex. ID ${id}: highlight ${hlId} is missing its block`
15110
16015
  );
15111
16016
  }
15112
- rule.legacy_kinds.push(parseLegacyKind(kindId, unwrapBlock(value())));
15113
- } else if (keyword === "income") {
15114
- rule.income = stripWrapping(value());
15115
- } else if (keyword === "no_entrance_fees_for") {
15116
- rule.no_entrance_fees_for = parseIdList(value());
15117
- } else if (keyword === "source") {
15118
- rule.source = readSource(unwrapBlock(value()));
16017
+ annex.highlights.push(parseAnnexHighlight(hlId, unwrapBlock(value())));
15119
16018
  } else {
15120
16019
  return false;
15121
16020
  }
15122
16021
  return true;
15123
16022
  },
15124
- { construct: "decision_rule", id }
16023
+ { construct: "informative_annex", id }
15125
16024
  );
15126
16025
  return (ctx) => {
15127
- ctx.decisionRules[id] = rule;
16026
+ ctx.informativeAnnexes[id] = annex;
15128
16027
  return ctx;
15129
16028
  };
15130
16029
  };
15131
- function dumpVoteRule(label, rule) {
15132
- let out = " " + label + " {\n";
15133
- if (rule.threshold > 0) {
15134
- out += " threshold " + rule.threshold + "\n";
15135
- }
15136
- if (rule.base) {
15137
- out += " base " + dumpBareSafe(rule.base) + "\n";
15138
- }
15139
- if (rule.clause) {
15140
- out += ' clause "' + escapeString(rule.clause) + '"\n';
15141
- }
15142
- if (rule.description) {
15143
- out += ' description "' + escapeString(rule.description) + '"\n';
15144
- }
15145
- out += " }\n";
15146
- return out;
15147
- }
15148
- function dumpVoting(v) {
15149
- let out = " voting {\n";
15150
- if (v.in_meeting) {
15151
- out += dumpVoteRule("in_meeting", v.in_meeting);
16030
+ var dumpInformativeAnnex = function(a) {
16031
+ let out = "informative_annex " + a.id + " {\n";
16032
+ out += " document {\n";
16033
+ if (a.document.id) {
16034
+ out += ' id "' + escapeString(a.document.id) + '"\n';
15152
16035
  }
15153
- if (v.by_correspondence) {
15154
- out += dumpVoteRule("by_correspondence", v.by_correspondence);
16036
+ if (a.document.title) {
16037
+ out += ' title "' + escapeString(a.document.title) + '"\n';
15155
16038
  }
15156
- if (v.other_proposals) {
15157
- const o = v.other_proposals;
15158
- out += " other_proposals {\n";
15159
- if (o.in_meeting > 0) {
15160
- out += " in_meeting " + o.in_meeting + "\n";
15161
- }
15162
- if (o.by_correspondence) {
15163
- out += " by_correspondence " + dumpBareSafe(o.by_correspondence) + "\n";
15164
- }
15165
- if (o.description) {
15166
- out += ' description "' + escapeString(o.description) + '"\n';
15167
- }
15168
- out += " }\n";
16039
+ if (a.document.edition) {
16040
+ out += " edition " + a.document.edition + "\n";
15169
16041
  }
15170
- if (v.proxies_max > 0) {
15171
- out += " proxies_max " + v.proxies_max + "\n";
16042
+ if (a.document.year) {
16043
+ out += " year " + a.document.year + "\n";
15172
16044
  }
15173
- if (v.abstentions) {
15174
- out += " abstentions " + dumpBareSafe(v.abstentions) + "\n";
16045
+ if (a.document.role) {
16046
+ out += " role " + dumpBareSafe(a.document.role) + "\n";
15175
16047
  }
15176
- if (v.reason_on_against_or_abstain) {
15177
- out += " reason_on_against_or_abstain true\n";
16048
+ if (a.document.source) {
16049
+ out += ' source "' + escapeString(a.document.source) + '"\n';
15178
16050
  }
15179
16051
  out += " }\n";
15180
- return out;
15181
- }
15182
- function dumpIdList3(label, ids, indent) {
15183
- return indent + label + " { " + ids.map(dumpBareSafe).join(" ") + " }\n";
15184
- }
15185
- var dumpDecisionRule = function(r) {
15186
- let out = "decision_rule " + r.id + " {\n";
15187
- if (r.organ) {
15188
- out += " organ " + dumpBareSafe(r.organ) + "\n";
15189
- }
15190
- if (r.kind) {
15191
- out += " kind " + dumpBareSafe(r.kind) + "\n";
15192
- }
15193
- if (r.clause) {
15194
- out += ' clause "' + escapeString(r.clause) + '"\n';
15195
- }
15196
- if (r.description) {
15197
- out += ' description "' + escapeString(r.description) + '"\n';
15198
- }
15199
- if (r.on_recommendation_of) {
15200
- out += " on_recommendation_of " + dumpBareSafe(r.on_recommendation_of) + "\n";
15201
- }
15202
- if (r.independent_of) {
15203
- out += " independent_of " + dumpBareSafe(r.independent_of) + "\n";
16052
+ if (a.appliesTo) {
16053
+ out += " applies_to " + dumpBareSafe(a.appliesTo) + "\n";
15204
16054
  }
15205
- if (r.decides.length > 0) {
15206
- out += dumpIdList3("decides", r.decides, " ");
15207
- }
15208
- if (r.voting) {
15209
- out += dumpVoting(r.voting);
15210
- }
15211
- if (r.tasks.length > 0) {
15212
- out += dumpIdList3("tasks", r.tasks, " ");
16055
+ if (a.appliedBy) {
16056
+ out += ' applied_by "' + escapeString(a.appliedBy) + '"\n';
15213
16057
  }
15214
- if (r.scope.length > 0) {
15215
- out += dumpIdList3("scope", r.scope, " ");
16058
+ if (a.scope) {
16059
+ out += ' scope "' + escapeString(a.scope) + '"\n';
15216
16060
  }
15217
- if (r.principle) {
15218
- out += " principle " + dumpBareSafe(r.principle) + "\n";
16061
+ if (a.numberingCaution) {
16062
+ out += ' numbering_caution "' + escapeString(a.numberingCaution) + '"\n';
15219
16063
  }
15220
- for (const k of r.legacy_kinds) {
15221
- out += " legacy_kind " + dumpBareSafe(k.id) + " {\n";
15222
- if (k.clause) {
15223
- out += ' clause "' + escapeString(k.clause) + '"\n';
16064
+ for (const h of a.highlights) {
16065
+ out += " highlight " + dumpBareSafe(h.id) + " {\n";
16066
+ if (h.clause) {
16067
+ out += ' clause "' + escapeString(h.clause) + '"\n';
15224
16068
  }
15225
- if (k.description) {
15226
- out += ' description "' + escapeString(k.description) + '"\n';
16069
+ if (h.title) {
16070
+ out += ' title "' + escapeString(h.title) + '"\n';
15227
16071
  }
15228
- out += " }\n";
15229
- }
15230
- if (r.income) {
15231
- out += " income " + dumpBareSafe(r.income) + "\n";
15232
- }
15233
- if (r.no_entrance_fees_for.length > 0) {
15234
- out += dumpIdList3("no_entrance_fees_for", r.no_entrance_fees_for, " ");
15235
- }
15236
- if (r.source.doc || r.source.clause) {
15237
- out += " source {\n";
15238
- if (r.source.doc) {
15239
- out += ' doc "' + escapeString(r.source.doc) + '"\n';
16072
+ if (h.statement) {
16073
+ out += ' statement "' + escapeString(h.statement) + '"\n';
15240
16074
  }
15241
- if (r.source.clause) {
15242
- out += ' clause "' + escapeString(r.source.clause) + '"\n';
16075
+ if (h.dischargedBy) {
16076
+ out += ' discharged_by "' + escapeString(h.dischargedBy) + '"\n';
15243
16077
  }
15244
16078
  out += " }\n";
15245
16079
  }
@@ -15275,6 +16109,15 @@ var CONSTRUCTS = [
15275
16109
  resolve: resolveProcess,
15276
16110
  dump: dumpProcess
15277
16111
  }),
16112
+ // The abstract-process model's file-level home (smart TODO.roadmap/40
16113
+ // batch 2): the pipeline sequence + the participant/expert registers.
16114
+ defineConstruct({
16115
+ keyword: "process_model",
16116
+ field: "processModels",
16117
+ takesID: true,
16118
+ parse: parseProcessModel,
16119
+ dump: dumpProcessModel
16120
+ }),
15278
16121
  defineConstruct({
15279
16122
  keyword: "approval",
15280
16123
  field: "approvals",
@@ -15498,6 +16341,22 @@ var CONSTRUCTS = [
15498
16341
  parse: parseCompetenceKind,
15499
16342
  dump: dumpCompetenceKind
15500
16343
  }),
16344
+ // The ISO/IEC 17067 scheme-type register (smart TODO.roadmap/40 batch
16345
+ // 2): the Table-1 activity menus + the scheme types.
16346
+ defineConstruct({
16347
+ keyword: "scheme_activity_kind",
16348
+ field: "schemeActivityKinds",
16349
+ takesID: true,
16350
+ parse: parseSchemeActivityKind,
16351
+ dump: dumpSchemeActivityKind
16352
+ }),
16353
+ defineConstruct({
16354
+ keyword: "scheme_type",
16355
+ field: "schemeTypes",
16356
+ takesID: true,
16357
+ parse: parseSchemeType,
16358
+ dump: dumpSchemeType
16359
+ }),
15501
16360
  // The relation registry (docs/primmel/18): declared ref predicates.
15502
16361
  defineConstruct({
15503
16362
  keyword: "predicate",
@@ -15650,6 +16509,23 @@ var CONSTRUCTS = [
15650
16509
  parse: parseDecisionRule,
15651
16510
  dump: dumpDecisionRule
15652
16511
  }),
16512
+ // The per-document content modules + the informative annexes (smart
16513
+ // TODO.roadmap/40 batch 2) — first-class what the directory convention
16514
+ // carried; the declared namespace pin C119 prefers.
16515
+ defineConstruct({
16516
+ keyword: "document_module",
16517
+ field: "documentModules",
16518
+ takesID: true,
16519
+ parse: parseDocumentModule,
16520
+ dump: dumpDocumentModule
16521
+ }),
16522
+ defineConstruct({
16523
+ keyword: "informative_annex",
16524
+ field: "informativeAnnexes",
16525
+ takesID: true,
16526
+ parse: parseInformativeAnnex,
16527
+ dump: dumpInformativeAnnex
16528
+ }),
15653
16529
  // Primmel v3 twin interface (TODO.roadmap/32 — doctrine ch. 14 §14.4):
15654
16530
  // the connector-profile registry. Endpoints and serve bindings are NOT
15655
16531
  // top-level constructs — they are subject anatomy slots (is.endpoints /
@@ -15809,7 +16685,8 @@ var CONVENTION_DIRS = [
15809
16685
  "entities",
15810
16686
  "specification",
15811
16687
  "execution",
15812
- "evaluation"
16688
+ "evaluation",
16689
+ "framework"
15813
16690
  ];
15814
16691
  function collectPrlFiles(dir) {
15815
16692
  const out = [];
@@ -15991,6 +16868,9 @@ var MERGE_FIELDS = [
15991
16868
  "approvals",
15992
16869
  "roles",
15993
16870
  "processes",
16871
+ // The abstract-process models (smart TODO.roadmap/40 batch 2) compose
16872
+ // like the processes they sequence, with uses-no-redefine semantics.
16873
+ "processModels",
15994
16874
  "pages",
15995
16875
  "gateways",
15996
16876
  "regs",
@@ -16015,6 +16895,11 @@ var MERGE_FIELDS = [
16015
16895
  "referenceMaterials",
16016
16896
  "testPointSets",
16017
16897
  "competenceKinds",
16898
+ // The ISO/IEC 17067 scheme-type register (smart TODO.roadmap/40 batch
16899
+ // 2) composes like every register — the scheme-side packages resolve
16900
+ // their manifest `scheme_type` against it through `uses` (C122).
16901
+ "schemeActivityKinds",
16902
+ "schemeTypes",
16018
16903
  "constraints",
16019
16904
  "discrepancyRecords",
16020
16905
  "stateMachines",
@@ -16061,6 +16946,10 @@ var MERGE_FIELDS = [
16061
16946
  "documentPrecedences",
16062
16947
  "autoInclusions",
16063
16948
  "decisionRules",
16949
+ // The document modules + informative annexes (smart TODO.roadmap/40
16950
+ // batch 2) compose like the framework registers they sit beside.
16951
+ "documentModules",
16952
+ "informativeAnnexes",
16064
16953
  // The pre-existing drift closed (the packages-as-SSOT epic): these
16065
16954
  // collections existed as constructs but were never merged, so `uses`
16066
16955
  // composition silently dropped them — comments, predicates, the
@@ -16155,6 +17044,11 @@ function composePackage(rootDir, options, rootManifest, withProvenance = false)
16155
17044
  }
16156
17045
  const ownedScopes = /* @__PURE__ */ new Map();
16157
17046
  const harvestScopes = (id, ctx) => {
17047
+ for (const m of Object.values(ctx.documentModules)) {
17048
+ if (m.namespace !== "" && !ownedScopes.has(m.namespace)) {
17049
+ ownedScopes.set(m.namespace, id);
17050
+ }
17051
+ }
16158
17052
  for (const key of Object.keys(ctx.requirementClasses)) {
16159
17053
  if (!ownedScopes.has(key)) {
16160
17054
  ownedScopes.set(key, id);
@@ -16906,6 +17800,11 @@ var TIER_BY_FIELD = {
16906
17800
  variables: "foundations",
16907
17801
  figures: "foundations",
16908
17802
  activityArchetypes: "foundations",
17803
+ // The ISO/IEC 17067 scheme-type register (smart TODO.roadmap/40 batch
17804
+ // 2) is foundations beside the activity archetypes: a vocabulary other
17805
+ // content classifies against.
17806
+ schemeActivityKinds: "foundations",
17807
+ schemeTypes: "foundations",
16909
17808
  connectorProfiles: "foundations",
16910
17809
  subjects: "primary",
16911
17810
  instruments: "primary",
@@ -16930,6 +17829,13 @@ var TIER_BY_FIELD = {
16930
17829
  testPointSets: "secondary",
16931
17830
  referenceMaterials: "secondary",
16932
17831
  processes: "tertiary",
17832
+ // Process models (smart TODO.roadmap/40 batch 2) are tertiary beside
17833
+ // processes: the pipeline sequence/registers are the abstract-process
17834
+ // model's file-level furniture.
17835
+ processModels: "tertiary",
17836
+ // Document modules (smart TODO.roadmap/40 batch 2) are tertiary beside
17837
+ // processes: the module is the pipeline's document-level furniture.
17838
+ documentModules: "tertiary",
16933
17839
  pages: "tertiary",
16934
17840
  dataclasses: "tertiary",
16935
17841
  regs: "tertiary",
@@ -16946,6 +17852,11 @@ var TIER_BY_FIELD = {
16946
17852
  viewProfiles: "tertiary",
16947
17853
  provisions: "tertiary",
16948
17854
  notes: "cross-cutting",
17855
+ // Informative annexes (smart TODO.roadmap/40 batch 2) are
17856
+ // cross-cutting beside notes: an annex binds cited guidance into the
17857
+ // module — annotation about the document set, not machinery inside
17858
+ // the model.
17859
+ informativeAnnexes: "cross-cutting",
16949
17860
  // Invariants (smart gap-close E9) are cross-cutting beside notes: the
16950
17861
  // typed replacement for the note-family encoding — doctrine about the
16951
17862
  // model, not machinery inside it (the enforcement claims point at the
@@ -18030,6 +18941,56 @@ var CHECK_RULES = [
18030
18941
  "normal",
18031
18942
  "smart TODO.roadmap/40 (the packages-as-SSOT epic)"
18032
18943
  ),
18944
+ // C121 (smart TODO.roadmap/40 batch 2; the packages-as-SSOT epic): the
18945
+ // abstract-process model's framework bindings resolve — the process's
18946
+ // roles / organs / participant_kinds lists, the decision rule, the
18947
+ // declaration kind + the sign|update action vocabulary, the discharged
18948
+ // declaration gate, realized_by → process, approved_by → approval, and
18949
+ // the calendar windows' shape (kind vocabulary; exactly one of
18950
+ // years/months); the process_model's sequence members and register
18951
+ // maintainers ride the same rule. Per-register gating (the C58
18952
+ // doctrine): an edge is checked only when its target register is in
18953
+ // composition scope.
18954
+ R(
18955
+ "C121",
18956
+ "abstract-process-references-resolve",
18957
+ "process",
18958
+ "error",
18959
+ "normal",
18960
+ "smart TODO.roadmap/40 batch 2 (the packages-as-SSOT epic)"
18961
+ ),
18962
+ // C122 (smart TODO.roadmap/40 batch 2; the packages-as-SSOT epic): the
18963
+ // ISO/IEC 17067 register is composable — a manifest's scheme_type
18964
+ // token resolves against the composed scheme_type register when one is
18965
+ // in scope, and a scheme_type's determination / attestation /
18966
+ // surveillance.activities entries resolve against the composed
18967
+ // scheme_activity_kind menus. Per-register gating (the C58 doctrine);
18968
+ // the register-free fallback stays (the C89 spelling precedent), and
18969
+ // C98's hard-coded no-surveillance set defers to the register's
18970
+ // surveillance.required when the register is in scope.
18971
+ R(
18972
+ "C122",
18973
+ "scheme-type-resolves",
18974
+ "composition",
18975
+ "error",
18976
+ "normal",
18977
+ "smart TODO.roadmap/40 batch 2 (the packages-as-SSOT epic)"
18978
+ ),
18979
+ // C123 (smart TODO.roadmap/40 batch 2; the packages-as-SSOT epic): the
18980
+ // document module's edges resolve — sequence members → process,
18981
+ // register maintainers → governance_organ (per-register gated, the C58
18982
+ // doctrine), the declared namespace is an absolute requirement-
18983
+ // namespace path (the pin C119 now prefers over the requirement_class-
18984
+ // id derivation), and the informative annex's applies_to names a known
18985
+ // package (locator-gated, the C97-class resolution discipline).
18986
+ R(
18987
+ "C123",
18988
+ "document-module-references-resolve",
18989
+ "composition",
18990
+ "error",
18991
+ "normal",
18992
+ "smart TODO.roadmap/40 batch 2 (the packages-as-SSOT epic)"
18993
+ ),
18033
18994
  // ── quantities / time / duality (TODO.roadmap/06) ─────────────────
18034
18995
  R(
18035
18996
  "C32",
@@ -20756,6 +21717,12 @@ function checkPackage(dir, options = {}) {
20756
21717
  );
20757
21718
  continue;
20758
21719
  }
21720
+ if (s.period !== "" || s.barred.length > 0) {
21721
+ err(
21722
+ "C59",
21723
+ `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)`
21724
+ );
21725
+ }
20759
21726
  const [a, b] = s.pair;
20760
21727
  if (a === b) {
20761
21728
  err(
@@ -20777,8 +21744,150 @@ function checkPackage(dir, options = {}) {
20777
21744
  `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)`
20778
21745
  );
20779
21746
  }
21747
+ } else {
21748
+ if (s.barred.length === 0) {
21749
+ err(
21750
+ "C59",
21751
+ `process ${p.id}: segregation constraint "${s.id}" is consultancy_bar but bars no client relation \u2014 the barred list is required (segregation-members-resolve)`
21752
+ );
21753
+ }
21754
+ if (s.pair.length > 0) {
21755
+ err(
21756
+ "C59",
21757
+ `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)`
21758
+ );
21759
+ }
21760
+ }
21761
+ }
21762
+ }
21763
+ }
21764
+ {
21765
+ const apRoleIds = new Set((standard.roles ?? []).map((r) => r.id));
21766
+ const apGateIds = new Set((standard.declarationGates ?? []).map((g) => g.id));
21767
+ const apRuleIds = new Set((standard.decisionRules ?? []).map((r) => r.id));
21768
+ const apApprovalIds = new Set((standard.approvals ?? []).map((a) => a.id));
21769
+ const resolveOrganAp = (where, facet, id) => {
21770
+ if (organIds.size > 0 && id !== "" && !organIds.has(id)) {
21771
+ err(
21772
+ "C121",
21773
+ `${where}: ${facet} "${id}" is not a declared governance organ (abstract-process-references-resolve)`
21774
+ );
21775
+ }
21776
+ };
21777
+ const resolveKindAp = (where, facet, id) => {
21778
+ if (kindIds.size > 0 && id !== "" && !kindIds.has(id)) {
21779
+ err(
21780
+ "C121",
21781
+ `${where}: ${facet} "${id}" is not a declared participant kind (abstract-process-references-resolve)`
21782
+ );
21783
+ }
21784
+ };
21785
+ const resolveDeclarationAp = (where, facet, id) => {
21786
+ if (declIds.size > 0 && id !== "" && !declIds.has(id)) {
21787
+ err(
21788
+ "C121",
21789
+ `${where}: ${facet} "${id}" is not a declared declaration kind (abstract-process-references-resolve)`
21790
+ );
21791
+ }
21792
+ };
21793
+ const resolveProcessRef = (where, facet, id) => {
21794
+ if (frameworkProcessIds.size > 0 && !frameworkProcessIds.has(id)) {
21795
+ err(
21796
+ "C121",
21797
+ `${where}: ${facet} "${id}" is not a declared process (abstract-process-references-resolve)`
21798
+ );
21799
+ }
21800
+ };
21801
+ for (const p of standard.processes ?? []) {
21802
+ const where = `process ${p.id}`;
21803
+ if (apRoleIds.size > 0) {
21804
+ for (const r of p.roles ?? []) {
21805
+ if (!apRoleIds.has(r)) {
21806
+ err(
21807
+ "C121",
21808
+ `${where}: roles "${r}" is not a declared role (abstract-process-references-resolve)`
21809
+ );
21810
+ }
21811
+ }
21812
+ }
21813
+ for (const o of p.organs ?? []) {
21814
+ resolveOrganAp(where, "organs", o);
21815
+ }
21816
+ for (const k of p.participantKinds ?? []) {
21817
+ resolveKindAp(where, "participant_kinds", k);
21818
+ }
21819
+ if (p.decision) {
21820
+ if (p.decision.rule === "") {
21821
+ err(
21822
+ "C121",
21823
+ `${where}: the decision facet declares no rule \u2014 a decision names the decision_rule it applies (abstract-process-references-resolve)`
21824
+ );
21825
+ } else if (apRuleIds.size > 0 && !apRuleIds.has(p.decision.rule)) {
21826
+ err(
21827
+ "C121",
21828
+ `${where}: decision.rule "${p.decision.rule}" is not a declared decision rule (abstract-process-references-resolve)`
21829
+ );
21830
+ }
21831
+ }
21832
+ if (p.declaration) {
21833
+ if (p.declaration.kind === "") {
21834
+ err(
21835
+ "C121",
21836
+ `${where}: the declaration facet declares no kind \u2014 a declaration names the declaration_kind it signs or updates (abstract-process-references-resolve)`
21837
+ );
21838
+ } else {
21839
+ resolveDeclarationAp(where, "declaration.kind", p.declaration.kind);
21840
+ }
21841
+ if (p.declaration.action !== "sign" && p.declaration.action !== "update") {
21842
+ err(
21843
+ "C121",
21844
+ `${where}: declaration action "${p.declaration.action || "(none)"}" \u2014 a declaration is signed or updated (valid: sign, update) (abstract-process-references-resolve)`
21845
+ );
21846
+ }
21847
+ }
21848
+ if (p.dischargesGate !== "" && apGateIds.size > 0 && !apGateIds.has(p.dischargesGate)) {
21849
+ err(
21850
+ "C121",
21851
+ `${where}: discharges_gate "${p.dischargesGate}" is not a declared declaration gate (abstract-process-references-resolve)`
21852
+ );
21853
+ }
21854
+ for (const r of p.realizedBy ?? []) {
21855
+ resolveProcessRef(where, "realized_by", r);
21856
+ }
21857
+ if (apApprovalIds.size > 0) {
21858
+ for (const a of p.approvedBy ?? []) {
21859
+ if (!apApprovalIds.has(a)) {
21860
+ err(
21861
+ "C121",
21862
+ `${where}: approved_by "${a}" is not a declared approval (abstract-process-references-resolve)`
21863
+ );
21864
+ }
20780
21865
  }
20781
21866
  }
21867
+ for (const w of p.windows ?? []) {
21868
+ const wwhere = `${where} window ${w.id}`;
21869
+ if (w.kind !== "max_elapsed" && w.kind !== "min_elapsed") {
21870
+ err(
21871
+ "C121",
21872
+ `${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)`
21873
+ );
21874
+ }
21875
+ if (w.windowYears > 0 === w.windowMonths > 0) {
21876
+ err(
21877
+ "C121",
21878
+ `${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)`
21879
+ );
21880
+ }
21881
+ }
21882
+ }
21883
+ for (const m of standard.processModels ?? []) {
21884
+ const where = `process_model ${m.id}`;
21885
+ for (const s of m.sequence ?? []) {
21886
+ resolveProcessRef(where, "sequence", s);
21887
+ }
21888
+ for (const r of m.registers ?? []) {
21889
+ resolveOrganAp(`${where} register ${r.id}`, "maintainer", r.maintainer);
21890
+ }
20782
21891
  }
20783
21892
  }
20784
21893
  {
@@ -21851,6 +22960,86 @@ function checkPackage(dir, options = {}) {
21851
22960
  }
21852
22961
  }
21853
22962
  }
22963
+ {
22964
+ const schemeTypeIds = new Set((standard.schemeTypes ?? []).map((t) => t.id));
22965
+ const menuIds = new Set(
22966
+ (standard.schemeActivityKinds ?? []).map((k) => k.id)
22967
+ );
22968
+ const manifestSchemeType = standard.packageManifest?.schemeType;
22969
+ if (schemeTypeIds.size > 0 && manifestSchemeType && !schemeTypeIds.has(manifestSchemeType)) {
22970
+ err(
22971
+ "C122",
22972
+ `package "${standard.packageManifest.id}": scheme_type "${manifestSchemeType}" is not a declared scheme type of the in-scope ISO/IEC 17067 register (scheme-type-resolves)`
22973
+ );
22974
+ }
22975
+ if (menuIds.size > 0) {
22976
+ const resolveMenuEntry = (where, facet, id) => {
22977
+ if (!menuIds.has(id)) {
22978
+ err(
22979
+ "C122",
22980
+ `${where}: ${facet} "${id}" is not a declared scheme activity kind (scheme-type-resolves)`
22981
+ );
22982
+ }
22983
+ };
22984
+ for (const t of standard.schemeTypes ?? []) {
22985
+ const where = `scheme_type ${t.id}`;
22986
+ for (const d of t.determination) {
22987
+ resolveMenuEntry(where, "determination", d);
22988
+ }
22989
+ for (const a of t.attestation) {
22990
+ resolveMenuEntry(where, "attestation", a);
22991
+ }
22992
+ for (const s of t.surveillance?.activities ?? []) {
22993
+ resolveMenuEntry(where, "surveillance.activities", s);
22994
+ }
22995
+ }
22996
+ }
22997
+ }
22998
+ {
22999
+ const dmOrganIds = new Set(
23000
+ (standard.governanceOrgans ?? []).map((o) => o.id)
23001
+ );
23002
+ const dmProcessIds = new Set((standard.processes ?? []).map((p) => p.id));
23003
+ for (const m of standard.documentModules ?? []) {
23004
+ const where = `document_module ${m.id}`;
23005
+ if (m.namespace !== "" && !m.namespace.startsWith("/")) {
23006
+ err(
23007
+ "C123",
23008
+ `${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)`
23009
+ );
23010
+ }
23011
+ if (dmProcessIds.size > 0) {
23012
+ for (const s of m.sequence ?? []) {
23013
+ if (!dmProcessIds.has(s)) {
23014
+ err(
23015
+ "C123",
23016
+ `${where}: sequence "${s}" is not a declared process (document-module-references-resolve)`
23017
+ );
23018
+ }
23019
+ }
23020
+ }
23021
+ if (dmOrganIds.size > 0) {
23022
+ for (const r of m.registers ?? []) {
23023
+ if (r.maintainer !== "" && !dmOrganIds.has(r.maintainer)) {
23024
+ err(
23025
+ "C123",
23026
+ `${where} register ${r.id}: maintainer "${r.maintainer}" is not a declared governance organ (document-module-references-resolve)`
23027
+ );
23028
+ }
23029
+ }
23030
+ }
23031
+ }
23032
+ if (options.resolvePackage) {
23033
+ for (const a of standard.informativeAnnexes ?? []) {
23034
+ if (a.appliesTo !== "" && !resolveDepManifest(a.appliesTo)) {
23035
+ err(
23036
+ "C123",
23037
+ `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)`
23038
+ );
23039
+ }
23040
+ }
23041
+ }
23042
+ }
21854
23043
  if (productManifest?.kind === "certification_program") {
21855
23044
  const mapsTo = productManifest.mapsTo ?? [];
21856
23045
  if (mapsTo.length === 0) {
@@ -21879,7 +23068,11 @@ function checkPackage(dir, options = {}) {
21879
23068
  }
21880
23069
  }
21881
23070
  const SCHEME_TYPES_WITHOUT_SURVEILLANCE = /* @__PURE__ */ new Set(["type_1a", "type_1b"]);
21882
- if (productManifest.schemeType && SCHEME_TYPES_WITHOUT_SURVEILLANCE.has(productManifest.schemeType)) {
23071
+ const registerEntry = (standard.schemeTypes ?? []).find(
23072
+ (t) => t.id === productManifest.schemeType
23073
+ );
23074
+ const noSurveillance = registerEntry ? !registerEntry.surveillance?.required : SCHEME_TYPES_WITHOUT_SURVEILLANCE.has(productManifest.schemeType ?? "");
23075
+ if (productManifest.schemeType && noSurveillance) {
21883
23076
  const claims = [];
21884
23077
  if ((standard.monitors ?? []).length > 0) {
21885
23078
  claims.push(