@mablhq/mabl-cli 1.58.20 → 1.58.25
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/api/basicApiClient.js +21 -15
- package/api/mablApiClient.js +40 -48
- package/api/mablApiClientFactory.js +1 -1
- package/auth/OktaClient.js +1 -2
- package/browserEngines/chromiumBrowserEngine.js +1 -2
- package/browserEngines/firefoxBrowserEngine.js +2 -2
- package/browserEngines/webkitBrowerEngine.js +2 -2
- package/browserLauncher/browserLauncherFactory.js +2 -3
- package/browserLauncher/elementHandle.js +1 -2
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +12 -20
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +7 -10
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +3 -4
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +4 -5
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +4 -7
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +6 -5
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +31 -37
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +8 -9
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +4 -8
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +4 -6
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +1 -2
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +1 -1
- package/browserTestMonitoring/metricsRecorder.js +6 -6
- package/commands/commandUtil/branches.js +2 -3
- package/commands/commandUtil/codeInsights.js +13 -16
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +3 -4
- package/commands/commandUtil/versionUtil.js +4 -5
- package/commands/config/config_cmds/list.js +2 -2
- package/commands/constants.js +3 -1
- package/commands/datatables/datatables_cmds/create.js +2 -3
- package/commands/datatables/datatables_cmds/export.js +3 -5
- package/commands/datatables/datatables_cmds/list.js +1 -2
- package/commands/datatables/datatables_cmds/scenarios.js +1 -2
- package/commands/datatables/datatables_cmds/update.js +11 -11
- package/commands/datatables/utils.js +9 -9
- package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +6 -8
- package/commands/deploy/deploy_cmds/create.js +11 -13
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +8 -11
- package/commands/deploy/deploy_cmds/list.js +3 -4
- package/commands/deploy/deploy_cmds/watch.js +1 -2
- package/commands/environments/environments_cmds/create.js +1 -2
- package/commands/environments/environments_cmds/delete.js +1 -2
- package/commands/environments/environments_cmds/update.js +1 -2
- package/commands/environments/environments_cmds/urls_cmds/list.js +1 -2
- package/commands/flows/flows_cmds/export.js +1 -2
- package/commands/plans/plans_cmds/describe.js +1 -2
- package/commands/tests/mobileEmulationUtil.js +5 -7
- package/commands/tests/testsUtil.js +40 -42
- package/commands/tests/tests_cmds/export.js +1 -2
- package/commands/tests/tests_cmds/import.js +4 -5
- package/commands/tests/tests_cmds/run-cloud.js +12 -13
- package/commands/tests/tests_cmds/run.js +30 -11
- package/commands/users/users_cmds/list.js +2 -2
- package/commands/workspaces/workspace_cmds/copy.js +1 -2
- package/core/execution/ApiTestUtils.js +82 -94
- package/core/execution/LocalizationOptionsLists.js +1253 -0
- package/core/messaging/logLineMessaging.js +2 -3
- package/core/messaging/messaging.js +6 -7
- package/core/trainer/trainingSessions.js +15 -15
- package/coreWebVitals/index.js +14 -18
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/functions/apiTest/utils.js +4 -5
- package/http/MablHttpAgent.js +4 -6
- package/http/RequestSecurityError.js +1 -1
- package/http/axiosProxyConfig.js +3 -5
- package/http/httpUtil.js +2 -3
- package/http/requestInterceptor.js +11 -15
- package/mablApi/index.js +1 -1
- package/mablscript/MablAction.js +2 -3
- package/mablscript/MablStep.js +2 -4
- package/mablscript/MablSymbol.js +1 -1
- package/mablscript/actions/ConditionAction.js +2 -4
- package/mablscript/actions/FindAction.js +2 -4
- package/mablscript/diffing/diffingUtil.js +8 -7
- package/mablscript/importer.js +1 -2
- package/mablscript/steps/AccessibilityCheck.js +7 -9
- package/mablscript/steps/AssertStep.js +11 -16
- package/mablscript/steps/ClickAndHoldStep.js +1 -2
- package/mablscript/steps/CookieUtils.js +40 -7
- package/mablscript/steps/CreateVariableStep.js +1 -2
- package/mablscript/steps/DownloadStep.js +1 -2
- package/mablscript/steps/EnterTextStep.js +1 -2
- package/mablscript/steps/EvaluateFlowStep.js +1 -1
- package/mablscript/steps/IfConditionStep.js +4 -6
- package/mablscript/steps/ReleaseStep.js +1 -2
- package/mablscript/steps/SendHttpRequestStep.js +2 -4
- package/mablscript/steps/SendKeyStep.js +1 -1
- package/mablscript/steps/SetCookieStep.js +35 -20
- package/mablscript/steps/SetViewportStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +3 -6
- package/mablscript/steps/SyntheticStep.js +1 -2
- package/mablscriptFind/index.js +1 -1
- package/middleware.js +1 -2
- package/package.json +2 -2
- package/popupDismissal/index.js +4 -5
- package/providers/authenticationProvider.js +5 -6
- package/providers/cliConfigProvider.js +10 -12
- package/providers/exportRequestProvider.js +3 -5
- package/providers/logging/loggingProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +12 -14
- package/resources/mablFind.js +1 -1
- package/util/actionabilityUtil.js +1 -1
- package/util/analytics.js +6 -9
- package/util/browserTestUtils.js +1 -2
- package/util/markdownUtil.js +9 -11
|
@@ -49,8 +49,8 @@ const EXPECT_FUNCTIONS = {
|
|
|
49
49
|
NotPresent: 'be.undefined',
|
|
50
50
|
};
|
|
51
51
|
function compareStringsCaseInsensitive(a, b) {
|
|
52
|
-
a = a
|
|
53
|
-
b = b
|
|
52
|
+
a = a?.toLowerCase();
|
|
53
|
+
b = b?.toLowerCase();
|
|
54
54
|
if (!a) {
|
|
55
55
|
return -1;
|
|
56
56
|
}
|
|
@@ -109,10 +109,9 @@ function createEmptyVariable() {
|
|
|
109
109
|
}
|
|
110
110
|
exports.createEmptyVariable = createEmptyVariable;
|
|
111
111
|
function deduplicateApiTestExecutionResults(postmanResult) {
|
|
112
|
-
var _a;
|
|
113
112
|
const executionsById = {};
|
|
114
113
|
const orderedExecutionIds = [];
|
|
115
|
-
|
|
114
|
+
postmanResult.run.executions?.forEach((execution) => {
|
|
116
115
|
const executionId = execution.id;
|
|
117
116
|
if (!executionsById[executionId]) {
|
|
118
117
|
orderedExecutionIds.push(executionId);
|
|
@@ -129,10 +128,9 @@ function restoreCustomRequestFields(postmanResult, collection) {
|
|
|
129
128
|
return collectionSet;
|
|
130
129
|
}, {});
|
|
131
130
|
postmanResult.run.executions.forEach((execution) => {
|
|
132
|
-
var _a;
|
|
133
131
|
const requestItemDefinition = requestItemsById[execution.id];
|
|
134
|
-
if (
|
|
135
|
-
|
|
132
|
+
if (execution.request.body?.mode === 'formdata' &&
|
|
133
|
+
requestItemDefinition?.request) {
|
|
136
134
|
restoreFormDataFileMetadata(execution.request, requestItemDefinition.request);
|
|
137
135
|
}
|
|
138
136
|
});
|
|
@@ -140,15 +138,14 @@ function restoreCustomRequestFields(postmanResult, collection) {
|
|
|
140
138
|
}
|
|
141
139
|
exports.restoreCustomRequestFields = restoreCustomRequestFields;
|
|
142
140
|
function restoreFormDataFileMetadata(resultRequest, collectionRequest) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
const requestFormDataBySrc = (_c = (_b = collectionRequest === null || collectionRequest === void 0 ? void 0 : collectionRequest.body) === null || _b === void 0 ? void 0 : _b.formdata) === null || _c === void 0 ? void 0 : _c.reduce((set, formData) => {
|
|
141
|
+
if (resultRequest.body?.formdata) {
|
|
142
|
+
const requestFormDataBySrc = collectionRequest?.body?.formdata?.reduce((set, formData) => {
|
|
146
143
|
if (formData.src) {
|
|
147
144
|
set[formData.src] = formData;
|
|
148
145
|
}
|
|
149
146
|
return set;
|
|
150
147
|
}, {});
|
|
151
|
-
if (!Array.isArray(
|
|
148
|
+
if (!Array.isArray(resultRequest.body?.formdata)) {
|
|
152
149
|
resultRequest.body.formdata = resultRequest.body.formdata
|
|
153
150
|
.all()
|
|
154
151
|
.map((formParam) => formParam);
|
|
@@ -158,7 +155,7 @@ function restoreFormDataFileMetadata(resultRequest, collectionRequest) {
|
|
|
158
155
|
resultFormParam.src &&
|
|
159
156
|
!resultFormParam.mablFile) {
|
|
160
157
|
resultFormParam.mablFile =
|
|
161
|
-
|
|
158
|
+
requestFormDataBySrc[resultFormParam.src]?.mablFile;
|
|
162
159
|
}
|
|
163
160
|
}
|
|
164
161
|
}
|
|
@@ -167,7 +164,7 @@ function findFirstMatchingEvent(eventDefinition, listen) {
|
|
|
167
164
|
const eventIndex = lodash_1.default.findIndex(eventDefinition, { listen });
|
|
168
165
|
let eventValue;
|
|
169
166
|
if (eventIndex !== -1) {
|
|
170
|
-
eventValue = eventDefinition
|
|
167
|
+
eventValue = eventDefinition?.[eventIndex];
|
|
171
168
|
}
|
|
172
169
|
return { eventIndex, eventValue };
|
|
173
170
|
}
|
|
@@ -200,8 +197,7 @@ function removeMablGeneratedScriptsFromLines(lines) {
|
|
|
200
197
|
return lines;
|
|
201
198
|
}
|
|
202
199
|
function removeMablGeneratedScripts(eventDefinition) {
|
|
203
|
-
|
|
204
|
-
lodash_1.default.set(eventDefinition, 'script.exec', removeMablGeneratedScriptsFromLines((_b = (_a = eventDefinition.script) === null || _a === void 0 ? void 0 : _a.exec) !== null && _b !== void 0 ? _b : []));
|
|
200
|
+
lodash_1.default.set(eventDefinition, 'script.exec', removeMablGeneratedScriptsFromLines(eventDefinition.script?.exec ?? []));
|
|
205
201
|
}
|
|
206
202
|
exports.removeMablGeneratedScripts = removeMablGeneratedScripts;
|
|
207
203
|
function isValidMablVariableAssignment(variable) {
|
|
@@ -209,11 +205,11 @@ function isValidMablVariableAssignment(variable) {
|
|
|
209
205
|
}
|
|
210
206
|
exports.isValidMablVariableAssignment = isValidMablVariableAssignment;
|
|
211
207
|
function filterValidMablVariableAssignments(variables) {
|
|
212
|
-
return variables
|
|
208
|
+
return variables?.filter(isValidMablVariableAssignment);
|
|
213
209
|
}
|
|
214
210
|
exports.filterValidMablVariableAssignments = filterValidMablVariableAssignments;
|
|
215
211
|
function filterValidMablAssertions(assertions) {
|
|
216
|
-
return assertions
|
|
212
|
+
return assertions?.filter(isValidMablAssertion);
|
|
217
213
|
}
|
|
218
214
|
exports.filterValidMablAssertions = filterValidMablAssertions;
|
|
219
215
|
function assertionRequiresValue(assertion) {
|
|
@@ -242,29 +238,28 @@ function normalizeExpectedValue(value) {
|
|
|
242
238
|
}
|
|
243
239
|
exports.normalizeExpectedValue = normalizeExpectedValue;
|
|
244
240
|
function isValidMablAssertion(assertion) {
|
|
245
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
246
241
|
if (!assertion.assertType) {
|
|
247
242
|
return false;
|
|
248
243
|
}
|
|
249
244
|
const assertTarget = assertion.assertTarget;
|
|
250
245
|
const requiresValue = assertionRequiresValue(assertion);
|
|
251
246
|
const expectedValue = normalizeExpectedValue(assertion.value);
|
|
252
|
-
const hasRequiredValue = !requiresValue || (
|
|
247
|
+
const hasRequiredValue = !requiresValue || (expectedValue?.length ?? 0) > 0;
|
|
253
248
|
let valid = false;
|
|
254
249
|
switch (assertTarget) {
|
|
255
250
|
case 'JSONBody':
|
|
256
|
-
const hasBodyPath = (
|
|
251
|
+
const hasBodyPath = (assertion.bodyPath?.trim()?.length ?? 0) > 0;
|
|
257
252
|
valid = hasBodyPath && hasRequiredValue;
|
|
258
253
|
break;
|
|
259
254
|
case 'Status':
|
|
260
|
-
valid = (
|
|
255
|
+
valid = (expectedValue?.length ?? 0) > 0;
|
|
261
256
|
break;
|
|
262
257
|
case 'Header':
|
|
263
|
-
const hasHeaderName = (
|
|
258
|
+
const hasHeaderName = (assertion.headerName?.length ?? 0) > 0;
|
|
264
259
|
valid = hasHeaderName && hasRequiredValue;
|
|
265
260
|
break;
|
|
266
261
|
case 'Size':
|
|
267
|
-
valid = (
|
|
262
|
+
valid = (expectedValue?.length ?? 0) > 0;
|
|
268
263
|
break;
|
|
269
264
|
}
|
|
270
265
|
return valid;
|
|
@@ -346,7 +341,7 @@ function generateVariableAssignmentScript(variable) {
|
|
|
346
341
|
}
|
|
347
342
|
}
|
|
348
343
|
function generateJsonBodyAssertion(description, assertType, requiresValues, path, expectedValue) {
|
|
349
|
-
if (!
|
|
344
|
+
if (!path?.trim().length || (requiresValues && !expectedValue?.length)) {
|
|
350
345
|
return;
|
|
351
346
|
}
|
|
352
347
|
let propertyAccessor = getJsonBodyProperty(path);
|
|
@@ -379,7 +374,7 @@ function generateGetHeaderValue(headerName) {
|
|
|
379
374
|
return `pm.response.headers.get(${JSON.stringify(headerName)})`;
|
|
380
375
|
}
|
|
381
376
|
function generateStatusAssertion(description, assertType, expectedValue) {
|
|
382
|
-
if (!
|
|
377
|
+
if (!expectedValue?.length) {
|
|
383
378
|
return;
|
|
384
379
|
}
|
|
385
380
|
let expect;
|
|
@@ -402,7 +397,7 @@ function generateStatusAssertion(description, assertType, expectedValue) {
|
|
|
402
397
|
default:
|
|
403
398
|
throw new Error(`Unexpected status assert type: ${assertType}`);
|
|
404
399
|
}
|
|
405
|
-
return generatePostmanTest(description, test
|
|
400
|
+
return generatePostmanTest(description, test ?? `pm.response.${expect}(parseInt(${expectedValue}))`);
|
|
406
401
|
}
|
|
407
402
|
function generateHeaderAssertion(description, assertType, headerName, expectedValue) {
|
|
408
403
|
if (!headerName) {
|
|
@@ -429,10 +424,11 @@ function generateHeaderAssertion(description, assertType, headerName, expectedVa
|
|
|
429
424
|
default:
|
|
430
425
|
throw new Error(`Unexpected header assert type: ${assertType}`);
|
|
431
426
|
}
|
|
432
|
-
return generatePostmanTest(description, test
|
|
427
|
+
return generatePostmanTest(description, test ??
|
|
428
|
+
`pm.expect(pm.response.headers.get(${normalizedHeaderName})).to.${expect}(${expectedValue})`);
|
|
433
429
|
}
|
|
434
430
|
function generateSizeAssertion(description, target, type, expectedValue) {
|
|
435
|
-
if (!
|
|
431
|
+
if (!expectedValue?.length) {
|
|
436
432
|
return;
|
|
437
433
|
}
|
|
438
434
|
return generateSimpleAssertion(description, target, type, `parseInt(${expectedValue})`);
|
|
@@ -462,14 +458,12 @@ function valueToUnquotedString(value) {
|
|
|
462
458
|
}
|
|
463
459
|
exports.valueToUnquotedString = valueToUnquotedString;
|
|
464
460
|
function getResponseContentType(response) {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
return contentType === null || contentType === void 0 ? void 0 : contentType.toLowerCase();
|
|
461
|
+
const contentType = response?.header?.find((header) => header.key.toLowerCase() === 'content-type')?.value;
|
|
462
|
+
return contentType?.toLowerCase();
|
|
468
463
|
}
|
|
469
464
|
exports.getResponseContentType = getResponseContentType;
|
|
470
465
|
function readBody(body, contentType) {
|
|
471
|
-
|
|
472
|
-
const bodyLength = (_a = body === null || body === void 0 ? void 0 : body.data) === null || _a === void 0 ? void 0 : _a.length;
|
|
466
|
+
const bodyLength = body?.data?.length;
|
|
473
467
|
if (!body || !bodyLength) {
|
|
474
468
|
return;
|
|
475
469
|
}
|
|
@@ -505,32 +499,30 @@ function readBody(body, contentType) {
|
|
|
505
499
|
}
|
|
506
500
|
exports.readBody = readBody;
|
|
507
501
|
function getActualValue(assertion, apiStepExecutionResult, variables) {
|
|
508
|
-
var _a, _b, _c, _d;
|
|
509
502
|
const { assertTarget, bodyPath, headerName } = assertion;
|
|
510
503
|
switch (assertTarget) {
|
|
511
504
|
case newman_types_1.AssertionTarget.Header:
|
|
512
|
-
return lodash_1.default.find(
|
|
505
|
+
return lodash_1.default.find(apiStepExecutionResult.response?.header, (header) => caseInsensitiveEquals(header.key, headerName));
|
|
513
506
|
case newman_types_1.AssertionTarget.JSONBody:
|
|
514
507
|
const contentType = getResponseContentType(apiStepExecutionResult.response);
|
|
515
|
-
const content = readBody(
|
|
508
|
+
const content = readBody(apiStepExecutionResult.response?.stream, contentType);
|
|
516
509
|
return bodyPath
|
|
517
510
|
? lodash_1.default.get(content, replaceVariables(bodyPath, variables))
|
|
518
511
|
: content;
|
|
519
512
|
case newman_types_1.AssertionTarget.Size:
|
|
520
|
-
return
|
|
513
|
+
return apiStepExecutionResult.response?.responseSize;
|
|
521
514
|
case newman_types_1.AssertionTarget.Status:
|
|
522
|
-
return
|
|
515
|
+
return apiStepExecutionResult.response?.code;
|
|
523
516
|
}
|
|
524
517
|
return null;
|
|
525
518
|
}
|
|
526
519
|
exports.getActualValue = getActualValue;
|
|
527
520
|
function replaceVariables(value, variables) {
|
|
528
|
-
var _a, _b;
|
|
529
521
|
let toReplace = value;
|
|
530
522
|
let matches;
|
|
531
523
|
while ((matches = toReplace.match(new RegExp('{{@(?<name>[^{}]+)}}')))) {
|
|
532
|
-
const variableName =
|
|
533
|
-
const variableValue = (
|
|
524
|
+
const variableName = matches.groups?.name;
|
|
525
|
+
const variableValue = (variableName && variables[variableName]) ?? '';
|
|
534
526
|
toReplace = toReplace.replace(new RegExp(`{{@${variableName}}}`, 'g'), variableValue);
|
|
535
527
|
}
|
|
536
528
|
return toReplace;
|
|
@@ -546,25 +538,28 @@ function toPostmanScript(assertion) {
|
|
|
546
538
|
}
|
|
547
539
|
exports.toPostmanScript = toPostmanScript;
|
|
548
540
|
function insertMablAssertionScripts(item) {
|
|
549
|
-
var _a, _b, _c, _d, _e, _f;
|
|
550
541
|
const { eventValue: existingEventValue } = findFirstMatchingEvent(item.event, exports.TEST_LISTEN);
|
|
551
|
-
const eventValue = existingEventValue
|
|
542
|
+
const eventValue = existingEventValue ?? createEmptyRequestEvent();
|
|
552
543
|
if (!existingEventValue) {
|
|
553
|
-
|
|
544
|
+
item.event?.push(eventValue);
|
|
554
545
|
}
|
|
555
546
|
removeMablGeneratedScripts(eventValue);
|
|
556
547
|
eventValue.mablVariables = filterValidMablVariableAssignments(eventValue.mablVariables);
|
|
557
548
|
eventValue.mablAssertions = filterValidMablAssertions(eventValue.mablAssertions);
|
|
558
|
-
const mablVariables =
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
549
|
+
const mablVariables = eventValue.mablVariables
|
|
550
|
+
?.map((variable) => toPostmanScript(variable))
|
|
551
|
+
.flat();
|
|
552
|
+
const mablAssertions = eventValue.mablAssertions
|
|
553
|
+
?.map((assertion) => toPostmanScript(assertion))
|
|
554
|
+
.flat();
|
|
555
|
+
if (mablAssertions?.length || mablVariables?.length) {
|
|
556
|
+
eventValue.script.exec?.push(`// ${exports.MABL_GENERATED_ASSERTION_TOKEN} Do not edit below this line`);
|
|
562
557
|
}
|
|
563
|
-
if (mablVariables
|
|
564
|
-
|
|
558
|
+
if (mablVariables?.length) {
|
|
559
|
+
eventValue.script.exec?.push(...mablVariables);
|
|
565
560
|
}
|
|
566
|
-
if (mablAssertions
|
|
567
|
-
|
|
561
|
+
if (mablAssertions?.length) {
|
|
562
|
+
eventValue.script.exec?.push(...mablAssertions);
|
|
568
563
|
}
|
|
569
564
|
}
|
|
570
565
|
exports.insertMablAssertionScripts = insertMablAssertionScripts;
|
|
@@ -649,42 +644,39 @@ function isXML(contentType) {
|
|
|
649
644
|
}
|
|
650
645
|
exports.isXML = isXML;
|
|
651
646
|
function isText(contentType) {
|
|
652
|
-
return !!contentType &&
|
|
647
|
+
return !!contentType && contentType?.startsWith('text/');
|
|
653
648
|
}
|
|
654
649
|
exports.isText = isText;
|
|
655
650
|
function getFormDataArray(item) {
|
|
656
|
-
var _a, _b, _c;
|
|
657
651
|
if (getRequestMode(item) === 'formdata') {
|
|
658
|
-
const formdata =
|
|
652
|
+
const formdata = item?.request?.body?.formdata;
|
|
659
653
|
if (Array.isArray(formdata)) {
|
|
660
654
|
return formdata;
|
|
661
655
|
}
|
|
662
|
-
return
|
|
656
|
+
return formdata?.all() ?? [];
|
|
663
657
|
}
|
|
664
658
|
return [];
|
|
665
659
|
}
|
|
666
660
|
exports.getFormDataArray = getFormDataArray;
|
|
667
661
|
function getRequestMode(item) {
|
|
668
|
-
|
|
669
|
-
return (_b = (_a = item === null || item === void 0 ? void 0 : item.request) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.mode;
|
|
662
|
+
return item?.request?.body?.mode;
|
|
670
663
|
}
|
|
671
664
|
exports.getRequestMode = getRequestMode;
|
|
672
665
|
function formatContent(contentContainer) {
|
|
673
|
-
if (contentContainer
|
|
666
|
+
if (contentContainer?.hasOwnProperty('content')) {
|
|
674
667
|
return contentContainer.content;
|
|
675
668
|
}
|
|
676
669
|
return contentContainer;
|
|
677
670
|
}
|
|
678
671
|
exports.formatContent = formatContent;
|
|
679
672
|
function processMablProtocolProfileBehavior(item) {
|
|
680
|
-
|
|
681
|
-
const mablProtocolProfileBehavior = (_b = (_a = item.mablTemporaryStorage) === null || _a === void 0 ? void 0 : _a.mablProtocolProfileBehavior) !== null && _b !== void 0 ? _b : [];
|
|
673
|
+
const mablProtocolProfileBehavior = item.mablTemporaryStorage?.mablProtocolProfileBehavior ?? [];
|
|
682
674
|
if (mablProtocolProfileBehavior.length === 0) {
|
|
683
675
|
delete item.protocolProfileBehavior;
|
|
684
676
|
return;
|
|
685
677
|
}
|
|
686
678
|
lodash_1.default.set(item, 'protocolProfileBehavior', {});
|
|
687
|
-
mablProtocolProfileBehavior
|
|
679
|
+
mablProtocolProfileBehavior?.forEach((setting) => {
|
|
688
680
|
if (setting.key && setting.value) {
|
|
689
681
|
let valueToSet;
|
|
690
682
|
try {
|
|
@@ -701,7 +693,7 @@ function createOptionalVariable(key, type, value, defaultValue) {
|
|
|
701
693
|
if (value === undefined && defaultValue === undefined) {
|
|
702
694
|
return;
|
|
703
695
|
}
|
|
704
|
-
let parsedValue = value
|
|
696
|
+
let parsedValue = value ?? defaultValue;
|
|
705
697
|
if (type === 'boolean') {
|
|
706
698
|
parsedValue = parsedValue === 'true';
|
|
707
699
|
}
|
|
@@ -724,17 +716,17 @@ function mablAuthToPostman(mablAuth, undefinedType) {
|
|
|
724
716
|
apikey: [
|
|
725
717
|
{
|
|
726
718
|
key: 'key',
|
|
727
|
-
value: apikey
|
|
719
|
+
value: apikey?.key,
|
|
728
720
|
type: 'string',
|
|
729
721
|
},
|
|
730
722
|
{
|
|
731
723
|
key: 'value',
|
|
732
|
-
value: apikey
|
|
724
|
+
value: apikey?.value,
|
|
733
725
|
type: 'string',
|
|
734
726
|
},
|
|
735
727
|
{
|
|
736
728
|
key: 'in',
|
|
737
|
-
value: apikey
|
|
729
|
+
value: apikey?.in,
|
|
738
730
|
type: 'string',
|
|
739
731
|
},
|
|
740
732
|
],
|
|
@@ -746,12 +738,12 @@ function mablAuthToPostman(mablAuth, undefinedType) {
|
|
|
746
738
|
basic: [
|
|
747
739
|
{
|
|
748
740
|
key: 'username',
|
|
749
|
-
value: basic
|
|
741
|
+
value: basic?.username,
|
|
750
742
|
type: 'string',
|
|
751
743
|
},
|
|
752
744
|
{
|
|
753
745
|
key: 'password',
|
|
754
|
-
value: basic
|
|
746
|
+
value: basic?.password,
|
|
755
747
|
type: 'string',
|
|
756
748
|
},
|
|
757
749
|
],
|
|
@@ -763,7 +755,7 @@ function mablAuthToPostman(mablAuth, undefinedType) {
|
|
|
763
755
|
bearer: [
|
|
764
756
|
{
|
|
765
757
|
key: 'token',
|
|
766
|
-
value: bearer
|
|
758
|
+
value: bearer?.token,
|
|
767
759
|
type: 'string',
|
|
768
760
|
},
|
|
769
761
|
],
|
|
@@ -773,20 +765,20 @@ function mablAuthToPostman(mablAuth, undefinedType) {
|
|
|
773
765
|
auth = {
|
|
774
766
|
type,
|
|
775
767
|
oauth1: [
|
|
776
|
-
createOptionalVariable('addParamsToHeader', 'boolean', oauth1
|
|
777
|
-
createOptionalVariable('addEmptyParamsToSign', 'boolean', oauth1
|
|
778
|
-
createOptionalVariable('callback', 'string', oauth1
|
|
779
|
-
createOptionalVariable('consumerKey', 'string', oauth1
|
|
780
|
-
createOptionalVariable('consumerSecret', 'string', oauth1
|
|
781
|
-
createOptionalVariable('includeBodyHash', 'boolean', oauth1
|
|
782
|
-
createOptionalVariable('nonce', 'string', oauth1
|
|
783
|
-
createOptionalVariable('realm', 'string', oauth1
|
|
784
|
-
createOptionalVariable('signatureMethod', 'string', oauth1
|
|
785
|
-
createOptionalVariable('timestamp', 'string', oauth1
|
|
786
|
-
createOptionalVariable('token', 'string', oauth1
|
|
787
|
-
createOptionalVariable('tokenSecret', 'string', oauth1
|
|
788
|
-
createOptionalVariable('verifier', 'string', oauth1
|
|
789
|
-
createOptionalVariable('version', 'string', oauth1
|
|
768
|
+
createOptionalVariable('addParamsToHeader', 'boolean', oauth1?.addParamsToHeader, exports.DEFAULT_ADD_OAUTH1_TO_HEADER_VALUE),
|
|
769
|
+
createOptionalVariable('addEmptyParamsToSign', 'boolean', oauth1?.addEmptyParamsToSign),
|
|
770
|
+
createOptionalVariable('callback', 'string', oauth1?.callback),
|
|
771
|
+
createOptionalVariable('consumerKey', 'string', oauth1?.consumerKey),
|
|
772
|
+
createOptionalVariable('consumerSecret', 'string', oauth1?.consumerSecret),
|
|
773
|
+
createOptionalVariable('includeBodyHash', 'boolean', oauth1?.includeBodyHash),
|
|
774
|
+
createOptionalVariable('nonce', 'string', oauth1?.nonce),
|
|
775
|
+
createOptionalVariable('realm', 'string', oauth1?.realm),
|
|
776
|
+
createOptionalVariable('signatureMethod', 'string', oauth1?.signatureMethod, exports.HMAC_SHA1_SIGNATURE),
|
|
777
|
+
createOptionalVariable('timestamp', 'string', oauth1?.timestamp),
|
|
778
|
+
createOptionalVariable('token', 'string', oauth1?.token),
|
|
779
|
+
createOptionalVariable('tokenSecret', 'string', oauth1?.tokenSecret),
|
|
780
|
+
createOptionalVariable('verifier', 'string', oauth1?.verifier),
|
|
781
|
+
createOptionalVariable('version', 'string', oauth1?.version, exports.DEFAULT_OAUTH1_VERSION),
|
|
790
782
|
].filter((variable) => variable),
|
|
791
783
|
};
|
|
792
784
|
}
|
|
@@ -795,29 +787,25 @@ function mablAuthToPostman(mablAuth, undefinedType) {
|
|
|
795
787
|
}
|
|
796
788
|
exports.mablAuthToPostman = mablAuthToPostman;
|
|
797
789
|
function processItemAuth(item) {
|
|
798
|
-
|
|
799
|
-
const itemAuth = mablAuthToPostman((_a = item.mablTemporaryStorage) === null || _a === void 0 ? void 0 : _a.mablAuth, exports.INHERIT_AUTH_FROM_PARENT_VALUE);
|
|
790
|
+
const itemAuth = mablAuthToPostman(item.mablTemporaryStorage?.mablAuth, exports.INHERIT_AUTH_FROM_PARENT_VALUE);
|
|
800
791
|
if (itemAuth) {
|
|
801
792
|
lodash_1.default.set(item, 'request.auth', itemAuth);
|
|
802
793
|
}
|
|
803
|
-
else if (
|
|
794
|
+
else if (item.request?.auth) {
|
|
804
795
|
item.request.auth = {};
|
|
805
796
|
}
|
|
806
797
|
}
|
|
807
798
|
exports.processItemAuth = processItemAuth;
|
|
808
799
|
function removeInvalidHeaders(item) {
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
item.request.header = item.request.header.filter((header) => { var _a, _b; return (_b = (_a = header.key) === null || _a === void 0 ? void 0 : _a.trim()) === null || _b === void 0 ? void 0 : _b.length; });
|
|
800
|
+
if (item.request?.header) {
|
|
801
|
+
item.request.header = item.request.header.filter((header) => header.key?.trim()?.length);
|
|
812
802
|
}
|
|
813
803
|
}
|
|
814
804
|
exports.removeInvalidHeaders = removeInvalidHeaders;
|
|
815
805
|
function replaceRawScriptWithExecArray(eventsContainer) {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
if (((_a = event.script) === null || _a === void 0 ? void 0 : _a.raw) !== undefined) {
|
|
820
|
-
if (((_c = (_b = event.script) === null || _b === void 0 ? void 0 : _b.raw) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
806
|
+
eventsContainer.event?.forEach((event) => {
|
|
807
|
+
if (event.script?.raw !== undefined) {
|
|
808
|
+
if (event.script?.raw?.length > 0) {
|
|
821
809
|
event.script.exec = splitLines(event.script.raw);
|
|
822
810
|
}
|
|
823
811
|
delete event.script.raw;
|