@transitrix/diagrams 1.8.6 → 1.8.8
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/dist/fgca/index.js +10 -10
- package/dist/fgca/layout.js +1 -1
- package/dist/fgca/nodeTypes.js +4 -4
- package/dist/index.js +33 -33
- package/package.json +8 -2
- package/dist/__tests__/edge-path.test.d.ts +0 -1
- package/dist/__tests__/edge-path.test.js +0 -55
- package/dist/__tests__/node-size-presets.test.d.ts +0 -1
- package/dist/__tests__/node-size-presets.test.js +0 -30
- package/dist/__tests__/scope.test.d.ts +0 -1
- package/dist/__tests__/scope.test.js +0 -23
- package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
- package/dist/__tests__/yaml-normalize.test.js +0 -148
- package/dist/activities/__tests__/cpm.test.d.ts +0 -1
- package/dist/activities/__tests__/cpm.test.js +0 -146
- package/dist/activities/__tests__/gantt.test.d.ts +0 -1
- package/dist/activities/__tests__/gantt.test.js +0 -263
- package/dist/activities/__tests__/layout.test.d.ts +0 -1
- package/dist/activities/__tests__/layout.test.js +0 -98
- package/dist/activities/__tests__/validate.test.d.ts +0 -1
- package/dist/activities/__tests__/validate.test.js +0 -397
- package/dist/activity-card/__tests__/example.test.d.ts +0 -1
- package/dist/activity-card/__tests__/example.test.js +0 -73
- package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
- package/dist/activity-card/__tests__/layout.test.js +0 -141
- package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
- package/dist/activity-card/__tests__/resolver.test.js +0 -325
- package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
- package/dist/activity-card/__tests__/validate.test.js +0 -149
- package/dist/actor/__tests__/validate.test.d.ts +0 -1
- package/dist/actor/__tests__/validate.test.js +0 -95
- package/dist/applications/__tests__/validate.test.d.ts +0 -1
- package/dist/applications/__tests__/validate.test.js +0 -223
- package/dist/assertion/__tests__/example.test.d.ts +0 -1
- package/dist/assertion/__tests__/example.test.js +0 -32
- package/dist/assertion/__tests__/validate.test.d.ts +0 -1
- package/dist/assertion/__tests__/validate.test.js +0 -130
- package/dist/blocks/__tests__/layout.test.d.ts +0 -1
- package/dist/blocks/__tests__/layout.test.js +0 -153
- package/dist/blocks/__tests__/validate.test.d.ts +0 -1
- package/dist/blocks/__tests__/validate.test.js +0 -235
- package/dist/business-service/__tests__/validate.test.d.ts +0 -1
- package/dist/business-service/__tests__/validate.test.js +0 -135
- package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
- package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
- package/dist/capability-map/__tests__/address.test.d.ts +0 -1
- package/dist/capability-map/__tests__/address.test.js +0 -49
- package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
- package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
- package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
- package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
- package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
- package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
- package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
- package/dist/capability-map/__tests__/validate.test.js +0 -212
- package/dist/change/__tests__/validate.test.d.ts +0 -1
- package/dist/change/__tests__/validate.test.js +0 -79
- package/dist/codex/__tests__/example.test.d.ts +0 -1
- package/dist/codex/__tests__/example.test.js +0 -33
- package/dist/codex/__tests__/validate.test.d.ts +0 -1
- package/dist/codex/__tests__/validate.test.js +0 -68
- package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
- package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
- package/dist/compliance/__tests__/classify.test.d.ts +0 -1
- package/dist/compliance/__tests__/classify.test.js +0 -58
- package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
- package/dist/compliance/__tests__/confidence.test.js +0 -78
- package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
- package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
- package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
- package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
- package/dist/compliance/__tests__/example.test.d.ts +0 -1
- package/dist/compliance/__tests__/example.test.js +0 -51
- package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
- package/dist/compliance/__tests__/gap-report.test.js +0 -113
- package/dist/compliance/__tests__/html.test.d.ts +0 -1
- package/dist/compliance/__tests__/html.test.js +0 -122
- package/dist/compliance/__tests__/impact.test.d.ts +0 -1
- package/dist/compliance/__tests__/impact.test.js +0 -913
- package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
- package/dist/compliance/__tests__/markdown.test.js +0 -85
- package/dist/compliance/__tests__/trace.test.d.ts +0 -1
- package/dist/compliance/__tests__/trace.test.js +0 -144
- package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
- package/dist/compliance/__tests__/view-resolution.test.js +0 -59
- package/dist/compliance/__tests__/views.test.d.ts +0 -1
- package/dist/compliance/__tests__/views.test.js +0 -59
- package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
- package/dist/compliance-matrix/__tests__/build.test.js +0 -183
- package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
- package/dist/compliance-matrix/__tests__/example.test.js +0 -49
- package/dist/confidence/__tests__/score.test.d.ts +0 -1
- package/dist/confidence/__tests__/score.test.js +0 -188
- package/dist/constraint/__tests__/example.test.d.ts +0 -1
- package/dist/constraint/__tests__/example.test.js +0 -14
- package/dist/constraint/__tests__/validate.test.d.ts +0 -1
- package/dist/constraint/__tests__/validate.test.js +0 -58
- package/dist/factor/__tests__/validate.test.d.ts +0 -1
- package/dist/factor/__tests__/validate.test.js +0 -112
- package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
- package/dist/fgca/__tests__/chain-table.test.js +0 -158
- package/dist/fgca/__tests__/layout.test.d.ts +0 -1
- package/dist/fgca/__tests__/layout.test.js +0 -140
- package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
- package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
- package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
- package/dist/fgca/__tests__/preview-layout.test.js +0 -106
- package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
- package/dist/fgca/__tests__/resolver.test.js +0 -185
- package/dist/fgca/__tests__/validate.test.d.ts +0 -1
- package/dist/fgca/__tests__/validate.test.js +0 -125
- package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
- package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
- package/dist/goals/__tests__/layout.test.d.ts +0 -1
- package/dist/goals/__tests__/layout.test.js +0 -153
- package/dist/goals/__tests__/mutations.test.d.ts +0 -1
- package/dist/goals/__tests__/mutations.test.js +0 -134
- package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
- package/dist/goals/__tests__/parse-canonical.test.js +0 -131
- package/dist/goals/__tests__/validate.test.d.ts +0 -1
- package/dist/goals/__tests__/validate.test.js +0 -183
- package/dist/integration/__tests__/validate.test.d.ts +0 -1
- package/dist/integration/__tests__/validate.test.js +0 -169
- package/dist/location/__tests__/validate.test.d.ts +0 -1
- package/dist/location/__tests__/validate.test.js +0 -107
- package/dist/node/__tests__/validate.test.d.ts +0 -1
- package/dist/node/__tests__/validate.test.js +0 -100
- package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
- package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
- package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
- package/dist/process-blueprint/__tests__/layout.test.js +0 -196
- package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
- package/dist/process-blueprint/__tests__/validate.test.js +0 -280
- package/dist/process-map/__tests__/validate.test.d.ts +0 -1
- package/dist/process-map/__tests__/validate.test.js +0 -199
- package/dist/products/__tests__/validate.test.d.ts +0 -1
- package/dist/products/__tests__/validate.test.js +0 -210
- package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
- package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
- package/dist/requirement/__tests__/example.test.d.ts +0 -1
- package/dist/requirement/__tests__/example.test.js +0 -21
- package/dist/requirement/__tests__/validate.test.d.ts +0 -1
- package/dist/requirement/__tests__/validate.test.js +0 -80
- package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
- package/dist/scenarios/__tests__/validate.test.js +0 -183
- package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
- package/dist/stakeholder/__tests__/validate.test.js +0 -88
- package/dist/target-state/__tests__/validate.test.d.ts +0 -1
- package/dist/target-state/__tests__/validate.test.js +0 -78
- package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
- package/dist/technology-service/__tests__/validate.test.js +0 -121
- package/dist/theme/__tests__/tokens.test.d.ts +0 -1
- package/dist/theme/__tests__/tokens.test.js +0 -159
- package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
- package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
- package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
- package/dist/webview/__tests__/entry-notations.test.js +0 -62
- package/dist/webview/__tests__/entry.test.d.ts +0 -1
- package/dist/webview/__tests__/entry.test.js +0 -56
- package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
- package/dist/webview/__tests__/render-activities.test.js +0 -91
- package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
- package/dist/webview/__tests__/render-blocks.test.js +0 -175
- package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
- package/dist/webview/__tests__/render-goals.test.js +0 -120
- package/dist/webview/__tests__/render-process.test.d.ts +0 -1
- package/dist/webview/__tests__/render-process.test.js +0 -463
- package/dist/webview/__tests__/render-util.test.d.ts +0 -1
- package/dist/webview/__tests__/render-util.test.js +0 -54
- package/src/__tests__/edge-path.test.ts +0 -67
- package/src/__tests__/node-size-presets.test.ts +0 -50
- package/src/__tests__/scope.test.ts +0 -27
- package/src/__tests__/yaml-normalize.test.ts +0 -158
- package/src/activities/__tests__/cpm.test.ts +0 -164
- package/src/activities/__tests__/gantt.test.ts +0 -290
- package/src/activities/__tests__/layout.test.ts +0 -112
- package/src/activities/__tests__/validate.test.ts +0 -446
- package/src/activity-card/__tests__/example.test.ts +0 -83
- package/src/activity-card/__tests__/layout.test.ts +0 -162
- package/src/activity-card/__tests__/resolver.test.ts +0 -357
- package/src/activity-card/__tests__/validate.test.ts +0 -167
- package/src/actor/__tests__/validate.test.ts +0 -114
- package/src/applications/__tests__/validate.test.ts +0 -256
- package/src/assertion/__tests__/example.test.ts +0 -37
- package/src/assertion/__tests__/validate.test.ts +0 -142
- package/src/blocks/__tests__/layout.test.ts +0 -169
- package/src/blocks/__tests__/validate.test.ts +0 -260
- package/src/business-service/__tests__/validate.test.ts +0 -160
- package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
- package/src/capability-map/__tests__/address.test.ts +0 -59
- package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
- package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
- package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
- package/src/capability-map/__tests__/validate.test.ts +0 -238
- package/src/change/__tests__/validate.test.ts +0 -97
- package/src/codex/__tests__/example.test.ts +0 -40
- package/src/codex/__tests__/validate.test.ts +0 -84
- package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
- package/src/compliance/__tests__/classify.test.ts +0 -64
- package/src/compliance/__tests__/confidence.test.ts +0 -98
- package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
- package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
- package/src/compliance/__tests__/example.test.ts +0 -57
- package/src/compliance/__tests__/gap-report.test.ts +0 -129
- package/src/compliance/__tests__/html.test.ts +0 -142
- package/src/compliance/__tests__/impact.test.ts +0 -1060
- package/src/compliance/__tests__/markdown.test.ts +0 -95
- package/src/compliance/__tests__/trace.test.ts +0 -157
- package/src/compliance/__tests__/view-resolution.test.ts +0 -80
- package/src/compliance/__tests__/views.test.ts +0 -64
- package/src/compliance-matrix/__tests__/build.test.ts +0 -200
- package/src/compliance-matrix/__tests__/example.test.ts +0 -57
- package/src/confidence/__tests__/score.test.ts +0 -254
- package/src/constraint/__tests__/example.test.ts +0 -19
- package/src/constraint/__tests__/validate.test.ts +0 -68
- package/src/factor/__tests__/validate.test.ts +0 -133
- package/src/fgca/__tests__/chain-table.test.ts +0 -172
- package/src/fgca/__tests__/layout.test.ts +0 -179
- package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
- package/src/fgca/__tests__/preview-layout.test.ts +0 -124
- package/src/fgca/__tests__/resolver.test.ts +0 -209
- package/src/fgca/__tests__/validate.test.ts +0 -142
- package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
- package/src/goals/__tests__/layout.test.ts +0 -175
- package/src/goals/__tests__/mutations.test.ts +0 -153
- package/src/goals/__tests__/parse-canonical.test.ts +0 -147
- package/src/goals/__tests__/validate.test.ts +0 -202
- package/src/integration/__tests__/validate.test.ts +0 -203
- package/src/location/__tests__/validate.test.ts +0 -127
- package/src/node/__tests__/validate.test.ts +0 -118
- package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
- package/src/process-blueprint/__tests__/layout.test.ts +0 -240
- package/src/process-blueprint/__tests__/validate.test.ts +0 -310
- package/src/process-map/__tests__/validate.test.ts +0 -223
- package/src/products/__tests__/validate.test.ts +0 -239
- package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
- package/src/requirement/__tests__/example.test.ts +0 -24
- package/src/requirement/__tests__/validate.test.ts +0 -96
- package/src/scenarios/__tests__/validate.test.ts +0 -209
- package/src/stakeholder/__tests__/validate.test.ts +0 -105
- package/src/target-state/__tests__/validate.test.ts +0 -95
- package/src/technology-service/__tests__/validate.test.ts +0 -143
- package/src/theme/__tests__/tokens.test.ts +0 -185
- package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
- package/src/webview/__tests__/entry-notations.test.ts +0 -77
- package/src/webview/__tests__/entry.test.ts +0 -64
- package/src/webview/__tests__/render-activities.test.ts +0 -100
- package/src/webview/__tests__/render-blocks.test.ts +0 -206
- package/src/webview/__tests__/render-goals.test.ts +0 -128
- package/src/webview/__tests__/render-process.test.ts +0 -538
- package/src/webview/__tests__/render-util.test.ts +0 -66
package/dist/fgca/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { buildFGCALayout, NODE_WIDTH, NODE_HEIGHT, COLUMN_GAP, ROW_GAP, COLUMN_BG } from "./layout";
|
|
2
|
-
export { layoutFGCAPreview, selectScopedFGCA, FGCA_NODE_W, FGCA_NODE_H, FGCA_HEADER_H, FGCA_PAD, FGCA_DEFAULT_COL_GAP, FGCA_DEFAULT_ROW_GAP, } from "./preview-layout";
|
|
3
|
-
export { buildChainTable } from "./chain-table";
|
|
4
|
-
export { validateFGCADoc } from "./validate";
|
|
5
|
-
export { ALL_FGCA_COLUMNS, FGCA_COLUMN_LABELS, } from "./types";
|
|
1
|
+
export { buildFGCALayout, NODE_WIDTH, NODE_HEIGHT, COLUMN_GAP, ROW_GAP, COLUMN_BG } from "./layout.js";
|
|
2
|
+
export { layoutFGCAPreview, selectScopedFGCA, FGCA_NODE_W, FGCA_NODE_H, FGCA_HEADER_H, FGCA_PAD, FGCA_DEFAULT_COL_GAP, FGCA_DEFAULT_ROW_GAP, } from "./preview-layout.js";
|
|
3
|
+
export { buildChainTable } from "./chain-table.js";
|
|
4
|
+
export { validateFGCADoc } from "./validate.js";
|
|
5
|
+
export { ALL_FGCA_COLUMNS, FGCA_COLUMN_LABELS, } from "./types.js";
|
|
6
6
|
export { resolveFGCA, isFGCAViewDoc } from './resolver.js';
|
|
7
|
-
export { default as FGCADriverNode } from "./nodes/FGCAFactorNode";
|
|
8
|
-
export { default as FGCAGoalNode } from "./nodes/FGCAGoalNode";
|
|
9
|
-
export { default as FGCAChangeNode } from "./nodes/FGCAChangeNode";
|
|
10
|
-
export { default as FGCAActivityNode } from "./nodes/FGCAActivityNode";
|
|
7
|
+
export { default as FGCADriverNode } from "./nodes/FGCAFactorNode.js";
|
|
8
|
+
export { default as FGCAGoalNode } from "./nodes/FGCAGoalNode.js";
|
|
9
|
+
export { default as FGCAChangeNode } from "./nodes/FGCAChangeNode.js";
|
|
10
|
+
export { default as FGCAActivityNode } from "./nodes/FGCAActivityNode.js";
|
|
11
11
|
/** ReactFlow nodeTypes map — pass directly to <ReactFlow nodeTypes={FGCA_NODE_TYPES} /> */
|
|
12
|
-
export { FGCA_NODE_TYPES } from "./nodeTypes";
|
|
12
|
+
export { FGCA_NODE_TYPES } from "./nodeTypes.js";
|
package/dist/fgca/layout.js
CHANGED
package/dist/fgca/nodeTypes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import FGCADriverNode from "./nodes/FGCAFactorNode";
|
|
2
|
-
import FGCAGoalNode from "./nodes/FGCAGoalNode";
|
|
3
|
-
import FGCAChangeNode from "./nodes/FGCAChangeNode";
|
|
4
|
-
import FGCAActivityNode from "./nodes/FGCAActivityNode";
|
|
1
|
+
import FGCADriverNode from "./nodes/FGCAFactorNode.js";
|
|
2
|
+
import FGCAGoalNode from "./nodes/FGCAGoalNode.js";
|
|
3
|
+
import FGCAChangeNode from "./nodes/FGCAChangeNode.js";
|
|
4
|
+
import FGCAActivityNode from "./nodes/FGCAActivityNode.js";
|
|
5
5
|
export const FGCA_NODE_TYPES = {
|
|
6
6
|
fgcaDriver: FGCADriverNode,
|
|
7
7
|
fgcaGoal: FGCAGoalNode,
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
export * from "./activities/index";
|
|
2
|
-
export * from "./activity-card/index";
|
|
3
|
-
export * from "./actor/index";
|
|
4
|
-
export * from "./business-service/index";
|
|
5
|
-
export * from "./geometry";
|
|
6
|
-
export * from "./applications/index";
|
|
7
|
-
export * from "./assertion/index";
|
|
8
|
-
export * from "./blocks/index";
|
|
9
|
-
export { validateCapabilityMap, layoutCapabilityTree, TREE_NODE_WIDTH, TREE_NODE_HEIGHT, TREE_RANK_SEP, TREE_NODE_SEP, renderCapabilityTreeSvg, } from "./capability-map/index";
|
|
10
|
-
export * from "./change/index";
|
|
11
|
-
export * from "./compliance/index";
|
|
12
|
-
export * from "./compliance-matrix/index";
|
|
13
|
-
export * from "./confidence/index";
|
|
14
|
-
export * from "./factor/index";
|
|
15
|
-
export * from "./fgca/index";
|
|
16
|
-
export * from "./goals/index";
|
|
17
|
-
export * from "./integration/index";
|
|
18
|
-
export * from "./location/index";
|
|
19
|
-
export * from "./node/index";
|
|
20
|
-
export * from "./process-blueprint/index";
|
|
21
|
-
export * from "./process-map/index";
|
|
22
|
-
export * from "./products/index";
|
|
23
|
-
export * from "./repo-validate/index";
|
|
24
|
-
export * from "./requirement/index";
|
|
25
|
-
export * from "./scenarios/index";
|
|
26
|
-
export * from "./stakeholder/index";
|
|
27
|
-
export * from "./target-state/index";
|
|
28
|
-
export * from "./technology-service/index";
|
|
29
|
-
export { SCHEMA_VERSION } from "./schema-version";
|
|
30
|
-
export * from "./theme/index";
|
|
31
|
-
export * from "./typed-id";
|
|
32
|
-
export * from "./validation-types";
|
|
33
|
-
export { coerceDatesToIsoStrings } from "./yaml-normalize";
|
|
1
|
+
export * from "./activities/index.js";
|
|
2
|
+
export * from "./activity-card/index.js";
|
|
3
|
+
export * from "./actor/index.js";
|
|
4
|
+
export * from "./business-service/index.js";
|
|
5
|
+
export * from "./geometry.js";
|
|
6
|
+
export * from "./applications/index.js";
|
|
7
|
+
export * from "./assertion/index.js";
|
|
8
|
+
export * from "./blocks/index.js";
|
|
9
|
+
export { validateCapabilityMap, layoutCapabilityTree, TREE_NODE_WIDTH, TREE_NODE_HEIGHT, TREE_RANK_SEP, TREE_NODE_SEP, renderCapabilityTreeSvg, } from "./capability-map/index.js";
|
|
10
|
+
export * from "./change/index.js";
|
|
11
|
+
export * from "./compliance/index.js";
|
|
12
|
+
export * from "./compliance-matrix/index.js";
|
|
13
|
+
export * from "./confidence/index.js";
|
|
14
|
+
export * from "./factor/index.js";
|
|
15
|
+
export * from "./fgca/index.js";
|
|
16
|
+
export * from "./goals/index.js";
|
|
17
|
+
export * from "./integration/index.js";
|
|
18
|
+
export * from "./location/index.js";
|
|
19
|
+
export * from "./node/index.js";
|
|
20
|
+
export * from "./process-blueprint/index.js";
|
|
21
|
+
export * from "./process-map/index.js";
|
|
22
|
+
export * from "./products/index.js";
|
|
23
|
+
export * from "./repo-validate/index.js";
|
|
24
|
+
export * from "./requirement/index.js";
|
|
25
|
+
export * from "./scenarios/index.js";
|
|
26
|
+
export * from "./stakeholder/index.js";
|
|
27
|
+
export * from "./target-state/index.js";
|
|
28
|
+
export * from "./technology-service/index.js";
|
|
29
|
+
export { SCHEMA_VERSION } from "./schema-version.js";
|
|
30
|
+
export * from "./theme/index.js";
|
|
31
|
+
export * from "./typed-id.js";
|
|
32
|
+
export * from "./validation-types.js";
|
|
33
|
+
export { coerceDatesToIsoStrings } from "./yaml-normalize.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transitrix/diagrams",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared rendering, validation, and pure mutations for Transitrix custom diagram formats.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,10 +31,16 @@
|
|
|
31
31
|
},
|
|
32
32
|
"files": [
|
|
33
33
|
"dist",
|
|
34
|
-
"src"
|
|
34
|
+
"src",
|
|
35
|
+
"!src/**/__tests__",
|
|
36
|
+
"!src/**/*.test.ts",
|
|
37
|
+
"!src/**/*.test.tsx",
|
|
38
|
+
"!src/**/*.js.map",
|
|
39
|
+
"!src/**/*.d.ts.map"
|
|
35
40
|
],
|
|
36
41
|
"scripts": {
|
|
37
42
|
"build": "tsc -p .",
|
|
43
|
+
"postbuild": "node scripts/fix-esm-extensions.mjs",
|
|
38
44
|
"test": "vitest run",
|
|
39
45
|
"test:watch": "vitest"
|
|
40
46
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { horizontalCubicEdgePath, EDGE_MIN_HANDLE } from '../edge-path.js';
|
|
3
|
-
describe('horizontalCubicEdgePath', () => {
|
|
4
|
-
// A short horizontal edge: |dx|=40 < EDGE_MIN_HANDLE*2, |dy|=0, so the
|
|
5
|
-
// base handle is the floor (64).
|
|
6
|
-
const sx = 0, sy = 0, tx = 40, ty = 0;
|
|
7
|
-
it('curvature 1 uses the floor handle (historical appearance)', () => {
|
|
8
|
-
const d = horizontalCubicEdgePath(sx, sy, tx, ty, 1);
|
|
9
|
-
// handle = max(64, 20, 0) = 64
|
|
10
|
-
expect(d).toBe(`M0,0 C${EDGE_MIN_HANDLE},0 ${40 - EDGE_MIN_HANDLE},0 40,0`);
|
|
11
|
-
});
|
|
12
|
-
it('default curvature equals explicit curvature 1', () => {
|
|
13
|
-
expect(horizontalCubicEdgePath(sx, sy, tx, ty)).toBe(horizontalCubicEdgePath(sx, sy, tx, ty, 1));
|
|
14
|
-
});
|
|
15
|
-
it('curvature 0 collapses control points onto the endpoints (straight line)', () => {
|
|
16
|
-
const d = horizontalCubicEdgePath(sx, sy, tx, ty, 0);
|
|
17
|
-
expect(d).toBe('M0,0 C0,0 40,0 40,0');
|
|
18
|
-
});
|
|
19
|
-
it('changing curvature changes the path output (AC#6)', () => {
|
|
20
|
-
const a = horizontalCubicEdgePath(sx, sy, tx, ty, 1);
|
|
21
|
-
const b = horizontalCubicEdgePath(sx, sy, tx, ty, 2);
|
|
22
|
-
expect(b).not.toBe(a);
|
|
23
|
-
});
|
|
24
|
-
it('larger curvature pushes the control handles further out', () => {
|
|
25
|
-
const handleOf = (curv) => {
|
|
26
|
-
// First control point x is `sx + handle`; parse it back out.
|
|
27
|
-
const m = horizontalCubicEdgePath(0, 0, 40, 0, curv).match(/^M0,0 C(-?\d+(?:\.\d+)?),0/);
|
|
28
|
-
return Number(m[1]);
|
|
29
|
-
};
|
|
30
|
-
expect(handleOf(2)).toBeGreaterThan(handleOf(1));
|
|
31
|
-
expect(handleOf(0.5)).toBeLessThan(handleOf(1));
|
|
32
|
-
expect(handleOf(2)).toBe(2 * EDGE_MIN_HANDLE);
|
|
33
|
-
});
|
|
34
|
-
it('handle scales with the vertical span for stacked nodes', () => {
|
|
35
|
-
// |dy|=200 ⇒ base handle = max(64, 0, 160) = 160; ×1 = 160.
|
|
36
|
-
const d = horizontalCubicEdgePath(0, 0, 0, 200, 1);
|
|
37
|
-
expect(d).toBe('M0,0 C160,0 -160,200 0,200');
|
|
38
|
-
});
|
|
39
|
-
it('entryCurvature independently scales the arrival handle', () => {
|
|
40
|
-
// exit handle = max(64,20,0)*1 = 64; entry handle = max(64,20,0)*2 = 128.
|
|
41
|
-
const d = horizontalCubicEdgePath(0, 0, 40, 0, 1, 2);
|
|
42
|
-
expect(d).toBe(`M0,0 C${EDGE_MIN_HANDLE},0 ${40 - EDGE_MIN_HANDLE * 2},0 40,0`);
|
|
43
|
-
});
|
|
44
|
-
it('omitting entryCurvature gives symmetric handles (historical behaviour)', () => {
|
|
45
|
-
expect(horizontalCubicEdgePath(0, 0, 40, 0, 0.5)).toBe(horizontalCubicEdgePath(0, 0, 40, 0, 0.5, 0.5));
|
|
46
|
-
});
|
|
47
|
-
it('caps the handle for a tall edge with a narrow column gap, instead of overshooting the target', () => {
|
|
48
|
-
// A network-view edge spanning several rows (|dy|=500) with a typical
|
|
49
|
-
// adjacent-column gap (dx=80): uncapped, |dy|*0.8=400 would push the exit
|
|
50
|
-
// control point 320px past the target's x, producing an exaggerated
|
|
51
|
-
// S-bow. Capped at 160, the control points stay close to the endpoints.
|
|
52
|
-
const d = horizontalCubicEdgePath(0, 0, 80, 500, 1);
|
|
53
|
-
expect(d).toBe('M0,0 C160,0 -80,500 80,500');
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { ACTION_NODE_SIZE, BLOCKS_LEAF_SIZE, CAPABILITY_MAP_NODE_SIZE, DGCA_NODE_SIZE, ENTITY_NODE_HEIGHT, ENTITY_NODE_SIZE, ENTITY_NODE_WIDTH, GOALS_NODE_SIZE, PROCESS_BLUEPRINT_SIZE, resolveGoalsNodeSize, } from '../node-size-presets.js';
|
|
3
|
-
describe('node-size-presets', () => {
|
|
4
|
-
it('uses shared width and height tiers for entity nodes', () => {
|
|
5
|
-
expect(ENTITY_NODE_WIDTH).toEqual({ compact: 200, normal: 250, wide: 320 });
|
|
6
|
-
expect(ENTITY_NODE_HEIGHT).toEqual({ compact: 72, normal: 80, wide: 96 });
|
|
7
|
-
expect(ENTITY_NODE_SIZE.normal).toEqual({ width: 250, height: 80 });
|
|
8
|
-
expect(ENTITY_NODE_SIZE.compact).toEqual({ width: 200, height: 72 });
|
|
9
|
-
expect(ENTITY_NODE_SIZE.wide).toEqual({ width: 320, height: 96 });
|
|
10
|
-
});
|
|
11
|
-
it('exposes the same entity sizes for every box-based notation', () => {
|
|
12
|
-
for (const table of [GOALS_NODE_SIZE, DGCA_NODE_SIZE, BLOCKS_LEAF_SIZE, ACTION_NODE_SIZE]) {
|
|
13
|
-
expect(table).toBe(ENTITY_NODE_SIZE);
|
|
14
|
-
expect(table.normal).toEqual(ENTITY_NODE_SIZE.normal);
|
|
15
|
-
}
|
|
16
|
-
expect(CAPABILITY_MAP_NODE_SIZE.normal).toEqual({
|
|
17
|
-
nodeWidth: ENTITY_NODE_WIDTH.normal,
|
|
18
|
-
nodeHeight: ENTITY_NODE_HEIGHT.normal,
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
it('scales wide above normal and compact below', () => {
|
|
22
|
-
expect(resolveGoalsNodeSize('wide').height).toBeGreaterThan(resolveGoalsNodeSize('normal').height);
|
|
23
|
-
expect(resolveGoalsNodeSize('compact').height).toBeLessThan(resolveGoalsNodeSize('normal').height);
|
|
24
|
-
expect(resolveGoalsNodeSize('wide').width).toBeGreaterThan(resolveGoalsNodeSize('normal').width);
|
|
25
|
-
});
|
|
26
|
-
it('scales process blueprint from the same tier ratios', () => {
|
|
27
|
-
expect(PROCESS_BLUEPRINT_SIZE.wide.stageColumnWidth).toBeGreaterThan(PROCESS_BLUEPRINT_SIZE.normal.stageColumnWidth);
|
|
28
|
-
expect(PROCESS_BLUEPRINT_SIZE.compact.goalRowHeight).toBeLessThan(PROCESS_BLUEPRINT_SIZE.normal.goalRowHeight);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { checkScopeRoot, SCOPE_MISSING_ROOT_CODE } from '../scope.js';
|
|
3
|
-
describe('checkScopeRoot', () => {
|
|
4
|
-
it('returns null for non-root scopes', () => {
|
|
5
|
-
expect(checkScopeRoot({ mode: 'all' }, [1, 2])).toBeNull();
|
|
6
|
-
expect(checkScopeRoot({ mode: 'level', maxLevel: 1 }, [1, 2])).toBeNull();
|
|
7
|
-
});
|
|
8
|
-
it('returns null when the root id is present (numeric ids compared as strings)', () => {
|
|
9
|
-
const scope = { mode: 'root', rootGoalId: '2' };
|
|
10
|
-
expect(checkScopeRoot(scope, [1, 2, 3])).toBeNull();
|
|
11
|
-
});
|
|
12
|
-
it('returns a SCOPE-001 warning when the root id is absent', () => {
|
|
13
|
-
const scope = { mode: 'root', rootGoalId: '99' };
|
|
14
|
-
const w = checkScopeRoot(scope, [1, 2, 3]);
|
|
15
|
-
expect(w).not.toBeNull();
|
|
16
|
-
expect(w.code).toBe(SCOPE_MISSING_ROOT_CODE);
|
|
17
|
-
expect(w.message).toContain('99');
|
|
18
|
-
});
|
|
19
|
-
it('handles string goal ids', () => {
|
|
20
|
-
expect(checkScopeRoot({ mode: 'root', rootGoalId: 'g1' }, ['g1', 'g2'])).toBeNull();
|
|
21
|
-
expect(checkScopeRoot({ mode: 'root', rootGoalId: 'gX' }, ['g1', 'g2'])).not.toBeNull();
|
|
22
|
-
});
|
|
23
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
-
import yaml from 'js-yaml';
|
|
3
|
-
import { coerceDatesToIsoStrings } from '../yaml-normalize.js';
|
|
4
|
-
import { validateActivities } from '../activities/index.js';
|
|
5
|
-
describe('coerceDatesToIsoStrings', () => {
|
|
6
|
-
it('replaces top-level Date with ISO YYYY-MM-DD string', () => {
|
|
7
|
-
const out = coerceDatesToIsoStrings(new Date(Date.UTC(2026, 5, 1))); // 2026-06-01 UTC
|
|
8
|
-
expect(out).toBe('2026-06-01');
|
|
9
|
-
});
|
|
10
|
-
it('replaces Date values inside nested arrays of objects', () => {
|
|
11
|
-
const input = {
|
|
12
|
-
activities: [
|
|
13
|
-
{ id: 'A-001', start_date: new Date(Date.UTC(2026, 5, 1)), end_date: new Date(Date.UTC(2026, 5, 5)) },
|
|
14
|
-
{ id: 'A-002', start_date: '2026-06-06' },
|
|
15
|
-
],
|
|
16
|
-
};
|
|
17
|
-
coerceDatesToIsoStrings(input);
|
|
18
|
-
expect(input.activities[0].start_date).toBe('2026-06-01');
|
|
19
|
-
expect(input.activities[0].end_date).toBe('2026-06-05');
|
|
20
|
-
expect(input.activities[1].start_date).toBe('2026-06-06');
|
|
21
|
-
});
|
|
22
|
-
it('walks objects recursively', () => {
|
|
23
|
-
const input = {
|
|
24
|
-
project: { start_date: new Date(Date.UTC(2026, 0, 15)) },
|
|
25
|
-
};
|
|
26
|
-
coerceDatesToIsoStrings(input);
|
|
27
|
-
expect(input.project.start_date).toBe('2026-01-15');
|
|
28
|
-
});
|
|
29
|
-
it('leaves non-Date values untouched', () => {
|
|
30
|
-
const input = {
|
|
31
|
-
notation: 'activities',
|
|
32
|
-
activities: [{ id: 'A-001', duration: 3, start_date: '2026-06-01' }],
|
|
33
|
-
};
|
|
34
|
-
const out = coerceDatesToIsoStrings(input);
|
|
35
|
-
expect(out).toBe(input);
|
|
36
|
-
expect(input.activities[0].start_date).toBe('2026-06-01');
|
|
37
|
-
expect(input.activities[0].duration).toBe(3);
|
|
38
|
-
});
|
|
39
|
-
it('handles null, undefined, and primitive scalars', () => {
|
|
40
|
-
expect(coerceDatesToIsoStrings(null)).toBe(null);
|
|
41
|
-
expect(coerceDatesToIsoStrings(undefined)).toBe(undefined);
|
|
42
|
-
expect(coerceDatesToIsoStrings('hello')).toBe('hello');
|
|
43
|
-
expect(coerceDatesToIsoStrings(42)).toBe(42);
|
|
44
|
-
expect(coerceDatesToIsoStrings(true)).toBe(true);
|
|
45
|
-
});
|
|
46
|
-
it('handles arrays that contain bare Date elements', () => {
|
|
47
|
-
const arr = [new Date(Date.UTC(2026, 5, 1)), 'x', { d: new Date(Date.UTC(2026, 5, 2)) }];
|
|
48
|
-
coerceDatesToIsoStrings(arr);
|
|
49
|
-
expect(arr[0]).toBe('2026-06-01');
|
|
50
|
-
expect(arr[1]).toBe('x');
|
|
51
|
-
expect(arr[2].d).toBe('2026-06-02');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
describe('coerceDatesToIsoStrings — js-yaml integration', () => {
|
|
55
|
-
it('quoted ISO dates are preserved untouched', () => {
|
|
56
|
-
const text = [
|
|
57
|
-
'notation: action',
|
|
58
|
-
'actions:',
|
|
59
|
-
' - id: "A-001"',
|
|
60
|
-
' name: "Quoted dates"',
|
|
61
|
-
' duration: 3',
|
|
62
|
-
' start_date: "2026-06-01"',
|
|
63
|
-
' end_date: "2026-06-03"',
|
|
64
|
-
'',
|
|
65
|
-
].join('\n');
|
|
66
|
-
const parsed = yaml.load(text);
|
|
67
|
-
coerceDatesToIsoStrings(parsed);
|
|
68
|
-
expect(parsed.actions[0].start_date).toBe('2026-06-01');
|
|
69
|
-
expect(parsed.actions[0].end_date).toBe('2026-06-03');
|
|
70
|
-
const v = validateActivities(parsed);
|
|
71
|
-
expect(v.valid).toBe(true);
|
|
72
|
-
});
|
|
73
|
-
it('bare ISO dates are coerced to ISO strings and pass validation', () => {
|
|
74
|
-
const text = [
|
|
75
|
-
'notation: action',
|
|
76
|
-
'actions:',
|
|
77
|
-
' - id: "A-001"',
|
|
78
|
-
' name: "Bare dates"',
|
|
79
|
-
' duration: 3',
|
|
80
|
-
' start_date: 2026-06-01',
|
|
81
|
-
' end_date: 2026-06-03',
|
|
82
|
-
'',
|
|
83
|
-
].join('\n');
|
|
84
|
-
const parsed = yaml.load(text);
|
|
85
|
-
// Without coercion, js-yaml returns Date instances and the validator
|
|
86
|
-
// would emit ACT-008 because typeof !== 'string'. Sanity-check that
|
|
87
|
-
// assumption before normalisation.
|
|
88
|
-
expect(parsed.actions[0].start_date).toBeInstanceOf(Date);
|
|
89
|
-
coerceDatesToIsoStrings(parsed);
|
|
90
|
-
expect(parsed.actions[0].start_date).toBe('2026-06-01');
|
|
91
|
-
expect(parsed.actions[0].end_date).toBe('2026-06-03');
|
|
92
|
-
const v = validateActivities(parsed);
|
|
93
|
-
expect(v.valid).toBe(true);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
// The issue calls out the timezone trap: a Date built from a bare ISO
|
|
97
|
-
// date is midnight UTC, but if we used `getFullYear / getMonth / getDate`
|
|
98
|
-
// instead of the UTC variants, a non-UTC process timezone would shift the
|
|
99
|
-
// day. Pin a non-UTC TZ for this block so the regression bites if anyone
|
|
100
|
-
// later swaps to local-time accessors.
|
|
101
|
-
describe('coerceDatesToIsoStrings — non-UTC timezone', () => {
|
|
102
|
-
const originalTz = process.env.TZ;
|
|
103
|
-
beforeAll(() => {
|
|
104
|
-
// Pacific/Auckland is UTC+12/+13 — the most aggressive eastward shift
|
|
105
|
-
// available without DST gymnastics. If local-time accessors are used,
|
|
106
|
-
// `2026-06-01` parsed as midnight UTC reads back as `2026-06-01 12:00
|
|
107
|
-
// local`, which is still the right day — so use a westward TZ for the
|
|
108
|
-
// real test below. Auckland is here as a sanity case.
|
|
109
|
-
process.env.TZ = 'Pacific/Auckland';
|
|
110
|
-
});
|
|
111
|
-
afterAll(() => {
|
|
112
|
-
if (originalTz === undefined) {
|
|
113
|
-
delete process.env.TZ;
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
process.env.TZ = originalTz;
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
it('does not drift the day forward in an eastward timezone', () => {
|
|
120
|
-
const text = 'd: 2026-06-01\n';
|
|
121
|
-
const parsed = yaml.load(text);
|
|
122
|
-
coerceDatesToIsoStrings(parsed);
|
|
123
|
-
expect(parsed.d).toBe('2026-06-01');
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
describe('coerceDatesToIsoStrings — westward (negative offset) timezone', () => {
|
|
127
|
-
const originalTz = process.env.TZ;
|
|
128
|
-
beforeAll(() => {
|
|
129
|
-
// Pacific/Honolulu is UTC-10, no DST. Midnight UTC `2026-06-01` reads
|
|
130
|
-
// back as `2026-05-31 14:00 local`. Local-time accessors would yield
|
|
131
|
-
// `2026-05-31` — wrong by one day. UTC accessors yield `2026-06-01`.
|
|
132
|
-
process.env.TZ = 'Pacific/Honolulu';
|
|
133
|
-
});
|
|
134
|
-
afterAll(() => {
|
|
135
|
-
if (originalTz === undefined) {
|
|
136
|
-
delete process.env.TZ;
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
process.env.TZ = originalTz;
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
it('does not drift the day backward in a westward timezone', () => {
|
|
143
|
-
const text = 'd: 2026-06-01\n';
|
|
144
|
-
const parsed = yaml.load(text);
|
|
145
|
-
coerceDatesToIsoStrings(parsed);
|
|
146
|
-
expect(parsed.d).toBe('2026-06-01');
|
|
147
|
-
});
|
|
148
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { computeCpm } from '../cpm.js';
|
|
3
|
-
// PMBoK textbook example (5-activity network):
|
|
4
|
-
// A(5) → B(8) → D(7)
|
|
5
|
-
// A(5) → C(3) → D(7)
|
|
6
|
-
// D(7) → E(4)
|
|
7
|
-
// Critical path: A→B→D→E = 5+8+7+4 = 24
|
|
8
|
-
// A: ES=0, EF=5, LS=0, LF=5, slack=0 (critical)
|
|
9
|
-
// B: ES=5, EF=13, LS=5, LF=13, slack=0 (critical)
|
|
10
|
-
// C: ES=5, EF=8, LS=10, LF=13, slack=5
|
|
11
|
-
// D: ES=13, EF=20, LS=13, LF=20, slack=0 (critical)
|
|
12
|
-
// E: ES=20, EF=24, LS=20, LF=24, slack=0 (critical)
|
|
13
|
-
const pmBokActivities = [
|
|
14
|
-
{ id: 'A', name: 'A', duration: 5 },
|
|
15
|
-
{ id: 'B', name: 'B', duration: 8, predecessors: ['A'] },
|
|
16
|
-
{ id: 'C', name: 'C', duration: 3, predecessors: ['A'] },
|
|
17
|
-
{ id: 'D', name: 'D', duration: 7, predecessors: ['B', 'C'] },
|
|
18
|
-
{ id: 'E', name: 'E', duration: 4, predecessors: ['D'] },
|
|
19
|
-
];
|
|
20
|
-
describe('computeCpm — PMBoK textbook example', () => {
|
|
21
|
-
const result = computeCpm(pmBokActivities);
|
|
22
|
-
it('computes ES for each activity', () => {
|
|
23
|
-
expect(result.get('A').es).toBe(0);
|
|
24
|
-
expect(result.get('B').es).toBe(5);
|
|
25
|
-
expect(result.get('C').es).toBe(5);
|
|
26
|
-
expect(result.get('D').es).toBe(13);
|
|
27
|
-
expect(result.get('E').es).toBe(20);
|
|
28
|
-
});
|
|
29
|
-
it('computes EF for each activity', () => {
|
|
30
|
-
expect(result.get('A').ef).toBe(5);
|
|
31
|
-
expect(result.get('B').ef).toBe(13);
|
|
32
|
-
expect(result.get('C').ef).toBe(8);
|
|
33
|
-
expect(result.get('D').ef).toBe(20);
|
|
34
|
-
expect(result.get('E').ef).toBe(24);
|
|
35
|
-
});
|
|
36
|
-
it('computes LS for each activity', () => {
|
|
37
|
-
expect(result.get('A').ls).toBe(0);
|
|
38
|
-
expect(result.get('B').ls).toBe(5);
|
|
39
|
-
expect(result.get('C').ls).toBe(10);
|
|
40
|
-
expect(result.get('D').ls).toBe(13);
|
|
41
|
-
expect(result.get('E').ls).toBe(20);
|
|
42
|
-
});
|
|
43
|
-
it('computes LF for each activity', () => {
|
|
44
|
-
expect(result.get('A').lf).toBe(5);
|
|
45
|
-
expect(result.get('B').lf).toBe(13);
|
|
46
|
-
expect(result.get('C').lf).toBe(13);
|
|
47
|
-
expect(result.get('D').lf).toBe(20);
|
|
48
|
-
expect(result.get('E').lf).toBe(24);
|
|
49
|
-
});
|
|
50
|
-
it('computes slack', () => {
|
|
51
|
-
expect(result.get('A').slack).toBe(0);
|
|
52
|
-
expect(result.get('B').slack).toBe(0);
|
|
53
|
-
expect(result.get('C').slack).toBe(5);
|
|
54
|
-
expect(result.get('D').slack).toBe(0);
|
|
55
|
-
expect(result.get('E').slack).toBe(0);
|
|
56
|
-
});
|
|
57
|
-
it('marks critical path activities', () => {
|
|
58
|
-
expect(result.get('A').isCritical).toBe(true);
|
|
59
|
-
expect(result.get('B').isCritical).toBe(true);
|
|
60
|
-
expect(result.get('C').isCritical).toBe(false);
|
|
61
|
-
expect(result.get('D').isCritical).toBe(true);
|
|
62
|
-
expect(result.get('E').isCritical).toBe(true);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
describe('computeCpm — edge cases', () => {
|
|
66
|
-
it('returns empty map for empty input', () => {
|
|
67
|
-
const result = computeCpm([]);
|
|
68
|
-
expect(result.size).toBe(0);
|
|
69
|
-
});
|
|
70
|
-
it('single node with no predecessors: ES=0, EF=duration, slack=0', () => {
|
|
71
|
-
const result = computeCpm([{ id: 'A', name: 'A', duration: 5 }]);
|
|
72
|
-
expect(result.get('A').es).toBe(0);
|
|
73
|
-
expect(result.get('A').ef).toBe(5);
|
|
74
|
-
expect(result.get('A').slack).toBe(0);
|
|
75
|
-
expect(result.get('A').isCritical).toBe(true);
|
|
76
|
-
});
|
|
77
|
-
it('activity with no duration treated as zero-duration', () => {
|
|
78
|
-
const result = computeCpm([{ id: 'A', name: 'Milestone' }]);
|
|
79
|
-
expect(result.get('A').ef).toBe(0);
|
|
80
|
-
});
|
|
81
|
-
it('linear chain A(3)→B(5)→C(2): total=10, all critical', () => {
|
|
82
|
-
const activities = [
|
|
83
|
-
{ id: 'A', name: 'A', duration: 3 },
|
|
84
|
-
{ id: 'B', name: 'B', duration: 5, predecessors: ['A'] },
|
|
85
|
-
{ id: 'C', name: 'C', duration: 2, predecessors: ['B'] },
|
|
86
|
-
];
|
|
87
|
-
const result = computeCpm(activities);
|
|
88
|
-
expect(result.get('A').ef).toBe(3);
|
|
89
|
-
expect(result.get('B').ef).toBe(8);
|
|
90
|
-
expect(result.get('C').ef).toBe(10);
|
|
91
|
-
expect(result.get('A').isCritical).toBe(true);
|
|
92
|
-
expect(result.get('B').isCritical).toBe(true);
|
|
93
|
-
expect(result.get('C').isCritical).toBe(true);
|
|
94
|
-
});
|
|
95
|
-
it('parallel paths: longer path is critical, shorter has positive slack', () => {
|
|
96
|
-
// A(1) → C(10)
|
|
97
|
-
// B(5) → C(10)
|
|
98
|
-
// merge at D(2): predecessors [C]
|
|
99
|
-
// path via A: 1+10+2=13; path via B: 5+10+2=17 → critical
|
|
100
|
-
const activities = [
|
|
101
|
-
{ id: 'A', name: 'A', duration: 1 },
|
|
102
|
-
{ id: 'B', name: 'B', duration: 5 },
|
|
103
|
-
{ id: 'C', name: 'C', duration: 10, predecessors: ['A', 'B'] },
|
|
104
|
-
{ id: 'D', name: 'D', duration: 2, predecessors: ['C'] },
|
|
105
|
-
];
|
|
106
|
-
const result = computeCpm(activities);
|
|
107
|
-
// C.es = max(EF[A], EF[B]) = max(1,5) = 5
|
|
108
|
-
expect(result.get('C').es).toBe(5);
|
|
109
|
-
expect(result.get('A').isCritical).toBe(false);
|
|
110
|
-
expect(result.get('B').isCritical).toBe(true);
|
|
111
|
-
expect(result.get('C').isCritical).toBe(true);
|
|
112
|
-
expect(result.get('D').isCritical).toBe(true);
|
|
113
|
-
expect(result.get('A').slack).toBe(4);
|
|
114
|
-
expect(result.get('B').slack).toBe(0);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
describe('computeCpm — cycle defence', () => {
|
|
118
|
-
// Pre-release should-fix: Kahn's topo-order silently omits cyclic nodes.
|
|
119
|
-
// The validator's ACT-006 is the authoritative cycle error, but
|
|
120
|
-
// layoutActivities is reachable without validation, so computeCpm must
|
|
121
|
-
// still produce an entry for every activity (filled with neutral values
|
|
122
|
-
// for omitted cyclic ones) — otherwise consumers see `undefined` and
|
|
123
|
-
// bars render without CPM data.
|
|
124
|
-
it('emits entries for every activity on a 2-node mutual cycle', () => {
|
|
125
|
-
const result = computeCpm([
|
|
126
|
-
{ id: 'A', name: 'A', duration: 3, predecessors: ['B'] },
|
|
127
|
-
{ id: 'B', name: 'B', duration: 2, predecessors: ['A'] },
|
|
128
|
-
]);
|
|
129
|
-
expect(result.size).toBe(2);
|
|
130
|
-
expect(result.get('A')).toMatchObject({ es: 0, ef: 0, slack: 0, isCritical: false });
|
|
131
|
-
expect(result.get('B')).toMatchObject({ es: 0, ef: 0, slack: 0, isCritical: false });
|
|
132
|
-
});
|
|
133
|
-
it('keeps real CPM data for the acyclic prefix when a cycle exists downstream', () => {
|
|
134
|
-
// A → B is acyclic; C ↔ D is a mutual cycle disconnected from A/B.
|
|
135
|
-
const result = computeCpm([
|
|
136
|
-
{ id: 'A', name: 'A', duration: 5 },
|
|
137
|
-
{ id: 'B', name: 'B', duration: 3, predecessors: ['A'] },
|
|
138
|
-
{ id: 'C', name: 'C', duration: 2, predecessors: ['D'] },
|
|
139
|
-
{ id: 'D', name: 'D', duration: 2, predecessors: ['C'] },
|
|
140
|
-
]);
|
|
141
|
-
expect(result.get('A')?.ef).toBe(5);
|
|
142
|
-
expect(result.get('B')?.ef).toBe(8);
|
|
143
|
-
expect(result.get('C')).toMatchObject({ es: 0, ef: 0, isCritical: false });
|
|
144
|
-
expect(result.get('D')).toMatchObject({ es: 0, ef: 0, isCritical: false });
|
|
145
|
-
});
|
|
146
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|