cassproject 0.5.27 → 0.5.28
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 +3 -0
- package/package.json +19 -18
- package/src/com/eduworks/ec/graph/EcFrameworkGraph.js +13 -13
- package/src/com/eduworks/ec/graph/EcFrameworkGraph.test.js +2 -1
- package/src/org/cass/profile/EcAssertion.js +1 -1
- package/src/org/cassproject/ebac/repository/EcRepository.test.js +1 -1
- package/src/org/json/ld/EcLinkedData.js +28 -25
- package/src/org/schema/EcPerson.js +19 -3
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cassproject",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.28",
|
|
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
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
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:0.5.6 && 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
|
+
"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
|
+
"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
|
+
"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",
|
|
12
13
|
"testkill": "docker kill cass-test | exit 0 && docker rm cass-test | exit 0",
|
|
13
14
|
"testNode16": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node16 -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
|
|
14
15
|
"testNode15": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node15 -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
|
|
@@ -34,11 +35,11 @@
|
|
|
34
35
|
},
|
|
35
36
|
"contributors": [
|
|
36
37
|
{
|
|
37
|
-
"name": "Devlin Junker",
|
|
38
|
+
"name": "Devlin Junker (Retired)",
|
|
38
39
|
"email": "devlin.junker@eduworks.com"
|
|
39
40
|
},
|
|
40
41
|
{
|
|
41
|
-
"name": "Thomas Buskirk",
|
|
42
|
+
"name": "Thomas Buskirk (Departed)",
|
|
42
43
|
"email": "tom.buskirk@eduworks.com"
|
|
43
44
|
},
|
|
44
45
|
{
|
|
@@ -55,14 +56,12 @@
|
|
|
55
56
|
"base64-arraybuffer": "^1.0.1",
|
|
56
57
|
"forge": "^2.3.0",
|
|
57
58
|
"form-data": "^4.0.0",
|
|
58
|
-
"jsonld": "
|
|
59
|
+
"jsonld": "^5.2.0",
|
|
59
60
|
"node-forge": "^0.10.0",
|
|
60
61
|
"papaparse": "^5.3.1",
|
|
61
62
|
"pem-jwk": "^2.0.0",
|
|
62
63
|
"promise-worker": "^2.0.1",
|
|
63
|
-
"web-worker": "^1.1.0"
|
|
64
|
-
"yuidoc-ember-cli-theme": "^1.0.4",
|
|
65
|
-
"yuidocjs": "^0.10.2"
|
|
64
|
+
"web-worker": "^1.1.0"
|
|
66
65
|
},
|
|
67
66
|
"files": [
|
|
68
67
|
"lib/",
|
|
@@ -86,17 +85,17 @@
|
|
|
86
85
|
},
|
|
87
86
|
"homepage": "https://github.com/cassproject/cass-npm#readme",
|
|
88
87
|
"devDependencies": {
|
|
89
|
-
"@babel/core": "^7.
|
|
90
|
-
"@babel/preset-env": "^7.
|
|
88
|
+
"@babel/core": "^7.16.5",
|
|
89
|
+
"@babel/preset-env": "^7.16.5",
|
|
91
90
|
"@cypress/browserify-preprocessor": "^3.0.1",
|
|
92
|
-
"@cypress/webpack-preprocessor": "^5.
|
|
91
|
+
"@cypress/webpack-preprocessor": "^5.11.0",
|
|
93
92
|
"babel-eslint": "^10.1.0",
|
|
94
|
-
"babel-loader": "^8.2.
|
|
93
|
+
"babel-loader": "^8.2.3",
|
|
95
94
|
"babel-plugin-transform-remove-strict-mode": "^0.0.2",
|
|
96
95
|
"chai": "^4.3.4",
|
|
97
96
|
"convert-hrtime": "^5.0.0",
|
|
98
|
-
"cypress": "^9.
|
|
99
|
-
"eslint": "^8.
|
|
97
|
+
"cypress": "^9.2.0",
|
|
98
|
+
"eslint": "^8.5.0",
|
|
100
99
|
"mocha": "^9.1.2",
|
|
101
100
|
"node-polyfill-webpack-plugin": "^1.1.3",
|
|
102
101
|
"nodemon": "^2.0.7",
|
|
@@ -104,6 +103,8 @@
|
|
|
104
103
|
"tap": "^15.0.9",
|
|
105
104
|
"wait-on": "^6.0.0",
|
|
106
105
|
"webpack": "^5.39.1",
|
|
107
|
-
"webpack-cli": "^4.8.0"
|
|
106
|
+
"webpack-cli": "^4.8.0",
|
|
107
|
+
"yuidoc-ember-cli-theme": "^1.0.4",
|
|
108
|
+
"yuidocjs": "^0.10.2"
|
|
108
109
|
}
|
|
109
110
|
}
|
|
@@ -143,9 +143,9 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
143
143
|
assertion
|
|
144
144
|
);
|
|
145
145
|
await Promise.all(
|
|
146
|
-
this.getOutEdges(competency).map((alignment) =>
|
|
147
|
-
this.getCompetency(alignment.target).then((t) =>
|
|
148
|
-
this.processAssertionBooleanOutward(
|
|
146
|
+
await this.getOutEdges(competency).map(async (alignment) =>
|
|
147
|
+
await this.getCompetency(alignment.target).then(async (t) =>
|
|
148
|
+
await this.processAssertionBooleanOutward(
|
|
149
149
|
alignment,
|
|
150
150
|
t,
|
|
151
151
|
assertion,
|
|
@@ -154,11 +154,11 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
154
154
|
)
|
|
155
155
|
)
|
|
156
156
|
)
|
|
157
|
-
).then(() =>
|
|
158
|
-
Promise.all(
|
|
159
|
-
this.getInEdges(competency).map((alignment) =>
|
|
160
|
-
this.getCompetency(alignment.source).then((s) =>
|
|
161
|
-
this.processAssertionBooleanInward(
|
|
157
|
+
).then(async() =>
|
|
158
|
+
await Promise.all(
|
|
159
|
+
this.getInEdges(competency).map(async (alignment) =>
|
|
160
|
+
await this.getCompetency(alignment.source).then(async (s) =>
|
|
161
|
+
await this.processAssertionBooleanInward(
|
|
162
162
|
alignment,
|
|
163
163
|
s,
|
|
164
164
|
assertion,
|
|
@@ -187,11 +187,11 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
187
187
|
)
|
|
188
188
|
)
|
|
189
189
|
)
|
|
190
|
-
).then(() =>
|
|
191
|
-
Promise.all(
|
|
192
|
-
this.getOutEdges(competency).map((alignment) =>
|
|
193
|
-
this.getCompetency(alignment.target).then((s) =>
|
|
194
|
-
this.processAssertionBooleanInward(
|
|
190
|
+
).then(async () =>
|
|
191
|
+
await Promise.all(
|
|
192
|
+
this.getOutEdges(competency).map(async (alignment) =>
|
|
193
|
+
await this.getCompetency(alignment.target).then(async (s) =>
|
|
194
|
+
await this.processAssertionBooleanInward(
|
|
195
195
|
alignment,
|
|
196
196
|
s,
|
|
197
197
|
assertion,
|
|
@@ -49,7 +49,7 @@ var failure = function (p1) {
|
|
|
49
49
|
assert.fail();
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
if (
|
|
52
|
+
if (fs.readFileSync != null) {
|
|
53
53
|
https.globalAgent.options.key = fs.readFileSync('client.key');
|
|
54
54
|
https.globalAgent.options.cert = fs.readFileSync('client.crt');
|
|
55
55
|
https.globalAgent.options.ca = fs.readFileSync('ca.crt');
|
|
@@ -128,6 +128,7 @@ describe("EcFrameworkGraph", () => {
|
|
|
128
128
|
let newId1;
|
|
129
129
|
EcIdentityManager.default.clearIdentities();
|
|
130
130
|
await repo.init(process.env.CASS_LOOPBACK || "http://localhost/api/", null, null, console.log);
|
|
131
|
+
newId1 = null;
|
|
131
132
|
if (EcIdentityManager.default.ids.length > 0)
|
|
132
133
|
newId1 = EcIdentityManager.default.ids[0];
|
|
133
134
|
else {
|
|
@@ -31,10 +31,10 @@ module.exports = class EcAssertion extends Assertion {
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
async getSubject(eim) {
|
|
34
|
+
if (this.subject == null) return null;
|
|
34
35
|
if (!eim) {
|
|
35
36
|
eim = EcIdentityManager.default;
|
|
36
37
|
}
|
|
37
|
-
if (this.subject == null) return null;
|
|
38
38
|
var v = new EcEncryptedValue();
|
|
39
39
|
v.copyFrom(this.subject);
|
|
40
40
|
var codebook = Assertion.getCodebook(this);
|
|
@@ -51,7 +51,7 @@ var failure = function (p1) {
|
|
|
51
51
|
assert.fail();
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
if (
|
|
54
|
+
if (fs.readFileSync != null) {
|
|
55
55
|
https.globalAgent.options.key = fs.readFileSync('client.key');
|
|
56
56
|
https.globalAgent.options.cert = fs.readFileSync('client.crt');
|
|
57
57
|
https.globalAgent.options.ca = fs.readFileSync('ca.crt');
|
|
@@ -263,27 +263,33 @@ global.jsonld = require("jsonld");
|
|
|
263
263
|
throw "Incompatible type: " + this.getFullType() + that;
|
|
264
264
|
return this;
|
|
265
265
|
}
|
|
266
|
-
recast(translationContext, targetContext, success, failure) {
|
|
266
|
+
async recast(translationContext, targetContext, success, failure) {
|
|
267
267
|
var me = this;
|
|
268
268
|
var json = JSON.parse(this.toJson());
|
|
269
269
|
if (targetContext == null) targetContext = json["@context"];
|
|
270
270
|
json["@context"] = translationContext;
|
|
271
271
|
var finalTargetContext = targetContext;
|
|
272
|
-
|
|
272
|
+
let actual;
|
|
273
|
+
try {
|
|
274
|
+
actual = await jsonld.expand(json);
|
|
275
|
+
} catch(error) {
|
|
273
276
|
if (error != null) {
|
|
274
277
|
failure(error["message"]);
|
|
275
278
|
return;
|
|
276
279
|
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
}
|
|
280
|
+
}
|
|
281
|
+
let o;
|
|
282
|
+
try {
|
|
283
|
+
o = await jsonld.compact(actual, finalTargetContext);
|
|
284
|
+
} catch(s) {
|
|
285
|
+
if (s != null) {
|
|
286
|
+
failure(s);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
me.copyFrom(o);
|
|
291
|
+
me["@context"] = finalTargetContext;
|
|
292
|
+
success(me);
|
|
287
293
|
}
|
|
288
294
|
/**
|
|
289
295
|
* Encodes the object in a form where it is ready to be signed.
|
|
@@ -370,20 +376,17 @@ global.jsonld = require("jsonld");
|
|
|
370
376
|
}
|
|
371
377
|
return a;
|
|
372
378
|
}
|
|
373
|
-
compact(remoteContextUrl, success, failure) {
|
|
379
|
+
async compact(remoteContextUrl, success, failure) {
|
|
374
380
|
var me = this;
|
|
375
|
-
|
|
376
|
-
this.toJson(),
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}
|
|
384
|
-
me.copyFrom(compacted);
|
|
385
|
-
success(this);
|
|
381
|
+
try {
|
|
382
|
+
let compacted = await jsonld.compact(this.toJson(), remoteContextUrl);
|
|
383
|
+
me.copyFrom(compacted);
|
|
384
|
+
success(this);
|
|
385
|
+
} catch(err) {
|
|
386
|
+
if (err != null) {
|
|
387
|
+
failure(err);
|
|
388
|
+
return;
|
|
386
389
|
}
|
|
387
|
-
|
|
390
|
+
}
|
|
388
391
|
}
|
|
389
392
|
};
|
|
@@ -1,13 +1,29 @@
|
|
|
1
|
+
const {cassReturnAsPromise} = require("../../com/eduworks/ec/promises/helpers");
|
|
1
2
|
const EcRepository = require("../cassproject/ebac/repository/EcRepository");
|
|
2
3
|
|
|
3
4
|
module.exports = class EcPerson extends schema.Person {
|
|
4
|
-
static getByPk(repo, pk, success, failure, eim) {
|
|
5
|
-
|
|
5
|
+
static async getByPk(repo, pk, success, failure, eim) {
|
|
6
|
+
let p = await EcPerson.get(
|
|
6
7
|
repo.selectedServer +
|
|
7
8
|
(repo.selectedServer.endsWith("/") ? "" : "/") +
|
|
8
9
|
"data/" +
|
|
9
10
|
pk.fingerprint(),
|
|
10
|
-
|
|
11
|
+
null,
|
|
12
|
+
null, repo, eim
|
|
13
|
+
);
|
|
14
|
+
if (p != null)
|
|
15
|
+
return cassReturnAsPromise(p, success, failure);
|
|
16
|
+
return EcPerson.search(repo, pk.fingerprint(),
|
|
17
|
+
(persons)=>{
|
|
18
|
+
if (persons.length === 0) {
|
|
19
|
+
if (failure != null)
|
|
20
|
+
failure("Person not found.");
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
if (EcRepository.caching)
|
|
24
|
+
EcRepository.cache[repo.selectedServer +(repo.selectedServer.endsWith("/") ? "" : "/") +"data/" +pk.fingerprint()] = persons[0];
|
|
25
|
+
return cassReturnAsPromise(persons[0], success, failure);
|
|
26
|
+
},
|
|
11
27
|
failure, repo, eim
|
|
12
28
|
);
|
|
13
29
|
}
|