@itentialopensource/adapter-utils 4.45.1 → 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,32 @@
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
+
12
+ ## 4.45.3 [12-13-2021]
13
+
14
+ * move preinstall to postinstall
15
+
16
+ See merge request itentialopensource/adapter-utils!229
17
+
18
+ ---
19
+
20
+ ## 4.45.2 [12-09-2021]
21
+
22
+ * change for sending content-length with empty token body
23
+
24
+ Closes ADAPT-1889
25
+
26
+ See merge request itentialopensource/adapter-utils!228
27
+
28
+ ---
29
+
2
30
  ## 4.45.1 [12-08-2021]
3
31
 
4
32
  * Modified response handling on error to use the translator
@@ -1931,7 +1931,7 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
1931
1931
 
1932
1932
  // if there is a body, set the content length of the body and add it to
1933
1933
  // the header
1934
- if (Object.keys(tokenEntity).length > 0) {
1934
+ if (Object.keys(tokenEntity).length > 0 || tokenSchema.sendEmpty) {
1935
1935
  options.headers['Content-length'] = Buffer.byteLength(bodyString);
1936
1936
  }
1937
1937
 
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,9 +1,9 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "4.45.1",
3
+ "version": "4.45.4",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
- "preinstall": "node utils/setup.js",
6
+ "postinstall": "node utils/setup.js",
7
7
  "lint": "eslint . --ext .json --ext .js",
8
8
  "lint:errors": "eslint --quiet . --ext .json --ext .js",
9
9
  "test:unit": "mocha test/unit/lib/requestHandlerTest.js --LOG=error && mocha test/unit/lib/restHandlerTest.js --LOG=error && mocha test/unit/lib/propertyUtilTest.js --LOG=error && mocha test/unit/lib/translatorUtilTest.js --LOG=error && mocha test/unit/lib/dbUtilTest.js --LOG=debug",
@@ -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",