@itentialopensource/adapter-utils 4.45.3 → 4.45.6
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 +30 -0
- package/lib/connectorRest.js +21 -6
- package/lib/dbUtil.js +9 -1
- package/package.json +2 -2
- package/schemas/propertiesSchema.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
|
|
2
|
+
## 4.45.6 [05-19-2022]
|
|
3
|
+
|
|
4
|
+
* Change for token request with Auth header and data
|
|
5
|
+
|
|
6
|
+
Closes ADAPT-2056
|
|
7
|
+
|
|
8
|
+
See merge request itentialopensource/adapter-utils!232
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 4.45.5 [05-14-2022]
|
|
13
|
+
|
|
14
|
+
* handle missing token data in mockdata
|
|
15
|
+
|
|
16
|
+
Closes ADAPT-2048
|
|
17
|
+
|
|
18
|
+
See merge request itentialopensource/adapter-utils!231
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 4.45.4 [05-01-2022]
|
|
23
|
+
|
|
24
|
+
* fix xml mockdata
|
|
25
|
+
|
|
26
|
+
Closes ADAPT-2033
|
|
27
|
+
|
|
28
|
+
See merge request itentialopensource/adapter-utils!230
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
2
32
|
## 4.45.3 [12-13-2021]
|
|
3
33
|
|
|
4
34
|
* move preinstall to postinstall
|
package/lib/connectorRest.js
CHANGED
|
@@ -1135,6 +1135,14 @@ function getToken(reqPath, options, tokenSchema, bodyString, callProperties, cal
|
|
|
1135
1135
|
translated = tokenResp.response;
|
|
1136
1136
|
}
|
|
1137
1137
|
|
|
1138
|
+
// since this is a stub, make sure we have what we need
|
|
1139
|
+
if (!translated.token) {
|
|
1140
|
+
translated.token = 'garbagetoken';
|
|
1141
|
+
}
|
|
1142
|
+
if (!translated.tokenp2) {
|
|
1143
|
+
translated.tokenp2 = 'garbagetoken';
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1138
1146
|
// if what we got back is an array, just return the first element
|
|
1139
1147
|
// should only have one token!!!
|
|
1140
1148
|
if (translated && Array.isArray(translated)) {
|
|
@@ -1153,7 +1161,7 @@ function getToken(reqPath, options, tokenSchema, bodyString, callProperties, cal
|
|
|
1153
1161
|
// do not make the call to return a token if the request is actually
|
|
1154
1162
|
// to get a token. Getting a token to get a token -- that should go
|
|
1155
1163
|
// direct to make request
|
|
1156
|
-
return callback({ token: 'faketoken' });
|
|
1164
|
+
return callback({ token: 'faketoken', tokenp2: 'faketoken' });
|
|
1157
1165
|
}
|
|
1158
1166
|
|
|
1159
1167
|
log.debug(`${origin}: OPTIONS: ${JSON.stringify(options)}`);
|
|
@@ -1857,11 +1865,12 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
|
|
|
1857
1865
|
let bodyString = null;
|
|
1858
1866
|
|
|
1859
1867
|
// if we have been passed a schema and the Authorization is in a header
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1868
|
+
// COMMENTED OUT AND HANDLED IN IF BELOW - take stuff out of body on line 1930
|
|
1869
|
+
// if (tokenSchema && tokenSchema.headers && tokenSchema.headers.Authorization) {
|
|
1870
|
+
// // request the token
|
|
1871
|
+
// options.headers['Content-length'] = 0;
|
|
1872
|
+
// return getToken(reqPath, options, tokenSchema, '', callProperties, callback);
|
|
1873
|
+
// }
|
|
1865
1874
|
if (tokenSchema) {
|
|
1866
1875
|
// if this is a get, need to put the username on the url
|
|
1867
1876
|
if (options.path.indexOf('/{username}') >= 0) {
|
|
@@ -1918,6 +1927,12 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
|
|
|
1918
1927
|
}
|
|
1919
1928
|
}
|
|
1920
1929
|
|
|
1930
|
+
if (tokenSchema.headers && tokenSchema.headers.Authorization) {
|
|
1931
|
+
// remove the username and password from the creds
|
|
1932
|
+
delete creds.username;
|
|
1933
|
+
delete creds.password;
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1921
1936
|
// map the data we received to an Entity - will get back the defaults
|
|
1922
1937
|
const tokenEntity = transUtilInst.mapToOutboundEntity(creds, tokenSchema.requestSchema);
|
|
1923
1938
|
bodyString = tokenEntity;
|
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
|
-
|
|
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
|
+
"version": "4.45.6",
|
|
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": "^
|
|
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",
|