@itentialopensource/adapter-utils 4.45.5 → 4.46.0
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 +18 -5
- package/lib/translatorUtil.js +5 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
|
|
2
|
+
## 4.46.0 [07-27-2022]
|
|
3
|
+
|
|
4
|
+
* Added code to skip split string on dot for special cases
|
|
5
|
+
|
|
6
|
+
Closes ADAPT-2266
|
|
7
|
+
|
|
8
|
+
See merge request itentialopensource/adapter-utils!234
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 4.45.7 [07-25-2022]
|
|
13
|
+
|
|
14
|
+
* Fix issue on no token where it takes exception
|
|
15
|
+
|
|
16
|
+
Closes ADAPT-2244
|
|
17
|
+
|
|
18
|
+
See merge request itentialopensource/adapter-utils!233
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 4.45.6 [05-19-2022]
|
|
23
|
+
|
|
24
|
+
* Change for token request with Auth header and data
|
|
25
|
+
|
|
26
|
+
Closes ADAPT-2056
|
|
27
|
+
|
|
28
|
+
See merge request itentialopensource/adapter-utils!232
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
2
32
|
## 4.45.5 [05-14-2022]
|
|
3
33
|
|
|
4
34
|
* handle missing token data in mockdata
|
package/lib/connectorRest.js
CHANGED
|
@@ -1865,11 +1865,12 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
|
|
|
1865
1865
|
let bodyString = null;
|
|
1866
1866
|
|
|
1867
1867
|
// if we have been passed a schema and the Authorization is in a header
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
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
|
+
// }
|
|
1873
1874
|
if (tokenSchema) {
|
|
1874
1875
|
// if this is a get, need to put the username on the url
|
|
1875
1876
|
if (options.path.indexOf('/{username}') >= 0) {
|
|
@@ -1926,6 +1927,12 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
|
|
|
1926
1927
|
}
|
|
1927
1928
|
}
|
|
1928
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
|
+
|
|
1929
1936
|
// map the data we received to an Entity - will get back the defaults
|
|
1930
1937
|
const tokenEntity = transUtilInst.mapToOutboundEntity(creds, tokenSchema.requestSchema);
|
|
1931
1938
|
bodyString = tokenEntity;
|
|
@@ -2117,6 +2124,9 @@ function getTokenItem(pathForToken, user, reqBody, invalidToken, callProperties,
|
|
|
2117
2124
|
if (berror) {
|
|
2118
2125
|
done(null, berror);
|
|
2119
2126
|
}
|
|
2127
|
+
if (!dyntoken) {
|
|
2128
|
+
done(null, 'No Token returned');
|
|
2129
|
+
}
|
|
2120
2130
|
|
|
2121
2131
|
let timeout = tokenTimeout;
|
|
2122
2132
|
|
|
@@ -2389,6 +2399,9 @@ function requestAuthenticate(request, entitySchema, invalidToken, callProperties
|
|
|
2389
2399
|
if (berror) {
|
|
2390
2400
|
return callback(null, berror);
|
|
2391
2401
|
}
|
|
2402
|
+
if (!dyntoken) {
|
|
2403
|
+
return callback(null, 'No Token returned');
|
|
2404
|
+
}
|
|
2392
2405
|
|
|
2393
2406
|
// format the authentication string
|
|
2394
2407
|
const tokenObj = {
|
package/lib/translatorUtil.js
CHANGED
|
@@ -247,6 +247,7 @@ function extractObject(dataObj, entitySchema, dynamicFields) {
|
|
|
247
247
|
log.trace(origin);
|
|
248
248
|
const returnObj = {};
|
|
249
249
|
let addFields = dynamicFields;
|
|
250
|
+
const regex = /(?<!\\)\./gm;
|
|
250
251
|
|
|
251
252
|
// if no translation needed - just return the object
|
|
252
253
|
if (Object.hasOwnProperty.call(entitySchema, 'translate')
|
|
@@ -278,7 +279,7 @@ function extractObject(dataObj, entitySchema, dynamicFields) {
|
|
|
278
279
|
// if the external name is something get that field
|
|
279
280
|
if (field.external_name) {
|
|
280
281
|
// need to determine the field in the incoming object where the data is
|
|
281
|
-
const externalPath = field.external_name.split('.');
|
|
282
|
+
const externalPath = field.external_name.split(regex).map((e) => (e.replace(/\\./g, '.')));
|
|
282
283
|
let location = dataObj;
|
|
283
284
|
let inField = null;
|
|
284
285
|
|
|
@@ -349,7 +350,7 @@ function extractObject(dataObj, entitySchema, dynamicFields) {
|
|
|
349
350
|
// if the field is not in the schema - we need to add it
|
|
350
351
|
// using the field name that came in since no translation
|
|
351
352
|
if (field.external_name) {
|
|
352
|
-
const externalPath = field.external_name.split('.');
|
|
353
|
+
const externalPath = field.external_name.split(regex).map((e) => (e.replace(/\\./g, '.')));
|
|
353
354
|
|
|
354
355
|
if (externalPath[externalPath.length - 1] === objectKeys[o]) {
|
|
355
356
|
found = true;
|
|
@@ -488,7 +489,7 @@ function extractJSONEntity(dataObj, entitySchema) {
|
|
|
488
489
|
function buildObject(dataObj, entitySchema, dynamicFields) {
|
|
489
490
|
const origin = `${id}-translatorUtil-buildObject`;
|
|
490
491
|
log.trace(origin);
|
|
491
|
-
|
|
492
|
+
const regex = /(?<!\\)\./gm;
|
|
492
493
|
const returnObj = {};
|
|
493
494
|
let addFields = dynamicFields;
|
|
494
495
|
|
|
@@ -531,7 +532,7 @@ function buildObject(dataObj, entitySchema, dynamicFields) {
|
|
|
531
532
|
// if in the data object, add to the system entity
|
|
532
533
|
if (fieldValue !== null) {
|
|
533
534
|
// need to determine the field in the object where the data should go
|
|
534
|
-
const externalPath = field.external_name.split('.');
|
|
535
|
+
const externalPath = field.external_name.split(regex).map((e) => (e.replace(/\\./g, '.')));
|
|
535
536
|
let location = returnObj;
|
|
536
537
|
|
|
537
538
|
// get to the field in the object
|