@itentialopensource/adapter-utils 6.1.11 → 6.1.13
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/lib/connectorRest.js +10 -0
- package/lib/requestHandler.js +11 -17
- package/package.json +1 -1
package/lib/connectorRest.js
CHANGED
|
@@ -3169,6 +3169,11 @@ function requestAuthenticate(request, entitySchema, invalidToken, callProperties
|
|
|
3169
3169
|
log.trace(origin);
|
|
3170
3170
|
|
|
3171
3171
|
try {
|
|
3172
|
+
// Store original path before authentication if not already stored
|
|
3173
|
+
if (!request.pathBeforeAuth) {
|
|
3174
|
+
request.pathBeforeAuth = request.header.path;
|
|
3175
|
+
}
|
|
3176
|
+
|
|
3172
3177
|
// set up the right credentials - passed in overrides default
|
|
3173
3178
|
let useUser = username;
|
|
3174
3179
|
let usePass = password;
|
|
@@ -3791,6 +3796,11 @@ function retryInvalidResponse(request, callProperties, myTransTime, claimedLic,
|
|
|
3791
3796
|
log.trace(origin);
|
|
3792
3797
|
|
|
3793
3798
|
try {
|
|
3799
|
+
// Restore original path before retry
|
|
3800
|
+
if (request.pathBeforeAuth) {
|
|
3801
|
+
request.header.path = request.pathBeforeAuth;
|
|
3802
|
+
}
|
|
3803
|
+
|
|
3794
3804
|
// Need to get a new token and retry the request
|
|
3795
3805
|
return requestAuthenticate(request, entitySchema, request.tokenUsed, callProperties, (mres, merror) => {
|
|
3796
3806
|
if (merror) {
|
package/lib/requestHandler.js
CHANGED
|
@@ -152,23 +152,17 @@ function walkThroughActionFiles(directory) {
|
|
|
152
152
|
// if invalid properties throw an error
|
|
153
153
|
if (!result) {
|
|
154
154
|
// Get the action and component from the first ajv error
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
//
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
// get the component that failed for the action
|
|
168
|
-
if (temp.length > actEndInd + 1) {
|
|
169
|
-
component = temp.substring(actEndInd + 2);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
155
|
+
const instancePath = validate.errors?.[0]?.instancePath || '';
|
|
156
|
+
const match = instancePath.match(/\/actions\/(\d+)/);
|
|
157
|
+
const actNum = match ? parseInt(match[1], 10) : undefined;
|
|
158
|
+
// Get action name
|
|
159
|
+
const action = actions.actions?.[actNum]?.name ?? 'checkErrorDetails';
|
|
160
|
+
// Get component from remaining path
|
|
161
|
+
const remainingPath = match ? instancePath.substring(match[0].length) : '';
|
|
162
|
+
const component = remainingPath.length > 1
|
|
163
|
+
? remainingPath.substring(1)
|
|
164
|
+
: 'checkErrorDetails';
|
|
165
|
+
|
|
172
166
|
let msg = `${origin}: Error on validation of actions for entity `;
|
|
173
167
|
msg += `${entities[e]} - ${action} - ${component} Details: ${JSON.stringify(validate.errors)}`;
|
|
174
168
|
clean.push(msg);
|