cassproject 0.5.30 → 1.5.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/README.md
CHANGED
|
@@ -21,10 +21,10 @@ 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
|
|
24
|
+
* `npm test` - Runs unit tests in docker images against the CaSS 1.5, 1.2, 1.3, and 1.4 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
|
-
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:
|
|
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`
|
|
28
28
|
|
|
29
29
|
* `npm automocha` - Runs mocha unit tests against current Node environment. Will rerun unit tests on-save.
|
|
30
30
|
* `npm mocha` - Runs mocha unit tests.
|
|
@@ -35,15 +35,24 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
|
|
|
35
35
|
|
|
36
36
|
## Publish checklist
|
|
37
37
|
|
|
38
|
-
*
|
|
38
|
+
* Review dependencies, autocomplete version numbers
|
|
39
39
|
* Increment version number in package.json and yuidoc.json
|
|
40
|
-
* `npm run docs`
|
|
40
|
+
* Update documentation, `npm run docs`
|
|
41
|
+
* Delete yuidoc elements from devDependencies in package.json
|
|
42
|
+
* Delete package-lock.json and node_modules, `npm install`
|
|
43
|
+
* `npm test` - Must not fail any tests.
|
|
41
44
|
* Commit changes to GitHub.
|
|
42
45
|
* Tag release with semantic version from package.json, push tag.
|
|
43
46
|
* `npm publish` (must be `npm login`ed)
|
|
44
47
|
|
|
45
48
|
# Changelog
|
|
46
49
|
|
|
50
|
+
## 1.5.0
|
|
51
|
+
* Version increment
|
|
52
|
+
|
|
53
|
+
## 0.5.31
|
|
54
|
+
* Optimized performance of EcFrameworkGraph
|
|
55
|
+
|
|
47
56
|
## 0.5.30
|
|
48
57
|
* Optimized performance of EcFrameworkGraph
|
|
49
58
|
* Library Updates
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cassproject",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Competency and Skills Service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "npm run test05 && npm run test14 && npm run test13 && npm run test12",
|
|
8
8
|
"testCassTest": "npm run testkill && docker run -d --name cass-test -p80:80 cass-test && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
|
|
9
|
-
"test05": "npm run testkill && docker run -d --name cass-test -p80:80 cassproject/cass:
|
|
9
|
+
"test05": "npm run testkill && docker run -d --name cass-test -p80:80 cassproject/cass:1.5.0 && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
|
|
10
10
|
"test14": "npm run testkill && docker run -d --name cass-test -p80:80 cassproject/cass:1.4.4 && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
|
|
11
11
|
"test13": "npm run testkill && docker run -d --name cass-test -p80:80 cassproject/cass:1.3.18 && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
|
|
12
12
|
"test12": "npm run testkill && docker run -d --name cass-test -p80:80 cassproject/cass:1.2.44 && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
|
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
"autotest": "nodemon test.js",
|
|
22
22
|
"autoindex": "nodemon index.js",
|
|
23
23
|
"mocha": "mocha -b src/**/*.test.js",
|
|
24
|
+
"mochaGraph": "mocha -b src/com/eduworks/ec/graph/**/*.test.js",
|
|
24
25
|
"automocha": "nodemon --exec \"npm run mocha\"",
|
|
26
|
+
"automochaGraph": "nodemon --exec \"npm run mochaGraph\"",
|
|
25
27
|
"automocha:clientSideCertificates": "set CASS_LOOPBACK=https://localhost/api/&& nodemon --exec \"npm run mocha\"",
|
|
26
28
|
"lint": "eslint src -c .eslintrc.js --ext .js --fix",
|
|
27
|
-
"docs": "yuidoc -c yuidoc.json -o docs -e .js src",
|
|
28
|
-
"doclint": "yuidoc --lint -c yuidoc.json -o docs -e .js src",
|
|
29
|
+
"docs": "npm install yuidocjs yuidoc-ember-cli-theme && yuidoc -c yuidoc.json -o docs -e .js src && npm remove yuidocjs yuidoc-ember-cli-theme",
|
|
30
|
+
"doclint": "npm install yuidocjs yuidoc-ember-cli-theme && yuidoc --lint -c yuidoc.json -o docs -e .js src",
|
|
29
31
|
"browserify:cypress:open": "cypress open --config-file cypressBrowserify.json",
|
|
30
32
|
"webpack:cypress:open": "cypress open --config-file cypressWebpack.json",
|
|
31
33
|
"browserify:cypress": "cypress run --config-file cypressBrowserify.json --headless --browser chrome",
|
|
@@ -52,8 +54,8 @@
|
|
|
52
54
|
}
|
|
53
55
|
],
|
|
54
56
|
"dependencies": {
|
|
55
|
-
"axios": "^0.
|
|
56
|
-
"base64-arraybuffer": "^1.0.
|
|
57
|
+
"axios": "^0.25.0",
|
|
58
|
+
"base64-arraybuffer": "^1.0.2",
|
|
57
59
|
"forge": "^2.3.0",
|
|
58
60
|
"form-data": "^4.0.0",
|
|
59
61
|
"jsonld": "^5.2.0",
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
"pem-jwk": "^2.0.0",
|
|
63
65
|
"promise-worker": "^2.0.1",
|
|
64
66
|
"rdf-canonize": "^3.0.0",
|
|
65
|
-
"web-worker": "^1.
|
|
67
|
+
"web-worker": "^1.2.0"
|
|
66
68
|
},
|
|
67
69
|
"files": [
|
|
68
70
|
"lib/",
|
|
@@ -86,26 +88,22 @@
|
|
|
86
88
|
},
|
|
87
89
|
"homepage": "https://github.com/cassproject/cass-npm#readme",
|
|
88
90
|
"devDependencies": {
|
|
89
|
-
"@babel/core": "^7.
|
|
90
|
-
"@babel/preset-env": "^7.16.
|
|
91
|
-
"@cypress/browserify-preprocessor": "^3.0.
|
|
91
|
+
"@babel/core": "^7.17.0",
|
|
92
|
+
"@babel/preset-env": "^7.16.11",
|
|
93
|
+
"@cypress/browserify-preprocessor": "^3.0.2",
|
|
92
94
|
"@cypress/webpack-preprocessor": "^5.11.0",
|
|
93
95
|
"babel-eslint": "^10.1.0",
|
|
94
96
|
"babel-loader": "^8.2.3",
|
|
95
97
|
"babel-plugin-transform-remove-strict-mode": "^0.0.2",
|
|
96
|
-
"chai": "^4.3.
|
|
98
|
+
"chai": "^4.3.6",
|
|
97
99
|
"convert-hrtime": "^5.0.0",
|
|
98
|
-
"cypress": "^9.
|
|
99
|
-
"eslint": "^8.
|
|
100
|
-
"mocha": "^9.
|
|
101
|
-
"node-polyfill-webpack-plugin": "^1.1.
|
|
102
|
-
"nodemon": "^2.0.
|
|
103
|
-
"prettier": "^2.2.1",
|
|
104
|
-
"tap": "^15.0.9",
|
|
100
|
+
"cypress": "^9.4.1",
|
|
101
|
+
"eslint": "^8.8.0",
|
|
102
|
+
"mocha": "^9.2.0",
|
|
103
|
+
"node-polyfill-webpack-plugin": "^1.1.4",
|
|
104
|
+
"nodemon": "^2.0.15",
|
|
105
105
|
"wait-on": "^6.0.0",
|
|
106
|
-
"webpack": "^5.
|
|
107
|
-
"webpack-cli": "^4.
|
|
108
|
-
"yuidoc-ember-cli-theme": "^1.0.4",
|
|
109
|
-
"yuidocjs": "^0.10.2"
|
|
106
|
+
"webpack": "^5.68.0",
|
|
107
|
+
"webpack-cli": "^4.9.2"
|
|
110
108
|
}
|
|
111
109
|
}
|
|
@@ -6,6 +6,7 @@ const EcRemoteLinkedData = require("../../../../org/cassproject/schema/general/E
|
|
|
6
6
|
const EcArray = require("../array/EcArray.js");
|
|
7
7
|
const { cassPromisify } = require("../promises/helpers.js");
|
|
8
8
|
const EcDirectedGraph = require("./EcDirectedGraph.js");
|
|
9
|
+
const Triple = require("./Triple.js");
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Graph for working with a framework. Additional computed data (such as profile data) can be overlaid on the graph through the use of "metaverticies" and "metaedges" that hold additional information.
|
|
@@ -110,7 +111,7 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
110
111
|
let competencies = {};
|
|
111
112
|
await Promise.all(
|
|
112
113
|
assertions.map(async (assertion) => {
|
|
113
|
-
if (!this.containsVertexById(assertion.competency)) {
|
|
114
|
+
if (!this.containsVertexById(assertion.competency)) { //O(1)
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
116
117
|
let negative = await assertion.getNegative();
|
|
@@ -125,12 +126,14 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
125
126
|
await Promise.all(
|
|
126
127
|
Object.keys(competencies).map(async (label) => {
|
|
127
128
|
let competency = await this.getCompetency(label);
|
|
129
|
+
//if (competencies[label].negatives.length > 0)
|
|
128
130
|
await this.processAssertionsBooleanPerAssertion(
|
|
129
131
|
competencies[label].negatives,
|
|
130
132
|
true,
|
|
131
133
|
competency,
|
|
132
134
|
[]
|
|
133
135
|
);
|
|
136
|
+
//if (competencies[label].positives.length > 0)
|
|
134
137
|
await this.processAssertionsBooleanPerAssertion(
|
|
135
138
|
competencies[label].positives,
|
|
136
139
|
false,
|
|
@@ -356,5 +359,57 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
356
359
|
}
|
|
357
360
|
getDefaultEdgeType() {
|
|
358
361
|
return EcAlignment.NARROWS;
|
|
362
|
+
}
|
|
363
|
+
inEdgeCache = {};
|
|
364
|
+
outEdgeCache = {};
|
|
365
|
+
getInEdges(vertex) {
|
|
366
|
+
if (this.inEdgeCache[vertex.shortId()] == null) return [];
|
|
367
|
+
return [...this.inEdgeCache[vertex.shortId()]];
|
|
368
|
+
}
|
|
369
|
+
getOutEdges(vertex) {
|
|
370
|
+
if (this.outEdgeCache[vertex.shortId()] == null) return [];
|
|
371
|
+
return [...this.outEdgeCache[vertex.shortId()]];
|
|
372
|
+
}
|
|
373
|
+
addEdge(e, v1, v2) {
|
|
374
|
+
this.addVertexSafely(v1);
|
|
375
|
+
this.addVertexSafely(v2);
|
|
376
|
+
var t = new Triple();
|
|
377
|
+
t.source = v1;
|
|
378
|
+
t.destination = v2;
|
|
379
|
+
t.edge = e;
|
|
380
|
+
this.edges.push(t);
|
|
381
|
+
this.cacheEdges(t);
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
addEdgeUnsafely(e, v1, v2) {
|
|
385
|
+
var t = new Triple();
|
|
386
|
+
t.source = v1;
|
|
387
|
+
t.destination = v2;
|
|
388
|
+
t.edge = e;
|
|
389
|
+
this.edges.push(t);
|
|
390
|
+
this.cacheEdges(t);
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
addEdgeSafely(e, v1, v2) {
|
|
394
|
+
this.addVertexSafely(v1);
|
|
395
|
+
this.addVertexSafely(v2);
|
|
396
|
+
var t = new Triple();
|
|
397
|
+
t.source = v1;
|
|
398
|
+
t.destination = v2;
|
|
399
|
+
t.edge = e;
|
|
400
|
+
if (EcArray.has(this.edges, t)) return false;
|
|
401
|
+
this.edges.push(t);
|
|
402
|
+
this.cacheEdges(t);
|
|
403
|
+
return true;
|
|
404
|
+
}
|
|
405
|
+
cacheEdges(e)
|
|
406
|
+
{
|
|
407
|
+
//TODO: Remove cached stuff when edges are removed.
|
|
408
|
+
if (this.inEdgeCache[e.destination.shortId()] == null)
|
|
409
|
+
this.inEdgeCache[e.destination.shortId()] = [];
|
|
410
|
+
this.inEdgeCache[e.destination.shortId()].push(e.edge);
|
|
411
|
+
if (this.outEdgeCache[e.source.shortId()] == null)
|
|
412
|
+
this.outEdgeCache[e.source.shortId()] = [];
|
|
413
|
+
this.outEdgeCache[e.source.shortId()].push(e.edge);
|
|
359
414
|
}
|
|
360
415
|
};
|
|
@@ -248,7 +248,6 @@ describe("EcFrameworkGraph", () => {
|
|
|
248
248
|
() => {}
|
|
249
249
|
).then(() => {
|
|
250
250
|
let result = [];
|
|
251
|
-
console.log(fg.getMetaStateCompetency(c));
|
|
252
251
|
result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
|
|
253
252
|
result.push(fg.getMetaStateCompetency(c)["negativeAssertion"]?.length);
|
|
254
253
|
return result;
|
|
@@ -301,7 +301,7 @@ global.jsonld = require("jsonld");
|
|
|
301
301
|
toSignableJson() {
|
|
302
302
|
var d = JSON.parse(this.toJson());
|
|
303
303
|
if (
|
|
304
|
-
this.type.indexOf("http://schema.eduworks.com/")
|
|
304
|
+
this.type.indexOf("http://schema.eduworks.com/") == 0 &&
|
|
305
305
|
this.type.indexOf("/0.1/") != -1
|
|
306
306
|
) {
|
|
307
307
|
delete d["signature"];
|
|
@@ -147,13 +147,7 @@ module.exports = class EcOrganization extends schema.Organization {
|
|
|
147
147
|
async addOrgKey(newOrgPpk) {
|
|
148
148
|
var orgKeys = await this.getOrgKeys();
|
|
149
149
|
orgKeys.push(newOrgPpk);
|
|
150
|
-
|
|
151
|
-
this.ppkListToPemArrayString(orgKeys),
|
|
152
|
-
EcOrganization.ORG_PPK_SET_KEY,
|
|
153
|
-
this.owner,
|
|
154
|
-
this.reader
|
|
155
|
-
);
|
|
156
|
-
this[EcOrganization.ORG_PPK_SET_KEY] = newKeys;
|
|
150
|
+
this[EcOrganization.ORG_PPK_SET_KEY] = orgKeys;
|
|
157
151
|
}
|
|
158
152
|
/**
|
|
159
153
|
* Performs a rekey operation and saves the organization details to the server
|
|
@@ -248,13 +242,15 @@ module.exports = class EcOrganization extends schema.Organization {
|
|
|
248
242
|
async getOrgKeys(eim) {
|
|
249
243
|
var orgKeys = [];
|
|
250
244
|
var o = this[EcOrganization.ORG_PPK_SET_KEY];
|
|
251
|
-
if (o != null) {
|
|
245
|
+
if (o != null && (o.type === 'EncryptedValue' || o["@type"] === 'EncryptedValue')) {
|
|
252
246
|
var ev = new EcEncryptedValue();
|
|
253
247
|
ev.copyFrom(o);
|
|
254
248
|
var orgKeysPPKPems = JSON.parse(await ev.decryptIntoString(null, null, eim));
|
|
255
249
|
for (var i = 0; i < orgKeysPPKPems.length; i++) {
|
|
256
250
|
orgKeys.push(EcPpk.fromPem(orgKeysPPKPems[i]));
|
|
257
251
|
}
|
|
252
|
+
} else if (o) {
|
|
253
|
+
orgKeys = o;
|
|
258
254
|
}
|
|
259
255
|
return orgKeys;
|
|
260
256
|
}
|