cassproject 1.5.23 → 1.5.27
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
CHANGED
|
@@ -21,7 +21,7 @@ Running `npm test` requires Docker.
|
|
|
21
21
|
|
|
22
22
|
## Release testing
|
|
23
23
|
|
|
24
|
-
* `npm test` - Runs unit tests in docker images against the CaSS 1.5
|
|
24
|
+
* `npm test` - Runs unit tests in docker images against the CaSS 1.5 repositories using Node versions 12-16 and Cypress against Edge, Chrome, Firefox and Electron. Takes some time.
|
|
25
25
|
|
|
26
26
|
## Development unit testing
|
|
27
27
|
Development unit tests presume you have a CaSS Repository running on `localhost:80`. You may get one by running `docker run -d --name cass-test -p80:80 cassproject/cass:1.5.0`
|
|
@@ -39,6 +39,7 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
|
|
|
39
39
|
* Increment version number in package.json and yuidoc.json.
|
|
40
40
|
* Update changelog.
|
|
41
41
|
* `npm install`
|
|
42
|
+
* `npm audit` and fix any audit issues.
|
|
42
43
|
* `npm test` - Must not fail any tests.
|
|
43
44
|
* Document code coverage output by the previous step.
|
|
44
45
|
* Commit changes to GitHub.
|
|
@@ -47,6 +48,13 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
|
|
|
47
48
|
|
|
48
49
|
# Changelog
|
|
49
50
|
|
|
51
|
+
## 1.5.26
|
|
52
|
+
* CORS Origins and CORS requests are now sent with credentials to enable cross origin credentialing.
|
|
53
|
+
* Extra lines in CSV import are ignored.
|
|
54
|
+
|
|
55
|
+
## 1.5.25
|
|
56
|
+
* Repo init now fetches max length of posts. Multiput now uses multiple requests if the POST length is too long.
|
|
57
|
+
|
|
50
58
|
## 1.5.23
|
|
51
59
|
* Fixed issue that was preventing use of webcrypto module.
|
|
52
60
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cassproject",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.27",
|
|
4
4
|
"description": "Competency and Skills Service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"multitest": "concurrently --kill-others --kill-others-on-fail \"npm run test15\" \"npm run test14\" \"npm run test13\" \"npm run test12\"",
|
|
10
10
|
"testCassTest": "npm run testkill && docker run -d --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",
|
|
11
11
|
"testDevHttps": "npm run testkill && docker run -d --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",
|
|
12
|
-
"test15Https": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.
|
|
13
|
-
"test15Https11": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.
|
|
14
|
-
"test15": "export CASS_LOOPBACK=http://localhost/api/|| set CASS_LOOPBACK=http://localhost/api/&& npm run testkill15 && docker run -d -e CASS_LOOPBACK --name cass-test15 -p80:80 cassproject/cass:1.5.
|
|
12
|
+
"test15Https": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.26 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode18HttpsFips\" \"npm run testNode18Https\" \"npm run testNode16Https\" && npm run testkill",
|
|
13
|
+
"test15Https11": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.26 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode18HttpsFips\" \"npm run testNode18Https\" \"npm run testNode16Https\" && npm run testkill",
|
|
14
|
+
"test15": "export CASS_LOOPBACK=http://localhost/api/|| set CASS_LOOPBACK=http://localhost/api/&& npm run testkill15 && docker run -d -e CASS_LOOPBACK --name cass-test15 -p80:80 cassproject/cass:1.5.26 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode18\" \"npm run testNode18Fips\" \"npm run testNode16\" && npm run testkill15",
|
|
15
15
|
"test14": "npm run testkill14 && docker run -d -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",
|
|
16
16
|
"test13": "npm run testkill13 && docker run -d -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",
|
|
17
17
|
"test12": "npm run testkill12 && docker run -d -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",
|
|
@@ -68,6 +68,10 @@
|
|
|
68
68
|
"webpack:cypressEdgeHttps": "cypress run -e CASS_LOOPBACK=https://localhost/api/ --config-file cypressWebpack.config.js --headless --browser edge"
|
|
69
69
|
},
|
|
70
70
|
"contributors": [
|
|
71
|
+
{
|
|
72
|
+
"name": "Kari Glover",
|
|
73
|
+
"email": "kari.glover@eduworks.com"
|
|
74
|
+
},
|
|
71
75
|
{
|
|
72
76
|
"name": "Devlin Junker (Retired)",
|
|
73
77
|
"email": "devlin.junker@eduworks.com"
|
|
@@ -95,9 +99,9 @@
|
|
|
95
99
|
"forge": "^2.3.0",
|
|
96
100
|
"form-data": "^4.0.0",
|
|
97
101
|
"http2-wrapper": "^2.2.0",
|
|
98
|
-
"jsonld": "^8.1.
|
|
102
|
+
"jsonld": "^8.1.1",
|
|
99
103
|
"node-forge": "^1.3.1",
|
|
100
|
-
"papaparse": "^5.
|
|
104
|
+
"papaparse": "^5.4.1",
|
|
101
105
|
"pem-jwk": "^2.0.0",
|
|
102
106
|
"promise-worker": "^2.0.1",
|
|
103
107
|
"rdf-canonize": "^3.3.0",
|
|
@@ -118,31 +122,31 @@
|
|
|
118
122
|
"cassproject",
|
|
119
123
|
"competency"
|
|
120
124
|
],
|
|
121
|
-
"author": "Fritz Ray <fritz.ray@eduworks.com> (http://
|
|
125
|
+
"author": "Fritz Ray <fritz.ray@eduworks.com> (http://devs.cassproject.org)",
|
|
122
126
|
"license": "Apache-2.0",
|
|
123
127
|
"bugs": {
|
|
124
128
|
"url": "https://github.com/cassproject/cass-npm/issues"
|
|
125
129
|
},
|
|
126
130
|
"homepage": "https://github.com/cassproject/cass-npm#readme",
|
|
127
131
|
"devDependencies": {
|
|
128
|
-
"@babel/core": "^7.
|
|
132
|
+
"@babel/core": "^7.21.3",
|
|
129
133
|
"@babel/preset-env": "^7.20.2",
|
|
130
134
|
"@cypress/browserify-preprocessor": "^3.0.2",
|
|
131
|
-
"@cypress/vite-dev-server": "^5.0.
|
|
132
|
-
"@cypress/webpack-preprocessor": "^5.
|
|
135
|
+
"@cypress/vite-dev-server": "^5.0.5",
|
|
136
|
+
"@cypress/webpack-preprocessor": "^5.17.0",
|
|
133
137
|
"babel-eslint": "^10.1.0",
|
|
134
138
|
"babel-plugin-transform-remove-strict-mode": "^0.0.2",
|
|
135
139
|
"chai": "^4.3.7",
|
|
136
140
|
"concurrently": "^7.6.0",
|
|
137
141
|
"convert-hrtime": "^5.0.0",
|
|
138
|
-
"cypress": "^12.
|
|
139
|
-
"eslint": "^8.
|
|
142
|
+
"cypress": "^12.8.1",
|
|
143
|
+
"eslint": "^8.36.0",
|
|
140
144
|
"mocha": "^10.2.0",
|
|
141
145
|
"node-polyfill-webpack-plugin": "^2.0.1",
|
|
142
|
-
"nodemon": "^2.0.
|
|
146
|
+
"nodemon": "^2.0.22",
|
|
143
147
|
"nyc": "^15.1.0",
|
|
144
148
|
"wait-on": "^7.0.1",
|
|
145
|
-
"webpack": "^5.
|
|
149
|
+
"webpack": "^5.76.3",
|
|
146
150
|
"webpack-cli": "^5.0.1"
|
|
147
151
|
}
|
|
148
152
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require("../../../../org/cassproject/general/AuditLogger.js");
|
|
2
2
|
|
|
3
3
|
global.axiosOptions = {};
|
|
4
|
+
global.corsOrigins = [];
|
|
4
5
|
let isNode = false;
|
|
5
6
|
if (typeof process === 'object') {
|
|
6
7
|
if (typeof process.versions === 'object') {
|
|
@@ -131,6 +132,13 @@ if (global.axios == null)
|
|
|
131
132
|
|
|
132
133
|
const { cassPromisify } = require("../promises/helpers");
|
|
133
134
|
|
|
135
|
+
getAxiosOptions = function(url) {
|
|
136
|
+
let newOptions = Object.assign({}, axiosOptions);
|
|
137
|
+
if (corsOrigins.findIndex((x) => url.startsWith(x)) > -1)
|
|
138
|
+
newOptions.withCredentials = true;
|
|
139
|
+
return newOptions;
|
|
140
|
+
}
|
|
141
|
+
|
|
134
142
|
/**
|
|
135
143
|
* Wrapper to handle all remote web service invocations.
|
|
136
144
|
*
|
|
@@ -257,8 +265,9 @@ module.exports = class EcRemote {
|
|
|
257
265
|
postHeaders["content-length"] = fd.getLengthSync();
|
|
258
266
|
if (headers !== undefined && headers != null)
|
|
259
267
|
for (let header in headers) postHeaders[header] = headers[header];
|
|
268
|
+
|
|
260
269
|
let p = axios.post(url, fd, {
|
|
261
|
-
...
|
|
270
|
+
...getAxiosOptions(url),
|
|
262
271
|
headers: postHeaders,
|
|
263
272
|
maxContentLength: Infinity,
|
|
264
273
|
maxBodyLength: Infinity
|
|
@@ -313,7 +322,7 @@ module.exports = class EcRemote {
|
|
|
313
322
|
let url = EcRemote.urlAppend(server, service);
|
|
314
323
|
url = EcRemote.upgradeHttpToHttps(url);
|
|
315
324
|
let p = axios
|
|
316
|
-
.get(url,
|
|
325
|
+
.get(url,getAxiosOptions(url))
|
|
317
326
|
.then((response) => {
|
|
318
327
|
global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.INFO, "EcRemoteGetExpectString", response.request.socket ? response.request.socket.remoteAddress : '', url);
|
|
319
328
|
return response.data;
|
|
@@ -358,7 +367,7 @@ module.exports = class EcRemote {
|
|
|
358
367
|
url = EcRemote.upgradeHttpToHttps(url);
|
|
359
368
|
let p = axios
|
|
360
369
|
.delete(url, {
|
|
361
|
-
...
|
|
370
|
+
...getAxiosOptions(url),
|
|
362
371
|
headers: { signatureSheet: signatureSheet }
|
|
363
372
|
})
|
|
364
373
|
.then((response) => {
|
|
@@ -97,8 +97,12 @@ module.exports = class CTDLASNCSVImport {
|
|
|
97
97
|
let relationById = {};
|
|
98
98
|
for (let i = 0; i < tabularData.length; i++) {
|
|
99
99
|
let pretranslatedE = tabularData[i];
|
|
100
|
-
if
|
|
101
|
-
|
|
100
|
+
// Skip extra lines if found in file
|
|
101
|
+
if (!pretranslatedE || !pretranslatedE["@type"]) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (pretranslatedE["@type"].toLowerCase() &&
|
|
105
|
+
(pretranslatedE["@type"].toLowerCase().startsWith('sample') || pretranslatedE["@type"].toLowerCase().startsWith('instruction'))
|
|
102
106
|
) {
|
|
103
107
|
continue;
|
|
104
108
|
}
|
|
@@ -522,6 +526,10 @@ module.exports = class CTDLASNCSVImport {
|
|
|
522
526
|
let relationById = {};
|
|
523
527
|
for (let i = 0; i < tabularData.length; i++) {
|
|
524
528
|
let pretranslatedE = tabularData[i];
|
|
529
|
+
// Skip extra lines if found in file
|
|
530
|
+
if (!pretranslatedE || !pretranslatedE["@type"]) {
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
525
533
|
if (
|
|
526
534
|
pretranslatedE["@type"].toLowerCase().startsWith('sample') || pretranslatedE["@type"].toLowerCase().startsWith('instruction')
|
|
527
535
|
) {
|
|
@@ -43,6 +43,7 @@ module.exports = class EcRepository {
|
|
|
43
43
|
selectedServerProxy = null;
|
|
44
44
|
autoDetectFound = false;
|
|
45
45
|
timeOffset = 0;
|
|
46
|
+
postMaxSize = null;
|
|
46
47
|
init(selectedServer, success, failure, loginObjectCallback) {
|
|
47
48
|
this.selectedServer = selectedServer;
|
|
48
49
|
return this.negotiateTimeOffset(success, failure, loginObjectCallback);
|
|
@@ -62,6 +63,9 @@ module.exports = class EcRepository {
|
|
|
62
63
|
if (p1["plugins"]) {
|
|
63
64
|
EcRepository.defaultPlugins = JSON.parse(p1["plugins"]);
|
|
64
65
|
}
|
|
66
|
+
if (p1["postMaxSize"]) {
|
|
67
|
+
me.postMaxSize = p1["postMaxSize"];
|
|
68
|
+
}
|
|
65
69
|
if (p1["ping"] == "pong") {
|
|
66
70
|
if (loginObjectCallback != null)
|
|
67
71
|
loginObjectCallback(p1);
|
|
@@ -914,16 +918,28 @@ module.exports = class EcRepository {
|
|
|
914
918
|
})
|
|
915
919
|
.then((signatureSheet) => {
|
|
916
920
|
let fd = new FormData();
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
921
|
+
let stringifiedData = JSON.stringify(preparedData);
|
|
922
|
+
if (this.postMaxSize && (stringifiedData.length >= this.postMaxSize || signatureSheet.length >= this.postMaxSize) && data.length > 1) {
|
|
923
|
+
let arr1 = data.slice(0, Math.floor(data.length / 2));
|
|
924
|
+
let arr2 = data.slice(Math.floor(data.length / 2), data.length);
|
|
925
|
+
|
|
926
|
+
let promise1 = this.multiput(arr1, null, null, eim);
|
|
927
|
+
let promise2 = this.multiput(arr2, null, null, eim);
|
|
928
|
+
|
|
929
|
+
let promise = Promise.all([promise1, promise2]);
|
|
930
|
+
return cassPromisify(promise, success, failure);
|
|
931
|
+
} else {
|
|
932
|
+
fd.append("data", stringifiedData);
|
|
933
|
+
fd.append("signatureSheet", signatureSheet);
|
|
934
|
+
let server = this.selectedServer;
|
|
935
|
+
return EcRemote.postExpectingString(
|
|
936
|
+
server,
|
|
937
|
+
"sky/repo/multiPut",
|
|
938
|
+
fd,
|
|
939
|
+
success,
|
|
940
|
+
failure
|
|
941
|
+
);
|
|
942
|
+
}
|
|
927
943
|
});
|
|
928
944
|
};
|
|
929
945
|
/**
|