codecharta-visualization 1.86.0 → 1.89.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/Dockerfile +1 -1
- package/app/app.module.ts +30 -6
- package/app/codeCharta/codeCharta.component.html +0 -2
- package/app/codeCharta/codeCharta.component.ts +2 -0
- package/app/codeCharta/codeCharta.model.ts +8 -5
- package/app/codeCharta/codeCharta.service.spec.ts +41 -50
- package/app/codeCharta/codeCharta.service.ts +33 -32
- package/app/codeCharta/e2e/url.e2e.ts +1 -1
- package/app/codeCharta/services/ajs-upgraded-providers.ts +13 -0
- package/app/codeCharta/state/angular-redux/effects/createEffect.spec.ts +37 -0
- package/app/codeCharta/state/angular-redux/effects/createEffect.ts +25 -0
- package/app/codeCharta/state/angular-redux/effects/effects.module.ts +36 -0
- package/app/codeCharta/state/angular-redux/ofType.ts +11 -0
- package/app/codeCharta/state/angular-redux/state.ts +12 -0
- package/app/codeCharta/state/angular-redux/store.ts +1 -1
- package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect.spec.ts +60 -0
- package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/addBlacklistItemsIfNotResultsInEmptyMap.effect.ts +56 -0
- package/app/codeCharta/state/effects/addBlacklistItemsIfNotResultsInEmptyMap/resultsInEmptyMap.ts +22 -0
- package/app/codeCharta/state/effects/nodeContextMenu/excludeButton/excludeButton.component.html +3 -0
- package/app/codeCharta/state/effects/nodeContextMenu/excludeButton/excludeButton.component.ts +26 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.html +13 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.spec.ts +55 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.component.ts +34 -0
- package/app/codeCharta/state/effects/nodeContextMenu/flattenButtons/flattenButtons.module.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.html +24 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.spec.ts +55 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.component.ts +38 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/focusButtons.module.ts +13 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/isNodeFocused.pipe.spec.ts +31 -0
- package/app/codeCharta/state/effects/nodeContextMenu/focusButtons/isNodeFocused.pipe.ts +25 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.html +6 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.spec.ts +64 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.component.ts +39 -0
- package/app/codeCharta/state/effects/nodeContextMenu/highlightButtons/highlightButtons.module.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.html +22 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.scss +31 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.spec.ts +35 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.component.ts +30 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/markFolderRow.module.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.spec.ts +17 -0
- package/app/codeCharta/state/effects/nodeContextMenu/markFolderRow/selectors/markFolderItems.selector.ts +29 -0
- package/app/codeCharta/{ui → state/effects}/nodeContextMenu/nodeContextMenu.e2e.ts +4 -16
- package/app/codeCharta/{ui → state/effects}/nodeContextMenu/nodeContextMenu.po.ts +1 -1
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenu.service.spec.ts +78 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenu.service.ts +72 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/lastPartOfNodePath.pipe.spec.ts +11 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/lastPartOfNodePath.pipe.ts +8 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.html +17 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.scss +34 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.spec.ts +49 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.component.ts +19 -0
- package/app/codeCharta/state/effects/nodeContextMenu/nodeContextMenuCard/nodeContextMenuCard.module.ts +18 -0
- package/app/codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect.spec.ts +32 -0
- package/app/codeCharta/state/effects/nodeContextMenu/openNodeContextMenu.effect.ts +33 -0
- package/app/codeCharta/state/effects/nodeContextMenu/rightClickedCodeMapNode.selector.ts +8 -0
- package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.spec.ts +47 -0
- package/app/codeCharta/state/effects/unfocusNodesOnLoadingMap.effect.ts +18 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/areAllNecessaryRenderDataAvailable.selector.ts +30 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areDynamicSettingsAvailable.spec.ts +36 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areDynamicSettingsAvailable.ts +10 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areMetricsAvailable.spec.ts +13 -0
- package/app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils/areMetricsAvailable.ts +8 -0
- package/app/codeCharta/state/store/appSettings/appSettings.actions.ts +2 -0
- package/app/codeCharta/state/store/appSettings/appSettings.reducer.ts +2 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.actions.ts +32 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.reducer.spec.ts +26 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.reducer.ts +12 -0
- package/app/codeCharta/state/store/appSettings/invertArea/invertArea.selector.ts +3 -0
- package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.spec.ts +14 -3
- package/app/codeCharta/state/store/appSettings/isLoadingMap/isLoadingMap.reducer.ts +41 -6
- package/app/codeCharta/state/store/appStatus/appStatus.reducer.ts +3 -1
- package/app/codeCharta/state/store/appStatus/appStatus.selector.ts +3 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.actions.ts +23 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.reducer.ts +15 -0
- package/app/codeCharta/state/store/appStatus/rightClickedNodeData/rightClickedNodeData.selector.ts +4 -0
- package/app/codeCharta/state/store/dynamicSettings/dynamicSettings.splitter.ts +2 -2
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/currentFocused.selector.ts +8 -0
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.actions.ts +27 -7
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.spec.ts +27 -11
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.reducer.ts +11 -5
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.selector.ts +4 -0
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.spec.ts +2 -2
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.service.ts +1 -1
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.actions.ts +33 -2
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.reducer.spec.ts +17 -1
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.reducer.ts +3 -1
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.service.spec.ts +1 -19
- package/app/codeCharta/state/store/fileSettings/blacklist/blacklist.service.ts +5 -28
- package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.actions.ts +9 -10
- package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.reducer.spec.ts +37 -7
- package/app/codeCharta/state/store/fileSettings/markedPackages/markedPackages.reducer.ts +7 -3
- package/app/codeCharta/state/store/fileSettings/markedPackages/util/findIndexOfMarkedPackageOrParent.spec.ts +39 -0
- package/app/codeCharta/state/store/fileSettings/markedPackages/util/findIndexOfMarkedPackageOrParent.ts +19 -0
- package/app/codeCharta/state/store/lookUp/idToNode/idToNode.selector.ts +4 -0
- package/app/codeCharta/state/store/lookUp/lookUp.selector.ts +3 -0
- package/app/codeCharta/state/store/metricData/nodeMetricData/nodeMetricData.service.ts +0 -4
- package/app/codeCharta/state/store/state.actions.ts +3 -1
- package/app/codeCharta/state/store/state.splitter.spec.ts +4 -4
- package/app/codeCharta/state/store/store.ts +5 -1
- package/app/codeCharta/state/store.service.spec.ts +21 -8
- package/app/codeCharta/state/store.service.ts +3 -31
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.html +3 -1
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.scss +6 -2
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.component.ts +1 -1
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.module.ts +3 -0
- package/app/codeCharta/ui/areaSettingsPanel/areaSettingsPanel.po.ts +4 -4
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.html +1 -0
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.scss +26 -0
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.spec.ts +29 -0
- package/app/codeCharta/ui/areaSettingsPanel/invertAreaOption/invertAreaOption.component.ts +24 -0
- package/app/codeCharta/ui/artificialIntelligence/__snapshots__/artificialIntelligence.component.spec.ts.snap +13 -16
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.html +4 -4
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.scss +0 -4
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.spec.ts +82 -52
- package/app/codeCharta/ui/artificialIntelligence/artificialIntelligence.component.ts +41 -101
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/aggregationType.pipe.spec.ts +19 -0
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/{aggregationSymbol.pipe.ts → aggregationType.pipe.ts} +4 -4
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.html +4 -12
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.scss +11 -20
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.component.spec.ts +8 -15
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/attributeTypeSelector.module.ts +2 -2
- package/app/codeCharta/ui/codeMap/__snapshots__/codeMap.arrow.service.spec.ts.snap +2 -2
- package/app/codeCharta/ui/codeMap/codeMap.actions.service.ts +1 -40
- package/app/codeCharta/ui/codeMap/codeMap.mouseEvent.service.ts +8 -16
- package/app/codeCharta/ui/codeMap/codeMap.preRender.service.spec.ts +1 -9
- package/app/codeCharta/ui/codeMap/codeMap.preRender.service.ts +9 -32
- package/app/codeCharta/ui/codeMap/rendering/codeMapMesh.ts +1 -0
- package/app/codeCharta/ui/colorPicker/colorPicker.component.html +16 -7
- package/app/codeCharta/ui/colorPicker/colorPicker.component.spec.ts +55 -16
- package/app/codeCharta/ui/colorPicker/colorPicker.component.ts +32 -1
- package/app/codeCharta/ui/colorPicker/colorPicker.module.ts +3 -1
- package/app/codeCharta/ui/customConfigs/customConfigs.component.html +29 -11
- package/app/codeCharta/ui/customConfigs/customConfigs.component.scss +1 -0
- package/app/codeCharta/ui/customConfigs/customConfigs.component.spec.ts +123 -2
- package/app/codeCharta/ui/customConfigs/customConfigs.component.ts +56 -2
- package/app/codeCharta/ui/dialog/dialog.addCustomConfigSettings.component.html +2 -2
- package/app/codeCharta/ui/dialog/dialog.changelog.component.html +1 -1
- package/app/codeCharta/ui/dialog/dialog.changelog.component.scss +15 -0
- package/app/codeCharta/ui/dialog/dialog.changelog.component.spec.ts +15 -15
- package/app/codeCharta/ui/dialog/dialog.changelog.component.ts +2 -1
- package/app/codeCharta/ui/dialog/dialog.globalSettings.e2e.ts +1 -1
- package/app/codeCharta/ui/dialog/dialog.globalSettings.po.ts +1 -1
- package/app/codeCharta/ui/dialog/dialog.service.spec.ts +68 -0
- package/app/codeCharta/ui/dialog/dialog.service.ts +38 -17
- package/app/codeCharta/ui/dialogs/dialogs.ts +3 -0
- package/app/codeCharta/ui/dialogs/errorDialog/errorDialog.component.html +7 -0
- package/app/codeCharta/ui/dialogs/errorDialog/errorDialog.component.ts +9 -0
- package/app/codeCharta/ui/edgeChooser/edgeChooser.e2e.ts +3 -2
- package/app/codeCharta/ui/fileChooser/fileChooser.e2e.ts +5 -6
- package/app/codeCharta/ui/filePanel/filePanel.component.html +24 -106
- package/app/codeCharta/ui/filePanel/filePanel.component.scss +12 -57
- package/app/codeCharta/ui/filePanel/filePanel.component.spec.ts +40 -72
- package/app/codeCharta/ui/filePanel/filePanel.component.ts +29 -81
- package/app/codeCharta/ui/filePanel/filePanel.module.ts +13 -1
- package/app/codeCharta/ui/filePanel/filePanel.po.ts +6 -24
- package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.html +23 -0
- package/app/codeCharta/ui/filePanel/filePanelDeltaSelector/filePanelDeltaSelector.component.ts +18 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.html +18 -0
- package/app/codeCharta/ui/filePanel/filePanelFileSelector/filePanelFileSelector.component.ts +16 -0
- package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.html +18 -0
- package/app/codeCharta/ui/filePanel/filePanelStateButtons/filePanelStateButtons.component.ts +11 -0
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.html +21 -13
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.spec.ts +11 -24
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.component.ts +1 -40
- package/app/codeCharta/ui/labelledColorPicker/labelledColorPicker.module.ts +1 -2
- package/app/codeCharta/ui/legendPanel/legendMarkedPackages/legendMarkedPackages.component.ts +2 -2
- package/app/codeCharta/ui/mapTreeView/mapTreeView.level.e2e.ts +8 -6
- package/app/codeCharta/ui/mapTreeView/mapTreeView.level.po.ts +1 -1
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.html +1 -1
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.spec.ts +6 -16
- package/app/codeCharta/ui/mapTreeView/mapTreeViewLevel/mapTreeViewLevel.component.ts +15 -11
- package/app/codeCharta/ui/ribbonBar/ribbonBar.component.html +3 -3
- package/app/codeCharta/ui/ribbonBar/ribbonBar.e2e.ts +3 -3
- package/app/codeCharta/ui/searchBar/searchBar.component.html +5 -0
- package/app/codeCharta/ui/searchBar/searchBar.component.scss +11 -0
- package/app/codeCharta/ui/searchBar/searchBar.component.spec.ts +10 -0
- package/app/codeCharta/ui/searchBar/searchBar.component.ts +1 -1
- package/app/codeCharta/ui/sortingOption/sortingOption.component.spec.ts +1 -1
- package/app/codeCharta/ui/toolBar/toolBar.component.html +1 -1
- package/app/codeCharta/ui/toolBar/toolBar.component.scss +1 -1
- package/app/codeCharta/ui/ui.ts +2 -6
- package/app/codeCharta/util/algorithm/streetLayout/strip/strip.ts +2 -2
- package/app/codeCharta/util/algorithm/streetLayout/treeMap.ts +1 -1
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapGenerator.spec.ts +2 -2
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapGenerator.ts +14 -7
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.spec.ts +2 -2
- package/app/codeCharta/util/algorithm/treeMapLayout/treeMapHelper.ts +1 -1
- package/app/codeCharta/util/customConfigBuilder.ts +2 -1
- package/app/codeCharta/util/customConfigHelper.spec.ts +155 -60
- package/app/codeCharta/util/customConfigHelper.ts +33 -3
- package/app/codeCharta/util/dataMocks.ts +8 -4
- package/app/codeCharta/util/fileExtensionCalculator.ts +1 -1
- package/app/codeCharta/util/fileValidator.spec.ts +69 -182
- package/app/codeCharta/util/fileValidator.ts +61 -37
- package/app/codeCharta/util/reduxHelper.ts +11 -0
- package/app/material/material.module.ts +17 -1
- package/conf/webpack.loaders.js +4 -1
- package/dist/webpack/bundle.js +5925 -1896
- package/dist/webpack/bundle.js.map +1 -1
- package/package.json +7 -6
- package/app/codeCharta/state/store/dynamicSettings/focusedNodePath/focusedNodePath.splitter.ts +0 -8
- package/app/codeCharta/ui/attributeSideBar/attributeTypeSelector/aggregationSymbol.pipe.spec.ts +0 -19
- package/app/codeCharta/ui/codeMap/codeMap.actions.service.spec.ts +0 -147
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.html +0 -5
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.scss +0 -13
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.component.ts +0 -30
- package/app/codeCharta/ui/nodeContextMenu/markFolderColorPicker/markFolderColorPicker.module.ts +0 -13
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.html +0 -68
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.scss +0 -52
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.spec.ts +0 -571
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.component.ts +0 -318
- package/app/codeCharta/ui/nodeContextMenu/nodeContextMenu.module.ts +0 -13
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.html +0 -15
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.scss +0 -5
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.spec.ts +0 -106
- package/app/codeCharta/ui/unfocusButton/unfocusButton.component.ts +0 -62
- package/app/codeCharta/ui/unfocusButton/unfocusButton.module.ts +0 -7
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
} from "./dataMocks"
|
|
8
8
|
import { CodeMapNode, NameDataPair, NodeType } from "../codeCharta.model"
|
|
9
9
|
import packageJson from "../../../package.json"
|
|
10
|
-
import {
|
|
11
|
-
import assert from "assert"
|
|
10
|
+
import { checkErrors, checkWarnings, ERROR_MESSAGES } from "./fileValidator"
|
|
12
11
|
import { fileWithFixedFolders, fileWithFixedOverlappingSubFolders } from "../resources/fixed-folders/fixed-folders-example"
|
|
13
12
|
import { APIVersions, ExportCCFile } from "../codeCharta.api.model"
|
|
14
13
|
import { clone } from "./clone"
|
|
@@ -25,14 +24,9 @@ describe("FileValidator", () => {
|
|
|
25
24
|
})
|
|
26
25
|
|
|
27
26
|
it("should throw on null", () => {
|
|
28
|
-
const
|
|
29
|
-
error: [ERROR_MESSAGES.fileIsInvalid],
|
|
30
|
-
warning: []
|
|
31
|
-
}
|
|
27
|
+
const expectedErrors = [ERROR_MESSAGES.fileIsInvalid]
|
|
32
28
|
|
|
33
|
-
|
|
34
|
-
validate(null)
|
|
35
|
-
}, expectedError)
|
|
29
|
+
expect(checkErrors(null)).toEqual(expectedErrors)
|
|
36
30
|
})
|
|
37
31
|
|
|
38
32
|
it("should throw when higher Major API", () => {
|
|
@@ -41,15 +35,9 @@ describe("FileValidator", () => {
|
|
|
41
35
|
fileSize: 30,
|
|
42
36
|
content: TEST_FILE_CONTENT_INVALID_MAJOR_API
|
|
43
37
|
}
|
|
38
|
+
const expectedErrors = [ERROR_MESSAGES.majorApiVersionIsOutdated]
|
|
44
39
|
|
|
45
|
-
|
|
46
|
-
error: [ERROR_MESSAGES.majorApiVersionIsOutdated],
|
|
47
|
-
warning: []
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
assert.throws(() => {
|
|
51
|
-
validate(nameDataPair)
|
|
52
|
-
}, expectedError)
|
|
40
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
53
41
|
})
|
|
54
42
|
|
|
55
43
|
it("should throw on warning with higher minor API version", () => {
|
|
@@ -58,15 +46,9 @@ describe("FileValidator", () => {
|
|
|
58
46
|
fileSize: 30,
|
|
59
47
|
content: TEST_FILE_CONTENT_INVALID_MINOR_API
|
|
60
48
|
}
|
|
49
|
+
const expectedWarnings = [`${ERROR_MESSAGES.minorApiVersionOutdated} Found: ${nameDataPair.content.apiVersion}`]
|
|
61
50
|
|
|
62
|
-
|
|
63
|
-
error: [],
|
|
64
|
-
warning: [`${ERROR_MESSAGES.minorApiVersionOutdated} Found: ${nameDataPair.content.apiVersion}`]
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
assert.throws(() => {
|
|
68
|
-
validate(nameDataPair)
|
|
69
|
-
}, expectedError)
|
|
51
|
+
expect(checkWarnings(nameDataPair.content)).toEqual(expectedWarnings)
|
|
70
52
|
})
|
|
71
53
|
|
|
72
54
|
it("should throw on file missing API version", () => {
|
|
@@ -75,15 +57,9 @@ describe("FileValidator", () => {
|
|
|
75
57
|
fileSize: 30,
|
|
76
58
|
content: TEST_FILE_CONTENT_NO_API
|
|
77
59
|
}
|
|
60
|
+
const expectedErrors = [ERROR_MESSAGES.apiVersionIsInvalid]
|
|
78
61
|
|
|
79
|
-
|
|
80
|
-
error: [ERROR_MESSAGES.apiVersionIsInvalid],
|
|
81
|
-
warning: []
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
assert.throws(() => {
|
|
85
|
-
validate(nameDataPair)
|
|
86
|
-
}, expectedError)
|
|
62
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
87
63
|
})
|
|
88
64
|
|
|
89
65
|
it("should throw on file with wrong API version", () => {
|
|
@@ -92,15 +68,9 @@ describe("FileValidator", () => {
|
|
|
92
68
|
fileSize: 30,
|
|
93
69
|
content: TEST_FILE_CONTENT_INVALID_API
|
|
94
70
|
}
|
|
71
|
+
const expectedErrors = [ERROR_MESSAGES.apiVersionIsInvalid]
|
|
95
72
|
|
|
96
|
-
|
|
97
|
-
error: [ERROR_MESSAGES.apiVersionIsInvalid],
|
|
98
|
-
warning: []
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
assert.throws(() => {
|
|
102
|
-
validate(nameDataPair)
|
|
103
|
-
}, expectedError)
|
|
73
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
104
74
|
})
|
|
105
75
|
|
|
106
76
|
it("should not throw on a file with edges", () => {
|
|
@@ -117,7 +87,8 @@ describe("FileValidator", () => {
|
|
|
117
87
|
|
|
118
88
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
119
89
|
|
|
120
|
-
|
|
90
|
+
expect(checkErrors(nameDataPair.content)).toEqual([])
|
|
91
|
+
expect(checkWarnings(nameDataPair.content)).toEqual([])
|
|
121
92
|
})
|
|
122
93
|
|
|
123
94
|
it("should not throw on a file without edges", () => {
|
|
@@ -125,7 +96,8 @@ describe("FileValidator", () => {
|
|
|
125
96
|
|
|
126
97
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
127
98
|
|
|
128
|
-
|
|
99
|
+
expect(checkErrors(nameDataPair.content)).toEqual([])
|
|
100
|
+
expect(checkWarnings(nameDataPair.content)).toEqual([])
|
|
129
101
|
})
|
|
130
102
|
|
|
131
103
|
it("should not throw on a file when numbers are floating point values", () => {
|
|
@@ -133,7 +105,8 @@ describe("FileValidator", () => {
|
|
|
133
105
|
|
|
134
106
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
135
107
|
|
|
136
|
-
|
|
108
|
+
expect(checkErrors(nameDataPair.content)).toEqual([])
|
|
109
|
+
expect(checkWarnings(nameDataPair.content)).toEqual([])
|
|
137
110
|
})
|
|
138
111
|
|
|
139
112
|
it("should throw when children are not unique in name+type", () => {
|
|
@@ -142,30 +115,17 @@ describe("FileValidator", () => {
|
|
|
142
115
|
file.nodes[0].children[1].name = "same"
|
|
143
116
|
file.nodes[0].children[1].type = NodeType.FILE
|
|
144
117
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
118
|
+
const expectedErrors = [`${ERROR_MESSAGES.nodesNotUnique} Found duplicate of File with path: /root/same`]
|
|
145
119
|
|
|
146
|
-
|
|
147
|
-
error: [`${ERROR_MESSAGES.nodesNotUnique} Found duplicate of File with path: /root/same`],
|
|
148
|
-
warning: []
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
assert.throws(() => {
|
|
152
|
-
validate(nameDataPair)
|
|
153
|
-
}, expectedError)
|
|
120
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
154
121
|
})
|
|
155
122
|
|
|
156
123
|
it("should throw when nodes are empty", () => {
|
|
157
124
|
file.nodes = []
|
|
158
|
-
|
|
159
125
|
const nameDataPair: NameDataPair = { fileName: "", fileSize: 30, content: file }
|
|
126
|
+
const expectedErrors = [ERROR_MESSAGES.nodesEmpty]
|
|
160
127
|
|
|
161
|
-
|
|
162
|
-
error: [ERROR_MESSAGES.nodesEmpty],
|
|
163
|
-
warning: []
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
assert.throws(() => {
|
|
167
|
-
validate(nameDataPair)
|
|
168
|
-
}, expectedError)
|
|
128
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
169
129
|
})
|
|
170
130
|
|
|
171
131
|
it("should throw if nodes is not a node and therefore has no name or id", () => {
|
|
@@ -173,20 +133,13 @@ describe("FileValidator", () => {
|
|
|
173
133
|
// @ts-expect-error
|
|
174
134
|
something: "something"
|
|
175
135
|
}
|
|
176
|
-
|
|
177
136
|
const nameDataPair: NameDataPair = { fileName: "", fileSize: 30, content: file }
|
|
137
|
+
const expectedErrors = [
|
|
138
|
+
"Required error: nodes[0] should have required property 'name'",
|
|
139
|
+
"Required error: nodes[0] should have required property 'type'"
|
|
140
|
+
]
|
|
178
141
|
|
|
179
|
-
|
|
180
|
-
error: [
|
|
181
|
-
"Required error: nodes[0] should have required property 'name'",
|
|
182
|
-
"Required error: nodes[0] should have required property 'type'"
|
|
183
|
-
],
|
|
184
|
-
warning: []
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
assert.throws(() => {
|
|
188
|
-
validate(nameDataPair)
|
|
189
|
-
}, expectedError)
|
|
142
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
190
143
|
})
|
|
191
144
|
|
|
192
145
|
describe("fixed sub folders validation", () => {
|
|
@@ -195,19 +148,13 @@ describe("FileValidator", () => {
|
|
|
195
148
|
const folder1: CodeMapNode = file.nodes[0].children[0].children[0]
|
|
196
149
|
const folder2: CodeMapNode = file.nodes[0].children[0].children[1]
|
|
197
150
|
const nameDataPair: NameDataPair = { fileName: "", fileSize: 30, content: file }
|
|
151
|
+
const expectedErrors = [
|
|
152
|
+
`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: folder_1_1 ${JSON.stringify(
|
|
153
|
+
folder1.fixedPosition
|
|
154
|
+
)} and folder_1_2 ${JSON.stringify(folder2.fixedPosition)}`
|
|
155
|
+
]
|
|
198
156
|
|
|
199
|
-
|
|
200
|
-
error: [
|
|
201
|
-
`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: folder_1_1 ${JSON.stringify(
|
|
202
|
-
folder1.fixedPosition
|
|
203
|
-
)} and folder_1_2 ${JSON.stringify(folder2.fixedPosition)}`
|
|
204
|
-
],
|
|
205
|
-
warning: []
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
assert.throws(() => {
|
|
209
|
-
validate(nameDataPair)
|
|
210
|
-
}, expectedError)
|
|
157
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
211
158
|
})
|
|
212
159
|
})
|
|
213
160
|
|
|
@@ -223,59 +170,36 @@ describe("FileValidator", () => {
|
|
|
223
170
|
it("should throw an error, if there are fixed folders, but not every folder on root is fixed", () => {
|
|
224
171
|
folder1.fixedPosition = undefined
|
|
225
172
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
226
|
-
const
|
|
227
|
-
error: [`${ERROR_MESSAGES.notAllFoldersAreFixed} Found: folder_1`],
|
|
228
|
-
warning: []
|
|
229
|
-
}
|
|
173
|
+
const expectedErrors = [`${ERROR_MESSAGES.notAllFoldersAreFixed} Found: folder_1`]
|
|
230
174
|
|
|
231
|
-
|
|
232
|
-
validate(nameDataPair)
|
|
233
|
-
}, expectedError)
|
|
175
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
234
176
|
})
|
|
235
177
|
|
|
236
178
|
it("should throw an error, if at least one fixed folder has a padding that is out of bounds", () => {
|
|
237
179
|
folder1.fixedPosition.left = -5
|
|
238
180
|
folder1.fixedPosition.width = 7
|
|
239
|
-
const nameDataPair: NameDataPair = { fileName: "", fileSize: 30, content: file }
|
|
240
|
-
|
|
241
|
-
const expectedError: CCValidationResult = {
|
|
242
|
-
error: [`${ERROR_MESSAGES.fixedFoldersOutOfBounds} Found: folder_1 ${JSON.stringify(folder1.fixedPosition)}`],
|
|
243
|
-
warning: []
|
|
244
|
-
}
|
|
181
|
+
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
182
|
+
const expectedErrors = [`${ERROR_MESSAGES.fixedFoldersOutOfBounds} Found: folder_1 ${JSON.stringify(folder1.fixedPosition)}`]
|
|
245
183
|
|
|
246
|
-
|
|
247
|
-
validate(nameDataPair)
|
|
248
|
-
}, expectedError)
|
|
184
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
249
185
|
})
|
|
250
186
|
|
|
251
187
|
it("should throw an error, if at least one fixed folder has a width or height that is out of bounds", () => {
|
|
252
188
|
folder1.fixedPosition.left = 10
|
|
253
189
|
folder1.fixedPosition.width = -50
|
|
254
190
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
191
|
+
const expectedErrors = [`${ERROR_MESSAGES.fixedFoldersOutOfBounds} Found: folder_1 ${JSON.stringify(folder1.fixedPosition)}`]
|
|
255
192
|
|
|
256
|
-
|
|
257
|
-
error: [`${ERROR_MESSAGES.fixedFoldersOutOfBounds} Found: folder_1 ${JSON.stringify(folder1.fixedPosition)}`],
|
|
258
|
-
warning: []
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
assert.throws(() => {
|
|
262
|
-
validate(nameDataPair)
|
|
263
|
-
}, expectedError)
|
|
193
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
264
194
|
})
|
|
265
195
|
|
|
266
196
|
it("should throw an error, if at least one fixed folder exceeds the maximum coordinate of 100", () => {
|
|
267
197
|
folder1.fixedPosition.left = 99
|
|
268
198
|
folder1.fixedPosition.width = 2
|
|
269
199
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
200
|
+
const expectedErrors = [`${ERROR_MESSAGES.fixedFoldersOutOfBounds} Found: folder_1 ${JSON.stringify(folder1.fixedPosition)}`]
|
|
270
201
|
|
|
271
|
-
|
|
272
|
-
error: [`${ERROR_MESSAGES.fixedFoldersOutOfBounds} Found: folder_1 ${JSON.stringify(folder1.fixedPosition)}`],
|
|
273
|
-
warning: []
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
assert.throws(() => {
|
|
277
|
-
validate(nameDataPair)
|
|
278
|
-
}, expectedError)
|
|
202
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
279
203
|
})
|
|
280
204
|
|
|
281
205
|
it("should throw an error, if two folders horizontally overlap", () => {
|
|
@@ -292,19 +216,13 @@ describe("FileValidator", () => {
|
|
|
292
216
|
height: 10
|
|
293
217
|
}
|
|
294
218
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
219
|
+
const expectedErrors = [
|
|
220
|
+
`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: folder_1 ${JSON.stringify(
|
|
221
|
+
folder1.fixedPosition
|
|
222
|
+
)} and folder_2 ${JSON.stringify(folder2.fixedPosition)}`
|
|
223
|
+
]
|
|
295
224
|
|
|
296
|
-
|
|
297
|
-
error: [
|
|
298
|
-
`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: folder_1 ${JSON.stringify(
|
|
299
|
-
folder1.fixedPosition
|
|
300
|
-
)} and folder_2 ${JSON.stringify(folder2.fixedPosition)}`
|
|
301
|
-
],
|
|
302
|
-
warning: []
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
assert.throws(() => {
|
|
306
|
-
validate(nameDataPair)
|
|
307
|
-
}, expectedError)
|
|
225
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
308
226
|
})
|
|
309
227
|
|
|
310
228
|
it("should throw an error, if two folders vertically overlap", () => {
|
|
@@ -321,19 +239,12 @@ describe("FileValidator", () => {
|
|
|
321
239
|
height: 10
|
|
322
240
|
}
|
|
323
241
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
],
|
|
331
|
-
warning: []
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
assert.throws(() => {
|
|
335
|
-
validate(nameDataPair)
|
|
336
|
-
}, expectedError)
|
|
242
|
+
const expectedErrors = [
|
|
243
|
+
`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: folder_1 ${JSON.stringify(
|
|
244
|
+
folder1.fixedPosition
|
|
245
|
+
)} and folder_2 ${JSON.stringify(folder2.fixedPosition)}`
|
|
246
|
+
]
|
|
247
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
337
248
|
})
|
|
338
249
|
|
|
339
250
|
it("should throw an error, if a folder is placed inside another", () => {
|
|
@@ -350,19 +261,13 @@ describe("FileValidator", () => {
|
|
|
350
261
|
height: 1
|
|
351
262
|
}
|
|
352
263
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
264
|
+
const expectedErrors = [
|
|
265
|
+
`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: folder_2 ${JSON.stringify(
|
|
266
|
+
folder2.fixedPosition
|
|
267
|
+
)} and folder_1 ${JSON.stringify(folder1.fixedPosition)}`
|
|
268
|
+
]
|
|
353
269
|
|
|
354
|
-
|
|
355
|
-
error: [
|
|
356
|
-
`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: folder_2 ${JSON.stringify(
|
|
357
|
-
folder2.fixedPosition
|
|
358
|
-
)} and folder_1 ${JSON.stringify(folder1.fixedPosition)}`
|
|
359
|
-
],
|
|
360
|
-
warning: []
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
assert.throws(() => {
|
|
364
|
-
validate(nameDataPair)
|
|
365
|
-
}, expectedError)
|
|
270
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
366
271
|
})
|
|
367
272
|
|
|
368
273
|
it("should throw an error, if a folder has the same boundaries as another", () => {
|
|
@@ -374,47 +279,29 @@ describe("FileValidator", () => {
|
|
|
374
279
|
}
|
|
375
280
|
folder2.fixedPosition = folder1.fixedPosition
|
|
376
281
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
282
|
+
const expectedErrors = [
|
|
283
|
+
`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: folder_1 ${JSON.stringify(
|
|
284
|
+
folder1.fixedPosition
|
|
285
|
+
)} and folder_2 ${JSON.stringify(folder2.fixedPosition)}`
|
|
286
|
+
]
|
|
377
287
|
|
|
378
|
-
|
|
379
|
-
error: [
|
|
380
|
-
`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: folder_1 ${JSON.stringify(
|
|
381
|
-
folder1.fixedPosition
|
|
382
|
-
)} and folder_2 ${JSON.stringify(folder2.fixedPosition)}`
|
|
383
|
-
],
|
|
384
|
-
warning: []
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
assert.throws(() => {
|
|
388
|
-
validate(nameDataPair)
|
|
389
|
-
}, expectedError)
|
|
288
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
390
289
|
})
|
|
391
290
|
|
|
392
291
|
it("should throw an error, if the major api version is smaller and fixed folders were defined", () => {
|
|
393
292
|
file.apiVersion = APIVersions.ZERO_POINT_ONE
|
|
394
293
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
294
|
+
const expectedErrors = [`${ERROR_MESSAGES.fixedFoldersNotAllowed} Found: 0.1`]
|
|
395
295
|
|
|
396
|
-
|
|
397
|
-
error: [`${ERROR_MESSAGES.fixedFoldersNotAllowed} Found: 0.1`],
|
|
398
|
-
warning: []
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
assert.throws(() => {
|
|
402
|
-
validate(nameDataPair)
|
|
403
|
-
}, expectedError)
|
|
296
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
404
297
|
})
|
|
405
298
|
|
|
406
299
|
it("should throw an error, if the minor api version is smaller and fixed folders were defined", () => {
|
|
407
300
|
file.apiVersion = APIVersions.ONE_POINT_ONE
|
|
408
301
|
const nameDataPair: NameDataPair = { fileName: "fileName", fileSize: 30, content: file }
|
|
302
|
+
const expectedErrors = [`${ERROR_MESSAGES.fixedFoldersNotAllowed} Found: 1.1`]
|
|
409
303
|
|
|
410
|
-
|
|
411
|
-
error: [`${ERROR_MESSAGES.fixedFoldersNotAllowed} Found: 1.1`],
|
|
412
|
-
warning: []
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
assert.throws(() => {
|
|
416
|
-
validate(nameDataPair)
|
|
417
|
-
}, expectedError)
|
|
304
|
+
expect(checkErrors(nameDataPair.content)).toEqual(expectedErrors)
|
|
418
305
|
})
|
|
419
306
|
})
|
|
420
307
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeMapNode, FixedPosition
|
|
1
|
+
import { CodeMapNode, FixedPosition } from "../codeCharta.model"
|
|
2
2
|
import Ajv from "ajv"
|
|
3
3
|
import packageJson from "../../../package.json"
|
|
4
4
|
import { ExportCCFile } from "../codeCharta.api.model"
|
|
@@ -12,9 +12,10 @@ interface ApiVersion {
|
|
|
12
12
|
minor: number
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export interface
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export interface CCFileValidationResult {
|
|
16
|
+
fileName: string
|
|
17
|
+
errors: string[]
|
|
18
|
+
warnings: string[]
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export const ERROR_MESSAGES = {
|
|
@@ -32,42 +33,50 @@ export const ERROR_MESSAGES = {
|
|
|
32
33
|
blacklistError: "Excluding all buildings is not possible."
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export function
|
|
36
|
-
const
|
|
37
|
-
|
|
36
|
+
export function checkWarnings(file: ExportCCFile) {
|
|
37
|
+
const warnings: string[] = []
|
|
38
|
+
if (!file) {
|
|
39
|
+
return warnings
|
|
40
|
+
}
|
|
41
|
+
if (fileHasHigherMinorVersion(file)) {
|
|
42
|
+
warnings.push(`${ERROR_MESSAGES.minorApiVersionOutdated} Found: ${file.apiVersion}`)
|
|
43
|
+
}
|
|
44
|
+
return warnings
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function checkErrors(file: ExportCCFile) {
|
|
48
|
+
const errors: string[] = []
|
|
38
49
|
switch (true) {
|
|
39
50
|
case !file:
|
|
40
|
-
|
|
51
|
+
errors.push(ERROR_MESSAGES.fileIsInvalid)
|
|
41
52
|
break
|
|
42
53
|
case !isValidApiVersion(file):
|
|
43
|
-
|
|
54
|
+
errors.push(ERROR_MESSAGES.apiVersionIsInvalid)
|
|
44
55
|
break
|
|
45
56
|
case fileHasHigherMajorVersion(file):
|
|
46
|
-
|
|
47
|
-
break
|
|
48
|
-
case fileHasHigherMinorVersion(file):
|
|
49
|
-
result.warning.push(`${ERROR_MESSAGES.minorApiVersionOutdated} Found: ${file.apiVersion}`)
|
|
57
|
+
errors.push(ERROR_MESSAGES.majorApiVersionIsOutdated)
|
|
50
58
|
break
|
|
51
59
|
}
|
|
60
|
+
if (errors.length === 0) errors.push(...checkJsonSchema(file))
|
|
61
|
+
return errors
|
|
62
|
+
}
|
|
52
63
|
|
|
53
|
-
|
|
64
|
+
function checkJsonSchema(file: ExportCCFile) {
|
|
65
|
+
const errors: string[] = []
|
|
66
|
+
if (errors.length === 0) {
|
|
54
67
|
const ajv = new Ajv({ allErrors: true })
|
|
55
68
|
const validate = ajv.compile(jsonSchema)
|
|
56
69
|
const valid = validate(file)
|
|
57
70
|
|
|
58
71
|
if (!valid) {
|
|
59
|
-
|
|
72
|
+
errors.push(...validate.errors.map((error: Ajv.ErrorObject) => getValidationMessage(error)))
|
|
60
73
|
} else if (file.nodes.length === 0) {
|
|
61
|
-
|
|
74
|
+
errors.push(ERROR_MESSAGES.nodesEmpty)
|
|
62
75
|
} else {
|
|
63
|
-
validateAllNodesAreUnique(file.nodes[0],
|
|
64
|
-
validateFixedFolders(file, result)
|
|
76
|
+
errors.push(...validateAllNodesAreUnique(file.nodes[0]), ...validateFixedFolders(file))
|
|
65
77
|
}
|
|
66
78
|
}
|
|
67
|
-
|
|
68
|
-
if (result.error.length > 0 || result.warning.length > 0) {
|
|
69
|
-
throw result
|
|
70
|
-
}
|
|
79
|
+
return errors
|
|
71
80
|
}
|
|
72
81
|
|
|
73
82
|
function isValidApiVersion(file: ExportCCFile) {
|
|
@@ -101,13 +110,15 @@ function getValidationMessage(error: Ajv.ErrorObject) {
|
|
|
101
110
|
return `${errorType} error: ${errorParameter} ${error.message}`
|
|
102
111
|
}
|
|
103
112
|
|
|
104
|
-
function validateAllNodesAreUnique(node: CodeMapNode
|
|
113
|
+
function validateAllNodesAreUnique(node: CodeMapNode) {
|
|
114
|
+
const errors: string[] = []
|
|
105
115
|
const names = new Set<string>()
|
|
106
116
|
names.add(`${node.name}|${node.type}`)
|
|
107
|
-
validateChildrenAreUniqueRecursive(node,
|
|
117
|
+
validateChildrenAreUniqueRecursive(node, errors, names, `/${node.name}`)
|
|
118
|
+
return errors
|
|
108
119
|
}
|
|
109
120
|
|
|
110
|
-
function validateChildrenAreUniqueRecursive(node: CodeMapNode,
|
|
121
|
+
function validateChildrenAreUniqueRecursive(node: CodeMapNode, errors: string[], names: Set<string>, subPath: string) {
|
|
111
122
|
if (isLeaf(node)) {
|
|
112
123
|
return
|
|
113
124
|
}
|
|
@@ -115,26 +126,29 @@ function validateChildrenAreUniqueRecursive(node: CodeMapNode, result: CCValidat
|
|
|
115
126
|
for (const child of node.children) {
|
|
116
127
|
const path = `${subPath}/${child.name}`
|
|
117
128
|
if (names.has(`${path}|${child.type}`)) {
|
|
118
|
-
|
|
129
|
+
errors.push(`${ERROR_MESSAGES.nodesNotUnique} Found duplicate of ${child.type} with path: ${path}`)
|
|
119
130
|
} else {
|
|
120
131
|
names.add(`${path}|${child.type}`)
|
|
121
|
-
validateChildrenAreUniqueRecursive(child,
|
|
132
|
+
validateChildrenAreUniqueRecursive(child, errors, names, path)
|
|
122
133
|
}
|
|
123
134
|
}
|
|
124
135
|
}
|
|
125
136
|
|
|
126
|
-
function
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
137
|
+
function checkChildNodes(
|
|
138
|
+
childNodes: CodeMapNode[],
|
|
139
|
+
notFixed: string[],
|
|
140
|
+
file: ExportCCFile,
|
|
141
|
+
errors: string[],
|
|
142
|
+
outOfBounds: string[],
|
|
143
|
+
intersections: Set<string>
|
|
144
|
+
) {
|
|
131
145
|
for (const node of childNodes) {
|
|
132
146
|
if (node.fixedPosition === undefined) {
|
|
133
147
|
notFixed.push(`${node.name}`)
|
|
134
148
|
} else {
|
|
135
149
|
const apiVersion = getAsApiVersion(file.apiVersion)
|
|
136
150
|
if (apiVersion.major < 1 || (apiVersion.major === 1 && apiVersion.minor < 2)) {
|
|
137
|
-
|
|
151
|
+
errors.push(`${ERROR_MESSAGES.fixedFoldersNotAllowed} Found: ${file.apiVersion}`)
|
|
138
152
|
return
|
|
139
153
|
}
|
|
140
154
|
|
|
@@ -154,24 +168,34 @@ function validateFixedFolders(file: ExportCCFile, result: CCValidationResult, ch
|
|
|
154
168
|
}
|
|
155
169
|
}
|
|
156
170
|
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function validateFixedFolders(file: ExportCCFile, childNodes: CodeMapNode[] = file.nodes[0].children) {
|
|
174
|
+
const errors: string[] = []
|
|
175
|
+
const notFixed: string[] = []
|
|
176
|
+
const outOfBounds: string[] = []
|
|
177
|
+
const intersections: Set<string> = new Set()
|
|
178
|
+
|
|
179
|
+
checkChildNodes(childNodes, notFixed, file, errors, outOfBounds, intersections)
|
|
157
180
|
|
|
158
181
|
if (notFixed.length > 0 && notFixed.length !== childNodes.length) {
|
|
159
|
-
|
|
182
|
+
errors.push(`${ERROR_MESSAGES.notAllFoldersAreFixed} Found: ${notFixed.join(", ")}`)
|
|
160
183
|
}
|
|
161
184
|
|
|
162
185
|
if (outOfBounds.length > 0) {
|
|
163
|
-
|
|
186
|
+
errors.push(`${ERROR_MESSAGES.fixedFoldersOutOfBounds} Found: ${outOfBounds.join(", ")}`)
|
|
164
187
|
}
|
|
165
188
|
|
|
166
189
|
if (intersections.size > 0) {
|
|
167
|
-
|
|
190
|
+
errors.push(`${ERROR_MESSAGES.fixedFoldersOverlapped} Found: ${[...intersections].join(", ")}`)
|
|
168
191
|
}
|
|
169
192
|
|
|
170
193
|
for (const node of childNodes) {
|
|
171
194
|
if (node.children) {
|
|
172
|
-
validateFixedFolders(file,
|
|
195
|
+
errors.push(...validateFixedFolders(file, node.children))
|
|
173
196
|
}
|
|
174
197
|
}
|
|
198
|
+
return errors
|
|
175
199
|
}
|
|
176
200
|
|
|
177
201
|
function getFoundFolderMessage(node: CodeMapNode) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { clone } from "./clone"
|
|
2
2
|
import isEqual from "lodash.isequal"
|
|
3
|
+
import { Action } from "redux"
|
|
3
4
|
|
|
4
5
|
export function removeItemFromArray<T>(array: T[], searchItem: T) {
|
|
5
6
|
return array.filter(entry => !isEqual(entry, searchItem))
|
|
@@ -16,10 +17,20 @@ export function addItemToArray<T>(array: T[], item: T) {
|
|
|
16
17
|
return array
|
|
17
18
|
}
|
|
18
19
|
|
|
20
|
+
export function addItemsToArray<T>(array: T[], items: T[]) {
|
|
21
|
+
const newArray = [...array]
|
|
22
|
+
for (const item of items) if (!arrayContainsItem(newArray, item)) newArray.push(item)
|
|
23
|
+
return newArray
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
export function isActionOfType(actionType: string, actions) {
|
|
20
27
|
return actions[actionType] !== undefined
|
|
21
28
|
}
|
|
22
29
|
|
|
30
|
+
export function isAction<T extends Action>(action: Action, type: string): action is T {
|
|
31
|
+
return action.type === type
|
|
32
|
+
}
|
|
33
|
+
|
|
23
34
|
function arrayContainsItem<T>(array: T[], item: T) {
|
|
24
35
|
return array.some(x => isEqual(x, item))
|
|
25
36
|
}
|
|
@@ -6,8 +6,24 @@ import { MatButtonModule } from "@angular/material/button"
|
|
|
6
6
|
import { MatDividerModule } from "@angular/material/divider"
|
|
7
7
|
import { MatTooltipModule } from "@angular/material/tooltip"
|
|
8
8
|
import { MatIconModule } from "@angular/material/icon"
|
|
9
|
+
import { MatButtonToggleModule } from "@angular/material/button-toggle"
|
|
10
|
+
import { MatDialogModule } from "@angular/material/dialog"
|
|
11
|
+
import { MatCardModule } from "@angular/material/card"
|
|
12
|
+
import { MatCheckboxModule } from "@angular/material/checkbox"
|
|
9
13
|
|
|
10
|
-
const materialModules = [
|
|
14
|
+
const materialModules = [
|
|
15
|
+
MatSelectModule,
|
|
16
|
+
MatMenuModule,
|
|
17
|
+
MatButtonModule,
|
|
18
|
+
MatDividerModule,
|
|
19
|
+
MatTooltipModule,
|
|
20
|
+
MatIconModule,
|
|
21
|
+
MatDialogModule,
|
|
22
|
+
MatCardModule,
|
|
23
|
+
MatButtonToggleModule,
|
|
24
|
+
MatDialogModule,
|
|
25
|
+
MatCheckboxModule
|
|
26
|
+
]
|
|
11
27
|
|
|
12
28
|
@NgModule({
|
|
13
29
|
imports: [BrowserAnimationsModule, materialModules],
|