cassproject 5.0.20 → 5.0.23

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.
Files changed (107) hide show
  1. package/package.json +49 -52
  2. package/src/com/eduworks/ec/array/EcArray.js +1 -1
  3. package/src/com/eduworks/ec/array/EcAsyncHelper.js +1 -1
  4. package/src/com/eduworks/ec/array/EcObject.js +1 -1
  5. package/src/com/eduworks/ec/crypto/EcAes.js +1 -1
  6. package/src/com/eduworks/ec/crypto/EcAesCtrAsync.js +20 -22
  7. package/src/com/eduworks/ec/crypto/EcCrypto.js +8 -4
  8. package/src/com/eduworks/ec/crypto/EcPk.js +7 -7
  9. package/src/com/eduworks/ec/crypto/EcPpk.js +7 -7
  10. package/src/com/eduworks/ec/crypto/EcRsaOaepAsync.js +20 -19
  11. package/src/com/eduworks/ec/crypto/EcRsaOaepAsyncWorker.js +7 -6
  12. package/src/com/eduworks/ec/crypto/forgeAsync.js +1 -9
  13. package/src/com/eduworks/ec/crypto/forgeAsyncNode.js +8 -8
  14. package/src/com/eduworks/ec/graph/EcDirectedGraph.js +1 -2
  15. package/src/com/eduworks/ec/graph/EcFrameworkGraph.js +18 -24
  16. package/src/com/eduworks/ec/promises/helpers.js +1 -3
  17. package/src/com/eduworks/ec/remote/EcRemote.js +9 -9
  18. package/src/com/eduworks/ec/task/EcAsyncTask.js +5 -20
  19. package/src/com/eduworks/ec/task/EcAsyncTaskManager.js +3 -4
  20. package/src/com/eduworks/ec/task/EcAsyncTaskWorker.js +9 -11
  21. package/src/com/eduworks/schema/cfd/competency/CfdFramework.js +36 -37
  22. package/src/com/eduworks/schema/ebac/EbacContact.js +3 -9
  23. package/src/com/eduworks/schema/ebac/EbacContactGrant.js +3 -9
  24. package/src/com/eduworks/schema/ebac/EbacCredential.js +3 -9
  25. package/src/com/eduworks/schema/ebac/EbacCredentialCommit.js +3 -9
  26. package/src/com/eduworks/schema/ebac/EbacCredentialRequest.js +3 -9
  27. package/src/com/eduworks/schema/ebac/EbacCredentials.js +3 -9
  28. package/src/com/eduworks/schema/ebac/EbacEncryptedSecret.js +3 -9
  29. package/src/com/eduworks/schema/ebac/EbacEncryptedValue.js +5 -12
  30. package/src/com/eduworks/schema/ebac/EbacSignature.js +1 -6
  31. package/src/index/env.js +6 -3
  32. package/src/index/polyfills.js +13 -27
  33. package/src/org/angles/schema/angles/VideoStory.js +1 -1
  34. package/src/org/cass/competency/EcCompetency.js +1 -2
  35. package/src/org/cass/competency/EcDirectory.js +1 -2
  36. package/src/org/cass/competency/EcFramework.js +9 -12
  37. package/src/org/cass/exporter/CSVExport.js +12 -13
  38. package/src/org/cass/importer/ASNImport.js +3 -6
  39. package/src/org/cass/importer/CSVImport.js +9 -17
  40. package/src/org/cass/importer/CTDLASNCSVConceptImport.js +25 -121
  41. package/src/org/cass/importer/CTDLASNCSVImport.js +88 -133
  42. package/src/org/cass/importer/FrameworkImport.js +16 -30
  43. package/src/org/cass/importer/MedbiqImport.js +3 -4
  44. package/src/org/cass/importer/TabStructuredImport.js +6 -6
  45. package/src/org/cass/profile/EcAssertion.js +40 -51
  46. package/src/org/cassproject/ebac/identity/EcContactGrant.js +2 -2
  47. package/src/org/cassproject/ebac/identity/EcIdentityManager.js +56 -62
  48. package/src/org/cassproject/ebac/identity/EcRekeyRequest.js +3 -2
  49. package/src/org/cassproject/ebac/identity/remote/EcRemoteIdentityManager.js +51 -62
  50. package/src/org/cassproject/ebac/identity/remote/OAuth2FileBasedRemoteIdentityManager.js +56 -70
  51. package/src/org/cassproject/ebac/identity/remote/RemoteIdentityManagerInterface.js +3 -3
  52. package/src/org/cassproject/ebac/repository/EcEncryptedValue.js +51 -44
  53. package/src/org/cassproject/ebac/repository/EcRepository.js +228 -301
  54. package/src/org/cassproject/general/repository/GeneralFile.js +8 -9
  55. package/src/org/cassproject/schema/cass/competency/Competency.js +10 -11
  56. package/src/org/cassproject/schema/cass/competency/Framework.js +10 -11
  57. package/src/org/cassproject/schema/cass/competency/Level.js +10 -11
  58. package/src/org/cassproject/schema/cass/competency/Relation.js +10 -11
  59. package/src/org/cassproject/schema/cass/competency/RollupRule.js +7 -7
  60. package/src/org/cassproject/schema/cass/profile/Assertion.js +20 -27
  61. package/src/org/cassproject/schema/cass/profile/AssertionEnvelope.js +3 -5
  62. package/src/org/cassproject/schema/general/EcRemoteLinkedData.js +41 -44
  63. package/src/org/json/ld/EcLinkedData.js +10 -12
  64. package/src/org/schema/EcOrganization.js +10 -10
  65. package/src/org/schema/EcQuestion.js +8 -8
  66. package/src/org/w3/skos/Concept.js +6 -6
  67. package/src/org/w3/skos/ConceptScheme.js +6 -6
  68. package/src/org/w3/skos/EcConcept.js +1 -2
  69. package/src/org/w3/skos/EcConceptScheme.js +1 -2
  70. package/src/test/0.start.test.js +1 -1
  71. package/src/test/0.testLibraries.test.js +172 -0
  72. package/src/test/1.ASNImport.test.js +122 -0
  73. package/src/test/1.CSVExport.test.js +57 -0
  74. package/src/test/1.CSVImport.test.js +185 -0
  75. package/src/test/1.CTDLASNCSVConceptImport.test.js +348 -0
  76. package/src/test/1.CTDLASNCSVImport.import.test.js +497 -0
  77. package/src/test/1.Ebac.schema.test.js +107 -0
  78. package/src/test/1.EcAssertion.decrypt.test.js +98 -0
  79. package/src/test/1.EcAssertion.pinned.test.js +160 -0
  80. package/src/test/1.EcCrypto.formats.test.js +293 -0
  81. package/src/test/1.EcCrypto.generateUUID.test.js +47 -0
  82. package/src/test/1.EcEncryptedValue.helpers.test.js +236 -0
  83. package/src/test/1.EcHelpers.misc.test.js +259 -0
  84. package/src/test/1.EcIdentityManager.keys.test.js +439 -0
  85. package/src/test/1.EcOrganization.rekey.test.js +68 -0
  86. package/src/test/1.EcRemote.responses.test.js +155 -0
  87. package/src/test/1.EcRemoteIdentityManager.flows.test.js +326 -0
  88. package/src/test/1.EcRemoteLinkedData.pinned.test.js +473 -0
  89. package/src/test/1.EcRepository.l0.test.js +14 -5
  90. package/src/test/1.EcRepository.l1.test.js +16 -7
  91. package/src/test/1.EcRepository.l2.test.js +20 -11
  92. package/src/test/1.EcRepository.unit.test.js +961 -0
  93. package/src/test/1.EcRsaOaep.test.js +2 -12
  94. package/src/test/1.EcRsaOaepAsync.test.js +2 -12
  95. package/src/test/1.EcRsaOaepAsyncWorker.test.js +2 -12
  96. package/src/test/1.EcRsaOaepAsyncWorker.workers.test.js +147 -0
  97. package/src/test/1.FrameworkImport.test.js +170 -0
  98. package/src/test/1.MedbiqImport.test.js +92 -0
  99. package/src/test/1.OAuth2FileBasedRemoteIdentityManager.test.js +399 -0
  100. package/src/test/1.TabStructuredImport.test.js +61 -0
  101. package/src/test/1.polyfills.test.js +89 -0
  102. package/src/test/1.schema.competency.pinned.test.js +384 -0
  103. package/src/test/3.EcFrameworkGraph.test.js +3 -2
  104. package/src/test/4.schema.test.js +33 -28
  105. package/src/test/4.skyId.test.js +4 -2
  106. package/src/test/cypressValue.js +9 -0
  107. package/src/test/2.EcCompetency.test.js +0 -17
@@ -3,6 +3,14 @@ function isPromise(obj) {
3
3
  return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function'
4
4
  }
5
5
 
6
+ function tryCatchFunc(callback, message) {
7
+ try {
8
+ return { res: callback(message) }
9
+ } catch (e) {
10
+ return { err: e }
11
+ }
12
+ }
13
+
6
14
  function registerPromiseWorker(callback) {
7
15
  function postOutgoingMessage(e, messageId, error, result) {
8
16
  function postMessage(msg) {
@@ -29,14 +37,6 @@ function registerPromiseWorker(callback) {
29
37
  }
30
38
  }
31
39
 
32
- function tryCatchFunc(callback, message) {
33
- try {
34
- return { res: callback(message) }
35
- } catch (e) {
36
- return { err: e }
37
- }
38
- }
39
-
40
40
  function handleIncomingMessage(e, callback, messageId, message) {
41
41
  let result = tryCatchFunc(callback, message)
42
42
 
@@ -66,8 +66,7 @@ module.exports = class EcDirectedGraph extends Graph {
66
66
  let results = [];
67
67
  for (let edge2 of this.edges) {
68
68
  if (edge.equals(edge2.edge)) {
69
- results.push(edge2.source);
70
- results.push(edge2.destination);
69
+ results.push(edge2.source, edge2.destination);
71
70
  }
72
71
  }
73
72
  EcArray.removeDuplicates(results);
@@ -198,6 +198,22 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
198
198
  if (success != null)
199
199
  success();
200
200
  }
201
+ /**
202
+ * Adds assertions to the competency's meta state array named by key. When propagating (visited has more than
203
+ * one entry), assertions whose registration is already present in either meta state array are skipped.
204
+ * @private
205
+ */
206
+ addAssertionsToMetaState(competency, assertions, visited, key) {
207
+ let msc = this.getMetaStateCompetency(competency);
208
+ let alreadyAsserted = (assertion) =>
209
+ msc?.positiveAssertion?.some(a => a.registration == assertion.registration) ||
210
+ msc?.negativeAssertion?.some(a => a.registration == assertion.registration);
211
+ for (let assertion of assertions) {
212
+ if (visited.length > 1 && assertion.registration && alreadyAsserted(assertion))
213
+ continue;
214
+ this.addToMetaStateArray(msc, key, assertion);
215
+ }
216
+ }
201
217
  async processAssertionsBooleanPerAssertion(
202
218
  assertions,
203
219
  negative,
@@ -209,18 +225,7 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
209
225
  }
210
226
  visited.push(competency);
211
227
  if (negative) {
212
- let msc = this.getMetaStateCompetency(competency);
213
- for (let assertion of assertions) {
214
- if (visited.length > 1 && assertion.registration && msc.positiveAssertion?.some(a => a.registration == assertion.registration))
215
- continue;
216
- if (visited.length > 1 && assertion.registration && msc.negativeAssertion?.some(a => a.registration == assertion.registration))
217
- continue;
218
- this.addToMetaStateArray(
219
- msc,
220
- "negativeAssertion",
221
- assertion
222
- );
223
- }
228
+ this.addAssertionsToMetaState(competency, assertions, visited, "negativeAssertion");
224
229
  await Promise.all(
225
230
  this.getOutEdges(competency).map(async (alignment) =>
226
231
  await this.getCompetency(alignment.target).then(async (t) =>
@@ -249,18 +254,7 @@ module.exports = class EcFrameworkGraph extends EcDirectedGraph {
249
254
  )
250
255
  );
251
256
  } else {
252
- let msc = this.getMetaStateCompetency(competency);
253
- for (let assertion of assertions) {
254
- if (visited.length > 1 && assertion.registration && msc.positiveAssertion?.some(a => a.registration == assertion.registration))
255
- continue;
256
- if (visited.length > 1 && assertion.registration && msc.negativeAssertion?.some(a => a.registration == assertion.registration))
257
- continue;
258
- this.addToMetaStateArray(
259
- msc,
260
- "positiveAssertion",
261
- assertion
262
- );
263
- }
257
+ this.addAssertionsToMetaState(competency, assertions, visited, "positiveAssertion");
264
258
  await Promise.all(
265
259
  this.getInEdges(competency).map(async (alignment) =>
266
260
  await this.getCompetency(alignment.source).then(async (t) =>
@@ -10,9 +10,7 @@ module.exports = {
10
10
  return p;
11
11
  },
12
12
  cassReturnNullAsPromise: function (success, failure, error) {
13
- let p = new Promise((resolve, reject) => {
14
- resolve(null);
15
- });
13
+ let p = Promise.resolve(null);
16
14
  if (success !== undefined && success != null && failure !== undefined && failure != null)
17
15
  p = p.then(success, failure);
18
16
  else if (success !== undefined && success != null)
@@ -5,7 +5,7 @@ let DEBUG = false;
5
5
  let isNode = false;
6
6
  if (typeof process === 'object') {
7
7
  if (typeof process.versions === 'object') {
8
- if (typeof process.versions.node !== 'undefined') {
8
+ if (process.versions.node !== undefined) {
9
9
  isNode = true;
10
10
  }
11
11
  }
@@ -191,7 +191,7 @@ module.exports = class EcRemote {
191
191
 
192
192
  const contentType = response.headers.get("content-type");
193
193
  let result = null;
194
- if (contentType && contentType.indexOf("application/json") !== -1) {
194
+ if (contentType?.includes("application/json")) {
195
195
  result = await response.json();
196
196
  } else {
197
197
  result = await response.text();
@@ -210,7 +210,7 @@ module.exports = class EcRemote {
210
210
  }
211
211
  return result;
212
212
  }).catch((err) => {
213
- if (isNode && typeof dns !== 'undefined') {
213
+ if (isNode && dns !== undefined) {
214
214
  dns.lookup(new URL(url).hostname, ((error, address) => {
215
215
  if (error) {
216
216
  global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "DNSLookup", url, error);
@@ -266,7 +266,7 @@ module.exports = class EcRemote {
266
266
 
267
267
  const contentType = response.headers.get("content-type");
268
268
  let result = null;
269
- if (contentType && contentType.indexOf("application/json") !== -1) {
269
+ if (contentType?.includes("application/json")) {
270
270
  result = await response.json();
271
271
  } else {
272
272
  result = await response.text();
@@ -283,7 +283,7 @@ module.exports = class EcRemote {
283
283
  else
284
284
  throw new Error(response.statusText);
285
285
  }
286
- if (isNode && typeof dns !== 'undefined') {
286
+ if (isNode && dns !== undefined) {
287
287
  dns.lookup(new URL(url).hostname, ((error, address) => {
288
288
  if (error) {
289
289
  global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "DNSLookup", url, error);
@@ -297,7 +297,7 @@ module.exports = class EcRemote {
297
297
  }
298
298
  return result;
299
299
  }).catch((err) => {
300
- if (isNode && typeof dns !== 'undefined') {
300
+ if (isNode && dns !== undefined) {
301
301
  dns.lookup(new URL(url).hostname, ((error, address) => {
302
302
  if (error) {
303
303
  global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "DNSLookup", url, error);
@@ -351,7 +351,7 @@ module.exports = class EcRemote {
351
351
  }
352
352
  const contentType = response.headers.get("content-type");
353
353
  let result = null;
354
- if (contentType && contentType.indexOf("application/json") !== -1) {
354
+ if (contentType?.includes("application/json")) {
355
355
  result = await response.json();
356
356
  } else {
357
357
  result = await response.text();
@@ -364,7 +364,7 @@ module.exports = class EcRemote {
364
364
  }
365
365
  return result;
366
366
  }).catch((err) => {
367
- if (isNode && typeof dns !== 'undefined') {
367
+ if (isNode && dns !== undefined) {
368
368
  dns.lookup(new URL(url).hostname, ((error, address) => {
369
369
  if (error) {
370
370
  global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "DNSLookup", url, signatureSheet, error);
@@ -383,7 +383,7 @@ module.exports = class EcRemote {
383
383
  static upgradeHttpToHttps(url) {
384
384
  if (typeof window !== "undefined")
385
385
  if (window?.location != null) {
386
- if (url.indexOf(window.location.protocol) == -1) {
386
+ if (!url.includes(window.location.protocol)) {
387
387
  if (window.location.protocol.startsWith("https")) {
388
388
  if (!url.startsWith("https:")) {
389
389
  url = url.replace("http:", "https:");
@@ -90,38 +90,23 @@ module.exports = class EcAsyncTask {
90
90
  return ret;
91
91
  }
92
92
  invoke0 = function() {
93
- let that = this;
94
- let ret = this.job.call(this, function() { //NOSONAR -- Not taking that chance.
95
- that.setComplete();
96
- });
93
+ let ret = this.job(() => this.setComplete());
97
94
  return ret;
98
95
  };
99
96
  invoke1 = function(arg1) {
100
- let that = this;
101
- let ret = this.job.call(this, arg1, function () { //NOSONAR -- Not taking that chance.
102
- that.setComplete();
103
- });
97
+ let ret = this.job(arg1, () => this.setComplete());
104
98
  return ret;
105
99
  };
106
100
  invoke2 = function(arg1, arg2) {
107
- let that = this;
108
- let ret = this.job.call(this, arg1, arg2, function () { //NOSONAR -- Not taking that chance.
109
- that.setComplete();
110
- });
101
+ let ret = this.job(arg1, arg2, () => this.setComplete());
111
102
  return ret;
112
103
  };
113
104
  invoke3 = function(arg1, arg2, arg3) {
114
- let that = this;
115
- let ret = this.job.call(this, arg1, arg2, arg3, function () { //NOSONAR -- Not taking that chance.
116
- that.setComplete();
117
- });
105
+ let ret = this.job(arg1, arg2, arg3, () => this.setComplete());
118
106
  return ret;
119
107
  };
120
108
  invoke4 = function(arg1, arg2, arg3, arg4) {
121
- let that = this;
122
- let ret = this.job.call(this, arg1, arg2, arg3, arg4, function() { //NOSONAR -- Not taking that chance.
123
- that.setComplete();
124
- });
109
+ let ret = this.job(arg1, arg2, arg3, arg4, () => this.setComplete());
125
110
  return ret;
126
111
  };
127
112
  };
@@ -6,9 +6,8 @@ module.exports = class EcAsyncTaskManager {
6
6
  for (let i = 0; i < workerCount; i++) {
7
7
  this.workerList.push(new EcAsyncTaskWorker());
8
8
  }
9
- let that = this;
10
- setInterval(function() {
11
- that.cleanupTasks();
9
+ setInterval(() => {
10
+ this.cleanupTasks();
12
11
  }, this.taskCleanupInterval);
13
12
  }
14
13
 
@@ -48,7 +47,7 @@ module.exports = class EcAsyncTaskManager {
48
47
  let timeoutSec = task.getTimeout();
49
48
  if (
50
49
  task.getStart().getTime() <
51
- new Date().getTime() - timeoutSec * 1000
50
+ Date.now() - timeoutSec * 1000
52
51
  ) {
53
52
  task.setComplete();
54
53
  }
@@ -1,9 +1,8 @@
1
1
  module.exports = class EcAsyncTaskWorker {
2
2
  constructor() {
3
3
  this.assignedList = [];
4
- let that = this;
5
- this.intervalHandler = setInterval(function() {
6
- that.run();
4
+ this.intervalHandler = setInterval(() => {
5
+ this.run();
7
6
  }, this.checkWorkInterval);
8
7
  }
9
8
  checkWorkInterval = 100;
@@ -42,19 +41,18 @@ module.exports = class EcAsyncTaskWorker {
42
41
  }
43
42
  }
44
43
  run() {
45
- let that = this;
46
- this.taskHandler = Task.immediate(function() {
44
+ this.taskHandler = Task.immediate(() => {
47
45
  if (
48
- that.currentTask != undefined &&
49
- that.currentTask != null &&
50
- !that.currentTask.getIsStarted()
46
+ this.currentTask != undefined &&
47
+ this.currentTask != null &&
48
+ !this.currentTask.getIsStarted()
51
49
  ) {
52
- that.invoke();
50
+ this.invoke();
53
51
  }
54
52
  if (
55
- that.currentTask?.getIsComplete()
53
+ this.currentTask?.getIsComplete()
56
54
  ) {
57
- that.currentTask = that.assignedList.shift();
55
+ this.currentTask = this.assignedList.shift();
58
56
  }
59
57
  });
60
58
  }
@@ -86,53 +86,52 @@ module.exports = class CfdFramework extends EcFramework {
86
86
  CfdFramework.toRemove[this.shortId()] = remove;
87
87
  if (CfdFramework.removed == null) CfdFramework.removed = {};
88
88
  CfdFramework.removed[this.shortId()] = 0;
89
- let that = this;
90
- let onAllRemove = function () {
91
- EcRepository.DELETE(that, success, failure, repo, eim);
89
+ let onAllRemove = () => {
90
+ EcRepository.DELETE(this, success, failure, repo, eim);
92
91
  };
93
92
  if (remove == 0) onAllRemove();
94
93
  if (this.competency != null && this.competency.length > 0) {
95
94
  for (let comp of this.competency) {
96
95
  CfdCompetency.get(
97
96
  comp,
98
- function (comp) {
97
+ (comp) => {
99
98
  comp._delete(
100
- function (p1) {
101
- CfdFramework.removed[that.shortId()] =
102
- CfdFramework.removed[that.shortId()] + 1;
99
+ (p1) => {
100
+ CfdFramework.removed[this.shortId()] =
101
+ CfdFramework.removed[this.shortId()] + 1;
103
102
  if (
104
- CfdFramework.removed[that.shortId()] ==
105
- CfdFramework.toRemove[that.shortId()]
103
+ CfdFramework.removed[this.shortId()] ==
104
+ CfdFramework.toRemove[this.shortId()]
106
105
  )
107
106
  onAllRemove();
108
107
  },
109
- function (err) {
108
+ (err) => {
110
109
  let error =
111
110
  "Error deleting competency (" +
112
111
  comp.id +
113
112
  "): " +
114
113
  err;
115
114
  failure(error);
116
- CfdFramework.removed[that.shortId()] =
117
- CfdFramework.removed[that.shortId()] + 1;
115
+ CfdFramework.removed[this.shortId()] =
116
+ CfdFramework.removed[this.shortId()] + 1;
118
117
  if (
119
- CfdFramework.removed[that.shortId()] ==
120
- CfdFramework.toRemove[that.shortId()]
118
+ CfdFramework.removed[this.shortId()] ==
119
+ CfdFramework.toRemove[this.shortId()]
121
120
  )
122
121
  onAllRemove();
123
122
  },
124
123
  repo, eim
125
124
  );
126
125
  },
127
- function (err) {
126
+ (err) => {
128
127
  let error =
129
128
  "Error retrieving competency to delete: " + err;
130
129
  failure(error);
131
- CfdFramework.removed[that.shortId()] =
132
- CfdFramework.removed[that.shortId()] + 1;
130
+ CfdFramework.removed[this.shortId()] =
131
+ CfdFramework.removed[this.shortId()] + 1;
133
132
  if (
134
- CfdFramework.removed[that.shortId()] ==
135
- CfdFramework.toRemove[that.shortId()]
133
+ CfdFramework.removed[this.shortId()] ==
134
+ CfdFramework.toRemove[this.shortId()]
136
135
  )
137
136
  onAllRemove();
138
137
  }, repo, eim
@@ -143,43 +142,43 @@ module.exports = class CfdFramework extends EcFramework {
143
142
  for (let rel of this.relation) {
144
143
  EcAlignment.get(
145
144
  rel,
146
- function (rel) {
145
+ (rel) => {
147
146
  rel._delete(
148
- function (p1) {
149
- CfdFramework.removed[that.shortId()] =
150
- CfdFramework.removed[that.shortId()] + 1;
147
+ (p1) => {
148
+ CfdFramework.removed[this.shortId()] =
149
+ CfdFramework.removed[this.shortId()] + 1;
151
150
  if (
152
- CfdFramework.removed[that.shortId()] ==
153
- CfdFramework.toRemove[that.shortId()]
151
+ CfdFramework.removed[this.shortId()] ==
152
+ CfdFramework.toRemove[this.shortId()]
154
153
  )
155
154
  onAllRemove();
156
155
  },
157
- function (err) {
156
+ (err) => {
158
157
  let error =
159
158
  "Error deleting relation (" +
160
159
  rel.id +
161
160
  "): " +
162
161
  err;
163
162
  failure(error);
164
- CfdFramework.removed[that.shortId()] =
165
- CfdFramework.removed[that.shortId()] + 1;
163
+ CfdFramework.removed[this.shortId()] =
164
+ CfdFramework.removed[this.shortId()] + 1;
166
165
  if (
167
- CfdFramework.removed[that.shortId()] ==
168
- CfdFramework.toRemove[that.shortId()]
166
+ CfdFramework.removed[this.shortId()] ==
167
+ CfdFramework.toRemove[this.shortId()]
169
168
  )
170
169
  onAllRemove();
171
170
  }, repo, eim
172
171
  );
173
172
  },
174
- function (err) {
173
+ (err) => {
175
174
  let error =
176
175
  "Error retrieving relationship to delete: " + err;
177
176
  failure(error);
178
- CfdFramework.removed[that.shortId()] =
179
- CfdFramework.removed[that.shortId()] + 1;
177
+ CfdFramework.removed[this.shortId()] =
178
+ CfdFramework.removed[this.shortId()] + 1;
180
179
  if (
181
- CfdFramework.removed[that.shortId()] ==
182
- CfdFramework.toRemove[that.shortId()]
180
+ CfdFramework.removed[this.shortId()] ==
181
+ CfdFramework.toRemove[this.shortId()]
183
182
  )
184
183
  onAllRemove();
185
184
  }
@@ -187,8 +186,8 @@ module.exports = class CfdFramework extends EcFramework {
187
186
  }
188
187
  }
189
188
  if (
190
- CfdFramework.removed[that.shortId()] ==
191
- CfdFramework.toRemove[that.shortId()]
189
+ CfdFramework.removed[this.shortId()] ==
190
+ CfdFramework.toRemove[this.shortId()]
192
191
  )
193
192
  onAllRemove();
194
193
  };
@@ -60,9 +60,8 @@ module.exports = class EbacContact extends EcLinkedData {
60
60
  upgrade() {
61
61
  super.upgrade();
62
62
  if (EbacContact.TYPE_0_1 == (this.type)) {
63
- let me = this;
64
- if (me["@context"] == null && me["@schema"] != null)
65
- me["@context"] = me["@schema"];
63
+ if (this["@context"] == null && this["@schema"] != null)
64
+ this["@context"] = this["@schema"];
66
65
  this.setContextAndType(Ebac.context_0_2, EbacContact.TYPE_0_2);
67
66
  }
68
67
  if (EbacContact.TYPE_0_2 == (this.getFullType())) {
@@ -73,11 +72,6 @@ module.exports = class EbacContact extends EcLinkedData {
73
72
  }
74
73
  }
75
74
  getTypes() {
76
- let a = [];
77
- a.push(EbacContact.TYPE_0_4);
78
- a.push(EbacContact.TYPE_0_3);
79
- a.push(EbacContact.TYPE_0_2);
80
- a.push(EbacContact.TYPE_0_1);
81
- return a;
75
+ return [EbacContact.TYPE_0_4, EbacContact.TYPE_0_3, EbacContact.TYPE_0_2, EbacContact.TYPE_0_1];
82
76
  }
83
77
  };
@@ -55,9 +55,8 @@ module.exports = class EbacContactGrant extends EcRemoteLinkedData {
55
55
  upgrade() {
56
56
  super.upgrade();
57
57
  if (EbacContactGrant.TYPE_0_1 == (this.type)) {
58
- let me = this;
59
- if (me["@context"] == null && me["@schema"] != null)
60
- me["@context"] = me["@schema"];
58
+ if (this["@context"] == null && this["@schema"] != null)
59
+ this["@context"] = this["@schema"];
61
60
  this.setContextAndType(Ebac.context_0_2, EbacContactGrant.TYPE_0_2);
62
61
  }
63
62
  if (EbacContactGrant.TYPE_0_2 == (this.getFullType())) {
@@ -68,11 +67,6 @@ module.exports = class EbacContactGrant extends EcRemoteLinkedData {
68
67
  }
69
68
  }
70
69
  getTypes() {
71
- let a = [];
72
- a.push(EbacContactGrant.TYPE_0_4);
73
- a.push(EbacContactGrant.TYPE_0_3);
74
- a.push(EbacContactGrant.TYPE_0_2);
75
- a.push(EbacContactGrant.TYPE_0_1);
76
- return a;
70
+ return [EbacContactGrant.TYPE_0_4, EbacContactGrant.TYPE_0_3, EbacContactGrant.TYPE_0_2, EbacContactGrant.TYPE_0_1];
77
71
  }
78
72
  };
@@ -49,9 +49,8 @@ module.exports = class EbacCredential extends EcLinkedData {
49
49
  upgrade() {
50
50
  super.upgrade();
51
51
  if (EbacCredential.TYPE_0_1 == (this.type)) {
52
- let me = this;
53
- if (me["@context"] == null && me["@schema"] != null)
54
- me["@context"] = me["@schema"];
52
+ if (this["@context"] == null && this["@schema"] != null)
53
+ this["@context"] = this["@schema"];
55
54
  this.setContextAndType(Ebac.context_0_2, EbacCredential.TYPE_0_2);
56
55
  }
57
56
  if (EbacCredential.TYPE_0_2 == (this.getFullType())) {
@@ -62,11 +61,6 @@ module.exports = class EbacCredential extends EcLinkedData {
62
61
  }
63
62
  }
64
63
  getTypes() {
65
- let a = [];
66
- a.push(EbacCredential.TYPE_0_4);
67
- a.push(EbacCredential.TYPE_0_3);
68
- a.push(EbacCredential.TYPE_0_2);
69
- a.push(EbacCredential.TYPE_0_1);
70
- return a;
64
+ return [EbacCredential.TYPE_0_4, EbacCredential.TYPE_0_3, EbacCredential.TYPE_0_2, EbacCredential.TYPE_0_1];
71
65
  }
72
66
  };
@@ -50,9 +50,8 @@ module.exports = class EbacCredentialCommit extends EcLinkedData {
50
50
  upgrade() {
51
51
  super.upgrade();
52
52
  if (EbacCredentialCommit.TYPE_0_1 == (this.type)) {
53
- let me = this;
54
- if (me["@context"] == null && me["@schema"] != null)
55
- me["@context"] = me["@schema"];
53
+ if (this["@context"] == null && this["@schema"] != null)
54
+ this["@context"] = this["@schema"];
56
55
  this.setContextAndType(
57
56
  Ebac.context_0_2,
58
57
  EbacCredentialCommit.TYPE_0_2
@@ -72,11 +71,6 @@ module.exports = class EbacCredentialCommit extends EcLinkedData {
72
71
  }
73
72
  }
74
73
  getTypes() {
75
- let a = [];
76
- a.push(EbacCredentialCommit.TYPE_0_4);
77
- a.push(EbacCredentialCommit.TYPE_0_3);
78
- a.push(EbacCredentialCommit.TYPE_0_2);
79
- a.push(EbacCredentialCommit.TYPE_0_1);
80
- return a;
74
+ return [EbacCredentialCommit.TYPE_0_4, EbacCredentialCommit.TYPE_0_3, EbacCredentialCommit.TYPE_0_2, EbacCredentialCommit.TYPE_0_1];
81
75
  }
82
76
  };
@@ -35,9 +35,8 @@ module.exports = class EbacCredentialRequest extends EcLinkedData {
35
35
  upgrade() {
36
36
  super.upgrade();
37
37
  if (EbacCredentialRequest.TYPE_0_1 == this.type) {
38
- let me = this;
39
- if (me["@context"] == null && me["@schema"] != null)
40
- me["@context"] = me["@schema"];
38
+ if (this["@context"] == null && this["@schema"] != null)
39
+ this["@context"] = this["@schema"];
41
40
  this.setContextAndType(
42
41
  Ebac.context_0_2,
43
42
  EbacCredentialRequest.TYPE_0_2
@@ -57,11 +56,6 @@ module.exports = class EbacCredentialRequest extends EcLinkedData {
57
56
  }
58
57
  }
59
58
  getTypes() {
60
- let a = [];
61
- a.push(EbacCredentialRequest.TYPE_0_4);
62
- a.push(EbacCredentialRequest.TYPE_0_3);
63
- a.push(EbacCredentialRequest.TYPE_0_2);
64
- a.push(EbacCredentialRequest.TYPE_0_1);
65
- return a;
59
+ return [EbacCredentialRequest.TYPE_0_4, EbacCredentialRequest.TYPE_0_3, EbacCredentialRequest.TYPE_0_2, EbacCredentialRequest.TYPE_0_1];
66
60
  }
67
61
  };
@@ -48,9 +48,8 @@ module.exports = class EbacCredentials extends EcLinkedData {
48
48
  upgrade() {
49
49
  super.upgrade();
50
50
  if (EbacCredentials.TYPE_0_1 == (this.type)) {
51
- let me = this;
52
- if (me["@context"] == null && me["@schema"] != null)
53
- me["@context"] = me["@schema"];
51
+ if (this["@context"] == null && this["@schema"] != null)
52
+ this["@context"] = this["@schema"];
54
53
  this.setContextAndType(Ebac.context_0_2, EbacCredentials.TYPE_0_2);
55
54
  }
56
55
  if (EbacCredentials.TYPE_0_2 == (this.getFullType())) {
@@ -61,11 +60,6 @@ module.exports = class EbacCredentials extends EcLinkedData {
61
60
  }
62
61
  }
63
62
  getTypes() {
64
- let a = [];
65
- a.push(EbacCredentials.TYPE_0_4);
66
- a.push(EbacCredentials.TYPE_0_3);
67
- a.push(EbacCredentials.TYPE_0_2);
68
- a.push(EbacCredentials.TYPE_0_1);
69
- return a;
63
+ return [EbacCredentials.TYPE_0_4, EbacCredentials.TYPE_0_3, EbacCredentials.TYPE_0_2, EbacCredentials.TYPE_0_1];
70
64
  }
71
65
  };
@@ -87,9 +87,8 @@ module.exports = class EbacEncryptedSecret extends EcLinkedData {
87
87
  upgrade() {
88
88
  super.upgrade();
89
89
  if (EbacEncryptedSecret.TYPE_0_1 == this.type) {
90
- let me = this;
91
- if (me["@context"] == null && me["@schema"] != null)
92
- me["@context"] = me["@schema"];
90
+ if (this["@context"] == null && this["@schema"] != null)
91
+ this["@context"] = this["@schema"];
93
92
  this.setContextAndType(
94
93
  Ebac.context_0_2,
95
94
  EbacEncryptedSecret.TYPE_0_2
@@ -109,11 +108,6 @@ module.exports = class EbacEncryptedSecret extends EcLinkedData {
109
108
  }
110
109
  }
111
110
  getTypes() {
112
- let a = [];
113
- a.push(EbacEncryptedSecret.TYPE_0_4);
114
- a.push(EbacEncryptedSecret.TYPE_0_3);
115
- a.push(EbacEncryptedSecret.TYPE_0_2);
116
- a.push(EbacEncryptedSecret.TYPE_0_1);
117
- return a;
111
+ return [EbacEncryptedSecret.TYPE_0_4, EbacEncryptedSecret.TYPE_0_3, EbacEncryptedSecret.TYPE_0_2, EbacEncryptedSecret.TYPE_0_1];
118
112
  }
119
113
  };
@@ -65,11 +65,10 @@ module.exports = class EbacEncryptedValue extends EcRemoteLinkedData {
65
65
  */
66
66
  iv = null;
67
67
  copyFrom(that) {
68
- let me = this;
69
- for (let key in me) delete me[key];
68
+ for (let key in this) delete this[key];
70
69
  let you = that;
71
70
  for (let key in you) {
72
- if (me[key] == null) me[key.replace("@", "")] = you[key];
71
+ if (this[key] == null) this[key.replace("@", "")] = you[key];
73
72
  }
74
73
  if (!this.isAny(this.getTypes()))
75
74
  throw new Error("Incompatible type: " + this.getFullType());
@@ -77,9 +76,8 @@ module.exports = class EbacEncryptedValue extends EcRemoteLinkedData {
77
76
  upgrade() {
78
77
  super.upgrade();
79
78
  if (EbacEncryptedValue.TYPE_0_1 == this.type) {
80
- let me = this;
81
- if (me["@context"] == null && me["@schema"] != null)
82
- me["@context"] = me["@schema"];
79
+ if (this["@context"] == null && this["@schema"] != null)
80
+ this["@context"] = this["@schema"];
83
81
  this.setContextAndType(
84
82
  Ebac.context_0_2,
85
83
  EbacEncryptedValue.TYPE_0_2
@@ -99,11 +97,6 @@ module.exports = class EbacEncryptedValue extends EcRemoteLinkedData {
99
97
  }
100
98
  }
101
99
  getTypes() {
102
- let a = [];
103
- a.push(EbacEncryptedValue.TYPE_0_4);
104
- a.push(EbacEncryptedValue.TYPE_0_3);
105
- a.push(EbacEncryptedValue.TYPE_0_2);
106
- a.push(EbacEncryptedValue.TYPE_0_1);
107
- return a;
100
+ return [EbacEncryptedValue.TYPE_0_4, EbacEncryptedValue.TYPE_0_3, EbacEncryptedValue.TYPE_0_2, EbacEncryptedValue.TYPE_0_1];
108
101
  }
109
102
  };