@mablhq/mabl-cli 1.58.25 → 1.58.28
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 +15 -21
- package/api/mablApiClient.js +48 -40
- package/api/mablApiClientFactory.js +1 -1
- package/auth/OktaClient.js +2 -1
- package/browserEngines/chromiumBrowserEngine.js +2 -1
- package/browserEngines/firefoxBrowserEngine.js +2 -2
- package/browserEngines/webkitBrowerEngine.js +2 -2
- package/browserLauncher/browserLauncherFactory.js +3 -2
- package/browserLauncher/elementHandle.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +20 -12
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +10 -7
- package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +4 -3
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +5 -4
- package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractPageDelegate.js +7 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +1 -1
- package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +7 -6
- package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +37 -31
- package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +9 -8
- package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +8 -4
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +5 -3
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +2 -1
- package/browserLauncher/playwrightBrowserLauncher/webkit/webkitFrameDelegate.js +1 -1
- package/browserTestMonitoring/metricsRecorder.js +6 -6
- package/commands/commandUtil/branches.js +3 -2
- package/commands/commandUtil/codeInsights.js +16 -13
- package/commands/commandUtil/fileUtil.js +1 -1
- package/commands/commandUtil/util.js +5 -3
- package/commands/commandUtil/versionUtil.js +5 -4
- package/commands/config/config_cmds/list.js +2 -2
- package/commands/datatables/datatables_cmds/create.js +3 -2
- package/commands/datatables/datatables_cmds/export.js +5 -3
- package/commands/datatables/datatables_cmds/list.js +2 -1
- package/commands/datatables/datatables_cmds/scenarios.js +2 -1
- package/commands/datatables/datatables_cmds/update.js +11 -11
- package/commands/datatables/utils.js +9 -9
- package/commands/deploy/deploy_cmds/awaitDeploymentCompletion.js +8 -6
- package/commands/deploy/deploy_cmds/create.js +13 -11
- package/commands/deploy/deploy_cmds/executionResultPresenter.js +11 -8
- package/commands/deploy/deploy_cmds/list.js +4 -3
- package/commands/deploy/deploy_cmds/watch.js +2 -1
- package/commands/environments/environments_cmds/create.js +2 -1
- package/commands/environments/environments_cmds/delete.js +2 -1
- package/commands/environments/environments_cmds/update.js +2 -1
- package/commands/environments/environments_cmds/urls_cmds/list.js +2 -1
- package/commands/flows/flows_cmds/export.js +2 -1
- package/commands/plans/plans_cmds/describe.js +2 -1
- package/commands/tests/mobileEmulationUtil.js +7 -5
- package/commands/tests/testsUtil.js +42 -40
- package/commands/tests/tests_cmds/export.js +2 -1
- package/commands/tests/tests_cmds/import.js +5 -4
- package/commands/tests/tests_cmds/run-cloud.js +13 -12
- package/commands/tests/tests_cmds/run.js +11 -9
- package/commands/users/users_cmds/list.js +2 -2
- package/commands/workspaces/workspace_cmds/copy.js +2 -1
- package/core/execution/ApiTestUtils.js +94 -82
- package/core/messaging/logLineMessaging.js +3 -2
- package/core/messaging/messaging.js +7 -6
- package/core/trainer/trainingSessions.js +15 -15
- package/coreWebVitals/index.js +18 -14
- package/execution/index.js +1 -1
- package/functions/apiTest/utils.js +5 -4
- package/http/MablHttpAgent.js +6 -4
- package/http/RequestSecurityError.js +1 -1
- package/http/axiosProxyConfig.js +5 -3
- package/http/httpUtil.js +3 -2
- package/http/requestInterceptor.js +15 -11
- package/mablscript/MablAction.js +3 -2
- package/mablscript/MablStep.js +4 -2
- package/mablscript/MablSymbol.js +1 -1
- package/mablscript/actions/ConditionAction.js +4 -2
- package/mablscript/actions/FindAction.js +4 -2
- package/mablscript/diffing/diffingUtil.js +7 -8
- package/mablscript/importer.js +2 -1
- package/mablscript/steps/AccessibilityCheck.js +9 -7
- package/mablscript/steps/AssertStep.js +16 -11
- package/mablscript/steps/ClickAndHoldStep.js +2 -1
- package/mablscript/steps/CreateVariableStep.js +2 -1
- package/mablscript/steps/DownloadStep.js +2 -1
- package/mablscript/steps/EnterTextStep.js +2 -1
- package/mablscript/steps/EvaluateFlowStep.js +1 -1
- package/mablscript/steps/IfConditionStep.js +6 -4
- package/mablscript/steps/ReleaseStep.js +2 -1
- package/mablscript/steps/SendHttpRequestStep.js +4 -2
- package/mablscript/steps/SendKeyStep.js +1 -1
- package/mablscript/steps/SetCookieStep.js +8 -7
- package/mablscript/steps/SetViewportStep.js +1 -1
- package/mablscript/steps/SwitchContextStep.js +6 -3
- package/mablscript/steps/SyntheticStep.js +2 -1
- package/middleware.js +2 -1
- package/package.json +1 -1
- package/popupDismissal/index.js +5 -4
- package/providers/authenticationProvider.js +6 -5
- package/providers/cliConfigProvider.js +12 -10
- package/providers/exportRequestProvider.js +5 -3
- package/providers/logging/loggingProvider.js +1 -1
- package/reporters/mochAwesome/mochAwesomeReporter.js +14 -12
- package/util/TestOutputWriter.js +12 -8
- package/util/actionabilityUtil.js +1 -1
- package/util/analytics.js +9 -6
- package/util/browserTestUtils.js +2 -1
- package/util/markdownUtil.js +11 -9
|
@@ -10,12 +10,13 @@ const chalk = require('chalk');
|
|
|
10
10
|
const bitbucketUserKey = 'MABL_BITBUCKET_USER';
|
|
11
11
|
const bitbucketAppToken = 'MABL_BITBUCKET_APP_TOKEN';
|
|
12
12
|
function generateCodeReportForCommit(executionEventId, outputLink, executionResult) {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
13
14
|
const codeReport = {
|
|
14
15
|
report_type: CodeReport_1.CodeReportType.TEST,
|
|
15
16
|
external_id: `${executionEventId}-cr`,
|
|
16
17
|
title: `mabl tests`,
|
|
17
18
|
details: `mabl tests for mabl deployment ${executionEventId}`,
|
|
18
|
-
result: executionResult.event_status
|
|
19
|
+
result: ((_a = executionResult.event_status) === null || _a === void 0 ? void 0 : _a.succeeded)
|
|
19
20
|
? CodeReport_1.CodeInsightsResult.PASSED
|
|
20
21
|
: CodeReport_1.CodeInsightsResult.FAILED,
|
|
21
22
|
reporter: `mabl`,
|
|
@@ -35,27 +36,27 @@ function generateCodeReportForCommit(executionEventId, outputLink, executionResu
|
|
|
35
36
|
{
|
|
36
37
|
title: 'Plans run',
|
|
37
38
|
type: 'NUMBER',
|
|
38
|
-
value: executionResult.plan_execution_metrics
|
|
39
|
+
value: (_b = executionResult.plan_execution_metrics) === null || _b === void 0 ? void 0 : _b.total,
|
|
39
40
|
},
|
|
40
41
|
{
|
|
41
42
|
title: 'Plans failed',
|
|
42
43
|
type: 'NUMBER',
|
|
43
|
-
value: executionResult.plan_execution_metrics
|
|
44
|
+
value: (_c = executionResult.plan_execution_metrics) === null || _c === void 0 ? void 0 : _c.failed,
|
|
44
45
|
},
|
|
45
46
|
{
|
|
46
47
|
title: 'Tests run',
|
|
47
48
|
type: 'NUMBER',
|
|
48
|
-
value: executionResult.journey_execution_metrics
|
|
49
|
+
value: (_d = executionResult.journey_execution_metrics) === null || _d === void 0 ? void 0 : _d.total,
|
|
49
50
|
},
|
|
50
51
|
{
|
|
51
52
|
title: 'Tests failed',
|
|
52
53
|
type: 'NUMBER',
|
|
53
|
-
value: executionResult.journey_execution_metrics
|
|
54
|
+
value: (_e = executionResult.journey_execution_metrics) === null || _e === void 0 ? void 0 : _e.failed,
|
|
54
55
|
},
|
|
55
56
|
];
|
|
56
|
-
if (executionResult.journey_execution_metrics
|
|
57
|
-
const percentPassing = parseFloat((((executionResult.journey_execution_metrics
|
|
58
|
-
(executionResult.journey_execution_metrics
|
|
57
|
+
if ((_g = (_f = executionResult.journey_execution_metrics) === null || _f === void 0 ? void 0 : _f.total) !== null && _g !== void 0 ? _g : 0 > 0) {
|
|
58
|
+
const percentPassing = parseFloat(((((_j = (_h = executionResult.journey_execution_metrics) === null || _h === void 0 ? void 0 : _h.passed) !== null && _j !== void 0 ? _j : 0) /
|
|
59
|
+
((_l = (_k = executionResult.journey_execution_metrics) === null || _k === void 0 ? void 0 : _k.total) !== null && _l !== void 0 ? _l : 1)) *
|
|
59
60
|
100).toFixed(2));
|
|
60
61
|
codeReport.data.push({
|
|
61
62
|
title: 'Tests passing percent',
|
|
@@ -114,10 +115,11 @@ function generateCodeAnnotationsForReport(executionResult) {
|
|
|
114
115
|
}
|
|
115
116
|
exports.generateCodeAnnotationsForReport = generateCodeAnnotationsForReport;
|
|
116
117
|
function generateAnnotationDetails(testExecution) {
|
|
118
|
+
var _a;
|
|
117
119
|
if (testExecution.success) {
|
|
118
120
|
return `Test was successful - Browser: "${testExecution.browser_type}"`;
|
|
119
121
|
}
|
|
120
|
-
return `Failure Error: "${testExecution.failure_summary
|
|
122
|
+
return `Failure Error: "${(_a = testExecution.failure_summary) === null || _a === void 0 ? void 0 : _a.error}" - Browser: "${testExecution.browser_type}"`;
|
|
121
123
|
}
|
|
122
124
|
function generateAnnotationSummary(testExecution, journeySummaries) {
|
|
123
125
|
let testForAnnotation;
|
|
@@ -140,15 +142,16 @@ async function putCodeReportAndAnnotations(executionResult, executionEventId, ou
|
|
|
140
142
|
}
|
|
141
143
|
exports.putCodeReportAndAnnotations = putCodeReportAndAnnotations;
|
|
142
144
|
async function maybeOutputToBitbucket(executionResult, deploymentId, outputLink) {
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
const
|
|
145
|
+
var _a, _b, _c, _d;
|
|
146
|
+
const repoSlug = (_a = process.env.BITBUCKET_REPO_SLUG) !== null && _a !== void 0 ? _a : '';
|
|
147
|
+
const workspace = (_b = process.env.BITBUCKET_REPO_OWNER) !== null && _b !== void 0 ? _b : '';
|
|
148
|
+
const node = (_c = process.env.BITBUCKET_COMMIT) !== null && _c !== void 0 ? _c : '';
|
|
146
149
|
const isCustomBitBucketPipe = process.env.IS_CUSTOM_BITBUCKET_PIPE === 'true';
|
|
147
150
|
const noProxy = process.env.CODE_INSIGHTS_PROXY_OFF === 'true';
|
|
148
151
|
if (repoSlug &&
|
|
149
152
|
workspace &&
|
|
150
153
|
node &&
|
|
151
|
-
executionResult
|
|
154
|
+
((_d = executionResult === null || executionResult === void 0 ? void 0 : executionResult.executions) === null || _d === void 0 ? void 0 : _d.length) &&
|
|
152
155
|
executionResult.executions.length > 0) {
|
|
153
156
|
const codeReport = await putCodeReportAndAnnotations(executionResult, deploymentId, outputLink, workspace, repoSlug, node, isCustomBitBucketPipe, noProxy);
|
|
154
157
|
loggingProvider_1.logger.info(chalk.cyan(`Bitbucket Code Insights Report generated ${codeReport.uuid}`));
|
|
@@ -32,7 +32,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
32
32
|
const loggingProvider_1 = require("../../providers/logging/loggingProvider");
|
|
33
33
|
const chalk = require('chalk');
|
|
34
34
|
function writeExportedEntityToFile(output, fileExtension, entityId, fileName) {
|
|
35
|
-
fileName = fileName
|
|
35
|
+
fileName = fileName !== null && fileName !== void 0 ? fileName : `${entityId}.mabl.${fileExtension}`.replace(':', '-');
|
|
36
36
|
const filePath = path_1.default.resolve(fileName);
|
|
37
37
|
const dirname = path_1.default.dirname(filePath);
|
|
38
38
|
fs.mkdirSync(dirname, { recursive: true });
|
|
@@ -16,7 +16,8 @@ function getDescribeDescriptions(entityName) {
|
|
|
16
16
|
exports.getDescribeDescriptions = getDescribeDescriptions;
|
|
17
17
|
function failWrapper(func, exitCodeOnError = 1) {
|
|
18
18
|
return (parsed) => func(parsed).catch((error) => {
|
|
19
|
-
|
|
19
|
+
var _a;
|
|
20
|
+
loggingProvider_1.logger.error(chalk.red.bold((_a = error === null || error === void 0 ? void 0 : error.message) !== null && _a !== void 0 ? _a : 'An unexpected error occurred'));
|
|
20
21
|
loggingProvider_1.logger.error(error.stack);
|
|
21
22
|
if (exitCodeOnError) {
|
|
22
23
|
process.exitCode = exitCodeOnError;
|
|
@@ -30,7 +31,7 @@ async function getWorkspaceId(parsed) {
|
|
|
30
31
|
return workspaceId;
|
|
31
32
|
}
|
|
32
33
|
const configuredWorkspace = await cliConfigProvider_1.CliConfigProvider.getWorkspace();
|
|
33
|
-
if (configuredWorkspace
|
|
34
|
+
if (configuredWorkspace === null || configuredWorkspace === void 0 ? void 0 : configuredWorkspace.id) {
|
|
34
35
|
return configuredWorkspace.id;
|
|
35
36
|
}
|
|
36
37
|
throw new Error('Please specify a workspace ID (--workspace-id) or configure a default in the CLI (mabl config set workspace <id>)');
|
|
@@ -38,7 +39,8 @@ async function getWorkspaceId(parsed) {
|
|
|
38
39
|
exports.getWorkspaceId = getWorkspaceId;
|
|
39
40
|
exports.TEST_WITHOUT_FLOWS_MESSAGE = `Test does not have any flows. You may need to specify a branch [--${constants_1.CommandArgMablBranch}] if the test is not on master.`;
|
|
40
41
|
async function getJourneyFlowArray(journey, apiClient, branchName) {
|
|
41
|
-
|
|
42
|
+
var _a;
|
|
43
|
+
if (!((_a = journey.flows) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
42
44
|
throw new Error(exports.TEST_WITHOUT_FLOWS_MESSAGE);
|
|
43
45
|
}
|
|
44
46
|
const flows = {};
|
|
@@ -7,11 +7,12 @@ function nodeVersionToString(nodeVersion) {
|
|
|
7
7
|
exports.nodeVersionToString = nodeVersionToString;
|
|
8
8
|
const NODE_VERSION_REGEX = /(\d+)\.(\d+)(\.(\d+))?/;
|
|
9
9
|
function extractNodeVersionTuple(stringWithVersion) {
|
|
10
|
-
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
const matches = stringWithVersion === null || stringWithVersion === void 0 ? void 0 : stringWithVersion.match(NODE_VERSION_REGEX);
|
|
11
12
|
return {
|
|
12
|
-
major: parseInt(matches
|
|
13
|
-
minor: parseInt(matches
|
|
14
|
-
point: parseInt(matches
|
|
13
|
+
major: parseInt((_a = matches === null || matches === void 0 ? void 0 : matches[1]) !== null && _a !== void 0 ? _a : '0'),
|
|
14
|
+
minor: parseInt((_b = matches === null || matches === void 0 ? void 0 : matches[2]) !== null && _b !== void 0 ? _b : '0'),
|
|
15
|
+
point: parseInt((_c = matches === null || matches === void 0 ? void 0 : matches[4]) !== null && _c !== void 0 ? _c : '0'),
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
18
|
exports.extractNodeVersionTuple = extractNodeVersionTuple;
|
|
@@ -23,8 +23,8 @@ async function listConfig() {
|
|
|
23
23
|
switch (propertyKey) {
|
|
24
24
|
case configKeys_1.configKeys.defaultWorkspaceId:
|
|
25
25
|
const maybeWorkspace = await cliConfigProvider_1.CliConfigProvider.getWorkspace();
|
|
26
|
-
value = maybeWorkspace
|
|
27
|
-
details = maybeWorkspace
|
|
26
|
+
value = maybeWorkspace === null || maybeWorkspace === void 0 ? void 0 : maybeWorkspace.id;
|
|
27
|
+
details = maybeWorkspace === null || maybeWorkspace === void 0 ? void 0 : maybeWorkspace.name;
|
|
28
28
|
break;
|
|
29
29
|
default:
|
|
30
30
|
value = await cliConfigProvider_1.CliConfigProvider.getConfigProperty(propertyKey);
|
|
@@ -34,9 +34,10 @@ exports.builder = (yargs) => {
|
|
|
34
34
|
};
|
|
35
35
|
exports.handler = (0, util_1.failWrapper)(createDataTable);
|
|
36
36
|
async function createDataTable(parsed) {
|
|
37
|
+
var _a, _b;
|
|
37
38
|
const { input } = parsed;
|
|
38
|
-
const format = parsed.format
|
|
39
|
-
const name = parsed.name
|
|
39
|
+
const format = (_a = parsed.format) !== null && _a !== void 0 ? _a : (0, utils_1.inferFileFormat)(input);
|
|
40
|
+
const name = (_b = parsed.name) !== null && _b !== void 0 ? _b : (0, path_1.basename)((0, path_1.resolve)(input));
|
|
40
41
|
const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
|
|
41
42
|
let scenarios = [];
|
|
42
43
|
switch (format) {
|
|
@@ -25,11 +25,12 @@ exports.builder = (yargs) => {
|
|
|
25
25
|
};
|
|
26
26
|
exports.handler = (0, util_1.failWrapper)(exportDataTable);
|
|
27
27
|
async function exportDataTable(parsed) {
|
|
28
|
+
var _a;
|
|
28
29
|
const dataTableId = parsed.id;
|
|
29
30
|
const format = parsed.format;
|
|
30
31
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
31
32
|
const scenarioQueryResult = await apiClient.queryScenarios(dataTableId);
|
|
32
|
-
const scenarios = scenarioQueryResult.scenarios
|
|
33
|
+
const scenarios = (_a = scenarioQueryResult.scenarios) !== null && _a !== void 0 ? _a : [];
|
|
33
34
|
let output = '';
|
|
34
35
|
switch (format) {
|
|
35
36
|
case constants_1.OutputFormats.Json:
|
|
@@ -71,12 +72,13 @@ function dumpToCsv(scenarios) {
|
|
|
71
72
|
];
|
|
72
73
|
output.push(headers);
|
|
73
74
|
scenarios.forEach((scenario) => {
|
|
74
|
-
|
|
75
|
+
var _a;
|
|
76
|
+
const variables = (_a = scenario.variables) !== null && _a !== void 0 ? _a : [];
|
|
75
77
|
const sanitizedRowValues = [
|
|
76
78
|
scenario.id,
|
|
77
79
|
scenario.name,
|
|
78
80
|
...variables.map((variable) => variable.value || ''),
|
|
79
|
-
].map((val) => (0, utils_1.sanitizeCsvCellInput)(val
|
|
81
|
+
].map((val) => (0, utils_1.sanitizeCsvCellInput)(val !== null && val !== void 0 ? val : ''));
|
|
80
82
|
output.push(sanitizedRowValues);
|
|
81
83
|
});
|
|
82
84
|
return (0, sync_1.stringify)(output);
|
|
@@ -8,10 +8,11 @@ exports.describe = 'List your DataTables';
|
|
|
8
8
|
exports.builder = (0, list_1.getListBuilderOptions)('datatables');
|
|
9
9
|
exports.handler = (0, util_1.failWrapper)(listDataTables);
|
|
10
10
|
async function listDataTables(parsed) {
|
|
11
|
+
var _a;
|
|
11
12
|
const output = parsed.output;
|
|
12
13
|
const limit = parsed.limit;
|
|
13
14
|
const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
|
|
14
15
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
15
16
|
const queryResult = await apiClient.queryDataTables(workspaceId, limit);
|
|
16
|
-
(0, list_1.outputEntities)(queryResult.dataTables
|
|
17
|
+
(0, list_1.outputEntities)((_a = queryResult.dataTables) !== null && _a !== void 0 ? _a : [], output);
|
|
17
18
|
}
|
|
@@ -25,10 +25,11 @@ exports.builder = (yargs) => {
|
|
|
25
25
|
};
|
|
26
26
|
exports.handler = (0, util_1.failWrapper)(dataTableScenarios);
|
|
27
27
|
async function dataTableScenarios(parsed) {
|
|
28
|
+
var _a;
|
|
28
29
|
const output = parsed.output;
|
|
29
30
|
const dataTableId = parsed.id;
|
|
30
31
|
const limit = parsed.limit;
|
|
31
32
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
32
33
|
const queryResult = await apiClient.queryScenarios(dataTableId, limit);
|
|
33
|
-
(0, list_1.outputEntities)(queryResult.scenarios
|
|
34
|
+
(0, list_1.outputEntities)((_a = queryResult.scenarios) !== null && _a !== void 0 ? _a : [], output);
|
|
34
35
|
}
|
|
@@ -33,8 +33,9 @@ exports.builder = (yargs) => {
|
|
|
33
33
|
};
|
|
34
34
|
exports.handler = (0, util_1.failWrapper)(updateDataTable);
|
|
35
35
|
async function updateDataTable(parsed) {
|
|
36
|
+
var _a;
|
|
36
37
|
const { id: dataTableId, input } = parsed;
|
|
37
|
-
const format = parsed.format
|
|
38
|
+
const format = (_a = parsed.format) !== null && _a !== void 0 ? _a : (0, utils_1.inferFileFormat)(input);
|
|
38
39
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
39
40
|
const dataTable = await apiClient.getDataTable(dataTableId);
|
|
40
41
|
let scenarios;
|
|
@@ -52,21 +53,23 @@ async function updateDataTable(parsed) {
|
|
|
52
53
|
await apiClient.updateDataTable(dataTableId, request);
|
|
53
54
|
}
|
|
54
55
|
function buildUpdateRequest(scenarios, dataTable) {
|
|
56
|
+
var _a, _b, _c;
|
|
55
57
|
if (scenarios.length === 0 || !scenarios) {
|
|
56
58
|
throw Error('Must have at least 1 scenario in DataTable.');
|
|
57
59
|
}
|
|
58
60
|
const validationVariables = scenarios[0].variables;
|
|
59
61
|
scenarios.forEach((scenario) => {
|
|
60
|
-
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
if (scenario.id && !((_a = dataTable.scenario_ids) === null || _a === void 0 ? void 0 : _a.includes(scenario.id))) {
|
|
61
64
|
throw Error(`Scenario in input with ID ${scenario.id} does not exist in DataTable scenario_ids.`);
|
|
62
65
|
}
|
|
63
|
-
if (scenario.variables
|
|
66
|
+
if (((_b = scenario.variables) === null || _b === void 0 ? void 0 : _b.length) === 0 || !scenario.variables) {
|
|
64
67
|
throw Error('Must have at least 1 variable in a scenario.');
|
|
65
68
|
}
|
|
66
|
-
if (scenario.variables.length !== validationVariables
|
|
69
|
+
if (scenario.variables.length !== (validationVariables === null || validationVariables === void 0 ? void 0 : validationVariables.length)) {
|
|
67
70
|
throw Error('All scenarios must have the same number of variables.');
|
|
68
71
|
}
|
|
69
|
-
scenario.variables
|
|
72
|
+
(_c = scenario.variables) === null || _c === void 0 ? void 0 : _c.forEach((variable, index) => {
|
|
70
73
|
if (!(0, domUtil_1.isValidUserVariableName)(variable.name)) {
|
|
71
74
|
throw Error(`Invalid variable name: ${variable.name}. Variable names must start with a letter or underscore (_) followed by letters, numbers, and underscores and cannot be "user", "web", or "mail"`);
|
|
72
75
|
}
|
|
@@ -81,17 +84,14 @@ function buildUpdateRequest(scenarios, dataTable) {
|
|
|
81
84
|
acc[scenario.id] = scenario;
|
|
82
85
|
return acc;
|
|
83
86
|
}, {});
|
|
84
|
-
const updatedRows = dataTable.scenario_ids
|
|
85
|
-
?.filter((id) => parsedScenarioMap[id] !== undefined)
|
|
86
|
-
.map((id) => {
|
|
87
|
+
const updatedRows = ((_a = dataTable.scenario_ids) === null || _a === void 0 ? void 0 : _a.filter((id) => parsedScenarioMap[id] !== undefined).map((id) => {
|
|
87
88
|
const variableRow = (0, utils_1.scenarioAsVariableRow)(parsedScenarioMap[id]);
|
|
88
89
|
return {
|
|
89
90
|
id: variableRow.id || '',
|
|
90
91
|
scenario_id: variableRow.scenario_id || '',
|
|
91
92
|
row: variableRow.row || [],
|
|
92
93
|
};
|
|
93
|
-
})
|
|
94
|
-
.filter(pureUtil_1.isDefined) || [];
|
|
94
|
+
}).filter(pureUtil_1.isDefined)) || [];
|
|
95
95
|
const updatedRowIds = updatedRows
|
|
96
96
|
.map((row) => row.id)
|
|
97
97
|
.filter(pureUtil_1.isDefined);
|
|
@@ -105,7 +105,7 @@ function buildUpdateRequest(scenarios, dataTable) {
|
|
|
105
105
|
row: variableRow.row,
|
|
106
106
|
};
|
|
107
107
|
});
|
|
108
|
-
const deletedRowIds = dataTable.scenario_ids
|
|
108
|
+
const deletedRowIds = (_c = (_b = dataTable.scenario_ids) === null || _b === void 0 ? void 0 : _b.filter((id) => !updatedRowIds.includes(id))) !== null && _c !== void 0 ? _c : [];
|
|
109
109
|
const prototype = {
|
|
110
110
|
...(0, utils_1.dataTableAsVariableTable)(dataTable),
|
|
111
111
|
row_ids: updatedRows.map((row) => row.id).filter(pureUtil_1.isDefined),
|
|
@@ -114,15 +114,15 @@ function dataTableAsVariableTable(dataTable) {
|
|
|
114
114
|
exports.dataTableAsVariableTable = dataTableAsVariableTable;
|
|
115
115
|
function scenarioAsVariableRow(scenario) {
|
|
116
116
|
return {
|
|
117
|
-
id: scenario
|
|
118
|
-
table_id: scenario
|
|
119
|
-
created_time: scenario
|
|
120
|
-
created_by_id: scenario
|
|
121
|
-
last_updated_time: scenario
|
|
122
|
-
last_updated_by_id: scenario
|
|
123
|
-
organization_id: scenario
|
|
124
|
-
scenario_id: scenario
|
|
125
|
-
row: scenario
|
|
117
|
+
id: scenario === null || scenario === void 0 ? void 0 : scenario.id,
|
|
118
|
+
table_id: scenario === null || scenario === void 0 ? void 0 : scenario.table_id,
|
|
119
|
+
created_time: scenario === null || scenario === void 0 ? void 0 : scenario.created_time,
|
|
120
|
+
created_by_id: scenario === null || scenario === void 0 ? void 0 : scenario.created_by_id,
|
|
121
|
+
last_updated_time: scenario === null || scenario === void 0 ? void 0 : scenario.last_updated_time,
|
|
122
|
+
last_updated_by_id: scenario === null || scenario === void 0 ? void 0 : scenario.last_updated_by_id,
|
|
123
|
+
organization_id: scenario === null || scenario === void 0 ? void 0 : scenario.workspace_id,
|
|
124
|
+
scenario_id: scenario === null || scenario === void 0 ? void 0 : scenario.name,
|
|
125
|
+
row: scenario === null || scenario === void 0 ? void 0 : scenario.variables,
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
exports.scenarioAsVariableRow = scenarioAsVariableRow;
|
|
@@ -15,12 +15,13 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
15
15
|
this.isSilent = !!isSilent;
|
|
16
16
|
}
|
|
17
17
|
async pollingFunction(mablApi, lastEntity, seedId) {
|
|
18
|
+
var _a, _b;
|
|
18
19
|
if (!seedId) {
|
|
19
20
|
throw new Error('event id must be passed');
|
|
20
21
|
}
|
|
21
22
|
const latestResults = await mablApi.getDeploymentResults(seedId);
|
|
22
23
|
if (this.exitOnFirstFailure) {
|
|
23
|
-
if (latestResults.plan_execution_metrics
|
|
24
|
+
if ((_b = (_a = latestResults.plan_execution_metrics) === null || _a === void 0 ? void 0 : _a.failed) !== null && _b !== void 0 ? _b : 0 > 0) {
|
|
24
25
|
this.exitOnFirstFailurePresenter(latestResults);
|
|
25
26
|
return {
|
|
26
27
|
newEntity: latestResults,
|
|
@@ -28,8 +29,8 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
const hasOutcomePayload = latestResults
|
|
32
|
-
Object.keys(latestResults
|
|
32
|
+
const hasOutcomePayload = (latestResults === null || latestResults === void 0 ? void 0 : latestResults.event_status) &&
|
|
33
|
+
Object.keys(latestResults === null || latestResults === void 0 ? void 0 : latestResults.event_status).length > 0;
|
|
33
34
|
const status = hasOutcomePayload
|
|
34
35
|
? awaitCompletion_1.PollingOutcomeType.Complete
|
|
35
36
|
: awaitCompletion_1.PollingOutcomeType.Running;
|
|
@@ -39,13 +40,14 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
42
|
statusPresenter(lastEntity) {
|
|
43
|
+
var _a, _b, _c, _d, _e, _f;
|
|
42
44
|
if (this.isSilent) {
|
|
43
45
|
return;
|
|
44
46
|
}
|
|
45
47
|
const elapsedTimeString = (0, timeUtil_1.elapsedTimeDurationToString)(this.getElapsedMilliseconds());
|
|
46
|
-
const passed = lastEntity.plan_execution_metrics
|
|
47
|
-
const failed = lastEntity.plan_execution_metrics
|
|
48
|
-
const total = lastEntity.plan_execution_metrics
|
|
48
|
+
const passed = (_b = (_a = lastEntity.plan_execution_metrics) === null || _a === void 0 ? void 0 : _a.passed) !== null && _b !== void 0 ? _b : 0;
|
|
49
|
+
const failed = (_d = (_c = lastEntity.plan_execution_metrics) === null || _c === void 0 ? void 0 : _c.failed) !== null && _d !== void 0 ? _d : 0;
|
|
50
|
+
const total = (_f = (_e = lastEntity.plan_execution_metrics) === null || _e === void 0 ? void 0 : _e.total) !== null && _f !== void 0 ? _f : 0;
|
|
49
51
|
const passedColor = passed === 0 ? 'gray' : 'green';
|
|
50
52
|
const failedColor = failed === 0 ? 'gray' : 'red';
|
|
51
53
|
let totalColor = 'gray';
|
|
@@ -189,6 +189,7 @@ exports.builder = (yargs) => {
|
|
|
189
189
|
};
|
|
190
190
|
exports.handler = (0, util_1.failWrapper)(createDeployment);
|
|
191
191
|
async function createDeployment(parsed) {
|
|
192
|
+
var _a, _b, _c;
|
|
192
193
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClientFromOptionalApiKey(parsed['api-key']);
|
|
193
194
|
if (parsed.output) {
|
|
194
195
|
parsed.silent = true;
|
|
@@ -203,7 +204,7 @@ async function createDeployment(parsed) {
|
|
|
203
204
|
const environmentOverride = parsed[constants_1.CommandArgOverrideEnvironmentId];
|
|
204
205
|
let deploymentIds;
|
|
205
206
|
if (environmentOverride) {
|
|
206
|
-
deploymentIds = (await apiClient.queryDeploymentEntities(workspaceId, environmentOverride, applicationId)).deployments
|
|
207
|
+
deploymentIds = (_a = (await apiClient.queryDeploymentEntities(workspaceId, environmentOverride, applicationId)).deployments) === null || _a === void 0 ? void 0 : _a.map((deployment) => deployment.id);
|
|
207
208
|
if (!deploymentIds || deploymentIds.length === 0) {
|
|
208
209
|
loggingProvider_1.logger.error(chalk.red.bold(`Application ${applicationId} is not defined in override environment ${environmentOverride}`));
|
|
209
210
|
process.exit(1);
|
|
@@ -241,7 +242,7 @@ async function createDeployment(parsed) {
|
|
|
241
242
|
}
|
|
242
243
|
const waiter = new awaitDeploymentCompletion_1.AwaitDeploymentCompletion(apiClient, parsed['fast-failure'], parsed.silent);
|
|
243
244
|
const pollingResult = await waiter.awaitCompletion(deploymentEvent.id);
|
|
244
|
-
const isSuccess = pollingResult
|
|
245
|
+
const isSuccess = ((_c = (_b = pollingResult === null || pollingResult === void 0 ? void 0 : pollingResult.newEntity) === null || _b === void 0 ? void 0 : _b.event_status) === null || _c === void 0 ? void 0 : _c.succeeded) || false;
|
|
245
246
|
try {
|
|
246
247
|
await (0, codeInsights_1.maybeOutputToBitbucket)(pollingResult.newEntity, deploymentEvent.id, outputWebappLink);
|
|
247
248
|
}
|
|
@@ -249,7 +250,7 @@ async function createDeployment(parsed) {
|
|
|
249
250
|
loggingProvider_1.logger.info(chalk.yellow.bold('Unable to generate code insights due to BitBucket integration API error'));
|
|
250
251
|
loggingProvider_1.logger.info(`details: ${error}`);
|
|
251
252
|
}
|
|
252
|
-
const textOutput = printDeploymentEventResultOutput(deploymentEvent.id, outputWebappLink, parsed.output, pollingResult
|
|
253
|
+
const textOutput = printDeploymentEventResultOutput(deploymentEvent.id, outputWebappLink, parsed.output, pollingResult === null || pollingResult === void 0 ? void 0 : pollingResult.newEntity);
|
|
253
254
|
if (!isSuccess) {
|
|
254
255
|
process.exit(1);
|
|
255
256
|
}
|
|
@@ -271,19 +272,20 @@ function printDeploymentEventResultOutput(deploymentEventId, outputWebappLink, o
|
|
|
271
272
|
}
|
|
272
273
|
exports.printDeploymentEventResultOutput = printDeploymentEventResultOutput;
|
|
273
274
|
async function collectSourceControlMetadataIfEnabled(parsed) {
|
|
275
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
274
276
|
const userSuppliedRepositoryUrl = parsed['repository-url'];
|
|
275
277
|
if (await cliConfigProvider_1.CliConfigProvider.getConfigProperty(configKeys_1.configKeys.enableSourceControlMetadataCollection)) {
|
|
276
278
|
const buildInfo = await new scmContextProvider_1.ScmContextProvider(process.env).extractScmAndBuildInfo();
|
|
277
|
-
const sourceControlBranch = buildInfo
|
|
278
|
-
const sourceControlTag = buildInfo
|
|
279
|
+
const sourceControlBranch = ((_a = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _a === void 0 ? void 0 : _a.branchName) || ((_b = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _b === void 0 ? void 0 : _b.branchName);
|
|
280
|
+
const sourceControlTag = ((_c = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _c === void 0 ? void 0 : _c.tagName) || ((_d = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _d === void 0 ? void 0 : _d.tagName);
|
|
279
281
|
const sourceControlRepoUrl = userSuppliedRepositoryUrl ||
|
|
280
|
-
buildInfo
|
|
281
|
-
buildInfo
|
|
282
|
-
const sourceControlRepoName = buildInfo
|
|
282
|
+
((_e = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _e === void 0 ? void 0 : _e.repoUrl) ||
|
|
283
|
+
((_f = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _f === void 0 ? void 0 : _f.repoUrl);
|
|
284
|
+
const sourceControlRepoName = ((_g = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _g === void 0 ? void 0 : _g.repoName) || ((_h = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _h === void 0 ? void 0 : _h.repoName);
|
|
283
285
|
const revision = parsed.revision ||
|
|
284
|
-
buildInfo
|
|
285
|
-
buildInfo
|
|
286
|
-
buildInfo
|
|
286
|
+
((_j = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.scmInfo) === null || _j === void 0 ? void 0 : _j.commitSha) ||
|
|
287
|
+
((_k = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _k === void 0 ? void 0 : _k.commitSha) ||
|
|
288
|
+
((_l = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.buildInfo) === null || _l === void 0 ? void 0 : _l.revision);
|
|
287
289
|
return {
|
|
288
290
|
branchName: sourceControlBranch,
|
|
289
291
|
tag: sourceControlTag,
|
|
@@ -11,6 +11,7 @@ const timeUtil_1 = require("../../../util/timeUtil");
|
|
|
11
11
|
const chalk = require('chalk');
|
|
12
12
|
class ExecutionResultPresenter {
|
|
13
13
|
entityToString(results, columnWidth) {
|
|
14
|
+
var _a;
|
|
14
15
|
const columnLabels = [
|
|
15
16
|
'Plan Name',
|
|
16
17
|
'Test Name',
|
|
@@ -26,14 +27,15 @@ class ExecutionResultPresenter {
|
|
|
26
27
|
tableConfig.colWidths = Array(columnLabels.length - 1).fill(columnWidth);
|
|
27
28
|
}
|
|
28
29
|
const table = new cli_table3_1.default(tableConfig);
|
|
29
|
-
const finalExecutions = results
|
|
30
|
+
const finalExecutions = (_a = results === null || results === void 0 ? void 0 : results.executions) !== null && _a !== void 0 ? _a : [];
|
|
30
31
|
finalExecutions.forEach((summary) => {
|
|
31
|
-
|
|
32
|
+
var _a, _b, _c, _d, _e;
|
|
33
|
+
const retryPrefix = ((_a = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _a === void 0 ? void 0 : _a.is_retry) ? '[Retry] ' : '';
|
|
32
34
|
const planId = summary.plan.id;
|
|
33
|
-
const planName = retryPrefix + (summary.plan
|
|
35
|
+
const planName = retryPrefix + ((_c = (_b = summary.plan) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '<plan name unavailable>');
|
|
34
36
|
const planRunStatus = summary.plan_execution.status;
|
|
35
37
|
const journeyMap = new Map();
|
|
36
|
-
summary
|
|
38
|
+
(_d = summary === null || summary === void 0 ? void 0 : summary.journeys) === null || _d === void 0 ? void 0 : _d.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
|
|
37
39
|
const statusChalk = this.mapPlanRunStatusToColor(planRunStatus);
|
|
38
40
|
table.push([
|
|
39
41
|
`${planName}`,
|
|
@@ -43,12 +45,13 @@ class ExecutionResultPresenter {
|
|
|
43
45
|
statusChalk(this.maybeCapitalize(planRunStatus.toString())),
|
|
44
46
|
summaryToElapsedTime(summary),
|
|
45
47
|
]);
|
|
46
|
-
summary
|
|
48
|
+
(_e = summary === null || summary === void 0 ? void 0 : summary.journey_executions) === null || _e === void 0 ? void 0 : _e.forEach((journeyRun) => {
|
|
49
|
+
var _a, _b, _c, _d;
|
|
47
50
|
const journeyId = journeyRun.journey_execution_id;
|
|
48
|
-
const journeyStatus = this.maybeCapitalize(journeyRun.status
|
|
49
|
-
const journeyBrowser = this.maybeCapitalize(journeyRun.browser_type
|
|
51
|
+
const journeyStatus = this.maybeCapitalize((_b = (_a = journeyRun.status) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '<status unavailable>');
|
|
52
|
+
const journeyBrowser = this.maybeCapitalize((_c = journeyRun.browser_type) !== null && _c !== void 0 ? _c : '<unknown browser>');
|
|
50
53
|
const journeySummary = journeyMap.get(journeyRun.journey_id);
|
|
51
|
-
const journeyName = `${retryPrefix}${journeySummary
|
|
54
|
+
const journeyName = `${retryPrefix}${(_d = journeySummary === null || journeySummary === void 0 ? void 0 : journeySummary.name) !== null && _d !== void 0 ? _d : '<test name >'}`;
|
|
52
55
|
const statusChalk = this.mapJourneyRunStatusToColor(journeyRun.status);
|
|
53
56
|
table.push([
|
|
54
57
|
'',
|
|
@@ -37,6 +37,7 @@ function printDeployments(deployments, output) {
|
|
|
37
37
|
head: ['ID', 'Time', 'Application/Env.', 'Pass', 'Fail', 'Total'],
|
|
38
38
|
});
|
|
39
39
|
deployments.forEach((deployment) => {
|
|
40
|
+
var _a, _b, _c, _d, _e, _f;
|
|
40
41
|
table.push([
|
|
41
42
|
{ rowSpan: 2, content: deployment.id, vAlign: 'center' },
|
|
42
43
|
{
|
|
@@ -49,19 +50,19 @@ function printDeployments(deployments, output) {
|
|
|
49
50
|
deployment.application_id || 'none',
|
|
50
51
|
{
|
|
51
52
|
rowSpan: 2,
|
|
52
|
-
content: deployment.run_result
|
|
53
|
+
content: (_b = (_a = deployment.run_result) === null || _a === void 0 ? void 0 : _a.journey_execution_metrics) === null || _b === void 0 ? void 0 : _b.passed,
|
|
53
54
|
vAlign: 'center',
|
|
54
55
|
hAlign: 'center',
|
|
55
56
|
},
|
|
56
57
|
{
|
|
57
58
|
rowSpan: 2,
|
|
58
|
-
content: deployment.run_result
|
|
59
|
+
content: (_d = (_c = deployment.run_result) === null || _c === void 0 ? void 0 : _c.journey_execution_metrics) === null || _d === void 0 ? void 0 : _d.failed,
|
|
59
60
|
vAlign: 'center',
|
|
60
61
|
hAlign: 'center',
|
|
61
62
|
},
|
|
62
63
|
{
|
|
63
64
|
rowSpan: 2,
|
|
64
|
-
content: deployment.run_result
|
|
65
|
+
content: (_f = (_e = deployment.run_result) === null || _e === void 0 ? void 0 : _e.journey_execution_metrics) === null || _f === void 0 ? void 0 : _f.total,
|
|
65
66
|
vAlign: 'center',
|
|
66
67
|
hAlign: 'center',
|
|
67
68
|
},
|
|
@@ -29,13 +29,14 @@ exports.builder = (yargs) => {
|
|
|
29
29
|
};
|
|
30
30
|
exports.handler = (0, util_1.failWrapper)(getWatch);
|
|
31
31
|
async function getWatch(parsed) {
|
|
32
|
+
var _a, _b;
|
|
32
33
|
const deploymentId = parsed.id;
|
|
33
34
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
34
35
|
const deploymentEvent = await apiClient.getDeploymentEvent(deploymentId);
|
|
35
36
|
const outputWebappLink = (0, create_1.getDeploymentEventWebappUrl)(deploymentEvent);
|
|
36
37
|
const waiter = new awaitDeploymentCompletion_1.AwaitDeploymentCompletion(apiClient, parsed['fast-failure'], parsed.silent);
|
|
37
38
|
const pollingResult = await waiter.awaitCompletion(deploymentEvent.id);
|
|
38
|
-
const isSuccess = pollingResult
|
|
39
|
+
const isSuccess = ((_b = (_a = pollingResult === null || pollingResult === void 0 ? void 0 : pollingResult.newEntity) === null || _a === void 0 ? void 0 : _a.event_status) === null || _b === void 0 ? void 0 : _b.succeeded) || false;
|
|
39
40
|
if (!isSuccess) {
|
|
40
41
|
process.exit(1);
|
|
41
42
|
}
|
|
@@ -98,6 +98,7 @@ function addUpdateEnvCommands(argv) {
|
|
|
98
98
|
}
|
|
99
99
|
exports.addUpdateEnvCommands = addUpdateEnvCommands;
|
|
100
100
|
async function createEnvironment(parsed) {
|
|
101
|
+
var _a;
|
|
101
102
|
let environment;
|
|
102
103
|
try {
|
|
103
104
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
@@ -120,7 +121,7 @@ async function createEnvironment(parsed) {
|
|
|
120
121
|
variables: parsed[constants_1.CommandArgVariables],
|
|
121
122
|
};
|
|
122
123
|
environment = await apiClient.createEnvironment(environment);
|
|
123
|
-
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(environment.id
|
|
124
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold((_a = environment.id) !== null && _a !== void 0 ? _a : '')} CREATED`));
|
|
124
125
|
const applicationId = parsed[constants_1.CommandArgApplicationId];
|
|
125
126
|
if (applicationId) {
|
|
126
127
|
loggingProvider_1.logger.info('Associating URLs with environment');
|
|
@@ -18,11 +18,12 @@ exports.builder = (yargs) => {
|
|
|
18
18
|
};
|
|
19
19
|
exports.handler = (0, util_1.failWrapper)(deleteEnvironment);
|
|
20
20
|
async function deleteEnvironment(parsed) {
|
|
21
|
+
var _a;
|
|
21
22
|
let environment;
|
|
22
23
|
try {
|
|
23
24
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
24
25
|
environment = await apiClient.deleteEnvironment(parsed.id);
|
|
25
|
-
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(environment.id
|
|
26
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold((_a = environment.id) !== null && _a !== void 0 ? _a : '')} DELETED`));
|
|
26
27
|
}
|
|
27
28
|
catch (error) {
|
|
28
29
|
throw new Error(`Error deleting environment: ${error}`);
|
|
@@ -21,6 +21,7 @@ exports.builder = (yargs) => {
|
|
|
21
21
|
};
|
|
22
22
|
exports.handler = (0, util_1.failWrapper)(updateEnvironment);
|
|
23
23
|
async function updateEnvironment(parsed) {
|
|
24
|
+
var _a;
|
|
24
25
|
let environment;
|
|
25
26
|
try {
|
|
26
27
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
@@ -36,7 +37,7 @@ async function updateEnvironment(parsed) {
|
|
|
36
37
|
variables: parsed[constants_1.CommandArgVariables],
|
|
37
38
|
};
|
|
38
39
|
environment = await apiClient.updateEnvironment(parsed[constants_1.CommandArgId], environment);
|
|
39
|
-
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(environment.id
|
|
40
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold((_a = environment.id) !== null && _a !== void 0 ? _a : '')} UPDATED`));
|
|
40
41
|
}
|
|
41
42
|
catch (error) {
|
|
42
43
|
throw new Error(`Error updating environment: ${error}`);
|
|
@@ -35,10 +35,11 @@ exports.builder = (yargs) => {
|
|
|
35
35
|
};
|
|
36
36
|
exports.handler = (0, util_1.failWrapper)(queryDeployments);
|
|
37
37
|
async function queryDeployments(parsed) {
|
|
38
|
+
var _a;
|
|
38
39
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
39
40
|
try {
|
|
40
41
|
const environment = await apiClient.getEnvironment(parsed.id);
|
|
41
|
-
const deploymentEntities = await apiClient.queryDeploymentEntities(environment.organization_id
|
|
42
|
+
const deploymentEntities = await apiClient.queryDeploymentEntities((_a = environment.organization_id) !== null && _a !== void 0 ? _a : '', environment.id, parsed[constants_1.CommandArgApplicationId], parsed.limit);
|
|
42
43
|
(0, describe_1.outputEntity)(deploymentEntities.deployments, parsed.output);
|
|
43
44
|
}
|
|
44
45
|
catch (error) {
|
|
@@ -36,11 +36,12 @@ exports.builder = (yargs) => {
|
|
|
36
36
|
};
|
|
37
37
|
exports.handler = (0, util_1.failWrapper)(pullFlow);
|
|
38
38
|
async function pullFlow(parsed) {
|
|
39
|
+
var _a;
|
|
39
40
|
const flowId = parsed.id;
|
|
40
41
|
const format = parsed.format;
|
|
41
42
|
const detailLevel = parsed[constants_1.CommandArgDetailLevel];
|
|
42
43
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
43
|
-
const branchName = parsed['mabl-branch']
|
|
44
|
+
const branchName = (_a = parsed['mabl-branch']) !== null && _a !== void 0 ? _a : constants_1.DefaultBranchName;
|
|
44
45
|
const flow = await apiClient.getFlow(flowId, branchName);
|
|
45
46
|
switch (format) {
|
|
46
47
|
case constants_1.OutputFormats.Csv:
|