cassproject 1.5.41 → 1.5.46
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 +25 -23
- package/src/com/eduworks/ec/crypto/EcAesCtrAsyncWorker.js +2 -2
- package/src/com/eduworks/ec/crypto/EcRsaOaepAsyncWorker.js +8 -7
- package/src/com/eduworks/ec/graph/EcFrameworkGraph.js +61 -20
- package/src/org/cassproject/ebac/repository/EcRepository.js +18 -1
- package/src/org/json/ld/EcLinkedData.js +1 -0
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
|
|
|
41
41
|
* `npm install`
|
|
42
42
|
* `npm audit` and fix any audit issues.
|
|
43
43
|
* `npm test` - Must not fail any tests.
|
|
44
|
+
* `npm run webpack:cypressFirefoxHttps` See if the firefox test case has changed.
|
|
44
45
|
* Document code coverage output by the previous step.
|
|
45
46
|
* Commit changes to GitHub.
|
|
46
47
|
* Tag release with semantic version from package.json, push tag.
|
|
@@ -48,6 +49,13 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
|
|
|
48
49
|
|
|
49
50
|
# Changelog
|
|
50
51
|
|
|
52
|
+
## 1.5.46
|
|
53
|
+
* Added addFrameworkSoft to EcFrameworkGraph -- works better with large, poor frameworks.
|
|
54
|
+
|
|
55
|
+
## 1.5.45
|
|
56
|
+
* Fixed an issue with caching registered data.
|
|
57
|
+
* Updated libraries
|
|
58
|
+
|
|
51
59
|
## 1.5.41
|
|
52
60
|
* Updates to CEASN Concept Scheme import
|
|
53
61
|
* Updated libraries
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cassproject",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.46",
|
|
4
4
|
"description": "Competency and Skills Service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,12 +9,12 @@
|
|
|
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
|
-
"test15HttpsFips": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.
|
|
13
|
-
"test15Https11Fips": "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
|
-
"test15Https": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.
|
|
15
|
-
"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.
|
|
16
|
-
"test15Fips": "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.
|
|
17
|
-
"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
|
+
"test15HttpsFips": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.45 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" \"npm run testNode18HttpsFips\" \"npm run testNode16Https\" && npm run testkill",
|
|
13
|
+
"test15Https11Fips": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.45 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" \"npm run testNode18HttpsFips\" \"npm run testNode16Https\" && npm run testkill",
|
|
14
|
+
"test15Https": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.45 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" \"npm run testNode18HttpsFips\" \"npm run testNode16Https\" && npm run testkill",
|
|
15
|
+
"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.45 && wait-on https://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" \"npm run testNode18HttpsFips\" \"npm run testNode16Https\" && npm run testkill",
|
|
16
|
+
"test15Fips": "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.45 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode20ForceFips\" \"npm run testNode18\" \"npm run testNode18Fips\" \"npm run testNode16\" && npm run testkill15",
|
|
17
|
+
"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.45 && wait-on http://localhost/api/ping && concurrently --kill-others-on-fail \"npm run testCypress\" \"npm run testNode20\" \"npm run testNode20Fips\" \"npm run testNode18\" \"npm run testNode18Fips\" \"npm run testNode16\" && npm run testkill15",
|
|
18
18
|
"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",
|
|
19
19
|
"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",
|
|
20
20
|
"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",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"testCypressHttps": "docker build --progress plain -f docker/cypressHttps -t npm-casscypresshttps . & docker run -e CASS_LOOPBACK --rm npm-casscypresshttps",
|
|
49
49
|
"autotest": "nodemon test.js",
|
|
50
50
|
"autoindex": "nodemon index.js",
|
|
51
|
-
"mocha": "mocha --timeout
|
|
52
|
-
"mochaFips": "mocha -n 'force-fips' --timeout
|
|
53
|
-
"mocha:httpsNoHttp2": "export HTTP2=false|| set HTTP2=false&& mocha --timeout
|
|
54
|
-
"mocha:https": "mocha --timeout
|
|
55
|
-
"mocha:clientSideCertificates": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export CASS_LOOPBACK=https://localhost/api/|| set CASS_LOOPBACK=https://localhost/api/&&export HTTP2=false|| set HTTP2=false&& mocha --timeout
|
|
56
|
-
"mocha:clientSideCertificatesDangerMouse": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export CASS_LOOPBACK=https://localhost/api/|| set CASS_LOOPBACK=https://localhost/api/&&export HTTP2=false|| set HTTP2=false&& mocha --timeout
|
|
51
|
+
"mocha": "mocha --timeout 20000 -b src/**/*.test.js",
|
|
52
|
+
"mochaFips": "mocha -n 'force-fips' --timeout 20000 -b src/**/*.test.js",
|
|
53
|
+
"mocha:httpsNoHttp2": "export HTTP2=false|| set HTTP2=false&& mocha --timeout 20000 -b src/**/*.test.js",
|
|
54
|
+
"mocha:https": "mocha --timeout 20000 -b src/**/*.test.js",
|
|
55
|
+
"mocha:clientSideCertificates": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export CASS_LOOPBACK=https://localhost/api/|| set CASS_LOOPBACK=https://localhost/api/&&export HTTP2=false|| set HTTP2=false&& mocha --timeout 20000 -b src/**/*.test.js",
|
|
56
|
+
"mocha:clientSideCertificatesDangerMouse": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export CASS_LOOPBACK=https://localhost/api/|| set CASS_LOOPBACK=https://localhost/api/&&export HTTP2=false|| set HTTP2=false&& mocha --timeout 20000 -b src/**/*.test.js",
|
|
57
57
|
"mocha:custom": "export CASS_LOOPBACK=https://tides.eduworks.us/api/|| set CASS_LOOPBACK=https://tides.eduworks.us/api/&& export HTTP2=false|| set HTTP2=false&& mocha --timeout 300000 -b src/**/*.test.js",
|
|
58
58
|
"mocha:dev": "export CASS_LOOPBACK=https://dev.cassproject.org/api/|| set CASS_LOOPBACK=https://dev.cassproject.org/api/&& export HTTP2=false|| set HTTP2=false&& mocha --timeout 300000 -b src/**/*.test.js",
|
|
59
59
|
"mocha:demo": "export CASS_LOOPBACK=https://demo.cassproject.org/api/|| set CASS_LOOPBACK=https://demo.cassproject.org/api/&& export HTTP2=false|| set HTTP2=false&& mocha --timeout 300000 -b src/**/*.test.js",
|
|
60
|
-
"mochaGraph": "mocha --timeout
|
|
60
|
+
"mochaGraph": "mocha --timeout 20000 -b src/com/eduworks/ec/graph/**/*.test.js",
|
|
61
61
|
"automocha": "nodemon --exec \"npm run mocha\"",
|
|
62
62
|
"automochaGraph": "nodemon --exec \"npm run mochaGraph\"",
|
|
63
63
|
"automocha:clientSideCertificates": "nodemon --exec \"npm run mocha:clientSideCertificates\"",
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
"webpack:cypress": "cypress run --config-file cypressWebpack.config.js --headless --browser chrome",
|
|
78
78
|
"webpack:cypressHttps": "cypress run -e CASS_LOOPBACK=https://localhost/api/ --config-file cypressWebpack.config.js --headless --browser chrome",
|
|
79
79
|
"webpack:cypressEdge": "cypress run --config-file cypressWebpack.config.js --headless --browser edge",
|
|
80
|
-
"webpack:cypressEdgeHttps": "cypress run -e CASS_LOOPBACK=https://localhost/api/ --config-file cypressWebpack.config.js --browser edge"
|
|
80
|
+
"webpack:cypressEdgeHttps": "cypress run -e CASS_LOOPBACK=https://localhost/api/ --config-file cypressWebpack.config.js --browser edge",
|
|
81
|
+
"webpack:cypressFirefoxHttps": "cypress open -e CASS_LOOPBACK=https://localhost/api/ --config-file cypressWebpack.config.js --browser firefox"
|
|
81
82
|
},
|
|
82
83
|
"contributors": [
|
|
83
84
|
{
|
|
@@ -138,24 +139,25 @@
|
|
|
138
139
|
},
|
|
139
140
|
"homepage": "https://github.com/cassproject/cass-npm#readme",
|
|
140
141
|
"devDependencies": {
|
|
141
|
-
"@babel/core": "^7.
|
|
142
|
-
"@babel/preset-env": "^7.
|
|
142
|
+
"@babel/core": "^7.24.3",
|
|
143
|
+
"@babel/preset-env": "^7.24.3",
|
|
143
144
|
"@cypress/browserify-preprocessor": "^3.0.2",
|
|
144
145
|
"@cypress/vite-dev-server": "^5.0.7",
|
|
145
146
|
"@cypress/webpack-preprocessor": "^6.0.1",
|
|
146
147
|
"babel-eslint": "^10.1.0",
|
|
147
148
|
"babel-plugin-transform-remove-strict-mode": "^0.0.2",
|
|
148
|
-
"chai": "^4.4.
|
|
149
|
+
"chai": "^4.4.1",
|
|
149
150
|
"concurrently": "^8.2.2",
|
|
150
151
|
"convert-hrtime": "^5.0.0",
|
|
151
|
-
"cypress": "^13.
|
|
152
|
-
"eslint": "^8.
|
|
153
|
-
"mocha": "^10.
|
|
152
|
+
"cypress": "^13.7.0",
|
|
153
|
+
"eslint": "^8.57.0",
|
|
154
|
+
"mocha": "^10.3.0",
|
|
154
155
|
"node-polyfill-webpack-plugin": "^2.0.1",
|
|
155
|
-
"nodemon": "^3.0
|
|
156
|
+
"nodemon": "^3.1.0",
|
|
156
157
|
"nyc": "^15.1.0",
|
|
158
|
+
"url-polyfill": "^1.1.12",
|
|
157
159
|
"wait-on": "^7.2.0",
|
|
158
|
-
"webpack": "^5.
|
|
160
|
+
"webpack": "^5.90.3",
|
|
159
161
|
"webpack-cli": "^5.1.4",
|
|
160
162
|
"wtfnode": "^0.9.1"
|
|
161
163
|
}
|
|
@@ -30,7 +30,7 @@ module.exports = class EcAesCtrAsyncWorker {
|
|
|
30
30
|
*/
|
|
31
31
|
static encrypt(plaintext, secret, iv, success, failure) {
|
|
32
32
|
EcRsaOaepAsyncWorker.initWorker();
|
|
33
|
-
if (!
|
|
33
|
+
if (!EcRsaOaepAsyncWorker.w == null || EcRsaOaepAsyncWorker.w[EcRsaOaepAsyncWorker.rotator] == null) {
|
|
34
34
|
return cassReturnAsPromise(
|
|
35
35
|
EcAesCtr.encrypt(plaintext, secret, iv),
|
|
36
36
|
success,
|
|
@@ -69,7 +69,7 @@ module.exports = class EcAesCtrAsyncWorker {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
EcRsaOaepAsyncWorker.initWorker();
|
|
72
|
-
if (!EcRsaOaepAsyncWorker.w == null) {
|
|
72
|
+
if (!EcRsaOaepAsyncWorker.w == null || EcRsaOaepAsyncWorker.w[EcRsaOaepAsyncWorker.rotator] == null) {
|
|
73
73
|
return cassReturnAsPromise(
|
|
74
74
|
EcAesCtr.decrypt(ciphertext, secret, iv),
|
|
75
75
|
success,
|
|
@@ -9,6 +9,7 @@ let forge = require("node-forge");
|
|
|
9
9
|
let cassPromisify = require("../promises/helpers.js").cassPromisify;
|
|
10
10
|
let cassReturnAsPromise = require("../promises/helpers.js").cassReturnAsPromise;
|
|
11
11
|
require("../../../../org/cassproject/general/AuditLogger.js");
|
|
12
|
+
let EcRsaOaep = require("./EcRsaOaep.js")
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Asynchronous implementation of {{#crossLink
|
|
@@ -52,7 +53,7 @@ module.exports = class EcRsaOaepAsyncWorker {
|
|
|
52
53
|
global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRsaOaepAsyncWorker", e);
|
|
53
54
|
try {
|
|
54
55
|
wkr = new Worker(path.resolve(__dirname, 'forgeAsync.js'));
|
|
55
|
-
wkr.onerror = function(event) {
|
|
56
|
+
wkr.onerror = function (event) {
|
|
56
57
|
wkr = null;
|
|
57
58
|
global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRsaOaepAsyncWorker", event);
|
|
58
59
|
wkr = new Worker(path.resolve(__dirname, 'cass-editor/forgeAsync.js'));
|
|
@@ -85,7 +86,7 @@ module.exports = class EcRsaOaepAsyncWorker {
|
|
|
85
86
|
static encrypt(pk, plaintext, success, failure) {
|
|
86
87
|
this.initWorker();
|
|
87
88
|
if (!EcCrypto.testMode)
|
|
88
|
-
if (this.w == null) {
|
|
89
|
+
if (this.w == null || this.w[this.rotator] == null) {
|
|
89
90
|
let p = new Promise((resolve, reject) => {
|
|
90
91
|
resolve(EcRsaOaep.encrypt(pk, plaintext));
|
|
91
92
|
});
|
|
@@ -124,7 +125,7 @@ module.exports = class EcRsaOaepAsyncWorker {
|
|
|
124
125
|
}
|
|
125
126
|
this.initWorker();
|
|
126
127
|
if (!EcCrypto.testMode)
|
|
127
|
-
if (this.w == null) {
|
|
128
|
+
if (this.w == null || this.w[this.rotator] == null) {
|
|
128
129
|
let p = new Promise((resolve, reject) => {
|
|
129
130
|
resolve(EcRsaOaep.decrypt(ppk, ciphertext));
|
|
130
131
|
});
|
|
@@ -164,7 +165,7 @@ module.exports = class EcRsaOaepAsyncWorker {
|
|
|
164
165
|
static sign(ppk, text, success, failure) {
|
|
165
166
|
this.initWorker();
|
|
166
167
|
if (!EcCrypto.testMode)
|
|
167
|
-
if (this.w == null) {
|
|
168
|
+
if (this.w == null || this.w[this.rotator] == null) {
|
|
168
169
|
let p = new Promise((resolve, reject) => {
|
|
169
170
|
resolve(EcRsaOaep.sign(ppk, text));
|
|
170
171
|
});
|
|
@@ -195,7 +196,7 @@ module.exports = class EcRsaOaepAsyncWorker {
|
|
|
195
196
|
static signSha256 = function (ppk, text, success, failure) {
|
|
196
197
|
this.initWorker();
|
|
197
198
|
if (!EcCrypto.testMode)
|
|
198
|
-
if (this.w == null) {
|
|
199
|
+
if (this.w == null || this.w[this.rotator] == null) {
|
|
199
200
|
let p = new Promise((resolve, reject) => {
|
|
200
201
|
resolve(EcRsaOaep.signSha256(ppk, text));
|
|
201
202
|
});
|
|
@@ -226,7 +227,7 @@ module.exports = class EcRsaOaepAsyncWorker {
|
|
|
226
227
|
*/
|
|
227
228
|
static verify(pk, text, signature, success, failure) {
|
|
228
229
|
this.initWorker();
|
|
229
|
-
if (this.w == null) {
|
|
230
|
+
if (this.w == null || this.w[this.rotator] == null) {
|
|
230
231
|
let p = new Promise((resolve, reject) => {
|
|
231
232
|
resolve(EcRsaOaep.verify(pk, text, signature));
|
|
232
233
|
});
|
|
@@ -258,7 +259,7 @@ module.exports = class EcRsaOaepAsyncWorker {
|
|
|
258
259
|
*/
|
|
259
260
|
static verifySha256(pk, text, signature, success, failure) {
|
|
260
261
|
this.initWorker();
|
|
261
|
-
if (this.w == null) {
|
|
262
|
+
if (this.w == null || this.w[this.rotator] == null) {
|
|
262
263
|
let p = new Promise((resolve, reject) => {
|
|
263
264
|
resolve(EcRsaOaep.verify(pk, text, signature));
|
|
264
265
|
});
|
|
@@ -56,26 +56,67 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
|
|
|
56
56
|
null,
|
|
57
57
|
null,
|
|
58
58
|
this.eim
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
).then(async (data) => {
|
|
60
|
+
await Promise.all(
|
|
61
|
+
data.map((d) => this.handleCacheElement(d, framework))
|
|
62
|
+
);
|
|
63
|
+
await repo.multiget(
|
|
64
|
+
framework.relation,
|
|
65
|
+
async (data2) => {
|
|
66
|
+
await Promise.all(
|
|
67
|
+
data2.map((d2) =>
|
|
68
|
+
this.handleCacheElement(d2, framework)
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
success();
|
|
72
|
+
},
|
|
73
|
+
failure, this.eim
|
|
74
|
+
);
|
|
75
|
+
}).catch((err) => {
|
|
76
|
+
if (failure != null)
|
|
77
|
+
failure(err);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Adds a framework to the graph with only bulk operations, and creates the edges to connect the competencies in the framework.
|
|
82
|
+
*
|
|
83
|
+
* @param {EcFramework} framework Framework to add to the graph.
|
|
84
|
+
* @param {EcRepository} repo Repository to fetch data from that exists in the framework.
|
|
85
|
+
* @param {function()} success Method to invoke when done adding the framework.
|
|
86
|
+
* @param {function(error)} failure Method to invoke when things go badly.
|
|
87
|
+
* @method addFrameworkSoft
|
|
88
|
+
* @memberOf EcFrameworkGraph
|
|
89
|
+
*/
|
|
90
|
+
async addFrameworkSoft(framework, repo, success, failure) {
|
|
91
|
+
this.repo = repo;
|
|
92
|
+
this.frameworks.push(framework);
|
|
93
|
+
if (framework.competency == null) framework.competency = [];
|
|
94
|
+
if (framework.relation == null) framework.relation = [];
|
|
95
|
+
await repo.precache(
|
|
96
|
+
framework.competency,
|
|
97
|
+
null,
|
|
98
|
+
null,
|
|
99
|
+
this.eim
|
|
100
|
+
).then(async (data) => {
|
|
101
|
+
await Promise.all(
|
|
102
|
+
data.map((d) => this.handleCacheElement(d, framework))
|
|
103
|
+
);
|
|
104
|
+
await repo.precache(
|
|
105
|
+
framework.relation,
|
|
106
|
+
async (data2) => {
|
|
107
|
+
await Promise.all(
|
|
108
|
+
data2.map((d2) =>
|
|
109
|
+
this.handleCacheElement(d2, framework)
|
|
110
|
+
)
|
|
111
|
+
);
|
|
112
|
+
success();
|
|
113
|
+
},
|
|
114
|
+
failure, this.eim
|
|
115
|
+
);
|
|
116
|
+
}).catch((err) => {
|
|
117
|
+
if (failure != null)
|
|
118
|
+
failure(err);
|
|
119
|
+
});
|
|
79
120
|
}
|
|
80
121
|
async handleCacheElement(d, framework) {
|
|
81
122
|
if (d.isAny(new EcEncryptedValue().getTypes()))
|
|
@@ -243,7 +243,22 @@ module.exports = class EcRepository {
|
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
|
|
246
|
+
if (EcRepository.caching) {
|
|
247
|
+
if (EcRepository.cache[url] !== undefined) {
|
|
248
|
+
if (EcRepository.cache[url] === null) {
|
|
249
|
+
return cassReturnNullAsPromise(
|
|
250
|
+
success,
|
|
251
|
+
failure
|
|
252
|
+
);
|
|
253
|
+
} else {
|
|
254
|
+
return cassReturnAsPromise(
|
|
255
|
+
EcRepository.cache[originalUrl],
|
|
256
|
+
success,
|
|
257
|
+
failure
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
247
262
|
let finalUrl = url;
|
|
248
263
|
let p = null;
|
|
249
264
|
if (this.unsigned) {
|
|
@@ -357,6 +372,8 @@ module.exports = class EcRepository {
|
|
|
357
372
|
}
|
|
358
373
|
if (this.caching) {
|
|
359
374
|
this.cache[finalUrl] = d;
|
|
375
|
+
if (originalUrl != null && originalUrl != finalUrl)
|
|
376
|
+
this.cache[originalUrl] = d;
|
|
360
377
|
if (d.id != null) this.cache[d.id] = d;
|
|
361
378
|
}
|
|
362
379
|
return cassReturnAsPromise(d, success, failure).then(defaultFunc);
|