@mablhq/mabl-cli 1.41.4 → 1.43.1
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 +19 -4
- package/commands/tests/tests_cmds/create.js +1 -1
- package/core/execution/ApiTestUtils.js +41 -1
- package/core/trainer/openUtils.js +2 -2
- package/core/trainer/trainingSessions-types.js +35 -0
- package/core/trainer/trainingSessions.js +52 -34
- package/domUtil/index.js +1 -1
- package/execution/index.js +1 -1
- package/http/MablHttpAgent.js +73 -0
- package/http/RequestFilteringHttpAgent.js +119 -0
- package/http/RequestSecurityError.js +9 -0
- package/{util/httpUtil.js → http/axiosProxyConfig.js} +3 -6
- package/http/httpUtil.js +54 -0
- package/http/requestInterceptor.js +187 -0
- package/mablscript/steps/SyntheticStep.js +1 -1
- package/mablscriptFind/index.js +1 -1
- package/observers/mockObserver.js +3 -0
- package/package.json +3 -3
- package/providers/authenticationProvider.js +2 -2
- package/providers/cliConfigProvider.js +1 -1
- package/providers/exportRequestProvider.js +8 -14
- package/resources/mablFind.js +1 -1
- package/util/encodingUtil.js +37 -0
- package/util/fileUploadUtil.js +2 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.decodeTestConfigAsParamsForParsedUrlProtocol = exports.encodeTestConfigAsParamsForParsedUrlProtocol = exports.b64EncodeUnicodeInNode = exports.b64DecodeUnicodeInNode = exports.TEST_CONFIG_URL_PARAM_KEY = void 0;
|
|
7
|
+
const querystring_1 = __importDefault(require("querystring"));
|
|
8
|
+
const MAX_PARSED_URL_PROTOCOL_PARAMS_LENGTH = 2000;
|
|
9
|
+
exports.TEST_CONFIG_URL_PARAM_KEY = 'scriptConfig';
|
|
10
|
+
function b64DecodeUnicodeInNode(encoded) {
|
|
11
|
+
return Buffer.from(encoded, 'base64').toString();
|
|
12
|
+
}
|
|
13
|
+
exports.b64DecodeUnicodeInNode = b64DecodeUnicodeInNode;
|
|
14
|
+
function b64EncodeUnicodeInNode(text) {
|
|
15
|
+
return Buffer.from(text).toString('base64');
|
|
16
|
+
}
|
|
17
|
+
exports.b64EncodeUnicodeInNode = b64EncodeUnicodeInNode;
|
|
18
|
+
function encodeTestConfigAsParamsForParsedUrlProtocol(testConfig, b64Encode) {
|
|
19
|
+
const encoded = querystring_1.default.stringify({
|
|
20
|
+
...testConfig,
|
|
21
|
+
[exports.TEST_CONFIG_URL_PARAM_KEY]: b64Encode(JSON.stringify(testConfig)),
|
|
22
|
+
});
|
|
23
|
+
if (encoded.length > MAX_PARSED_URL_PROTOCOL_PARAMS_LENGTH) {
|
|
24
|
+
throw new Error('Test parameters exceed size limit. Please use the mabl Desktop App to create or edit tests.');
|
|
25
|
+
}
|
|
26
|
+
return encoded;
|
|
27
|
+
}
|
|
28
|
+
exports.encodeTestConfigAsParamsForParsedUrlProtocol = encodeTestConfigAsParamsForParsedUrlProtocol;
|
|
29
|
+
function decodeTestConfigAsParamsForParsedUrlProtocol(encoded, b64Decode, useV2) {
|
|
30
|
+
const params = querystring_1.default.parse(encoded);
|
|
31
|
+
if (useV2 && params[exports.TEST_CONFIG_URL_PARAM_KEY]) {
|
|
32
|
+
return JSON.parse(b64Decode(params[exports.TEST_CONFIG_URL_PARAM_KEY]));
|
|
33
|
+
}
|
|
34
|
+
delete params[exports.TEST_CONFIG_URL_PARAM_KEY];
|
|
35
|
+
return params;
|
|
36
|
+
}
|
|
37
|
+
exports.decodeTestConfigAsParamsForParsedUrlProtocol = decodeTestConfigAsParamsForParsedUrlProtocol;
|
package/util/fileUploadUtil.js
CHANGED
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.removeUploadDirs = exports.cleanupOldFiles = exports.downloadFileUpload = void 0;
|
|
30
30
|
const axios_1 = __importDefault(require("axios"));
|
|
31
|
-
const
|
|
31
|
+
const axiosProxyConfig_1 = require("../http/axiosProxyConfig");
|
|
32
32
|
const path_1 = __importDefault(require("path"));
|
|
33
33
|
const fs = __importStar(require("fs-extra"));
|
|
34
34
|
const stream_1 = require("stream");
|
|
@@ -42,7 +42,7 @@ async function downloadFileUpload(fileUploadUrl, fileUpload, downloadDirectory,
|
|
|
42
42
|
client = mablApiClient.httpClient;
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
client = axios_1.default.create(await (0,
|
|
45
|
+
client = axios_1.default.create(await (0, axiosProxyConfig_1.currentProxyConfig)());
|
|
46
46
|
}
|
|
47
47
|
try {
|
|
48
48
|
const finalDirectory = path_1.default.normalize(`${downloadDirectory}/${fileUpload.id}`);
|