@primmel/primmel 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/check-rules.d.ts +1 -1
- package/dist/src/check-rules.d.ts.map +1 -1
- package/dist/src/check-rules.js +24 -2
- package/dist/src/check-rules.js.map +1 -1
- package/dist/src/check.d.ts.map +1 -1
- package/dist/src/check.js +204 -0
- package/dist/src/check.js.map +1 -1
- package/dist/src/ser-des/config/artifact.d.ts.map +1 -1
- package/dist/src/ser-des/config/artifact.js +8 -0
- package/dist/src/ser-des/config/artifact.js.map +1 -1
- package/dist/src/ser-des/config/calculation.d.ts.map +1 -1
- package/dist/src/ser-des/config/calculation.js +9 -0
- package/dist/src/ser-des/config/calculation.js.map +1 -1
- package/dist/src/ser-des/config/competenceKind.d.ts.map +1 -1
- package/dist/src/ser-des/config/competenceKind.js +10 -1
- package/dist/src/ser-des/config/competenceKind.js.map +1 -1
- package/dist/src/ser-des/config/conformanceTest.d.ts.map +1 -1
- package/dist/src/ser-des/config/conformanceTest.js +6 -0
- package/dist/src/ser-des/config/conformanceTest.js.map +1 -1
- package/dist/src/ser-des/config/constraint.d.ts.map +1 -1
- package/dist/src/ser-des/config/constraint.js +10 -1
- package/dist/src/ser-des/config/constraint.js.map +1 -1
- package/dist/src/ser-des/config/correspondence.d.ts +19 -0
- package/dist/src/ser-des/config/correspondence.d.ts.map +1 -0
- package/dist/src/ser-des/config/correspondence.js +107 -0
- package/dist/src/ser-des/config/correspondence.js.map +1 -0
- package/dist/src/ser-des/config/dataspace.d.ts +9 -0
- package/dist/src/ser-des/config/dataspace.d.ts.map +1 -0
- package/dist/src/ser-des/config/dataspace.js +269 -0
- package/dist/src/ser-des/config/dataspace.js.map +1 -0
- package/dist/src/ser-des/config/field-parser.d.ts.map +1 -1
- package/dist/src/ser-des/config/field-parser.js +11 -0
- package/dist/src/ser-des/config/field-parser.js.map +1 -1
- package/dist/src/ser-des/config/form.d.ts.map +1 -1
- package/dist/src/ser-des/config/form.js +8 -0
- package/dist/src/ser-des/config/form.js.map +1 -1
- package/dist/src/ser-des/config/formulasUsed.d.ts.map +1 -1
- package/dist/src/ser-des/config/formulasUsed.js +6 -0
- package/dist/src/ser-des/config/formulasUsed.js.map +1 -1
- package/dist/src/ser-des/config/index.d.ts.map +1 -1
- package/dist/src/ser-des/config/index.js +10 -0
- package/dist/src/ser-des/config/index.js.map +1 -1
- package/dist/src/ser-des/config/packageManifest.d.ts.map +1 -1
- package/dist/src/ser-des/config/packageManifest.js +10 -0
- package/dist/src/ser-des/config/packageManifest.js.map +1 -1
- package/dist/src/ser-des/config/policy.d.ts +9 -0
- package/dist/src/ser-des/config/policy.d.ts.map +1 -0
- package/dist/src/ser-des/config/policy.js +192 -0
- package/dist/src/ser-des/config/policy.js.map +1 -0
- package/dist/src/ser-des/config/process.d.ts.map +1 -1
- package/dist/src/ser-des/config/process.js +6 -0
- package/dist/src/ser-des/config/process.js.map +1 -1
- package/dist/src/ser-des/config/referenceMaterial.d.ts.map +1 -1
- package/dist/src/ser-des/config/referenceMaterial.js +6 -0
- package/dist/src/ser-des/config/referenceMaterial.js.map +1 -1
- package/dist/src/ser-des/config/requirement.d.ts.map +1 -1
- package/dist/src/ser-des/config/requirement.js +8 -0
- package/dist/src/ser-des/config/requirement.js.map +1 -1
- package/dist/src/ser-des/config/subject.d.ts.map +1 -1
- package/dist/src/ser-des/config/subject.js +37 -0
- package/dist/src/ser-des/config/subject.js.map +1 -1
- package/dist/src/ser-des/config/symbol.d.ts.map +1 -1
- package/dist/src/ser-des/config/symbol.js +10 -2
- package/dist/src/ser-des/config/symbol.js.map +1 -1
- package/dist/src/ser-des/config/table.d.ts.map +1 -1
- package/dist/src/ser-des/config/table.js +10 -1
- package/dist/src/ser-des/config/table.js.map +1 -1
- package/dist/src/ser-des/config/term.d.ts.map +1 -1
- package/dist/src/ser-des/config/term.js +9 -0
- package/dist/src/ser-des/config/term.js.map +1 -1
- package/dist/src/ser-des/config/testPointSet.d.ts.map +1 -1
- package/dist/src/ser-des/config/testPointSet.js +6 -0
- package/dist/src/ser-des/config/testPointSet.js.map +1 -1
- package/dist/src/ser-des/config/testSequence.d.ts.map +1 -1
- package/dist/src/ser-des/config/testSequence.js +8 -0
- package/dist/src/ser-des/config/testSequence.js.map +1 -1
- package/dist/src/ser-des/config/trustRef.d.ts +13 -0
- package/dist/src/ser-des/config/trustRef.d.ts.map +1 -0
- package/dist/src/ser-des/config/trustRef.js +51 -0
- package/dist/src/ser-des/config/trustRef.js.map +1 -0
- package/dist/src/ser-des/config/verdict.d.ts.map +1 -1
- package/dist/src/ser-des/config/verdict.js +7 -0
- package/dist/src/ser-des/config/verdict.js.map +1 -1
- package/dist/src/ser-des/parse-block.d.ts +9 -6
- package/dist/src/ser-des/parse-block.d.ts.map +1 -1
- package/dist/src/ser-des/parse-block.js +44 -17
- package/dist/src/ser-des/parse-block.js.map +1 -1
- package/dist/src/ser-des/parse.d.ts.map +1 -1
- package/dist/src/ser-des/parse.js +3 -0
- package/dist/src/ser-des/parse.js.map +1 -1
- package/dist/src/ser-des/types.d.ts +4 -0
- package/dist/src/ser-des/types.d.ts.map +1 -1
- package/dist/src/types/Artifact.d.ts +2 -0
- package/dist/src/types/Artifact.d.ts.map +1 -1
- package/dist/src/types/Calculation.d.ts +2 -0
- package/dist/src/types/Calculation.d.ts.map +1 -1
- package/dist/src/types/CompetenceKind.d.ts +2 -0
- package/dist/src/types/CompetenceKind.d.ts.map +1 -1
- package/dist/src/types/ConformanceTest.d.ts +2 -0
- package/dist/src/types/ConformanceTest.d.ts.map +1 -1
- package/dist/src/types/Constraint.d.ts +2 -0
- package/dist/src/types/Constraint.d.ts.map +1 -1
- package/dist/src/types/Correspondence.d.ts +27 -0
- package/dist/src/types/Correspondence.d.ts.map +1 -0
- package/dist/src/types/Correspondence.js +23 -0
- package/dist/src/types/Correspondence.js.map +1 -0
- package/dist/src/types/Dataspace.d.ts +60 -0
- package/dist/src/types/Dataspace.d.ts.map +1 -0
- package/dist/src/types/Dataspace.js +36 -0
- package/dist/src/types/Dataspace.js.map +1 -0
- package/dist/src/types/Form.d.ts +5 -0
- package/dist/src/types/Form.d.ts.map +1 -1
- package/dist/src/types/FormulasUsed.d.ts +2 -0
- package/dist/src/types/FormulasUsed.d.ts.map +1 -1
- package/dist/src/types/Package.d.ts +4 -0
- package/dist/src/types/Package.d.ts.map +1 -1
- package/dist/src/types/Policy.d.ts +40 -0
- package/dist/src/types/Policy.d.ts.map +1 -0
- package/dist/src/types/Policy.js +48 -0
- package/dist/src/types/Policy.js.map +1 -0
- package/dist/src/types/ReferenceMaterial.d.ts +2 -0
- package/dist/src/types/ReferenceMaterial.d.ts.map +1 -1
- package/dist/src/types/Requirement.d.ts +2 -0
- package/dist/src/types/Requirement.d.ts.map +1 -1
- package/dist/src/types/Standard.d.ts +4 -0
- package/dist/src/types/Standard.d.ts.map +1 -1
- package/dist/src/types/Subject.d.ts +11 -0
- package/dist/src/types/Subject.d.ts.map +1 -1
- package/dist/src/types/Symbol.d.ts +2 -0
- package/dist/src/types/Symbol.d.ts.map +1 -1
- package/dist/src/types/Table.d.ts +4 -0
- package/dist/src/types/Table.d.ts.map +1 -1
- package/dist/src/types/Term.d.ts +2 -0
- package/dist/src/types/Term.d.ts.map +1 -1
- package/dist/src/types/TestPointSet.d.ts +2 -0
- package/dist/src/types/TestPointSet.d.ts.map +1 -1
- package/dist/src/types/TestSequence.d.ts +2 -0
- package/dist/src/types/TestSequence.d.ts.map +1 -1
- package/dist/src/types/TrustRef.d.ts +10 -0
- package/dist/src/types/TrustRef.d.ts.map +1 -0
- package/dist/src/types/TrustRef.js +28 -0
- package/dist/src/types/TrustRef.js.map +1 -0
- package/dist/src/types/Verdict.d.ts +2 -0
- package/dist/src/types/Verdict.d.ts.map +1 -1
- package/dist/src/types/process.d.ts +2 -0
- package/dist/src/types/process.d.ts.map +1 -1
- package/dist-browser/index.mjs +1538 -1235
- package/dist-cli/primmel.mjs +1014 -6
- package/package.json +1 -1
package/dist-cli/primmel.mjs
CHANGED
|
@@ -263,6 +263,9 @@ function parse(mmelString, parsers, options = {}) {
|
|
|
263
263
|
formulasUsed: {},
|
|
264
264
|
// Primmel v3 ISO 24229 multilinguality (TODO.roadmap/25)
|
|
265
265
|
texts: {},
|
|
266
|
+
// Primmel v3.1 dataspace + trust (TODO.primmel/10)
|
|
267
|
+
dataspaces: {},
|
|
268
|
+
policies: {},
|
|
266
269
|
// Issue collection (duplicate IDs, etc.)
|
|
267
270
|
issues: []
|
|
268
271
|
};
|
|
@@ -417,12 +420,18 @@ function forEachEntry(data, visitor, errCtx) {
|
|
|
417
420
|
() => t[i]
|
|
418
421
|
);
|
|
419
422
|
if (!claimed) {
|
|
420
|
-
if (keyword === "ref") {
|
|
423
|
+
if (keyword === "ref" || keyword === "corresponds") {
|
|
421
424
|
i++;
|
|
422
425
|
i++;
|
|
423
426
|
if (i < t.length && t[i].startsWith("{")) {
|
|
424
427
|
i++;
|
|
425
428
|
}
|
|
429
|
+
} else if (keyword === "trust_ref") {
|
|
430
|
+
i++;
|
|
431
|
+
if (t[i] === "key") {
|
|
432
|
+
i++;
|
|
433
|
+
i++;
|
|
434
|
+
}
|
|
426
435
|
} else {
|
|
427
436
|
i++;
|
|
428
437
|
}
|
|
@@ -430,7 +439,7 @@ function forEachEntry(data, visitor, errCtx) {
|
|
|
430
439
|
}
|
|
431
440
|
}
|
|
432
441
|
function skipUnknownValue(t, i, keyword) {
|
|
433
|
-
if (keyword === "ref") {
|
|
442
|
+
if (keyword === "ref" || keyword === "corresponds") {
|
|
434
443
|
i++;
|
|
435
444
|
if (i < t.length) {
|
|
436
445
|
i++;
|
|
@@ -440,6 +449,18 @@ function skipUnknownValue(t, i, keyword) {
|
|
|
440
449
|
}
|
|
441
450
|
return i;
|
|
442
451
|
}
|
|
452
|
+
if (keyword === "trust_ref") {
|
|
453
|
+
if (i < t.length) {
|
|
454
|
+
i++;
|
|
455
|
+
}
|
|
456
|
+
if (t[i] === "key") {
|
|
457
|
+
i++;
|
|
458
|
+
if (i < t.length) {
|
|
459
|
+
i++;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
return i;
|
|
463
|
+
}
|
|
443
464
|
if (i < t.length) {
|
|
444
465
|
i++;
|
|
445
466
|
}
|
|
@@ -1289,6 +1310,86 @@ function dumpSourceRefAsRef(src, indent, escapeString2) {
|
|
|
1289
1310
|
return `${indent}source { doc "${escapeString2(src.doc ?? "")}" clause "${escapeString2(String(src.clause ?? ""))}"` + (src.fragment ? ` fragment "${escapeString2(src.fragment)}"` : "") + " }\n";
|
|
1290
1311
|
}
|
|
1291
1312
|
|
|
1313
|
+
// src/ser-des/config/correspondence.ts
|
|
1314
|
+
function parseCorresponds(t, i, stripWrapping2) {
|
|
1315
|
+
if (t[i] === void 0) {
|
|
1316
|
+
throw new Error(
|
|
1317
|
+
"Parsing error: corresponds: Expecting value for corresponds (the scheme and the concept)"
|
|
1318
|
+
);
|
|
1319
|
+
}
|
|
1320
|
+
const scheme = stripWrapping2(t[i++]);
|
|
1321
|
+
if (t[i] === void 0) {
|
|
1322
|
+
throw new Error(
|
|
1323
|
+
"Parsing error: corresponds: Expecting value for corresponds (the concept)"
|
|
1324
|
+
);
|
|
1325
|
+
}
|
|
1326
|
+
const corr = {
|
|
1327
|
+
scheme,
|
|
1328
|
+
concept: stripWrapping2(t[i++]),
|
|
1329
|
+
projections: []
|
|
1330
|
+
};
|
|
1331
|
+
if (i < t.length && t[i].startsWith("{")) {
|
|
1332
|
+
const block = unwrapBlock(t[i++]);
|
|
1333
|
+
forEachEntry(
|
|
1334
|
+
block,
|
|
1335
|
+
(keyword, value, peek) => {
|
|
1336
|
+
if (keyword === "projection") {
|
|
1337
|
+
const codec = stripWrapping2(value());
|
|
1338
|
+
const entries = [];
|
|
1339
|
+
const next = peek();
|
|
1340
|
+
if (next && next.startsWith("{")) {
|
|
1341
|
+
forEachEntry(
|
|
1342
|
+
unwrapBlock(value()),
|
|
1343
|
+
(k, kv) => {
|
|
1344
|
+
entries.push({ key: k, value: stripWrapping2(kv()) });
|
|
1345
|
+
return true;
|
|
1346
|
+
},
|
|
1347
|
+
{ construct: "corresponds.projection", id: codec }
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1350
|
+
corr.projections.push({ codec, entries });
|
|
1351
|
+
return true;
|
|
1352
|
+
}
|
|
1353
|
+
return false;
|
|
1354
|
+
},
|
|
1355
|
+
{ construct: "corresponds", id: corr.scheme }
|
|
1356
|
+
);
|
|
1357
|
+
}
|
|
1358
|
+
return { corr, next: i };
|
|
1359
|
+
}
|
|
1360
|
+
function parseCorrespondsFromReaders(value, peek, stripWrapping2) {
|
|
1361
|
+
const parts = [value(), value()];
|
|
1362
|
+
const next = peek();
|
|
1363
|
+
if (next && next.startsWith("{")) {
|
|
1364
|
+
parts.push(value());
|
|
1365
|
+
}
|
|
1366
|
+
return parseCorresponds(parts, 0, stripWrapping2).corr;
|
|
1367
|
+
}
|
|
1368
|
+
function dumpCorrespondences(corrs, indent, escapeString2, dumpBareSafe2) {
|
|
1369
|
+
if (!corrs || corrs.length === 0) {
|
|
1370
|
+
return "";
|
|
1371
|
+
}
|
|
1372
|
+
let out = "";
|
|
1373
|
+
for (const c of corrs) {
|
|
1374
|
+
out += `${indent}corresponds ${dumpBareSafe2(c.scheme)} "${escapeString2(c.concept)}"`;
|
|
1375
|
+
if (c.projections.length === 0) {
|
|
1376
|
+
out += "\n";
|
|
1377
|
+
continue;
|
|
1378
|
+
}
|
|
1379
|
+
out += " {\n";
|
|
1380
|
+
for (const p of c.projections) {
|
|
1381
|
+
out += `${indent} projection ${dumpBareSafe2(p.codec)} {`;
|
|
1382
|
+
for (const e of p.entries) {
|
|
1383
|
+
out += ` ${dumpBareSafe2(e.key)} ${dumpBareSafe2(e.value)}`;
|
|
1384
|
+
}
|
|
1385
|
+
out += " }\n";
|
|
1386
|
+
}
|
|
1387
|
+
out += `${indent}}
|
|
1388
|
+
`;
|
|
1389
|
+
}
|
|
1390
|
+
return out;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1292
1393
|
// src/ser-des/config/series.ts
|
|
1293
1394
|
function parseSeriesDecl(block) {
|
|
1294
1395
|
const decl = { axes: [], cellSymbol: "", cellUnit: "" };
|
|
@@ -1697,6 +1798,10 @@ function parseFormField(name, block, type) {
|
|
|
1697
1798
|
field.refs.push(r.ref);
|
|
1698
1799
|
}
|
|
1699
1800
|
i = r.next;
|
|
1801
|
+
} else if (cmd === "corresponds") {
|
|
1802
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
1803
|
+
(field.correspondences ??= []).push(cc.corr);
|
|
1804
|
+
i = cc.next;
|
|
1700
1805
|
} else if (cmd === "specification_reference") {
|
|
1701
1806
|
field.specificationReference = stripWrapping(t[i++]);
|
|
1702
1807
|
} else if (cmd === "applicability") {
|
|
@@ -2045,6 +2150,16 @@ function dumpFormField(field, indent) {
|
|
|
2045
2150
|
);
|
|
2046
2151
|
}
|
|
2047
2152
|
}
|
|
2153
|
+
if (field.correspondences && field.correspondences.length > 0) {
|
|
2154
|
+
inner.push(
|
|
2155
|
+
dumpCorrespondences(
|
|
2156
|
+
field.correspondences,
|
|
2157
|
+
"",
|
|
2158
|
+
escapeString,
|
|
2159
|
+
dumpBareSafe
|
|
2160
|
+
).trimEnd()
|
|
2161
|
+
);
|
|
2162
|
+
}
|
|
2048
2163
|
if (field.specificationReference) {
|
|
2049
2164
|
inner.push(
|
|
2050
2165
|
'specification_reference "' + escapeString(field.specificationReference) + '"'
|
|
@@ -2740,6 +2855,10 @@ var parseProcess = function(id, data) {
|
|
|
2740
2855
|
if (!foldRefIntoLegacy(result, r)) {
|
|
2741
2856
|
(result.refs ??= []).push(r);
|
|
2742
2857
|
}
|
|
2858
|
+
} else if (keyword === "corresponds") {
|
|
2859
|
+
(result.correspondences ??= []).push(
|
|
2860
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
2861
|
+
);
|
|
2743
2862
|
} else {
|
|
2744
2863
|
return false;
|
|
2745
2864
|
}
|
|
@@ -3007,6 +3126,12 @@ var dumpProcess = function(process2, ctx) {
|
|
|
3007
3126
|
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
3008
3127
|
}
|
|
3009
3128
|
out += dumpRefs(process2.refs, " ", escapeString);
|
|
3129
|
+
out += dumpCorrespondences(
|
|
3130
|
+
process2.correspondences,
|
|
3131
|
+
" ",
|
|
3132
|
+
escapeString,
|
|
3133
|
+
dumpBareSafe
|
|
3134
|
+
);
|
|
3010
3135
|
if (process2.parent && (process2.children.length === 0 || !ctx?.nested)) {
|
|
3011
3136
|
out += " parent " + process2.parent + "\n";
|
|
3012
3137
|
}
|
|
@@ -3754,8 +3879,12 @@ var parseTable = function(id, data) {
|
|
|
3754
3879
|
(result.refs ??= []).push(rr.ref);
|
|
3755
3880
|
}
|
|
3756
3881
|
i = rr.next;
|
|
3882
|
+
} else if (command === "corresponds") {
|
|
3883
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
3884
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
3885
|
+
i = cc.next;
|
|
3757
3886
|
} else {
|
|
3758
|
-
i
|
|
3887
|
+
i = skipUnknownValue(t, i, command);
|
|
3759
3888
|
}
|
|
3760
3889
|
} else {
|
|
3761
3890
|
throw new Error(
|
|
@@ -3826,6 +3955,12 @@ var dumpTable = function(t) {
|
|
|
3826
3955
|
if (t.sourceDiscrepancy) {
|
|
3827
3956
|
out += dumpSourceDiscrepancy(t.sourceDiscrepancy, " ") + "\n";
|
|
3828
3957
|
}
|
|
3958
|
+
out += dumpCorrespondences(
|
|
3959
|
+
t.correspondences,
|
|
3960
|
+
" ",
|
|
3961
|
+
escapeString,
|
|
3962
|
+
dumpBareSafe
|
|
3963
|
+
);
|
|
3829
3964
|
if (t.overrides && Object.keys(t.overrides).length > 0) {
|
|
3830
3965
|
out += " overrides { ";
|
|
3831
3966
|
for (const [key, o] of Object.entries(t.overrides)) {
|
|
@@ -4348,6 +4483,10 @@ var parseForm = function(id, data) {
|
|
|
4348
4483
|
result.refs = [...result.refs ?? [], r.ref];
|
|
4349
4484
|
}
|
|
4350
4485
|
i = r.next;
|
|
4486
|
+
} else if (command === "corresponds") {
|
|
4487
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
4488
|
+
result.correspondences = [...result.correspondences ?? [], cc.corr];
|
|
4489
|
+
i = cc.next;
|
|
4351
4490
|
} else if (command === "calculation_context") {
|
|
4352
4491
|
result.calculationContext = parseCalculationContext(
|
|
4353
4492
|
unwrapBlock(t[i++])
|
|
@@ -4640,6 +4779,12 @@ var dumpForm = function(f) {
|
|
|
4640
4779
|
out += " ref " + r.predicate + ' "' + escapeString(r.target) + '"' + (r.note ? ' { note "' + escapeString(r.note) + '" }' : "") + "\n";
|
|
4641
4780
|
}
|
|
4642
4781
|
}
|
|
4782
|
+
out += dumpCorrespondences(
|
|
4783
|
+
f.correspondences,
|
|
4784
|
+
" ",
|
|
4785
|
+
escapeString,
|
|
4786
|
+
dumpBareSafe
|
|
4787
|
+
);
|
|
4643
4788
|
if (f.calculationContext) {
|
|
4644
4789
|
const cc = f.calculationContext;
|
|
4645
4790
|
let line = " calculation_context { ";
|
|
@@ -4912,6 +5057,12 @@ var parseSymbol = function(id, data) {
|
|
|
4912
5057
|
}
|
|
4913
5058
|
return true;
|
|
4914
5059
|
}
|
|
5060
|
+
if (command === "corresponds") {
|
|
5061
|
+
(result.correspondences ??= []).push(
|
|
5062
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
5063
|
+
);
|
|
5064
|
+
return true;
|
|
5065
|
+
}
|
|
4915
5066
|
if (command === "name") {
|
|
4916
5067
|
result.name = unwrapped(value);
|
|
4917
5068
|
} else if (command === "definition") {
|
|
@@ -5062,6 +5213,12 @@ var dumpSymbol = function(s) {
|
|
|
5062
5213
|
}
|
|
5063
5214
|
out += " }\n";
|
|
5064
5215
|
}
|
|
5216
|
+
out += dumpCorrespondences(
|
|
5217
|
+
s.correspondences,
|
|
5218
|
+
" ",
|
|
5219
|
+
escapeString,
|
|
5220
|
+
dumpBareSafe
|
|
5221
|
+
);
|
|
5065
5222
|
out += "}\n";
|
|
5066
5223
|
return out;
|
|
5067
5224
|
};
|
|
@@ -5115,6 +5272,10 @@ var parseCalculation = function(id, data) {
|
|
|
5115
5272
|
(result.refs ??= []).push(rr.ref);
|
|
5116
5273
|
}
|
|
5117
5274
|
i = rr.next;
|
|
5275
|
+
} else if (command === "corresponds") {
|
|
5276
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
5277
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
5278
|
+
i = cc.next;
|
|
5118
5279
|
} else if (command === "source") {
|
|
5119
5280
|
const inner = tokenize(unwrapBlock(t[i++]));
|
|
5120
5281
|
const src = {
|
|
@@ -5386,6 +5547,12 @@ var dumpCalculation = function(c) {
|
|
|
5386
5547
|
for (const r of c.refs ?? []) {
|
|
5387
5548
|
out += " ref " + r.predicate + ' "' + escapeString(r.target) + '"' + (r.note ? ' { note "' + escapeString(r.note) + '" }' : "") + "\n";
|
|
5388
5549
|
}
|
|
5550
|
+
out += dumpCorrespondences(
|
|
5551
|
+
c.correspondences,
|
|
5552
|
+
" ",
|
|
5553
|
+
escapeString,
|
|
5554
|
+
dumpBareSafe
|
|
5555
|
+
);
|
|
5389
5556
|
if (c.ref.length > 0) {
|
|
5390
5557
|
out += " reference {\n";
|
|
5391
5558
|
for (const r of c.ref) {
|
|
@@ -6671,8 +6838,12 @@ var parseCompetenceKind = function(id, data) {
|
|
|
6671
6838
|
(result.refs ??= []).push(rr.ref);
|
|
6672
6839
|
}
|
|
6673
6840
|
i = rr.next;
|
|
6841
|
+
} else if (keyword === "corresponds") {
|
|
6842
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
6843
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
6844
|
+
i = cc.next;
|
|
6674
6845
|
} else {
|
|
6675
|
-
i
|
|
6846
|
+
i = skipUnknownValue(t, i, keyword);
|
|
6676
6847
|
}
|
|
6677
6848
|
}
|
|
6678
6849
|
return (ctx) => {
|
|
@@ -6694,6 +6865,12 @@ var dumpCompetenceKind = function(k) {
|
|
|
6694
6865
|
for (const ms of k.methodStandards) {
|
|
6695
6866
|
out += " method_standard " + ms.id + ' "' + escapeString(ms.title) + '"\n';
|
|
6696
6867
|
}
|
|
6868
|
+
out += dumpCorrespondences(
|
|
6869
|
+
k.correspondences,
|
|
6870
|
+
" ",
|
|
6871
|
+
escapeString,
|
|
6872
|
+
dumpBareSafe
|
|
6873
|
+
);
|
|
6697
6874
|
out += "}\n";
|
|
6698
6875
|
return out;
|
|
6699
6876
|
};
|
|
@@ -7138,6 +7315,10 @@ var parseConformanceTest = function(id, data) {
|
|
|
7138
7315
|
if (!foldRefIntoLegacy(result, rr)) {
|
|
7139
7316
|
(result.refs ??= []).push(rr);
|
|
7140
7317
|
}
|
|
7318
|
+
} else if (keyword === "corresponds") {
|
|
7319
|
+
(result.correspondences ??= []).push(
|
|
7320
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
7321
|
+
);
|
|
7141
7322
|
} else if (keyword === "binds_to") {
|
|
7142
7323
|
result.bindsTo = tokenizePackage(value());
|
|
7143
7324
|
} else if (keyword === "applicability") {
|
|
@@ -7496,6 +7677,12 @@ var dumpConformanceTest = function(ct) {
|
|
|
7496
7677
|
if (ct.sourceDiscrepancy) {
|
|
7497
7678
|
out += dumpSourceDiscrepancy(ct.sourceDiscrepancy, " ") + "\n";
|
|
7498
7679
|
}
|
|
7680
|
+
out += dumpCorrespondences(
|
|
7681
|
+
ct.correspondences,
|
|
7682
|
+
" ",
|
|
7683
|
+
escapeString,
|
|
7684
|
+
dumpBareSafe
|
|
7685
|
+
);
|
|
7499
7686
|
out += "}\n";
|
|
7500
7687
|
return out;
|
|
7501
7688
|
};
|
|
@@ -7524,6 +7711,12 @@ var parseTerm = function(id, data) {
|
|
|
7524
7711
|
}
|
|
7525
7712
|
return true;
|
|
7526
7713
|
}
|
|
7714
|
+
if (command === "corresponds") {
|
|
7715
|
+
(result.correspondences ??= []).push(
|
|
7716
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
7717
|
+
);
|
|
7718
|
+
return true;
|
|
7719
|
+
}
|
|
7527
7720
|
if (command === "label") {
|
|
7528
7721
|
result.label = unwrapped(value);
|
|
7529
7722
|
} else if (command === "definition") {
|
|
@@ -7643,6 +7836,12 @@ var dumpTerm = function(term) {
|
|
|
7643
7836
|
}
|
|
7644
7837
|
out += " }\n";
|
|
7645
7838
|
}
|
|
7839
|
+
out += dumpCorrespondences(
|
|
7840
|
+
term.correspondences,
|
|
7841
|
+
" ",
|
|
7842
|
+
escapeString,
|
|
7843
|
+
dumpBareSafe
|
|
7844
|
+
);
|
|
7646
7845
|
out += "}\n";
|
|
7647
7846
|
return out;
|
|
7648
7847
|
};
|
|
@@ -7719,6 +7918,10 @@ var parseVerdict = function(id, data) {
|
|
|
7719
7918
|
if (!foldRefIntoLegacy(result, r)) {
|
|
7720
7919
|
(result.refs ??= []).push(r);
|
|
7721
7920
|
}
|
|
7921
|
+
} else if (keyword === "corresponds") {
|
|
7922
|
+
(result.correspondences ??= []).push(
|
|
7923
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
7924
|
+
);
|
|
7722
7925
|
} else {
|
|
7723
7926
|
return false;
|
|
7724
7927
|
}
|
|
@@ -7763,6 +7966,12 @@ var dumpVerdict = function(v) {
|
|
|
7763
7966
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
7764
7967
|
}
|
|
7765
7968
|
out += dumpRefs(v.refs, " ", escapeString);
|
|
7969
|
+
out += dumpCorrespondences(
|
|
7970
|
+
v.correspondences,
|
|
7971
|
+
" ",
|
|
7972
|
+
escapeString,
|
|
7973
|
+
dumpBareSafe
|
|
7974
|
+
);
|
|
7766
7975
|
out += "}\n";
|
|
7767
7976
|
return out;
|
|
7768
7977
|
};
|
|
@@ -7932,6 +8141,10 @@ var parseReferenceMaterial = function(id, data) {
|
|
|
7932
8141
|
if (!foldRefIntoLegacy(result, r)) {
|
|
7933
8142
|
(result.refs ??= []).push(r);
|
|
7934
8143
|
}
|
|
8144
|
+
} else if (keyword === "corresponds") {
|
|
8145
|
+
(result.correspondences ??= []).push(
|
|
8146
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
8147
|
+
);
|
|
7935
8148
|
} else if (keyword === "identity_fields") {
|
|
7936
8149
|
result.identityFields = parseIdentityFields(unwrapBlock(value()));
|
|
7937
8150
|
} else if (keyword === "constraints") {
|
|
@@ -7964,6 +8177,12 @@ var dumpReferenceMaterial = function(m) {
|
|
|
7964
8177
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
7965
8178
|
}
|
|
7966
8179
|
out += dumpRefs(m.refs, " ", escapeString);
|
|
8180
|
+
out += dumpCorrespondences(
|
|
8181
|
+
m.correspondences,
|
|
8182
|
+
" ",
|
|
8183
|
+
escapeString,
|
|
8184
|
+
dumpBareSafe
|
|
8185
|
+
);
|
|
7967
8186
|
if (m.identityFields.length > 0) {
|
|
7968
8187
|
out += " identity_fields {\n";
|
|
7969
8188
|
for (const f of m.identityFields) {
|
|
@@ -8152,8 +8371,12 @@ var parseConstraint = function(id, data) {
|
|
|
8152
8371
|
(result.refs ??= []).push(rr.ref);
|
|
8153
8372
|
}
|
|
8154
8373
|
i = rr.next;
|
|
8374
|
+
} else if (keyword === "corresponds") {
|
|
8375
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
8376
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
8377
|
+
i = cc.next;
|
|
8155
8378
|
} else {
|
|
8156
|
-
i
|
|
8379
|
+
i = skipUnknownValue(t, i, keyword);
|
|
8157
8380
|
}
|
|
8158
8381
|
}
|
|
8159
8382
|
return (ctx) => {
|
|
@@ -8179,6 +8402,12 @@ var dumpConstraint = function(c) {
|
|
|
8179
8402
|
if (c.source && (c.source.doc || c.source.clause)) {
|
|
8180
8403
|
out += ' source { doc "' + escapeString(c.source.doc) + '" clause "' + escapeString(c.source.clause) + '"' + (c.source.fragment ? ' fragment "' + escapeString(c.source.fragment) + '"' : "") + " }\n";
|
|
8181
8404
|
}
|
|
8405
|
+
out += dumpCorrespondences(
|
|
8406
|
+
c.correspondences,
|
|
8407
|
+
" ",
|
|
8408
|
+
escapeString,
|
|
8409
|
+
dumpBareSafe
|
|
8410
|
+
);
|
|
8182
8411
|
out += "}\n";
|
|
8183
8412
|
return out;
|
|
8184
8413
|
};
|
|
@@ -8364,6 +8593,10 @@ var parseTestPointSet = function(id, data) {
|
|
|
8364
8593
|
if (!foldRefIntoLegacy(result, r)) {
|
|
8365
8594
|
(result.refs ??= []).push(r);
|
|
8366
8595
|
}
|
|
8596
|
+
} else if (keyword === "corresponds") {
|
|
8597
|
+
(result.correspondences ??= []).push(
|
|
8598
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
8599
|
+
);
|
|
8367
8600
|
} else if (keyword === "cardinality") {
|
|
8368
8601
|
result.cardinality = parseCardinality(unwrapBlock(value()));
|
|
8369
8602
|
} else if (keyword === "repetitions_per_point") {
|
|
@@ -8392,6 +8625,12 @@ var dumpTestPointSet = function(s) {
|
|
|
8392
8625
|
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
8393
8626
|
}
|
|
8394
8627
|
out += dumpRefs(s.refs, " ", escapeString);
|
|
8628
|
+
out += dumpCorrespondences(
|
|
8629
|
+
s.correspondences,
|
|
8630
|
+
" ",
|
|
8631
|
+
escapeString,
|
|
8632
|
+
dumpBareSafe
|
|
8633
|
+
);
|
|
8395
8634
|
const ckeys = Object.keys(s.cardinality);
|
|
8396
8635
|
if (ckeys.length > 0) {
|
|
8397
8636
|
out += " cardinality {\n";
|
|
@@ -8697,6 +8936,10 @@ var parseRequirement = function(id, data) {
|
|
|
8697
8936
|
(result.refs ??= []).push(r.ref);
|
|
8698
8937
|
}
|
|
8699
8938
|
i = r.next;
|
|
8939
|
+
} else if (cmd === "corresponds") {
|
|
8940
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
8941
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
8942
|
+
i = cc.next;
|
|
8700
8943
|
} else {
|
|
8701
8944
|
i = skipUnknownValue(t, i, cmd);
|
|
8702
8945
|
}
|
|
@@ -8841,6 +9084,12 @@ var dumpRequirement = function(r) {
|
|
|
8841
9084
|
for (const ref of r.refs ?? []) {
|
|
8842
9085
|
out += " ref " + ref.predicate + ' "' + escapeString(ref.target) + '"' + (ref.note ? ' { note "' + escapeString(ref.note) + '" }' : "") + "\n";
|
|
8843
9086
|
}
|
|
9087
|
+
out += dumpCorrespondences(
|
|
9088
|
+
r.correspondences,
|
|
9089
|
+
" ",
|
|
9090
|
+
escapeString,
|
|
9091
|
+
dumpBareSafe
|
|
9092
|
+
);
|
|
8844
9093
|
out += "}\n";
|
|
8845
9094
|
return out;
|
|
8846
9095
|
};
|
|
@@ -9024,6 +9273,10 @@ var parsePackage = function(data) {
|
|
|
9024
9273
|
(manifest.refs ??= []).push(r.ref);
|
|
9025
9274
|
}
|
|
9026
9275
|
i = r.next;
|
|
9276
|
+
} else if (cmd === "corresponds") {
|
|
9277
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
9278
|
+
(manifest.correspondences ??= []).push(cc.corr);
|
|
9279
|
+
i = cc.next;
|
|
9027
9280
|
} else if (cmd === "scheme_type" || cmd === "schemeType") {
|
|
9028
9281
|
manifest.schemeType = stripWrapping(t[i++]);
|
|
9029
9282
|
} else if (cmd === "provides") {
|
|
@@ -9728,6 +9981,10 @@ var parseInstrument = function(id, data) {
|
|
|
9728
9981
|
(result.refs ??= []).push(rr.ref);
|
|
9729
9982
|
}
|
|
9730
9983
|
i = rr.next;
|
|
9984
|
+
} else if (cmd === "corresponds") {
|
|
9985
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
9986
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
9987
|
+
i = cc.next;
|
|
9731
9988
|
} else {
|
|
9732
9989
|
i = skipUnknownValue(t, i, cmd);
|
|
9733
9990
|
}
|
|
@@ -10230,6 +10487,12 @@ var dumpInstrument = function(inst) {
|
|
|
10230
10487
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10231
10488
|
}
|
|
10232
10489
|
out += dumpRefs(inst.refs, " ", escapeString);
|
|
10490
|
+
out += dumpCorrespondences(
|
|
10491
|
+
inst.correspondences,
|
|
10492
|
+
" ",
|
|
10493
|
+
escapeString,
|
|
10494
|
+
dumpBareSafe
|
|
10495
|
+
);
|
|
10233
10496
|
out += dumpIdList("reference", inst.referenceIds, " ");
|
|
10234
10497
|
out += "}\n";
|
|
10235
10498
|
return out;
|
|
@@ -10302,6 +10565,10 @@ var parseAttributeDefinition = function(id, data) {
|
|
|
10302
10565
|
(result.refs ??= []).push(rr.ref);
|
|
10303
10566
|
}
|
|
10304
10567
|
i = rr.next;
|
|
10568
|
+
} else if (cmd === "corresponds") {
|
|
10569
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
10570
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
10571
|
+
i = cc.next;
|
|
10305
10572
|
} else {
|
|
10306
10573
|
i = skipUnknownValue(t, i, cmd);
|
|
10307
10574
|
}
|
|
@@ -10327,6 +10594,12 @@ var dumpAttributeDefinition = function(a) {
|
|
|
10327
10594
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10328
10595
|
}
|
|
10329
10596
|
out += dumpRefs(a.refs, " ", escapeString);
|
|
10597
|
+
out += dumpCorrespondences(
|
|
10598
|
+
a.correspondences,
|
|
10599
|
+
" ",
|
|
10600
|
+
escapeString,
|
|
10601
|
+
dumpBareSafe
|
|
10602
|
+
);
|
|
10330
10603
|
if (a.quantityKind) {
|
|
10331
10604
|
out += " quantity_kind " + a.quantityKind + "\n";
|
|
10332
10605
|
}
|
|
@@ -10404,6 +10677,10 @@ var parseCapability = function(id, data) {
|
|
|
10404
10677
|
(result.refs ??= []).push(rr.ref);
|
|
10405
10678
|
}
|
|
10406
10679
|
i = rr.next;
|
|
10680
|
+
} else if (cmd === "corresponds") {
|
|
10681
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
10682
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
10683
|
+
i = cc.next;
|
|
10407
10684
|
} else {
|
|
10408
10685
|
i = skipUnknownValue(t, i, cmd);
|
|
10409
10686
|
}
|
|
@@ -10431,6 +10708,12 @@ var dumpCapability = function(c) {
|
|
|
10431
10708
|
out += dumpIdList("verified_by_tests", c.verifiedByTests, " ");
|
|
10432
10709
|
out += dumpIdList("reference", c.referenceIds, " ");
|
|
10433
10710
|
out += dumpRefs(c.refs, " ", escapeString);
|
|
10711
|
+
out += dumpCorrespondences(
|
|
10712
|
+
c.correspondences,
|
|
10713
|
+
" ",
|
|
10714
|
+
escapeString,
|
|
10715
|
+
dumpBareSafe
|
|
10716
|
+
);
|
|
10434
10717
|
out += "}\n";
|
|
10435
10718
|
return out;
|
|
10436
10719
|
};
|
|
@@ -10471,6 +10754,10 @@ var parseBehavior = function(id, data) {
|
|
|
10471
10754
|
(result.refs ??= []).push(rr.ref);
|
|
10472
10755
|
}
|
|
10473
10756
|
i = rr.next;
|
|
10757
|
+
} else if (cmd === "corresponds") {
|
|
10758
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
10759
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
10760
|
+
i = cc.next;
|
|
10474
10761
|
} else {
|
|
10475
10762
|
i = skipUnknownValue(t, i, cmd);
|
|
10476
10763
|
}
|
|
@@ -10496,6 +10783,12 @@ var dumpBehavior = function(b) {
|
|
|
10496
10783
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10497
10784
|
}
|
|
10498
10785
|
out += dumpRefs(b.refs, " ", escapeString);
|
|
10786
|
+
out += dumpCorrespondences(
|
|
10787
|
+
b.correspondences,
|
|
10788
|
+
" ",
|
|
10789
|
+
escapeString,
|
|
10790
|
+
dumpBareSafe
|
|
10791
|
+
);
|
|
10499
10792
|
out += dumpIdList("verified_by", b.verifiedBy, " ");
|
|
10500
10793
|
out += "}\n";
|
|
10501
10794
|
return out;
|
|
@@ -10548,6 +10841,10 @@ var parseConditionSet = function(id, data) {
|
|
|
10548
10841
|
} else {
|
|
10549
10842
|
(result.refs ??= []).push(rr.ref);
|
|
10550
10843
|
}
|
|
10844
|
+
} else if (cmd === "corresponds") {
|
|
10845
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
10846
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
10847
|
+
i = cc.next;
|
|
10551
10848
|
} else if (cmd === "reference") {
|
|
10552
10849
|
result.referenceIds = readReference(t[i++]);
|
|
10553
10850
|
} else {
|
|
@@ -10634,6 +10931,12 @@ var dumpConditionSet = function(cs) {
|
|
|
10634
10931
|
}
|
|
10635
10932
|
out += dumpIdList("reference", cs.referenceIds, " ");
|
|
10636
10933
|
out += dumpRefs(cs.refs, " ", escapeString);
|
|
10934
|
+
out += dumpCorrespondences(
|
|
10935
|
+
cs.correspondences,
|
|
10936
|
+
" ",
|
|
10937
|
+
escapeString,
|
|
10938
|
+
dumpBareSafe
|
|
10939
|
+
);
|
|
10637
10940
|
out += "}\n";
|
|
10638
10941
|
return out;
|
|
10639
10942
|
};
|
|
@@ -11629,6 +11932,10 @@ var parseArtifactDefinition = function(id, data) {
|
|
|
11629
11932
|
(result.refs ??= []).push(rr.ref);
|
|
11630
11933
|
}
|
|
11631
11934
|
i = rr.next;
|
|
11935
|
+
} else if (cmd === "corresponds") {
|
|
11936
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
11937
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
11938
|
+
i = cc.next;
|
|
11632
11939
|
} else {
|
|
11633
11940
|
i = skipUnknownValue(t, i, cmd);
|
|
11634
11941
|
}
|
|
@@ -11696,6 +12003,12 @@ var dumpArtifactDefinition = function(d) {
|
|
|
11696
12003
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
11697
12004
|
}
|
|
11698
12005
|
out += dumpRefs(d.refs, " ", escapeString);
|
|
12006
|
+
out += dumpCorrespondences(
|
|
12007
|
+
d.correspondences,
|
|
12008
|
+
" ",
|
|
12009
|
+
escapeString,
|
|
12010
|
+
dumpBareSafe
|
|
12011
|
+
);
|
|
11699
12012
|
out += dumpIdList2("reference", d.referenceIds, " ");
|
|
11700
12013
|
out += "}\n";
|
|
11701
12014
|
return out;
|
|
@@ -12287,6 +12600,10 @@ var parseTestSequence = function(id, data) {
|
|
|
12287
12600
|
sequence.refs = [...sequence.refs ?? [], rr.ref];
|
|
12288
12601
|
}
|
|
12289
12602
|
i = rr.next;
|
|
12603
|
+
} else if (command === "corresponds") {
|
|
12604
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
12605
|
+
sequence.correspondences = [...sequence.correspondences ?? [], cc.corr];
|
|
12606
|
+
i = cc.next;
|
|
12290
12607
|
} else if (command === "source") {
|
|
12291
12608
|
sequence.sourceRefs.push(readSource(unwrapBlock(t[i++])));
|
|
12292
12609
|
} else if (command === "step") {
|
|
@@ -12348,6 +12665,12 @@ var dumpTestSequence = function(seq) {
|
|
|
12348
12665
|
for (const src of seq.sourceRefs) {
|
|
12349
12666
|
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
12350
12667
|
}
|
|
12668
|
+
out += dumpCorrespondences(
|
|
12669
|
+
seq.correspondences,
|
|
12670
|
+
" ",
|
|
12671
|
+
escapeString,
|
|
12672
|
+
dumpBareSafe
|
|
12673
|
+
);
|
|
12351
12674
|
out += "}\n";
|
|
12352
12675
|
return out;
|
|
12353
12676
|
};
|
|
@@ -12382,6 +12705,10 @@ var parseFormulasUsed = function(id, data) {
|
|
|
12382
12705
|
if (!foldRefIntoLegacy(trace, r)) {
|
|
12383
12706
|
(trace.refs ??= []).push(r);
|
|
12384
12707
|
}
|
|
12708
|
+
} else if (command === "corresponds") {
|
|
12709
|
+
(trace.correspondences ??= []).push(
|
|
12710
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
12711
|
+
);
|
|
12385
12712
|
} else if (command === "source") {
|
|
12386
12713
|
trace.sourceRefs.push(readSource(unwrapBlock(value())));
|
|
12387
12714
|
} else {
|
|
@@ -12413,6 +12740,12 @@ var dumpFormulasUsed = function(fu) {
|
|
|
12413
12740
|
for (const src of fu.sourceRefs) {
|
|
12414
12741
|
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
12415
12742
|
}
|
|
12743
|
+
out += dumpCorrespondences(
|
|
12744
|
+
fu.correspondences,
|
|
12745
|
+
" ",
|
|
12746
|
+
escapeString,
|
|
12747
|
+
dumpBareSafe
|
|
12748
|
+
);
|
|
12416
12749
|
out += "}\n";
|
|
12417
12750
|
return out;
|
|
12418
12751
|
};
|
|
@@ -12705,6 +13038,392 @@ var dualConstruct = {
|
|
|
12705
13038
|
dump: dumpDual
|
|
12706
13039
|
};
|
|
12707
13040
|
|
|
13041
|
+
// src/ser-des/config/trustRef.ts
|
|
13042
|
+
function parseTrustRefFromReaders(value, peek, stripWrapping2) {
|
|
13043
|
+
const ref = { org: stripWrapping2(value()), kid: "" };
|
|
13044
|
+
if (peek() === "key") {
|
|
13045
|
+
value();
|
|
13046
|
+
ref.kid = stripWrapping2(value());
|
|
13047
|
+
}
|
|
13048
|
+
return ref;
|
|
13049
|
+
}
|
|
13050
|
+
function dumpTrustRef(ref, indent, dumpBareSafe2) {
|
|
13051
|
+
let out = `${indent}trust_ref ${dumpBareSafe2(ref.org)}`;
|
|
13052
|
+
if (ref.kid !== "") {
|
|
13053
|
+
out += ` key ${dumpBareSafe2(ref.kid)}`;
|
|
13054
|
+
}
|
|
13055
|
+
return out + "\n";
|
|
13056
|
+
}
|
|
13057
|
+
|
|
13058
|
+
// src/ser-des/config/dataspace.ts
|
|
13059
|
+
var parseDataspace = function(id, data) {
|
|
13060
|
+
const ds = {
|
|
13061
|
+
id,
|
|
13062
|
+
name: "",
|
|
13063
|
+
description: "",
|
|
13064
|
+
participantClasses: [],
|
|
13065
|
+
artifactClasses: [],
|
|
13066
|
+
policies: [],
|
|
13067
|
+
defaultPolicy: "",
|
|
13068
|
+
trustAnchors: [],
|
|
13069
|
+
compatibleWith: [],
|
|
13070
|
+
source: null,
|
|
13071
|
+
sourceRefs: []
|
|
13072
|
+
};
|
|
13073
|
+
forEachEntry(
|
|
13074
|
+
data,
|
|
13075
|
+
(command, value, peek) => {
|
|
13076
|
+
if (command === "name") {
|
|
13077
|
+
ds.name = unwrapped(value);
|
|
13078
|
+
} else if (command === "description") {
|
|
13079
|
+
ds.description = unwrapped(value);
|
|
13080
|
+
} else if (command === "participant_class") {
|
|
13081
|
+
const pc = {
|
|
13082
|
+
id: stripWrapping(value()),
|
|
13083
|
+
label: "",
|
|
13084
|
+
description: ""
|
|
13085
|
+
};
|
|
13086
|
+
const next = peek();
|
|
13087
|
+
if (next && next.startsWith("{")) {
|
|
13088
|
+
forEachEntry(
|
|
13089
|
+
unwrapBlock(value()),
|
|
13090
|
+
(facet, facetValue) => {
|
|
13091
|
+
if (facet === "label") {
|
|
13092
|
+
pc.label = unwrapped(facetValue);
|
|
13093
|
+
} else if (facet === "description") {
|
|
13094
|
+
pc.description = unwrapped(facetValue);
|
|
13095
|
+
} else {
|
|
13096
|
+
return false;
|
|
13097
|
+
}
|
|
13098
|
+
return true;
|
|
13099
|
+
},
|
|
13100
|
+
{ construct: "dataspace.participant_class", id: pc.id }
|
|
13101
|
+
);
|
|
13102
|
+
}
|
|
13103
|
+
ds.participantClasses.push(pc);
|
|
13104
|
+
} else if (command === "artifact_class") {
|
|
13105
|
+
const ac = {
|
|
13106
|
+
id: stripWrapping(value()),
|
|
13107
|
+
label: "",
|
|
13108
|
+
description: "",
|
|
13109
|
+
element: "",
|
|
13110
|
+
policy: ""
|
|
13111
|
+
};
|
|
13112
|
+
const next = peek();
|
|
13113
|
+
if (next && next.startsWith("{")) {
|
|
13114
|
+
forEachEntry(
|
|
13115
|
+
unwrapBlock(value()),
|
|
13116
|
+
(facet, facetValue) => {
|
|
13117
|
+
if (facet === "label") {
|
|
13118
|
+
ac.label = unwrapped(facetValue);
|
|
13119
|
+
} else if (facet === "description") {
|
|
13120
|
+
ac.description = unwrapped(facetValue);
|
|
13121
|
+
} else if (facet === "element") {
|
|
13122
|
+
ac.element = stripWrapping(facetValue());
|
|
13123
|
+
} else if (facet === "policy") {
|
|
13124
|
+
ac.policy = stripWrapping(facetValue());
|
|
13125
|
+
} else {
|
|
13126
|
+
return false;
|
|
13127
|
+
}
|
|
13128
|
+
return true;
|
|
13129
|
+
},
|
|
13130
|
+
{ construct: "dataspace.artifact_class", id: ac.id }
|
|
13131
|
+
);
|
|
13132
|
+
}
|
|
13133
|
+
ds.artifactClasses.push(ac);
|
|
13134
|
+
} else if (command === "policies") {
|
|
13135
|
+
ds.policies = readEntryTokens(value());
|
|
13136
|
+
} else if (command === "default_policy") {
|
|
13137
|
+
ds.defaultPolicy = stripWrapping(value());
|
|
13138
|
+
} else if (command === "trust_anchor") {
|
|
13139
|
+
const ta = {
|
|
13140
|
+
id: stripWrapping(value()),
|
|
13141
|
+
trustRef: null,
|
|
13142
|
+
role: "",
|
|
13143
|
+
description: ""
|
|
13144
|
+
};
|
|
13145
|
+
const next = peek();
|
|
13146
|
+
if (next && next.startsWith("{")) {
|
|
13147
|
+
forEachEntry(
|
|
13148
|
+
unwrapBlock(value()),
|
|
13149
|
+
(facet, facetValue, facetPeek) => {
|
|
13150
|
+
if (facet === "trust_ref") {
|
|
13151
|
+
ta.trustRef = parseTrustRefFromReaders(
|
|
13152
|
+
facetValue,
|
|
13153
|
+
facetPeek,
|
|
13154
|
+
stripWrapping
|
|
13155
|
+
);
|
|
13156
|
+
} else if (facet === "role") {
|
|
13157
|
+
ta.role = stripWrapping(facetValue());
|
|
13158
|
+
} else if (facet === "description") {
|
|
13159
|
+
ta.description = unwrapped(facetValue);
|
|
13160
|
+
} else {
|
|
13161
|
+
return false;
|
|
13162
|
+
}
|
|
13163
|
+
return true;
|
|
13164
|
+
},
|
|
13165
|
+
{ construct: "dataspace.trust_anchor", id: ta.id }
|
|
13166
|
+
);
|
|
13167
|
+
}
|
|
13168
|
+
ds.trustAnchors.push(ta);
|
|
13169
|
+
} else if (command === "compatible_with") {
|
|
13170
|
+
ds.compatibleWith = readEntryTokens(value());
|
|
13171
|
+
} else if (command === "source") {
|
|
13172
|
+
const src = readSource(unwrapBlock(value()));
|
|
13173
|
+
ds.sourceRefs.push(src);
|
|
13174
|
+
if (!ds.source) {
|
|
13175
|
+
ds.source = src;
|
|
13176
|
+
}
|
|
13177
|
+
} else if (command === "ref") {
|
|
13178
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
13179
|
+
if (!foldRefIntoLegacy(ds, r)) {
|
|
13180
|
+
(ds.refs ??= []).push(r);
|
|
13181
|
+
}
|
|
13182
|
+
} else if (command === "corresponds") {
|
|
13183
|
+
(ds.correspondences ??= []).push(
|
|
13184
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
13185
|
+
);
|
|
13186
|
+
} else {
|
|
13187
|
+
return false;
|
|
13188
|
+
}
|
|
13189
|
+
return true;
|
|
13190
|
+
},
|
|
13191
|
+
{ construct: "dataspace", id }
|
|
13192
|
+
);
|
|
13193
|
+
return (ctx) => {
|
|
13194
|
+
ctx.dataspaces[id] = ds;
|
|
13195
|
+
return ctx;
|
|
13196
|
+
};
|
|
13197
|
+
};
|
|
13198
|
+
var dumpDataspace = function(d) {
|
|
13199
|
+
let out = "dataspace " + d.id + " {\n";
|
|
13200
|
+
if (d.name) {
|
|
13201
|
+
out += ' name "' + escapeString(d.name) + '"\n';
|
|
13202
|
+
}
|
|
13203
|
+
if (d.description) {
|
|
13204
|
+
out += ' description "' + escapeString(d.description) + '"\n';
|
|
13205
|
+
}
|
|
13206
|
+
for (const pc of d.participantClasses) {
|
|
13207
|
+
out += " participant_class " + dumpBareSafe(pc.id) + " {\n";
|
|
13208
|
+
if (pc.label) {
|
|
13209
|
+
out += ' label "' + escapeString(pc.label) + '"\n';
|
|
13210
|
+
}
|
|
13211
|
+
if (pc.description) {
|
|
13212
|
+
out += ' description "' + escapeString(pc.description) + '"\n';
|
|
13213
|
+
}
|
|
13214
|
+
out += " }\n";
|
|
13215
|
+
}
|
|
13216
|
+
for (const ac of d.artifactClasses) {
|
|
13217
|
+
out += " artifact_class " + dumpBareSafe(ac.id) + " {\n";
|
|
13218
|
+
if (ac.label) {
|
|
13219
|
+
out += ' label "' + escapeString(ac.label) + '"\n';
|
|
13220
|
+
}
|
|
13221
|
+
if (ac.description) {
|
|
13222
|
+
out += ' description "' + escapeString(ac.description) + '"\n';
|
|
13223
|
+
}
|
|
13224
|
+
if (ac.element) {
|
|
13225
|
+
out += " element " + dumpBareSafe(ac.element) + "\n";
|
|
13226
|
+
}
|
|
13227
|
+
if (ac.policy) {
|
|
13228
|
+
out += " policy " + dumpBareSafe(ac.policy) + "\n";
|
|
13229
|
+
}
|
|
13230
|
+
out += " }\n";
|
|
13231
|
+
}
|
|
13232
|
+
if (d.policies.length > 0) {
|
|
13233
|
+
out += " policies { " + d.policies.map(dumpBareSafe).join(" ") + " }\n";
|
|
13234
|
+
}
|
|
13235
|
+
if (d.defaultPolicy) {
|
|
13236
|
+
out += " default_policy " + dumpBareSafe(d.defaultPolicy) + "\n";
|
|
13237
|
+
}
|
|
13238
|
+
for (const ta of d.trustAnchors) {
|
|
13239
|
+
out += " trust_anchor " + dumpBareSafe(ta.id) + " {\n";
|
|
13240
|
+
if (ta.trustRef) {
|
|
13241
|
+
out += dumpTrustRef(ta.trustRef, " ", dumpBareSafe);
|
|
13242
|
+
}
|
|
13243
|
+
if (ta.role) {
|
|
13244
|
+
out += " role " + dumpBareSafe(ta.role) + "\n";
|
|
13245
|
+
}
|
|
13246
|
+
if (ta.description) {
|
|
13247
|
+
out += ' description "' + escapeString(ta.description) + '"\n';
|
|
13248
|
+
}
|
|
13249
|
+
out += " }\n";
|
|
13250
|
+
}
|
|
13251
|
+
if (d.compatibleWith.length > 0) {
|
|
13252
|
+
out += " compatible_with { " + d.compatibleWith.map(dumpBareSafe).join(" ") + " }\n";
|
|
13253
|
+
}
|
|
13254
|
+
const sources = d.sourceRefs && d.sourceRefs.length > 0 ? d.sourceRefs : d.source ? [d.source] : [];
|
|
13255
|
+
for (const s of sources) {
|
|
13256
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
13257
|
+
}
|
|
13258
|
+
out += dumpRefs(d.refs, " ", escapeString);
|
|
13259
|
+
out += dumpCorrespondences(
|
|
13260
|
+
d.correspondences,
|
|
13261
|
+
" ",
|
|
13262
|
+
escapeString,
|
|
13263
|
+
dumpBareSafe
|
|
13264
|
+
);
|
|
13265
|
+
out += "}\n";
|
|
13266
|
+
return out;
|
|
13267
|
+
};
|
|
13268
|
+
var dataspaceConstruct = {
|
|
13269
|
+
keyword: "dataspace",
|
|
13270
|
+
field: "dataspaces",
|
|
13271
|
+
takesID: true,
|
|
13272
|
+
parse: parseDataspace,
|
|
13273
|
+
dump: dumpDataspace
|
|
13274
|
+
};
|
|
13275
|
+
|
|
13276
|
+
// src/types/Policy.ts
|
|
13277
|
+
var POLICY_RULE_KINDS = [
|
|
13278
|
+
"permission",
|
|
13279
|
+
"obligation",
|
|
13280
|
+
"prohibition"
|
|
13281
|
+
];
|
|
13282
|
+
|
|
13283
|
+
// src/ser-des/config/policy.ts
|
|
13284
|
+
var parsePolicy = function(id, data) {
|
|
13285
|
+
const policy = {
|
|
13286
|
+
id,
|
|
13287
|
+
name: "",
|
|
13288
|
+
description: "",
|
|
13289
|
+
governs: [],
|
|
13290
|
+
defaultPosture: null,
|
|
13291
|
+
rules: [],
|
|
13292
|
+
source: null,
|
|
13293
|
+
sourceRefs: []
|
|
13294
|
+
};
|
|
13295
|
+
forEachEntry(
|
|
13296
|
+
data,
|
|
13297
|
+
(command, value, peek) => {
|
|
13298
|
+
if (command === "name") {
|
|
13299
|
+
policy.name = unwrapped(value);
|
|
13300
|
+
} else if (command === "description") {
|
|
13301
|
+
policy.description = unwrapped(value);
|
|
13302
|
+
} else if (command === "governs") {
|
|
13303
|
+
policy.governs = readEntryTokens(value());
|
|
13304
|
+
} else if (command === "default_posture") {
|
|
13305
|
+
const v = stripWrapping(value());
|
|
13306
|
+
if (v !== "true" && v !== "false") {
|
|
13307
|
+
throw new Error(
|
|
13308
|
+
`Parsing error: policy. ID ${id}: default_posture is true | false, got "${v}"`
|
|
13309
|
+
);
|
|
13310
|
+
}
|
|
13311
|
+
policy.defaultPosture = v === "true";
|
|
13312
|
+
} else if (command === "rule") {
|
|
13313
|
+
const rule = {
|
|
13314
|
+
id: stripWrapping(value()),
|
|
13315
|
+
kind: "",
|
|
13316
|
+
action: "",
|
|
13317
|
+
artifact: "",
|
|
13318
|
+
constraints: []
|
|
13319
|
+
};
|
|
13320
|
+
const next = peek();
|
|
13321
|
+
if (next && next.startsWith("{")) {
|
|
13322
|
+
forEachEntry(
|
|
13323
|
+
unwrapBlock(value()),
|
|
13324
|
+
(facet, facetValue) => {
|
|
13325
|
+
if (facet === "kind") {
|
|
13326
|
+
const k = stripWrapping(facetValue());
|
|
13327
|
+
if (!POLICY_RULE_KINDS.includes(k)) {
|
|
13328
|
+
throw new Error(
|
|
13329
|
+
`Parsing error: policy.rule. ID ${rule.id}: unknown rule kind "${k}" \u2014 rule kinds are ${POLICY_RULE_KINDS.join(" | ")} (fail-closed: a misspelt kind never parses into a rule that says nothing)`
|
|
13330
|
+
);
|
|
13331
|
+
}
|
|
13332
|
+
rule.kind = k;
|
|
13333
|
+
} else if (facet === "action") {
|
|
13334
|
+
rule.action = stripWrapping(facetValue());
|
|
13335
|
+
} else if (facet === "artifact") {
|
|
13336
|
+
rule.artifact = stripWrapping(facetValue());
|
|
13337
|
+
} else if (facet === "constraint") {
|
|
13338
|
+
rule.constraints.push(unwrapped(facetValue));
|
|
13339
|
+
} else {
|
|
13340
|
+
return false;
|
|
13341
|
+
}
|
|
13342
|
+
return true;
|
|
13343
|
+
},
|
|
13344
|
+
{ construct: "policy.rule", id: rule.id }
|
|
13345
|
+
);
|
|
13346
|
+
}
|
|
13347
|
+
policy.rules.push(rule);
|
|
13348
|
+
} else if (command === "source") {
|
|
13349
|
+
const src = readSource(unwrapBlock(value()));
|
|
13350
|
+
policy.sourceRefs.push(src);
|
|
13351
|
+
if (!policy.source) {
|
|
13352
|
+
policy.source = src;
|
|
13353
|
+
}
|
|
13354
|
+
} else if (command === "ref") {
|
|
13355
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
13356
|
+
if (!foldRefIntoLegacy(policy, r)) {
|
|
13357
|
+
(policy.refs ??= []).push(r);
|
|
13358
|
+
}
|
|
13359
|
+
} else if (command === "corresponds") {
|
|
13360
|
+
(policy.correspondences ??= []).push(
|
|
13361
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
13362
|
+
);
|
|
13363
|
+
} else {
|
|
13364
|
+
return false;
|
|
13365
|
+
}
|
|
13366
|
+
return true;
|
|
13367
|
+
},
|
|
13368
|
+
{ construct: "policy", id }
|
|
13369
|
+
);
|
|
13370
|
+
return (ctx) => {
|
|
13371
|
+
ctx.policies[id] = policy;
|
|
13372
|
+
return ctx;
|
|
13373
|
+
};
|
|
13374
|
+
};
|
|
13375
|
+
var dumpPolicy = function(p) {
|
|
13376
|
+
let out = "policy " + p.id + " {\n";
|
|
13377
|
+
if (p.name) {
|
|
13378
|
+
out += ' name "' + escapeString(p.name) + '"\n';
|
|
13379
|
+
}
|
|
13380
|
+
if (p.description) {
|
|
13381
|
+
out += ' description "' + escapeString(p.description) + '"\n';
|
|
13382
|
+
}
|
|
13383
|
+
if (p.defaultPosture !== null) {
|
|
13384
|
+
out += " default_posture " + (p.defaultPosture ? "true" : "false") + "\n";
|
|
13385
|
+
}
|
|
13386
|
+
if (p.governs.length > 0) {
|
|
13387
|
+
out += " governs { " + p.governs.map(dumpBareSafe).join(" ") + " }\n";
|
|
13388
|
+
}
|
|
13389
|
+
for (const r of p.rules) {
|
|
13390
|
+
out += " rule " + dumpBareSafe(r.id) + " {\n";
|
|
13391
|
+
if (r.kind) {
|
|
13392
|
+
out += " kind " + r.kind + "\n";
|
|
13393
|
+
}
|
|
13394
|
+
if (r.action) {
|
|
13395
|
+
out += " action " + dumpBareSafe(r.action) + "\n";
|
|
13396
|
+
}
|
|
13397
|
+
if (r.artifact) {
|
|
13398
|
+
out += " artifact " + dumpBareSafe(r.artifact) + "\n";
|
|
13399
|
+
}
|
|
13400
|
+
for (const c of r.constraints) {
|
|
13401
|
+
out += ' constraint "' + escapeString(c) + '"\n';
|
|
13402
|
+
}
|
|
13403
|
+
out += " }\n";
|
|
13404
|
+
}
|
|
13405
|
+
const sources = p.sourceRefs && p.sourceRefs.length > 0 ? p.sourceRefs : p.source ? [p.source] : [];
|
|
13406
|
+
for (const s of sources) {
|
|
13407
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
13408
|
+
}
|
|
13409
|
+
out += dumpRefs(p.refs, " ", escapeString);
|
|
13410
|
+
out += dumpCorrespondences(
|
|
13411
|
+
p.correspondences,
|
|
13412
|
+
" ",
|
|
13413
|
+
escapeString,
|
|
13414
|
+
dumpBareSafe
|
|
13415
|
+
);
|
|
13416
|
+
out += "}\n";
|
|
13417
|
+
return out;
|
|
13418
|
+
};
|
|
13419
|
+
var policyConstruct = {
|
|
13420
|
+
keyword: "policy",
|
|
13421
|
+
field: "policies",
|
|
13422
|
+
takesID: true,
|
|
13423
|
+
parse: parsePolicy,
|
|
13424
|
+
dump: dumpPolicy
|
|
13425
|
+
};
|
|
13426
|
+
|
|
12708
13427
|
// src/ser-des/config/activityArchetype.ts
|
|
12709
13428
|
var parseActivityArchetype = (id, data) => {
|
|
12710
13429
|
const archetype = {
|
|
@@ -13114,7 +13833,15 @@ var CONSTRUCTS = [
|
|
|
13114
13833
|
takesID: true,
|
|
13115
13834
|
parse: parseText,
|
|
13116
13835
|
dump: dumpText
|
|
13117
|
-
})
|
|
13836
|
+
}),
|
|
13837
|
+
// Primmel v3.1 dataspace + trust (TODO.primmel/10; MN 114 clause 19):
|
|
13838
|
+
// the dataspace definition as a model object, and the usage-policy set
|
|
13839
|
+
// in Primmel's own policy grammar (ODRL is a codec output, never an
|
|
13840
|
+
// import). The trust_ref form and the corresponds facet are shared
|
|
13841
|
+
// sub-structures (config/trustRef.ts, config/correspondence.ts), not
|
|
13842
|
+
// top-level constructs.
|
|
13843
|
+
dataspaceConstruct,
|
|
13844
|
+
policyConstruct
|
|
13118
13845
|
];
|
|
13119
13846
|
function buildParserConfig(constructs) {
|
|
13120
13847
|
const out = {};
|
|
@@ -15964,6 +16691,63 @@ var CHECK_RULES = [
|
|
|
15964
16691
|
"error",
|
|
15965
16692
|
"normal",
|
|
15966
16693
|
"docs/primmel/18 \xA718.6 (the unified reference/relation construct)"
|
|
16694
|
+
),
|
|
16695
|
+
// ── the dataspace family (TODO.primmel/10; MN 114 v3.1 clause 19) ──
|
|
16696
|
+
// The v3.1 extension set: the dataspace definition, the policy
|
|
16697
|
+
// construct (Primmel's own policy grammar; ODRL is a codec output),
|
|
16698
|
+
// the trust_ref form (opaque addressing — the checker verifies shape,
|
|
16699
|
+
// NEVER resolution: the trust plane's membership is runtime fact), and
|
|
16700
|
+
// the generalized corresponds annotations. C104: the dataspace's
|
|
16701
|
+
// references resolve (policy register, default policy, per-class
|
|
16702
|
+
// overrides, content elements, the compatibility register). C105:
|
|
16703
|
+
// every trust anchor carries its trust_ref with an organization
|
|
16704
|
+
// identifier. C106: a dataspace with no governance citation warns (an
|
|
16705
|
+
// orphan definition). C107: the policy shape — at least one rule,
|
|
16706
|
+
// every rule with its action, rule artifacts inside the governs
|
|
16707
|
+
// register, governed classes resolving, at most one default-posture
|
|
16708
|
+
// policy per class. C108: one corresponds entry per scheme per
|
|
16709
|
+
// element (an error — the bridges read unambiguous mappings), and the
|
|
16710
|
+
// irdi legacy spelling agreeing with `corresponds iec-cdd` (a warning
|
|
16711
|
+
// leg).
|
|
16712
|
+
R(
|
|
16713
|
+
"C104",
|
|
16714
|
+
"dataspace-references-resolve",
|
|
16715
|
+
"dataspace",
|
|
16716
|
+
"error",
|
|
16717
|
+
"normal",
|
|
16718
|
+
"TODO.primmel/10, MN 114 clause 19.1"
|
|
16719
|
+
),
|
|
16720
|
+
R(
|
|
16721
|
+
"C105",
|
|
16722
|
+
"dataspace-trust-anchor-shape",
|
|
16723
|
+
"dataspace",
|
|
16724
|
+
"error",
|
|
16725
|
+
"normal",
|
|
16726
|
+
"TODO.primmel/10, MN 114 clauses 19.1/19.3"
|
|
16727
|
+
),
|
|
16728
|
+
R(
|
|
16729
|
+
"C106",
|
|
16730
|
+
"dataspace-governance-provenance",
|
|
16731
|
+
"dataspace",
|
|
16732
|
+
"warning",
|
|
16733
|
+
"normal",
|
|
16734
|
+
"TODO.primmel/10, MN 114 clause 19.1"
|
|
16735
|
+
),
|
|
16736
|
+
R(
|
|
16737
|
+
"C107",
|
|
16738
|
+
"policy-shape",
|
|
16739
|
+
"dataspace",
|
|
16740
|
+
"error",
|
|
16741
|
+
"normal",
|
|
16742
|
+
"TODO.primmel/10, MN 114 clause 19.2"
|
|
16743
|
+
),
|
|
16744
|
+
R(
|
|
16745
|
+
"C108",
|
|
16746
|
+
"correspondence-shape",
|
|
16747
|
+
"dataspace",
|
|
16748
|
+
"error",
|
|
16749
|
+
"normal",
|
|
16750
|
+
"TODO.primmel/10, MN 114 clause 19.4"
|
|
15967
16751
|
)
|
|
15968
16752
|
];
|
|
15969
16753
|
var byId = new Map(CHECK_RULES.map((r) => [r.id, r]));
|
|
@@ -20023,6 +20807,230 @@ function checkPackage(dir, options = {}) {
|
|
|
20023
20807
|
}
|
|
20024
20808
|
}
|
|
20025
20809
|
}
|
|
20810
|
+
{
|
|
20811
|
+
const dataspaces = standard.dataspaces ?? [];
|
|
20812
|
+
const policies = standard.policies ?? [];
|
|
20813
|
+
const policyIds = new Set(policies.map((p) => p.id));
|
|
20814
|
+
const dataspaceIds = new Set(dataspaces.map((d) => d.id));
|
|
20815
|
+
const artifactClassIds = /* @__PURE__ */ new Set();
|
|
20816
|
+
for (const d of dataspaces) {
|
|
20817
|
+
for (const ac of d.artifactClasses) {
|
|
20818
|
+
artifactClassIds.add(ac.id);
|
|
20819
|
+
}
|
|
20820
|
+
}
|
|
20821
|
+
const elementIds = /* @__PURE__ */ new Set([
|
|
20822
|
+
...(standard.artifactDefinitions ?? []).map((a) => a.id),
|
|
20823
|
+
...(standard.forms ?? []).map((f) => f.id),
|
|
20824
|
+
...(standard.dataclasses ?? []).map((c) => c.id)
|
|
20825
|
+
]);
|
|
20826
|
+
for (const d of dataspaces) {
|
|
20827
|
+
for (const pid of d.policies) {
|
|
20828
|
+
if (!policyIds.has(pid)) {
|
|
20829
|
+
err(
|
|
20830
|
+
"C104",
|
|
20831
|
+
`dataspace ${d.id}: policies entry "${pid}" declares no policy of that id \u2014 the dataspace's policy register references declared policy constructs (dataspace-references-resolve)`
|
|
20832
|
+
);
|
|
20833
|
+
}
|
|
20834
|
+
}
|
|
20835
|
+
if (d.defaultPolicy !== "") {
|
|
20836
|
+
if (!policyIds.has(d.defaultPolicy)) {
|
|
20837
|
+
err(
|
|
20838
|
+
"C104",
|
|
20839
|
+
`dataspace ${d.id}: default_policy "${d.defaultPolicy}" declares no policy of that id \u2014 the standing default is a declared policy (dataspace-references-resolve)`
|
|
20840
|
+
);
|
|
20841
|
+
} else if (!d.policies.includes(d.defaultPolicy)) {
|
|
20842
|
+
err(
|
|
20843
|
+
"C104",
|
|
20844
|
+
`dataspace ${d.id}: default_policy "${d.defaultPolicy}" is not in the dataspace's policies register \u2014 the default is one of the policy sets the dataspace carries (dataspace-references-resolve)`
|
|
20845
|
+
);
|
|
20846
|
+
}
|
|
20847
|
+
}
|
|
20848
|
+
for (const ac of d.artifactClasses) {
|
|
20849
|
+
if (ac.policy !== "") {
|
|
20850
|
+
if (!policyIds.has(ac.policy)) {
|
|
20851
|
+
err(
|
|
20852
|
+
"C104",
|
|
20853
|
+
`dataspace ${d.id}: artifact class "${ac.id}" overrides with policy "${ac.policy}", which declares no policy of that id (dataspace-references-resolve)`
|
|
20854
|
+
);
|
|
20855
|
+
} else if (!d.policies.includes(ac.policy)) {
|
|
20856
|
+
err(
|
|
20857
|
+
"C104",
|
|
20858
|
+
`dataspace ${d.id}: artifact class "${ac.id}" overrides with policy "${ac.policy}", which the dataspace's policies register does not carry \u2014 an override names a policy set the dataspace carries (dataspace-references-resolve)`
|
|
20859
|
+
);
|
|
20860
|
+
}
|
|
20861
|
+
}
|
|
20862
|
+
if (ac.element !== "" && !elementIds.has(ac.element)) {
|
|
20863
|
+
err(
|
|
20864
|
+
"C104",
|
|
20865
|
+
`dataspace ${d.id}: artifact class "${ac.id}" declares element "${ac.element}", which names no declared artifact definition, form, or data class \u2014 the class's content definition must resolve (dataspace-references-resolve)`
|
|
20866
|
+
);
|
|
20867
|
+
}
|
|
20868
|
+
}
|
|
20869
|
+
for (const compat of d.compatibleWith) {
|
|
20870
|
+
if (!dataspaceIds.has(compat)) {
|
|
20871
|
+
err(
|
|
20872
|
+
"C104",
|
|
20873
|
+
`dataspace ${d.id}: compatible_with entry "${compat}" declares no dataspace of that id \u2014 compatibility is explicit and resolved (dataspace-references-resolve)`
|
|
20874
|
+
);
|
|
20875
|
+
} else if (compat === d.id) {
|
|
20876
|
+
err(
|
|
20877
|
+
"C104",
|
|
20878
|
+
`dataspace ${d.id}: compatible_with names the dataspace itself \u2014 compatibility relates two dataspaces (dataspace-references-resolve)`
|
|
20879
|
+
);
|
|
20880
|
+
}
|
|
20881
|
+
}
|
|
20882
|
+
for (const ta of d.trustAnchors) {
|
|
20883
|
+
if (!ta.trustRef || ta.trustRef.org === "") {
|
|
20884
|
+
err(
|
|
20885
|
+
"C105",
|
|
20886
|
+
`dataspace ${d.id}: trust anchor "${ta.id}" declares no trust_ref with an organization identifier \u2014 an anchor without its trust reference anchors nothing (dataspace-trust-anchor-shape)`
|
|
20887
|
+
);
|
|
20888
|
+
}
|
|
20889
|
+
}
|
|
20890
|
+
const hasGovernance = (d.sourceRefs?.length ?? 0) > 0 || d.source && (d.source.doc || d.source.clause);
|
|
20891
|
+
if (!hasGovernance) {
|
|
20892
|
+
warn(
|
|
20893
|
+
"C106",
|
|
20894
|
+
`dataspace ${d.id}: the dataspace cites no governance clause \u2014 the definition's charter is its clause-cited provenance (ref derives-from); an orphan definition is a warning, never silent (dataspace-governance-provenance)`
|
|
20895
|
+
);
|
|
20896
|
+
}
|
|
20897
|
+
}
|
|
20898
|
+
for (const p of policies) {
|
|
20899
|
+
if (p.rules.length === 0) {
|
|
20900
|
+
err(
|
|
20901
|
+
"C107",
|
|
20902
|
+
`policy ${p.id}: a policy declares at least one rule \u2014 a rule-less set says nothing (policy-shape)`
|
|
20903
|
+
);
|
|
20904
|
+
}
|
|
20905
|
+
for (const g of p.governs) {
|
|
20906
|
+
if (!artifactClassIds.has(g)) {
|
|
20907
|
+
err(
|
|
20908
|
+
"C107",
|
|
20909
|
+
`policy ${p.id}: governs entry "${g}" names no artifact class declared by the merged model's dataspaces \u2014 the governed classes resolve (policy-shape)`
|
|
20910
|
+
);
|
|
20911
|
+
}
|
|
20912
|
+
}
|
|
20913
|
+
for (const r of p.rules) {
|
|
20914
|
+
if (r.action === "") {
|
|
20915
|
+
err(
|
|
20916
|
+
"C107",
|
|
20917
|
+
`policy ${p.id}: rule "${r.id}" declares no action \u2014 a rule without its action says nothing (policy-shape)`
|
|
20918
|
+
);
|
|
20919
|
+
}
|
|
20920
|
+
if (r.artifact !== "") {
|
|
20921
|
+
if (p.governs.length > 0 && !p.governs.includes(r.artifact)) {
|
|
20922
|
+
err(
|
|
20923
|
+
"C107",
|
|
20924
|
+
`policy ${p.id}: rule "${r.id}" constrains artifact class "${r.artifact}", which is not in the policy's governs register \u2014 a rule stays inside the register, or drops the facet to cover every governed class (policy-shape)`
|
|
20925
|
+
);
|
|
20926
|
+
}
|
|
20927
|
+
if (!artifactClassIds.has(r.artifact)) {
|
|
20928
|
+
err(
|
|
20929
|
+
"C107",
|
|
20930
|
+
`policy ${p.id}: rule "${r.id}" constrains artifact class "${r.artifact}", which no dataspace of the merged model declares (policy-shape)`
|
|
20931
|
+
);
|
|
20932
|
+
}
|
|
20933
|
+
}
|
|
20934
|
+
}
|
|
20935
|
+
}
|
|
20936
|
+
const postureByClass = /* @__PURE__ */ new Map();
|
|
20937
|
+
for (const p of policies) {
|
|
20938
|
+
if (p.defaultPosture !== true) {
|
|
20939
|
+
continue;
|
|
20940
|
+
}
|
|
20941
|
+
for (const g of p.governs) {
|
|
20942
|
+
postureByClass.set(g, [...postureByClass.get(g) ?? [], p.id]);
|
|
20943
|
+
}
|
|
20944
|
+
}
|
|
20945
|
+
for (const [cls, ids] of postureByClass) {
|
|
20946
|
+
if (ids.length > 1) {
|
|
20947
|
+
err(
|
|
20948
|
+
"C107",
|
|
20949
|
+
`artifact class "${cls}" is governed by ${ids.length} default-posture policies (${ids.join(", ")}) \u2014 the standing default is one policy per class; the rest attach by explicit reference (policy-shape)`
|
|
20950
|
+
);
|
|
20951
|
+
}
|
|
20952
|
+
}
|
|
20953
|
+
const corrElements = [];
|
|
20954
|
+
const collect = (kind, items) => {
|
|
20955
|
+
for (const it of items ?? []) {
|
|
20956
|
+
if (it.correspondences && it.correspondences.length > 0) {
|
|
20957
|
+
corrElements.push({ kind, id: it.id, corrs: it.correspondences });
|
|
20958
|
+
}
|
|
20959
|
+
}
|
|
20960
|
+
};
|
|
20961
|
+
collect("dataspace", dataspaces);
|
|
20962
|
+
collect("policy", policies);
|
|
20963
|
+
collect("instrument", standard.instruments ?? []);
|
|
20964
|
+
collect("attribute_definition", standard.attributeDefinitions ?? []);
|
|
20965
|
+
collect("capability", standard.capabilities ?? []);
|
|
20966
|
+
collect("behavior", standard.behaviors ?? []);
|
|
20967
|
+
collect("condition_set", standard.conditionSets ?? []);
|
|
20968
|
+
collect("requirement", standard.requirements ?? []);
|
|
20969
|
+
collect("conformance_test", standard.conformanceTests ?? []);
|
|
20970
|
+
collect("form", standard.forms ?? []);
|
|
20971
|
+
collect("table", standard.tables ?? []);
|
|
20972
|
+
collect("symbol", standard.symbols ?? []);
|
|
20973
|
+
collect("calculation", standard.calculations ?? []);
|
|
20974
|
+
collect("term", standard.terms ?? []);
|
|
20975
|
+
collect("artifact_definition", standard.artifactDefinitions ?? []);
|
|
20976
|
+
collect("verdict", standard.verdicts ?? []);
|
|
20977
|
+
collect("reference_material", standard.referenceMaterials ?? []);
|
|
20978
|
+
collect("test_point_set", standard.testPointSets ?? []);
|
|
20979
|
+
collect("competence_kind", standard.competenceKinds ?? []);
|
|
20980
|
+
collect("constraint", standard.constraints ?? []);
|
|
20981
|
+
collect("test_sequence", standard.testSequences ?? []);
|
|
20982
|
+
collect("formulas_used", standard.formulasUsed ?? []);
|
|
20983
|
+
collect("process", standard.processes ?? []);
|
|
20984
|
+
for (const f of standard.forms ?? []) {
|
|
20985
|
+
for (const fld of f.fields ?? []) {
|
|
20986
|
+
if (fld.correspondences && fld.correspondences.length > 0) {
|
|
20987
|
+
corrElements.push({
|
|
20988
|
+
kind: "field",
|
|
20989
|
+
id: `${f.id}.${fld.name}`,
|
|
20990
|
+
corrs: fld.correspondences
|
|
20991
|
+
});
|
|
20992
|
+
}
|
|
20993
|
+
}
|
|
20994
|
+
}
|
|
20995
|
+
if (standard.packageManifest?.correspondences?.length) {
|
|
20996
|
+
corrElements.push({
|
|
20997
|
+
kind: "package",
|
|
20998
|
+
id: standard.packageManifest.id,
|
|
20999
|
+
corrs: standard.packageManifest.correspondences
|
|
21000
|
+
});
|
|
21001
|
+
}
|
|
21002
|
+
for (const el of corrElements) {
|
|
21003
|
+
const byScheme = /* @__PURE__ */ new Map();
|
|
21004
|
+
for (const c of el.corrs) {
|
|
21005
|
+
byScheme.set(c.scheme, (byScheme.get(c.scheme) ?? 0) + 1);
|
|
21006
|
+
if (c.scheme === "" || c.concept === "") {
|
|
21007
|
+
err(
|
|
21008
|
+
"C108",
|
|
21009
|
+
`${el.kind} ${el.id}: a corresponds entry carries an empty scheme or concept \u2014 the entry names its scheme and the scheme's concept identifier (correspondence-shape)`
|
|
21010
|
+
);
|
|
21011
|
+
}
|
|
21012
|
+
}
|
|
21013
|
+
for (const [scheme, n] of byScheme) {
|
|
21014
|
+
if (n > 1) {
|
|
21015
|
+
err(
|
|
21016
|
+
"C108",
|
|
21017
|
+
`${el.kind} ${el.id}: ${n} corresponds entries name scheme "${scheme}" \u2014 one element has at most one correspondence per scheme, so every bridge reads an unambiguous mapping (correspondence-shape)`
|
|
21018
|
+
);
|
|
21019
|
+
}
|
|
21020
|
+
}
|
|
21021
|
+
}
|
|
21022
|
+
for (const a of standard.attributeDefinitions ?? []) {
|
|
21023
|
+
if (a.irdi && a.irdi !== "") {
|
|
21024
|
+
const cdd = (a.correspondences ?? []).find((c) => c.scheme === "iec-cdd");
|
|
21025
|
+
if (cdd && cdd.concept !== a.irdi) {
|
|
21026
|
+
warn(
|
|
21027
|
+
"C108",
|
|
21028
|
+
`attribute_definition ${a.id}: irdi "${a.irdi}" disagrees with corresponds iec-cdd "${cdd.concept}" \u2014 the legacy single-scheme spelling and the generalized annotation name the same concept, or the irdi facet retires (correspondence-shape)`
|
|
21029
|
+
);
|
|
21030
|
+
}
|
|
21031
|
+
}
|
|
21032
|
+
}
|
|
21033
|
+
}
|
|
20026
21034
|
const level = strictness === "audit" ? "audit" : "normal";
|
|
20027
21035
|
const { allowlist, issues: allowlistParseIssues } = loadAllowlist(dir);
|
|
20028
21036
|
issues.push(...allowlistParseIssues);
|