cassproject 5.0.0 → 5.0.1
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
|
@@ -49,8 +49,11 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
|
|
|
49
49
|
|
|
50
50
|
# Changelog
|
|
51
51
|
|
|
52
|
+
## 5.0.1
|
|
53
|
+
* Updated CEASN import to include versionIdentifier.
|
|
54
|
+
|
|
52
55
|
## 5.0.0
|
|
53
|
-
* Added multidelete to EcRepository
|
|
56
|
+
* Added multidelete to EcRepository.
|
|
54
57
|
* NPM requires semantic versioning coherence, so I must now use big number for version.
|
|
55
58
|
* Added and refined tests to include deleting, multideleting.
|
|
56
59
|
* Made use of EcRepository.cache more consistent.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cassproject",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "Competency and Skills Service",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"convert-hrtime": "^5.0.0",
|
|
179
179
|
"cypress": "^13.17.0",
|
|
180
180
|
"cypress-fail-fast": "^7.1.1",
|
|
181
|
-
"eslint": "^9.
|
|
181
|
+
"eslint": "^9.29.0",
|
|
182
182
|
"fake-indexeddb": "^6.0.1",
|
|
183
183
|
"mocha": "^10.8.2",
|
|
184
184
|
"node-polyfill-webpack-plugin": "^4.1.0",
|
|
@@ -31,6 +31,30 @@ const customDocLoader = async (url, options) => {
|
|
|
31
31
|
return result;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
function setVersionIdentifier(f) {
|
|
35
|
+
if (f["ceterms:versionIdentifier"]) {
|
|
36
|
+
if (!Array.isArray(f["ceterms:versionIdentifier"])) {
|
|
37
|
+
f["ceterms:versionIdentifier"] = [f["ceterms:versionIdentifier"]];
|
|
38
|
+
}
|
|
39
|
+
for (let i = f["ceterms:versionIdentifier"].length - 1; i >= 0; i--) {
|
|
40
|
+
try {
|
|
41
|
+
let parts = f["ceterms:versionIdentifier"][i].split("~");
|
|
42
|
+
console.log('parts', parts);
|
|
43
|
+
f["ceterms:versionIdentifier"][i] = {
|
|
44
|
+
"ceterms:identifierValueCode": parts[0],
|
|
45
|
+
"ceterms:identifierTypeName": {
|
|
46
|
+
"@language": "en-us",
|
|
47
|
+
"@value": parts[1]
|
|
48
|
+
},
|
|
49
|
+
"ceterms:identifierType": parts.length > 2 ? parts[2] : undefined
|
|
50
|
+
};
|
|
51
|
+
} catch (e) {
|
|
52
|
+
delete f["ceterms:versionIdentifier"][i];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
34
58
|
module.exports = class CTDLASNCSVConceptImport {
|
|
35
59
|
static analyzeFile(file, success, failure) {
|
|
36
60
|
if (file == null) {
|
|
@@ -137,14 +161,6 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
137
161
|
endpoint,
|
|
138
162
|
repo
|
|
139
163
|
);
|
|
140
|
-
try {
|
|
141
|
-
let existing = await EcRepository.get(translator.id);
|
|
142
|
-
if (existing && existing.type !== translator.type) {
|
|
143
|
-
return failure(`Row ${i + 2}: ${translator.id} already exists as a ${existing.type}`);
|
|
144
|
-
}
|
|
145
|
-
} catch (e) {
|
|
146
|
-
console.error(e);
|
|
147
|
-
}
|
|
148
164
|
if (translator["ceasn:name"] != null) {
|
|
149
165
|
let name = translator["ceasn:name"];
|
|
150
166
|
let nameWithLanguage = {};
|
|
@@ -204,6 +220,7 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
204
220
|
) {
|
|
205
221
|
CTDLASNCSVImport.setDateCreated(e, f);
|
|
206
222
|
}
|
|
223
|
+
setVersionIdentifier(f);
|
|
207
224
|
schemeArray.push(f);
|
|
208
225
|
} else if (pretranslatedE["@type"] == "skos:Concept") {
|
|
209
226
|
let translator = new EcLinkedData(null, null);
|
|
@@ -401,14 +418,6 @@ module.exports = class CTDLASNCSVConceptImport {
|
|
|
401
418
|
endpoint,
|
|
402
419
|
repo
|
|
403
420
|
);
|
|
404
|
-
try {
|
|
405
|
-
let existing = await EcRepository.get(translator.id);
|
|
406
|
-
if (existing && existing.type !== translator.type) {
|
|
407
|
-
return failure(`Row ${i + 2}: ${translator.id} already exists as a ${existing.type}`);
|
|
408
|
-
}
|
|
409
|
-
} catch (e) {
|
|
410
|
-
console.error(e);
|
|
411
|
-
}
|
|
412
421
|
if (translator["ceasn:name"] != null) {
|
|
413
422
|
let name = translator["ceasn:name"];
|
|
414
423
|
let nameWithLanguage = {};
|
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
const EcArray = require("../../../com/eduworks/ec/array/EcArray");
|
|
2
2
|
const EcRemote = require("../../../com/eduworks/ec/remote/EcRemote");
|
|
3
3
|
|
|
4
|
+
function setVersionIdentifier(f) {
|
|
5
|
+
if (f["ceterms:versionIdentifier"]) {
|
|
6
|
+
if (!Array.isArray(f["ceterms:versionIdentifier"])) {
|
|
7
|
+
f["ceterms:versionIdentifier"] = [f["ceterms:versionIdentifier"]];
|
|
8
|
+
}
|
|
9
|
+
for (let i = f["ceterms:versionIdentifier"].length - 1; i >= 0; i--) {
|
|
10
|
+
try {
|
|
11
|
+
let parts = f["ceterms:versionIdentifier"][i].split("~");
|
|
12
|
+
console.log('parts', parts);
|
|
13
|
+
f["ceterms:versionIdentifier"][i] = {
|
|
14
|
+
"ceterms:identifierValueCode": parts[0],
|
|
15
|
+
"ceterms:identifierTypeName": {
|
|
16
|
+
"@language": "en-us",
|
|
17
|
+
"@value": parts[1]
|
|
18
|
+
},
|
|
19
|
+
"ceterms:identifierType": parts.length > 2 ? parts[2] : undefined
|
|
20
|
+
};
|
|
21
|
+
} catch (e) {
|
|
22
|
+
delete f["ceterms:versionIdentifier"][i];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
4
28
|
module.exports = class CTDLASNCSVImport {
|
|
5
29
|
static analyzeFile(file, success, failure) {
|
|
6
30
|
if (file == null) {
|
|
@@ -191,7 +215,7 @@ module.exports = class CTDLASNCSVImport {
|
|
|
191
215
|
);
|
|
192
216
|
try {
|
|
193
217
|
let existing = await EcRepository.get(translator.id);
|
|
194
|
-
if (existing && existing.type !==
|
|
218
|
+
if (existing && existing.type !== 'Framework') {
|
|
195
219
|
return failure(`Row ${i + 2}: ${translator.id} already exists as a ${existing.type}`);
|
|
196
220
|
}
|
|
197
221
|
} catch (e) {
|
|
@@ -301,6 +325,9 @@ module.exports = class CTDLASNCSVImport {
|
|
|
301
325
|
}
|
|
302
326
|
});
|
|
303
327
|
}
|
|
328
|
+
|
|
329
|
+
setVersionIdentifier(f);
|
|
330
|
+
|
|
304
331
|
frameworkArray.push(f);
|
|
305
332
|
f.competency = [];
|
|
306
333
|
f.relation = [];
|
|
@@ -598,6 +625,7 @@ module.exports = class CTDLASNCSVImport {
|
|
|
598
625
|
f["ceasn:minorAlignment"] = null;
|
|
599
626
|
f["ceasn:prerequisiteAlignment"] = null;
|
|
600
627
|
f["ceasn:hasChild"] = null;
|
|
628
|
+
setVersionIdentifier(f);
|
|
601
629
|
competencies.push(f);
|
|
602
630
|
competencyRows[f.shortId()] = e;
|
|
603
631
|
} else if (
|
|
@@ -684,14 +712,6 @@ module.exports = class CTDLASNCSVImport {
|
|
|
684
712
|
endpoint,
|
|
685
713
|
repo
|
|
686
714
|
);
|
|
687
|
-
try {
|
|
688
|
-
let existing = await EcRepository.get(translator.id);
|
|
689
|
-
if (existing && existing.type !== translator.type) {
|
|
690
|
-
return failure(`Row ${i + 2}: ${translator.id} already exists as a ${existing.type}`);
|
|
691
|
-
}
|
|
692
|
-
} catch (e) {
|
|
693
|
-
console.error(e);
|
|
694
|
-
}
|
|
695
715
|
for (let each in translator) {
|
|
696
716
|
if (terms[each]) {
|
|
697
717
|
translator[terms[each]] = translator[each];
|
|
@@ -749,6 +769,7 @@ module.exports = class CTDLASNCSVImport {
|
|
|
749
769
|
}
|
|
750
770
|
});
|
|
751
771
|
}
|
|
772
|
+
setVersionIdentifier(f);
|
|
752
773
|
delete f["ceterms:hasMember"];
|
|
753
774
|
f.relation = [];
|
|
754
775
|
f.subType = "Collection";
|
|
@@ -964,6 +985,7 @@ module.exports = class CTDLASNCSVImport {
|
|
|
964
985
|
f["ceasn:prerequisiteAlignment"] = null;
|
|
965
986
|
f["ceasn:hasChild"] = null;
|
|
966
987
|
f["ceterms:isMemberOf"] = null;
|
|
988
|
+
setVersionIdentifier(f);
|
|
967
989
|
competencies.push(f);
|
|
968
990
|
competencyRows[f.shortId()] = e;
|
|
969
991
|
} else if (
|