cassproject 1.5.49 → 1.5.50

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,6 +49,9 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
49
49
 
50
50
  # Changelog
51
51
 
52
+ ## 1.5.49
53
+ * Fixed bug in precache.
54
+
52
55
  ## 1.5.48
53
56
  * EcRepository.precache now returns all urls it can, regardless of whether they were fetched from the server.
54
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cassproject",
3
- "version": "1.5.49",
3
+ "version": "1.5.50",
4
4
  "description": "Competency and Skills Service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -978,12 +978,12 @@ module.exports = class EcRepository {
978
978
  * @method precache
979
979
  */
980
980
  precache = function (urls, success, failure, eim) {
981
- let originals = [...urls];
982
981
  if (eim === undefined || eim == null)
983
982
  eim = EcIdentityManager.default;
984
983
  if (urls == null) {
985
984
  throw new Error("urls not defined.");
986
985
  }
986
+ let originals = [...urls];
987
987
  if (EcRepository.caching == true)
988
988
  urls = urls.filter(url => EcRepository.cache[url] === undefined);
989
989
  urls = urls.map(
@@ -996,7 +996,7 @@ module.exports = class EcRepository {
996
996
  if (EcRepository.caching == true)
997
997
  urls = urls.filter(url => EcRepository.cache[url] === undefined);
998
998
  if (urls.length == 0) {
999
- return new Promise((resolve, reject) => resolve());
999
+ return new Promise((resolve, reject) => resolve()).then(()=>originals.map(url=>EcRepository.cache[url]).filter(x=>x));
1000
1000
  }
1001
1001
  let fd = new FormData();
1002
1002
  fd.append("data", JSON.stringify(urls));