@transitrix/diagrams 1.0.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.
- package/LICENSE +21 -0
- package/README.md +47 -0
- package/dist/__tests__/edge-path.test.d.ts +1 -0
- package/dist/__tests__/edge-path.test.js +39 -0
- package/dist/__tests__/scope.test.d.ts +1 -0
- package/dist/__tests__/scope.test.js +23 -0
- package/dist/__tests__/yaml-normalize.test.d.ts +1 -0
- package/dist/__tests__/yaml-normalize.test.js +148 -0
- package/dist/activities/__tests__/cpm.test.d.ts +1 -0
- package/dist/activities/__tests__/cpm.test.js +146 -0
- package/dist/activities/__tests__/gantt.test.d.ts +1 -0
- package/dist/activities/__tests__/gantt.test.js +224 -0
- package/dist/activities/__tests__/layout.test.d.ts +1 -0
- package/dist/activities/__tests__/layout.test.js +98 -0
- package/dist/activities/__tests__/validate.test.d.ts +1 -0
- package/dist/activities/__tests__/validate.test.js +363 -0
- package/dist/activities/cpm.d.ts +2 -0
- package/dist/activities/cpm.js +86 -0
- package/dist/activities/gantt.d.ts +6 -0
- package/dist/activities/gantt.js +250 -0
- package/dist/activities/index.d.ts +5 -0
- package/dist/activities/index.js +4 -0
- package/dist/activities/layout.d.ts +2 -0
- package/dist/activities/layout.js +103 -0
- package/dist/activities/types.d.ts +125 -0
- package/dist/activities/types.js +1 -0
- package/dist/activities/validate.d.ts +2 -0
- package/dist/activities/validate.js +326 -0
- package/dist/activity-card/__tests__/example.test.d.ts +1 -0
- package/dist/activity-card/__tests__/example.test.js +56 -0
- package/dist/activity-card/__tests__/layout.test.d.ts +1 -0
- package/dist/activity-card/__tests__/layout.test.js +57 -0
- package/dist/activity-card/__tests__/resolver.test.d.ts +1 -0
- package/dist/activity-card/__tests__/resolver.test.js +146 -0
- package/dist/activity-card/__tests__/validate.test.d.ts +1 -0
- package/dist/activity-card/__tests__/validate.test.js +116 -0
- package/dist/activity-card/index.d.ts +5 -0
- package/dist/activity-card/index.js +3 -0
- package/dist/activity-card/layout.d.ts +7 -0
- package/dist/activity-card/layout.js +167 -0
- package/dist/activity-card/resolver.d.ts +7 -0
- package/dist/activity-card/resolver.js +310 -0
- package/dist/activity-card/types.d.ts +175 -0
- package/dist/activity-card/types.js +20 -0
- package/dist/activity-card/validate.d.ts +3 -0
- package/dist/activity-card/validate.js +145 -0
- package/dist/actor/__tests__/validate.test.d.ts +1 -0
- package/dist/actor/__tests__/validate.test.js +57 -0
- package/dist/actor/index.d.ts +3 -0
- package/dist/actor/index.js +2 -0
- package/dist/actor/types.d.ts +20 -0
- package/dist/actor/types.js +4 -0
- package/dist/actor/validate.d.ts +2 -0
- package/dist/actor/validate.js +34 -0
- package/dist/applications/__tests__/validate.test.d.ts +1 -0
- package/dist/applications/__tests__/validate.test.js +223 -0
- package/dist/applications/index.d.ts +2 -0
- package/dist/applications/index.js +1 -0
- package/dist/applications/types.d.ts +39 -0
- package/dist/applications/types.js +1 -0
- package/dist/applications/validate.d.ts +3 -0
- package/dist/applications/validate.js +109 -0
- package/dist/assertion/__tests__/example.test.d.ts +1 -0
- package/dist/assertion/__tests__/example.test.js +32 -0
- package/dist/assertion/__tests__/validate.test.d.ts +1 -0
- package/dist/assertion/__tests__/validate.test.js +130 -0
- package/dist/assertion/index.d.ts +4 -0
- package/dist/assertion/index.js +2 -0
- package/dist/assertion/types.d.ts +43 -0
- package/dist/assertion/types.js +7 -0
- package/dist/assertion/validate.d.ts +9 -0
- package/dist/assertion/validate.js +137 -0
- package/dist/blocks/__tests__/layout.test.d.ts +1 -0
- package/dist/blocks/__tests__/layout.test.js +153 -0
- package/dist/blocks/__tests__/validate.test.d.ts +1 -0
- package/dist/blocks/__tests__/validate.test.js +235 -0
- package/dist/blocks/index.d.ts +4 -0
- package/dist/blocks/index.js +2 -0
- package/dist/blocks/layout.d.ts +4 -0
- package/dist/blocks/layout.js +145 -0
- package/dist/blocks/types.d.ts +56 -0
- package/dist/blocks/types.js +1 -0
- package/dist/blocks/validate.d.ts +9 -0
- package/dist/blocks/validate.js +186 -0
- package/dist/capability-map/__tests__/validate.test.d.ts +1 -0
- package/dist/capability-map/__tests__/validate.test.js +212 -0
- package/dist/capability-map/index.d.ts +2 -0
- package/dist/capability-map/index.js +1 -0
- package/dist/capability-map/types.d.ts +26 -0
- package/dist/capability-map/types.js +1 -0
- package/dist/capability-map/validate.d.ts +3 -0
- package/dist/capability-map/validate.js +103 -0
- package/dist/change/__tests__/validate.test.d.ts +1 -0
- package/dist/change/__tests__/validate.test.js +73 -0
- package/dist/change/index.d.ts +2 -0
- package/dist/change/index.js +1 -0
- package/dist/change/types.d.ts +17 -0
- package/dist/change/types.js +3 -0
- package/dist/change/validate.d.ts +2 -0
- package/dist/change/validate.js +57 -0
- package/dist/compliance/__tests__/classify.test.d.ts +1 -0
- package/dist/compliance/__tests__/classify.test.js +24 -0
- package/dist/compliance/__tests__/confidence.test.d.ts +1 -0
- package/dist/compliance/__tests__/confidence.test.js +78 -0
- package/dist/compliance/__tests__/coverage-metric.test.d.ts +1 -0
- package/dist/compliance/__tests__/coverage-metric.test.js +164 -0
- package/dist/compliance/__tests__/demo-scenario.test.d.ts +1 -0
- package/dist/compliance/__tests__/demo-scenario.test.js +226 -0
- package/dist/compliance/__tests__/example.test.d.ts +1 -0
- package/dist/compliance/__tests__/example.test.js +51 -0
- package/dist/compliance/__tests__/gap-report.test.d.ts +1 -0
- package/dist/compliance/__tests__/gap-report.test.js +113 -0
- package/dist/compliance/__tests__/html.test.d.ts +1 -0
- package/dist/compliance/__tests__/html.test.js +122 -0
- package/dist/compliance/__tests__/impact.test.d.ts +1 -0
- package/dist/compliance/__tests__/impact.test.js +410 -0
- package/dist/compliance/__tests__/markdown.test.d.ts +1 -0
- package/dist/compliance/__tests__/markdown.test.js +85 -0
- package/dist/compliance/__tests__/views.test.d.ts +1 -0
- package/dist/compliance/__tests__/views.test.js +59 -0
- package/dist/compliance/classify.d.ts +27 -0
- package/dist/compliance/classify.js +60 -0
- package/dist/compliance/confidence.d.ts +27 -0
- package/dist/compliance/confidence.js +43 -0
- package/dist/compliance/coverage-metric.d.ts +74 -0
- package/dist/compliance/coverage-metric.js +181 -0
- package/dist/compliance/gap-report.d.ts +20 -0
- package/dist/compliance/gap-report.js +64 -0
- package/dist/compliance/html.d.ts +22 -0
- package/dist/compliance/html.js +256 -0
- package/dist/compliance/impact.d.ts +251 -0
- package/dist/compliance/impact.js +464 -0
- package/dist/compliance/index.d.ts +16 -0
- package/dist/compliance/index.js +9 -0
- package/dist/compliance/markdown.d.ts +18 -0
- package/dist/compliance/markdown.js +129 -0
- package/dist/compliance/reverse-index.d.ts +8 -0
- package/dist/compliance/reverse-index.js +30 -0
- package/dist/compliance/types.d.ts +98 -0
- package/dist/compliance/types.js +5 -0
- package/dist/compliance/views.d.ts +14 -0
- package/dist/compliance/views.js +35 -0
- package/dist/compliance-matrix/__tests__/build.test.d.ts +1 -0
- package/dist/compliance-matrix/__tests__/build.test.js +183 -0
- package/dist/compliance-matrix/__tests__/example.test.d.ts +1 -0
- package/dist/compliance-matrix/__tests__/example.test.js +49 -0
- package/dist/compliance-matrix/build.d.ts +18 -0
- package/dist/compliance-matrix/build.js +0 -0
- package/dist/compliance-matrix/index.d.ts +2 -0
- package/dist/compliance-matrix/index.js +1 -0
- package/dist/compliance-matrix/types.d.ts +86 -0
- package/dist/compliance-matrix/types.js +8 -0
- package/dist/confidence/__tests__/score.test.d.ts +1 -0
- package/dist/confidence/__tests__/score.test.js +188 -0
- package/dist/confidence/index.d.ts +2 -0
- package/dist/confidence/index.js +1 -0
- package/dist/confidence/score.d.ts +62 -0
- package/dist/confidence/score.js +215 -0
- package/dist/confidence/types.d.ts +79 -0
- package/dist/confidence/types.js +6 -0
- package/dist/edge-path.d.ts +18 -0
- package/dist/edge-path.js +35 -0
- package/dist/element-envelope.d.ts +15 -0
- package/dist/element-envelope.js +55 -0
- package/dist/factor/__tests__/validate.test.d.ts +1 -0
- package/dist/factor/__tests__/validate.test.js +83 -0
- package/dist/factor/index.d.ts +3 -0
- package/dist/factor/index.js +2 -0
- package/dist/factor/types.d.ts +23 -0
- package/dist/factor/types.js +6 -0
- package/dist/factor/validate.d.ts +2 -0
- package/dist/factor/validate.js +69 -0
- package/dist/fgca/__tests__/chain-table.test.d.ts +1 -0
- package/dist/fgca/__tests__/chain-table.test.js +158 -0
- package/dist/fgca/__tests__/layout.test.d.ts +1 -0
- package/dist/fgca/__tests__/layout.test.js +140 -0
- package/dist/fgca/__tests__/parse-canonical.test.d.ts +1 -0
- package/dist/fgca/__tests__/parse-canonical.test.js +224 -0
- package/dist/fgca/__tests__/preview-layout.test.d.ts +1 -0
- package/dist/fgca/__tests__/preview-layout.test.js +106 -0
- package/dist/fgca/__tests__/validate.test.d.ts +1 -0
- package/dist/fgca/__tests__/validate.test.js +125 -0
- package/dist/fgca/chain-table.d.ts +36 -0
- package/dist/fgca/chain-table.js +177 -0
- package/dist/fgca/index.d.ts +16 -0
- package/dist/fgca/index.js +11 -0
- package/dist/fgca/layout.d.ts +27 -0
- package/dist/fgca/layout.js +156 -0
- package/dist/fgca/nodeTypes.d.ts +6 -0
- package/dist/fgca/nodeTypes.js +10 -0
- package/dist/fgca/nodes/FGCAActivityNode.d.ts +13 -0
- package/dist/fgca/nodes/FGCAActivityNode.js +35 -0
- package/dist/fgca/nodes/FGCAChangeNode.d.ts +12 -0
- package/dist/fgca/nodes/FGCAChangeNode.js +35 -0
- package/dist/fgca/nodes/FGCAFactorNode.d.ts +12 -0
- package/dist/fgca/nodes/FGCAFactorNode.js +35 -0
- package/dist/fgca/nodes/FGCAGoalNode.d.ts +14 -0
- package/dist/fgca/nodes/FGCAGoalNode.js +40 -0
- package/dist/fgca/parse-canonical.d.ts +58 -0
- package/dist/fgca/parse-canonical.js +339 -0
- package/dist/fgca/preview-layout.d.ts +87 -0
- package/dist/fgca/preview-layout.js +122 -0
- package/dist/fgca/types.d.ts +39 -0
- package/dist/fgca/types.js +7 -0
- package/dist/fgca/validate.d.ts +14 -0
- package/dist/fgca/validate.js +108 -0
- package/dist/geometry.d.ts +7 -0
- package/dist/geometry.js +2 -0
- package/dist/goals/__tests__/layout.test.d.ts +1 -0
- package/dist/goals/__tests__/layout.test.js +153 -0
- package/dist/goals/__tests__/mutations.test.d.ts +1 -0
- package/dist/goals/__tests__/mutations.test.js +95 -0
- package/dist/goals/__tests__/parse-canonical.test.d.ts +1 -0
- package/dist/goals/__tests__/parse-canonical.test.js +129 -0
- package/dist/goals/__tests__/validate.test.d.ts +1 -0
- package/dist/goals/__tests__/validate.test.js +183 -0
- package/dist/goals/index.d.ts +6 -0
- package/dist/goals/index.js +4 -0
- package/dist/goals/layout.d.ts +11 -0
- package/dist/goals/layout.js +147 -0
- package/dist/goals/mutations.d.ts +6 -0
- package/dist/goals/mutations.js +116 -0
- package/dist/goals/parse-canonical.d.ts +29 -0
- package/dist/goals/parse-canonical.js +257 -0
- package/dist/goals/types.d.ts +71 -0
- package/dist/goals/types.js +1 -0
- package/dist/goals/validate.d.ts +2 -0
- package/dist/goals/validate.js +122 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +23 -0
- package/dist/issues/__tests__/layout.test.d.ts +1 -0
- package/dist/issues/__tests__/layout.test.js +62 -0
- package/dist/issues/__tests__/validate.test.d.ts +1 -0
- package/dist/issues/__tests__/validate.test.js +82 -0
- package/dist/issues/index.d.ts +4 -0
- package/dist/issues/index.js +2 -0
- package/dist/issues/layout.d.ts +10 -0
- package/dist/issues/layout.js +82 -0
- package/dist/issues/types.d.ts +61 -0
- package/dist/issues/types.js +6 -0
- package/dist/issues/validate.d.ts +3 -0
- package/dist/issues/validate.js +143 -0
- package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +1 -0
- package/dist/process-blueprint/__tests__/compliance-lane.test.js +272 -0
- package/dist/process-blueprint/__tests__/layout.test.d.ts +1 -0
- package/dist/process-blueprint/__tests__/layout.test.js +159 -0
- package/dist/process-blueprint/__tests__/validate.test.d.ts +1 -0
- package/dist/process-blueprint/__tests__/validate.test.js +280 -0
- package/dist/process-blueprint/index.d.ts +4 -0
- package/dist/process-blueprint/index.js +2 -0
- package/dist/process-blueprint/layout.d.ts +2 -0
- package/dist/process-blueprint/layout.js +416 -0
- package/dist/process-blueprint/types.d.ts +220 -0
- package/dist/process-blueprint/types.js +1 -0
- package/dist/process-blueprint/validate.d.ts +3 -0
- package/dist/process-blueprint/validate.js +165 -0
- package/dist/process-map/__tests__/validate.test.d.ts +1 -0
- package/dist/process-map/__tests__/validate.test.js +199 -0
- package/dist/process-map/index.d.ts +2 -0
- package/dist/process-map/index.js +1 -0
- package/dist/process-map/types.d.ts +32 -0
- package/dist/process-map/types.js +1 -0
- package/dist/process-map/validate.d.ts +3 -0
- package/dist/process-map/validate.js +115 -0
- package/dist/products/__tests__/validate.test.d.ts +1 -0
- package/dist/products/__tests__/validate.test.js +210 -0
- package/dist/products/index.d.ts +2 -0
- package/dist/products/index.js +1 -0
- package/dist/products/types.d.ts +28 -0
- package/dist/products/types.js +1 -0
- package/dist/products/validate.d.ts +3 -0
- package/dist/products/validate.js +93 -0
- package/dist/repo-validate/__tests__/validate-repo.test.d.ts +1 -0
- package/dist/repo-validate/__tests__/validate-repo.test.js +132 -0
- package/dist/repo-validate/index.d.ts +2 -0
- package/dist/repo-validate/index.js +1 -0
- package/dist/repo-validate/types.d.ts +34 -0
- package/dist/repo-validate/types.js +14 -0
- package/dist/repo-validate/validate-repo.d.ts +8 -0
- package/dist/repo-validate/validate-repo.js +189 -0
- package/dist/requirement/__tests__/example.test.d.ts +1 -0
- package/dist/requirement/__tests__/example.test.js +21 -0
- package/dist/requirement/__tests__/validate.test.d.ts +1 -0
- package/dist/requirement/__tests__/validate.test.js +80 -0
- package/dist/requirement/index.d.ts +4 -0
- package/dist/requirement/index.js +2 -0
- package/dist/requirement/types.d.ts +25 -0
- package/dist/requirement/types.js +4 -0
- package/dist/requirement/validate.d.ts +7 -0
- package/dist/requirement/validate.js +81 -0
- package/dist/scenarios/__tests__/validate.test.d.ts +1 -0
- package/dist/scenarios/__tests__/validate.test.js +183 -0
- package/dist/scenarios/index.d.ts +2 -0
- package/dist/scenarios/index.js +1 -0
- package/dist/scenarios/types.d.ts +45 -0
- package/dist/scenarios/types.js +1 -0
- package/dist/scenarios/validate.d.ts +3 -0
- package/dist/scenarios/validate.js +110 -0
- package/dist/schema-version.d.ts +16 -0
- package/dist/schema-version.js +16 -0
- package/dist/scope.d.ts +23 -0
- package/dist/scope.js +38 -0
- package/dist/stakeholder/__tests__/validate.test.d.ts +1 -0
- package/dist/stakeholder/__tests__/validate.test.js +86 -0
- package/dist/stakeholder/index.d.ts +3 -0
- package/dist/stakeholder/index.js +2 -0
- package/dist/stakeholder/types.d.ts +24 -0
- package/dist/stakeholder/types.js +5 -0
- package/dist/stakeholder/validate.d.ts +2 -0
- package/dist/stakeholder/validate.js +58 -0
- package/dist/target-state/__tests__/validate.test.d.ts +1 -0
- package/dist/target-state/__tests__/validate.test.js +62 -0
- package/dist/target-state/index.d.ts +2 -0
- package/dist/target-state/index.js +1 -0
- package/dist/target-state/types.d.ts +18 -0
- package/dist/target-state/types.js +7 -0
- package/dist/target-state/validate.d.ts +2 -0
- package/dist/target-state/validate.js +61 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/themes.d.ts +16 -0
- package/dist/theme/themes.js +213 -0
- package/dist/theme/tokens.d.ts +158 -0
- package/dist/theme/tokens.js +105 -0
- package/dist/typed-id.d.ts +20 -0
- package/dist/typed-id.js +38 -0
- package/dist/validation-types.d.ts +34 -0
- package/dist/validation-types.js +1 -0
- package/dist/webview/__tests__/entry-notations.test.d.ts +1 -0
- package/dist/webview/__tests__/entry-notations.test.js +62 -0
- package/dist/webview/__tests__/entry.test.d.ts +1 -0
- package/dist/webview/__tests__/entry.test.js +56 -0
- package/dist/webview/__tests__/render-goals.test.d.ts +1 -0
- package/dist/webview/__tests__/render-goals.test.js +65 -0
- package/dist/webview/entry.d.ts +38 -0
- package/dist/webview/entry.js +182 -0
- package/dist/webview/render-activities.d.ts +24 -0
- package/dist/webview/render-activities.js +127 -0
- package/dist/webview/render-activity-card.d.ts +5 -0
- package/dist/webview/render-activity-card.js +168 -0
- package/dist/webview/render-applications.d.ts +11 -0
- package/dist/webview/render-applications.js +105 -0
- package/dist/webview/render-blocks.d.ts +5 -0
- package/dist/webview/render-blocks.js +71 -0
- package/dist/webview/render-capability-map.d.ts +7 -0
- package/dist/webview/render-capability-map.js +88 -0
- package/dist/webview/render-fgca.d.ts +8 -0
- package/dist/webview/render-fgca.js +94 -0
- package/dist/webview/render-goals.d.ts +6 -0
- package/dist/webview/render-goals.js +92 -0
- package/dist/webview/render-process-blueprint.d.ts +5 -0
- package/dist/webview/render-process-blueprint.js +135 -0
- package/dist/webview/render-process-map.d.ts +7 -0
- package/dist/webview/render-process-map.js +82 -0
- package/dist/webview/render-products.d.ts +7 -0
- package/dist/webview/render-products.js +81 -0
- package/dist/webview/render-scenarios.d.ts +7 -0
- package/dist/webview/render-scenarios.js +75 -0
- package/dist/webview/render-util.d.ts +16 -0
- package/dist/webview/render-util.js +31 -0
- package/dist/webview/transitrix-render.css +323 -0
- package/dist/webview/transitrix-render.js +6452 -0
- package/dist/webview/transitrix-render.js.map +7 -0
- package/dist/yaml-normalize.d.ts +20 -0
- package/dist/yaml-normalize.js +57 -0
- package/package.json +40 -0
- package/src/__tests__/edge-path.test.ts +46 -0
- package/src/__tests__/scope.test.ts +27 -0
- package/src/__tests__/yaml-normalize.test.ts +158 -0
- package/src/activities/__tests__/cpm.test.ts +164 -0
- package/src/activities/__tests__/gantt.test.ts +245 -0
- package/src/activities/__tests__/layout.test.ts +112 -0
- package/src/activities/__tests__/validate.test.ts +409 -0
- package/src/activities/cpm.ts +95 -0
- package/src/activities/gantt.ts +276 -0
- package/src/activities/index.ts +28 -0
- package/src/activities/layout.ts +112 -0
- package/src/activities/types.ts +148 -0
- package/src/activities/validate.ts +357 -0
- package/src/activity-card/__tests__/example.test.ts +66 -0
- package/src/activity-card/__tests__/layout.test.ts +63 -0
- package/src/activity-card/__tests__/resolver.test.ts +161 -0
- package/src/activity-card/__tests__/validate.test.ts +131 -0
- package/src/activity-card/index.ts +32 -0
- package/src/activity-card/layout.ts +194 -0
- package/src/activity-card/resolver.ts +337 -0
- package/src/activity-card/types.ts +237 -0
- package/src/activity-card/validate.ts +158 -0
- package/src/actor/__tests__/validate.test.ts +67 -0
- package/src/actor/index.ts +3 -0
- package/src/actor/types.ts +29 -0
- package/src/actor/validate.ts +38 -0
- package/src/applications/__tests__/validate.test.ts +256 -0
- package/src/applications/index.ts +11 -0
- package/src/applications/types.ts +43 -0
- package/src/applications/validate.ts +131 -0
- package/src/assertion/__tests__/example.test.ts +37 -0
- package/src/assertion/__tests__/validate.test.ts +142 -0
- package/src/assertion/index.ts +12 -0
- package/src/assertion/types.ts +58 -0
- package/src/assertion/validate.ts +145 -0
- package/src/blocks/__tests__/layout.test.ts +169 -0
- package/src/blocks/__tests__/validate.test.ts +260 -0
- package/src/blocks/index.ts +17 -0
- package/src/blocks/layout.ts +186 -0
- package/src/blocks/types.ts +62 -0
- package/src/blocks/validate.ts +206 -0
- package/src/capability-map/__tests__/validate.test.ts +238 -0
- package/src/capability-map/index.ts +8 -0
- package/src/capability-map/types.ts +29 -0
- package/src/capability-map/validate.ts +127 -0
- package/src/change/__tests__/validate.test.ts +88 -0
- package/src/change/index.ts +2 -0
- package/src/change/types.ts +23 -0
- package/src/change/validate.ts +61 -0
- package/src/compliance/__tests__/classify.test.ts +27 -0
- package/src/compliance/__tests__/confidence.test.ts +98 -0
- package/src/compliance/__tests__/coverage-metric.test.ts +188 -0
- package/src/compliance/__tests__/demo-scenario.test.ts +273 -0
- package/src/compliance/__tests__/example.test.ts +57 -0
- package/src/compliance/__tests__/gap-report.test.ts +129 -0
- package/src/compliance/__tests__/html.test.ts +142 -0
- package/src/compliance/__tests__/impact.test.ts +482 -0
- package/src/compliance/__tests__/markdown.test.ts +95 -0
- package/src/compliance/__tests__/views.test.ts +64 -0
- package/src/compliance/classify.ts +84 -0
- package/src/compliance/confidence.ts +69 -0
- package/src/compliance/coverage-metric.ts +263 -0
- package/src/compliance/gap-report.ts +94 -0
- package/src/compliance/html.ts +295 -0
- package/src/compliance/impact.ts +677 -0
- package/src/compliance/index.ts +56 -0
- package/src/compliance/markdown.ts +135 -0
- package/src/compliance/reverse-index.ts +33 -0
- package/src/compliance/types.ts +120 -0
- package/src/compliance/views.ts +46 -0
- package/src/compliance-matrix/__tests__/build.test.ts +200 -0
- package/src/compliance-matrix/__tests__/example.test.ts +57 -0
- package/src/compliance-matrix/build.ts +0 -0
- package/src/compliance-matrix/index.ts +11 -0
- package/src/compliance-matrix/types.ts +102 -0
- package/src/confidence/__tests__/score.test.ts +254 -0
- package/src/confidence/index.ts +21 -0
- package/src/confidence/score.ts +243 -0
- package/src/confidence/types.ts +96 -0
- package/src/edge-path.ts +44 -0
- package/src/element-envelope.ts +76 -0
- package/src/factor/__tests__/validate.test.ts +98 -0
- package/src/factor/index.ts +8 -0
- package/src/factor/types.ts +41 -0
- package/src/factor/validate.ts +74 -0
- package/src/fgca/__tests__/chain-table.test.ts +172 -0
- package/src/fgca/__tests__/layout.test.ts +179 -0
- package/src/fgca/__tests__/parse-canonical.test.ts +248 -0
- package/src/fgca/__tests__/preview-layout.test.ts +124 -0
- package/src/fgca/__tests__/validate.test.ts +142 -0
- package/src/fgca/chain-table.ts +225 -0
- package/src/fgca/index.ts +45 -0
- package/src/fgca/layout.ts +204 -0
- package/src/fgca/nodeTypes.ts +11 -0
- package/src/fgca/nodes/FGCAActivityNode.tsx +65 -0
- package/src/fgca/nodes/FGCAChangeNode.tsx +64 -0
- package/src/fgca/nodes/FGCAFactorNode.tsx +64 -0
- package/src/fgca/nodes/FGCAGoalNode.tsx +72 -0
- package/src/fgca/parse-canonical.ts +400 -0
- package/src/fgca/preview-layout.ts +217 -0
- package/src/fgca/types.ts +50 -0
- package/src/fgca/validate.ts +126 -0
- package/src/geometry.ts +9 -0
- package/src/goals/__tests__/layout.test.ts +175 -0
- package/src/goals/__tests__/mutations.test.ts +111 -0
- package/src/goals/__tests__/parse-canonical.test.ts +145 -0
- package/src/goals/__tests__/validate.test.ts +202 -0
- package/src/goals/index.ts +21 -0
- package/src/goals/layout.ts +172 -0
- package/src/goals/mutations.ts +123 -0
- package/src/goals/parse-canonical.ts +286 -0
- package/src/goals/types.ts +85 -0
- package/src/goals/validate.ts +136 -0
- package/src/index.ts +23 -0
- package/src/process-blueprint/__tests__/compliance-lane.test.ts +320 -0
- package/src/process-blueprint/__tests__/layout.test.ts +195 -0
- package/src/process-blueprint/__tests__/validate.test.ts +310 -0
- package/src/process-blueprint/index.ts +31 -0
- package/src/process-blueprint/layout.ts +531 -0
- package/src/process-blueprint/types.ts +242 -0
- package/src/process-blueprint/validate.ts +181 -0
- package/src/process-map/__tests__/validate.test.ts +223 -0
- package/src/process-map/index.ts +10 -0
- package/src/process-map/types.ts +36 -0
- package/src/process-map/validate.ts +135 -0
- package/src/products/__tests__/validate.test.ts +239 -0
- package/src/products/index.ts +9 -0
- package/src/products/types.ts +31 -0
- package/src/products/validate.ts +112 -0
- package/src/repo-validate/__tests__/validate-repo.test.ts +149 -0
- package/src/repo-validate/index.ts +2 -0
- package/src/repo-validate/types.ts +50 -0
- package/src/repo-validate/validate-repo.ts +196 -0
- package/src/requirement/__tests__/example.test.ts +24 -0
- package/src/requirement/__tests__/validate.test.ts +96 -0
- package/src/requirement/index.ts +4 -0
- package/src/requirement/types.ts +35 -0
- package/src/requirement/validate.ts +92 -0
- package/src/scenarios/__tests__/validate.test.ts +209 -0
- package/src/scenarios/index.ts +15 -0
- package/src/scenarios/types.ts +37 -0
- package/src/scenarios/validate.ts +122 -0
- package/src/schema-version.ts +16 -0
- package/src/scope.ts +46 -0
- package/src/stakeholder/__tests__/validate.test.ts +101 -0
- package/src/stakeholder/index.ts +3 -0
- package/src/stakeholder/types.ts +33 -0
- package/src/stakeholder/validate.ts +63 -0
- package/src/target-state/__tests__/validate.test.ts +74 -0
- package/src/target-state/index.ts +2 -0
- package/src/target-state/types.ts +28 -0
- package/src/target-state/validate.ts +67 -0
- package/src/theme/index.ts +4 -0
- package/src/theme/themes.ts +237 -0
- package/src/theme/tokens.ts +133 -0
- package/src/typed-id.ts +56 -0
- package/src/validation-types.ts +36 -0
- package/src/webview/__tests__/entry-notations.test.ts +77 -0
- package/src/webview/__tests__/entry.test.ts +64 -0
- package/src/webview/__tests__/render-goals.test.ts +72 -0
- package/src/webview/entry.ts +292 -0
- package/src/webview/render-activities.ts +156 -0
- package/src/webview/render-activity-card.ts +234 -0
- package/src/webview/render-applications.ts +123 -0
- package/src/webview/render-blocks.ts +91 -0
- package/src/webview/render-capability-map.ts +98 -0
- package/src/webview/render-fgca.ts +122 -0
- package/src/webview/render-goals.ts +110 -0
- package/src/webview/render-process-blueprint.ts +207 -0
- package/src/webview/render-process-map.ts +93 -0
- package/src/webview/render-products.ts +91 -0
- package/src/webview/render-scenarios.ts +90 -0
- package/src/webview/render-util.ts +34 -0
- package/src/webview/styles.css +323 -0
- package/src/yaml-normalize.ts +56 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Reverse-index builder (vkgeorgia/strategy#84 Phase 3).
|
|
2
|
+
function push(map, key, value) {
|
|
3
|
+
const list = map.get(key);
|
|
4
|
+
if (list)
|
|
5
|
+
list.push(value);
|
|
6
|
+
else
|
|
7
|
+
map.set(key, [value]);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Builds the reverse indexes used by every compliance view. Pure; the input
|
|
11
|
+
* arrays are read, not mutated. Requirements with no `derived_from` simply do
|
|
12
|
+
* not appear under any law; assertions are indexed by both their requirement
|
|
13
|
+
* (`about`) and their subject.
|
|
14
|
+
*/
|
|
15
|
+
export function buildComplianceIndex(input) {
|
|
16
|
+
const requirementById = new Map();
|
|
17
|
+
const requirementsByLaw = new Map();
|
|
18
|
+
const assertionsByRequirement = new Map();
|
|
19
|
+
const assertionsBySubject = new Map();
|
|
20
|
+
for (const r of input.requirements) {
|
|
21
|
+
requirementById.set(r.id, r);
|
|
22
|
+
for (const law of r.derived_from ?? [])
|
|
23
|
+
push(requirementsByLaw, law, r);
|
|
24
|
+
}
|
|
25
|
+
for (const a of input.assertions) {
|
|
26
|
+
push(assertionsByRequirement, a.about, a);
|
|
27
|
+
push(assertionsBySubject, a.subject, a);
|
|
28
|
+
}
|
|
29
|
+
return { requirementById, requirementsByLaw, assertionsByRequirement, assertionsBySubject };
|
|
30
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { AssertionStatus } from '../assertion/types.js';
|
|
2
|
+
/** Projection of a REQUIREMENT the compliance views need. */
|
|
3
|
+
export interface IndexRequirement {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
severity?: string;
|
|
7
|
+
/** Typed IDs of the codex sources this requirement derives from. */
|
|
8
|
+
derived_from?: string[];
|
|
9
|
+
/** Admission date (CONTRACT §6) — feeds DQ-1 freshness decay. */
|
|
10
|
+
admitted_at?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Compliance deadline (ISO 8601 date, YYYY-MM-DD).
|
|
13
|
+
* When a gap exists on a cell whose requirement carries a deadline that is
|
|
14
|
+
* past or imminent, CV-3 renders an urgent decoration on the cell.
|
|
15
|
+
*/
|
|
16
|
+
deadline?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Temporal status of a requirement deadline relative to today.
|
|
20
|
+
*
|
|
21
|
+
* - `past_due` — deadline has already passed (`deadline < today`).
|
|
22
|
+
* - `in_force` — deadline is within the next 30 days.
|
|
23
|
+
* - `upcoming` — deadline is more than 30 days away.
|
|
24
|
+
* - `none` — no deadline set.
|
|
25
|
+
*/
|
|
26
|
+
export type DeadlineStatus = 'past_due' | 'in_force' | 'upcoming' | 'none';
|
|
27
|
+
/** Projection of an ASSERTION the compliance views need. */
|
|
28
|
+
export interface IndexAssertion {
|
|
29
|
+
id: string;
|
|
30
|
+
about: string;
|
|
31
|
+
subject: string;
|
|
32
|
+
status: AssertionStatus;
|
|
33
|
+
assessed_at?: string;
|
|
34
|
+
next_review_at?: string;
|
|
35
|
+
/** Number of evidence entries — feeds the Phase 4 "no evidence" gap. */
|
|
36
|
+
evidenceCount?: number;
|
|
37
|
+
/** Admission date (CONTRACT §6) — feeds DQ-1 freshness decay. */
|
|
38
|
+
admitted_at?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Typed IDs of the stages / tasks where the requirement is realised for
|
|
41
|
+
* the subject (16-assertion.md §2 `realised_via`). Populated when the
|
|
42
|
+
* assertion carries granular evidence; absent when the claim covers the
|
|
43
|
+
* entire subject without stage decomposition. CV-3a uses this to fill
|
|
44
|
+
* stage-grouped matrix cells.
|
|
45
|
+
*/
|
|
46
|
+
realised_via?: string[];
|
|
47
|
+
}
|
|
48
|
+
/** One detail-level element of a business object, used as a matrix sub-column. */
|
|
49
|
+
export interface ObjectDetailDef {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Maps a business object to its ordered detail elements.
|
|
55
|
+
* Passed into `buildImpactMatrix` when `grouping.columns` is
|
|
56
|
+
* `object-details`. The details can be process stages, product
|
|
57
|
+
* components, capability modules, etc. — whatever sub-structure the object
|
|
58
|
+
* exposes. Typically extracted from a process-blueprint via`extractObjectDetails`.
|
|
59
|
+
*/
|
|
60
|
+
export interface ObjectDetailInput {
|
|
61
|
+
objectId: string;
|
|
62
|
+
details: ObjectDetailDef[];
|
|
63
|
+
}
|
|
64
|
+
export interface ComplianceIndexInput {
|
|
65
|
+
requirements: IndexRequirement[];
|
|
66
|
+
assertions: IndexAssertion[];
|
|
67
|
+
}
|
|
68
|
+
/** The reverse-index — all maps are keyed by canonical id. */
|
|
69
|
+
export interface ComplianceIndex {
|
|
70
|
+
requirementById: Map<string, IndexRequirement>;
|
|
71
|
+
/** Codex artefact id → requirements whose `derived_from` names it. */
|
|
72
|
+
requirementsByLaw: Map<string, IndexRequirement[]>;
|
|
73
|
+
/** Requirement id → assertions whose `about` names it. */
|
|
74
|
+
assertionsByRequirement: Map<string, IndexAssertion[]>;
|
|
75
|
+
/** Subject id (product / process / capability) → assertions about it. */
|
|
76
|
+
assertionsBySubject: Map<string, IndexAssertion[]>;
|
|
77
|
+
}
|
|
78
|
+
export interface LawTreeRequirement {
|
|
79
|
+
requirement: IndexRequirement;
|
|
80
|
+
/** Assertions targeting this requirement, id-sorted. */
|
|
81
|
+
assertions: IndexAssertion[];
|
|
82
|
+
}
|
|
83
|
+
export interface LawTree {
|
|
84
|
+
lawId: string;
|
|
85
|
+
/** Requirements derived from the law, id-sorted. */
|
|
86
|
+
requirements: LawTreeRequirement[];
|
|
87
|
+
}
|
|
88
|
+
export interface ProductRequirementStatus {
|
|
89
|
+
/** The requirement the assertion is about. `name` falls back to the id when
|
|
90
|
+
* the requirement is not present in the scan (dangling `about`). */
|
|
91
|
+
requirement: IndexRequirement;
|
|
92
|
+
assertion: IndexAssertion;
|
|
93
|
+
}
|
|
94
|
+
export interface ProductView {
|
|
95
|
+
productId: string;
|
|
96
|
+
/** Requirements bound to the product via an assertion, requirement-id-sorted. */
|
|
97
|
+
requirements: ProductRequirementStatus[];
|
|
98
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// Shared compliance reverse-index + derived views (vkgeorgia/strategy#84
|
|
2
|
+
// Phase 3). The reverse-index pass (Law → Requirements, Requirement →
|
|
3
|
+
// Assertions, Subject → Assertions) backs the single-law tree and the
|
|
4
|
+
// single-product view here, and the gap dashboard in Phase 4.
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ComplianceIndex, LawTree, ProductView } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Law → Requirements → Assertions. Requirements are those whose `derived_from`
|
|
4
|
+
* names `lawId`; each carries the assertions targeting it. An unknown law (no
|
|
5
|
+
* requirement derives from it) yields an empty tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildLawTree(lawId: string, index: ComplianceIndex): LawTree;
|
|
8
|
+
/**
|
|
9
|
+
* Product → the Requirements it has an assertion about, with each assertion's
|
|
10
|
+
* status. The requirement is resolved from the index; a dangling `about`
|
|
11
|
+
* (assertion references a requirement not in the scan) falls back to a stub
|
|
12
|
+
* carrying the id as its name, so the binding still shows.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildProductView(productId: string, index: ComplianceIndex): ProductView;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Single-law tree + single-product view builders (vkgeorgia/strategy#84 Phase 3).
|
|
2
|
+
function byId(a, b) {
|
|
3
|
+
return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Law → Requirements → Assertions. Requirements are those whose `derived_from`
|
|
7
|
+
* names `lawId`; each carries the assertions targeting it. An unknown law (no
|
|
8
|
+
* requirement derives from it) yields an empty tree.
|
|
9
|
+
*/
|
|
10
|
+
export function buildLawTree(lawId, index) {
|
|
11
|
+
const requirements = [...(index.requirementsByLaw.get(lawId) ?? [])].sort(byId);
|
|
12
|
+
return {
|
|
13
|
+
lawId,
|
|
14
|
+
requirements: requirements.map(requirement => ({
|
|
15
|
+
requirement,
|
|
16
|
+
assertions: [...(index.assertionsByRequirement.get(requirement.id) ?? [])].sort(byId),
|
|
17
|
+
})),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Product → the Requirements it has an assertion about, with each assertion's
|
|
22
|
+
* status. The requirement is resolved from the index; a dangling `about`
|
|
23
|
+
* (assertion references a requirement not in the scan) falls back to a stub
|
|
24
|
+
* carrying the id as its name, so the binding still shows.
|
|
25
|
+
*/
|
|
26
|
+
export function buildProductView(productId, index) {
|
|
27
|
+
const assertions = [...(index.assertionsBySubject.get(productId) ?? [])];
|
|
28
|
+
const requirements = assertions
|
|
29
|
+
.map(assertion => {
|
|
30
|
+
const requirement = index.requirementById.get(assertion.about) ?? { id: assertion.about, name: assertion.about };
|
|
31
|
+
return { requirement, assertion };
|
|
32
|
+
})
|
|
33
|
+
.sort((a, b) => byId(a.requirement, b.requirement));
|
|
34
|
+
return { productId, requirements };
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { buildComplianceMatrix, filterComplianceMatrix } from '../build.js';
|
|
3
|
+
function input(over = {}) {
|
|
4
|
+
return {
|
|
5
|
+
products: [
|
|
6
|
+
{ id: 'PRODUCT-ECOMM-1', name: 'E-Commerce' },
|
|
7
|
+
{ id: 'PRODUCT-SUPPORT-1', name: 'Support' },
|
|
8
|
+
],
|
|
9
|
+
requirements: [
|
|
10
|
+
{ id: 'REQUIREMENT-DATA-ERASURE-1', name: 'Erasure', severity: 'high' },
|
|
11
|
+
{ id: 'REQUIREMENT-AUDIT-LOG-RETENTION-1', name: 'Audit logs', severity: 'medium' },
|
|
12
|
+
],
|
|
13
|
+
assertions: [
|
|
14
|
+
{ id: 'ASSERTION-1', about: 'REQUIREMENT-DATA-ERASURE-1', subject: 'PRODUCT-ECOMM-1', status: 'compliant' },
|
|
15
|
+
],
|
|
16
|
+
...over,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
describe('buildComplianceMatrix', () => {
|
|
20
|
+
it('sorts products as rows and requirements as columns by id', () => {
|
|
21
|
+
const m = buildComplianceMatrix(input());
|
|
22
|
+
expect(m.products.map(p => p.id)).toEqual(['PRODUCT-ECOMM-1', 'PRODUCT-SUPPORT-1']);
|
|
23
|
+
expect(m.requirements.map(r => r.id)).toEqual([
|
|
24
|
+
'REQUIREMENT-AUDIT-LOG-RETENTION-1',
|
|
25
|
+
'REQUIREMENT-DATA-ERASURE-1',
|
|
26
|
+
]);
|
|
27
|
+
});
|
|
28
|
+
it('places an assertion status in the (product, requirement) cell and gaps elsewhere', () => {
|
|
29
|
+
const m = buildComplianceMatrix(input());
|
|
30
|
+
// row 0 = ECOMM; col 1 = DATA-ERASURE (after the sort)
|
|
31
|
+
expect(m.cells[0][1]).toMatchObject({ status: 'compliant', assertionId: 'ASSERTION-1' });
|
|
32
|
+
expect(m.cells[0][0].status).toBeUndefined(); // ECOMM × AUDIT-LOG → gap
|
|
33
|
+
expect(m.cells[1][1].status).toBeUndefined(); // SUPPORT × DATA-ERASURE → gap
|
|
34
|
+
expect(m.summary).toMatchObject({ products: 2, requirements: 2, assertions: 1, gaps: 3 });
|
|
35
|
+
});
|
|
36
|
+
it('adds a product-typed assertion subject with no product file as an unresolved row', () => {
|
|
37
|
+
const m = buildComplianceMatrix(input({
|
|
38
|
+
assertions: [
|
|
39
|
+
{ id: 'A1', about: 'REQUIREMENT-DATA-ERASURE-1', subject: 'PRODUCT-MOBILE-1', status: 'partial' },
|
|
40
|
+
],
|
|
41
|
+
}));
|
|
42
|
+
const mobile = m.products.find(p => p.id === 'PRODUCT-MOBILE-1');
|
|
43
|
+
expect(mobile).toMatchObject({ unresolved: true });
|
|
44
|
+
const col = m.requirements.findIndex(r => r.id === 'REQUIREMENT-DATA-ERASURE-1');
|
|
45
|
+
const row = m.products.findIndex(p => p.id === 'PRODUCT-MOBILE-1');
|
|
46
|
+
expect(m.cells[row][col].status).toBe('partial');
|
|
47
|
+
});
|
|
48
|
+
it('ignores assertions whose subject is not a PRODUCT', () => {
|
|
49
|
+
const m = buildComplianceMatrix(input({
|
|
50
|
+
assertions: [
|
|
51
|
+
{ id: 'A1', about: 'REQUIREMENT-DATA-ERASURE-1', subject: 'CAPABILITY-V2', status: 'compliant' },
|
|
52
|
+
{ id: 'A2', about: 'REQUIREMENT-DATA-ERASURE-1', subject: 'PROCESS-X-1', status: 'partial' },
|
|
53
|
+
],
|
|
54
|
+
}));
|
|
55
|
+
expect(m.summary.assertions).toBe(0);
|
|
56
|
+
expect(m.products.map(p => p.id)).toEqual(['PRODUCT-ECOMM-1', 'PRODUCT-SUPPORT-1']);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
describe('buildComplianceMatrix — jurisdiction resolution (F16)', () => {
|
|
60
|
+
it('resolves Requirement.jurisdictions from derived_from → codex', () => {
|
|
61
|
+
const m = buildComplianceMatrix(input({
|
|
62
|
+
requirements: [
|
|
63
|
+
{ id: 'REQUIREMENT-DATA-ERASURE-1', name: 'Erasure', severity: 'high',
|
|
64
|
+
derived_from: ['LAW-PERSONAL-DATA-2017-1'] },
|
|
65
|
+
{ id: 'REQUIREMENT-AUDIT-LOG-RETENTION-1', name: 'Audit logs', severity: 'medium',
|
|
66
|
+
derived_from: ['LAW-AUDIT-2020-1', 'LAW-PERSONAL-DATA-2017-1'] },
|
|
67
|
+
],
|
|
68
|
+
codex: [
|
|
69
|
+
{ id: 'LAW-PERSONAL-DATA-2017-1', jurisdiction: 'ge' },
|
|
70
|
+
{ id: 'LAW-AUDIT-2020-1', jurisdiction: 'eu' },
|
|
71
|
+
],
|
|
72
|
+
}));
|
|
73
|
+
const erasure = m.requirements.find(r => r.id === 'REQUIREMENT-DATA-ERASURE-1');
|
|
74
|
+
const audit = m.requirements.find(r => r.id === 'REQUIREMENT-AUDIT-LOG-RETENTION-1');
|
|
75
|
+
expect(erasure.jurisdictions).toEqual(['ge']);
|
|
76
|
+
// Sorted, deduplicated union.
|
|
77
|
+
expect(audit.jurisdictions).toEqual(['eu', 'ge']);
|
|
78
|
+
});
|
|
79
|
+
it('leaves jurisdictions undefined when no codex source resolves', () => {
|
|
80
|
+
const m = buildComplianceMatrix(input({
|
|
81
|
+
requirements: [
|
|
82
|
+
{ id: 'REQUIREMENT-INTERNAL-1', name: 'Internal', severity: 'low' },
|
|
83
|
+
{ id: 'REQUIREMENT-DANGLING-1', name: 'Dangling', severity: 'low',
|
|
84
|
+
derived_from: ['LAW-MISSING-1'] },
|
|
85
|
+
],
|
|
86
|
+
codex: [{ id: 'LAW-OTHER-1', jurisdiction: 'us' }],
|
|
87
|
+
}));
|
|
88
|
+
expect(m.requirements.find(r => r.id === 'REQUIREMENT-INTERNAL-1').jurisdictions).toBeUndefined();
|
|
89
|
+
expect(m.requirements.find(r => r.id === 'REQUIREMENT-DANGLING-1').jurisdictions).toBeUndefined();
|
|
90
|
+
});
|
|
91
|
+
it('ignores codex entries with no jurisdiction (e.g. internal POLICY)', () => {
|
|
92
|
+
const m = buildComplianceMatrix(input({
|
|
93
|
+
requirements: [
|
|
94
|
+
{ id: 'REQUIREMENT-DATA-ERASURE-1', name: 'Erasure', severity: 'high',
|
|
95
|
+
derived_from: ['POLICY-INTERNAL-1'] },
|
|
96
|
+
],
|
|
97
|
+
codex: [{ id: 'POLICY-INTERNAL-1' }],
|
|
98
|
+
}));
|
|
99
|
+
expect(m.requirements[0].jurisdictions).toBeUndefined();
|
|
100
|
+
});
|
|
101
|
+
it('works with no codex input (backwards-compatible)', () => {
|
|
102
|
+
const m = buildComplianceMatrix(input({
|
|
103
|
+
requirements: [
|
|
104
|
+
{ id: 'REQUIREMENT-DATA-ERASURE-1', name: 'Erasure', severity: 'high',
|
|
105
|
+
derived_from: ['LAW-PERSONAL-DATA-2017-1'] },
|
|
106
|
+
],
|
|
107
|
+
}));
|
|
108
|
+
expect(m.requirements[0].jurisdictions).toBeUndefined();
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe('filterComplianceMatrix', () => {
|
|
112
|
+
it('trims requirement columns by severity', () => {
|
|
113
|
+
const m = buildComplianceMatrix(input());
|
|
114
|
+
const f = filterComplianceMatrix(m, { severities: ['high'] });
|
|
115
|
+
expect(f.requirements.map(r => r.id)).toEqual(['REQUIREMENT-DATA-ERASURE-1']);
|
|
116
|
+
expect(f.cells[0]).toHaveLength(1);
|
|
117
|
+
expect(f.cells[0][0]).toMatchObject({ status: 'compliant' });
|
|
118
|
+
});
|
|
119
|
+
it('blanks cells whose status is filtered out, preserving the grid shape', () => {
|
|
120
|
+
const m = buildComplianceMatrix(input());
|
|
121
|
+
const f = filterComplianceMatrix(m, { statuses: ['non_compliant'] });
|
|
122
|
+
// The compliant cell is now hidden (treated as a gap); columns unchanged.
|
|
123
|
+
expect(f.requirements).toHaveLength(2);
|
|
124
|
+
expect(f.cells[0][1].status).toBeUndefined();
|
|
125
|
+
expect(f.summary.assertions).toBe(0);
|
|
126
|
+
});
|
|
127
|
+
it('is a no-op when no filter dimension is set', () => {
|
|
128
|
+
const m = buildComplianceMatrix(input());
|
|
129
|
+
const f = filterComplianceMatrix(m, {});
|
|
130
|
+
expect(f.summary).toEqual(m.summary);
|
|
131
|
+
});
|
|
132
|
+
it('keeps only columns whose resolved jurisdiction is in the filter (F16)', () => {
|
|
133
|
+
const m = buildComplianceMatrix(input({
|
|
134
|
+
requirements: [
|
|
135
|
+
{ id: 'REQUIREMENT-DATA-ERASURE-1', name: 'Erasure', severity: 'high',
|
|
136
|
+
derived_from: ['LAW-PERSONAL-DATA-2017-1'] },
|
|
137
|
+
{ id: 'REQUIREMENT-AUDIT-LOG-RETENTION-1', name: 'Audit logs', severity: 'medium',
|
|
138
|
+
derived_from: ['LAW-AUDIT-2020-1'] },
|
|
139
|
+
],
|
|
140
|
+
codex: [
|
|
141
|
+
{ id: 'LAW-PERSONAL-DATA-2017-1', jurisdiction: 'ge' },
|
|
142
|
+
{ id: 'LAW-AUDIT-2020-1', jurisdiction: 'eu' },
|
|
143
|
+
],
|
|
144
|
+
}));
|
|
145
|
+
const f = filterComplianceMatrix(m, { jurisdictions: ['ge'] });
|
|
146
|
+
expect(f.requirements.map(r => r.id)).toEqual(['REQUIREMENT-DATA-ERASURE-1']);
|
|
147
|
+
expect(f.cells[0]).toHaveLength(1);
|
|
148
|
+
});
|
|
149
|
+
it('drops requirements with no resolved jurisdiction when the filter is active', () => {
|
|
150
|
+
const m = buildComplianceMatrix(input({
|
|
151
|
+
requirements: [
|
|
152
|
+
{ id: 'REQUIREMENT-DATA-ERASURE-1', name: 'Erasure', severity: 'high',
|
|
153
|
+
derived_from: ['LAW-PERSONAL-DATA-2017-1'] },
|
|
154
|
+
{ id: 'REQUIREMENT-INTERNAL-1', name: 'Internal', severity: 'low' },
|
|
155
|
+
],
|
|
156
|
+
codex: [{ id: 'LAW-PERSONAL-DATA-2017-1', jurisdiction: 'ge' }],
|
|
157
|
+
}));
|
|
158
|
+
const f = filterComplianceMatrix(m, { jurisdictions: ['ge'] });
|
|
159
|
+
expect(f.requirements.map(r => r.id)).toEqual(['REQUIREMENT-DATA-ERASURE-1']);
|
|
160
|
+
});
|
|
161
|
+
it('combines jurisdiction filter with severity (intersection)', () => {
|
|
162
|
+
const m = buildComplianceMatrix(input({
|
|
163
|
+
requirements: [
|
|
164
|
+
{ id: 'REQUIREMENT-DATA-ERASURE-1', name: 'Erasure', severity: 'high',
|
|
165
|
+
derived_from: ['LAW-PERSONAL-DATA-2017-1'] },
|
|
166
|
+
{ id: 'REQUIREMENT-DATA-PORTABILITY-1', name: 'Portability', severity: 'medium',
|
|
167
|
+
derived_from: ['LAW-PERSONAL-DATA-2017-1'] },
|
|
168
|
+
],
|
|
169
|
+
codex: [{ id: 'LAW-PERSONAL-DATA-2017-1', jurisdiction: 'ge' }],
|
|
170
|
+
}));
|
|
171
|
+
const f = filterComplianceMatrix(m, { jurisdictions: ['ge'], severities: ['high'] });
|
|
172
|
+
expect(f.requirements.map(r => r.id)).toEqual(['REQUIREMENT-DATA-ERASURE-1']);
|
|
173
|
+
});
|
|
174
|
+
it('empty jurisdiction array is treated as no-filter on that dimension', () => {
|
|
175
|
+
const m = buildComplianceMatrix(input({
|
|
176
|
+
requirements: [
|
|
177
|
+
{ id: 'REQUIREMENT-INTERNAL-1', name: 'Internal', severity: 'low' },
|
|
178
|
+
],
|
|
179
|
+
}));
|
|
180
|
+
const f = filterComplianceMatrix(m, { jurisdictions: [] });
|
|
181
|
+
expect(f.requirements).toHaveLength(1);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Conformance test — the compliance matrix on the acme_corp worked examples
|
|
2
|
+
// (mirrored under tests/fixtures/notation-corpus/product, tests/fixtures/notation-corpus/requirement, tests/fixtures/notation-corpus/assertion).
|
|
3
|
+
// Pins the #84 Phase 2 acceptance: the matrix renders correctly and gaps are
|
|
4
|
+
// obvious.
|
|
5
|
+
import { describe, it, expect } from 'vitest';
|
|
6
|
+
import { readdirSync, readFileSync } from 'node:fs';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import yaml from 'js-yaml';
|
|
10
|
+
import { buildComplianceMatrix } from '../build.js';
|
|
11
|
+
const examples = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../../tests/fixtures/notation-corpus');
|
|
12
|
+
function loadAll(dir) {
|
|
13
|
+
const full = path.join(examples, dir);
|
|
14
|
+
return readdirSync(full)
|
|
15
|
+
.filter(f => f.endsWith('.yaml'))
|
|
16
|
+
.map(f => yaml.load(readFileSync(path.join(full, f), 'utf-8')));
|
|
17
|
+
}
|
|
18
|
+
describe('compliance matrix — acme_corp worked examples', () => {
|
|
19
|
+
const products = loadAll('product').map(p => ({ id: String(p.id), name: String(p.name) }));
|
|
20
|
+
const requirements = loadAll('requirement').map(r => ({
|
|
21
|
+
id: String(r.id), name: String(r.name), severity: r.severity,
|
|
22
|
+
}));
|
|
23
|
+
const assertions = loadAll('assertion').map(a => ({
|
|
24
|
+
id: String(a.id), about: String(a.about), subject: String(a.subject),
|
|
25
|
+
status: a.status,
|
|
26
|
+
assessed_at: a.assessed_at,
|
|
27
|
+
next_review_at: a.next_review_at,
|
|
28
|
+
}));
|
|
29
|
+
const m = buildComplianceMatrix({ products, requirements, assertions });
|
|
30
|
+
it('rows = the two product files plus the dangling PRODUCT-MOBILE-1 subject', () => {
|
|
31
|
+
expect(m.products.map(p => p.id)).toEqual([
|
|
32
|
+
'PRODUCT-ECOMM-1', 'PRODUCT-MOBILE-1', 'PRODUCT-SUPPORT-1',
|
|
33
|
+
]);
|
|
34
|
+
expect(m.products.find(p => p.id === 'PRODUCT-MOBILE-1')?.unresolved).toBe(true);
|
|
35
|
+
});
|
|
36
|
+
it('columns = the two requirements', () => {
|
|
37
|
+
expect(m.requirements.map(r => r.id)).toEqual([
|
|
38
|
+
'REQUIREMENT-AUDIT-LOG-RETENTION-1', 'REQUIREMENT-DATA-ERASURE-1',
|
|
39
|
+
]);
|
|
40
|
+
});
|
|
41
|
+
it('the only product-subject assertion (mobile → data-erasure) is compliant; everything else is a gap', () => {
|
|
42
|
+
const row = m.products.findIndex(p => p.id === 'PRODUCT-MOBILE-1');
|
|
43
|
+
const col = m.requirements.findIndex(r => r.id === 'REQUIREMENT-DATA-ERASURE-1');
|
|
44
|
+
expect(m.cells[row][col]).toMatchObject({ status: 'compliant', assertionId: 'ASSERTION-MOBILE-DATA-ERASURE-1' });
|
|
45
|
+
// 3 products × 2 requirements = 6 cells; 1 filled → 5 gaps. The CRM
|
|
46
|
+
// (capability) and onboarding (process) assertions are not in the matrix.
|
|
47
|
+
expect(m.summary).toMatchObject({ products: 3, requirements: 2, assertions: 1, gaps: 5 });
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComplianceMatrix, ComplianceMatrixInput, MatrixFilter } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the Products × Requirements matrix.
|
|
4
|
+
*
|
|
5
|
+
* Rows are the discovered PRODUCT elements, unioned with any product-typed
|
|
6
|
+
* assertion subject that has no product element (flagged `unresolved`) so a
|
|
7
|
+
* compliance claim is never silently dropped. Columns are the requirements.
|
|
8
|
+
* A cell carries the status of the product-subject assertion whose `about`
|
|
9
|
+
* matches the column, or is a gap.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildComplianceMatrix(input: ComplianceMatrixInput): ComplianceMatrix;
|
|
12
|
+
/**
|
|
13
|
+
* Applies a toolbar filter. Severity trims requirement *columns*; status blanks
|
|
14
|
+
* the *cells* whose status is filtered out (rendered as a non-matching gap),
|
|
15
|
+
* leaving the grid shape intact so the remaining claims stay aligned. Returns a
|
|
16
|
+
* new matrix; the input is not mutated.
|
|
17
|
+
*/
|
|
18
|
+
export declare function filterComplianceMatrix(matrix: ComplianceMatrix, filter: MatrixFilter): ComplianceMatrix;
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { buildComplianceMatrix, filterComplianceMatrix } from './build.js';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { AssertionStatus } from '../assertion/types.js';
|
|
2
|
+
/** A row of the matrix — a discovered PRODUCT element. */
|
|
3
|
+
export interface MatrixProduct {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** True when the product was discovered only as an assertion subject (no
|
|
7
|
+
* product element file resolves it) — a dangling subject reference. */
|
|
8
|
+
unresolved?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** A column of the matrix — a discovered REQUIREMENT. */
|
|
11
|
+
export interface MatrixRequirement {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
/** Organisation-defined priority (high | medium | low), used by the filter. */
|
|
15
|
+
severity?: string;
|
|
16
|
+
/** Typed IDs of the codex sources this requirement derives from (verbatim
|
|
17
|
+
* from `derived_from`). Carried so the renderer can surface provenance and
|
|
18
|
+
* resolve jurisdictions without re-scanning. */
|
|
19
|
+
derived_from?: string[];
|
|
20
|
+
/** Jurisdictions resolved by walking `derived_from` → codex artefacts and
|
|
21
|
+
* collecting their `jurisdiction` (Codex §1.1). Unique, sorted. Empty when
|
|
22
|
+
* no codex source resolves with a jurisdiction (internal-only requirements,
|
|
23
|
+
* or codex artefacts the scan did not find / has no jurisdiction). The
|
|
24
|
+
* toolbar jurisdiction filter (F16) keys on this set. */
|
|
25
|
+
jurisdictions?: string[];
|
|
26
|
+
}
|
|
27
|
+
/** A codex source document the matrix uses to resolve `Requirement.jurisdictions`. */
|
|
28
|
+
export interface MatrixCodexDoc {
|
|
29
|
+
id: string;
|
|
30
|
+
jurisdiction?: string;
|
|
31
|
+
}
|
|
32
|
+
/** The assertion fields the matrix needs (a projection of the full Assertion). */
|
|
33
|
+
export interface MatrixAssertionRef {
|
|
34
|
+
id: string;
|
|
35
|
+
about: string;
|
|
36
|
+
subject: string;
|
|
37
|
+
status: AssertionStatus;
|
|
38
|
+
assessed_at?: string;
|
|
39
|
+
next_review_at?: string;
|
|
40
|
+
}
|
|
41
|
+
/** One grid cell. `status === undefined` is a gap (no assertion for the pair). */
|
|
42
|
+
export interface MatrixCell {
|
|
43
|
+
productId: string;
|
|
44
|
+
requirementId: string;
|
|
45
|
+
/** The assertion filling this cell, when one exists. */
|
|
46
|
+
assertionId?: string;
|
|
47
|
+
status?: AssertionStatus;
|
|
48
|
+
assessed_at?: string;
|
|
49
|
+
next_review_at?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ComplianceMatrix {
|
|
52
|
+
/** Rows, sorted by id. */
|
|
53
|
+
products: MatrixProduct[];
|
|
54
|
+
/** Columns, sorted by id. */
|
|
55
|
+
requirements: MatrixRequirement[];
|
|
56
|
+
/** `cells[rowIndex][colIndex]`, aligned to `products` × `requirements`. */
|
|
57
|
+
cells: MatrixCell[][];
|
|
58
|
+
/** Counts for the summary strip. */
|
|
59
|
+
summary: {
|
|
60
|
+
products: number;
|
|
61
|
+
requirements: number;
|
|
62
|
+
assertions: number;
|
|
63
|
+
/** Cells with no assertion (compliance gaps). */
|
|
64
|
+
gaps: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface ComplianceMatrixInput {
|
|
68
|
+
products: MatrixProduct[];
|
|
69
|
+
requirements: MatrixRequirement[];
|
|
70
|
+
assertions: MatrixAssertionRef[];
|
|
71
|
+
/** Codex source documents — used to resolve each Requirement's jurisdictions
|
|
72
|
+
* by walking `derived_from`. Optional: when omitted the builder still works
|
|
73
|
+
* and every requirement's `jurisdictions` is left empty. */
|
|
74
|
+
codex?: MatrixCodexDoc[];
|
|
75
|
+
}
|
|
76
|
+
/** Toolbar filter — empty/omitted fields mean "no filter on that dimension". */
|
|
77
|
+
export interface MatrixFilter {
|
|
78
|
+
/** Keep only requirement columns whose severity is in this set. */
|
|
79
|
+
severities?: string[];
|
|
80
|
+
/** Keep only the cell status badges in this set; others render as filtered. */
|
|
81
|
+
statuses?: AssertionStatus[];
|
|
82
|
+
/** Keep only requirement columns whose resolved jurisdictions intersect this
|
|
83
|
+
* set. Requirements with no resolved jurisdiction are filtered out when this
|
|
84
|
+
* is non-empty (F16, epic #84). */
|
|
85
|
+
jurisdictions?: string[];
|
|
86
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Compliance matrix model (vkgeorgia/strategy#84 Phase 2).
|
|
2
|
+
//
|
|
3
|
+
// The matrix is Products × Requirements. Each cell is the status of the
|
|
4
|
+
// (Product, Requirement) ASSERTION when one exists, or a gap when none does.
|
|
5
|
+
// Pure data — the layout is computed by `build.ts`; the Studio preview renders
|
|
6
|
+
// it. Non-product-subject assertions (CAPABILITY / PROCESS) belong to the
|
|
7
|
+
// single-product / single-law views (Phase 3) and are ignored here.
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|