@primmel/primmel 1.21.15 → 1.21.17

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Requirement.d.ts","sourceRoot":"","sources":["../../../src/types/Requirement.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,kBAAkB,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,wEAAwE;AACxE,MAAM,WAAW,uBAAuB;IACtC,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,OAAO,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACxC;;;;OAIG;IACH,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAA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AC3B,0DAA0D;IAC1D,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,iDAAiD;IACjD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC5C,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB;;wDAEoD;IACpD,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;IACzB;iEAC6D;IAC7D,IAAI,CAAC,EAAE,OAAO,OAAO,EAAE,GAAG,EAAE,CAAC;IAC7B,iEAAiE;IACjE,eAAe,CAAC,EAAE,OAAO,kBAAkB,EAAE,cAAc,EAAE,CAAC;IAC9D,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,oDAAoD;IACpD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,uFAAuF;IACvF,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACrC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAChC,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB"}
@@ -5587,7 +5587,23 @@ var Li = function(e, t) {
5587
5587
  else if (t === "instances") o.instances = Oi(i(s()));
5588
5588
  else if (t === "inherits_from") o.inheritsFrom = a(s());
5589
5589
  else if (t === "result_forms") o.resultForms = U(s());
5590
- else if (t === "produces_artifacts") o.producesArtifacts = U(s());
5590
+ else if (t === "run") {
5591
+ let t = r(i(s())), n = {
5592
+ performedBy: "",
5593
+ store: "",
5594
+ trajectory: ""
5595
+ }, c = 0;
5596
+ for (; c < t.length;) {
5597
+ let r = t[c++];
5598
+ if (c >= t.length) throw Error(`Parsing error: conformance_test. ID ${e}: run expects a value for ${r}`);
5599
+ if (r === "performed_by") {
5600
+ let r = a(t[c++]);
5601
+ if (r !== "laboratory" && r !== "manufacturer") throw Error(`Parsing error: conformance_test. ID ${e}: Unknown run performer ${r} (valid: laboratory, manufacturer)`);
5602
+ n.performedBy = r;
5603
+ } else r === "store" ? n.store = a(t[c++]) : r === "trajectory" ? n.trajectory = a(t[c++]) : c = b(t, c, r);
5604
+ }
5605
+ o.run = n;
5606
+ } else if (t === "produces_artifacts") o.producesArtifacts = U(s());
5591
5607
  else if (t === "report_rows") o.reportRows = U(s());
5592
5608
  else if (t === "derived_values") o.derivedValues = Ei(i(s()));
5593
5609
  else if (t === "validate_measurement") {
@@ -5680,7 +5696,7 @@ var Li = function(e, t) {
5680
5696
  }
5681
5697
  t += n + "} }\n";
5682
5698
  }
5683
- if (e.inheritsFrom && (t += " inherits_from " + e.inheritsFrom + "\n"), e.resultForms.length > 0 && (t += " result_forms { " + e.resultForms.join(" ") + " }\n"), e.producesArtifacts && e.producesArtifacts.length > 0 && (t += " produces_artifacts { " + e.producesArtifacts.join(" ") + " }\n"), e.reportRows && e.reportRows.length > 0 && (t += " report_rows { " + e.reportRows.join(" ") + " }\n"), e.derivedValues.length > 0) {
5699
+ if (e.inheritsFrom && (t += " inherits_from " + e.inheritsFrom + "\n"), e.resultForms.length > 0 && (t += " result_forms { " + e.resultForms.join(" ") + " }\n"), e.run && (t += " run {\n", e.run.performedBy && (t += " performed_by " + e.run.performedBy + "\n"), e.run.store && (t += " store " + e.run.store + "\n"), e.run.trajectory && (t += " trajectory " + e.run.trajectory + "\n"), t += " }\n"), e.producesArtifacts && e.producesArtifacts.length > 0 && (t += " produces_artifacts { " + e.producesArtifacts.join(" ") + " }\n"), e.reportRows && e.reportRows.length > 0 && (t += " report_rows { " + e.reportRows.join(" ") + " }\n"), e.derivedValues.length > 0) {
5684
5700
  t += " derived_values {\n";
5685
5701
  for (let n of e.derivedValues) t += " value " + n.name + " { expression \"" + s(n.expression) + "\" }\n";
5686
5702
  t += " }\n";
@@ -6408,8 +6424,11 @@ function Da() {
6408
6424
  };
6409
6425
  }
6410
6426
  function Oa(e) {
6411
- let t = Da();
6412
- return Aa(n(e), t, 0), t;
6427
+ let t = Da(), r = n(e);
6428
+ Aa(r, t, 0);
6429
+ let a = 0;
6430
+ for (; a < r.length;) r[a] === "when" && r[a + 1]?.startsWith("{") ? (t.when = ce(i(r[a + 1])), a += 2) : a += 1;
6431
+ return t;
6413
6432
  }
6414
6433
  function ka(e) {
6415
6434
  return ce(e);
@@ -6549,8 +6568,12 @@ var Na = function(e, t) {
6549
6568
  else if (e === "binds_to") o.bindsTo = Ta(s[c++]);
6550
6569
  else if (e === "subjects") o.subjects = ja(i(s[c++]));
6551
6570
  else if (e === "parameters") o.parameters = Ma(i(s[c++]));
6552
- else if (e === "limit") o.limit = Oa(i(s[c++]));
6553
- else if (e === "applicability") o.applicability = R(i(s[c++]));
6571
+ else if (e === "limit") {
6572
+ let e = "";
6573
+ s[c] !== void 0 && !s[c].startsWith("{") && (e = a(s[c++]));
6574
+ let t = Oa(i(s[c++]));
6575
+ e ? (t.name = e, (o.limits ??= []).push(t)) : o.limit ? (o.limits ??= []).push(t) : o.limit = t;
6576
+ } else if (e === "applicability") o.applicability = R(i(s[c++]));
6554
6577
  else if (e === "channel") o.channel = a(s[c++]);
6555
6578
  else if (e === "report_row") o.reportRow = a(s[c++]);
6556
6579
  else if (e === "obligation") o.obligation = a(s[c++]);
@@ -6579,12 +6602,17 @@ var Na = function(e, t) {
6579
6602
  };
6580
6603
  function Pa(e) {
6581
6604
  if (e.argsBound) {
6582
- let t = " limit {\n";
6605
+ let t = e.name ? " limit " + JSON.stringify(e.name) + " {\n" : " limit {\n";
6583
6606
  if ((e.args ?? []).length > 0) {
6584
6607
  t += " args {\n";
6585
6608
  for (let n of e.args ?? []) t += " " + n.name + " <- " + n.source + "\n";
6586
6609
  t += " }\n";
6587
6610
  }
6611
+ if (e.when) {
6612
+ t += " when {\n";
6613
+ for (let n of e.when.split("\n")) t += " " + n + "\n";
6614
+ t += " }\n";
6615
+ }
6588
6616
  t += " expression {\n";
6589
6617
  for (let n of e.expression.split("\n")) t += " " + n + "\n";
6590
6618
  if (t += " }\n", e.modality && (t += " modality " + e.modality + "\n"), e.relativeTo && (t += " relative_to " + e.relativeTo + "\n"), e.notes && (t += " notes \"" + s(e.notes) + "\"\n"), e.accepts) {
@@ -6619,7 +6647,11 @@ var Fa = function(e) {
6619
6647
  }
6620
6648
  t += " }\n";
6621
6649
  }
6622
- if (e.limit && (t += Pa(e.limit)), e.applicability.length > 0 && (t += " applicability {\n " + z(e.applicability).trim() + "\n }\n"), e.channel && (t += " channel " + e.channel + "\n"), e.reportRow && (t += " report_row " + e.reportRow + "\n"), e.obligation && (t += " obligation " + e.obligation + "\n"), e.acceptanceCriteria && (t += " acceptance_criteria {\n " + e.acceptanceCriteria + "\n }\n"), e.verificationMethod) {
6650
+ if (e.limit) {
6651
+ t += Pa(e.limit);
6652
+ for (let n of e.limits ?? []) t += Pa(n);
6653
+ }
6654
+ if (e.applicability.length > 0 && (t += " applicability {\n " + z(e.applicability).trim() + "\n }\n"), e.channel && (t += " channel " + e.channel + "\n"), e.reportRow && (t += " report_row " + e.reportRow + "\n"), e.obligation && (t += " obligation " + e.obligation + "\n"), e.acceptanceCriteria && (t += " acceptance_criteria {\n " + e.acceptanceCriteria + "\n }\n"), e.verificationMethod) {
6623
6655
  let n = " verification { method " + e.verificationMethod;
6624
6656
  e.verificationDescription && (n += " description \"" + s(e.verificationDescription) + "\""), t += n + " }\n";
6625
6657
  }
@@ -10153,6 +10153,39 @@ var parseConformanceTest = function(id, data) {
10153
10153
  result.inheritsFrom = stripWrapping(value());
10154
10154
  } else if (keyword === "result_forms") {
10155
10155
  result.resultForms = readStringList(value());
10156
+ } else if (keyword === "run") {
10157
+ const runBlock = unwrapBlock(value());
10158
+ const rt = tokenizePackage(runBlock);
10159
+ const run = {
10160
+ performedBy: "",
10161
+ store: "",
10162
+ trajectory: ""
10163
+ };
10164
+ let ri = 0;
10165
+ while (ri < rt.length) {
10166
+ const rk = rt[ri++];
10167
+ if (ri >= rt.length) {
10168
+ throw new Error(
10169
+ `Parsing error: conformance_test. ID ${id}: run expects a value for ${rk}`
10170
+ );
10171
+ }
10172
+ if (rk === "performed_by") {
10173
+ const who = stripWrapping(rt[ri++]);
10174
+ if (who !== "laboratory" && who !== "manufacturer") {
10175
+ throw new Error(
10176
+ `Parsing error: conformance_test. ID ${id}: Unknown run performer ${who} (valid: laboratory, manufacturer)`
10177
+ );
10178
+ }
10179
+ run.performedBy = who;
10180
+ } else if (rk === "store") {
10181
+ run.store = stripWrapping(rt[ri++]);
10182
+ } else if (rk === "trajectory") {
10183
+ run.trajectory = stripWrapping(rt[ri++]);
10184
+ } else {
10185
+ ri = skipUnknownValue(rt, ri, rk);
10186
+ }
10187
+ }
10188
+ result.run = run;
10156
10189
  } else if (keyword === "produces_artifacts") {
10157
10190
  result.producesArtifacts = readStringList(value());
10158
10191
  } else if (keyword === "report_rows") {
@@ -10454,6 +10487,19 @@ var dumpConformanceTest = function(ct) {
10454
10487
  if (ct.resultForms.length > 0) {
10455
10488
  out += " result_forms { " + ct.resultForms.join(" ") + " }\n";
10456
10489
  }
10490
+ if (ct.run) {
10491
+ out += " run {\n";
10492
+ if (ct.run.performedBy) {
10493
+ out += " performed_by " + ct.run.performedBy + "\n";
10494
+ }
10495
+ if (ct.run.store) {
10496
+ out += " store " + ct.run.store + "\n";
10497
+ }
10498
+ if (ct.run.trajectory) {
10499
+ out += " trajectory " + ct.run.trajectory + "\n";
10500
+ }
10501
+ out += " }\n";
10502
+ }
10457
10503
  if (ct.producesArtifacts && ct.producesArtifacts.length > 0) {
10458
10504
  out += " produces_artifacts { " + ct.producesArtifacts.join(" ") + " }\n";
10459
10505
  }
@@ -12008,7 +12054,17 @@ function blankLimit() {
12008
12054
  }
12009
12055
  function readLimit(block) {
12010
12056
  const limit = blankLimit();
12011
- readLegacyLimitFields(tokenize(block), limit, 0);
12057
+ const lt = tokenize(block);
12058
+ readLegacyLimitFields(lt, limit, 0);
12059
+ let i = 0;
12060
+ while (i < lt.length) {
12061
+ if (lt[i] === "when" && lt[i + 1]?.startsWith("{")) {
12062
+ limit.when = canonicalizeExpression(unwrapBlock(lt[i + 1]));
12063
+ i += 2;
12064
+ } else {
12065
+ i += 1;
12066
+ }
12067
+ }
12012
12068
  return limit;
12013
12069
  }
12014
12070
  function readExpressionBlock(raw) {
@@ -12239,7 +12295,19 @@ var parseRequirement = function(id, data) {
12239
12295
  } else if (cmd === "parameters") {
12240
12296
  result.parameters = readParameters(unwrapBlock(t[i++]));
12241
12297
  } else if (cmd === "limit") {
12242
- result.limit = readLimit(unwrapBlock(t[i++]));
12298
+ let name = "";
12299
+ if (t[i] !== void 0 && !t[i].startsWith("{")) {
12300
+ name = stripWrapping(t[i++]);
12301
+ }
12302
+ const lim = readLimit(unwrapBlock(t[i++]));
12303
+ if (name) {
12304
+ lim.name = name;
12305
+ (result.limits ??= []).push(lim);
12306
+ } else if (result.limit) {
12307
+ (result.limits ??= []).push(lim);
12308
+ } else {
12309
+ result.limit = lim;
12310
+ }
12243
12311
  } else if (cmd === "applicability") {
12244
12312
  result.applicability = parseApplicability(unwrapBlock(t[i++]));
12245
12313
  } else if (cmd === "channel") {
@@ -12298,7 +12366,8 @@ var parseRequirement = function(id, data) {
12298
12366
  };
12299
12367
  function dumpLimit(limit) {
12300
12368
  if (limit.argsBound) {
12301
- let out2 = " limit {\n";
12369
+ const head = limit.name ? " limit " + JSON.stringify(limit.name) + " {\n" : " limit {\n";
12370
+ let out2 = head;
12302
12371
  if ((limit.args ?? []).length > 0) {
12303
12372
  out2 += " args {\n";
12304
12373
  for (const a of limit.args ?? []) {
@@ -12306,6 +12375,13 @@ function dumpLimit(limit) {
12306
12375
  }
12307
12376
  out2 += " }\n";
12308
12377
  }
12378
+ if (limit.when) {
12379
+ out2 += " when {\n";
12380
+ for (const line of limit.when.split("\n")) {
12381
+ out2 += " " + line + "\n";
12382
+ }
12383
+ out2 += " }\n";
12384
+ }
12309
12385
  out2 += " expression {\n";
12310
12386
  for (const line of limit.expression.split("\n")) {
12311
12387
  out2 += " " + line + "\n";
@@ -12455,6 +12531,9 @@ var dumpRequirement = function(r) {
12455
12531
  }
12456
12532
  if (r.limit) {
12457
12533
  out += dumpLimit(r.limit);
12534
+ for (const lim of r.limits ?? []) {
12535
+ out += dumpLimit(lim);
12536
+ }
12458
12537
  }
12459
12538
  if (r.applicability.length > 0) {
12460
12539
  out += " applicability {\n " + dumpApplicabilityEntries(r.applicability).trim() + "\n }\n";
@@ -23506,6 +23585,22 @@ var CHECK_RULES = [
23506
23585
  "normal",
23507
23586
  "an uncertainty budget targets a declared verdict; a Type A component names a declared captured series, a Type B component states its distribution and half-width; the coverage factor is a positive number"
23508
23587
  ),
23588
+ R(
23589
+ "C180",
23590
+ "run-plane-shape",
23591
+ "coverage",
23592
+ "error",
23593
+ "normal",
23594
+ "the run facet of a conformance test declares the execution: the performer is in the closed vocabulary (laboratory | manufacturer), the store names a declared data_registry, the trajectory names a declared state_machine"
23595
+ ),
23596
+ R(
23597
+ "C181",
23598
+ "run-store-binds",
23599
+ "coverage",
23600
+ "error",
23601
+ "normal",
23602
+ "the run store registry and the record forms of the test agree on the data class \u2014 the output records and the store hold the same shape"
23603
+ ),
23509
23604
  R(
23510
23605
  "C173",
23511
23606
  "step-plane-refs-resolve",
@@ -26818,9 +26913,76 @@ function checkPackage(dir, options = {}) {
26818
26913
  };
26819
26914
  kindOf(ast);
26820
26915
  };
26916
+ const checkGuard = (rid, name, lim) => {
26917
+ if (!lim.when) {
26918
+ return;
26919
+ }
26920
+ const args2 = new Set((lim.args ?? []).map((a) => a.name));
26921
+ try {
26922
+ const ast = parseExpression(lim.when);
26923
+ const ids = freeIdentifiers(ast);
26924
+ for (const call of new Set(ids.calls)) {
26925
+ if (!INLINE_FUNCTION_WORDS.has(call)) {
26926
+ err(
26927
+ "C171",
26928
+ `requirement ${rid}: limit ${name}'s when-guard calls "${call}(\u2026)", which no argument binds and which is not in the expression function vocabulary (expression-identifiers-resolve)`
26929
+ );
26930
+ }
26931
+ }
26932
+ for (const id of new Set(ids.names)) {
26933
+ const root = id.split(".")[0];
26934
+ if (args2.has(id) || id.includes(".") && (root === "self" || CONTEXT_ROOTS.has(root) || args2.has(root))) {
26935
+ continue;
26936
+ }
26937
+ err(
26938
+ "C171",
26939
+ `requirement ${rid}: limit ${name}'s when-guard names "${id}", which no argument binds (expression-identifiers-resolve)`
26940
+ );
26941
+ }
26942
+ const top = ast.type;
26943
+ if (!(top === "binop" && [
26944
+ "<=",
26945
+ ">=",
26946
+ "<",
26947
+ ">",
26948
+ "=",
26949
+ "!=",
26950
+ "\u2260",
26951
+ "and",
26952
+ "or",
26953
+ "xor",
26954
+ "implies"
26955
+ ].includes(ast.op) || top === "unop" && ast.op === "not")) {
26956
+ err(
26957
+ "C84",
26958
+ `requirement ${rid}: limit ${name}'s when-guard does not evaluate to a boolean \u2014 the guard is one comparison or logical composition (constraint-shape)`
26959
+ );
26960
+ }
26961
+ } catch (e) {
26962
+ err(
26963
+ "C171",
26964
+ `requirement ${rid}: limit ${name}'s when-guard does not parse \u2014 ${String(e.message ?? e)} (expression-identifiers-resolve)`
26965
+ );
26966
+ }
26967
+ };
26821
26968
  for (const r of standard.requirements ?? []) {
26822
26969
  if (r.limit?.argsBound) {
26823
26970
  checkInlineLimit("requirement", r.id, r.limit, null);
26971
+ checkGuard(r.id, "(the unnamed limit)", r.limit);
26972
+ }
26973
+ for (const lim of r.limits ?? []) {
26974
+ const label = lim.name ? `"${lim.name}"` : "(an unnamed limit)";
26975
+ if (lim.argsBound) {
26976
+ checkInlineLimit("requirement", r.id, lim, null);
26977
+ } else if (lim.expression) {
26978
+ err(
26979
+ "C171",
26980
+ `requirement ${r.id}: limit ${label} must carry the inline carrier \u2014 args { \u2026 } and expression { \u2026 } (expression-identifiers-resolve)`
26981
+ );
26982
+ }
26983
+ checkGuard(r.id, label, lim);
26984
+ }
26985
+ if (r.limit?.argsBound || (r.limits ?? []).length > 0) {
26824
26986
  continue;
26825
26987
  }
26826
26988
  const expr = r.limit?.expression;
@@ -26901,8 +27063,51 @@ function checkPackage(dir, options = {}) {
26901
27063
  );
26902
27064
  }
26903
27065
  }
27066
+ const runChecks = (t) => {
27067
+ const run = t.run;
27068
+ if (!run) {
27069
+ return;
27070
+ }
27071
+ if (run.performedBy !== "laboratory" && run.performedBy !== "manufacturer") {
27072
+ err(
27073
+ "C180",
27074
+ `conformance test ${t.id}: run performer "${run.performedBy}" is outside the closed vocabulary (laboratory | manufacturer) (run-plane-shape)`
27075
+ );
27076
+ }
27077
+ if (run.store) {
27078
+ const reg = (standard.regs ?? []).find((r) => r.id === run.store);
27079
+ if (!reg) {
27080
+ err(
27081
+ "C180",
27082
+ `conformance test ${t.id}: run store "${run.store}" names no declared data_registry \u2014 the collected records land in a declared store (run-plane-shape)`
27083
+ );
27084
+ } else if (reg.data?.id) {
27085
+ for (const formId of t.resultForms ?? []) {
27086
+ const form = (standard.forms ?? []).find((f) => f.id === formId);
27087
+ if (form?.dataClassId && form.dataClassId !== reg.data.id) {
27088
+ err(
27089
+ "C181",
27090
+ `conformance test ${t.id}: the run's store "${run.store}" holds ${reg.data.id}, but its record form ${formId} captures ${form.dataClassId} \u2014 the output records and the store must agree on the data class (run-store-binds)`
27091
+ );
27092
+ }
27093
+ }
27094
+ }
27095
+ }
27096
+ if (run.trajectory) {
27097
+ const machine = (standard.stateMachines ?? []).find(
27098
+ (m) => m.entityName === run.trajectory
27099
+ );
27100
+ if (!machine) {
27101
+ err(
27102
+ "C180",
27103
+ `conformance test ${t.id}: run trajectory "${run.trajectory}" names no declared state_machine \u2014 the run folds a declared trajectory (run-plane-shape)`
27104
+ );
27105
+ }
27106
+ }
27107
+ };
26904
27108
  for (const t of standard.conformanceTests ?? []) {
26905
27109
  const scope = (t.variables ?? []).map((v) => v.name);
27110
+ runChecks(t);
26906
27111
  for (const v of t.variables ?? []) {
26907
27112
  if (!v.derivation) {
26908
27113
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@primmel/primmel",
3
- "version": "1.21.15",
3
+ "version": "1.21.17",
4
4
  "description": "Primmel — parser, types, and serializer for the Primmel modelling language (successor to MMEL)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",