@primmel/primmel 1.7.0 → 1.8.1
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 +34 -2
- package/dist/src/check-rules.js.map +1 -1
- package/dist/src/check.d.ts.map +1 -1
- package/dist/src/check.js +220 -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 +18 -2
- 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/stateMachine.d.ts.map +1 -1
- package/dist/src/ser-des/config/stateMachine.js +9 -1
- package/dist/src/ser-des/config/stateMachine.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 +15 -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 +1556 -1253
- package/dist-cli/primmel.mjs +1047 -9
- 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 = {
|
|
@@ -5199,7 +5360,7 @@ function parseInputs(block) {
|
|
|
5199
5360
|
} else if (cmd === "description") {
|
|
5200
5361
|
description = unwrapBlock(pt[j++]);
|
|
5201
5362
|
} else if (cmd === "default") {
|
|
5202
|
-
defaultValue =
|
|
5363
|
+
defaultValue = stripWrapping(pt[j++]);
|
|
5203
5364
|
hasDefault = true;
|
|
5204
5365
|
} else if (cmd === "enum_values") {
|
|
5205
5366
|
enumValues = tokenizePackage(unwrapBlock(pt[j++]));
|
|
@@ -5333,7 +5494,7 @@ var dumpCalculation = function(c) {
|
|
|
5333
5494
|
line += ' description "' + escapeString(inp.description) + '"';
|
|
5334
5495
|
}
|
|
5335
5496
|
if (inp.hasDefault) {
|
|
5336
|
-
line += " default " + inp.defaultValue;
|
|
5497
|
+
line += " default " + dumpBareSafe(inp.defaultValue);
|
|
5337
5498
|
}
|
|
5338
5499
|
if (inp.enumValues && inp.enumValues.length > 0) {
|
|
5339
5500
|
line += " enum_values { " + inp.enumValues.join(" ") + " }";
|
|
@@ -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) {
|
|
@@ -5596,7 +5763,9 @@ var dumpStateMachine = function(sm) {
|
|
|
5596
5763
|
if (sm.kind === "operational") {
|
|
5597
5764
|
out += " kind operational\n";
|
|
5598
5765
|
}
|
|
5599
|
-
|
|
5766
|
+
if (sm.initialState) {
|
|
5767
|
+
out += " initial " + sm.initialState + "\n";
|
|
5768
|
+
}
|
|
5600
5769
|
if (sm.states.length > 0) {
|
|
5601
5770
|
out += " states {\n";
|
|
5602
5771
|
for (const s of sm.states) {
|
|
@@ -6671,8 +6840,12 @@ var parseCompetenceKind = function(id, data) {
|
|
|
6671
6840
|
(result.refs ??= []).push(rr.ref);
|
|
6672
6841
|
}
|
|
6673
6842
|
i = rr.next;
|
|
6843
|
+
} else if (keyword === "corresponds") {
|
|
6844
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
6845
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
6846
|
+
i = cc.next;
|
|
6674
6847
|
} else {
|
|
6675
|
-
i
|
|
6848
|
+
i = skipUnknownValue(t, i, keyword);
|
|
6676
6849
|
}
|
|
6677
6850
|
}
|
|
6678
6851
|
return (ctx) => {
|
|
@@ -6694,6 +6867,12 @@ var dumpCompetenceKind = function(k) {
|
|
|
6694
6867
|
for (const ms of k.methodStandards) {
|
|
6695
6868
|
out += " method_standard " + ms.id + ' "' + escapeString(ms.title) + '"\n';
|
|
6696
6869
|
}
|
|
6870
|
+
out += dumpCorrespondences(
|
|
6871
|
+
k.correspondences,
|
|
6872
|
+
" ",
|
|
6873
|
+
escapeString,
|
|
6874
|
+
dumpBareSafe
|
|
6875
|
+
);
|
|
6697
6876
|
out += "}\n";
|
|
6698
6877
|
return out;
|
|
6699
6878
|
};
|
|
@@ -7138,6 +7317,10 @@ var parseConformanceTest = function(id, data) {
|
|
|
7138
7317
|
if (!foldRefIntoLegacy(result, rr)) {
|
|
7139
7318
|
(result.refs ??= []).push(rr);
|
|
7140
7319
|
}
|
|
7320
|
+
} else if (keyword === "corresponds") {
|
|
7321
|
+
(result.correspondences ??= []).push(
|
|
7322
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
7323
|
+
);
|
|
7141
7324
|
} else if (keyword === "binds_to") {
|
|
7142
7325
|
result.bindsTo = tokenizePackage(value());
|
|
7143
7326
|
} else if (keyword === "applicability") {
|
|
@@ -7496,6 +7679,12 @@ var dumpConformanceTest = function(ct) {
|
|
|
7496
7679
|
if (ct.sourceDiscrepancy) {
|
|
7497
7680
|
out += dumpSourceDiscrepancy(ct.sourceDiscrepancy, " ") + "\n";
|
|
7498
7681
|
}
|
|
7682
|
+
out += dumpCorrespondences(
|
|
7683
|
+
ct.correspondences,
|
|
7684
|
+
" ",
|
|
7685
|
+
escapeString,
|
|
7686
|
+
dumpBareSafe
|
|
7687
|
+
);
|
|
7499
7688
|
out += "}\n";
|
|
7500
7689
|
return out;
|
|
7501
7690
|
};
|
|
@@ -7524,6 +7713,12 @@ var parseTerm = function(id, data) {
|
|
|
7524
7713
|
}
|
|
7525
7714
|
return true;
|
|
7526
7715
|
}
|
|
7716
|
+
if (command === "corresponds") {
|
|
7717
|
+
(result.correspondences ??= []).push(
|
|
7718
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
7719
|
+
);
|
|
7720
|
+
return true;
|
|
7721
|
+
}
|
|
7527
7722
|
if (command === "label") {
|
|
7528
7723
|
result.label = unwrapped(value);
|
|
7529
7724
|
} else if (command === "definition") {
|
|
@@ -7611,6 +7806,9 @@ var dumpTerm = function(term) {
|
|
|
7611
7806
|
if (term.source) {
|
|
7612
7807
|
out += ' source "' + escapeString(term.source) + '"\n';
|
|
7613
7808
|
}
|
|
7809
|
+
if (term.overlay) {
|
|
7810
|
+
out += " overlay true\n";
|
|
7811
|
+
}
|
|
7614
7812
|
if (term.scopeNote) {
|
|
7615
7813
|
out += ' scope_note "' + escapeString(term.scopeNote) + '"\n';
|
|
7616
7814
|
}
|
|
@@ -7643,6 +7841,12 @@ var dumpTerm = function(term) {
|
|
|
7643
7841
|
}
|
|
7644
7842
|
out += " }\n";
|
|
7645
7843
|
}
|
|
7844
|
+
out += dumpCorrespondences(
|
|
7845
|
+
term.correspondences,
|
|
7846
|
+
" ",
|
|
7847
|
+
escapeString,
|
|
7848
|
+
dumpBareSafe
|
|
7849
|
+
);
|
|
7646
7850
|
out += "}\n";
|
|
7647
7851
|
return out;
|
|
7648
7852
|
};
|
|
@@ -7719,6 +7923,10 @@ var parseVerdict = function(id, data) {
|
|
|
7719
7923
|
if (!foldRefIntoLegacy(result, r)) {
|
|
7720
7924
|
(result.refs ??= []).push(r);
|
|
7721
7925
|
}
|
|
7926
|
+
} else if (keyword === "corresponds") {
|
|
7927
|
+
(result.correspondences ??= []).push(
|
|
7928
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
7929
|
+
);
|
|
7722
7930
|
} else {
|
|
7723
7931
|
return false;
|
|
7724
7932
|
}
|
|
@@ -7763,6 +7971,12 @@ var dumpVerdict = function(v) {
|
|
|
7763
7971
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
7764
7972
|
}
|
|
7765
7973
|
out += dumpRefs(v.refs, " ", escapeString);
|
|
7974
|
+
out += dumpCorrespondences(
|
|
7975
|
+
v.correspondences,
|
|
7976
|
+
" ",
|
|
7977
|
+
escapeString,
|
|
7978
|
+
dumpBareSafe
|
|
7979
|
+
);
|
|
7766
7980
|
out += "}\n";
|
|
7767
7981
|
return out;
|
|
7768
7982
|
};
|
|
@@ -7932,6 +8146,10 @@ var parseReferenceMaterial = function(id, data) {
|
|
|
7932
8146
|
if (!foldRefIntoLegacy(result, r)) {
|
|
7933
8147
|
(result.refs ??= []).push(r);
|
|
7934
8148
|
}
|
|
8149
|
+
} else if (keyword === "corresponds") {
|
|
8150
|
+
(result.correspondences ??= []).push(
|
|
8151
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
8152
|
+
);
|
|
7935
8153
|
} else if (keyword === "identity_fields") {
|
|
7936
8154
|
result.identityFields = parseIdentityFields(unwrapBlock(value()));
|
|
7937
8155
|
} else if (keyword === "constraints") {
|
|
@@ -7964,6 +8182,12 @@ var dumpReferenceMaterial = function(m) {
|
|
|
7964
8182
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
7965
8183
|
}
|
|
7966
8184
|
out += dumpRefs(m.refs, " ", escapeString);
|
|
8185
|
+
out += dumpCorrespondences(
|
|
8186
|
+
m.correspondences,
|
|
8187
|
+
" ",
|
|
8188
|
+
escapeString,
|
|
8189
|
+
dumpBareSafe
|
|
8190
|
+
);
|
|
7967
8191
|
if (m.identityFields.length > 0) {
|
|
7968
8192
|
out += " identity_fields {\n";
|
|
7969
8193
|
for (const f of m.identityFields) {
|
|
@@ -8152,8 +8376,12 @@ var parseConstraint = function(id, data) {
|
|
|
8152
8376
|
(result.refs ??= []).push(rr.ref);
|
|
8153
8377
|
}
|
|
8154
8378
|
i = rr.next;
|
|
8379
|
+
} else if (keyword === "corresponds") {
|
|
8380
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
8381
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
8382
|
+
i = cc.next;
|
|
8155
8383
|
} else {
|
|
8156
|
-
i
|
|
8384
|
+
i = skipUnknownValue(t, i, keyword);
|
|
8157
8385
|
}
|
|
8158
8386
|
}
|
|
8159
8387
|
return (ctx) => {
|
|
@@ -8179,6 +8407,12 @@ var dumpConstraint = function(c) {
|
|
|
8179
8407
|
if (c.source && (c.source.doc || c.source.clause)) {
|
|
8180
8408
|
out += ' source { doc "' + escapeString(c.source.doc) + '" clause "' + escapeString(c.source.clause) + '"' + (c.source.fragment ? ' fragment "' + escapeString(c.source.fragment) + '"' : "") + " }\n";
|
|
8181
8409
|
}
|
|
8410
|
+
out += dumpCorrespondences(
|
|
8411
|
+
c.correspondences,
|
|
8412
|
+
" ",
|
|
8413
|
+
escapeString,
|
|
8414
|
+
dumpBareSafe
|
|
8415
|
+
);
|
|
8182
8416
|
out += "}\n";
|
|
8183
8417
|
return out;
|
|
8184
8418
|
};
|
|
@@ -8364,6 +8598,10 @@ var parseTestPointSet = function(id, data) {
|
|
|
8364
8598
|
if (!foldRefIntoLegacy(result, r)) {
|
|
8365
8599
|
(result.refs ??= []).push(r);
|
|
8366
8600
|
}
|
|
8601
|
+
} else if (keyword === "corresponds") {
|
|
8602
|
+
(result.correspondences ??= []).push(
|
|
8603
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
8604
|
+
);
|
|
8367
8605
|
} else if (keyword === "cardinality") {
|
|
8368
8606
|
result.cardinality = parseCardinality(unwrapBlock(value()));
|
|
8369
8607
|
} else if (keyword === "repetitions_per_point") {
|
|
@@ -8392,6 +8630,12 @@ var dumpTestPointSet = function(s) {
|
|
|
8392
8630
|
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
8393
8631
|
}
|
|
8394
8632
|
out += dumpRefs(s.refs, " ", escapeString);
|
|
8633
|
+
out += dumpCorrespondences(
|
|
8634
|
+
s.correspondences,
|
|
8635
|
+
" ",
|
|
8636
|
+
escapeString,
|
|
8637
|
+
dumpBareSafe
|
|
8638
|
+
);
|
|
8395
8639
|
const ckeys = Object.keys(s.cardinality);
|
|
8396
8640
|
if (ckeys.length > 0) {
|
|
8397
8641
|
out += " cardinality {\n";
|
|
@@ -8697,6 +8941,10 @@ var parseRequirement = function(id, data) {
|
|
|
8697
8941
|
(result.refs ??= []).push(r.ref);
|
|
8698
8942
|
}
|
|
8699
8943
|
i = r.next;
|
|
8944
|
+
} else if (cmd === "corresponds") {
|
|
8945
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
8946
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
8947
|
+
i = cc.next;
|
|
8700
8948
|
} else {
|
|
8701
8949
|
i = skipUnknownValue(t, i, cmd);
|
|
8702
8950
|
}
|
|
@@ -8841,6 +9089,12 @@ var dumpRequirement = function(r) {
|
|
|
8841
9089
|
for (const ref of r.refs ?? []) {
|
|
8842
9090
|
out += " ref " + ref.predicate + ' "' + escapeString(ref.target) + '"' + (ref.note ? ' { note "' + escapeString(ref.note) + '" }' : "") + "\n";
|
|
8843
9091
|
}
|
|
9092
|
+
out += dumpCorrespondences(
|
|
9093
|
+
r.correspondences,
|
|
9094
|
+
" ",
|
|
9095
|
+
escapeString,
|
|
9096
|
+
dumpBareSafe
|
|
9097
|
+
);
|
|
8844
9098
|
out += "}\n";
|
|
8845
9099
|
return out;
|
|
8846
9100
|
};
|
|
@@ -9024,6 +9278,10 @@ var parsePackage = function(data) {
|
|
|
9024
9278
|
(manifest.refs ??= []).push(r.ref);
|
|
9025
9279
|
}
|
|
9026
9280
|
i = r.next;
|
|
9281
|
+
} else if (cmd === "corresponds") {
|
|
9282
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
9283
|
+
(manifest.correspondences ??= []).push(cc.corr);
|
|
9284
|
+
i = cc.next;
|
|
9027
9285
|
} else if (cmd === "scheme_type" || cmd === "schemeType") {
|
|
9028
9286
|
manifest.schemeType = stripWrapping(t[i++]);
|
|
9029
9287
|
} else if (cmd === "provides") {
|
|
@@ -9728,6 +9986,10 @@ var parseInstrument = function(id, data) {
|
|
|
9728
9986
|
(result.refs ??= []).push(rr.ref);
|
|
9729
9987
|
}
|
|
9730
9988
|
i = rr.next;
|
|
9989
|
+
} else if (cmd === "corresponds") {
|
|
9990
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
9991
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
9992
|
+
i = cc.next;
|
|
9731
9993
|
} else {
|
|
9732
9994
|
i = skipUnknownValue(t, i, cmd);
|
|
9733
9995
|
}
|
|
@@ -10230,6 +10492,12 @@ var dumpInstrument = function(inst) {
|
|
|
10230
10492
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10231
10493
|
}
|
|
10232
10494
|
out += dumpRefs(inst.refs, " ", escapeString);
|
|
10495
|
+
out += dumpCorrespondences(
|
|
10496
|
+
inst.correspondences,
|
|
10497
|
+
" ",
|
|
10498
|
+
escapeString,
|
|
10499
|
+
dumpBareSafe
|
|
10500
|
+
);
|
|
10233
10501
|
out += dumpIdList("reference", inst.referenceIds, " ");
|
|
10234
10502
|
out += "}\n";
|
|
10235
10503
|
return out;
|
|
@@ -10302,6 +10570,10 @@ var parseAttributeDefinition = function(id, data) {
|
|
|
10302
10570
|
(result.refs ??= []).push(rr.ref);
|
|
10303
10571
|
}
|
|
10304
10572
|
i = rr.next;
|
|
10573
|
+
} else if (cmd === "corresponds") {
|
|
10574
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
10575
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
10576
|
+
i = cc.next;
|
|
10305
10577
|
} else {
|
|
10306
10578
|
i = skipUnknownValue(t, i, cmd);
|
|
10307
10579
|
}
|
|
@@ -10327,6 +10599,12 @@ var dumpAttributeDefinition = function(a) {
|
|
|
10327
10599
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10328
10600
|
}
|
|
10329
10601
|
out += dumpRefs(a.refs, " ", escapeString);
|
|
10602
|
+
out += dumpCorrespondences(
|
|
10603
|
+
a.correspondences,
|
|
10604
|
+
" ",
|
|
10605
|
+
escapeString,
|
|
10606
|
+
dumpBareSafe
|
|
10607
|
+
);
|
|
10330
10608
|
if (a.quantityKind) {
|
|
10331
10609
|
out += " quantity_kind " + a.quantityKind + "\n";
|
|
10332
10610
|
}
|
|
@@ -10404,6 +10682,10 @@ var parseCapability = function(id, data) {
|
|
|
10404
10682
|
(result.refs ??= []).push(rr.ref);
|
|
10405
10683
|
}
|
|
10406
10684
|
i = rr.next;
|
|
10685
|
+
} else if (cmd === "corresponds") {
|
|
10686
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
10687
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
10688
|
+
i = cc.next;
|
|
10407
10689
|
} else {
|
|
10408
10690
|
i = skipUnknownValue(t, i, cmd);
|
|
10409
10691
|
}
|
|
@@ -10431,6 +10713,12 @@ var dumpCapability = function(c) {
|
|
|
10431
10713
|
out += dumpIdList("verified_by_tests", c.verifiedByTests, " ");
|
|
10432
10714
|
out += dumpIdList("reference", c.referenceIds, " ");
|
|
10433
10715
|
out += dumpRefs(c.refs, " ", escapeString);
|
|
10716
|
+
out += dumpCorrespondences(
|
|
10717
|
+
c.correspondences,
|
|
10718
|
+
" ",
|
|
10719
|
+
escapeString,
|
|
10720
|
+
dumpBareSafe
|
|
10721
|
+
);
|
|
10434
10722
|
out += "}\n";
|
|
10435
10723
|
return out;
|
|
10436
10724
|
};
|
|
@@ -10471,6 +10759,10 @@ var parseBehavior = function(id, data) {
|
|
|
10471
10759
|
(result.refs ??= []).push(rr.ref);
|
|
10472
10760
|
}
|
|
10473
10761
|
i = rr.next;
|
|
10762
|
+
} else if (cmd === "corresponds") {
|
|
10763
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
10764
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
10765
|
+
i = cc.next;
|
|
10474
10766
|
} else {
|
|
10475
10767
|
i = skipUnknownValue(t, i, cmd);
|
|
10476
10768
|
}
|
|
@@ -10496,6 +10788,12 @@ var dumpBehavior = function(b) {
|
|
|
10496
10788
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
10497
10789
|
}
|
|
10498
10790
|
out += dumpRefs(b.refs, " ", escapeString);
|
|
10791
|
+
out += dumpCorrespondences(
|
|
10792
|
+
b.correspondences,
|
|
10793
|
+
" ",
|
|
10794
|
+
escapeString,
|
|
10795
|
+
dumpBareSafe
|
|
10796
|
+
);
|
|
10499
10797
|
out += dumpIdList("verified_by", b.verifiedBy, " ");
|
|
10500
10798
|
out += "}\n";
|
|
10501
10799
|
return out;
|
|
@@ -10548,6 +10846,10 @@ var parseConditionSet = function(id, data) {
|
|
|
10548
10846
|
} else {
|
|
10549
10847
|
(result.refs ??= []).push(rr.ref);
|
|
10550
10848
|
}
|
|
10849
|
+
} else if (cmd === "corresponds") {
|
|
10850
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
10851
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
10852
|
+
i = cc.next;
|
|
10551
10853
|
} else if (cmd === "reference") {
|
|
10552
10854
|
result.referenceIds = readReference(t[i++]);
|
|
10553
10855
|
} else {
|
|
@@ -10634,6 +10936,12 @@ var dumpConditionSet = function(cs) {
|
|
|
10634
10936
|
}
|
|
10635
10937
|
out += dumpIdList("reference", cs.referenceIds, " ");
|
|
10636
10938
|
out += dumpRefs(cs.refs, " ", escapeString);
|
|
10939
|
+
out += dumpCorrespondences(
|
|
10940
|
+
cs.correspondences,
|
|
10941
|
+
" ",
|
|
10942
|
+
escapeString,
|
|
10943
|
+
dumpBareSafe
|
|
10944
|
+
);
|
|
10637
10945
|
out += "}\n";
|
|
10638
10946
|
return out;
|
|
10639
10947
|
};
|
|
@@ -11629,6 +11937,10 @@ var parseArtifactDefinition = function(id, data) {
|
|
|
11629
11937
|
(result.refs ??= []).push(rr.ref);
|
|
11630
11938
|
}
|
|
11631
11939
|
i = rr.next;
|
|
11940
|
+
} else if (cmd === "corresponds") {
|
|
11941
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
11942
|
+
(result.correspondences ??= []).push(cc.corr);
|
|
11943
|
+
i = cc.next;
|
|
11632
11944
|
} else {
|
|
11633
11945
|
i = skipUnknownValue(t, i, cmd);
|
|
11634
11946
|
}
|
|
@@ -11696,6 +12008,12 @@ var dumpArtifactDefinition = function(d) {
|
|
|
11696
12008
|
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
11697
12009
|
}
|
|
11698
12010
|
out += dumpRefs(d.refs, " ", escapeString);
|
|
12011
|
+
out += dumpCorrespondences(
|
|
12012
|
+
d.correspondences,
|
|
12013
|
+
" ",
|
|
12014
|
+
escapeString,
|
|
12015
|
+
dumpBareSafe
|
|
12016
|
+
);
|
|
11699
12017
|
out += dumpIdList2("reference", d.referenceIds, " ");
|
|
11700
12018
|
out += "}\n";
|
|
11701
12019
|
return out;
|
|
@@ -12287,6 +12605,10 @@ var parseTestSequence = function(id, data) {
|
|
|
12287
12605
|
sequence.refs = [...sequence.refs ?? [], rr.ref];
|
|
12288
12606
|
}
|
|
12289
12607
|
i = rr.next;
|
|
12608
|
+
} else if (command === "corresponds") {
|
|
12609
|
+
const cc = parseCorresponds(t, i, stripWrapping);
|
|
12610
|
+
sequence.correspondences = [...sequence.correspondences ?? [], cc.corr];
|
|
12611
|
+
i = cc.next;
|
|
12290
12612
|
} else if (command === "source") {
|
|
12291
12613
|
sequence.sourceRefs.push(readSource(unwrapBlock(t[i++])));
|
|
12292
12614
|
} else if (command === "step") {
|
|
@@ -12348,6 +12670,12 @@ var dumpTestSequence = function(seq) {
|
|
|
12348
12670
|
for (const src of seq.sourceRefs) {
|
|
12349
12671
|
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
12350
12672
|
}
|
|
12673
|
+
out += dumpCorrespondences(
|
|
12674
|
+
seq.correspondences,
|
|
12675
|
+
" ",
|
|
12676
|
+
escapeString,
|
|
12677
|
+
dumpBareSafe
|
|
12678
|
+
);
|
|
12351
12679
|
out += "}\n";
|
|
12352
12680
|
return out;
|
|
12353
12681
|
};
|
|
@@ -12382,6 +12710,10 @@ var parseFormulasUsed = function(id, data) {
|
|
|
12382
12710
|
if (!foldRefIntoLegacy(trace, r)) {
|
|
12383
12711
|
(trace.refs ??= []).push(r);
|
|
12384
12712
|
}
|
|
12713
|
+
} else if (command === "corresponds") {
|
|
12714
|
+
(trace.correspondences ??= []).push(
|
|
12715
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
12716
|
+
);
|
|
12385
12717
|
} else if (command === "source") {
|
|
12386
12718
|
trace.sourceRefs.push(readSource(unwrapBlock(value())));
|
|
12387
12719
|
} else {
|
|
@@ -12413,6 +12745,12 @@ var dumpFormulasUsed = function(fu) {
|
|
|
12413
12745
|
for (const src of fu.sourceRefs) {
|
|
12414
12746
|
out += dumpSourceRefAsRef(src, " ", escapeString);
|
|
12415
12747
|
}
|
|
12748
|
+
out += dumpCorrespondences(
|
|
12749
|
+
fu.correspondences,
|
|
12750
|
+
" ",
|
|
12751
|
+
escapeString,
|
|
12752
|
+
dumpBareSafe
|
|
12753
|
+
);
|
|
12416
12754
|
out += "}\n";
|
|
12417
12755
|
return out;
|
|
12418
12756
|
};
|
|
@@ -12705,6 +13043,392 @@ var dualConstruct = {
|
|
|
12705
13043
|
dump: dumpDual
|
|
12706
13044
|
};
|
|
12707
13045
|
|
|
13046
|
+
// src/ser-des/config/trustRef.ts
|
|
13047
|
+
function parseTrustRefFromReaders(value, peek, stripWrapping2) {
|
|
13048
|
+
const ref = { org: stripWrapping2(value()), kid: "" };
|
|
13049
|
+
if (peek() === "key") {
|
|
13050
|
+
value();
|
|
13051
|
+
ref.kid = stripWrapping2(value());
|
|
13052
|
+
}
|
|
13053
|
+
return ref;
|
|
13054
|
+
}
|
|
13055
|
+
function dumpTrustRef(ref, indent, dumpBareSafe2) {
|
|
13056
|
+
let out = `${indent}trust_ref ${dumpBareSafe2(ref.org)}`;
|
|
13057
|
+
if (ref.kid !== "") {
|
|
13058
|
+
out += ` key ${dumpBareSafe2(ref.kid)}`;
|
|
13059
|
+
}
|
|
13060
|
+
return out + "\n";
|
|
13061
|
+
}
|
|
13062
|
+
|
|
13063
|
+
// src/ser-des/config/dataspace.ts
|
|
13064
|
+
var parseDataspace = function(id, data) {
|
|
13065
|
+
const ds = {
|
|
13066
|
+
id,
|
|
13067
|
+
name: "",
|
|
13068
|
+
description: "",
|
|
13069
|
+
participantClasses: [],
|
|
13070
|
+
artifactClasses: [],
|
|
13071
|
+
policies: [],
|
|
13072
|
+
defaultPolicy: "",
|
|
13073
|
+
trustAnchors: [],
|
|
13074
|
+
compatibleWith: [],
|
|
13075
|
+
source: null,
|
|
13076
|
+
sourceRefs: []
|
|
13077
|
+
};
|
|
13078
|
+
forEachEntry(
|
|
13079
|
+
data,
|
|
13080
|
+
(command, value, peek) => {
|
|
13081
|
+
if (command === "name") {
|
|
13082
|
+
ds.name = unwrapped(value);
|
|
13083
|
+
} else if (command === "description") {
|
|
13084
|
+
ds.description = unwrapped(value);
|
|
13085
|
+
} else if (command === "participant_class") {
|
|
13086
|
+
const pc = {
|
|
13087
|
+
id: stripWrapping(value()),
|
|
13088
|
+
label: "",
|
|
13089
|
+
description: ""
|
|
13090
|
+
};
|
|
13091
|
+
const next = peek();
|
|
13092
|
+
if (next && next.startsWith("{")) {
|
|
13093
|
+
forEachEntry(
|
|
13094
|
+
unwrapBlock(value()),
|
|
13095
|
+
(facet, facetValue) => {
|
|
13096
|
+
if (facet === "label") {
|
|
13097
|
+
pc.label = unwrapped(facetValue);
|
|
13098
|
+
} else if (facet === "description") {
|
|
13099
|
+
pc.description = unwrapped(facetValue);
|
|
13100
|
+
} else {
|
|
13101
|
+
return false;
|
|
13102
|
+
}
|
|
13103
|
+
return true;
|
|
13104
|
+
},
|
|
13105
|
+
{ construct: "dataspace.participant_class", id: pc.id }
|
|
13106
|
+
);
|
|
13107
|
+
}
|
|
13108
|
+
ds.participantClasses.push(pc);
|
|
13109
|
+
} else if (command === "artifact_class") {
|
|
13110
|
+
const ac = {
|
|
13111
|
+
id: stripWrapping(value()),
|
|
13112
|
+
label: "",
|
|
13113
|
+
description: "",
|
|
13114
|
+
element: "",
|
|
13115
|
+
policy: ""
|
|
13116
|
+
};
|
|
13117
|
+
const next = peek();
|
|
13118
|
+
if (next && next.startsWith("{")) {
|
|
13119
|
+
forEachEntry(
|
|
13120
|
+
unwrapBlock(value()),
|
|
13121
|
+
(facet, facetValue) => {
|
|
13122
|
+
if (facet === "label") {
|
|
13123
|
+
ac.label = unwrapped(facetValue);
|
|
13124
|
+
} else if (facet === "description") {
|
|
13125
|
+
ac.description = unwrapped(facetValue);
|
|
13126
|
+
} else if (facet === "element") {
|
|
13127
|
+
ac.element = stripWrapping(facetValue());
|
|
13128
|
+
} else if (facet === "policy") {
|
|
13129
|
+
ac.policy = stripWrapping(facetValue());
|
|
13130
|
+
} else {
|
|
13131
|
+
return false;
|
|
13132
|
+
}
|
|
13133
|
+
return true;
|
|
13134
|
+
},
|
|
13135
|
+
{ construct: "dataspace.artifact_class", id: ac.id }
|
|
13136
|
+
);
|
|
13137
|
+
}
|
|
13138
|
+
ds.artifactClasses.push(ac);
|
|
13139
|
+
} else if (command === "policies") {
|
|
13140
|
+
ds.policies = readEntryTokens(value());
|
|
13141
|
+
} else if (command === "default_policy") {
|
|
13142
|
+
ds.defaultPolicy = stripWrapping(value());
|
|
13143
|
+
} else if (command === "trust_anchor") {
|
|
13144
|
+
const ta = {
|
|
13145
|
+
id: stripWrapping(value()),
|
|
13146
|
+
trustRef: null,
|
|
13147
|
+
role: "",
|
|
13148
|
+
description: ""
|
|
13149
|
+
};
|
|
13150
|
+
const next = peek();
|
|
13151
|
+
if (next && next.startsWith("{")) {
|
|
13152
|
+
forEachEntry(
|
|
13153
|
+
unwrapBlock(value()),
|
|
13154
|
+
(facet, facetValue, facetPeek) => {
|
|
13155
|
+
if (facet === "trust_ref") {
|
|
13156
|
+
ta.trustRef = parseTrustRefFromReaders(
|
|
13157
|
+
facetValue,
|
|
13158
|
+
facetPeek,
|
|
13159
|
+
stripWrapping
|
|
13160
|
+
);
|
|
13161
|
+
} else if (facet === "role") {
|
|
13162
|
+
ta.role = stripWrapping(facetValue());
|
|
13163
|
+
} else if (facet === "description") {
|
|
13164
|
+
ta.description = unwrapped(facetValue);
|
|
13165
|
+
} else {
|
|
13166
|
+
return false;
|
|
13167
|
+
}
|
|
13168
|
+
return true;
|
|
13169
|
+
},
|
|
13170
|
+
{ construct: "dataspace.trust_anchor", id: ta.id }
|
|
13171
|
+
);
|
|
13172
|
+
}
|
|
13173
|
+
ds.trustAnchors.push(ta);
|
|
13174
|
+
} else if (command === "compatible_with") {
|
|
13175
|
+
ds.compatibleWith = readEntryTokens(value());
|
|
13176
|
+
} else if (command === "source") {
|
|
13177
|
+
const src = readSource(unwrapBlock(value()));
|
|
13178
|
+
ds.sourceRefs.push(src);
|
|
13179
|
+
if (!ds.source) {
|
|
13180
|
+
ds.source = src;
|
|
13181
|
+
}
|
|
13182
|
+
} else if (command === "ref") {
|
|
13183
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
13184
|
+
if (!foldRefIntoLegacy(ds, r)) {
|
|
13185
|
+
(ds.refs ??= []).push(r);
|
|
13186
|
+
}
|
|
13187
|
+
} else if (command === "corresponds") {
|
|
13188
|
+
(ds.correspondences ??= []).push(
|
|
13189
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
13190
|
+
);
|
|
13191
|
+
} else {
|
|
13192
|
+
return false;
|
|
13193
|
+
}
|
|
13194
|
+
return true;
|
|
13195
|
+
},
|
|
13196
|
+
{ construct: "dataspace", id }
|
|
13197
|
+
);
|
|
13198
|
+
return (ctx) => {
|
|
13199
|
+
ctx.dataspaces[id] = ds;
|
|
13200
|
+
return ctx;
|
|
13201
|
+
};
|
|
13202
|
+
};
|
|
13203
|
+
var dumpDataspace = function(d) {
|
|
13204
|
+
let out = "dataspace " + d.id + " {\n";
|
|
13205
|
+
if (d.name) {
|
|
13206
|
+
out += ' name "' + escapeString(d.name) + '"\n';
|
|
13207
|
+
}
|
|
13208
|
+
if (d.description) {
|
|
13209
|
+
out += ' description "' + escapeString(d.description) + '"\n';
|
|
13210
|
+
}
|
|
13211
|
+
for (const pc of d.participantClasses) {
|
|
13212
|
+
out += " participant_class " + dumpBareSafe(pc.id) + " {\n";
|
|
13213
|
+
if (pc.label) {
|
|
13214
|
+
out += ' label "' + escapeString(pc.label) + '"\n';
|
|
13215
|
+
}
|
|
13216
|
+
if (pc.description) {
|
|
13217
|
+
out += ' description "' + escapeString(pc.description) + '"\n';
|
|
13218
|
+
}
|
|
13219
|
+
out += " }\n";
|
|
13220
|
+
}
|
|
13221
|
+
for (const ac of d.artifactClasses) {
|
|
13222
|
+
out += " artifact_class " + dumpBareSafe(ac.id) + " {\n";
|
|
13223
|
+
if (ac.label) {
|
|
13224
|
+
out += ' label "' + escapeString(ac.label) + '"\n';
|
|
13225
|
+
}
|
|
13226
|
+
if (ac.description) {
|
|
13227
|
+
out += ' description "' + escapeString(ac.description) + '"\n';
|
|
13228
|
+
}
|
|
13229
|
+
if (ac.element) {
|
|
13230
|
+
out += " element " + dumpBareSafe(ac.element) + "\n";
|
|
13231
|
+
}
|
|
13232
|
+
if (ac.policy) {
|
|
13233
|
+
out += " policy " + dumpBareSafe(ac.policy) + "\n";
|
|
13234
|
+
}
|
|
13235
|
+
out += " }\n";
|
|
13236
|
+
}
|
|
13237
|
+
if (d.policies.length > 0) {
|
|
13238
|
+
out += " policies { " + d.policies.map(dumpBareSafe).join(" ") + " }\n";
|
|
13239
|
+
}
|
|
13240
|
+
if (d.defaultPolicy) {
|
|
13241
|
+
out += " default_policy " + dumpBareSafe(d.defaultPolicy) + "\n";
|
|
13242
|
+
}
|
|
13243
|
+
for (const ta of d.trustAnchors) {
|
|
13244
|
+
out += " trust_anchor " + dumpBareSafe(ta.id) + " {\n";
|
|
13245
|
+
if (ta.trustRef) {
|
|
13246
|
+
out += dumpTrustRef(ta.trustRef, " ", dumpBareSafe);
|
|
13247
|
+
}
|
|
13248
|
+
if (ta.role) {
|
|
13249
|
+
out += " role " + dumpBareSafe(ta.role) + "\n";
|
|
13250
|
+
}
|
|
13251
|
+
if (ta.description) {
|
|
13252
|
+
out += ' description "' + escapeString(ta.description) + '"\n';
|
|
13253
|
+
}
|
|
13254
|
+
out += " }\n";
|
|
13255
|
+
}
|
|
13256
|
+
if (d.compatibleWith.length > 0) {
|
|
13257
|
+
out += " compatible_with { " + d.compatibleWith.map(dumpBareSafe).join(" ") + " }\n";
|
|
13258
|
+
}
|
|
13259
|
+
const sources = d.sourceRefs && d.sourceRefs.length > 0 ? d.sourceRefs : d.source ? [d.source] : [];
|
|
13260
|
+
for (const s of sources) {
|
|
13261
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
13262
|
+
}
|
|
13263
|
+
out += dumpRefs(d.refs, " ", escapeString);
|
|
13264
|
+
out += dumpCorrespondences(
|
|
13265
|
+
d.correspondences,
|
|
13266
|
+
" ",
|
|
13267
|
+
escapeString,
|
|
13268
|
+
dumpBareSafe
|
|
13269
|
+
);
|
|
13270
|
+
out += "}\n";
|
|
13271
|
+
return out;
|
|
13272
|
+
};
|
|
13273
|
+
var dataspaceConstruct = {
|
|
13274
|
+
keyword: "dataspace",
|
|
13275
|
+
field: "dataspaces",
|
|
13276
|
+
takesID: true,
|
|
13277
|
+
parse: parseDataspace,
|
|
13278
|
+
dump: dumpDataspace
|
|
13279
|
+
};
|
|
13280
|
+
|
|
13281
|
+
// src/types/Policy.ts
|
|
13282
|
+
var POLICY_RULE_KINDS = [
|
|
13283
|
+
"permission",
|
|
13284
|
+
"obligation",
|
|
13285
|
+
"prohibition"
|
|
13286
|
+
];
|
|
13287
|
+
|
|
13288
|
+
// src/ser-des/config/policy.ts
|
|
13289
|
+
var parsePolicy = function(id, data) {
|
|
13290
|
+
const policy = {
|
|
13291
|
+
id,
|
|
13292
|
+
name: "",
|
|
13293
|
+
description: "",
|
|
13294
|
+
governs: [],
|
|
13295
|
+
defaultPosture: null,
|
|
13296
|
+
rules: [],
|
|
13297
|
+
source: null,
|
|
13298
|
+
sourceRefs: []
|
|
13299
|
+
};
|
|
13300
|
+
forEachEntry(
|
|
13301
|
+
data,
|
|
13302
|
+
(command, value, peek) => {
|
|
13303
|
+
if (command === "name") {
|
|
13304
|
+
policy.name = unwrapped(value);
|
|
13305
|
+
} else if (command === "description") {
|
|
13306
|
+
policy.description = unwrapped(value);
|
|
13307
|
+
} else if (command === "governs") {
|
|
13308
|
+
policy.governs = readEntryTokens(value());
|
|
13309
|
+
} else if (command === "default_posture") {
|
|
13310
|
+
const v = stripWrapping(value());
|
|
13311
|
+
if (v !== "true" && v !== "false") {
|
|
13312
|
+
throw new Error(
|
|
13313
|
+
`Parsing error: policy. ID ${id}: default_posture is true | false, got "${v}"`
|
|
13314
|
+
);
|
|
13315
|
+
}
|
|
13316
|
+
policy.defaultPosture = v === "true";
|
|
13317
|
+
} else if (command === "rule") {
|
|
13318
|
+
const rule = {
|
|
13319
|
+
id: stripWrapping(value()),
|
|
13320
|
+
kind: "",
|
|
13321
|
+
action: "",
|
|
13322
|
+
artifact: "",
|
|
13323
|
+
constraints: []
|
|
13324
|
+
};
|
|
13325
|
+
const next = peek();
|
|
13326
|
+
if (next && next.startsWith("{")) {
|
|
13327
|
+
forEachEntry(
|
|
13328
|
+
unwrapBlock(value()),
|
|
13329
|
+
(facet, facetValue) => {
|
|
13330
|
+
if (facet === "kind") {
|
|
13331
|
+
const k = stripWrapping(facetValue());
|
|
13332
|
+
if (!POLICY_RULE_KINDS.includes(k)) {
|
|
13333
|
+
throw new Error(
|
|
13334
|
+
`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)`
|
|
13335
|
+
);
|
|
13336
|
+
}
|
|
13337
|
+
rule.kind = k;
|
|
13338
|
+
} else if (facet === "action") {
|
|
13339
|
+
rule.action = stripWrapping(facetValue());
|
|
13340
|
+
} else if (facet === "artifact") {
|
|
13341
|
+
rule.artifact = stripWrapping(facetValue());
|
|
13342
|
+
} else if (facet === "constraint") {
|
|
13343
|
+
rule.constraints.push(unwrapped(facetValue));
|
|
13344
|
+
} else {
|
|
13345
|
+
return false;
|
|
13346
|
+
}
|
|
13347
|
+
return true;
|
|
13348
|
+
},
|
|
13349
|
+
{ construct: "policy.rule", id: rule.id }
|
|
13350
|
+
);
|
|
13351
|
+
}
|
|
13352
|
+
policy.rules.push(rule);
|
|
13353
|
+
} else if (command === "source") {
|
|
13354
|
+
const src = readSource(unwrapBlock(value()));
|
|
13355
|
+
policy.sourceRefs.push(src);
|
|
13356
|
+
if (!policy.source) {
|
|
13357
|
+
policy.source = src;
|
|
13358
|
+
}
|
|
13359
|
+
} else if (command === "ref") {
|
|
13360
|
+
const r = parseRefFromReaders(value, peek, stripWrapping, unwrapBlock);
|
|
13361
|
+
if (!foldRefIntoLegacy(policy, r)) {
|
|
13362
|
+
(policy.refs ??= []).push(r);
|
|
13363
|
+
}
|
|
13364
|
+
} else if (command === "corresponds") {
|
|
13365
|
+
(policy.correspondences ??= []).push(
|
|
13366
|
+
parseCorrespondsFromReaders(value, peek, stripWrapping)
|
|
13367
|
+
);
|
|
13368
|
+
} else {
|
|
13369
|
+
return false;
|
|
13370
|
+
}
|
|
13371
|
+
return true;
|
|
13372
|
+
},
|
|
13373
|
+
{ construct: "policy", id }
|
|
13374
|
+
);
|
|
13375
|
+
return (ctx) => {
|
|
13376
|
+
ctx.policies[id] = policy;
|
|
13377
|
+
return ctx;
|
|
13378
|
+
};
|
|
13379
|
+
};
|
|
13380
|
+
var dumpPolicy = function(p) {
|
|
13381
|
+
let out = "policy " + p.id + " {\n";
|
|
13382
|
+
if (p.name) {
|
|
13383
|
+
out += ' name "' + escapeString(p.name) + '"\n';
|
|
13384
|
+
}
|
|
13385
|
+
if (p.description) {
|
|
13386
|
+
out += ' description "' + escapeString(p.description) + '"\n';
|
|
13387
|
+
}
|
|
13388
|
+
if (p.defaultPosture !== null) {
|
|
13389
|
+
out += " default_posture " + (p.defaultPosture ? "true" : "false") + "\n";
|
|
13390
|
+
}
|
|
13391
|
+
if (p.governs.length > 0) {
|
|
13392
|
+
out += " governs { " + p.governs.map(dumpBareSafe).join(" ") + " }\n";
|
|
13393
|
+
}
|
|
13394
|
+
for (const r of p.rules) {
|
|
13395
|
+
out += " rule " + dumpBareSafe(r.id) + " {\n";
|
|
13396
|
+
if (r.kind) {
|
|
13397
|
+
out += " kind " + r.kind + "\n";
|
|
13398
|
+
}
|
|
13399
|
+
if (r.action) {
|
|
13400
|
+
out += " action " + dumpBareSafe(r.action) + "\n";
|
|
13401
|
+
}
|
|
13402
|
+
if (r.artifact) {
|
|
13403
|
+
out += " artifact " + dumpBareSafe(r.artifact) + "\n";
|
|
13404
|
+
}
|
|
13405
|
+
for (const c of r.constraints) {
|
|
13406
|
+
out += ' constraint "' + escapeString(c) + '"\n';
|
|
13407
|
+
}
|
|
13408
|
+
out += " }\n";
|
|
13409
|
+
}
|
|
13410
|
+
const sources = p.sourceRefs && p.sourceRefs.length > 0 ? p.sourceRefs : p.source ? [p.source] : [];
|
|
13411
|
+
for (const s of sources) {
|
|
13412
|
+
out += dumpSourceRefAsRef(s, " ", escapeString);
|
|
13413
|
+
}
|
|
13414
|
+
out += dumpRefs(p.refs, " ", escapeString);
|
|
13415
|
+
out += dumpCorrespondences(
|
|
13416
|
+
p.correspondences,
|
|
13417
|
+
" ",
|
|
13418
|
+
escapeString,
|
|
13419
|
+
dumpBareSafe
|
|
13420
|
+
);
|
|
13421
|
+
out += "}\n";
|
|
13422
|
+
return out;
|
|
13423
|
+
};
|
|
13424
|
+
var policyConstruct = {
|
|
13425
|
+
keyword: "policy",
|
|
13426
|
+
field: "policies",
|
|
13427
|
+
takesID: true,
|
|
13428
|
+
parse: parsePolicy,
|
|
13429
|
+
dump: dumpPolicy
|
|
13430
|
+
};
|
|
13431
|
+
|
|
12708
13432
|
// src/ser-des/config/activityArchetype.ts
|
|
12709
13433
|
var parseActivityArchetype = (id, data) => {
|
|
12710
13434
|
const archetype = {
|
|
@@ -13114,7 +13838,15 @@ var CONSTRUCTS = [
|
|
|
13114
13838
|
takesID: true,
|
|
13115
13839
|
parse: parseText,
|
|
13116
13840
|
dump: dumpText
|
|
13117
|
-
})
|
|
13841
|
+
}),
|
|
13842
|
+
// Primmel v3.1 dataspace + trust (TODO.primmel/10; MN 114 clause 19):
|
|
13843
|
+
// the dataspace definition as a model object, and the usage-policy set
|
|
13844
|
+
// in Primmel's own policy grammar (ODRL is a codec output, never an
|
|
13845
|
+
// import). The trust_ref form and the corresponds facet are shared
|
|
13846
|
+
// sub-structures (config/trustRef.ts, config/correspondence.ts), not
|
|
13847
|
+
// top-level constructs.
|
|
13848
|
+
dataspaceConstruct,
|
|
13849
|
+
policyConstruct
|
|
13118
13850
|
];
|
|
13119
13851
|
function buildParserConfig(constructs) {
|
|
13120
13852
|
const out = {};
|
|
@@ -15964,6 +16696,80 @@ var CHECK_RULES = [
|
|
|
15964
16696
|
"error",
|
|
15965
16697
|
"normal",
|
|
15966
16698
|
"docs/primmel/18 \xA718.6 (the unified reference/relation construct)"
|
|
16699
|
+
),
|
|
16700
|
+
// ── the dataspace family (TODO.primmel/10; MN 114 v3.1 clause 19) ──
|
|
16701
|
+
// The v3.1 extension set: the dataspace definition, the policy
|
|
16702
|
+
// construct (Primmel's own policy grammar; ODRL is a codec output),
|
|
16703
|
+
// the trust_ref form (opaque addressing — the checker verifies shape,
|
|
16704
|
+
// NEVER resolution: the trust plane's membership is runtime fact), and
|
|
16705
|
+
// the generalized corresponds annotations. C104: the dataspace's
|
|
16706
|
+
// references resolve (policy register, default policy, per-class
|
|
16707
|
+
// overrides, content elements, the compatibility register). C105:
|
|
16708
|
+
// every trust anchor carries its trust_ref with an organization
|
|
16709
|
+
// identifier. C106: a dataspace with no governance citation warns (an
|
|
16710
|
+
// orphan definition). C107: the policy shape — at least one rule,
|
|
16711
|
+
// every rule with its action, rule artifacts inside the governs
|
|
16712
|
+
// register, governed classes resolving, at most one default-posture
|
|
16713
|
+
// policy per class. C108: one corresponds entry per scheme per
|
|
16714
|
+
// element (an error — the bridges read unambiguous mappings), and the
|
|
16715
|
+
// irdi legacy spelling agreeing with `corresponds iec-cdd` (a warning
|
|
16716
|
+
// leg).
|
|
16717
|
+
R(
|
|
16718
|
+
"C104",
|
|
16719
|
+
"dataspace-references-resolve",
|
|
16720
|
+
"dataspace",
|
|
16721
|
+
"error",
|
|
16722
|
+
"normal",
|
|
16723
|
+
"TODO.primmel/10, MN 114 clause 19.1"
|
|
16724
|
+
),
|
|
16725
|
+
R(
|
|
16726
|
+
"C105",
|
|
16727
|
+
"dataspace-trust-anchor-shape",
|
|
16728
|
+
"dataspace",
|
|
16729
|
+
"error",
|
|
16730
|
+
"normal",
|
|
16731
|
+
"TODO.primmel/10, MN 114 clauses 19.1/19.3"
|
|
16732
|
+
),
|
|
16733
|
+
R(
|
|
16734
|
+
"C106",
|
|
16735
|
+
"dataspace-governance-provenance",
|
|
16736
|
+
"dataspace",
|
|
16737
|
+
"warning",
|
|
16738
|
+
"normal",
|
|
16739
|
+
"TODO.primmel/10, MN 114 clause 19.1"
|
|
16740
|
+
),
|
|
16741
|
+
R(
|
|
16742
|
+
"C107",
|
|
16743
|
+
"policy-shape",
|
|
16744
|
+
"dataspace",
|
|
16745
|
+
"error",
|
|
16746
|
+
"normal",
|
|
16747
|
+
"TODO.primmel/10, MN 114 clause 19.2"
|
|
16748
|
+
),
|
|
16749
|
+
R(
|
|
16750
|
+
"C108",
|
|
16751
|
+
"correspondence-shape",
|
|
16752
|
+
"dataspace",
|
|
16753
|
+
"error",
|
|
16754
|
+
"normal",
|
|
16755
|
+
"TODO.primmel/10, MN 114 clause 19.4"
|
|
16756
|
+
),
|
|
16757
|
+
// ── C109: state-machine-initial-present (the editor wave-03 finding,
|
|
16758
|
+
// primmel/editor#19) ──
|
|
16759
|
+
// The spec's state machine syntax marks `initial` required (the
|
|
16760
|
+
// starting state for new entities). The parser stays total (a machine
|
|
16761
|
+
// without the line loads with initialState '') and the serializer
|
|
16762
|
+
// stays honest (it omits the line — never the dangling keyword that
|
|
16763
|
+
// reparsed as `initial states`), so the refusal lives HERE, at the
|
|
16764
|
+
// language's own validation layer — the C95 contract-ownership
|
|
16765
|
+
// doctrine.
|
|
16766
|
+
R(
|
|
16767
|
+
"C109",
|
|
16768
|
+
"state-machine-initial-present",
|
|
16769
|
+
"state",
|
|
16770
|
+
"error",
|
|
16771
|
+
"normal",
|
|
16772
|
+
"spec sources/state-machines \xA72 (initial: Required), primmel/editor#19 (wave-03 findings)"
|
|
15967
16773
|
)
|
|
15968
16774
|
];
|
|
15969
16775
|
var byId = new Map(CHECK_RULES.map((r) => [r.id, r]));
|
|
@@ -19603,6 +20409,14 @@ function checkPackage(dir, options = {}) {
|
|
|
19603
20409
|
const machineById = new Map(
|
|
19604
20410
|
(standard.stateMachines ?? []).map((sm) => [sm.entityName, sm])
|
|
19605
20411
|
);
|
|
20412
|
+
for (const sm of standard.stateMachines ?? []) {
|
|
20413
|
+
if (!sm.initialState) {
|
|
20414
|
+
err(
|
|
20415
|
+
"C109",
|
|
20416
|
+
`state_machine ${sm.entityName}: declares no initial state \u2014 initial is required (state-machine-initial-present)`
|
|
20417
|
+
);
|
|
20418
|
+
}
|
|
20419
|
+
}
|
|
19606
20420
|
const operationalIds = new Set(
|
|
19607
20421
|
(standard.stateMachines ?? []).filter((sm) => sm.kind === "operational").map((sm) => sm.entityName)
|
|
19608
20422
|
);
|
|
@@ -20023,6 +20837,230 @@ function checkPackage(dir, options = {}) {
|
|
|
20023
20837
|
}
|
|
20024
20838
|
}
|
|
20025
20839
|
}
|
|
20840
|
+
{
|
|
20841
|
+
const dataspaces = standard.dataspaces ?? [];
|
|
20842
|
+
const policies = standard.policies ?? [];
|
|
20843
|
+
const policyIds = new Set(policies.map((p) => p.id));
|
|
20844
|
+
const dataspaceIds = new Set(dataspaces.map((d) => d.id));
|
|
20845
|
+
const artifactClassIds = /* @__PURE__ */ new Set();
|
|
20846
|
+
for (const d of dataspaces) {
|
|
20847
|
+
for (const ac of d.artifactClasses) {
|
|
20848
|
+
artifactClassIds.add(ac.id);
|
|
20849
|
+
}
|
|
20850
|
+
}
|
|
20851
|
+
const elementIds = /* @__PURE__ */ new Set([
|
|
20852
|
+
...(standard.artifactDefinitions ?? []).map((a) => a.id),
|
|
20853
|
+
...(standard.forms ?? []).map((f) => f.id),
|
|
20854
|
+
...(standard.dataclasses ?? []).map((c) => c.id)
|
|
20855
|
+
]);
|
|
20856
|
+
for (const d of dataspaces) {
|
|
20857
|
+
for (const pid of d.policies) {
|
|
20858
|
+
if (!policyIds.has(pid)) {
|
|
20859
|
+
err(
|
|
20860
|
+
"C104",
|
|
20861
|
+
`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)`
|
|
20862
|
+
);
|
|
20863
|
+
}
|
|
20864
|
+
}
|
|
20865
|
+
if (d.defaultPolicy !== "") {
|
|
20866
|
+
if (!policyIds.has(d.defaultPolicy)) {
|
|
20867
|
+
err(
|
|
20868
|
+
"C104",
|
|
20869
|
+
`dataspace ${d.id}: default_policy "${d.defaultPolicy}" declares no policy of that id \u2014 the standing default is a declared policy (dataspace-references-resolve)`
|
|
20870
|
+
);
|
|
20871
|
+
} else if (!d.policies.includes(d.defaultPolicy)) {
|
|
20872
|
+
err(
|
|
20873
|
+
"C104",
|
|
20874
|
+
`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)`
|
|
20875
|
+
);
|
|
20876
|
+
}
|
|
20877
|
+
}
|
|
20878
|
+
for (const ac of d.artifactClasses) {
|
|
20879
|
+
if (ac.policy !== "") {
|
|
20880
|
+
if (!policyIds.has(ac.policy)) {
|
|
20881
|
+
err(
|
|
20882
|
+
"C104",
|
|
20883
|
+
`dataspace ${d.id}: artifact class "${ac.id}" overrides with policy "${ac.policy}", which declares no policy of that id (dataspace-references-resolve)`
|
|
20884
|
+
);
|
|
20885
|
+
} else if (!d.policies.includes(ac.policy)) {
|
|
20886
|
+
err(
|
|
20887
|
+
"C104",
|
|
20888
|
+
`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)`
|
|
20889
|
+
);
|
|
20890
|
+
}
|
|
20891
|
+
}
|
|
20892
|
+
if (ac.element !== "" && !elementIds.has(ac.element)) {
|
|
20893
|
+
err(
|
|
20894
|
+
"C104",
|
|
20895
|
+
`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)`
|
|
20896
|
+
);
|
|
20897
|
+
}
|
|
20898
|
+
}
|
|
20899
|
+
for (const compat of d.compatibleWith) {
|
|
20900
|
+
if (!dataspaceIds.has(compat)) {
|
|
20901
|
+
err(
|
|
20902
|
+
"C104",
|
|
20903
|
+
`dataspace ${d.id}: compatible_with entry "${compat}" declares no dataspace of that id \u2014 compatibility is explicit and resolved (dataspace-references-resolve)`
|
|
20904
|
+
);
|
|
20905
|
+
} else if (compat === d.id) {
|
|
20906
|
+
err(
|
|
20907
|
+
"C104",
|
|
20908
|
+
`dataspace ${d.id}: compatible_with names the dataspace itself \u2014 compatibility relates two dataspaces (dataspace-references-resolve)`
|
|
20909
|
+
);
|
|
20910
|
+
}
|
|
20911
|
+
}
|
|
20912
|
+
for (const ta of d.trustAnchors) {
|
|
20913
|
+
if (!ta.trustRef || ta.trustRef.org === "") {
|
|
20914
|
+
err(
|
|
20915
|
+
"C105",
|
|
20916
|
+
`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)`
|
|
20917
|
+
);
|
|
20918
|
+
}
|
|
20919
|
+
}
|
|
20920
|
+
const hasGovernance = (d.sourceRefs?.length ?? 0) > 0 || d.source && (d.source.doc || d.source.clause);
|
|
20921
|
+
if (!hasGovernance) {
|
|
20922
|
+
warn(
|
|
20923
|
+
"C106",
|
|
20924
|
+
`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)`
|
|
20925
|
+
);
|
|
20926
|
+
}
|
|
20927
|
+
}
|
|
20928
|
+
for (const p of policies) {
|
|
20929
|
+
if (p.rules.length === 0) {
|
|
20930
|
+
err(
|
|
20931
|
+
"C107",
|
|
20932
|
+
`policy ${p.id}: a policy declares at least one rule \u2014 a rule-less set says nothing (policy-shape)`
|
|
20933
|
+
);
|
|
20934
|
+
}
|
|
20935
|
+
for (const g of p.governs) {
|
|
20936
|
+
if (!artifactClassIds.has(g)) {
|
|
20937
|
+
err(
|
|
20938
|
+
"C107",
|
|
20939
|
+
`policy ${p.id}: governs entry "${g}" names no artifact class declared by the merged model's dataspaces \u2014 the governed classes resolve (policy-shape)`
|
|
20940
|
+
);
|
|
20941
|
+
}
|
|
20942
|
+
}
|
|
20943
|
+
for (const r of p.rules) {
|
|
20944
|
+
if (r.action === "") {
|
|
20945
|
+
err(
|
|
20946
|
+
"C107",
|
|
20947
|
+
`policy ${p.id}: rule "${r.id}" declares no action \u2014 a rule without its action says nothing (policy-shape)`
|
|
20948
|
+
);
|
|
20949
|
+
}
|
|
20950
|
+
if (r.artifact !== "") {
|
|
20951
|
+
if (p.governs.length > 0 && !p.governs.includes(r.artifact)) {
|
|
20952
|
+
err(
|
|
20953
|
+
"C107",
|
|
20954
|
+
`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)`
|
|
20955
|
+
);
|
|
20956
|
+
}
|
|
20957
|
+
if (!artifactClassIds.has(r.artifact)) {
|
|
20958
|
+
err(
|
|
20959
|
+
"C107",
|
|
20960
|
+
`policy ${p.id}: rule "${r.id}" constrains artifact class "${r.artifact}", which no dataspace of the merged model declares (policy-shape)`
|
|
20961
|
+
);
|
|
20962
|
+
}
|
|
20963
|
+
}
|
|
20964
|
+
}
|
|
20965
|
+
}
|
|
20966
|
+
const postureByClass = /* @__PURE__ */ new Map();
|
|
20967
|
+
for (const p of policies) {
|
|
20968
|
+
if (p.defaultPosture !== true) {
|
|
20969
|
+
continue;
|
|
20970
|
+
}
|
|
20971
|
+
for (const g of p.governs) {
|
|
20972
|
+
postureByClass.set(g, [...postureByClass.get(g) ?? [], p.id]);
|
|
20973
|
+
}
|
|
20974
|
+
}
|
|
20975
|
+
for (const [cls, ids] of postureByClass) {
|
|
20976
|
+
if (ids.length > 1) {
|
|
20977
|
+
err(
|
|
20978
|
+
"C107",
|
|
20979
|
+
`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)`
|
|
20980
|
+
);
|
|
20981
|
+
}
|
|
20982
|
+
}
|
|
20983
|
+
const corrElements = [];
|
|
20984
|
+
const collect = (kind, items) => {
|
|
20985
|
+
for (const it of items ?? []) {
|
|
20986
|
+
if (it.correspondences && it.correspondences.length > 0) {
|
|
20987
|
+
corrElements.push({ kind, id: it.id, corrs: it.correspondences });
|
|
20988
|
+
}
|
|
20989
|
+
}
|
|
20990
|
+
};
|
|
20991
|
+
collect("dataspace", dataspaces);
|
|
20992
|
+
collect("policy", policies);
|
|
20993
|
+
collect("instrument", standard.instruments ?? []);
|
|
20994
|
+
collect("attribute_definition", standard.attributeDefinitions ?? []);
|
|
20995
|
+
collect("capability", standard.capabilities ?? []);
|
|
20996
|
+
collect("behavior", standard.behaviors ?? []);
|
|
20997
|
+
collect("condition_set", standard.conditionSets ?? []);
|
|
20998
|
+
collect("requirement", standard.requirements ?? []);
|
|
20999
|
+
collect("conformance_test", standard.conformanceTests ?? []);
|
|
21000
|
+
collect("form", standard.forms ?? []);
|
|
21001
|
+
collect("table", standard.tables ?? []);
|
|
21002
|
+
collect("symbol", standard.symbols ?? []);
|
|
21003
|
+
collect("calculation", standard.calculations ?? []);
|
|
21004
|
+
collect("term", standard.terms ?? []);
|
|
21005
|
+
collect("artifact_definition", standard.artifactDefinitions ?? []);
|
|
21006
|
+
collect("verdict", standard.verdicts ?? []);
|
|
21007
|
+
collect("reference_material", standard.referenceMaterials ?? []);
|
|
21008
|
+
collect("test_point_set", standard.testPointSets ?? []);
|
|
21009
|
+
collect("competence_kind", standard.competenceKinds ?? []);
|
|
21010
|
+
collect("constraint", standard.constraints ?? []);
|
|
21011
|
+
collect("test_sequence", standard.testSequences ?? []);
|
|
21012
|
+
collect("formulas_used", standard.formulasUsed ?? []);
|
|
21013
|
+
collect("process", standard.processes ?? []);
|
|
21014
|
+
for (const f of standard.forms ?? []) {
|
|
21015
|
+
for (const fld of f.fields ?? []) {
|
|
21016
|
+
if (fld.correspondences && fld.correspondences.length > 0) {
|
|
21017
|
+
corrElements.push({
|
|
21018
|
+
kind: "field",
|
|
21019
|
+
id: `${f.id}.${fld.name}`,
|
|
21020
|
+
corrs: fld.correspondences
|
|
21021
|
+
});
|
|
21022
|
+
}
|
|
21023
|
+
}
|
|
21024
|
+
}
|
|
21025
|
+
if (standard.packageManifest?.correspondences?.length) {
|
|
21026
|
+
corrElements.push({
|
|
21027
|
+
kind: "package",
|
|
21028
|
+
id: standard.packageManifest.id,
|
|
21029
|
+
corrs: standard.packageManifest.correspondences
|
|
21030
|
+
});
|
|
21031
|
+
}
|
|
21032
|
+
for (const el of corrElements) {
|
|
21033
|
+
const byScheme = /* @__PURE__ */ new Map();
|
|
21034
|
+
for (const c of el.corrs) {
|
|
21035
|
+
byScheme.set(c.scheme, (byScheme.get(c.scheme) ?? 0) + 1);
|
|
21036
|
+
if (c.scheme === "" || c.concept === "") {
|
|
21037
|
+
err(
|
|
21038
|
+
"C108",
|
|
21039
|
+
`${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)`
|
|
21040
|
+
);
|
|
21041
|
+
}
|
|
21042
|
+
}
|
|
21043
|
+
for (const [scheme, n] of byScheme) {
|
|
21044
|
+
if (n > 1) {
|
|
21045
|
+
err(
|
|
21046
|
+
"C108",
|
|
21047
|
+
`${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)`
|
|
21048
|
+
);
|
|
21049
|
+
}
|
|
21050
|
+
}
|
|
21051
|
+
}
|
|
21052
|
+
for (const a of standard.attributeDefinitions ?? []) {
|
|
21053
|
+
if (a.irdi && a.irdi !== "") {
|
|
21054
|
+
const cdd = (a.correspondences ?? []).find((c) => c.scheme === "iec-cdd");
|
|
21055
|
+
if (cdd && cdd.concept !== a.irdi) {
|
|
21056
|
+
warn(
|
|
21057
|
+
"C108",
|
|
21058
|
+
`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)`
|
|
21059
|
+
);
|
|
21060
|
+
}
|
|
21061
|
+
}
|
|
21062
|
+
}
|
|
21063
|
+
}
|
|
20026
21064
|
const level = strictness === "audit" ? "audit" : "normal";
|
|
20027
21065
|
const { allowlist, issues: allowlistParseIssues } = loadAllowlist(dir);
|
|
20028
21066
|
issues.push(...allowlistParseIssues);
|