@primmel/primmel 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/src/check-rules.d.ts.map +1 -1
  2. package/dist/src/check-rules.js +73 -0
  3. package/dist/src/check-rules.js.map +1 -1
  4. package/dist/src/check.d.ts.map +1 -1
  5. package/dist/src/check.js +693 -0
  6. package/dist/src/check.js.map +1 -1
  7. package/dist/src/model-diff.d.ts.map +1 -1
  8. package/dist/src/model-diff.js +35 -0
  9. package/dist/src/model-diff.js.map +1 -1
  10. package/dist/src/ser-des/config/applicationDeclaration.d.ts +5 -0
  11. package/dist/src/ser-des/config/applicationDeclaration.d.ts.map +1 -0
  12. package/dist/src/ser-des/config/applicationDeclaration.js +102 -0
  13. package/dist/src/ser-des/config/applicationDeclaration.js.map +1 -0
  14. package/dist/src/ser-des/config/aspect.d.ts +5 -0
  15. package/dist/src/ser-des/config/aspect.d.ts.map +1 -0
  16. package/dist/src/ser-des/config/aspect.js +128 -0
  17. package/dist/src/ser-des/config/aspect.js.map +1 -0
  18. package/dist/src/ser-des/config/calculationContext.d.ts +5 -0
  19. package/dist/src/ser-des/config/calculationContext.d.ts.map +1 -0
  20. package/dist/src/ser-des/config/calculationContext.js +62 -0
  21. package/dist/src/ser-des/config/calculationContext.js.map +1 -0
  22. package/dist/src/ser-des/config/certificateTemplate.d.ts +5 -0
  23. package/dist/src/ser-des/config/certificateTemplate.d.ts.map +1 -0
  24. package/dist/src/ser-des/config/certificateTemplate.js +195 -0
  25. package/dist/src/ser-des/config/certificateTemplate.js.map +1 -0
  26. package/dist/src/ser-des/config/evaluationDimension.d.ts +5 -0
  27. package/dist/src/ser-des/config/evaluationDimension.d.ts.map +1 -0
  28. package/dist/src/ser-des/config/evaluationDimension.js +128 -0
  29. package/dist/src/ser-des/config/evaluationDimension.js.map +1 -0
  30. package/dist/src/ser-des/config/evaluationProfile.d.ts +5 -0
  31. package/dist/src/ser-des/config/evaluationProfile.d.ts.map +1 -0
  32. package/dist/src/ser-des/config/evaluationProfile.js +61 -0
  33. package/dist/src/ser-des/config/evaluationProfile.js.map +1 -0
  34. package/dist/src/ser-des/config/identitySlot.d.ts +5 -0
  35. package/dist/src/ser-des/config/identitySlot.d.ts.map +1 -0
  36. package/dist/src/ser-des/config/identitySlot.js +120 -0
  37. package/dist/src/ser-des/config/identitySlot.js.map +1 -0
  38. package/dist/src/ser-des/config/index.d.ts.map +1 -1
  39. package/dist/src/ser-des/config/index.js +148 -0
  40. package/dist/src/ser-des/config/index.js.map +1 -1
  41. package/dist/src/ser-des/config/promiseSet.d.ts +5 -0
  42. package/dist/src/ser-des/config/promiseSet.d.ts.map +1 -0
  43. package/dist/src/ser-des/config/promiseSet.js +46 -0
  44. package/dist/src/ser-des/config/promiseSet.js.map +1 -0
  45. package/dist/src/ser-des/config/selectionRules.d.ts +9 -0
  46. package/dist/src/ser-des/config/selectionRules.d.ts.map +1 -0
  47. package/dist/src/ser-des/config/selectionRules.js +372 -0
  48. package/dist/src/ser-des/config/selectionRules.js.map +1 -0
  49. package/dist/src/ser-des/config/subject.d.ts +18 -1
  50. package/dist/src/ser-des/config/subject.d.ts.map +1 -1
  51. package/dist/src/ser-des/config/subject.js +177 -61
  52. package/dist/src/ser-des/config/subject.js.map +1 -1
  53. package/dist/src/ser-des/config/testReport.d.ts +7 -0
  54. package/dist/src/ser-des/config/testReport.d.ts.map +1 -0
  55. package/dist/src/ser-des/config/testReport.js +322 -0
  56. package/dist/src/ser-des/config/testReport.js.map +1 -0
  57. package/dist/src/ser-des/config/verificationPathway.d.ts +5 -0
  58. package/dist/src/ser-des/config/verificationPathway.d.ts.map +1 -0
  59. package/dist/src/ser-des/config/verificationPathway.js +361 -0
  60. package/dist/src/ser-des/config/verificationPathway.js.map +1 -0
  61. package/dist/src/ser-des/config/workflowConfig.d.ts +5 -0
  62. package/dist/src/ser-des/config/workflowConfig.d.ts.map +1 -0
  63. package/dist/src/ser-des/config/workflowConfig.js +129 -0
  64. package/dist/src/ser-des/config/workflowConfig.js.map +1 -0
  65. package/dist/src/ser-des/package.d.ts +10 -0
  66. package/dist/src/ser-des/package.d.ts.map +1 -1
  67. package/dist/src/ser-des/package.js +161 -12
  68. package/dist/src/ser-des/package.js.map +1 -1
  69. package/dist/src/ser-des/parse.d.ts.map +1 -1
  70. package/dist/src/ser-des/parse.js +24 -0
  71. package/dist/src/ser-des/parse.js.map +1 -1
  72. package/dist/src/ser-des/types.d.ts +27 -0
  73. package/dist/src/ser-des/types.d.ts.map +1 -1
  74. package/dist/src/types/ApplicationDeclaration.d.ts +23 -0
  75. package/dist/src/types/ApplicationDeclaration.d.ts.map +1 -0
  76. package/dist/src/types/ApplicationDeclaration.js +32 -0
  77. package/dist/src/types/ApplicationDeclaration.js.map +1 -0
  78. package/dist/src/types/Aspect.d.ts +30 -0
  79. package/dist/src/types/Aspect.d.ts.map +1 -0
  80. package/dist/src/types/Aspect.js +41 -0
  81. package/dist/src/types/Aspect.js.map +1 -0
  82. package/dist/src/types/CalculationContext.d.ts +17 -0
  83. package/dist/src/types/CalculationContext.d.ts.map +1 -0
  84. package/dist/src/types/CalculationContext.js +34 -0
  85. package/dist/src/types/CalculationContext.js.map +1 -0
  86. package/dist/src/types/CertificateTemplate.d.ts +46 -0
  87. package/dist/src/types/CertificateTemplate.d.ts.map +1 -0
  88. package/dist/src/types/CertificateTemplate.js +46 -0
  89. package/dist/src/types/CertificateTemplate.js.map +1 -0
  90. package/dist/src/types/EvaluationDimension.d.ts +32 -0
  91. package/dist/src/types/EvaluationDimension.d.ts.map +1 -0
  92. package/dist/src/types/EvaluationDimension.js +38 -0
  93. package/dist/src/types/EvaluationDimension.js.map +1 -0
  94. package/dist/src/types/EvaluationProfile.d.ts +10 -0
  95. package/dist/src/types/EvaluationProfile.d.ts.map +1 -0
  96. package/dist/src/types/EvaluationProfile.js +25 -0
  97. package/dist/src/types/EvaluationProfile.js.map +1 -0
  98. package/dist/src/types/IdentitySlot.d.ts +24 -0
  99. package/dist/src/types/IdentitySlot.d.ts.map +1 -0
  100. package/dist/src/types/IdentitySlot.js +34 -0
  101. package/dist/src/types/IdentitySlot.js.map +1 -0
  102. package/dist/src/types/PromiseSet.d.ts +8 -0
  103. package/dist/src/types/PromiseSet.d.ts.map +1 -0
  104. package/dist/src/types/PromiseSet.js +35 -0
  105. package/dist/src/types/PromiseSet.js.map +1 -0
  106. package/dist/src/types/SelectionRules.d.ts +73 -0
  107. package/dist/src/types/SelectionRules.d.ts.map +1 -0
  108. package/dist/src/types/SelectionRules.js +55 -0
  109. package/dist/src/types/SelectionRules.js.map +1 -0
  110. package/dist/src/types/Standard.d.ts +53 -0
  111. package/dist/src/types/Standard.d.ts.map +1 -1
  112. package/dist/src/types/Subject.d.ts +31 -1
  113. package/dist/src/types/Subject.d.ts.map +1 -1
  114. package/dist/src/types/TestReport.d.ts +71 -0
  115. package/dist/src/types/TestReport.d.ts.map +1 -0
  116. package/dist/src/types/TestReport.js +73 -0
  117. package/dist/src/types/TestReport.js.map +1 -0
  118. package/dist/src/types/VerificationPathway.d.ts +63 -0
  119. package/dist/src/types/VerificationPathway.d.ts.map +1 -0
  120. package/dist/src/types/VerificationPathway.js +56 -0
  121. package/dist/src/types/VerificationPathway.js.map +1 -0
  122. package/dist/src/types/WorkflowConfig.d.ts +34 -0
  123. package/dist/src/types/WorkflowConfig.d.ts.map +1 -0
  124. package/dist/src/types/WorkflowConfig.js +47 -0
  125. package/dist/src/types/WorkflowConfig.js.map +1 -0
  126. package/dist-browser/index.mjs +2135 -1017
  127. package/dist-cli/primmel.mjs +7462 -4450
  128. package/package.json +1 -1
@@ -103,7 +103,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
103
103
  exports.subjectConstruct = exports.conditionSetConstruct = exports.behaviorConstruct = exports.capabilityConstruct = exports.attributeDefinitionConstruct = exports.instrumentConstruct = void 0;
104
104
  exports.parseDimension = parseDimension;
105
105
  exports.dumpDimension = dumpDimension;
106
+ exports.readPromiseEntry = readPromiseEntry;
106
107
  exports.resolveSubject = resolveSubject;
108
+ exports.dumpPromiseEntry = dumpPromiseEntry;
107
109
  const tokenize_1 = require("../tokenize");
108
110
  const tokenize_2 = require("../tokenize");
109
111
  const parse_block_1 = require("../parse-block");
@@ -1826,7 +1828,7 @@ function readPromiseLevel(t, i) {
1826
1828
  /**
1827
1829
  * Read is.promises entries (TODO.roadmap/08). Two entry forms:
1828
1830
  * - rich: `<id> { target … level … conditions … statement …
1829
- * verified_by { … } source { … } }`
1831
+ * verified_by { … } source { … } certificate { … } }`
1830
1832
  * - shorthand: a quoted phrase or a bare token NOT followed by a block —
1831
1833
  * the legacy string-list form, parsed as a statement-only promise
1832
1834
  * (empty id/target/conditions; the linter's C43 flags it as
@@ -1850,55 +1852,121 @@ function readPromises(block) {
1850
1852
  statement: (0, tokenize_2.stripWrapping)(tok),
1851
1853
  verifiedBy: [],
1852
1854
  source: null,
1855
+ certificate: null,
1853
1856
  });
1854
1857
  continue;
1855
1858
  }
1856
- const p = {
1857
- id: (0, field_parser_1.stripColon)(tok),
1858
- target: '',
1859
- level: null,
1860
- conditions: '',
1861
- statement: '',
1862
- verifiedBy: [],
1863
- source: null,
1864
- };
1865
- const inner = (0, tokenize_1.default)((0, tokenize_2.unwrapBlock)(t[i++]));
1866
- let j = 0;
1867
- while (j < inner.length) {
1868
- const cmd = inner[j++];
1869
- if (j >= inner.length) {
1870
- break;
1871
- }
1872
- if (cmd === 'target') {
1873
- p.target = (0, tokenize_2.stripWrapping)(inner[j++]);
1874
- }
1875
- else if (cmd === 'level') {
1876
- const read = readPromiseLevel(inner, j);
1877
- p.level = read.level;
1878
- j = read.next;
1879
- }
1880
- else if (cmd === 'conditions') {
1881
- // ocl{…} expressions reassemble across whitespace (readValueToken).
1882
- const read = (0, field_parser_1.readValueToken)(inner, j);
1883
- p.conditions = (0, tokenize_2.stripWrapping)(read.text);
1884
- j = read.next;
1885
- }
1886
- else if (cmd === 'statement') {
1887
- p.statement = (0, tokenize_2.stripWrapping)(inner[j++]);
1888
- }
1889
- else if (cmd === 'verified_by') {
1890
- p.verifiedBy = readIdList(inner[j++]);
1891
- }
1892
- else if (cmd === 'source') {
1893
- p.source = (0, field_parser_1.readSource)((0, tokenize_2.unwrapBlock)(inner[j++]));
1894
- }
1895
- else {
1896
- (0, tokenize_2.unwrapBlock)(inner[j++]);
1859
+ out.push(readPromiseEntry((0, field_parser_1.stripColon)(tok), (0, tokenize_2.unwrapBlock)(t[i++])));
1860
+ }
1861
+ return out;
1862
+ }
1863
+ /** The certificate print-projection obligation vocabulary (mandatory |
1864
+ * optional) — parse-enforced, the fail-closed precedent. */
1865
+ const PROMISE_CERTIFICATE_OBLIGATIONS = ['mandatory', 'optional'];
1866
+ /** Read a promise's `certificate { … }` block (smart TODO.roadmap/40
1867
+ * batch 3): the content-binding XOR (attribute | attributes | dimension
1868
+ * | none — the statement row) is check-enforced (C131); the obligation
1869
+ * vocabulary is parse-enforced. */
1870
+ function readPromiseCertificate(promiseId, block) {
1871
+ const cert = {
1872
+ attribute: '',
1873
+ attributes: [],
1874
+ dimension: '',
1875
+ type: '',
1876
+ label: '',
1877
+ obligation: '',
1878
+ };
1879
+ const t = (0, tokenize_1.default)(block);
1880
+ let i = 0;
1881
+ while (i < t.length) {
1882
+ const cmd = t[i++];
1883
+ if (i > t.length) {
1884
+ break;
1885
+ }
1886
+ if (cmd === 'attribute') {
1887
+ cert.attribute = (0, tokenize_2.stripWrapping)(t[i++]);
1888
+ }
1889
+ else if (cmd === 'attributes') {
1890
+ cert.attributes = readIdList(t[i++]);
1891
+ }
1892
+ else if (cmd === 'dimension') {
1893
+ cert.dimension = (0, tokenize_2.stripWrapping)(t[i++]);
1894
+ }
1895
+ else if (cmd === 'type') {
1896
+ cert.type = (0, tokenize_2.stripWrapping)(t[i++]);
1897
+ }
1898
+ else if (cmd === 'label') {
1899
+ cert.label = (0, tokenize_2.stripWrapping)(t[i++]);
1900
+ }
1901
+ else if (cmd === 'obligation') {
1902
+ const o = (0, tokenize_2.stripWrapping)(t[i++]);
1903
+ if (!PROMISE_CERTIFICATE_OBLIGATIONS.includes(o)) {
1904
+ throw new Error(`Parsing error: promise. ID ${promiseId}: Unknown certificate obligation "${o}" (valid: ${PROMISE_CERTIFICATE_OBLIGATIONS.join(', ')})`);
1897
1905
  }
1906
+ cert.obligation = o;
1907
+ }
1908
+ else {
1909
+ (0, tokenize_2.unwrapBlock)(t[i++]);
1898
1910
  }
1899
- out.push(p);
1900
1911
  }
1901
- return out;
1912
+ return cert;
1913
+ }
1914
+ /**
1915
+ * Read ONE rich promise entry body (`target … level … conditions …
1916
+ * statement … verified_by { … } source { … } certificate { … }`).
1917
+ * Exported for the promise_set register (config/promiseSet.ts, smart
1918
+ * TODO.roadmap/40 batch 3), which reuses the promise sub-grammar
1919
+ * verbatim.
1920
+ */
1921
+ function readPromiseEntry(id, block) {
1922
+ const p = {
1923
+ id,
1924
+ target: '',
1925
+ level: null,
1926
+ conditions: '',
1927
+ statement: '',
1928
+ verifiedBy: [],
1929
+ source: null,
1930
+ certificate: null,
1931
+ };
1932
+ const inner = (0, tokenize_1.default)(block);
1933
+ let j = 0;
1934
+ while (j < inner.length) {
1935
+ const cmd = inner[j++];
1936
+ if (j >= inner.length) {
1937
+ break;
1938
+ }
1939
+ if (cmd === 'target') {
1940
+ p.target = (0, tokenize_2.stripWrapping)(inner[j++]);
1941
+ }
1942
+ else if (cmd === 'level') {
1943
+ const read = readPromiseLevel(inner, j);
1944
+ p.level = read.level;
1945
+ j = read.next;
1946
+ }
1947
+ else if (cmd === 'conditions') {
1948
+ // ocl{…} expressions reassemble across whitespace (readValueToken).
1949
+ const read = (0, field_parser_1.readValueToken)(inner, j);
1950
+ p.conditions = (0, tokenize_2.stripWrapping)(read.text);
1951
+ j = read.next;
1952
+ }
1953
+ else if (cmd === 'statement') {
1954
+ p.statement = (0, tokenize_2.stripWrapping)(inner[j++]);
1955
+ }
1956
+ else if (cmd === 'verified_by') {
1957
+ p.verifiedBy = readIdList(inner[j++]);
1958
+ }
1959
+ else if (cmd === 'source') {
1960
+ p.source = (0, field_parser_1.readSource)((0, tokenize_2.unwrapBlock)(inner[j++]));
1961
+ }
1962
+ else if (cmd === 'certificate') {
1963
+ p.certificate = readPromiseCertificate(p.id, (0, tokenize_2.unwrapBlock)(inner[j++]));
1964
+ }
1965
+ else {
1966
+ (0, tokenize_2.unwrapBlock)(inner[j++]);
1967
+ }
1968
+ }
1969
+ return p;
1902
1970
  }
1903
1971
  /** A promise carrying nothing but its prose statement (the shorthand form). */
1904
1972
  function isStatementOnlyPromise(p) {
@@ -1907,7 +1975,8 @@ function isStatementOnlyPromise(p) {
1907
1975
  !p.level &&
1908
1976
  !p.conditions &&
1909
1977
  p.verifiedBy.length === 0 &&
1910
- !p.source);
1978
+ !p.source &&
1979
+ !p.certificate);
1911
1980
  }
1912
1981
  function parseSubjectIs(block, result) {
1913
1982
  const t = (0, tokenize_1.default)(block);
@@ -2224,6 +2293,68 @@ function dumpPromiseLevel(level) {
2224
2293
  }
2225
2294
  return (0, quantity_1.dumpQuantityBlock)(level.quantity ?? { value: '' });
2226
2295
  }
2296
+ /** Dump a promise's certificate print projection (smart TODO.roadmap/40
2297
+ * batch 3) — facet order is the byte contract: attribute | attributes |
2298
+ * dimension, then type, label, obligation. */
2299
+ function dumpPromiseCertificate(cert, indent) {
2300
+ const facet = indent + ' ';
2301
+ let out = indent + 'certificate {\n';
2302
+ if (cert.attribute) {
2303
+ out += facet + 'attribute ' + (0, field_parser_1.dumpBareSafe)(cert.attribute) + '\n';
2304
+ }
2305
+ if (cert.attributes.length > 0) {
2306
+ out +=
2307
+ facet +
2308
+ 'attributes { ' +
2309
+ cert.attributes.map(field_parser_1.dumpBareSafe).join(' ') +
2310
+ ' }\n';
2311
+ }
2312
+ if (cert.dimension) {
2313
+ out += facet + 'dimension ' + (0, field_parser_1.dumpBareSafe)(cert.dimension) + '\n';
2314
+ }
2315
+ if (cert.type) {
2316
+ out += facet + 'type ' + (0, field_parser_1.dumpBareSafe)(cert.type) + '\n';
2317
+ }
2318
+ if (cert.label) {
2319
+ out += facet + 'label "' + (0, tokenize_2.escapeString)(cert.label) + '"\n';
2320
+ }
2321
+ if (cert.obligation) {
2322
+ out += facet + 'obligation ' + (0, field_parser_1.dumpBareSafe)(cert.obligation) + '\n';
2323
+ }
2324
+ out += indent + '}\n';
2325
+ return out;
2326
+ }
2327
+ /**
2328
+ * Dump ONE rich promise entry at the given indent — shared by
2329
+ * dumpSubjectPromises (is.promises) and the promise_set register
2330
+ * (config/promiseSet.ts, smart TODO.roadmap/40 batch 3), which prefixes
2331
+ * its entries with the `promise` keyword. Facet order is the byte
2332
+ * contract: target, level, conditions, statement, verified_by, source,
2333
+ * certificate.
2334
+ */
2335
+ function dumpPromiseEntry(p, indent, keyword = '') {
2336
+ const facet = indent + ' ';
2337
+ let out = indent + keyword + (0, field_parser_1.dumpBareSafe)(p.id) + ' {\n';
2338
+ if (p.target) {
2339
+ out += facet + 'target ' + (0, field_parser_1.dumpBareSafe)(p.target) + '\n';
2340
+ }
2341
+ if (p.level) {
2342
+ out += facet + 'level ' + dumpPromiseLevel(p.level) + '\n';
2343
+ }
2344
+ if (p.conditions) {
2345
+ out += facet + 'conditions ' + dumpSubjectDerivation(p.conditions) + '\n';
2346
+ }
2347
+ if (p.statement) {
2348
+ out += facet + 'statement "' + (0, tokenize_2.escapeString)(p.statement) + '"\n';
2349
+ }
2350
+ out += dumpIdList('verified_by', p.verifiedBy, facet);
2351
+ out += dumpSource('source', p.source ?? null, facet);
2352
+ if (p.certificate) {
2353
+ out += dumpPromiseCertificate(p.certificate, facet);
2354
+ }
2355
+ out += indent + '}\n';
2356
+ return out;
2357
+ }
2227
2358
  /**
2228
2359
  * Dump is.promises (TODO.roadmap/08). Byte-compat with the legacy string
2229
2360
  * list: a block of statement-only entries keeps the single-line form
@@ -2246,22 +2377,7 @@ function dumpSubjectPromises(promises) {
2246
2377
  out += ' ' + (0, field_parser_1.dumpBareSafe)(p.statement) + '\n';
2247
2378
  continue;
2248
2379
  }
2249
- out += ' ' + (0, field_parser_1.dumpBareSafe)(p.id) + ' {\n';
2250
- if (p.target) {
2251
- out += ' target ' + (0, field_parser_1.dumpBareSafe)(p.target) + '\n';
2252
- }
2253
- if (p.level) {
2254
- out += ' level ' + dumpPromiseLevel(p.level) + '\n';
2255
- }
2256
- if (p.conditions) {
2257
- out += ' conditions ' + dumpSubjectDerivation(p.conditions) + '\n';
2258
- }
2259
- if (p.statement) {
2260
- out += ' statement "' + (0, tokenize_2.escapeString)(p.statement) + '"\n';
2261
- }
2262
- out += dumpIdList('verified_by', p.verifiedBy, ' ');
2263
- out += dumpSource('source', p.source ?? null, ' ');
2264
- out += ' }\n';
2380
+ out += dumpPromiseEntry(p, ' ');
2265
2381
  }
2266
2382
  out += ' }\n';
2267
2383
  return out;