@transitrix/diagrams 1.8.4 → 1.8.7

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 (254) hide show
  1. package/dist/edge-path.js +10 -1
  2. package/dist/webview/render-activities.d.ts +1 -1
  3. package/dist/webview/render-activities.js +2 -2
  4. package/dist/webview/render-fgca.js +1 -4
  5. package/package.json +7 -2
  6. package/src/edge-path.ts +15 -1
  7. package/src/webview/render-activities.ts +2 -2
  8. package/src/webview/render-fgca.ts +1 -4
  9. package/dist/__tests__/edge-path.test.d.ts +0 -1
  10. package/dist/__tests__/edge-path.test.js +0 -47
  11. package/dist/__tests__/node-size-presets.test.d.ts +0 -1
  12. package/dist/__tests__/node-size-presets.test.js +0 -30
  13. package/dist/__tests__/scope.test.d.ts +0 -1
  14. package/dist/__tests__/scope.test.js +0 -23
  15. package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
  16. package/dist/__tests__/yaml-normalize.test.js +0 -148
  17. package/dist/activities/__tests__/cpm.test.d.ts +0 -1
  18. package/dist/activities/__tests__/cpm.test.js +0 -146
  19. package/dist/activities/__tests__/gantt.test.d.ts +0 -1
  20. package/dist/activities/__tests__/gantt.test.js +0 -263
  21. package/dist/activities/__tests__/layout.test.d.ts +0 -1
  22. package/dist/activities/__tests__/layout.test.js +0 -98
  23. package/dist/activities/__tests__/validate.test.d.ts +0 -1
  24. package/dist/activities/__tests__/validate.test.js +0 -397
  25. package/dist/activity-card/__tests__/example.test.d.ts +0 -1
  26. package/dist/activity-card/__tests__/example.test.js +0 -73
  27. package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
  28. package/dist/activity-card/__tests__/layout.test.js +0 -141
  29. package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
  30. package/dist/activity-card/__tests__/resolver.test.js +0 -325
  31. package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
  32. package/dist/activity-card/__tests__/validate.test.js +0 -149
  33. package/dist/actor/__tests__/validate.test.d.ts +0 -1
  34. package/dist/actor/__tests__/validate.test.js +0 -95
  35. package/dist/applications/__tests__/validate.test.d.ts +0 -1
  36. package/dist/applications/__tests__/validate.test.js +0 -223
  37. package/dist/assertion/__tests__/example.test.d.ts +0 -1
  38. package/dist/assertion/__tests__/example.test.js +0 -32
  39. package/dist/assertion/__tests__/validate.test.d.ts +0 -1
  40. package/dist/assertion/__tests__/validate.test.js +0 -130
  41. package/dist/blocks/__tests__/layout.test.d.ts +0 -1
  42. package/dist/blocks/__tests__/layout.test.js +0 -153
  43. package/dist/blocks/__tests__/validate.test.d.ts +0 -1
  44. package/dist/blocks/__tests__/validate.test.js +0 -235
  45. package/dist/business-service/__tests__/validate.test.d.ts +0 -1
  46. package/dist/business-service/__tests__/validate.test.js +0 -135
  47. package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
  48. package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
  49. package/dist/capability-map/__tests__/address.test.d.ts +0 -1
  50. package/dist/capability-map/__tests__/address.test.js +0 -49
  51. package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
  52. package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
  53. package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
  54. package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
  55. package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
  56. package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
  57. package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
  58. package/dist/capability-map/__tests__/validate.test.js +0 -212
  59. package/dist/change/__tests__/validate.test.d.ts +0 -1
  60. package/dist/change/__tests__/validate.test.js +0 -79
  61. package/dist/codex/__tests__/example.test.d.ts +0 -1
  62. package/dist/codex/__tests__/example.test.js +0 -33
  63. package/dist/codex/__tests__/validate.test.d.ts +0 -1
  64. package/dist/codex/__tests__/validate.test.js +0 -68
  65. package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
  66. package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
  67. package/dist/compliance/__tests__/classify.test.d.ts +0 -1
  68. package/dist/compliance/__tests__/classify.test.js +0 -58
  69. package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
  70. package/dist/compliance/__tests__/confidence.test.js +0 -78
  71. package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
  72. package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
  73. package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
  74. package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
  75. package/dist/compliance/__tests__/example.test.d.ts +0 -1
  76. package/dist/compliance/__tests__/example.test.js +0 -51
  77. package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
  78. package/dist/compliance/__tests__/gap-report.test.js +0 -113
  79. package/dist/compliance/__tests__/html.test.d.ts +0 -1
  80. package/dist/compliance/__tests__/html.test.js +0 -122
  81. package/dist/compliance/__tests__/impact.test.d.ts +0 -1
  82. package/dist/compliance/__tests__/impact.test.js +0 -913
  83. package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
  84. package/dist/compliance/__tests__/markdown.test.js +0 -85
  85. package/dist/compliance/__tests__/trace.test.d.ts +0 -1
  86. package/dist/compliance/__tests__/trace.test.js +0 -144
  87. package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
  88. package/dist/compliance/__tests__/view-resolution.test.js +0 -59
  89. package/dist/compliance/__tests__/views.test.d.ts +0 -1
  90. package/dist/compliance/__tests__/views.test.js +0 -59
  91. package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
  92. package/dist/compliance-matrix/__tests__/build.test.js +0 -183
  93. package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
  94. package/dist/compliance-matrix/__tests__/example.test.js +0 -49
  95. package/dist/confidence/__tests__/score.test.d.ts +0 -1
  96. package/dist/confidence/__tests__/score.test.js +0 -188
  97. package/dist/constraint/__tests__/example.test.d.ts +0 -1
  98. package/dist/constraint/__tests__/example.test.js +0 -14
  99. package/dist/constraint/__tests__/validate.test.d.ts +0 -1
  100. package/dist/constraint/__tests__/validate.test.js +0 -58
  101. package/dist/factor/__tests__/validate.test.d.ts +0 -1
  102. package/dist/factor/__tests__/validate.test.js +0 -112
  103. package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
  104. package/dist/fgca/__tests__/chain-table.test.js +0 -158
  105. package/dist/fgca/__tests__/layout.test.d.ts +0 -1
  106. package/dist/fgca/__tests__/layout.test.js +0 -140
  107. package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
  108. package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
  109. package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
  110. package/dist/fgca/__tests__/preview-layout.test.js +0 -106
  111. package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
  112. package/dist/fgca/__tests__/resolver.test.js +0 -185
  113. package/dist/fgca/__tests__/validate.test.d.ts +0 -1
  114. package/dist/fgca/__tests__/validate.test.js +0 -125
  115. package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
  116. package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
  117. package/dist/goals/__tests__/layout.test.d.ts +0 -1
  118. package/dist/goals/__tests__/layout.test.js +0 -153
  119. package/dist/goals/__tests__/mutations.test.d.ts +0 -1
  120. package/dist/goals/__tests__/mutations.test.js +0 -134
  121. package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
  122. package/dist/goals/__tests__/parse-canonical.test.js +0 -131
  123. package/dist/goals/__tests__/validate.test.d.ts +0 -1
  124. package/dist/goals/__tests__/validate.test.js +0 -183
  125. package/dist/integration/__tests__/validate.test.d.ts +0 -1
  126. package/dist/integration/__tests__/validate.test.js +0 -169
  127. package/dist/location/__tests__/validate.test.d.ts +0 -1
  128. package/dist/location/__tests__/validate.test.js +0 -107
  129. package/dist/node/__tests__/validate.test.d.ts +0 -1
  130. package/dist/node/__tests__/validate.test.js +0 -100
  131. package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
  132. package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
  133. package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
  134. package/dist/process-blueprint/__tests__/layout.test.js +0 -196
  135. package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
  136. package/dist/process-blueprint/__tests__/validate.test.js +0 -280
  137. package/dist/process-map/__tests__/validate.test.d.ts +0 -1
  138. package/dist/process-map/__tests__/validate.test.js +0 -199
  139. package/dist/products/__tests__/validate.test.d.ts +0 -1
  140. package/dist/products/__tests__/validate.test.js +0 -210
  141. package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
  142. package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
  143. package/dist/requirement/__tests__/example.test.d.ts +0 -1
  144. package/dist/requirement/__tests__/example.test.js +0 -21
  145. package/dist/requirement/__tests__/validate.test.d.ts +0 -1
  146. package/dist/requirement/__tests__/validate.test.js +0 -80
  147. package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
  148. package/dist/scenarios/__tests__/validate.test.js +0 -183
  149. package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
  150. package/dist/stakeholder/__tests__/validate.test.js +0 -88
  151. package/dist/target-state/__tests__/validate.test.d.ts +0 -1
  152. package/dist/target-state/__tests__/validate.test.js +0 -78
  153. package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
  154. package/dist/technology-service/__tests__/validate.test.js +0 -121
  155. package/dist/theme/__tests__/tokens.test.d.ts +0 -1
  156. package/dist/theme/__tests__/tokens.test.js +0 -159
  157. package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
  158. package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
  159. package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
  160. package/dist/webview/__tests__/entry-notations.test.js +0 -62
  161. package/dist/webview/__tests__/entry.test.d.ts +0 -1
  162. package/dist/webview/__tests__/entry.test.js +0 -56
  163. package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
  164. package/dist/webview/__tests__/render-activities.test.js +0 -91
  165. package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
  166. package/dist/webview/__tests__/render-blocks.test.js +0 -175
  167. package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
  168. package/dist/webview/__tests__/render-goals.test.js +0 -120
  169. package/dist/webview/__tests__/render-process.test.d.ts +0 -1
  170. package/dist/webview/__tests__/render-process.test.js +0 -463
  171. package/dist/webview/__tests__/render-util.test.d.ts +0 -1
  172. package/dist/webview/__tests__/render-util.test.js +0 -54
  173. package/src/__tests__/edge-path.test.ts +0 -58
  174. package/src/__tests__/node-size-presets.test.ts +0 -50
  175. package/src/__tests__/scope.test.ts +0 -27
  176. package/src/__tests__/yaml-normalize.test.ts +0 -158
  177. package/src/activities/__tests__/cpm.test.ts +0 -164
  178. package/src/activities/__tests__/gantt.test.ts +0 -290
  179. package/src/activities/__tests__/layout.test.ts +0 -112
  180. package/src/activities/__tests__/validate.test.ts +0 -446
  181. package/src/activity-card/__tests__/example.test.ts +0 -83
  182. package/src/activity-card/__tests__/layout.test.ts +0 -162
  183. package/src/activity-card/__tests__/resolver.test.ts +0 -357
  184. package/src/activity-card/__tests__/validate.test.ts +0 -167
  185. package/src/actor/__tests__/validate.test.ts +0 -114
  186. package/src/applications/__tests__/validate.test.ts +0 -256
  187. package/src/assertion/__tests__/example.test.ts +0 -37
  188. package/src/assertion/__tests__/validate.test.ts +0 -142
  189. package/src/blocks/__tests__/layout.test.ts +0 -169
  190. package/src/blocks/__tests__/validate.test.ts +0 -260
  191. package/src/business-service/__tests__/validate.test.ts +0 -160
  192. package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
  193. package/src/capability-map/__tests__/address.test.ts +0 -59
  194. package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
  195. package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
  196. package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
  197. package/src/capability-map/__tests__/validate.test.ts +0 -238
  198. package/src/change/__tests__/validate.test.ts +0 -97
  199. package/src/codex/__tests__/example.test.ts +0 -40
  200. package/src/codex/__tests__/validate.test.ts +0 -84
  201. package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
  202. package/src/compliance/__tests__/classify.test.ts +0 -64
  203. package/src/compliance/__tests__/confidence.test.ts +0 -98
  204. package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
  205. package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
  206. package/src/compliance/__tests__/example.test.ts +0 -57
  207. package/src/compliance/__tests__/gap-report.test.ts +0 -129
  208. package/src/compliance/__tests__/html.test.ts +0 -142
  209. package/src/compliance/__tests__/impact.test.ts +0 -1060
  210. package/src/compliance/__tests__/markdown.test.ts +0 -95
  211. package/src/compliance/__tests__/trace.test.ts +0 -157
  212. package/src/compliance/__tests__/view-resolution.test.ts +0 -80
  213. package/src/compliance/__tests__/views.test.ts +0 -64
  214. package/src/compliance-matrix/__tests__/build.test.ts +0 -200
  215. package/src/compliance-matrix/__tests__/example.test.ts +0 -57
  216. package/src/confidence/__tests__/score.test.ts +0 -254
  217. package/src/constraint/__tests__/example.test.ts +0 -19
  218. package/src/constraint/__tests__/validate.test.ts +0 -68
  219. package/src/factor/__tests__/validate.test.ts +0 -133
  220. package/src/fgca/__tests__/chain-table.test.ts +0 -172
  221. package/src/fgca/__tests__/layout.test.ts +0 -179
  222. package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
  223. package/src/fgca/__tests__/preview-layout.test.ts +0 -124
  224. package/src/fgca/__tests__/resolver.test.ts +0 -209
  225. package/src/fgca/__tests__/validate.test.ts +0 -142
  226. package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
  227. package/src/goals/__tests__/layout.test.ts +0 -175
  228. package/src/goals/__tests__/mutations.test.ts +0 -153
  229. package/src/goals/__tests__/parse-canonical.test.ts +0 -147
  230. package/src/goals/__tests__/validate.test.ts +0 -202
  231. package/src/integration/__tests__/validate.test.ts +0 -203
  232. package/src/location/__tests__/validate.test.ts +0 -127
  233. package/src/node/__tests__/validate.test.ts +0 -118
  234. package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
  235. package/src/process-blueprint/__tests__/layout.test.ts +0 -240
  236. package/src/process-blueprint/__tests__/validate.test.ts +0 -310
  237. package/src/process-map/__tests__/validate.test.ts +0 -223
  238. package/src/products/__tests__/validate.test.ts +0 -239
  239. package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
  240. package/src/requirement/__tests__/example.test.ts +0 -24
  241. package/src/requirement/__tests__/validate.test.ts +0 -96
  242. package/src/scenarios/__tests__/validate.test.ts +0 -209
  243. package/src/stakeholder/__tests__/validate.test.ts +0 -105
  244. package/src/target-state/__tests__/validate.test.ts +0 -95
  245. package/src/technology-service/__tests__/validate.test.ts +0 -143
  246. package/src/theme/__tests__/tokens.test.ts +0 -185
  247. package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
  248. package/src/webview/__tests__/entry-notations.test.ts +0 -77
  249. package/src/webview/__tests__/entry.test.ts +0 -64
  250. package/src/webview/__tests__/render-activities.test.ts +0 -100
  251. package/src/webview/__tests__/render-blocks.test.ts +0 -206
  252. package/src/webview/__tests__/render-goals.test.ts +0 -128
  253. package/src/webview/__tests__/render-process.test.ts +0 -538
  254. package/src/webview/__tests__/render-util.test.ts +0 -66
@@ -1,196 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { layoutProcessBlueprint } from '../layout.js';
3
- function build(file) {
4
- return {
5
- notation: 'process-blueprint',
6
- process_blueprint: {
7
- id: 'PROCESS_BLUEPRINT-T-1',
8
- name: 'Test',
9
- stages: [],
10
- ...file,
11
- },
12
- };
13
- }
14
- describe('layoutProcessBlueprint', () => {
15
- it('lays out stage headers in input order across the legend offset', () => {
16
- const layout = layoutProcessBlueprint(build({
17
- stages: [
18
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
19
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
20
- { id: 'STAGE-3', name: 'C', goal: 'g', result: 'r' },
21
- ],
22
- }));
23
- expect(layout.stageHeaders).toHaveLength(3);
24
- expect(layout.stageHeaders[0].x).toBe(layout.legendColumnWidth);
25
- expect(layout.stageHeaders[1].x).toBe(layout.legendColumnWidth + layout.stageColumnWidth);
26
- expect(layout.stageHeaders[2].x).toBe(layout.legendColumnWidth + 2 * layout.stageColumnWidth);
27
- expect(layout.stageHeaders[0].name).toBe('A');
28
- });
29
- it('produces goal and result cells aligned under each stage column', () => {
30
- const layout = layoutProcessBlueprint(build({
31
- stages: [
32
- { id: 'STAGE-1', name: 'A', goal: 'gA', result: 'rA' },
33
- { id: 'STAGE-2', name: 'B', goal: 'gB', result: 'rB' },
34
- ],
35
- }));
36
- expect(layout.goalCells.map(c => c.text)).toEqual(['gA', 'gB']);
37
- expect(layout.resultCells.map(c => c.text)).toEqual(['rA', 'rB']);
38
- expect(layout.goalCells[0].y).toBeLessThan(layout.resultCells[0].y);
39
- expect(layout.goalCells[0].x).toBe(layout.stageHeaders[0].x);
40
- });
41
- it('omits aspect rows for categories without any entries', () => {
42
- const layout = layoutProcessBlueprint(build({
43
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
44
- }));
45
- expect(layout.aspectRows).toHaveLength(0);
46
- });
47
- it('merges consecutive stages into a single spanning pill', () => {
48
- const layout = layoutProcessBlueprint(build({
49
- stages: [
50
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
51
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
52
- { id: 'STAGE-3', name: 'C', goal: 'g', result: 'r' },
53
- ],
54
- systems: [
55
- { id: 'APPLICATION-OMS-1', name: 'OMS', stages: ['STAGE-1', 'STAGE-2', 'STAGE-3'] },
56
- ],
57
- }));
58
- expect(layout.aspectRows).toHaveLength(1);
59
- const row = layout.aspectRows[0];
60
- expect(row.category).toBe('systems');
61
- expect(row.pills).toHaveLength(1);
62
- expect(row.pills[0].startStageIndex).toBe(0);
63
- expect(row.pills[0].endStageIndex).toBe(2);
64
- expect(row.pills[0].width).toBeGreaterThan(layout.stageColumnWidth);
65
- });
66
- it('splits non-consecutive stages into separate pills', () => {
67
- const layout = layoutProcessBlueprint(build({
68
- stages: [
69
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
70
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
71
- { id: 'STAGE-3', name: 'C', goal: 'g', result: 'r' },
72
- { id: 'STAGE-4', name: 'D', goal: 'g', result: 'r' },
73
- ],
74
- systems: [
75
- { id: 'APPLICATION-X-1', name: 'X', stages: ['STAGE-1', 'STAGE-3', 'STAGE-4'] },
76
- ],
77
- }));
78
- const pills = layout.aspectRows[0].pills;
79
- expect(pills).toHaveLength(2);
80
- expect(pills[0].startStageIndex).toBe(0);
81
- expect(pills[0].endStageIndex).toBe(0);
82
- expect(pills[1].startStageIndex).toBe(2);
83
- expect(pills[1].endStageIndex).toBe(3);
84
- });
85
- it('stacks overlapping pills into vertical slots inside the same row', () => {
86
- const layout = layoutProcessBlueprint(build({
87
- stages: [
88
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
89
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
90
- ],
91
- systems: [
92
- { id: 'APPLICATION-A-1', name: 'A', stages: ['STAGE-1', 'STAGE-2'] },
93
- { id: 'APPLICATION-B-1', name: 'B', stages: ['STAGE-1'] },
94
- ],
95
- }));
96
- const row = layout.aspectRows[0];
97
- expect(row.pills).toHaveLength(2);
98
- // The two pills overlap at STAGE-1, so they should sit at different y.
99
- expect(row.pills[0].y).not.toBe(row.pills[1].y);
100
- // Row height must be tall enough for two stacked pills.
101
- expect(row.height).toBeGreaterThan(row.pills[0].height);
102
- });
103
- it('preserves the fixed category order: systems, actors, equipment, information_entities', () => {
104
- const layout = layoutProcessBlueprint(build({
105
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
106
- information_entities: [{ name: 'Doc', stages: ['STAGE-1'] }],
107
- actors: [{ id: 'ROLE-X-1', name: 'X', stages: ['STAGE-1'] }],
108
- systems: [{ id: 'APPLICATION-X-1', name: 'X', stages: ['STAGE-1'] }],
109
- equipment: [{ name: 'Scanner', stages: ['STAGE-1'] }],
110
- }));
111
- expect(layout.aspectRows.map(r => r.category)).toEqual([
112
- 'systems',
113
- 'actors',
114
- 'equipment',
115
- 'information_entities',
116
- ]);
117
- });
118
- it('builds the legend in row order: goal, result, then aspect categories', () => {
119
- const layout = layoutProcessBlueprint(build({
120
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
121
- systems: [{ id: 'APPLICATION-X-1', name: 'X', stages: ['STAGE-1'] }],
122
- }));
123
- expect(layout.legend.map(l => l.kind)).toEqual(['goal', 'result', 'aspect']);
124
- expect(layout.legend[2].category).toBe('systems');
125
- });
126
- it('total bounds cover the legend column plus every stage column', () => {
127
- const layout = layoutProcessBlueprint(build({
128
- stages: [
129
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
130
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
131
- ],
132
- }));
133
- expect(layout.bounds.width).toBe(layout.legendColumnWidth + 2 * layout.stageColumnWidth);
134
- expect(layout.bounds.height).toBeGreaterThan(0);
135
- });
136
- it('ignores aspect entries that reference undeclared stages', () => {
137
- const layout = layoutProcessBlueprint(build({
138
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
139
- systems: [
140
- { id: 'APPLICATION-X-1', name: 'X', stages: ['STAGE-1', 'STAGE-999'] },
141
- ],
142
- }));
143
- const pills = layout.aspectRows[0].pills;
144
- expect(pills).toHaveLength(1);
145
- expect(pills[0].startStageIndex).toBe(0);
146
- expect(pills[0].endStageIndex).toBe(0);
147
- });
148
- it('honours overridden LayoutOptions', () => {
149
- const layout = layoutProcessBlueprint(build({
150
- stages: [
151
- { id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' },
152
- { id: 'STAGE-2', name: 'B', goal: 'g', result: 'r' },
153
- ],
154
- }), { legendColumnWidth: 200, stageColumnWidth: 300 });
155
- expect(layout.legendColumnWidth).toBe(200);
156
- expect(layout.stageColumnWidth).toBe(300);
157
- expect(layout.stageHeaders[1].x).toBe(200 + 300);
158
- });
159
- describe('visibleAspects', () => {
160
- const FILE_WITH_ALL = build({
161
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'g', result: 'r' }],
162
- systems: [{ name: 'OMS', stages: ['STAGE-1'] }],
163
- actors: [{ name: 'Ops', stages: ['STAGE-1'] }],
164
- equipment: [{ name: 'Printer', stages: ['STAGE-1'] }],
165
- });
166
- it('shows all categories when visibleAspects is not set', () => {
167
- const layout = layoutProcessBlueprint(FILE_WITH_ALL);
168
- expect(layout.aspectRows.map(r => r.category)).toEqual(expect.arrayContaining(['systems', 'actors', 'equipment']));
169
- expect(layout.aspectRows).toHaveLength(3);
170
- });
171
- it('limits rows to those in visibleAspects', () => {
172
- const layout = layoutProcessBlueprint(FILE_WITH_ALL, {
173
- visibleAspects: ['systems'],
174
- });
175
- expect(layout.aspectRows).toHaveLength(1);
176
- expect(layout.aspectRows[0].category).toBe('systems');
177
- });
178
- it('suppresses all aspect rows when visibleAspects is empty', () => {
179
- const layout = layoutProcessBlueprint(FILE_WITH_ALL, { visibleAspects: [] });
180
- expect(layout.aspectRows).toHaveLength(0);
181
- });
182
- it('preserves the canonical ASPECT_CATEGORIES order within the filtered set', () => {
183
- const layout = layoutProcessBlueprint(FILE_WITH_ALL, {
184
- visibleAspects: ['equipment', 'systems'],
185
- });
186
- expect(layout.aspectRows.map(r => r.category)).toEqual(['systems', 'equipment']);
187
- });
188
- it('ignores categories in visibleAspects that have no data', () => {
189
- const layout = layoutProcessBlueprint(FILE_WITH_ALL, {
190
- visibleAspects: ['systems', 'information_entities'],
191
- });
192
- expect(layout.aspectRows).toHaveLength(1);
193
- expect(layout.aspectRows[0].category).toBe('systems');
194
- });
195
- });
196
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,280 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import * as fs from 'node:fs';
3
- import * as path from 'node:path';
4
- import yaml from 'js-yaml';
5
- import { validateProcessBlueprint } from '../validate.js';
6
- const EXAMPLES_DIR = path.resolve(process.cwd(), '..', '..', 'tests', 'fixtures', 'notation-corpus', 'process-blueprint');
7
- const VALID_BLUEPRINT = {
8
- notation: 'process-blueprint',
9
- spec_version: '0.1',
10
- process_blueprint: {
11
- id: 'PROCESS_BLUEPRINT-FULFIL-1',
12
- name: 'Order fulfilment blueprint',
13
- stages: [
14
- { id: 'STAGE-1', name: 'Receive', goal: 'Capture order', result: 'Validated order' },
15
- { id: 'STAGE-2', name: 'Pack', goal: 'Assemble', result: 'Packed shipment' },
16
- { id: 'STAGE-3', name: 'Ship', goal: 'Hand to carrier', result: 'In transit' },
17
- ],
18
- systems: [
19
- { id: 'APPLICATION-OMS-1', name: 'OMS', stages: ['STAGE-1', 'STAGE-2', 'STAGE-3'] },
20
- ],
21
- actors: [
22
- { id: 'ROLE-WAREHOUSE-1', name: 'Warehouse op', stages: ['STAGE-2', 'STAGE-3'] },
23
- ],
24
- equipment: [
25
- { name: 'Barcode scanner', stages: ['STAGE-2', 'STAGE-3'] },
26
- ],
27
- information_entities: [
28
- { name: 'Customer order', stages: ['STAGE-1', 'STAGE-2', 'STAGE-3'] },
29
- ],
30
- },
31
- };
32
- describe('validateProcessBlueprint', () => {
33
- it('passes on a valid blueprint', () => {
34
- const r = validateProcessBlueprint(VALID_BLUEPRINT);
35
- expect(r.valid).toBe(true);
36
- expect(r.errors).toHaveLength(0);
37
- });
38
- it('BP-001: rejects non-object input', () => {
39
- expect(validateProcessBlueprint(null).valid).toBe(false);
40
- expect(validateProcessBlueprint(null).errors[0].code).toBe('BP-001');
41
- expect(validateProcessBlueprint('string').errors[0].code).toBe('BP-001');
42
- });
43
- it('BP-001: rejects missing process_blueprint root key', () => {
44
- const r = validateProcessBlueprint({ notation: 'process-blueprint' });
45
- expect(r.errors.some(e => e.code === 'BP-001')).toBe(true);
46
- });
47
- it('BP-001: rejects wrong notation value', () => {
48
- const r = validateProcessBlueprint({ ...VALID_BLUEPRINT, notation: 'goals' });
49
- expect(r.errors.some(e => e.code === 'BP-001')).toBe(true);
50
- });
51
- it('BP-001: tolerates a missing notation field (header check is contract-level)', () => {
52
- const { notation: _, ...rest } = VALID_BLUEPRINT;
53
- const r = validateProcessBlueprint(rest);
54
- expect(r.errors.some(e => e.code === 'BP-001')).toBe(false);
55
- });
56
- it('BP-002: rejects missing id', () => {
57
- const r = validateProcessBlueprint({
58
- ...VALID_BLUEPRINT,
59
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, id: '' },
60
- });
61
- expect(r.errors.some(e => e.code === 'BP-002')).toBe(true);
62
- });
63
- it('BP-002: rejects id that does not match PROCESS_BLUEPRINT grammar', () => {
64
- const r = validateProcessBlueprint({
65
- ...VALID_BLUEPRINT,
66
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, id: 'PB-1' },
67
- });
68
- expect(r.errors.some(e => e.code === 'BP-002')).toBe(true);
69
- });
70
- it('BP-003: rejects missing name', () => {
71
- const r = validateProcessBlueprint({
72
- ...VALID_BLUEPRINT,
73
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, name: '' },
74
- });
75
- expect(r.errors.some(e => e.code === 'BP-003')).toBe(true);
76
- });
77
- it('BP-004: rejects missing stages', () => {
78
- const { stages: _, ...rest } = VALID_BLUEPRINT.process_blueprint;
79
- const r = validateProcessBlueprint({ ...VALID_BLUEPRINT, process_blueprint: rest });
80
- expect(r.errors.some(e => e.code === 'BP-004')).toBe(true);
81
- });
82
- it('BP-004: rejects empty stages array', () => {
83
- const r = validateProcessBlueprint({
84
- ...VALID_BLUEPRINT,
85
- process_blueprint: { ...VALID_BLUEPRINT.process_blueprint, stages: [] },
86
- });
87
- expect(r.errors.some(e => e.code === 'BP-004')).toBe(true);
88
- });
89
- it('BP-005: rejects stage missing goal', () => {
90
- const r = validateProcessBlueprint({
91
- ...VALID_BLUEPRINT,
92
- process_blueprint: {
93
- ...VALID_BLUEPRINT.process_blueprint,
94
- stages: [{ id: 'STAGE-1', name: 'X', goal: '', result: 'R' }],
95
- },
96
- });
97
- expect(r.errors.some(e => e.code === 'BP-005' && /goal/.test(e.message))).toBe(true);
98
- });
99
- it('BP-005: rejects stage missing result', () => {
100
- const r = validateProcessBlueprint({
101
- ...VALID_BLUEPRINT,
102
- process_blueprint: {
103
- ...VALID_BLUEPRINT.process_blueprint,
104
- stages: [{ id: 'STAGE-1', name: 'X', goal: 'G', result: '' }],
105
- },
106
- });
107
- expect(r.errors.some(e => e.code === 'BP-005' && /result/.test(e.message))).toBe(true);
108
- });
109
- it('BP-006: rejects duplicate stage ids', () => {
110
- const r = validateProcessBlueprint({
111
- ...VALID_BLUEPRINT,
112
- process_blueprint: {
113
- ...VALID_BLUEPRINT.process_blueprint,
114
- stages: [
115
- { id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' },
116
- { id: 'STAGE-1', name: 'B', goal: 'G', result: 'R' },
117
- ],
118
- },
119
- });
120
- expect(r.errors.some(e => e.code === 'BP-006' && /Duplicate/.test(e.message))).toBe(true);
121
- });
122
- it('BP-006: treats ids that differ only in surrounding whitespace as duplicates', () => {
123
- const r = validateProcessBlueprint({
124
- ...VALID_BLUEPRINT,
125
- process_blueprint: {
126
- ...VALID_BLUEPRINT.process_blueprint,
127
- stages: [
128
- { id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' },
129
- { id: 'STAGE-1 ', name: 'B', goal: 'G', result: 'R' },
130
- ],
131
- },
132
- });
133
- expect(r.errors.some(e => e.code === 'BP-006' && /Duplicate/.test(e.message))).toBe(true);
134
- });
135
- it('BP-008: tolerates whitespace around aspect stage refs (matches trimmed stage ids)', () => {
136
- const r = validateProcessBlueprint({
137
- ...VALID_BLUEPRINT,
138
- process_blueprint: {
139
- ...VALID_BLUEPRINT.process_blueprint,
140
- stages: [{ id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' }],
141
- systems: [{ id: 'APPLICATION-X-1', name: 'X', stages: [' STAGE-1 '] }],
142
- actors: undefined,
143
- equipment: undefined,
144
- information_entities: undefined,
145
- },
146
- });
147
- expect(r.errors.some(e => e.code === 'BP-008')).toBe(false);
148
- });
149
- it('BP-006: rejects stage id that does not match STAGE grammar', () => {
150
- const r = validateProcessBlueprint({
151
- ...VALID_BLUEPRINT,
152
- process_blueprint: {
153
- ...VALID_BLUEPRINT.process_blueprint,
154
- stages: [{ id: 'STG-1', name: 'A', goal: 'G', result: 'R' }],
155
- },
156
- });
157
- expect(r.errors.some(e => e.code === 'BP-006')).toBe(true);
158
- });
159
- it('BP-007: rejects aspect entry missing name', () => {
160
- const r = validateProcessBlueprint({
161
- ...VALID_BLUEPRINT,
162
- process_blueprint: {
163
- ...VALID_BLUEPRINT.process_blueprint,
164
- systems: [{ name: '', stages: ['STAGE-1'] }],
165
- },
166
- });
167
- expect(r.errors.some(e => e.code === 'BP-007' && /name/.test(e.message))).toBe(true);
168
- });
169
- it('BP-007: rejects aspect entry with empty stages array', () => {
170
- const r = validateProcessBlueprint({
171
- ...VALID_BLUEPRINT,
172
- process_blueprint: {
173
- ...VALID_BLUEPRINT.process_blueprint,
174
- systems: [{ name: 'X', stages: [] }],
175
- },
176
- });
177
- expect(r.errors.some(e => e.code === 'BP-007' && /stages/.test(e.message))).toBe(true);
178
- });
179
- it('BP-008: rejects aspect entry referencing undeclared stage', () => {
180
- const r = validateProcessBlueprint({
181
- ...VALID_BLUEPRINT,
182
- process_blueprint: {
183
- ...VALID_BLUEPRINT.process_blueprint,
184
- systems: [{ name: 'X', stages: ['STAGE-1', 'STAGE-999'] }],
185
- },
186
- });
187
- expect(r.errors.some(e => e.code === 'BP-008')).toBe(true);
188
- });
189
- it('BP-009: rejects aspect entry id that does not match canonical grammar', () => {
190
- const r = validateProcessBlueprint({
191
- ...VALID_BLUEPRINT,
192
- process_blueprint: {
193
- ...VALID_BLUEPRINT.process_blueprint,
194
- equipment: [{ id: 'lowercase-1', name: 'X', stages: ['STAGE-1'] }],
195
- },
196
- });
197
- expect(r.errors.some(e => e.code === 'BP-009')).toBe(true);
198
- });
199
- it('BP-009: accepts an id for equipment as long as it matches general grammar', () => {
200
- const r = validateProcessBlueprint({
201
- ...VALID_BLUEPRINT,
202
- process_blueprint: {
203
- ...VALID_BLUEPRINT.process_blueprint,
204
- equipment: [{ id: 'EQUIPMENT-SCANNER-1', name: 'Barcode scanner', stages: ['STAGE-2'] }],
205
- },
206
- });
207
- expect(r.errors.some(e => e.code === 'BP-009')).toBe(false);
208
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(false);
209
- });
210
- it('BP-010: rejects systems entry id without APPLICATION- prefix', () => {
211
- const r = validateProcessBlueprint({
212
- ...VALID_BLUEPRINT,
213
- process_blueprint: {
214
- ...VALID_BLUEPRINT.process_blueprint,
215
- systems: [{ id: 'SERVICE-OMS-1', name: 'OMS', stages: ['STAGE-1'] }],
216
- },
217
- });
218
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(true);
219
- });
220
- it('BP-010: rejects actors entry id without ROLE- prefix', () => {
221
- const r = validateProcessBlueprint({
222
- ...VALID_BLUEPRINT,
223
- process_blueprint: {
224
- ...VALID_BLUEPRINT.process_blueprint,
225
- actors: [{ id: 'PERSON-1', name: 'X', stages: ['STAGE-1'] }],
226
- },
227
- });
228
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(true);
229
- });
230
- it('BP-010: accepts free-form aspect entries without id', () => {
231
- const r = validateProcessBlueprint({
232
- ...VALID_BLUEPRINT,
233
- process_blueprint: {
234
- ...VALID_BLUEPRINT.process_blueprint,
235
- systems: [{ name: 'Legacy app', stages: ['STAGE-1'] }],
236
- },
237
- });
238
- expect(r.errors.some(e => e.code === 'BP-009')).toBe(false);
239
- expect(r.errors.some(e => e.code === 'BP-010')).toBe(false);
240
- });
241
- it('BP-011: warns when a stage has no aspect entries pointing at it', () => {
242
- const r = validateProcessBlueprint({
243
- ...VALID_BLUEPRINT,
244
- process_blueprint: {
245
- ...VALID_BLUEPRINT.process_blueprint,
246
- stages: [
247
- { id: 'STAGE-1', name: 'A', goal: 'G', result: 'R' },
248
- { id: 'STAGE-99', name: 'Orphan', goal: 'G', result: 'R' },
249
- ],
250
- systems: [{ id: 'APPLICATION-OMS-1', name: 'OMS', stages: ['STAGE-1'] }],
251
- actors: undefined,
252
- equipment: undefined,
253
- information_entities: undefined,
254
- },
255
- });
256
- expect(r.warnings.some(w => w.code === 'BP-011' && /STAGE-99/.test(w.message))).toBe(true);
257
- expect(r.valid).toBe(true);
258
- });
259
- // BP-012 was removed from the spec on 2026-05-21 (methodology PR #15):
260
- // a single-stage aspect entry is normal, valid blueprint content and the
261
- // warning fired on the common case. Studio side dropped to match.
262
- it('happy path: surfaces no warnings on a well-formed multi-stage blueprint', () => {
263
- const r = validateProcessBlueprint(VALID_BLUEPRINT);
264
- expect(r.valid).toBe(true);
265
- expect(r.warnings).toHaveLength(0);
266
- });
267
- });
268
- describe('process-blueprint examples (regression)', () => {
269
- const files = fs.readdirSync(EXAMPLES_DIR).filter(f => f.endsWith('.yaml'));
270
- expect(files.length).toBeGreaterThan(0);
271
- for (const file of files) {
272
- it(`validates tests/fixtures/notation-corpus/process-blueprint/${file}`, () => {
273
- const text = fs.readFileSync(path.join(EXAMPLES_DIR, file), 'utf8');
274
- const parsed = yaml.load(text);
275
- const r = validateProcessBlueprint(parsed);
276
- expect(r.errors).toEqual([]);
277
- expect(r.valid).toBe(true);
278
- });
279
- }
280
- });
@@ -1 +0,0 @@
1
- export {};