cassproject 5.0.1 → 5.0.3
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/README.md +8 -0
- package/package.json +36 -24
- package/src/com/eduworks/ec/graph/EcFrameworkGraph.js +7 -8
- package/src/org/cass/exporter/CSVExport.js +11 -1
- package/src/org/cass/importer/CTDLASNCSVConceptImport.js +174 -9
- package/src/org/cass/importer/CTDLASNCSVImport.js +163 -8
- package/src/test/1.EcAesCtrAsync.test.js +20 -20
- package/src/test/1.EcAesCtrAsyncWorker.test.js +19 -19
- package/src/test/1.EcRepository.l0.test.js +103 -103
- package/src/test/1.EcRepository.l1.test.js +93 -93
- package/src/test/1.EcRepository.l2.test.js +120 -120
- package/src/test/2.EcCompetency.test.js +0 -131
package/README.md
CHANGED
|
@@ -40,6 +40,7 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
|
|
|
40
40
|
* Update changelog.
|
|
41
41
|
* `npm install`
|
|
42
42
|
* `npm audit` and fix any audit issues.
|
|
43
|
+
* Update CaSS server version if necessary in package.json
|
|
43
44
|
* `npm test` - Must not fail any tests.
|
|
44
45
|
* `npm run webpack:cypressFirefoxHttps` See if the firefox test case has changed.
|
|
45
46
|
* Document code coverage output by the previous step.
|
|
@@ -49,6 +50,13 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
|
|
|
49
50
|
|
|
50
51
|
# Changelog
|
|
51
52
|
|
|
53
|
+
## 5.0.3
|
|
54
|
+
* Updates to CEASN import/export.
|
|
55
|
+
* Security updates.
|
|
56
|
+
|
|
57
|
+
## 5.0.2
|
|
58
|
+
* Cosmetic and security updates (to dev dependencies)
|
|
59
|
+
|
|
52
60
|
## 5.0.1
|
|
53
61
|
* Updated CEASN import to include versionIdentifier.
|
|
54
62
|
|
package/package.json
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cassproject",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Competency and Skills Service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "concurrently --maxProcesses=
|
|
7
|
+
"test": "concurrently --maxProcesses=1 --kill-others-on-fail \"npm run test16HttpsFips\" \"npm run test16Https11Fips\" \"npm run test16Https\" \"npm run test16Https11\" \"npm run test16Fips\" \"npm run test16\" \"npm run test15HttpsFips\" \"npm run test15Https11Fips\" \"npm run test15Https\" \"npm run test15Https11\" \"npm run test15Fips\" \"npm run test15\"",
|
|
8
8
|
"testActionCypress": "npm run testkill && export CASS_LOOPBACK=http://cass-test15/api/|| set CASS_LOOPBACK=http://cass-test15/api/&& npm run testkill15 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-test15 -p80:80 cassproject/cass:1.5.75 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\"",
|
|
9
9
|
"testCustom": "npm run test14 && npm run test13 && npm run test12",
|
|
10
10
|
"multitest": "concurrently --kill-others-on-fail \"npm run test15\" \"npm run test14\" \"npm run test13\" \"npm run test12\"",
|
|
11
11
|
"testCassTest": "npm run testkill && docker run -d --platform linux/amd64 --network cass-net --name cass-test -p80:80 -e CASS_LOOPBACK cass-test && wait-on http://localhost/api/ping && npm run testNode18 && npm run testNode18Fips && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testCypressEdge && npm run testCypress && npm run testkill",
|
|
12
12
|
"testDevHttps": "npm run testkill && docker run -d --platform linux/amd64 --network cass-net --name cass-test -p443:80 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:dev && wait-on https://localhost/api/ping && npm run testNode18HttpsFips && npm run testNode18Https && npm run testNode16Https && npm run testNode15Https && npm run testNode14Https && npm run testNode13Https && npm run testNode12Https && npm run testCypressEdgeHttps && npm run testCypressHttps",
|
|
13
|
-
"test16HttpsFips": "export CASS_LOOPBACK=https://cass-testsf16/api/|| set CASS_LOOPBACK=https://cass-testsf16/api/&& npm run testkillsf16 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf16 -p450:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.6.
|
|
14
|
-
"test16Https11Fips": "export CASS_LOOPBACK=https://cass-testsf1116/api/|| set CASS_LOOPBACK=https://cass-testsf1116/api/&& npm run testkillsf1116 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf1116 -p449:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.6.
|
|
15
|
-
"test16Https": "export CASS_LOOPBACK=https://cass-tests16/api/|| set CASS_LOOPBACK=https://cass-tests16/api/&& npm run testkills16 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests16 -p448:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.6.
|
|
16
|
-
"test16Https11": "export CASS_LOOPBACK=https://cass-tests1116/api/|| set CASS_LOOPBACK=https://cass-tests1116/api/&& npm run testkills1116 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests1116 -p451:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.6.
|
|
17
|
-
"test16Fips": "export CASS_LOOPBACK=http://cass-testf16/api/|| set CASS_LOOPBACK=http://cass-testf16/api/&& npm run testkillf16 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-testf16 -p83:80 cassproject/cass:1.6.
|
|
18
|
-
"test16": "export CASS_LOOPBACK=http://cass-test16/api/|| set CASS_LOOPBACK=http://cass-test16/api/&& npm run testkill16 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-test16 -p82:80 cassproject/cass:1.6.
|
|
19
|
-
"test15HttpsFips": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=https://cass-testsf15/api/|| set CASS_LOOPBACK=https://cass-testsf15/api/&& npm run testkillsf15 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf15 -p446:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.75 && wait-on https://localhost:446/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode22HttpsForceFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" && npm run testkillsf15",
|
|
20
|
-
"test15Https11Fips": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=https://cass-testsf1115/api/|| set CASS_LOOPBACK=https://cass-testsf1115/api/&& npm run testkillsf1115 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf1115 -p447:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.75 && wait-on https://localhost:447/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode22HttpsForceFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" && npm run testkillsf1115",
|
|
21
|
-
"test15Https": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=https://cass-tests15/api/|| set CASS_LOOPBACK=https://cass-tests15/api/&& npm run testkills15 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests15 -p444:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.75 && wait-on https://localhost:444/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" && npm run testkills15",
|
|
22
|
-
"test15Https11": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=https://cass-tests1115/api/|| set CASS_LOOPBACK=https://cass-tests1115/api/&& npm run testkills1115 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests1115 -p443:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.75 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" && npm run testkills1115",
|
|
23
|
-
"test15Fips": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=http://cass-testf15/api/|| set CASS_LOOPBACK=http://cass-testf15/api/&& npm run testkillf15 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-testf15 -p81:80 cassproject/cass:1.5.75 && wait-on http://localhost:81/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode22\" \"npm run testNode22Fips\" \"npm run testNode22ForceFips\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode20ForceFips\" \"npm run testNode18\" && npm run testkillf15",
|
|
24
|
-
"test15": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=http://cass-test15/api/|| set CASS_LOOPBACK=http://cass-test15/api/&& npm run testkill15 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-test15 -p80:80 cassproject/cass:1.5.75 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode22\" \"npm run testNode22Fips\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode18\" && npm run testkill15",
|
|
13
|
+
"test16HttpsFips": "export CASS_LOOPBACK=https://cass-testsf16/api/|| set CASS_LOOPBACK=https://cass-testsf16/api/&& npm run testkillsf16 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf16 -p450:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.6.6 && wait-on https://localhost:450/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode24HttpsForceFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode22HttpsForceFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" && npm run testkillsf16",
|
|
14
|
+
"test16Https11Fips": "export CASS_LOOPBACK=https://cass-testsf1116/api/|| set CASS_LOOPBACK=https://cass-testsf1116/api/&& npm run testkillsf1116 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf1116 -p449:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.6.6 && wait-on https://localhost:449/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode24HttpsForceFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode22HttpsForceFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" && npm run testkillsf1116",
|
|
15
|
+
"test16Https": "export CASS_LOOPBACK=https://cass-tests16/api/|| set CASS_LOOPBACK=https://cass-tests16/api/&& npm run testkills16 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests16 -p448:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.6.6 && wait-on https://localhost:448/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" && npm run testkills16",
|
|
16
|
+
"test16Https11": "export CASS_LOOPBACK=https://cass-tests1116/api/|| set CASS_LOOPBACK=https://cass-tests1116/api/&& npm run testkills1116 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests1116 -p451:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.6.6 && wait-on https://localhost:451/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" && npm run testkills1116",
|
|
17
|
+
"test16Fips": "export CASS_LOOPBACK=http://cass-testf16/api/|| set CASS_LOOPBACK=http://cass-testf16/api/&& npm run testkillf16 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-testf16 -p83:80 cassproject/cass:1.6.6 && wait-on http://localhost:83/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode24\" \"npm run testNode24Fips\" \"npm run testNode24ForceFips\" \"npm run testNode22\" \"npm run testNode22Fips\" \"npm run testNode22ForceFips\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode20ForceFips\" \"npm run testNode18\" && npm run testkillf16",
|
|
18
|
+
"test16": "export CASS_LOOPBACK=http://cass-test16/api/|| set CASS_LOOPBACK=http://cass-test16/api/&& npm run testkill16 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-test16 -p82:80 cassproject/cass:1.6.6 && wait-on http://localhost:82/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode24\" \"npm run testNode24Fips\" \"npm run testNode22\" \"npm run testNode22Fips\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode18\" && npm run testkill16",
|
|
19
|
+
"test15HttpsFips": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=https://cass-testsf15/api/|| set CASS_LOOPBACK=https://cass-testsf15/api/&& npm run testkillsf15 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf15 -p446:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.75 && wait-on https://localhost:446/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode22HttpsForceFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" && npm run testkillsf15",
|
|
20
|
+
"test15Https11Fips": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=https://cass-testsf1115/api/|| set CASS_LOOPBACK=https://cass-testsf1115/api/&& npm run testkillsf1115 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf1115 -p447:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.75 && wait-on https://localhost:447/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode24HttpsForceFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode22HttpsForceFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" && npm run testkillsf1115",
|
|
21
|
+
"test15Https": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=https://cass-tests15/api/|| set CASS_LOOPBACK=https://cass-tests15/api/&& npm run testkills15 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests15 -p444:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.75 && wait-on https://localhost:444/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" && npm run testkills15",
|
|
22
|
+
"test15Https11": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=https://cass-tests1115/api/|| set CASS_LOOPBACK=https://cass-tests1115/api/&& npm run testkills1115 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests1115 -p443:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.75 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" && npm run testkills1115",
|
|
23
|
+
"test15Fips": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=http://cass-testf15/api/|| set CASS_LOOPBACK=http://cass-testf15/api/&& npm run testkillf15 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-testf15 -p81:80 cassproject/cass:1.5.75 && wait-on http://localhost:81/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode24\" \"npm run testNode24Fips\" \"npm run testNode24ForceFips\" \"npm run testNode22\" \"npm run testNode22Fips\" \"npm run testNode22ForceFips\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode20ForceFips\" \"npm run testNode18\" && npm run testkillf15",
|
|
24
|
+
"test15": "export TESTLEVEL=15|| set TESTLEVEL=15&& export CASS_LOOPBACK=http://cass-test15/api/|| set CASS_LOOPBACK=http://cass-test15/api/&& npm run testkill15 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-test15 -p80:80 cassproject/cass:1.5.75 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode24\" \"npm run testNode24Fips\" \"npm run testNode22\" \"npm run testNode22Fips\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode18\" && npm run testkill15",
|
|
25
25
|
"test14": "npm run testkill14 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-test14 -p80:80 cassproject/cass:1.4.4 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode16\" && npm run testkill14",
|
|
26
26
|
"test13": "npm run testkill13 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-test13 -p80:80 cassproject/cass:1.3.18 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode16\" && npm run testkill13",
|
|
27
27
|
"test12": "npm run testkill12 && docker run -d --platform linux/amd64 --network cass-net -e CASS_LOOPBACK --name cass-test12 -p80:80 cassproject/cass:1.2.44 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode16\" && npm run testkill12",
|
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
"testkill13": "docker kill cass-test13 | exit 0 && docker rm cass-test13 | exit 0 && docker network create cass-net | exit 0",
|
|
42
42
|
"testkill12": "docker kill cass-test12 | exit 0 && docker rm cass-test12 | exit 0 && docker network create cass-net | exit 0",
|
|
43
43
|
"testkill": "docker kill cass-test | exit 0 && docker rm cass-test | exit 0 && docker network create cass-net | exit 0",
|
|
44
|
+
"testNode24": "docker build --progress plain -f docker/node24 -t npm-cass24 . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass24",
|
|
45
|
+
"testNode24Https": "docker build --progress plain -f docker/node24https -t npm-cass24https . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass24https",
|
|
46
|
+
"testNode24HttpsFips": "docker build --progress plain -f docker/node24httpsfips -t npm-cass24httpsfips . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass24httpsfips",
|
|
47
|
+
"testNode24HttpsForceFips": "docker build --progress plain -f docker/node24httpsforcefips -t npm-cass24httpsforcefips . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass24httpsforcefips",
|
|
48
|
+
"testNode24ForceFips": "docker build --progress plain -f docker/node24forcefips -t npm-cass24forcefips . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass24forcefips",
|
|
49
|
+
"testNode24Fips": "docker build --progress plain -f docker/node24fips -t npm-cass24fips . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass24fips",
|
|
44
50
|
"testNode22": "docker build --progress plain -f docker/node22 -t npm-cass22 . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass22",
|
|
45
51
|
"testNode22Https": "docker build --progress plain -f docker/node22https -t npm-cass22https . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass22https",
|
|
46
52
|
"testNode22HttpsFips": "docker build --progress plain -f docker/node22httpsfips -t npm-cass22httpsfips . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass22httpsfips",
|
|
@@ -68,8 +74,14 @@
|
|
|
68
74
|
"testNode13Https": "docker build --progress plain -f docker/node13https -t npm-cass13https . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass13https",
|
|
69
75
|
"testNode12": "docker build --progress plain -f docker/node12 -t npm-cass12 . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass12",
|
|
70
76
|
"testNode12Https": "docker build --progress plain -f docker/node12https -t npm-cass12https . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-cass12https",
|
|
71
|
-
"testCypress": "
|
|
72
|
-
"testCypressHttps": "
|
|
77
|
+
"testCypress": "concurrently --kill-others-on-fail \"npm run testCypressEdge\" \"npm run testCypressElectron\" \"npm run testCypressChrome\"",
|
|
78
|
+
"testCypressHttps": "concurrently --kill-others-on-fail \"npm run testCypressEdgeHttps\" \"npm run testCypressElectronHttps\" \"npm run testCypressChromeHttps\"",
|
|
79
|
+
"testCypressEdge": "docker build --progress plain -f docker/cypressEdge -t npm-casscypressedge . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-casscypressedge",
|
|
80
|
+
"testCypressEdgeHttps": "docker build --progress plain -f docker/cypressHttpsEdge -t npm-casscypressedgehttps . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-casscypressedgehttps",
|
|
81
|
+
"testCypressElectron": "docker build --progress plain -f docker/cypressElectron -t npm-casscypresselectron . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-casscypresselectron",
|
|
82
|
+
"testCypressElectronHttps": "docker build --progress plain -f docker/cypressHttpsElectron -t npm-casscypresselectronhttps . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-casscypresselectronhttps",
|
|
83
|
+
"testCypressChrome": "docker build --progress plain -f docker/cypressChrome -t npm-casscypresschrome . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-casscypresschrome",
|
|
84
|
+
"testCypressChromeHttps": "docker build --progress plain -f docker/cypressHttpsChrome -t npm-casscypresschromehttps . && docker run --network cass-net -e CASS_LOOPBACK -e TESTLEVEL --rm npm-casscypresschromehttps",
|
|
73
85
|
"autotest": "nodemon test.js",
|
|
74
86
|
"autoindex": "nodemon index.js",
|
|
75
87
|
"autonyc": "nodemon --exec \"npm run nyc\"",
|
|
@@ -77,7 +89,7 @@
|
|
|
77
89
|
"mocha": "mocha --timeout 30000 -b src/**/*.test.js",
|
|
78
90
|
"mochaFips": "mocha -n 'force-fips' --timeout 30000 -b src/**/*.test.js",
|
|
79
91
|
"mocha:httpsNoHttp2": "export HTTP2=false|| set HTTP2=false&& mocha --timeout 30000 -b src/**/*.test.js",
|
|
80
|
-
"mocha:https": "mocha --timeout 30000 -b src/**/*.test.js",
|
|
92
|
+
"mocha:https": "export CASS_LOOPBACK=https://localhost/api/|| set CASS_LOOPBACK=https://localhost/api/&& mocha --timeout 30000 -b src/**/*.test.js",
|
|
81
93
|
"mocha:clientSideCertificates": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export HTTP2=false|| set HTTP2=false&& mocha --timeout 30000 -b src/**/*.test.js",
|
|
82
94
|
"mochaFips:clientSideCertificates": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export HTTP2=false|| set HTTP2=false&& mocha -n 'force-fips' --timeout 30000 -b src/**/*.test.js",
|
|
83
95
|
"mocha:clientSideCertificatesDangerMouse": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export HTTP2=false|| set HTTP2=false&& mocha --timeout 30000 -b src/**/*.test.js",
|
|
@@ -174,20 +186,20 @@
|
|
|
174
186
|
"@cypress/vite-dev-server": "^5.2.1",
|
|
175
187
|
"@cypress/webpack-preprocessor": "^6.0.4",
|
|
176
188
|
"chai": "4.5.0",
|
|
177
|
-
"concurrently": "^9.1
|
|
189
|
+
"concurrently": "^9.2.1",
|
|
178
190
|
"convert-hrtime": "^5.0.0",
|
|
179
|
-
"cypress": "^
|
|
191
|
+
"cypress": "^15.4.0",
|
|
180
192
|
"cypress-fail-fast": "^7.1.1",
|
|
181
|
-
"eslint": "^9.
|
|
182
|
-
"fake-indexeddb": "^6.
|
|
193
|
+
"eslint": "^9.37.0",
|
|
194
|
+
"fake-indexeddb": "^6.2.3",
|
|
183
195
|
"mocha": "^10.8.2",
|
|
184
196
|
"node-polyfill-webpack-plugin": "^4.1.0",
|
|
185
197
|
"nodemon": "^3.1.10",
|
|
186
198
|
"nyc": "^17.1.0",
|
|
187
199
|
"sinon": "^19.0.5",
|
|
188
|
-
"url-polyfill": "^1.1.
|
|
189
|
-
"wait-on": "^8.0.
|
|
190
|
-
"webpack": "^5.
|
|
200
|
+
"url-polyfill": "^1.1.14",
|
|
201
|
+
"wait-on": "^8.0.5",
|
|
202
|
+
"webpack": "^5.102.1",
|
|
191
203
|
"webpack-cli": "^5.1.4"
|
|
192
204
|
},
|
|
193
205
|
"packageManager": "npm@11.3.0+sha512.96eb611483f49c55f7fa74df61b588de9e213f80a256728e6798ddc67176c7b07e4a1cfc7de8922422cbce02543714367037536955221fa451b0c4fefaf20c66"
|
|
@@ -169,10 +169,10 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
169
169
|
}
|
|
170
170
|
let negative = await assertion.getNegative();
|
|
171
171
|
if (competencies[assertion.competency] == null)
|
|
172
|
-
competencies[assertion.competency] = {positives:[],negatives:[]};
|
|
173
|
-
if (negative)
|
|
172
|
+
competencies[assertion.competency] = { positives: [], negatives: [] };
|
|
173
|
+
if (negative)
|
|
174
174
|
competencies[assertion.competency].negatives.push(assertion);
|
|
175
|
-
else
|
|
175
|
+
else
|
|
176
176
|
competencies[assertion.competency].positives.push(assertion);
|
|
177
177
|
})
|
|
178
178
|
)
|
|
@@ -227,7 +227,7 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
227
227
|
)
|
|
228
228
|
)
|
|
229
229
|
)
|
|
230
|
-
).then(async() =>
|
|
230
|
+
).then(async () =>
|
|
231
231
|
await Promise.all(
|
|
232
232
|
this.getInEdges(competency).map(async (alignment) =>
|
|
233
233
|
await this.getCompetency(alignment.source).then(async (s) =>
|
|
@@ -311,7 +311,7 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
311
311
|
addToMetaStateArray(metaState, key, value) {
|
|
312
312
|
if (metaState == null) return;
|
|
313
313
|
if (metaState[key] == null) metaState[key] = [];
|
|
314
|
-
metaState[key]
|
|
314
|
+
EcArray.setAdd(metaState[key], value);
|
|
315
315
|
}
|
|
316
316
|
/**
|
|
317
317
|
* Fetches the Meta Competency (additional state information used to compute profiles or other data) for a competency.
|
|
@@ -398,7 +398,7 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
398
398
|
}
|
|
399
399
|
getDefaultEdgeType() {
|
|
400
400
|
return EcAlignment.NARROWS;
|
|
401
|
-
}
|
|
401
|
+
}
|
|
402
402
|
inEdgeCache = {};
|
|
403
403
|
outEdgeCache = {};
|
|
404
404
|
getInEdges(vertex) {
|
|
@@ -446,8 +446,7 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
446
446
|
delete this.outEdgeCache[vertex.shortId()];
|
|
447
447
|
return super.removeVertex(vertex);
|
|
448
448
|
}
|
|
449
|
-
cacheEdges(e)
|
|
450
|
-
{
|
|
449
|
+
cacheEdges(e) {
|
|
451
450
|
if (this.inEdgeCache[e.destination.shortId()] == null)
|
|
452
451
|
this.inEdgeCache[e.destination.shortId()] = [];
|
|
453
452
|
this.inEdgeCache[e.destination.shortId()].push(e.edge);
|
|
@@ -23,6 +23,7 @@ module.exports = class CSVExport extends Exporter {
|
|
|
23
23
|
compExport.downloadCSV(fileName);
|
|
24
24
|
}
|
|
25
25
|
static exportCTDLASN(json, name) {
|
|
26
|
+
console.log('export CTDL');
|
|
26
27
|
let objects = [];
|
|
27
28
|
CSVExport.findGraphs(json, objects);
|
|
28
29
|
CSVExport.exportObjects(objects, name + ".csv", true);
|
|
@@ -202,7 +203,16 @@ module.exports = class CSVExport extends Exporter {
|
|
|
202
203
|
display += props2[prop2][prop3] + "|";
|
|
203
204
|
}
|
|
204
205
|
} else {
|
|
205
|
-
|
|
206
|
+
if (prop === 'ceterms:versionIdentifier') {
|
|
207
|
+
if (props2[prop2]['ceterms:identifierValueCode'])
|
|
208
|
+
display += props2[prop2]['ceterms:identifierValueCode'] + "~";
|
|
209
|
+
if (props2[prop2]['ceterms:identifierTypeName'])
|
|
210
|
+
display += Object.values(props2[prop2]['ceterms:identifierTypeName'])[0] + "~";
|
|
211
|
+
if (props2[prop2]['ceterms:identifierType'])
|
|
212
|
+
display += props2[prop2]['ceterms:identifierType'] + "|";
|
|
213
|
+
} else {
|
|
214
|
+
display += props2[prop2] + "|";
|
|
215
|
+
}
|
|
206
216
|
}
|
|
207
217
|
}
|
|
208
218
|
display = display.substring(0, display.length - 1);
|
|
@@ -109,7 +109,8 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
109
109
|
ceo,
|
|
110
110
|
endpoint,
|
|
111
111
|
eim,
|
|
112
|
-
progressionsFlag
|
|
112
|
+
progressionsFlag,
|
|
113
|
+
validationRules
|
|
113
114
|
) {
|
|
114
115
|
if (eim === undefined || eim == null)
|
|
115
116
|
eim = EcIdentityManager.default;
|
|
@@ -123,7 +124,7 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
123
124
|
failure("Invalid file type");
|
|
124
125
|
}
|
|
125
126
|
if (progressionsFlag) {
|
|
126
|
-
return this.importProgressions(repo, file, success, failure, ceo, endpoint, eim);
|
|
127
|
+
return this.importProgressions(repo, file, success, failure, ceo, endpoint, eim, validationRules);
|
|
127
128
|
}
|
|
128
129
|
Papa.parse(file, {
|
|
129
130
|
header: true,
|
|
@@ -139,21 +140,50 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
139
140
|
} catch (e) {
|
|
140
141
|
console.error('Error trimming data', e);
|
|
141
142
|
}
|
|
143
|
+
|
|
144
|
+
// Validate hierarchy before processing (only if validation rules provided)
|
|
145
|
+
if (validationRules && validationRules.validateHierarchy !== false) {
|
|
146
|
+
const hierarchyError = CTDLASNCSVConceptImport.validateConceptHierarchy(
|
|
147
|
+
tabularData,
|
|
148
|
+
validationRules.hierarchyRules
|
|
149
|
+
);
|
|
150
|
+
if (hierarchyError) {
|
|
151
|
+
failure(hierarchyError);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
142
155
|
const terms = JSON.parse(JSON.stringify((await EcRemote.getExpectingObject("https://schema.cassproject.org/0.4/jsonld1.1/ceasn2cassConceptsTerms"))));
|
|
143
156
|
let schemeArray = [];
|
|
144
157
|
let concepts = [];
|
|
145
158
|
for (let each = 0; each < tabularData.length; each++) {
|
|
146
159
|
let pretranslatedE = tabularData[each];
|
|
147
|
-
//
|
|
148
|
-
if (!pretranslatedE["@
|
|
160
|
+
// Skip extra lines if found in file
|
|
161
|
+
if (!pretranslatedE || !pretranslatedE["@type"]) {
|
|
149
162
|
continue;
|
|
150
163
|
}
|
|
164
|
+
if (!pretranslatedE["@id"]) {
|
|
165
|
+
failure(`Row ${each + 2}: is missing an @id`);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
151
168
|
if (
|
|
152
169
|
pretranslatedE["@type"].toLowerCase().startsWith('sample') || pretranslatedE["@type"].toLowerCase().startsWith('instruction')
|
|
153
170
|
) {
|
|
154
171
|
continue;
|
|
155
172
|
}
|
|
156
173
|
if (pretranslatedE["@type"] == "skos:ConceptScheme") {
|
|
174
|
+
// Validate required properties (only if validation rules provided)
|
|
175
|
+
if (validationRules && validationRules.requiredProps) {
|
|
176
|
+
const validationError = CTDLASNCSVConceptImport.validateRequiredProperties(
|
|
177
|
+
pretranslatedE,
|
|
178
|
+
"skos:ConceptScheme",
|
|
179
|
+
each + 2,
|
|
180
|
+
validationRules.requiredProps
|
|
181
|
+
);
|
|
182
|
+
if (validationError) {
|
|
183
|
+
failure(validationError);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
157
187
|
let translator = new EcLinkedData(null, null);
|
|
158
188
|
translator.copyFrom(pretranslatedE);
|
|
159
189
|
CTDLASNCSVImport.cleanUpTranslator(
|
|
@@ -223,6 +253,19 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
223
253
|
setVersionIdentifier(f);
|
|
224
254
|
schemeArray.push(f);
|
|
225
255
|
} else if (pretranslatedE["@type"] == "skos:Concept") {
|
|
256
|
+
// Validate required properties (only if validation rules provided)
|
|
257
|
+
if (validationRules && validationRules.requiredProps) {
|
|
258
|
+
const validationError = CTDLASNCSVConceptImport.validateRequiredProperties(
|
|
259
|
+
pretranslatedE,
|
|
260
|
+
"skos:Concept",
|
|
261
|
+
each + 2,
|
|
262
|
+
validationRules.requiredProps
|
|
263
|
+
);
|
|
264
|
+
if (validationError) {
|
|
265
|
+
failure(validationError);
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
226
269
|
let translator = new EcLinkedData(null, null);
|
|
227
270
|
translator.copyFrom(pretranslatedE);
|
|
228
271
|
CTDLASNCSVImport.cleanUpTranslator(
|
|
@@ -251,6 +294,7 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
251
294
|
let f = new EcConcept();
|
|
252
295
|
f.copyFrom(e);
|
|
253
296
|
if (e["id"] == null) {
|
|
297
|
+
failure(`Row ${each + 2}: Concept is missing an id`);
|
|
254
298
|
return;
|
|
255
299
|
}
|
|
256
300
|
if (
|
|
@@ -364,10 +408,11 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
364
408
|
pretranslatedE["@type"] == null ||
|
|
365
409
|
pretranslatedE["@type"] == ""
|
|
366
410
|
) {
|
|
411
|
+
failure(`Row ${each + 2}: Missing or empty @type`);
|
|
367
412
|
return;
|
|
368
413
|
} else {
|
|
369
|
-
|
|
370
|
-
|
|
414
|
+
failure(
|
|
415
|
+
`Row ${each + 2}: Found unknown type: ` + pretranslatedE["@type"]
|
|
371
416
|
);
|
|
372
417
|
return;
|
|
373
418
|
}
|
|
@@ -384,7 +429,8 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
384
429
|
failure,
|
|
385
430
|
ceo,
|
|
386
431
|
endpoint,
|
|
387
|
-
eim
|
|
432
|
+
eim,
|
|
433
|
+
validationRules
|
|
388
434
|
) {
|
|
389
435
|
Papa.parse(file, {
|
|
390
436
|
header: true,
|
|
@@ -400,17 +446,50 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
400
446
|
} catch (e) {
|
|
401
447
|
console.error('Error trimming data', e);
|
|
402
448
|
}
|
|
449
|
+
|
|
450
|
+
// Validate hierarchy before processing (only if validation rules provided)
|
|
451
|
+
if (validationRules && validationRules.validateHierarchy !== false) {
|
|
452
|
+
const hierarchyError = CTDLASNCSVConceptImport.validateConceptHierarchy(
|
|
453
|
+
tabularData,
|
|
454
|
+
validationRules.hierarchyRules
|
|
455
|
+
);
|
|
456
|
+
if (hierarchyError) {
|
|
457
|
+
failure(hierarchyError);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
403
461
|
const terms = JSON.parse(JSON.stringify((await EcRemote.getExpectingObject("https://schema.cassproject.org/0.4/jsonld1.1/ceasn2cassConceptsTerms"))));
|
|
404
462
|
let schemeArray = [];
|
|
405
463
|
let concepts = [];
|
|
406
464
|
for (let each = 0; each < tabularData.length; each++) {
|
|
407
465
|
let pretranslatedE = tabularData[each];
|
|
466
|
+
// Skip extra lines if found in file
|
|
467
|
+
if (!pretranslatedE || !pretranslatedE["@type"]) {
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
if (!pretranslatedE["@id"]) {
|
|
471
|
+
failure(`Row ${each + 2}: is missing an @id`);
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
408
474
|
if (
|
|
409
475
|
pretranslatedE["@type"].toLowerCase().startsWith('sample') || pretranslatedE["@type"].toLowerCase().startsWith('instruction')
|
|
410
476
|
) {
|
|
411
477
|
continue;
|
|
412
478
|
}
|
|
413
479
|
if (pretranslatedE["@type"] == "asn:ProgressionModel") {
|
|
480
|
+
// Validate required properties (only if validation rules provided)
|
|
481
|
+
if (validationRules && validationRules.requiredProps) {
|
|
482
|
+
const validationError = CTDLASNCSVConceptImport.validateRequiredProperties(
|
|
483
|
+
pretranslatedE,
|
|
484
|
+
"asn:ProgressionModel",
|
|
485
|
+
each + 2,
|
|
486
|
+
validationRules.requiredProps
|
|
487
|
+
);
|
|
488
|
+
if (validationError) {
|
|
489
|
+
failure(validationError);
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
414
493
|
let translator = new EcLinkedData(null, null);
|
|
415
494
|
translator.copyFrom(pretranslatedE);
|
|
416
495
|
CTDLASNCSVImport.cleanUpTranslator(
|
|
@@ -476,6 +555,19 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
476
555
|
f.subType = "Progression";
|
|
477
556
|
schemeArray.push(f);
|
|
478
557
|
} else if (pretranslatedE["@type"] == "asn:ProgressionLevel") {
|
|
558
|
+
// Validate required properties (only if validation rules provided)
|
|
559
|
+
if (validationRules && validationRules.requiredProps) {
|
|
560
|
+
const validationError = CTDLASNCSVConceptImport.validateRequiredProperties(
|
|
561
|
+
pretranslatedE,
|
|
562
|
+
"asn:ProgressionLevel",
|
|
563
|
+
each + 2,
|
|
564
|
+
validationRules.requiredProps
|
|
565
|
+
);
|
|
566
|
+
if (validationError) {
|
|
567
|
+
failure(validationError);
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
479
571
|
let translator = new EcLinkedData(null, null);
|
|
480
572
|
translator.copyFrom(pretranslatedE);
|
|
481
573
|
CTDLASNCSVImport.cleanUpTranslator(
|
|
@@ -504,6 +596,7 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
504
596
|
let f = new EcConcept();
|
|
505
597
|
f.copyFrom(e);
|
|
506
598
|
if (e["id"] == null) {
|
|
599
|
+
failure(`Row ${each + 2}: Concept is missing an id`);
|
|
507
600
|
return;
|
|
508
601
|
}
|
|
509
602
|
if (
|
|
@@ -583,10 +676,11 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
583
676
|
pretranslatedE["@type"] == null ||
|
|
584
677
|
pretranslatedE["@type"] == ""
|
|
585
678
|
) {
|
|
679
|
+
failure(`Row ${each + 2}: Missing or empty @type`);
|
|
586
680
|
return;
|
|
587
681
|
} else {
|
|
588
|
-
|
|
589
|
-
|
|
682
|
+
failure(
|
|
683
|
+
`Row ${each + 2}: Found unknown type: ` + pretranslatedE["@type"]
|
|
590
684
|
);
|
|
591
685
|
return;
|
|
592
686
|
}
|
|
@@ -596,4 +690,75 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
596
690
|
error: failure
|
|
597
691
|
});
|
|
598
692
|
}
|
|
693
|
+
|
|
694
|
+
static validateRequiredProperties(obj, type, rowIndex, requiredProps) {
|
|
695
|
+
// Use provided validation rules or fall back to defaults
|
|
696
|
+
if (!requiredProps) {
|
|
697
|
+
return 'Required properties not defined.'
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
const props = requiredProps[type];
|
|
701
|
+
if (!props) return null;
|
|
702
|
+
|
|
703
|
+
const missing = [];
|
|
704
|
+
for (const prop of props) {
|
|
705
|
+
if (!obj[prop] || (typeof obj[prop] === 'string' && obj[prop].trim() === '')) {
|
|
706
|
+
missing.push(prop);
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
if (missing.length > 0) {
|
|
711
|
+
return `Row ${rowIndex}: Missing required properties for ${type}: ${missing.join(', ')}`;
|
|
712
|
+
}
|
|
713
|
+
return null;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
static validateConceptHierarchy(tabularData, hierarchyRules) {
|
|
717
|
+
// Use provided hierarchy rules or fall back to defaults
|
|
718
|
+
if (!hierarchyRules) {
|
|
719
|
+
return 'Hierarchy rules not defined.'
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// Check each type defined in hierarchy rules
|
|
723
|
+
for (const [type, rules] of Object.entries(hierarchyRules)) {
|
|
724
|
+
const hasType = tabularData.some(r => r && r["@type"] === type);
|
|
725
|
+
if (!hasType) continue;
|
|
726
|
+
|
|
727
|
+
let hasRequiredProp = false;
|
|
728
|
+
let hasChildProp = false;
|
|
729
|
+
|
|
730
|
+
for (const row of tabularData) {
|
|
731
|
+
if (!row || !row["@type"]) continue;
|
|
732
|
+
|
|
733
|
+
// Check if this row has any of the required properties
|
|
734
|
+
if (row["@type"] === type && rules.requiredProperties) {
|
|
735
|
+
for (const prop of rules.requiredProperties) {
|
|
736
|
+
if (row[prop]) {
|
|
737
|
+
hasRequiredProp = true;
|
|
738
|
+
break;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// Check if any row has child properties
|
|
744
|
+
if (rules.childProperties) {
|
|
745
|
+
for (const prop of rules.childProperties) {
|
|
746
|
+
if (row[prop]) {
|
|
747
|
+
hasChildProp = true;
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
if (hasRequiredProp && hasChildProp) break;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
// Validate that at least one of the hierarchy properties exists
|
|
757
|
+
if (!hasRequiredProp && !hasChildProp) {
|
|
758
|
+
return rules.errorMessage || `CSV must contain hierarchy properties for ${type}`;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
return null;
|
|
763
|
+
}
|
|
599
764
|
};
|