@itentialopensource/adapter-utils 4.45.3 → 4.45.4

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/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ ## 4.45.4 [05-01-2022]
3
+
4
+ * fix xml mockdata
5
+
6
+ Closes ADAPT-2033
7
+
8
+ See merge request itentialopensource/adapter-utils!230
9
+
10
+ ---
11
+
2
12
  ## 4.45.3 [12-13-2021]
3
13
 
4
14
  * move preinstall to postinstall
package/lib/dbUtil.js CHANGED
@@ -79,8 +79,16 @@ function getFromJson(fileName, filter) {
79
79
  fs.readdirSync(`${entityDir}/${retEntity}/mockdatafiles`).forEach((file) => {
80
80
  if (file.split('.').pop() === 'json') {
81
81
  const mockpath = `${entityDir}/${retEntity}/mockdatafiles/${file}`;
82
- const data = JSON.parse(fs.readFileSync(mockpath));
82
+ let data = {};
83
+ try {
84
+ data = JSON.parse(fs.readFileSync(mockpath));
85
+ } catch (ex) {
86
+ log.warn(`could not parse mockdata file ${file}, using empty object!`);
87
+ }
83
88
  mockdatafiles[mockpath.split('/').pop()] = data;
89
+ } else if (file.split('.').pop() === 'xml') {
90
+ const mockpath = `${entityDir}/${retEntity}/mockdatafiles/${file}`;
91
+ mockdatafiles[mockpath.split('/').pop()] = fs.readFileSync(mockpath);
84
92
  }
85
93
  });
86
94
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "4.45.3",
3
+ "version": "4.45.4",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "postinstall": "node utils/setup.js",
@@ -29,7 +29,7 @@
29
29
  "async-lock": "1.2.0",
30
30
  "cookie": "^0.4.0",
31
31
  "crypto-js": "^3.1.9-1",
32
- "ejs": "^2.7.1",
32
+ "ejs": "^3.1.7",
33
33
  "form-data": "^2.5.1",
34
34
  "fs-extra": "^8.1.0",
35
35
  "https-proxy-agent": "^2.2.1",