@mablhq/mabl-cli 2.5.4 → 2.8.18
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 +14 -0
- package/api/types.js +1 -0
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +11 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +6 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +3 -0
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +1 -1
- package/cli.js +1 -1
- package/commands/commandUtil/codeInsights.js +7 -1
- package/domUtil/index.js +1 -1
- package/execution/index.js +9 -9
- package/http/axiosProxyConfig.js +2 -25
- package/index.d.ts +1 -0
- package/mablApi/index.js +1 -1
- package/mablscript/importer.js +2 -0
- package/mablscript/mobile/steps/PushFileStep.js +27 -0
- package/mablscript/mobile/tests/steps/PushFileStep.mobiletest.js +55 -0
- package/mablscript/steps/CreateVariableStep.js +23 -0
- package/mablscript/types/CreateVariableStepDescriptor.js +1 -0
- package/mablscript/types/mobile/PushFileDescriptor.js +2 -0
- package/mablscriptFind/index.js +1 -1
- package/mobile/index.js +2 -0
- package/mobile/types.js +2 -0
- package/package.json +6 -4
- package/proxy/index.js +2 -2
- package/resources/mablFind.js +1 -1
- package/upload/index.js +2 -5
- package/upload/index.js.LICENSE.txt +27 -0
- package/util/asyncUtil.js +9 -7
- package/util/fileUploadUtil.js +33 -1
- package/util/logUtils.js +14 -8
- package/util/pureUtil.js +9 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* mime-db
|
|
3
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
4
|
+
* MIT Licensed
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/*!
|
|
8
|
+
* mime-types
|
|
9
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
10
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
11
|
+
* MIT Licensed
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/*! *****************************************************************************
|
|
15
|
+
Copyright (c) Microsoft Corporation.
|
|
16
|
+
|
|
17
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
18
|
+
purpose with or without fee is hereby granted.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
21
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
22
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
23
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
24
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
25
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
26
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
27
|
+
***************************************************************************** */
|
package/util/asyncUtil.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterAsync = exports.
|
|
3
|
+
exports.filterAsync = exports.TimeoutError = exports.promiseWithTimeout = void 0;
|
|
4
4
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
5
|
+
const pureUtil_1 = require("./pureUtil");
|
|
6
|
+
const logUtils_1 = require("./logUtils");
|
|
5
7
|
async function promiseWithTimeout(promise, timeoutMillis, description, timeoutType = 'mabl timeout', printToConsole = true) {
|
|
6
8
|
const startTimeMillis = new Date().getTime();
|
|
7
9
|
const { timer, cancelTimer, errorMessage } = startTimer(timeoutMillis, description, timeoutType);
|
|
@@ -48,12 +50,12 @@ const startTimer = (timeoutMillis, description, timeoutType) => {
|
|
|
48
50
|
errorMessage: timeoutError.message,
|
|
49
51
|
};
|
|
50
52
|
};
|
|
51
|
-
function mapAsync(array, callback) {
|
|
52
|
-
return Promise.all(array.map(callback));
|
|
53
|
-
}
|
|
54
|
-
exports.mapAsync = mapAsync;
|
|
55
53
|
async function filterAsync(array, callback) {
|
|
56
|
-
const
|
|
57
|
-
|
|
54
|
+
const results = await Promise.allSettled(array.map(callback));
|
|
55
|
+
(0, logUtils_1.logPromiseSettledRejections)(results);
|
|
56
|
+
return array.filter((_, index) => {
|
|
57
|
+
const result = results[index];
|
|
58
|
+
return (0, pureUtil_1.isFulfilledPromise)(result) && result.value;
|
|
59
|
+
});
|
|
58
60
|
}
|
|
59
61
|
exports.filterAsync = filterAsync;
|
package/util/fileUploadUtil.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.removeUploadDirs = exports.cleanupOldFiles = exports.downloadFileUpload = void 0;
|
|
29
|
+
exports.downloadFileUploadsAndSetReferenceInContext = exports.downloadAllFileUploadsAndSetContext = exports.createTempDirectoryForFileUploads = exports.createFileUploadDirectoryName = exports.removeUploadDirs = exports.cleanupOldFiles = exports.downloadFileUpload = void 0;
|
|
30
30
|
const axios_1 = __importDefault(require("axios"));
|
|
31
31
|
const axiosProxyConfig_1 = require("../http/axiosProxyConfig");
|
|
32
32
|
const path_1 = __importDefault(require("path"));
|
|
@@ -112,3 +112,35 @@ function removeUploadDirs(dirFullPath) {
|
|
|
112
112
|
fs.rmSync(dirFullPath, rmOpts);
|
|
113
113
|
}
|
|
114
114
|
exports.removeUploadDirs = removeUploadDirs;
|
|
115
|
+
function createFileUploadDirectoryName() {
|
|
116
|
+
const dir = Globals_1.Globals.getUploadDirectory();
|
|
117
|
+
const prefix = Globals_1.Globals.getUploadDirectoryPrefix();
|
|
118
|
+
return `${dir}/${prefix}${Date.now()}-`;
|
|
119
|
+
}
|
|
120
|
+
exports.createFileUploadDirectoryName = createFileUploadDirectoryName;
|
|
121
|
+
function createTempDirectoryForFileUploads(fileUploadDirName) {
|
|
122
|
+
return fs.mkdtempSync(fileUploadDirName);
|
|
123
|
+
}
|
|
124
|
+
exports.createTempDirectoryForFileUploads = createTempDirectoryForFileUploads;
|
|
125
|
+
async function downloadAllFileUploadsAndSetContext(apiClient, testContext, uploadDirectory, fileUploadReferences) {
|
|
126
|
+
await Promise.all(fileUploadReferences.map(async (fileRef) => {
|
|
127
|
+
const fileUploadUrl = await apiClient.getFileUploadUrl(fileRef.id);
|
|
128
|
+
const finalPathDownloaded = await downloadFileUpload(fileUploadUrl.redirectUrl, fileRef, uploadDirectory, apiClient);
|
|
129
|
+
testContext.setFileUploadReference(fileRef.id, finalPathDownloaded);
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
exports.downloadAllFileUploadsAndSetContext = downloadAllFileUploadsAndSetContext;
|
|
133
|
+
async function downloadFileUploadsAndSetReferenceInContext(apiClient, testContext, fileUploadReferences) {
|
|
134
|
+
const uploadDirs = testContext.getFileUploadDirs();
|
|
135
|
+
let uploadDirectoryPath;
|
|
136
|
+
if (uploadDirs.size === 0) {
|
|
137
|
+
const dirName = createFileUploadDirectoryName();
|
|
138
|
+
uploadDirectoryPath = createTempDirectoryForFileUploads(dirName);
|
|
139
|
+
testContext.addFileUploadDir(uploadDirectoryPath);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
uploadDirectoryPath = uploadDirs.values().next().value;
|
|
143
|
+
}
|
|
144
|
+
return downloadAllFileUploadsAndSetContext(apiClient, testContext, uploadDirectoryPath, fileUploadReferences);
|
|
145
|
+
}
|
|
146
|
+
exports.downloadFileUploadsAndSetReferenceInContext = downloadFileUploadsAndSetReferenceInContext;
|
package/util/logUtils.js
CHANGED
|
@@ -3,11 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.logPromiseSettledRejections = exports.logErrorVerbose = exports.formatTimestamp = exports.valueToString = exports.logWebUIAndCliOutput = exports.logWebUI = exports.findResultSeverityToLogLevel = exports.logCliOutput = exports.logInternal = void 0;
|
|
6
|
+
exports.getPromiseSettledValues = exports.logPromiseSettledRejections = exports.logErrorVerbose = exports.formatTimestamp = exports.valueToString = exports.logWebUIAndCliOutput = exports.logWebUI = exports.findResultSeverityToLogLevel = exports.logCliOutput = exports.logInternal = void 0;
|
|
7
7
|
const mablscriptFind_1 = require("../mablscriptFind");
|
|
8
8
|
const loggingProvider_1 = require("../providers/logging/loggingProvider");
|
|
9
9
|
const moment_1 = __importDefault(require("moment"));
|
|
10
10
|
const constants_1 = require("../commands/constants");
|
|
11
|
+
const pureUtil_1 = require("./pureUtil");
|
|
11
12
|
function logInternal(logLine, ...meta) {
|
|
12
13
|
loggingProvider_1.logger.debug(logLine, meta);
|
|
13
14
|
}
|
|
@@ -89,13 +90,18 @@ function logErrorVerbose(error, context) {
|
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
exports.logErrorVerbose = logErrorVerbose;
|
|
92
|
-
function logPromiseSettledRejections(promises) {
|
|
93
|
+
function logPromiseSettledRejections(promises, reThrow = false) {
|
|
93
94
|
promises
|
|
94
|
-
.filter(
|
|
95
|
-
.forEach((promise) =>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
95
|
+
.filter(pureUtil_1.isRejectedPromise)
|
|
96
|
+
.forEach((promise) => logErrorVerbose(promise.reason));
|
|
97
|
+
const findRejectedPromise = promises.find(pureUtil_1.isRejectedPromise);
|
|
98
|
+
if (findRejectedPromise && reThrow) {
|
|
99
|
+
throw findRejectedPromise.reason;
|
|
100
|
+
}
|
|
100
101
|
}
|
|
101
102
|
exports.logPromiseSettledRejections = logPromiseSettledRejections;
|
|
103
|
+
function getPromiseSettledValues(promises, reThrow = false) {
|
|
104
|
+
logPromiseSettledRejections(promises, reThrow);
|
|
105
|
+
return promises.filter(pureUtil_1.isFulfilledPromise).map((promise) => promise.value);
|
|
106
|
+
}
|
|
107
|
+
exports.getPromiseSettledValues = getPromiseSettledValues;
|
package/util/pureUtil.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.getCaseInsensitiveProperty = exports.extractKeyCountsFromArgs = exports.getCliName = exports.getCliVersion = exports.stringifyIfPresent = exports.stringify = exports.isWholeNumber = exports.isString = exports.isNullish = exports.isDefined = void 0;
|
|
26
|
+
exports.getCaseInsensitiveProperty = exports.extractKeyCountsFromArgs = exports.getCliName = exports.getCliVersion = exports.stringifyIfPresent = exports.stringify = exports.isRejectedPromise = exports.isFulfilledPromise = exports.isWholeNumber = exports.isString = exports.isNullish = exports.isDefined = void 0;
|
|
27
27
|
const fs = __importStar(require("fs"));
|
|
28
28
|
const path = __importStar(require("path"));
|
|
29
29
|
const possibleCliPackagePaths = Object.freeze([
|
|
@@ -65,6 +65,14 @@ function isWholeNumber(value) {
|
|
|
65
65
|
return parsed - Math.floor(parsed) === 0;
|
|
66
66
|
}
|
|
67
67
|
exports.isWholeNumber = isWholeNumber;
|
|
68
|
+
function isFulfilledPromise(settledPromise) {
|
|
69
|
+
return settledPromise.status === 'fulfilled';
|
|
70
|
+
}
|
|
71
|
+
exports.isFulfilledPromise = isFulfilledPromise;
|
|
72
|
+
function isRejectedPromise(settledPromise) {
|
|
73
|
+
return settledPromise.status === 'rejected';
|
|
74
|
+
}
|
|
75
|
+
exports.isRejectedPromise = isRejectedPromise;
|
|
68
76
|
function stringify(value) {
|
|
69
77
|
if (isNullish(value)) {
|
|
70
78
|
return '';
|