@primmel/primmel 1.10.0 → 1.11.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 (71) hide show
  1. package/dist/src/check-rules.d.ts.map +1 -1
  2. package/dist/src/check-rules.js +11 -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 +102 -0
  6. package/dist/src/check.js.map +1 -1
  7. package/dist/src/ser-des/config/decisionRule.d.ts +5 -0
  8. package/dist/src/ser-des/config/decisionRule.d.ts.map +1 -0
  9. package/dist/src/ser-des/config/decisionRule.js +357 -0
  10. package/dist/src/ser-des/config/decisionRule.js.map +1 -0
  11. package/dist/src/ser-des/config/declaration.d.ts +9 -0
  12. package/dist/src/ser-des/config/declaration.d.ts.map +1 -0
  13. package/dist/src/ser-des/config/declaration.js +288 -0
  14. package/dist/src/ser-des/config/declaration.js.map +1 -0
  15. package/dist/src/ser-des/config/frameworkDocument.d.ts +9 -0
  16. package/dist/src/ser-des/config/frameworkDocument.d.ts.map +1 -0
  17. package/dist/src/ser-des/config/frameworkDocument.js +254 -0
  18. package/dist/src/ser-des/config/frameworkDocument.js.map +1 -0
  19. package/dist/src/ser-des/config/governanceOrgan.d.ts +5 -0
  20. package/dist/src/ser-des/config/governanceOrgan.d.ts.map +1 -0
  21. package/dist/src/ser-des/config/governanceOrgan.js +111 -0
  22. package/dist/src/ser-des/config/governanceOrgan.js.map +1 -0
  23. package/dist/src/ser-des/config/index.d.ts.map +1 -1
  24. package/dist/src/ser-des/config/index.js +91 -0
  25. package/dist/src/ser-des/config/index.js.map +1 -1
  26. package/dist/src/ser-des/config/participantKind.d.ts +5 -0
  27. package/dist/src/ser-des/config/participantKind.d.ts.map +1 -0
  28. package/dist/src/ser-des/config/participantKind.js +329 -0
  29. package/dist/src/ser-des/config/participantKind.js.map +1 -0
  30. package/dist/src/ser-des/config/scheme.d.ts +7 -0
  31. package/dist/src/ser-des/config/scheme.d.ts.map +1 -0
  32. package/dist/src/ser-des/config/scheme.js +434 -0
  33. package/dist/src/ser-des/config/scheme.js.map +1 -0
  34. package/dist/src/ser-des/package.d.ts +3 -0
  35. package/dist/src/ser-des/package.d.ts.map +1 -1
  36. package/dist/src/ser-des/package.js +40 -5
  37. package/dist/src/ser-des/package.js.map +1 -1
  38. package/dist/src/ser-des/parse.d.ts.map +1 -1
  39. package/dist/src/ser-des/parse.js +12 -0
  40. package/dist/src/ser-des/parse.js.map +1 -1
  41. package/dist/src/ser-des/types.d.ts +19 -0
  42. package/dist/src/ser-des/types.d.ts.map +1 -1
  43. package/dist/src/types/DecisionRule.d.ts +84 -0
  44. package/dist/src/types/DecisionRule.d.ts.map +1 -0
  45. package/dist/src/types/DecisionRule.js +17 -0
  46. package/dist/src/types/DecisionRule.js.map +1 -0
  47. package/dist/src/types/Declaration.d.ts +68 -0
  48. package/dist/src/types/Declaration.d.ts.map +1 -0
  49. package/dist/src/types/Declaration.js +22 -0
  50. package/dist/src/types/Declaration.js.map +1 -0
  51. package/dist/src/types/FrameworkDocument.d.ts +57 -0
  52. package/dist/src/types/FrameworkDocument.d.ts.map +1 -0
  53. package/dist/src/types/FrameworkDocument.js +21 -0
  54. package/dist/src/types/FrameworkDocument.js.map +1 -0
  55. package/dist/src/types/GovernanceOrgan.d.ts +23 -0
  56. package/dist/src/types/GovernanceOrgan.d.ts.map +1 -0
  57. package/dist/src/types/GovernanceOrgan.js +14 -0
  58. package/dist/src/types/GovernanceOrgan.js.map +1 -0
  59. package/dist/src/types/ParticipantKind.d.ts +82 -0
  60. package/dist/src/types/ParticipantKind.d.ts.map +1 -0
  61. package/dist/src/types/ParticipantKind.js +22 -0
  62. package/dist/src/types/ParticipantKind.js.map +1 -0
  63. package/dist/src/types/Scheme.d.ts +99 -0
  64. package/dist/src/types/Scheme.d.ts.map +1 -0
  65. package/dist/src/types/Scheme.js +24 -0
  66. package/dist/src/types/Scheme.js.map +1 -0
  67. package/dist/src/types/Standard.d.ts +19 -0
  68. package/dist/src/types/Standard.d.ts.map +1 -1
  69. package/dist-browser/index.mjs +988 -177
  70. package/dist-cli/primmel.mjs +1713 -3
  71. package/package.json +1 -1
@@ -249,6 +249,18 @@ function parse(mmelString, parsers, options = {}) {
249
249
  duals: {},
250
250
  // Primmel v3 ISO/IEC 17000 activity taxonomy (TODO.roadmap/39)
251
251
  activityArchetypes: {},
252
+ // Primmel v3 certification-framework model (smart TODO.roadmap/40)
253
+ participantKinds: {},
254
+ governanceOrgans: {},
255
+ declarationKinds: {},
256
+ declarationStatuses: {},
257
+ declarationGates: {},
258
+ schemeDefinitions: {},
259
+ schemeLifecycles: {},
260
+ frameworkDocuments: {},
261
+ documentPrecedences: {},
262
+ autoInclusions: {},
263
+ decisionRules: {},
252
264
  // Primmel v3 twin interface (TODO.roadmap/32)
253
265
  connectorProfiles: {},
254
266
  // Primmel v3 continuous compliance (TODO.roadmap/34)
@@ -13791,6 +13803,1450 @@ var dumpActivityArchetype = function(a) {
13791
13803
  return out;
13792
13804
  };
13793
13805
 
13806
+ // src/ser-des/config/participantKind.ts
13807
+ function parseCompetence(block) {
13808
+ const competence = {
13809
+ delegates_to: "",
13810
+ clause: "",
13811
+ note: ""
13812
+ };
13813
+ forEachEntry(
13814
+ block,
13815
+ (keyword, value) => {
13816
+ if (keyword === "delegates_to") {
13817
+ competence.delegates_to = stripWrapping(value());
13818
+ } else if (keyword === "clause") {
13819
+ competence.clause = stripWrapping(value());
13820
+ } else if (keyword === "note") {
13821
+ competence.note = stripWrapping(value());
13822
+ } else {
13823
+ return false;
13824
+ }
13825
+ return true;
13826
+ },
13827
+ { construct: "participant_kind competence", id: "" }
13828
+ );
13829
+ return competence;
13830
+ }
13831
+ function parseApproval2(block) {
13832
+ const approval = {
13833
+ decided_by: "",
13834
+ on_recommendation_of: "",
13835
+ procedure: "",
13836
+ clause: ""
13837
+ };
13838
+ forEachEntry(
13839
+ block,
13840
+ (keyword, value) => {
13841
+ if (keyword === "decided_by") {
13842
+ approval.decided_by = stripWrapping(value());
13843
+ } else if (keyword === "on_recommendation_of") {
13844
+ approval.on_recommendation_of = stripWrapping(value());
13845
+ } else if (keyword === "procedure") {
13846
+ approval.procedure = stripWrapping(value());
13847
+ } else if (keyword === "clause") {
13848
+ approval.clause = stripWrapping(value());
13849
+ } else {
13850
+ return false;
13851
+ }
13852
+ return true;
13853
+ },
13854
+ { construct: "participant_kind approval", id: "" }
13855
+ );
13856
+ return approval;
13857
+ }
13858
+ function parseSubkind(id, block) {
13859
+ const subkind = {
13860
+ id,
13861
+ label: "",
13862
+ term: "",
13863
+ definition: "",
13864
+ data_flag: "",
13865
+ acceptance: "",
13866
+ acceptance_note: ""
13867
+ };
13868
+ forEachEntry(
13869
+ block,
13870
+ (keyword, value) => {
13871
+ if (keyword === "label") {
13872
+ subkind.label = stripWrapping(value());
13873
+ } else if (keyword === "term") {
13874
+ subkind.term = stripWrapping(value());
13875
+ } else if (keyword === "definition") {
13876
+ subkind.definition = stripWrapping(value());
13877
+ } else if (keyword === "data_flag") {
13878
+ subkind.data_flag = stripWrapping(value());
13879
+ } else if (keyword === "acceptance") {
13880
+ subkind.acceptance = stripWrapping(value());
13881
+ } else if (keyword === "acceptance_note") {
13882
+ subkind.acceptance_note = stripWrapping(value());
13883
+ } else {
13884
+ return false;
13885
+ }
13886
+ return true;
13887
+ },
13888
+ { construct: "participant_kind subkind", id }
13889
+ );
13890
+ return subkind;
13891
+ }
13892
+ var parseParticipantKind = (id, data) => {
13893
+ const kind = {
13894
+ id,
13895
+ label: "",
13896
+ term: "",
13897
+ clause: "",
13898
+ definition: "",
13899
+ member: "",
13900
+ competence: null,
13901
+ approval: null,
13902
+ approved_by: "",
13903
+ designated_by: "",
13904
+ declaration: "",
13905
+ admission: "",
13906
+ becomes: "",
13907
+ procedure: "",
13908
+ subkinds: [],
13909
+ source: { doc: "", clause: "" }
13910
+ };
13911
+ forEachEntry(
13912
+ data,
13913
+ (keyword, value, peek) => {
13914
+ if (keyword === "label") {
13915
+ kind.label = stripWrapping(value());
13916
+ } else if (keyword === "term") {
13917
+ kind.term = stripWrapping(value());
13918
+ } else if (keyword === "clause") {
13919
+ kind.clause = stripWrapping(value());
13920
+ } else if (keyword === "definition") {
13921
+ kind.definition = stripWrapping(value());
13922
+ } else if (keyword === "member") {
13923
+ kind.member = stripWrapping(value());
13924
+ } else if (keyword === "competence") {
13925
+ kind.competence = parseCompetence(unwrapBlock(value()));
13926
+ } else if (keyword === "approval") {
13927
+ kind.approval = parseApproval2(unwrapBlock(value()));
13928
+ } else if (keyword === "approved_by") {
13929
+ kind.approved_by = stripWrapping(value());
13930
+ } else if (keyword === "designated_by") {
13931
+ kind.designated_by = stripWrapping(value());
13932
+ } else if (keyword === "declaration") {
13933
+ kind.declaration = stripWrapping(value());
13934
+ } else if (keyword === "admission") {
13935
+ kind.admission = stripWrapping(value());
13936
+ } else if (keyword === "becomes") {
13937
+ kind.becomes = stripWrapping(value());
13938
+ } else if (keyword === "procedure") {
13939
+ kind.procedure = stripWrapping(value());
13940
+ } else if (keyword === "subkind") {
13941
+ const subId = stripWrapping(value());
13942
+ const head = peek();
13943
+ if (head === void 0 || !head.startsWith("{")) {
13944
+ throw new Error(
13945
+ `Parsing error: participant_kind. ID ${id}: subkind ${subId} is missing its block`
13946
+ );
13947
+ }
13948
+ kind.subkinds.push(parseSubkind(subId, unwrapBlock(value())));
13949
+ } else if (keyword === "source") {
13950
+ kind.source = readSource(unwrapBlock(value()));
13951
+ } else {
13952
+ return false;
13953
+ }
13954
+ return true;
13955
+ },
13956
+ { construct: "participant_kind", id }
13957
+ );
13958
+ return (ctx) => {
13959
+ ctx.participantKinds[id] = kind;
13960
+ return ctx;
13961
+ };
13962
+ };
13963
+ function dumpCompetence(c) {
13964
+ let out = " competence {\n";
13965
+ if (c.delegates_to) {
13966
+ out += " delegates_to " + dumpBareSafe(c.delegates_to) + "\n";
13967
+ }
13968
+ if (c.clause) {
13969
+ out += ' clause "' + escapeString(c.clause) + '"\n';
13970
+ }
13971
+ if (c.note) {
13972
+ out += ' note "' + escapeString(c.note) + '"\n';
13973
+ }
13974
+ out += " }\n";
13975
+ return out;
13976
+ }
13977
+ function dumpApproval2(a) {
13978
+ let out = " approval {\n";
13979
+ if (a.decided_by) {
13980
+ out += " decided_by " + dumpBareSafe(a.decided_by) + "\n";
13981
+ }
13982
+ if (a.on_recommendation_of) {
13983
+ out += " on_recommendation_of " + dumpBareSafe(a.on_recommendation_of) + "\n";
13984
+ }
13985
+ if (a.procedure) {
13986
+ out += ' procedure "' + escapeString(a.procedure) + '"\n';
13987
+ }
13988
+ if (a.clause) {
13989
+ out += ' clause "' + escapeString(a.clause) + '"\n';
13990
+ }
13991
+ out += " }\n";
13992
+ return out;
13993
+ }
13994
+ function dumpSubkind(s) {
13995
+ let out = " subkind " + dumpBareSafe(s.id) + " {\n";
13996
+ if (s.label) {
13997
+ out += ' label "' + escapeString(s.label) + '"\n';
13998
+ }
13999
+ if (s.term) {
14000
+ out += ' term "' + escapeString(s.term) + '"\n';
14001
+ }
14002
+ if (s.definition) {
14003
+ out += ' definition "' + escapeString(s.definition) + '"\n';
14004
+ }
14005
+ if (s.data_flag) {
14006
+ out += ' data_flag "' + escapeString(s.data_flag) + '"\n';
14007
+ }
14008
+ if (s.acceptance) {
14009
+ out += " acceptance " + dumpBareSafe(s.acceptance) + "\n";
14010
+ }
14011
+ if (s.acceptance_note) {
14012
+ out += ' acceptance_note "' + escapeString(s.acceptance_note) + '"\n';
14013
+ }
14014
+ out += " }\n";
14015
+ return out;
14016
+ }
14017
+ var dumpParticipantKind = function(k) {
14018
+ let out = "participant_kind " + k.id + " {\n";
14019
+ if (k.label) {
14020
+ out += ' label "' + escapeString(k.label) + '"\n';
14021
+ }
14022
+ if (k.term) {
14023
+ out += ' term "' + escapeString(k.term) + '"\n';
14024
+ }
14025
+ if (k.clause) {
14026
+ out += ' clause "' + escapeString(k.clause) + '"\n';
14027
+ }
14028
+ if (k.definition) {
14029
+ out += ' definition "' + escapeString(k.definition) + '"\n';
14030
+ }
14031
+ if (k.member) {
14032
+ out += " member " + dumpBareSafe(k.member) + "\n";
14033
+ }
14034
+ if (k.competence) {
14035
+ out += dumpCompetence(k.competence);
14036
+ }
14037
+ if (k.approval) {
14038
+ out += dumpApproval2(k.approval);
14039
+ }
14040
+ if (k.approved_by) {
14041
+ out += " approved_by " + dumpBareSafe(k.approved_by) + "\n";
14042
+ }
14043
+ if (k.designated_by) {
14044
+ out += " designated_by " + dumpBareSafe(k.designated_by) + "\n";
14045
+ }
14046
+ if (k.declaration) {
14047
+ out += " declaration " + dumpBareSafe(k.declaration) + "\n";
14048
+ }
14049
+ if (k.admission) {
14050
+ out += ' admission "' + escapeString(k.admission) + '"\n';
14051
+ }
14052
+ if (k.becomes) {
14053
+ out += " becomes " + dumpBareSafe(k.becomes) + "\n";
14054
+ }
14055
+ if (k.procedure) {
14056
+ out += ' procedure "' + escapeString(k.procedure) + '"\n';
14057
+ }
14058
+ for (const s of k.subkinds) {
14059
+ out += dumpSubkind(s);
14060
+ }
14061
+ if (k.source.doc || k.source.clause) {
14062
+ out += " source {\n";
14063
+ if (k.source.doc) {
14064
+ out += ' doc "' + escapeString(k.source.doc) + '"\n';
14065
+ }
14066
+ if (k.source.clause) {
14067
+ out += ' clause "' + escapeString(k.source.clause) + '"\n';
14068
+ }
14069
+ out += " }\n";
14070
+ }
14071
+ out += "}\n";
14072
+ return out;
14073
+ };
14074
+
14075
+ // src/ser-des/config/governanceOrgan.ts
14076
+ var parseGovernanceOrgan = (id, data) => {
14077
+ const organ = {
14078
+ id,
14079
+ label: "",
14080
+ term: "",
14081
+ clause: "",
14082
+ mandate: "",
14083
+ sub_committee_of: "",
14084
+ independent_of: "",
14085
+ source: { doc: "", clause: "" }
14086
+ };
14087
+ forEachEntry(
14088
+ data,
14089
+ (keyword, value) => {
14090
+ if (keyword === "label") {
14091
+ organ.label = stripWrapping(value());
14092
+ } else if (keyword === "term") {
14093
+ organ.term = stripWrapping(value());
14094
+ } else if (keyword === "clause") {
14095
+ organ.clause = stripWrapping(value());
14096
+ } else if (keyword === "mandate") {
14097
+ organ.mandate = stripWrapping(value());
14098
+ } else if (keyword === "sub_committee_of") {
14099
+ organ.sub_committee_of = stripWrapping(value());
14100
+ } else if (keyword === "independent_of") {
14101
+ organ.independent_of = stripWrapping(value());
14102
+ } else if (keyword === "source") {
14103
+ organ.source = readSource(unwrapBlock(value()));
14104
+ } else {
14105
+ return false;
14106
+ }
14107
+ return true;
14108
+ },
14109
+ { construct: "governance_organ", id }
14110
+ );
14111
+ return (ctx) => {
14112
+ ctx.governanceOrgans[id] = organ;
14113
+ return ctx;
14114
+ };
14115
+ };
14116
+ var dumpGovernanceOrgan = function(o) {
14117
+ let out = "governance_organ " + o.id + " {\n";
14118
+ if (o.label) {
14119
+ out += ' label "' + escapeString(o.label) + '"\n';
14120
+ }
14121
+ if (o.term) {
14122
+ out += ' term "' + escapeString(o.term) + '"\n';
14123
+ }
14124
+ if (o.clause) {
14125
+ out += ' clause "' + escapeString(o.clause) + '"\n';
14126
+ }
14127
+ if (o.mandate) {
14128
+ out += ' mandate "' + escapeString(o.mandate) + '"\n';
14129
+ }
14130
+ if (o.sub_committee_of) {
14131
+ out += " sub_committee_of " + dumpBareSafe(o.sub_committee_of) + "\n";
14132
+ }
14133
+ if (o.independent_of) {
14134
+ out += " independent_of " + dumpBareSafe(o.independent_of) + "\n";
14135
+ }
14136
+ if (o.source.doc || o.source.clause) {
14137
+ out += " source {\n";
14138
+ if (o.source.doc) {
14139
+ out += ' doc "' + escapeString(o.source.doc) + '"\n';
14140
+ }
14141
+ if (o.source.clause) {
14142
+ out += ' clause "' + escapeString(o.source.clause) + '"\n';
14143
+ }
14144
+ out += " }\n";
14145
+ }
14146
+ out += "}\n";
14147
+ return out;
14148
+ };
14149
+
14150
+ // src/ser-des/config/declaration.ts
14151
+ function parseContentSlot(id, block) {
14152
+ const slot = { id, clause: "", description: "" };
14153
+ forEachEntry(
14154
+ block,
14155
+ (keyword, value) => {
14156
+ if (keyword === "clause") {
14157
+ slot.clause = stripWrapping(value());
14158
+ } else if (keyword === "description") {
14159
+ slot.description = stripWrapping(value());
14160
+ } else {
14161
+ return false;
14162
+ }
14163
+ return true;
14164
+ },
14165
+ { construct: "declaration_kind content", id }
14166
+ );
14167
+ return slot;
14168
+ }
14169
+ var parseDeclarationKind = (id, data) => {
14170
+ const kind = {
14171
+ id,
14172
+ label: "",
14173
+ holder: "",
14174
+ clause: "",
14175
+ procedure: "",
14176
+ definition: "",
14177
+ scope_model: "",
14178
+ scheme_a_obligation: "",
14179
+ content: [],
14180
+ source: { doc: "", clause: "" }
14181
+ };
14182
+ forEachEntry(
14183
+ data,
14184
+ (keyword, value, peek) => {
14185
+ if (keyword === "label") {
14186
+ kind.label = stripWrapping(value());
14187
+ } else if (keyword === "holder") {
14188
+ kind.holder = stripWrapping(value());
14189
+ } else if (keyword === "clause") {
14190
+ kind.clause = stripWrapping(value());
14191
+ } else if (keyword === "procedure") {
14192
+ kind.procedure = stripWrapping(value());
14193
+ } else if (keyword === "definition") {
14194
+ kind.definition = stripWrapping(value());
14195
+ } else if (keyword === "scope_model") {
14196
+ kind.scope_model = stripWrapping(value());
14197
+ } else if (keyword === "scheme_a_obligation") {
14198
+ kind.scheme_a_obligation = stripWrapping(value());
14199
+ } else if (keyword === "content") {
14200
+ const slotId = stripWrapping(value());
14201
+ const head = peek();
14202
+ if (head === void 0 || !head.startsWith("{")) {
14203
+ throw new Error(
14204
+ `Parsing error: declaration_kind. ID ${id}: content ${slotId} is missing its block`
14205
+ );
14206
+ }
14207
+ kind.content.push(parseContentSlot(slotId, unwrapBlock(value())));
14208
+ } else if (keyword === "source") {
14209
+ kind.source = readSource(unwrapBlock(value()));
14210
+ } else {
14211
+ return false;
14212
+ }
14213
+ return true;
14214
+ },
14215
+ { construct: "declaration_kind", id }
14216
+ );
14217
+ return (ctx) => {
14218
+ ctx.declarationKinds[id] = kind;
14219
+ return ctx;
14220
+ };
14221
+ };
14222
+ function dumpContentSlot(s) {
14223
+ let out = " content " + dumpBareSafe(s.id) + " {\n";
14224
+ if (s.clause) {
14225
+ out += ' clause "' + escapeString(s.clause) + '"\n';
14226
+ }
14227
+ if (s.description) {
14228
+ out += ' description "' + escapeString(s.description) + '"\n';
14229
+ }
14230
+ out += " }\n";
14231
+ return out;
14232
+ }
14233
+ function dumpSourceBlock(src) {
14234
+ let out = " source {\n";
14235
+ if (src.doc) {
14236
+ out += ' doc "' + escapeString(src.doc) + '"\n';
14237
+ }
14238
+ if (src.clause) {
14239
+ out += ' clause "' + escapeString(src.clause) + '"\n';
14240
+ }
14241
+ out += " }\n";
14242
+ return out;
14243
+ }
14244
+ var dumpDeclarationKind = function(k) {
14245
+ let out = "declaration_kind " + k.id + " {\n";
14246
+ if (k.label) {
14247
+ out += ' label "' + escapeString(k.label) + '"\n';
14248
+ }
14249
+ if (k.holder) {
14250
+ out += " holder " + dumpBareSafe(k.holder) + "\n";
14251
+ }
14252
+ if (k.clause) {
14253
+ out += ' clause "' + escapeString(k.clause) + '"\n';
14254
+ }
14255
+ if (k.procedure) {
14256
+ out += ' procedure "' + escapeString(k.procedure) + '"\n';
14257
+ }
14258
+ if (k.definition) {
14259
+ out += ' definition "' + escapeString(k.definition) + '"\n';
14260
+ }
14261
+ if (k.scope_model) {
14262
+ out += " scope_model " + dumpBareSafe(k.scope_model) + "\n";
14263
+ }
14264
+ if (k.scheme_a_obligation) {
14265
+ out += ' scheme_a_obligation "' + escapeString(k.scheme_a_obligation) + '"\n';
14266
+ }
14267
+ for (const s of k.content) {
14268
+ out += dumpContentSlot(s);
14269
+ }
14270
+ if (k.source.doc || k.source.clause) {
14271
+ out += dumpSourceBlock(k.source);
14272
+ }
14273
+ out += "}\n";
14274
+ return out;
14275
+ };
14276
+ var parseDeclarationStatus = (id, data) => {
14277
+ const status = { id, description: "" };
14278
+ forEachEntry(
14279
+ data,
14280
+ (keyword, value) => {
14281
+ if (keyword === "description") {
14282
+ status.description = stripWrapping(value());
14283
+ } else {
14284
+ return false;
14285
+ }
14286
+ return true;
14287
+ },
14288
+ { construct: "declaration_status", id }
14289
+ );
14290
+ return (ctx) => {
14291
+ ctx.declarationStatuses[id] = status;
14292
+ return ctx;
14293
+ };
14294
+ };
14295
+ var dumpDeclarationStatus = function(s) {
14296
+ let out = "declaration_status " + s.id + " {\n";
14297
+ if (s.description) {
14298
+ out += ' description "' + escapeString(s.description) + '"\n';
14299
+ }
14300
+ out += "}\n";
14301
+ return out;
14302
+ };
14303
+ var parseDeclarationGate = (id, data) => {
14304
+ const gate = {
14305
+ id,
14306
+ clause: "",
14307
+ statement: "",
14308
+ holder: "",
14309
+ declaration: "",
14310
+ blocks: [],
14311
+ blocks_note: "",
14312
+ scope_checked: [],
14313
+ source: { doc: "", clause: "" }
14314
+ };
14315
+ forEachEntry(
14316
+ data,
14317
+ (keyword, value) => {
14318
+ if (keyword === "clause") {
14319
+ gate.clause = stripWrapping(value());
14320
+ } else if (keyword === "statement") {
14321
+ gate.statement = stripWrapping(value());
14322
+ } else if (keyword === "holder") {
14323
+ gate.holder = stripWrapping(value());
14324
+ } else if (keyword === "declaration") {
14325
+ gate.declaration = stripWrapping(value());
14326
+ } else if (keyword === "blocks") {
14327
+ gate.blocks = tokenizePackage(unwrapBlock(value())).filter(
14328
+ (s) => s.length > 0
14329
+ );
14330
+ } else if (keyword === "blocks_note") {
14331
+ gate.blocks_note = stripWrapping(value());
14332
+ } else if (keyword === "scope_checked") {
14333
+ gate.scope_checked = tokenizePackage(unwrapBlock(value())).filter(
14334
+ (s) => s.length > 0
14335
+ );
14336
+ } else if (keyword === "source") {
14337
+ gate.source = readSource(unwrapBlock(value()));
14338
+ } else {
14339
+ return false;
14340
+ }
14341
+ return true;
14342
+ },
14343
+ { construct: "declaration_gate", id }
14344
+ );
14345
+ return (ctx) => {
14346
+ ctx.declarationGates[id] = gate;
14347
+ return ctx;
14348
+ };
14349
+ };
14350
+ var dumpDeclarationGate = function(g) {
14351
+ let out = "declaration_gate " + g.id + " {\n";
14352
+ if (g.clause) {
14353
+ out += ' clause "' + escapeString(g.clause) + '"\n';
14354
+ }
14355
+ if (g.statement) {
14356
+ out += ' statement "' + escapeString(g.statement) + '"\n';
14357
+ }
14358
+ if (g.holder) {
14359
+ out += " holder " + dumpBareSafe(g.holder) + "\n";
14360
+ }
14361
+ if (g.declaration) {
14362
+ out += " declaration " + dumpBareSafe(g.declaration) + "\n";
14363
+ }
14364
+ if (g.blocks.length > 0) {
14365
+ out += " blocks { " + g.blocks.map(dumpBareSafe).join(" ") + " }\n";
14366
+ }
14367
+ if (g.blocks_note) {
14368
+ out += ' blocks_note "' + escapeString(g.blocks_note) + '"\n';
14369
+ }
14370
+ if (g.scope_checked.length > 0) {
14371
+ out += " scope_checked { " + g.scope_checked.map(dumpBareSafe).join(" ") + " }\n";
14372
+ }
14373
+ if (g.source.doc || g.source.clause) {
14374
+ out += dumpSourceBlock(g.source);
14375
+ }
14376
+ out += "}\n";
14377
+ return out;
14378
+ };
14379
+
14380
+ // src/ser-des/config/scheme.ts
14381
+ function parseDemonstration(block) {
14382
+ const demonstration = {
14383
+ method: "",
14384
+ clause: "",
14385
+ basis: [],
14386
+ note: ""
14387
+ };
14388
+ forEachEntry(
14389
+ block,
14390
+ (keyword, value) => {
14391
+ if (keyword === "method") {
14392
+ demonstration.method = stripWrapping(value());
14393
+ } else if (keyword === "clause") {
14394
+ demonstration.clause = stripWrapping(value());
14395
+ } else if (keyword === "basis") {
14396
+ demonstration.basis = tokenizePackage(unwrapBlock(value())).filter(
14397
+ (s) => s.length > 0
14398
+ );
14399
+ } else if (keyword === "note") {
14400
+ demonstration.note = stripWrapping(value());
14401
+ } else {
14402
+ return false;
14403
+ }
14404
+ return true;
14405
+ },
14406
+ { construct: "scheme_definition demonstration", id: "" }
14407
+ );
14408
+ return demonstration;
14409
+ }
14410
+ var parseSchemeDefinition = (id, data) => {
14411
+ const scheme = {
14412
+ id,
14413
+ label: "",
14414
+ term: "",
14415
+ clause: "",
14416
+ definition: "",
14417
+ demonstration: null,
14418
+ source: { doc: "", clause: "" }
14419
+ };
14420
+ forEachEntry(
14421
+ data,
14422
+ (keyword, value) => {
14423
+ if (keyword === "label") {
14424
+ scheme.label = stripWrapping(value());
14425
+ } else if (keyword === "term") {
14426
+ scheme.term = stripWrapping(value());
14427
+ } else if (keyword === "clause") {
14428
+ scheme.clause = stripWrapping(value());
14429
+ } else if (keyword === "definition") {
14430
+ scheme.definition = stripWrapping(value());
14431
+ } else if (keyword === "demonstration") {
14432
+ scheme.demonstration = parseDemonstration(unwrapBlock(value()));
14433
+ } else if (keyword === "source") {
14434
+ scheme.source = readSource(unwrapBlock(value()));
14435
+ } else {
14436
+ return false;
14437
+ }
14438
+ return true;
14439
+ },
14440
+ { construct: "scheme_definition", id }
14441
+ );
14442
+ return (ctx) => {
14443
+ ctx.schemeDefinitions[id] = scheme;
14444
+ return ctx;
14445
+ };
14446
+ };
14447
+ function dumpSourceBlock2(src) {
14448
+ let out = " source {\n";
14449
+ if (src.doc) {
14450
+ out += ' doc "' + escapeString(src.doc) + '"\n';
14451
+ }
14452
+ if (src.clause) {
14453
+ out += ' clause "' + escapeString(src.clause) + '"\n';
14454
+ }
14455
+ out += " }\n";
14456
+ return out;
14457
+ }
14458
+ var dumpSchemeDefinition = function(s) {
14459
+ let out = "scheme_definition " + s.id + " {\n";
14460
+ if (s.label) {
14461
+ out += ' label "' + escapeString(s.label) + '"\n';
14462
+ }
14463
+ if (s.term) {
14464
+ out += ' term "' + escapeString(s.term) + '"\n';
14465
+ }
14466
+ if (s.clause) {
14467
+ out += ' clause "' + escapeString(s.clause) + '"\n';
14468
+ }
14469
+ if (s.definition) {
14470
+ out += ' definition "' + escapeString(s.definition) + '"\n';
14471
+ }
14472
+ if (s.demonstration) {
14473
+ const d = s.demonstration;
14474
+ out += " demonstration {\n";
14475
+ if (d.method) {
14476
+ out += " method " + dumpBareSafe(d.method) + "\n";
14477
+ }
14478
+ if (d.clause) {
14479
+ out += ' clause "' + escapeString(d.clause) + '"\n';
14480
+ }
14481
+ if (d.basis.length > 0) {
14482
+ out += " basis { " + d.basis.map(dumpBareSafe).join(" ") + " }\n";
14483
+ }
14484
+ if (d.note) {
14485
+ out += ' note "' + escapeString(d.note) + '"\n';
14486
+ }
14487
+ out += " }\n";
14488
+ }
14489
+ if (s.source.doc || s.source.clause) {
14490
+ out += dumpSourceBlock2(s.source);
14491
+ }
14492
+ out += "}\n";
14493
+ return out;
14494
+ };
14495
+ function parseEntry(block) {
14496
+ const entry = {
14497
+ action: "",
14498
+ automatic: false,
14499
+ clause: "",
14500
+ conditions_ref: "",
14501
+ description: ""
14502
+ };
14503
+ forEachEntry(
14504
+ block,
14505
+ (keyword, value) => {
14506
+ if (keyword === "action") {
14507
+ entry.action = stripWrapping(value());
14508
+ } else if (keyword === "automatic") {
14509
+ entry.automatic = value() === "true";
14510
+ } else if (keyword === "clause") {
14511
+ entry.clause = stripWrapping(value());
14512
+ } else if (keyword === "conditions_ref") {
14513
+ entry.conditions_ref = stripWrapping(value());
14514
+ } else if (keyword === "description") {
14515
+ entry.description = stripWrapping(value());
14516
+ } else {
14517
+ return false;
14518
+ }
14519
+ return true;
14520
+ },
14521
+ { construct: "scheme_lifecycle entry", id: "" }
14522
+ );
14523
+ return entry;
14524
+ }
14525
+ function parseTransition(block) {
14526
+ const facets = {
14527
+ clause: "",
14528
+ decided_by: "",
14529
+ on_proposal_of: "",
14530
+ description: ""
14531
+ };
14532
+ forEachEntry(
14533
+ block,
14534
+ (keyword, value) => {
14535
+ if (keyword === "clause") {
14536
+ facets.clause = stripWrapping(value());
14537
+ } else if (keyword === "decided_by") {
14538
+ facets.decided_by = stripWrapping(value());
14539
+ } else if (keyword === "on_proposal_of") {
14540
+ facets.on_proposal_of = stripWrapping(value());
14541
+ } else if (keyword === "description") {
14542
+ facets.description = stripWrapping(value());
14543
+ } else {
14544
+ return false;
14545
+ }
14546
+ return true;
14547
+ },
14548
+ { construct: "scheme_lifecycle transition", id: "" }
14549
+ );
14550
+ return facets;
14551
+ }
14552
+ function parseTrigger(id, block) {
14553
+ const trigger = {
14554
+ id,
14555
+ kind: "",
14556
+ action: "",
14557
+ windowYears: 0,
14558
+ windowMonths: 0,
14559
+ clause: "",
14560
+ deferrable: false,
14561
+ deferral_note: "",
14562
+ description: ""
14563
+ };
14564
+ forEachEntry(
14565
+ block,
14566
+ (keyword, value) => {
14567
+ if (keyword === "kind") {
14568
+ trigger.kind = stripWrapping(value());
14569
+ } else if (keyword === "action") {
14570
+ trigger.action = stripWrapping(value());
14571
+ } else if (keyword === "window") {
14572
+ const wt = tokenizePackage(unwrapBlock(value()));
14573
+ for (let i = 0; i + 1 < wt.length; i += 2) {
14574
+ if (wt[i] === "years") {
14575
+ trigger.windowYears = parseInt(stripWrapping(wt[i + 1]), 10) || 0;
14576
+ } else if (wt[i] === "months") {
14577
+ trigger.windowMonths = parseInt(stripWrapping(wt[i + 1]), 10) || 0;
14578
+ }
14579
+ }
14580
+ } else if (keyword === "clause") {
14581
+ trigger.clause = stripWrapping(value());
14582
+ } else if (keyword === "deferrable") {
14583
+ trigger.deferrable = value() === "true";
14584
+ } else if (keyword === "deferral_note") {
14585
+ trigger.deferral_note = stripWrapping(value());
14586
+ } else if (keyword === "description") {
14587
+ trigger.description = stripWrapping(value());
14588
+ } else {
14589
+ return false;
14590
+ }
14591
+ return true;
14592
+ },
14593
+ { construct: "scheme_lifecycle trigger", id }
14594
+ );
14595
+ return trigger;
14596
+ }
14597
+ var parseSchemeLifecycle = (id, data) => {
14598
+ const lifecycle = {
14599
+ id,
14600
+ applies_to: "",
14601
+ initial: "",
14602
+ entry: null,
14603
+ transitions: [],
14604
+ triggers: [],
14605
+ source: { doc: "", clause: "" }
14606
+ };
14607
+ forEachEntry(
14608
+ data,
14609
+ (keyword, value, peek) => {
14610
+ if (keyword === "applies_to") {
14611
+ lifecycle.applies_to = stripWrapping(value());
14612
+ } else if (keyword === "initial") {
14613
+ lifecycle.initial = stripWrapping(value());
14614
+ } else if (keyword === "entry") {
14615
+ lifecycle.entry = parseEntry(unwrapBlock(value()));
14616
+ } else if (keyword === "transition") {
14617
+ const from = stripWrapping(value());
14618
+ const arrow = peek();
14619
+ if (arrow === void 0 || arrow !== "->" && arrow !== "\u2192") {
14620
+ throw new Error(
14621
+ `Parsing error: scheme_lifecycle. ID ${id}: transition ${from} is missing its '->'`
14622
+ );
14623
+ }
14624
+ value();
14625
+ const to = stripWrapping(value());
14626
+ let action = "";
14627
+ if (peek() === "action") {
14628
+ value();
14629
+ action = stripWrapping(value());
14630
+ }
14631
+ const head = peek();
14632
+ if (head === void 0 || !head.startsWith("{")) {
14633
+ throw new Error(
14634
+ `Parsing error: scheme_lifecycle. ID ${id}: transition ${from} -> ${to} is missing its block`
14635
+ );
14636
+ }
14637
+ const facets = parseTransition(unwrapBlock(value()));
14638
+ lifecycle.transitions.push({ from, to, action, ...facets });
14639
+ } else if (keyword === "trigger") {
14640
+ const trigId = stripWrapping(value());
14641
+ const head = peek();
14642
+ if (head === void 0 || !head.startsWith("{")) {
14643
+ throw new Error(
14644
+ `Parsing error: scheme_lifecycle. ID ${id}: trigger ${trigId} is missing its block`
14645
+ );
14646
+ }
14647
+ lifecycle.triggers.push(parseTrigger(trigId, unwrapBlock(value())));
14648
+ } else if (keyword === "source") {
14649
+ lifecycle.source = readSource(unwrapBlock(value()));
14650
+ } else {
14651
+ return false;
14652
+ }
14653
+ return true;
14654
+ },
14655
+ { construct: "scheme_lifecycle", id }
14656
+ );
14657
+ return (ctx) => {
14658
+ ctx.schemeLifecycles[id] = lifecycle;
14659
+ return ctx;
14660
+ };
14661
+ };
14662
+ var dumpSchemeLifecycle = function(l) {
14663
+ let out = "scheme_lifecycle " + l.id + " {\n";
14664
+ if (l.applies_to) {
14665
+ out += " applies_to " + dumpBareSafe(l.applies_to) + "\n";
14666
+ }
14667
+ if (l.initial) {
14668
+ out += " initial " + dumpBareSafe(l.initial) + "\n";
14669
+ }
14670
+ if (l.entry) {
14671
+ const e = l.entry;
14672
+ out += " entry {\n";
14673
+ if (e.action) {
14674
+ out += " action " + dumpBareSafe(e.action) + "\n";
14675
+ }
14676
+ out += " automatic " + (e.automatic ? "true" : "false") + "\n";
14677
+ if (e.clause) {
14678
+ out += ' clause "' + escapeString(e.clause) + '"\n';
14679
+ }
14680
+ if (e.conditions_ref) {
14681
+ out += " conditions_ref " + dumpBareSafe(e.conditions_ref) + "\n";
14682
+ }
14683
+ if (e.description) {
14684
+ out += ' description "' + escapeString(e.description) + '"\n';
14685
+ }
14686
+ out += " }\n";
14687
+ }
14688
+ for (const t of l.transitions) {
14689
+ out += " transition " + dumpBareSafe(t.from) + " -> " + dumpBareSafe(t.to);
14690
+ if (t.action) {
14691
+ out += " action " + dumpBareSafe(t.action);
14692
+ }
14693
+ out += " {\n";
14694
+ if (t.clause) {
14695
+ out += ' clause "' + escapeString(t.clause) + '"\n';
14696
+ }
14697
+ if (t.decided_by) {
14698
+ out += " decided_by " + dumpBareSafe(t.decided_by) + "\n";
14699
+ }
14700
+ if (t.on_proposal_of) {
14701
+ out += " on_proposal_of " + dumpBareSafe(t.on_proposal_of) + "\n";
14702
+ }
14703
+ if (t.description) {
14704
+ out += ' description "' + escapeString(t.description) + '"\n';
14705
+ }
14706
+ out += " }\n";
14707
+ }
14708
+ for (const tr of l.triggers) {
14709
+ out += " trigger " + dumpBareSafe(tr.id) + " {\n";
14710
+ if (tr.kind) {
14711
+ out += " kind " + dumpBareSafe(tr.kind) + "\n";
14712
+ }
14713
+ if (tr.action) {
14714
+ out += " action " + dumpBareSafe(tr.action) + "\n";
14715
+ }
14716
+ if (tr.windowYears > 0 || tr.windowMonths > 0) {
14717
+ let w = " window {";
14718
+ if (tr.windowYears > 0) {
14719
+ w += " years " + tr.windowYears;
14720
+ }
14721
+ if (tr.windowMonths > 0) {
14722
+ w += " months " + tr.windowMonths;
14723
+ }
14724
+ out += w + " }\n";
14725
+ }
14726
+ if (tr.clause) {
14727
+ out += ' clause "' + escapeString(tr.clause) + '"\n';
14728
+ }
14729
+ if (tr.deferrable) {
14730
+ out += " deferrable true\n";
14731
+ }
14732
+ if (tr.deferral_note) {
14733
+ out += ' deferral_note "' + escapeString(tr.deferral_note) + '"\n';
14734
+ }
14735
+ if (tr.description) {
14736
+ out += ' description "' + escapeString(tr.description) + '"\n';
14737
+ }
14738
+ out += " }\n";
14739
+ }
14740
+ if (l.source.doc || l.source.clause) {
14741
+ out += dumpSourceBlock2(l.source);
14742
+ }
14743
+ out += "}\n";
14744
+ return out;
14745
+ };
14746
+
14747
+ // src/ser-des/config/frameworkDocument.ts
14748
+ function dumpSourceBlock3(src) {
14749
+ let out = " source {\n";
14750
+ if (src.doc) {
14751
+ out += ' doc "' + escapeString(src.doc) + '"\n';
14752
+ }
14753
+ if (src.clause) {
14754
+ out += ' clause "' + escapeString(src.clause) + '"\n';
14755
+ }
14756
+ out += " }\n";
14757
+ return out;
14758
+ }
14759
+ var parseFrameworkDocument = (id, data) => {
14760
+ const doc = {
14761
+ id,
14762
+ rank: 0,
14763
+ doc: "",
14764
+ title: "",
14765
+ approved_by: "",
14766
+ clause: "",
14767
+ note: "",
14768
+ source: { doc: "", clause: "" }
14769
+ };
14770
+ forEachEntry(
14771
+ data,
14772
+ (keyword, value) => {
14773
+ if (keyword === "rank") {
14774
+ doc.rank = parseInt(stripWrapping(value()), 10) || 0;
14775
+ } else if (keyword === "doc") {
14776
+ doc.doc = stripWrapping(value());
14777
+ } else if (keyword === "title") {
14778
+ doc.title = stripWrapping(value());
14779
+ } else if (keyword === "approved_by") {
14780
+ doc.approved_by = stripWrapping(value());
14781
+ } else if (keyword === "clause") {
14782
+ doc.clause = stripWrapping(value());
14783
+ } else if (keyword === "note") {
14784
+ doc.note = stripWrapping(value());
14785
+ } else if (keyword === "source") {
14786
+ doc.source = readSource(unwrapBlock(value()));
14787
+ } else {
14788
+ return false;
14789
+ }
14790
+ return true;
14791
+ },
14792
+ { construct: "framework_document", id }
14793
+ );
14794
+ return (ctx) => {
14795
+ ctx.frameworkDocuments[id] = doc;
14796
+ return ctx;
14797
+ };
14798
+ };
14799
+ var dumpFrameworkDocument = function(d) {
14800
+ let out = "framework_document " + d.id + " {\n";
14801
+ if (d.rank > 0) {
14802
+ out += " rank " + d.rank + "\n";
14803
+ }
14804
+ if (d.doc) {
14805
+ out += ' doc "' + escapeString(d.doc) + '"\n';
14806
+ }
14807
+ if (d.title) {
14808
+ out += ' title "' + escapeString(d.title) + '"\n';
14809
+ }
14810
+ if (d.approved_by) {
14811
+ out += " approved_by " + dumpBareSafe(d.approved_by) + "\n";
14812
+ }
14813
+ if (d.clause) {
14814
+ out += ' clause "' + escapeString(d.clause) + '"\n';
14815
+ }
14816
+ if (d.note) {
14817
+ out += ' note "' + escapeString(d.note) + '"\n';
14818
+ }
14819
+ if (d.source.doc || d.source.clause) {
14820
+ out += dumpSourceBlock3(d.source);
14821
+ }
14822
+ out += "}\n";
14823
+ return out;
14824
+ };
14825
+ var parseDocumentPrecedence = (id, data) => {
14826
+ const rule = {
14827
+ id,
14828
+ clause: "",
14829
+ statement: "",
14830
+ source: { doc: "", clause: "" }
14831
+ };
14832
+ forEachEntry(
14833
+ data,
14834
+ (keyword, value) => {
14835
+ if (keyword === "clause") {
14836
+ rule.clause = stripWrapping(value());
14837
+ } else if (keyword === "statement") {
14838
+ rule.statement = stripWrapping(value());
14839
+ } else if (keyword === "source") {
14840
+ rule.source = readSource(unwrapBlock(value()));
14841
+ } else {
14842
+ return false;
14843
+ }
14844
+ return true;
14845
+ },
14846
+ { construct: "document_precedence", id }
14847
+ );
14848
+ return (ctx) => {
14849
+ ctx.documentPrecedences[id] = rule;
14850
+ return ctx;
14851
+ };
14852
+ };
14853
+ var dumpDocumentPrecedence = function(p) {
14854
+ let out = "document_precedence " + p.id + " {\n";
14855
+ if (p.clause) {
14856
+ out += ' clause "' + escapeString(p.clause) + '"\n';
14857
+ }
14858
+ if (p.statement) {
14859
+ out += ' statement "' + escapeString(p.statement) + '"\n';
14860
+ }
14861
+ if (p.source.doc || p.source.clause) {
14862
+ out += dumpSourceBlock3(p.source);
14863
+ }
14864
+ out += "}\n";
14865
+ return out;
14866
+ };
14867
+ function parseCondition(id, block) {
14868
+ const condition = { id, clause: "", description: "" };
14869
+ forEachEntry(
14870
+ block,
14871
+ (keyword, value) => {
14872
+ if (keyword === "clause") {
14873
+ condition.clause = stripWrapping(value());
14874
+ } else if (keyword === "description") {
14875
+ condition.description = stripWrapping(value());
14876
+ } else {
14877
+ return false;
14878
+ }
14879
+ return true;
14880
+ },
14881
+ { construct: "auto_inclusion condition", id }
14882
+ );
14883
+ return condition;
14884
+ }
14885
+ var parseAutoInclusion = (id, data) => {
14886
+ const inclusion = {
14887
+ id,
14888
+ clause: "",
14889
+ statement: "",
14890
+ conditions: [],
14891
+ note: "",
14892
+ source: { doc: "", clause: "" }
14893
+ };
14894
+ forEachEntry(
14895
+ data,
14896
+ (keyword, value, peek) => {
14897
+ if (keyword === "clause") {
14898
+ inclusion.clause = stripWrapping(value());
14899
+ } else if (keyword === "statement") {
14900
+ inclusion.statement = stripWrapping(value());
14901
+ } else if (keyword === "condition") {
14902
+ const condId = stripWrapping(value());
14903
+ const head = peek();
14904
+ if (head === void 0 || !head.startsWith("{")) {
14905
+ throw new Error(
14906
+ `Parsing error: auto_inclusion. ID ${id}: condition ${condId} is missing its block`
14907
+ );
14908
+ }
14909
+ inclusion.conditions.push(parseCondition(condId, unwrapBlock(value())));
14910
+ } else if (keyword === "note") {
14911
+ inclusion.note = stripWrapping(value());
14912
+ } else if (keyword === "source") {
14913
+ inclusion.source = readSource(unwrapBlock(value()));
14914
+ } else {
14915
+ return false;
14916
+ }
14917
+ return true;
14918
+ },
14919
+ { construct: "auto_inclusion", id }
14920
+ );
14921
+ return (ctx) => {
14922
+ ctx.autoInclusions[id] = inclusion;
14923
+ return ctx;
14924
+ };
14925
+ };
14926
+ var dumpAutoInclusion = function(a) {
14927
+ let out = "auto_inclusion " + a.id + " {\n";
14928
+ if (a.clause) {
14929
+ out += ' clause "' + escapeString(a.clause) + '"\n';
14930
+ }
14931
+ if (a.statement) {
14932
+ out += ' statement "' + escapeString(a.statement) + '"\n';
14933
+ }
14934
+ for (const c of a.conditions) {
14935
+ out += " condition " + dumpBareSafe(c.id) + " {\n";
14936
+ if (c.clause) {
14937
+ out += ' clause "' + escapeString(c.clause) + '"\n';
14938
+ }
14939
+ if (c.description) {
14940
+ out += ' description "' + escapeString(c.description) + '"\n';
14941
+ }
14942
+ out += " }\n";
14943
+ }
14944
+ if (a.note) {
14945
+ out += ' note "' + escapeString(a.note) + '"\n';
14946
+ }
14947
+ if (a.source.doc || a.source.clause) {
14948
+ out += dumpSourceBlock3(a.source);
14949
+ }
14950
+ out += "}\n";
14951
+ return out;
14952
+ };
14953
+
14954
+ // src/ser-des/config/decisionRule.ts
14955
+ function parseVoteRule(block) {
14956
+ const rule = {
14957
+ threshold: 0,
14958
+ base: "",
14959
+ clause: "",
14960
+ description: ""
14961
+ };
14962
+ forEachEntry(
14963
+ block,
14964
+ (keyword, value) => {
14965
+ if (keyword === "threshold") {
14966
+ rule.threshold = parseFloat(stripWrapping(value())) || 0;
14967
+ } else if (keyword === "base") {
14968
+ rule.base = stripWrapping(value());
14969
+ } else if (keyword === "clause") {
14970
+ rule.clause = stripWrapping(value());
14971
+ } else if (keyword === "description") {
14972
+ rule.description = stripWrapping(value());
14973
+ } else {
14974
+ return false;
14975
+ }
14976
+ return true;
14977
+ },
14978
+ { construct: "decision_rule voting rule", id: "" }
14979
+ );
14980
+ return rule;
14981
+ }
14982
+ function parseOtherProposals(block) {
14983
+ const rule = {
14984
+ in_meeting: 0,
14985
+ by_correspondence: "",
14986
+ description: ""
14987
+ };
14988
+ forEachEntry(
14989
+ block,
14990
+ (keyword, value) => {
14991
+ if (keyword === "in_meeting") {
14992
+ rule.in_meeting = parseFloat(stripWrapping(value())) || 0;
14993
+ } else if (keyword === "by_correspondence") {
14994
+ rule.by_correspondence = stripWrapping(value());
14995
+ } else if (keyword === "description") {
14996
+ rule.description = stripWrapping(value());
14997
+ } else {
14998
+ return false;
14999
+ }
15000
+ return true;
15001
+ },
15002
+ { construct: "decision_rule other_proposals", id: "" }
15003
+ );
15004
+ return rule;
15005
+ }
15006
+ function parseVoting(block) {
15007
+ const voting = {
15008
+ in_meeting: null,
15009
+ by_correspondence: null,
15010
+ other_proposals: null,
15011
+ proxies_max: 0,
15012
+ abstentions: "",
15013
+ reason_on_against_or_abstain: false
15014
+ };
15015
+ forEachEntry(
15016
+ block,
15017
+ (keyword, value) => {
15018
+ if (keyword === "in_meeting") {
15019
+ voting.in_meeting = parseVoteRule(unwrapBlock(value()));
15020
+ } else if (keyword === "by_correspondence") {
15021
+ voting.by_correspondence = parseVoteRule(unwrapBlock(value()));
15022
+ } else if (keyword === "other_proposals") {
15023
+ voting.other_proposals = parseOtherProposals(unwrapBlock(value()));
15024
+ } else if (keyword === "proxies_max") {
15025
+ voting.proxies_max = parseInt(stripWrapping(value()), 10) || 0;
15026
+ } else if (keyword === "abstentions") {
15027
+ voting.abstentions = stripWrapping(value());
15028
+ } else if (keyword === "reason_on_against_or_abstain") {
15029
+ voting.reason_on_against_or_abstain = value() === "true";
15030
+ } else {
15031
+ return false;
15032
+ }
15033
+ return true;
15034
+ },
15035
+ { construct: "decision_rule voting", id: "" }
15036
+ );
15037
+ return voting;
15038
+ }
15039
+ function parseLegacyKind(id, block) {
15040
+ const kind = { id, clause: "", description: "" };
15041
+ forEachEntry(
15042
+ block,
15043
+ (keyword, value) => {
15044
+ if (keyword === "clause") {
15045
+ kind.clause = stripWrapping(value());
15046
+ } else if (keyword === "description") {
15047
+ kind.description = stripWrapping(value());
15048
+ } else {
15049
+ return false;
15050
+ }
15051
+ return true;
15052
+ },
15053
+ { construct: "decision_rule legacy_kind", id }
15054
+ );
15055
+ return kind;
15056
+ }
15057
+ function parseIdList(value) {
15058
+ return tokenizePackage(unwrapBlock(value)).filter((s) => s.length > 0);
15059
+ }
15060
+ var parseDecisionRule = (id, data) => {
15061
+ const rule = {
15062
+ id,
15063
+ organ: "",
15064
+ kind: "",
15065
+ clause: "",
15066
+ description: "",
15067
+ on_recommendation_of: "",
15068
+ independent_of: "",
15069
+ decides: [],
15070
+ voting: null,
15071
+ tasks: [],
15072
+ scope: [],
15073
+ principle: "",
15074
+ legacy_kinds: [],
15075
+ income: "",
15076
+ no_entrance_fees_for: [],
15077
+ source: { doc: "", clause: "" }
15078
+ };
15079
+ forEachEntry(
15080
+ data,
15081
+ (keyword, value, peek) => {
15082
+ if (keyword === "organ") {
15083
+ rule.organ = stripWrapping(value());
15084
+ } else if (keyword === "kind") {
15085
+ rule.kind = stripWrapping(value());
15086
+ } else if (keyword === "clause") {
15087
+ rule.clause = stripWrapping(value());
15088
+ } else if (keyword === "description") {
15089
+ rule.description = stripWrapping(value());
15090
+ } else if (keyword === "on_recommendation_of") {
15091
+ rule.on_recommendation_of = stripWrapping(value());
15092
+ } else if (keyword === "independent_of") {
15093
+ rule.independent_of = stripWrapping(value());
15094
+ } else if (keyword === "decides") {
15095
+ rule.decides = parseIdList(value());
15096
+ } else if (keyword === "voting") {
15097
+ rule.voting = parseVoting(unwrapBlock(value()));
15098
+ } else if (keyword === "tasks") {
15099
+ rule.tasks = parseIdList(value());
15100
+ } else if (keyword === "scope") {
15101
+ rule.scope = parseIdList(value());
15102
+ } else if (keyword === "principle") {
15103
+ rule.principle = stripWrapping(value());
15104
+ } else if (keyword === "legacy_kind") {
15105
+ const kindId = stripWrapping(value());
15106
+ const head = peek();
15107
+ if (head === void 0 || !head.startsWith("{")) {
15108
+ throw new Error(
15109
+ `Parsing error: decision_rule. ID ${id}: legacy_kind ${kindId} is missing its block`
15110
+ );
15111
+ }
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()));
15119
+ } else {
15120
+ return false;
15121
+ }
15122
+ return true;
15123
+ },
15124
+ { construct: "decision_rule", id }
15125
+ );
15126
+ return (ctx) => {
15127
+ ctx.decisionRules[id] = rule;
15128
+ return ctx;
15129
+ };
15130
+ };
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);
15152
+ }
15153
+ if (v.by_correspondence) {
15154
+ out += dumpVoteRule("by_correspondence", v.by_correspondence);
15155
+ }
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";
15169
+ }
15170
+ if (v.proxies_max > 0) {
15171
+ out += " proxies_max " + v.proxies_max + "\n";
15172
+ }
15173
+ if (v.abstentions) {
15174
+ out += " abstentions " + dumpBareSafe(v.abstentions) + "\n";
15175
+ }
15176
+ if (v.reason_on_against_or_abstain) {
15177
+ out += " reason_on_against_or_abstain true\n";
15178
+ }
15179
+ 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";
15204
+ }
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, " ");
15213
+ }
15214
+ if (r.scope.length > 0) {
15215
+ out += dumpIdList3("scope", r.scope, " ");
15216
+ }
15217
+ if (r.principle) {
15218
+ out += " principle " + dumpBareSafe(r.principle) + "\n";
15219
+ }
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';
15224
+ }
15225
+ if (k.description) {
15226
+ out += ' description "' + escapeString(k.description) + '"\n';
15227
+ }
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';
15240
+ }
15241
+ if (r.source.clause) {
15242
+ out += ' clause "' + escapeString(r.source.clause) + '"\n';
15243
+ }
15244
+ out += " }\n";
15245
+ }
15246
+ out += "}\n";
15247
+ return out;
15248
+ };
15249
+
13794
15250
  // src/ser-des/config/index.ts
13795
15251
  function defineConstruct(def) {
13796
15252
  return def;
@@ -14109,6 +15565,91 @@ var CONSTRUCTS = [
14109
15565
  parse: parseActivityArchetype,
14110
15566
  dump: dumpActivityArchetype
14111
15567
  }),
15568
+ // Primmel v3 certification-framework model (smart TODO.roadmap/40; the
15569
+ // packages-as-SSOT epic): the participant-kind register + the organs.
15570
+ defineConstruct({
15571
+ keyword: "participant_kind",
15572
+ field: "participantKinds",
15573
+ takesID: true,
15574
+ parse: parseParticipantKind,
15575
+ dump: dumpParticipantKind
15576
+ }),
15577
+ defineConstruct({
15578
+ keyword: "governance_organ",
15579
+ field: "governanceOrgans",
15580
+ takesID: true,
15581
+ parse: parseGovernanceOrgan,
15582
+ dump: dumpGovernanceOrgan
15583
+ }),
15584
+ // The framework's Declaration machinery (B 18:2025 §5.5–5.6; PD-08).
15585
+ defineConstruct({
15586
+ keyword: "declaration_kind",
15587
+ field: "declarationKinds",
15588
+ takesID: true,
15589
+ parse: parseDeclarationKind,
15590
+ dump: dumpDeclarationKind
15591
+ }),
15592
+ defineConstruct({
15593
+ keyword: "declaration_status",
15594
+ field: "declarationStatuses",
15595
+ takesID: true,
15596
+ parse: parseDeclarationStatus,
15597
+ dump: dumpDeclarationStatus
15598
+ }),
15599
+ defineConstruct({
15600
+ keyword: "declaration_gate",
15601
+ field: "declarationGates",
15602
+ takesID: true,
15603
+ parse: parseDeclarationGate,
15604
+ dump: dumpDeclarationGate
15605
+ }),
15606
+ // The two-Scheme architecture (B 18:2025 3.37/3.38, §5.4) + the
15607
+ // per-category lifecycle machines (clause 15).
15608
+ defineConstruct({
15609
+ keyword: "scheme_definition",
15610
+ field: "schemeDefinitions",
15611
+ takesID: true,
15612
+ parse: parseSchemeDefinition,
15613
+ dump: dumpSchemeDefinition
15614
+ }),
15615
+ defineConstruct({
15616
+ keyword: "scheme_lifecycle",
15617
+ field: "schemeLifecycles",
15618
+ takesID: true,
15619
+ parse: parseSchemeLifecycle,
15620
+ dump: dumpSchemeLifecycle
15621
+ }),
15622
+ // The governing-document hierarchy (clause 6) + precedence + the §4.2
15623
+ // auto-inclusion blocks.
15624
+ defineConstruct({
15625
+ keyword: "framework_document",
15626
+ field: "frameworkDocuments",
15627
+ takesID: true,
15628
+ parse: parseFrameworkDocument,
15629
+ dump: dumpFrameworkDocument
15630
+ }),
15631
+ defineConstruct({
15632
+ keyword: "document_precedence",
15633
+ field: "documentPrecedences",
15634
+ takesID: true,
15635
+ parse: parseDocumentPrecedence,
15636
+ dump: dumpDocumentPrecedence
15637
+ }),
15638
+ defineConstruct({
15639
+ keyword: "auto_inclusion",
15640
+ field: "autoInclusions",
15641
+ takesID: true,
15642
+ parse: parseAutoInclusion,
15643
+ dump: dumpAutoInclusion
15644
+ }),
15645
+ // The organs' decision rules (clauses 9–16).
15646
+ defineConstruct({
15647
+ keyword: "decision_rule",
15648
+ field: "decisionRules",
15649
+ takesID: true,
15650
+ parse: parseDecisionRule,
15651
+ dump: dumpDecisionRule
15652
+ }),
14112
15653
  // Primmel v3 twin interface (TODO.roadmap/32 — doctrine ch. 14 §14.4):
14113
15654
  // the connector-profile registry. Endpoints and serve bindings are NOT
14114
15655
  // top-level constructs — they are subject anatomy slots (is.endpoints /
@@ -14505,7 +16046,38 @@ var MERGE_FIELDS = [
14505
16046
  // `uses` like every doctrine collection, with uses-no-redefine
14506
16047
  // protection.
14507
16048
  "formulasUsed",
14508
- "texts"
16049
+ "texts",
16050
+ // The certification-framework registers (smart TODO.roadmap/40; the
16051
+ // packages-as-SSOT epic) — the framework package's participant kinds
16052
+ // and organs compose into every scheme-side model through `uses`.
16053
+ "participantKinds",
16054
+ "governanceOrgans",
16055
+ "declarationKinds",
16056
+ "declarationStatuses",
16057
+ "declarationGates",
16058
+ "schemeDefinitions",
16059
+ "schemeLifecycles",
16060
+ "frameworkDocuments",
16061
+ "documentPrecedences",
16062
+ "autoInclusions",
16063
+ "decisionRules",
16064
+ // The pre-existing drift closed (the packages-as-SSOT epic): these
16065
+ // collections existed as constructs but were never merged, so `uses`
16066
+ // composition silently dropped them — comments, predicates, the
16067
+ // artifact registers, the activity archetypes, connector profiles,
16068
+ // monitors, passports, dataspaces, policies, and the top-level
16069
+ // dimensions all compose with the same no-redefine semantics now.
16070
+ "comments",
16071
+ "predicates",
16072
+ "artifactDefinitions",
16073
+ "artifactInstances",
16074
+ "activityArchetypes",
16075
+ "connectorProfiles",
16076
+ "monitors",
16077
+ "passports",
16078
+ "dataspaces",
16079
+ "policies",
16080
+ "dimensions"
14509
16081
  ];
14510
16082
  function parsePackageContent(dir, options) {
14511
16083
  const chunks = chunkify(packageFiles(dir));
@@ -16440,6 +18012,24 @@ var CHECK_RULES = [
16440
18012
  "normal",
16441
18013
  "smart AGENTS.d/07 (TODO.editor/05 Q3)"
16442
18014
  ),
18015
+ // C120 (smart TODO.roadmap/40; the packages-as-SSOT epic): the
18016
+ // certification-framework registers' cross-references resolve —
18017
+ // participant_kind organ/declaration/kind edges, organ sub-committee
18018
+ // and independence edges, declaration holder + gate edges (incl. the
18019
+ // gate's blocked processes), scheme-lifecycle organ edges + the
18020
+ // entry's conditions_ref + trigger actions, framework_document
18021
+ // approving organs, decision_rule organ + exemption edges. Per-
18022
+ // register gating (the C58 doctrine): an edge is checked only when
18023
+ // its target register is in composition scope. Mirror of the OIML
18024
+ // SMART linker's R25.
18025
+ R(
18026
+ "C120",
18027
+ "framework-references-resolve",
18028
+ "composition",
18029
+ "error",
18030
+ "normal",
18031
+ "smart TODO.roadmap/40 (the packages-as-SSOT epic)"
18032
+ ),
16443
18033
  // ── quantities / time / duality (TODO.roadmap/06) ─────────────────
16444
18034
  R(
16445
18035
  "C32",
@@ -17407,7 +18997,7 @@ function loadAllowlist(dir) {
17407
18997
  }
17408
18998
  } else if (cmd === "allowlist_entry") {
17409
18999
  const block = unwrapBlock(tokens[i++] ?? "");
17410
- const entry = parseEntry(block);
19000
+ const entry = parseEntry2(block);
17411
19001
  issues.push(...validateEntry(entry));
17412
19002
  if (entry.rule && entry.match && entry.reason && entry.auditRef) {
17413
19003
  allowlist.entries.push(entry);
@@ -17425,7 +19015,7 @@ function loadAllowlist(dir) {
17425
19015
  }
17426
19016
  return { allowlist, issues };
17427
19017
  }
17428
- function parseEntry(block) {
19018
+ function parseEntry2(block) {
17429
19019
  const entry = {
17430
19020
  rule: "",
17431
19021
  match: "",
@@ -19024,6 +20614,126 @@ function checkPackage(dir, options = {}) {
19024
20614
  }
19025
20615
  }
19026
20616
  }
20617
+ const organIds = new Set((standard.governanceOrgans ?? []).map((o) => o.id));
20618
+ const kindIds = new Set((standard.participantKinds ?? []).map((k) => k.id));
20619
+ const declIds = new Set((standard.declarationKinds ?? []).map((d) => d.id));
20620
+ const autoInclusionIds = new Set(
20621
+ (standard.autoInclusions ?? []).map((a) => a.id)
20622
+ );
20623
+ const frameworkProcessIds = new Set(
20624
+ (standard.processes ?? []).map((p) => p.id)
20625
+ );
20626
+ const resolveOrgan = (where, facet, id) => {
20627
+ if (organIds.size > 0 && id !== "" && !organIds.has(id)) {
20628
+ err(
20629
+ "C120",
20630
+ `${where}: ${facet} "${id}" is not a declared governance organ (framework-references-resolve)`
20631
+ );
20632
+ }
20633
+ };
20634
+ const resolveKind = (where, facet, id) => {
20635
+ if (kindIds.size > 0 && id !== "" && !kindIds.has(id)) {
20636
+ err(
20637
+ "C120",
20638
+ `${where}: ${facet} "${id}" is not a declared participant kind (framework-references-resolve)`
20639
+ );
20640
+ }
20641
+ };
20642
+ const resolveDeclaration = (where, facet, id) => {
20643
+ if (declIds.size > 0 && id !== "" && !declIds.has(id)) {
20644
+ err(
20645
+ "C120",
20646
+ `${where}: ${facet} "${id}" is not a declared declaration kind (framework-references-resolve)`
20647
+ );
20648
+ }
20649
+ };
20650
+ for (const o of standard.governanceOrgans ?? []) {
20651
+ resolveOrgan(
20652
+ `governance_organ ${o.id}`,
20653
+ "sub_committee_of",
20654
+ o.sub_committee_of
20655
+ );
20656
+ resolveOrgan(
20657
+ `governance_organ ${o.id}`,
20658
+ "independent_of",
20659
+ o.independent_of
20660
+ );
20661
+ }
20662
+ for (const k of standard.participantKinds ?? []) {
20663
+ const where = `participant_kind ${k.id}`;
20664
+ resolveOrgan(where, "approved_by", k.approved_by);
20665
+ resolveKind(where, "designated_by", k.designated_by);
20666
+ resolveKind(where, "becomes", k.becomes);
20667
+ resolveDeclaration(where, "declaration", k.declaration);
20668
+ if (k.approval) {
20669
+ resolveOrgan(where, "approval.decided_by", k.approval.decided_by);
20670
+ resolveOrgan(
20671
+ where,
20672
+ "approval.on_recommendation_of",
20673
+ k.approval.on_recommendation_of
20674
+ );
20675
+ }
20676
+ }
20677
+ for (const d of standard.declarationKinds ?? []) {
20678
+ resolveKind(`declaration_kind ${d.id}`, "holder", d.holder);
20679
+ }
20680
+ for (const g of standard.declarationGates ?? []) {
20681
+ const where = `declaration_gate ${g.id}`;
20682
+ resolveKind(where, "holder", g.holder);
20683
+ resolveDeclaration(where, "declaration", g.declaration);
20684
+ if (frameworkProcessIds.size > 0) {
20685
+ for (const b of g.blocks) {
20686
+ if (!frameworkProcessIds.has(b)) {
20687
+ err(
20688
+ "C120",
20689
+ `${where}: blocks "${b}" is not a declared process (framework-references-resolve)`
20690
+ );
20691
+ }
20692
+ }
20693
+ }
20694
+ }
20695
+ for (const l of standard.schemeLifecycles ?? []) {
20696
+ const where = `scheme_lifecycle ${l.id}`;
20697
+ if (autoInclusionIds.size > 0 && l.entry && l.entry.conditions_ref !== "" && !autoInclusionIds.has(l.entry.conditions_ref)) {
20698
+ err(
20699
+ "C120",
20700
+ `${where}: entry.conditions_ref "${l.entry.conditions_ref}" is not a declared auto_inclusion block (framework-references-resolve)`
20701
+ );
20702
+ }
20703
+ const actionIds = new Set(l.transitions.map((t) => t.action));
20704
+ for (const t of l.transitions) {
20705
+ resolveOrgan(
20706
+ `${where} transition ${t.action}`,
20707
+ "decided_by",
20708
+ t.decided_by
20709
+ );
20710
+ resolveOrgan(
20711
+ `${where} transition ${t.action}`,
20712
+ "on_proposal_of",
20713
+ t.on_proposal_of
20714
+ );
20715
+ }
20716
+ for (const tr of l.triggers) {
20717
+ if (tr.action !== "" && !actionIds.has(tr.action)) {
20718
+ err(
20719
+ "C120",
20720
+ `${where}: trigger ${tr.id} fires action "${tr.action}", which no transition of the machine declares (framework-references-resolve)`
20721
+ );
20722
+ }
20723
+ }
20724
+ }
20725
+ for (const d of standard.frameworkDocuments ?? []) {
20726
+ resolveOrgan(`framework_document ${d.id}`, "approved_by", d.approved_by);
20727
+ }
20728
+ for (const r of standard.decisionRules ?? []) {
20729
+ const where = `decision_rule ${r.id}`;
20730
+ resolveOrgan(where, "organ", r.organ);
20731
+ resolveOrgan(where, "on_recommendation_of", r.on_recommendation_of);
20732
+ resolveOrgan(where, "independent_of", r.independent_of);
20733
+ for (const k of r.no_entrance_fees_for) {
20734
+ resolveKind(where, "no_entrance_fees_for", k);
20735
+ }
20736
+ }
19027
20737
  {
19028
20738
  const SEGREGATION_CASE_PERSONNEL = "case_personnel";
19029
20739
  const segregationProcessIds = new Set(