@driftsys/markspec 0.6.2 → 0.7.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 (64) hide show
  1. package/README.md +2 -3
  2. package/esm/compiler/constants.d.ts +1 -1
  3. package/esm/compiler/constants.d.ts.map +1 -1
  4. package/esm/compiler/constants.js +4 -14
  5. package/esm/config/markspec.d.ts +1 -0
  6. package/esm/config/markspec.d.ts.map +1 -1
  7. package/esm/config/markspec.js +5 -1
  8. package/esm/lock/resolve.d.ts.map +1 -1
  9. package/esm/lock/resolve.js +3 -11
  10. package/esm/lock/serializer.d.ts.map +1 -1
  11. package/esm/lock/serializer.js +2 -1
  12. package/esm/mod.d.ts +3 -3
  13. package/esm/mod.d.ts.map +1 -1
  14. package/esm/mod.js +2 -2
  15. package/esm/model/attributes.d.ts.map +1 -1
  16. package/esm/model/attributes.js +7 -0
  17. package/esm/model/mod.d.ts +3 -1
  18. package/esm/model/mod.d.ts.map +1 -1
  19. package/esm/model/mod.js +6 -14
  20. package/esm/model/relations.d.ts +35 -0
  21. package/esm/model/relations.d.ts.map +1 -0
  22. package/esm/model/relations.js +86 -0
  23. package/esm/model/type_hierarchy.d.ts +7 -0
  24. package/esm/model/type_hierarchy.d.ts.map +1 -1
  25. package/esm/model/type_hierarchy.js +35 -10
  26. package/esm/profile/manifest.d.ts +8 -0
  27. package/esm/profile/manifest.d.ts.map +1 -1
  28. package/esm/profile/manifest.js +9 -8
  29. package/esm/validator/listing.d.ts.map +1 -1
  30. package/esm/validator/listing.js +9 -10
  31. package/esm/validator/trace_types.d.ts.map +1 -1
  32. package/esm/validator/trace_types.js +7 -29
  33. package/package.json +1 -1
  34. package/script/compiler/constants.d.ts +1 -1
  35. package/script/compiler/constants.d.ts.map +1 -1
  36. package/script/compiler/constants.js +4 -14
  37. package/script/config/markspec.d.ts +1 -0
  38. package/script/config/markspec.d.ts.map +1 -1
  39. package/script/config/markspec.js +7 -3
  40. package/script/lock/resolve.d.ts.map +1 -1
  41. package/script/lock/resolve.js +3 -11
  42. package/script/lock/serializer.d.ts.map +1 -1
  43. package/script/lock/serializer.js +2 -1
  44. package/script/mod.d.ts +3 -3
  45. package/script/mod.d.ts.map +1 -1
  46. package/script/mod.js +7 -4
  47. package/script/model/attributes.d.ts.map +1 -1
  48. package/script/model/attributes.js +7 -0
  49. package/script/model/mod.d.ts +3 -1
  50. package/script/model/mod.d.ts.map +1 -1
  51. package/script/model/mod.js +9 -14
  52. package/script/model/relations.d.ts +35 -0
  53. package/script/model/relations.d.ts.map +1 -0
  54. package/script/model/relations.js +89 -0
  55. package/script/model/type_hierarchy.d.ts +7 -0
  56. package/script/model/type_hierarchy.d.ts.map +1 -1
  57. package/script/model/type_hierarchy.js +36 -10
  58. package/script/profile/manifest.d.ts +8 -0
  59. package/script/profile/manifest.d.ts.map +1 -1
  60. package/script/profile/manifest.js +18 -16
  61. package/script/validator/listing.d.ts.map +1 -1
  62. package/script/validator/listing.js +9 -10
  63. package/script/validator/trace_types.d.ts.map +1 -1
  64. package/script/validator/trace_types.js +6 -28
@@ -1 +1 @@
1
- {"version":3,"file":"type_hierarchy.d.ts","sourceRoot":"","sources":["../../src/model/type_hierarchy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA0ErE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAa/D;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAMnD,CAAC"}
1
+ {"version":3,"file":"type_hierarchy.d.ts","sourceRoot":"","sources":["../../src/model/type_hierarchy.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,WAAW;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5C;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA6ErE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAa/D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAc3D;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAMnD,CAAC"}
@@ -11,6 +11,7 @@
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CORE_TYPE_SCOPED_ATTRS = exports.CORE_TYPE_HIERARCHY = void 0;
13
13
  exports.attributesForType = attributesForType;
14
+ exports.descendantsOf = descendantsOf;
14
15
  /**
15
16
  * Built-in type hierarchy. Keyed by the canonical TitleCase / lower-with-
16
17
  * hyphens name as it would appear in a `Type:` attribute value.
@@ -32,6 +33,19 @@ exports.CORE_TYPE_HIERARCHY = {
32
33
  excludedAttrs: ["Allocated-to"],
33
34
  },
34
35
  Contract: { parent: "Specification", ownAttrs: ["Schema-language"] },
36
+ // Interface specifications — software/hardware boundary contracts.
37
+ // Re-parented from Component (an interface is a spec, not a building
38
+ // block); names kept (literature terms for an interface specification).
39
+ SoftwareInterface: { parent: "Contract", ownAttrs: [] },
40
+ HardwareInterface: {
41
+ parent: "Contract",
42
+ ownAttrs: [
43
+ "Bus-protocol",
44
+ "Connector-type",
45
+ "Voltage-level",
46
+ "Signal-direction",
47
+ ],
48
+ },
35
49
  Record: { parent: "Specification", ownAttrs: ["Caused-by", "Affects"] },
36
50
  Risk: { parent: "Specification", ownAttrs: ["Caused-by", "Mitigated-by"] },
37
51
  // Component family (ADR-003 §Part 2 — Component)
@@ -54,16 +68,6 @@ exports.CORE_TYPE_HIERARCHY = {
54
68
  parent: "Component",
55
69
  ownAttrs: ["Manufacturer", "Part-number", "Datasheet"],
56
70
  },
57
- SoftwareInterface: { parent: "Component", ownAttrs: [] },
58
- HardwareInterface: {
59
- parent: "Component",
60
- ownAttrs: [
61
- "Bus-protocol",
62
- "Connector-type",
63
- "Voltage-level",
64
- "Signal-direction",
65
- ],
66
- },
67
71
  // Unit family (ADR-003 §Part 2 — Unit)
68
72
  Unit: {
69
73
  parent: "Item",
@@ -114,6 +118,28 @@ function attributesForType(typeName) {
114
118
  result.delete(a);
115
119
  return result;
116
120
  }
121
+ /**
122
+ * Every type whose ancestor chain includes `ancestor` (inclusive of `ancestor`
123
+ * itself), per {@linkcode CORE_TYPE_HIERARCHY}. Returns an empty set when
124
+ * `ancestor` is not a known core type. Used to derive type-family sets (e.g. the
125
+ * components-listing family) so they cannot drift from the hierarchy.
126
+ */
127
+ function descendantsOf(ancestor) {
128
+ const result = new Set();
129
+ if (!exports.CORE_TYPE_HIERARCHY[ancestor])
130
+ return result;
131
+ for (const name of Object.keys(exports.CORE_TYPE_HIERARCHY)) {
132
+ let cursor = name;
133
+ while (cursor !== null && exports.CORE_TYPE_HIERARCHY[cursor]) {
134
+ if (cursor === ancestor) {
135
+ result.add(name);
136
+ break;
137
+ }
138
+ cursor = exports.CORE_TYPE_HIERARCHY[cursor].parent;
139
+ }
140
+ }
141
+ return result;
142
+ }
117
143
  /**
118
144
  * Union of every type-scoped attribute name declared anywhere in the
119
145
  * core hierarchy. Used by the validator to suppress `MSL-R010`
@@ -6,6 +6,14 @@
6
6
  * schema violations.
7
7
  */
8
8
  import type { Diagnostic, ProfileManifest } from "../model/mod.js";
9
+ export declare const ALLOWED_ROOT_KEYS: Set<string>;
10
+ export declare const ALLOWED_PROFILE_KEYS: Set<string>;
11
+ export declare const ALLOWED_TYPE_KEYS: Set<string>;
12
+ export declare const ALLOWED_DOC_TYPE_KEYS: Set<string>;
13
+ export declare const ALLOWED_DOCUMENTS_KEYS: Set<string>;
14
+ export declare const ALLOWED_ATTR_KEYS: Set<string>;
15
+ export declare const ALLOWED_INVERSE_KEYS: Set<string>;
16
+ export declare const ALLOWED_TRACE_RULE_KEYS: Set<string>;
9
17
  /** Result of parsing a profile manifest. */
10
18
  export interface ParseManifestResult {
11
19
  readonly manifest: ProfileManifest | null;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAoFnE,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAysCD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CA+LrB"}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/profile/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AA4BnE,eAAO,MAAM,iBAAiB,aAS5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAU/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,aAU5B,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAA6C,CAAC;AAChF,eAAO,MAAM,sBAAsB,aAAoC,CAAC;AAExE,eAAO,MAAM,iBAAiB,aAQ5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,aAAgC,CAAC;AAElE,eAAO,MAAM,uBAAuB,aAKlC,CAAC;AAEH,4CAA4C;AAC5C,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAysCD;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,UAAU,SAAoB,GAC7B,mBAAmB,CA+LrB"}
@@ -7,11 +7,13 @@
7
7
  * schema violations.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ALLOWED_TRACE_RULE_KEYS = exports.ALLOWED_INVERSE_KEYS = exports.ALLOWED_ATTR_KEYS = exports.ALLOWED_DOCUMENTS_KEYS = exports.ALLOWED_DOC_TYPE_KEYS = exports.ALLOWED_TYPE_KEYS = exports.ALLOWED_PROFILE_KEYS = exports.ALLOWED_ROOT_KEYS = void 0;
10
11
  exports.parseManifest = parseManifest;
11
12
  const yaml_1 = require("@std/yaml");
12
13
  const mod_js_1 = require("../model/mod.js");
13
14
  const VALUE_TYPE_SET = new Set(mod_js_1.VALUE_TYPES);
14
- const ALLOWED_ROOT_KEYS = new Set([
15
+ exports.ALLOWED_ROOT_KEYS = new Set([
16
+ "$schema",
15
17
  "id",
16
18
  "version",
17
19
  "markspec-schema",
@@ -20,7 +22,7 @@ const ALLOWED_ROOT_KEYS = new Set([
20
22
  "extends",
21
23
  "profile",
22
24
  ]);
23
- const ALLOWED_PROFILE_KEYS = new Set([
25
+ exports.ALLOWED_PROFILE_KEYS = new Set([
24
26
  "attributes",
25
27
  "labels",
26
28
  "colors",
@@ -31,7 +33,7 @@ const ALLOWED_PROFILE_KEYS = new Set([
31
33
  "prose",
32
34
  "discipline-mode",
33
35
  ]);
34
- const ALLOWED_TYPE_KEYS = new Set([
36
+ exports.ALLOWED_TYPE_KEYS = new Set([
35
37
  "extends",
36
38
  "description",
37
39
  "display-id-pattern",
@@ -42,9 +44,9 @@ const ALLOWED_TYPE_KEYS = new Set([
42
44
  "color",
43
45
  "discipline",
44
46
  ]);
45
- const ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
46
- const ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
47
- const ALLOWED_ATTR_KEYS = new Set([
47
+ exports.ALLOWED_DOC_TYPE_KEYS = new Set(["id", "contains", "description"]);
48
+ exports.ALLOWED_DOCUMENTS_KEYS = new Set(["types", "frontMatter"]);
49
+ exports.ALLOWED_ATTR_KEYS = new Set([
48
50
  "name",
49
51
  "type",
50
52
  "required",
@@ -53,8 +55,8 @@ const ALLOWED_ATTR_KEYS = new Set([
53
55
  "inverse",
54
56
  "description",
55
57
  ]);
56
- const ALLOWED_INVERSE_KEYS = new Set(["name", "category"]);
57
- const ALLOWED_TRACE_RULE_KEYS = new Set([
58
+ exports.ALLOWED_INVERSE_KEYS = new Set(["name", "category"]);
59
+ exports.ALLOWED_TRACE_RULE_KEYS = new Set([
58
60
  "target",
59
61
  "cardinality",
60
62
  "required",
@@ -226,7 +228,7 @@ function parseAttrDecl(raw, context, sourcePath, diagnostics) {
226
228
  }
227
229
  const r = raw;
228
230
  for (const key of Object.keys(r)) {
229
- if (!ALLOWED_ATTR_KEYS.has(key)) {
231
+ if (!exports.ALLOWED_ATTR_KEYS.has(key)) {
230
232
  diagnostics.push({
231
233
  code: "PROFILE-LOAD-003",
232
234
  severity: "error",
@@ -297,7 +299,7 @@ function parseAttrDecl(raw, context, sourcePath, diagnostics) {
297
299
  }
298
300
  const inv = r.inverse;
299
301
  for (const key of Object.keys(inv)) {
300
- if (!ALLOWED_INVERSE_KEYS.has(key)) {
302
+ if (!exports.ALLOWED_INVERSE_KEYS.has(key)) {
301
303
  diagnostics.push({
302
304
  code: "PROFILE-LOAD-003",
303
305
  severity: "error",
@@ -394,7 +396,7 @@ function parseTraceRule(raw, context, sourcePath, diagnostics) {
394
396
  }
395
397
  const r = raw;
396
398
  for (const key of Object.keys(r)) {
397
- if (!ALLOWED_TRACE_RULE_KEYS.has(key)) {
399
+ if (!exports.ALLOWED_TRACE_RULE_KEYS.has(key)) {
398
400
  diagnostics.push({
399
401
  code: "PROFILE-LOAD-003",
400
402
  severity: "error",
@@ -875,7 +877,7 @@ function parseTypeDef(name, raw, sourcePath, diagnostics) {
875
877
  }
876
878
  const r = raw;
877
879
  for (const key of Object.keys(r)) {
878
- if (!ALLOWED_TYPE_KEYS.has(key)) {
880
+ if (!exports.ALLOWED_TYPE_KEYS.has(key)) {
879
881
  diagnostics.push({
880
882
  code: "PROFILE-TYPE-005",
881
883
  severity: "error",
@@ -1009,7 +1011,7 @@ function parseDocTypeDef(raw, sourcePath, diagnostics) {
1009
1011
  }
1010
1012
  const r = raw;
1011
1013
  for (const key of Object.keys(r)) {
1012
- if (!ALLOWED_DOC_TYPE_KEYS.has(key)) {
1014
+ if (!exports.ALLOWED_DOC_TYPE_KEYS.has(key)) {
1013
1015
  diagnostics.push({
1014
1016
  code: "PROFILE-LOAD-003",
1015
1017
  severity: "error",
@@ -1047,7 +1049,7 @@ function parseDocumentsSection(raw, sourcePath, diagnostics) {
1047
1049
  }
1048
1050
  const r = raw;
1049
1051
  for (const key of Object.keys(r)) {
1050
- if (!ALLOWED_DOCUMENTS_KEYS.has(key)) {
1052
+ if (!exports.ALLOWED_DOCUMENTS_KEYS.has(key)) {
1051
1053
  diagnostics.push({
1052
1054
  code: "PROFILE-LOAD-003",
1053
1055
  severity: "error",
@@ -1110,7 +1112,7 @@ function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
1110
1112
  }
1111
1113
  const root = parsed;
1112
1114
  for (const key of Object.keys(root)) {
1113
- if (!ALLOWED_ROOT_KEYS.has(key)) {
1115
+ if (!exports.ALLOWED_ROOT_KEYS.has(key)) {
1114
1116
  diagnostics.push({
1115
1117
  code: "PROFILE-LOAD-003",
1116
1118
  severity: "error",
@@ -1159,7 +1161,7 @@ function parseManifest(rawYaml, sourcePath = "<markspec.yaml>") {
1159
1161
  return { manifest: null, diagnostics };
1160
1162
  }
1161
1163
  for (const key of Object.keys(rawProfile)) {
1162
- if (!ALLOWED_PROFILE_KEYS.has(key)) {
1164
+ if (!exports.ALLOWED_PROFILE_KEYS.has(key)) {
1163
1165
  diagnostics.push({
1164
1166
  code: "PROFILE-LOAD-003",
1165
1167
  severity: "error",
@@ -1 +1 @@
1
- {"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../src/validator/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAWpE,oDAAoD;AACpD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAEnE,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC3C;AA8SD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GACtC,SAAS,UAAU,EAAE,CAMvB"}
1
+ {"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../src/validator/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAYpE,oDAAoD;AACpD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,YAAY,CAAC;AAEnE,uEAAuE;AACvE,MAAM,WAAW,kBAAkB;IACjC,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;CAC3C;AA4SD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GACtC,SAAS,UAAU,EAAE,CAMvB"}
@@ -21,19 +21,19 @@
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.validateListingDocuments = validateListingDocuments;
23
23
  const path_1 = require("@std/path");
24
+ const mod_js_1 = require("../model/mod.js");
24
25
  const glossary_js_1 = require("../parser/glossary.js");
25
26
  const component_schemes_js_1 = require("./component_schemes.js");
26
27
  // ---------------------------------------------------------------------------
27
28
  // Component-family and Unit-family sets
28
29
  // ---------------------------------------------------------------------------
29
- /** Core Component-family type names per ADR-003 §Part 2 / spec §6.3. */
30
- const COMPONENT_FAMILY = new Set([
31
- "Component",
32
- "SoftwareComponent",
33
- "HardwareComponent",
34
- "SoftwareInterface",
35
- "HardwareInterface",
36
- ]);
30
+ /** Core Component-family type names per ADR-003 §Part 2 / spec §6.3.
31
+ *
32
+ * SoftwareInterface and HardwareInterface are NOT included here: they
33
+ * were re-parented from Component to Contract (interface-as-contract
34
+ * design). A components listing accepts only true structural components.
35
+ */
36
+ const COMPONENT_FAMILY = (0, mod_js_1.descendantsOf)("Component");
37
37
  /** Core Unit-family type names per ADR-003 §Part 2. */
38
38
  const UNIT_FAMILY = new Set([
39
39
  "Unit",
@@ -229,8 +229,7 @@ function validateComponentsEntry(entry, file, diagnostics) {
229
229
  severity: "error",
230
230
  message: `${file}:${entry.location.line}: entry '[${entry.displayId}]' ` +
231
231
  `has Type: ${typeVal} which is not in the Component family ` +
232
- `(Component/SoftwareComponent/HardwareComponent/` +
233
- `SoftwareInterface/HardwareInterface) — ` +
232
+ `(Component/SoftwareComponent/HardwareComponent) — ` +
234
233
  `only Component-family types are permitted in a components listing ` +
235
234
  `(spec §6.3)`,
236
235
  location: entry.location,
@@ -1 +1 @@
1
- {"version":3,"file":"trace_types.d.ts","sourceRoot":"","sources":["../../src/validator/trace_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AA0GzD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,SAAS,UAAU,EAAE,CAuHvB"}
1
+ {"version":3,"file":"trace_types.d.ts","sourceRoot":"","sources":["../../src/validator/trace_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAoFzD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,SAAS,UAAU,EAAE,CAuHvB"}
@@ -16,34 +16,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.validateTraceTargetTypes = validateTraceTargetTypes;
17
17
  const mod_js_1 = require("../model/mod.js");
18
18
  const type_resolution_js_1 = require("./type_resolution.js");
19
- const TRACE_RULES = [
20
- // Specification family
21
- { attr: "Satisfies", allowedTargetTypes: ["Specification"] },
22
- { attr: "Derived-from", allowedTargetTypes: ["Specification"] },
23
- { attr: "Allocated-to", allowedTargetTypes: ["Component"] },
24
- // Test (extends Specification)
25
- { attr: "Verifies", allowedTargetTypes: ["Requirement", "Contract"] },
26
- { attr: "Tests", allowedTargetTypes: ["Component", "Unit"] },
27
- // Component / Unit
28
- { attr: "Realizes", allowedTargetTypes: ["Specification"] },
29
- {
30
- attr: "Provides",
31
- allowedTargetTypes: ["SoftwareInterface", "HardwareInterface"],
32
- },
33
- {
34
- attr: "Requires",
35
- allowedTargetTypes: ["SoftwareInterface", "HardwareInterface"],
36
- },
37
- { attr: "Depends-on", allowedTargetTypes: ["Component", "Unit"] },
38
- { attr: "Part-of", allowedTargetTypes: ["Component"] },
39
- // Risk
40
- { attr: "Mitigated-by", allowedTargetTypes: ["Specification"] },
41
- // Record
42
- { attr: "Affects", allowedTargetTypes: ["Component", "Unit"] },
43
- // `Caused-by` is polymorphic between Record (cause = Requirement/Risk/
44
- // Contract/Record) and Risk (cause = Component/Unit/Specification).
45
- // The simplest correct rule is the union — handled by the loop below.
46
- ];
19
+ const TRACE_RULES = mod_js_1.CORE_RELATIONS
20
+ .filter((r) => r.targetTypes)
21
+ .map((r) => ({ attr: r.attr, allowedTargetTypes: r.targetTypes }));
22
+ // `Caused-by` is polymorphic between Record (cause = Requirement/Risk/
23
+ // Contract/Record) and Risk (cause = Component/Unit/Specification).
24
+ // The simplest correct rule is the union — handled by POLYMORPHIC_CAUSED_BY below.
47
25
  /** Polymorphic relations where the source type's role widens the targets. */
48
26
  const POLYMORPHIC_CAUSED_BY = [
49
27
  {