@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
|
@@ -10,13 +10,12 @@ 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;
|
|
14
13
|
const codeReport = {
|
|
15
14
|
report_type: CodeReport_1.CodeReportType.TEST,
|
|
16
15
|
external_id: `${executionEventId}-cr`,
|
|
17
16
|
title: `mabl tests`,
|
|
18
17
|
details: `mabl tests for mabl deployment ${executionEventId}`,
|
|
19
|
-
result:
|
|
18
|
+
result: executionResult.event_status?.succeeded
|
|
20
19
|
? CodeReport_1.CodeInsightsResult.PASSED
|
|
21
20
|
: CodeReport_1.CodeInsightsResult.FAILED,
|
|
22
21
|
reporter: `mabl`,
|
|
@@ -36,27 +35,27 @@ function generateCodeReportForCommit(executionEventId, outputLink, executionResu
|
|
|
36
35
|
{
|
|
37
36
|
title: 'Plans run',
|
|
38
37
|
type: 'NUMBER',
|
|
39
|
-
value:
|
|
38
|
+
value: executionResult.plan_execution_metrics?.total,
|
|
40
39
|
},
|
|
41
40
|
{
|
|
42
41
|
title: 'Plans failed',
|
|
43
42
|
type: 'NUMBER',
|
|
44
|
-
value:
|
|
43
|
+
value: executionResult.plan_execution_metrics?.failed,
|
|
45
44
|
},
|
|
46
45
|
{
|
|
47
46
|
title: 'Tests run',
|
|
48
47
|
type: 'NUMBER',
|
|
49
|
-
value:
|
|
48
|
+
value: executionResult.journey_execution_metrics?.total,
|
|
50
49
|
},
|
|
51
50
|
{
|
|
52
51
|
title: 'Tests failed',
|
|
53
52
|
type: 'NUMBER',
|
|
54
|
-
value:
|
|
53
|
+
value: executionResult.journey_execution_metrics?.failed,
|
|
55
54
|
},
|
|
56
55
|
];
|
|
57
|
-
if (
|
|
58
|
-
const percentPassing = parseFloat((((
|
|
59
|
-
(
|
|
56
|
+
if (executionResult.journey_execution_metrics?.total ?? 0 > 0) {
|
|
57
|
+
const percentPassing = parseFloat((((executionResult.journey_execution_metrics?.passed ?? 0) /
|
|
58
|
+
(executionResult.journey_execution_metrics?.total ?? 1)) *
|
|
60
59
|
100).toFixed(2));
|
|
61
60
|
codeReport.data.push({
|
|
62
61
|
title: 'Tests passing percent',
|
|
@@ -115,11 +114,10 @@ function generateCodeAnnotationsForReport(executionResult) {
|
|
|
115
114
|
}
|
|
116
115
|
exports.generateCodeAnnotationsForReport = generateCodeAnnotationsForReport;
|
|
117
116
|
function generateAnnotationDetails(testExecution) {
|
|
118
|
-
var _a;
|
|
119
117
|
if (testExecution.success) {
|
|
120
118
|
return `Test was successful - Browser: "${testExecution.browser_type}"`;
|
|
121
119
|
}
|
|
122
|
-
return `Failure Error: "${
|
|
120
|
+
return `Failure Error: "${testExecution.failure_summary?.error}" - Browser: "${testExecution.browser_type}"`;
|
|
123
121
|
}
|
|
124
122
|
function generateAnnotationSummary(testExecution, journeySummaries) {
|
|
125
123
|
let testForAnnotation;
|
|
@@ -142,16 +140,15 @@ async function putCodeReportAndAnnotations(executionResult, executionEventId, ou
|
|
|
142
140
|
}
|
|
143
141
|
exports.putCodeReportAndAnnotations = putCodeReportAndAnnotations;
|
|
144
142
|
async function maybeOutputToBitbucket(executionResult, deploymentId, outputLink) {
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const node = (_c = process.env.BITBUCKET_COMMIT) !== null && _c !== void 0 ? _c : '';
|
|
143
|
+
const repoSlug = process.env.BITBUCKET_REPO_SLUG ?? '';
|
|
144
|
+
const workspace = process.env.BITBUCKET_REPO_OWNER ?? '';
|
|
145
|
+
const node = process.env.BITBUCKET_COMMIT ?? '';
|
|
149
146
|
const isCustomBitBucketPipe = process.env.IS_CUSTOM_BITBUCKET_PIPE === 'true';
|
|
150
147
|
const noProxy = process.env.CODE_INSIGHTS_PROXY_OFF === 'true';
|
|
151
148
|
if (repoSlug &&
|
|
152
149
|
workspace &&
|
|
153
150
|
node &&
|
|
154
|
-
|
|
151
|
+
executionResult?.executions?.length &&
|
|
155
152
|
executionResult.executions.length > 0) {
|
|
156
153
|
const codeReport = await putCodeReportAndAnnotations(executionResult, deploymentId, outputLink, workspace, repoSlug, node, isCustomBitBucketPipe, noProxy);
|
|
157
154
|
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 ?? `${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,8 +16,7 @@ function getDescribeDescriptions(entityName) {
|
|
|
16
16
|
exports.getDescribeDescriptions = getDescribeDescriptions;
|
|
17
17
|
function failWrapper(func, exitCodeOnError = 1) {
|
|
18
18
|
return (parsed) => func(parsed).catch((error) => {
|
|
19
|
-
|
|
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'));
|
|
19
|
+
loggingProvider_1.logger.error(chalk.red.bold(error?.message ?? 'An unexpected error occurred'));
|
|
21
20
|
loggingProvider_1.logger.error(error.stack);
|
|
22
21
|
if (exitCodeOnError) {
|
|
23
22
|
process.exitCode = exitCodeOnError;
|
|
@@ -31,7 +30,7 @@ async function getWorkspaceId(parsed) {
|
|
|
31
30
|
return workspaceId;
|
|
32
31
|
}
|
|
33
32
|
const configuredWorkspace = await cliConfigProvider_1.CliConfigProvider.getWorkspace();
|
|
34
|
-
if (configuredWorkspace
|
|
33
|
+
if (configuredWorkspace?.id) {
|
|
35
34
|
return configuredWorkspace.id;
|
|
36
35
|
}
|
|
37
36
|
throw new Error('Please specify a workspace ID (--workspace-id) or configure a default in the CLI (mabl config set workspace <id>)');
|
|
@@ -39,7 +38,7 @@ async function getWorkspaceId(parsed) {
|
|
|
39
38
|
exports.getWorkspaceId = getWorkspaceId;
|
|
40
39
|
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.`;
|
|
41
40
|
async function getJourneyFlowArray(journey, apiClient, branchName) {
|
|
42
|
-
if (!journey.flows
|
|
41
|
+
if (!journey.flows?.length) {
|
|
43
42
|
throw new Error(exports.TEST_WITHOUT_FLOWS_MESSAGE);
|
|
44
43
|
}
|
|
45
44
|
const flows = {};
|
|
@@ -7,12 +7,11 @@ function nodeVersionToString(nodeVersion) {
|
|
|
7
7
|
exports.nodeVersionToString = nodeVersionToString;
|
|
8
8
|
const NODE_VERSION_REGEX = /(\d+)\.(\d+)(\.(\d+))?/;
|
|
9
9
|
function extractNodeVersionTuple(stringWithVersion) {
|
|
10
|
-
|
|
11
|
-
const matches = stringWithVersion === null || stringWithVersion === void 0 ? void 0 : stringWithVersion.match(NODE_VERSION_REGEX);
|
|
10
|
+
const matches = stringWithVersion?.match(NODE_VERSION_REGEX);
|
|
12
11
|
return {
|
|
13
|
-
major: parseInt(
|
|
14
|
-
minor: parseInt(
|
|
15
|
-
point: parseInt(
|
|
12
|
+
major: parseInt(matches?.[1] ?? '0'),
|
|
13
|
+
minor: parseInt(matches?.[2] ?? '0'),
|
|
14
|
+
point: parseInt(matches?.[4] ?? '0'),
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
17
|
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?.id;
|
|
27
|
+
details = maybeWorkspace?.name;
|
|
28
28
|
break;
|
|
29
29
|
default:
|
|
30
30
|
value = await cliConfigProvider_1.CliConfigProvider.getConfigProperty(propertyKey);
|
package/commands/constants.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CommandArgContentTypes = exports.CommandArgPreview = exports.CommandArgOutputFilePath = exports.CommandArgOutput = exports.CommandArgNoPrompt = exports.CommandArgPrompt = exports.CommandArgPortNumber = exports.CommandArgName = exports.CommandArgMablBranchChangesOnly = exports.CommandArgMablBranch = exports.CommandArgMablAutoLogin = exports.CommandArgMablAutoBranch = exports.CommandArgLinkBypass = exports.CommandArgLinkLabel = exports.CommandArgLimitOutput = exports.CommandArgLabels = exports.CommandArgLabelsInclude = exports.CommandArgLabelsExclude = exports.CommandArgTestInteractionSpeed = exports.CommandArgTestRunId = exports.CommandArgTestFile = exports.CommandArgKeepBrowserOpen = exports.CommandArgInput = exports.CommandArgId = exports.CommandArgUserAgent = exports.CommandArgHttpHeaders = exports.CommandArgHelp = exports.CommandArgHeadless = exports.CommandArgFromPlanId = exports.CommandArgFrom = exports.CommandArgFormat = exports.CommandArgFindPath = exports.CommandArgFastFailure = exports.CommandArgOverrideEnvironmentId = exports.CommandArgExistingReport = exports.CommandArgEnvironmentId = exports.CommandArgEnableLink = exports.CommandArgDetailLevel = exports.CommandArgDescription = exports.CommandArgDeploymentId = exports.CommandArgDecrypt = exports.CommandArgDataTables = exports.CommandArgDataTableId = exports.CommandArgCredentials = exports.CommandArgBasicAuthCredentials = exports.CommandArgBrowsers = exports.CommandArgBrowser = exports.CommandArgApplicationId = exports.CommandArgApiKey = exports.CommandArgABConfigFile = void 0;
|
|
4
|
-
exports.SCENARIO_ID_HEADER = exports.SCENARIO_NAME_HEADER = exports.ValidBrowserTypesForLocalRuns = exports.BrowserTypeSelections = exports.DefaultBrowserType = exports.DefaultBranchName = exports.DefaultOutputFormatChoices = exports.DetailLevelFormats = exports.ReporterOptions = exports.OutputFormats = exports.CommandArgAliases = exports.CommandArgBrowserEnableExtensions = exports.CommandArgBrowserIgnoreCertificateErrors = exports.CommandArgBrowserDisableIsolation = exports.ListTimeFormat = exports.CommandArgScenarioId = exports.CommandArgReporterOptions = exports.CommandArgReporter = exports.CommandArgWorkspaceId = exports.CommandArgVersion = exports.CommandArgVariables = exports.CommandArgUrlApi = exports.CommandArgUrlApp = exports.CommandArgUrl = exports.CommandArgTrainerVersion = exports.CommandArgTo = exports.CommandArgSilent = exports.CommandArgRevision = exports.CommandArgMaxHeartbeatAge = exports.CommandArgPlanId = void 0;
|
|
4
|
+
exports.SCENARIO_ID_HEADER = exports.SCENARIO_NAME_HEADER = exports.ValidBrowserTypesForLocalRuns = exports.BrowserTypeSelections = exports.DefaultBrowserType = exports.DefaultBranchName = exports.DefaultOutputFormatChoices = exports.DetailLevelFormats = exports.ReporterOptions = exports.OutputFormats = exports.CommandArgAliases = exports.CommandArgBrowserEnableExtensions = exports.CommandArgBrowserIgnoreCertificateErrors = exports.CommandArgBrowserDisableIsolation = exports.ListTimeFormat = exports.CommandArgTimezoneID = exports.CommandArgLocale = exports.CommandArgScenarioId = exports.CommandArgReporterOptions = exports.CommandArgReporter = exports.CommandArgWorkspaceId = exports.CommandArgVersion = exports.CommandArgVariables = exports.CommandArgUrlApi = exports.CommandArgUrlApp = exports.CommandArgUrl = exports.CommandArgTrainerVersion = exports.CommandArgTo = exports.CommandArgSilent = exports.CommandArgRevision = exports.CommandArgMaxHeartbeatAge = exports.CommandArgPlanId = void 0;
|
|
5
5
|
const browserTypes_1 = require("./browserTypes");
|
|
6
6
|
exports.CommandArgABConfigFile = 'ab-config-file';
|
|
7
7
|
exports.CommandArgApiKey = 'api-key';
|
|
@@ -68,6 +68,8 @@ exports.CommandArgWorkspaceId = 'workspace-id';
|
|
|
68
68
|
exports.CommandArgReporter = 'reporter';
|
|
69
69
|
exports.CommandArgReporterOptions = 'reporter-options';
|
|
70
70
|
exports.CommandArgScenarioId = 'scenario-id';
|
|
71
|
+
exports.CommandArgLocale = 'locale';
|
|
72
|
+
exports.CommandArgTimezoneID = 'timezone-id';
|
|
71
73
|
exports.ListTimeFormat = 'MMM Do YYYY, HH:mm:ss';
|
|
72
74
|
exports.CommandArgBrowserDisableIsolation = 'browser-disable-isolation';
|
|
73
75
|
exports.CommandArgBrowserIgnoreCertificateErrors = 'browser-ignore-certificate-errors';
|
|
@@ -34,10 +34,9 @@ exports.builder = (yargs) => {
|
|
|
34
34
|
};
|
|
35
35
|
exports.handler = (0, util_1.failWrapper)(createDataTable);
|
|
36
36
|
async function createDataTable(parsed) {
|
|
37
|
-
var _a, _b;
|
|
38
37
|
const { input } = parsed;
|
|
39
|
-
const format =
|
|
40
|
-
const name =
|
|
38
|
+
const format = parsed.format ?? (0, utils_1.inferFileFormat)(input);
|
|
39
|
+
const name = parsed.name ?? (0, path_1.basename)((0, path_1.resolve)(input));
|
|
41
40
|
const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
|
|
42
41
|
let scenarios = [];
|
|
43
42
|
switch (format) {
|
|
@@ -25,12 +25,11 @@ exports.builder = (yargs) => {
|
|
|
25
25
|
};
|
|
26
26
|
exports.handler = (0, util_1.failWrapper)(exportDataTable);
|
|
27
27
|
async function exportDataTable(parsed) {
|
|
28
|
-
var _a;
|
|
29
28
|
const dataTableId = parsed.id;
|
|
30
29
|
const format = parsed.format;
|
|
31
30
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
32
31
|
const scenarioQueryResult = await apiClient.queryScenarios(dataTableId);
|
|
33
|
-
const scenarios =
|
|
32
|
+
const scenarios = scenarioQueryResult.scenarios ?? [];
|
|
34
33
|
let output = '';
|
|
35
34
|
switch (format) {
|
|
36
35
|
case constants_1.OutputFormats.Json:
|
|
@@ -72,13 +71,12 @@ function dumpToCsv(scenarios) {
|
|
|
72
71
|
];
|
|
73
72
|
output.push(headers);
|
|
74
73
|
scenarios.forEach((scenario) => {
|
|
75
|
-
|
|
76
|
-
const variables = (_a = scenario.variables) !== null && _a !== void 0 ? _a : [];
|
|
74
|
+
const variables = scenario.variables ?? [];
|
|
77
75
|
const sanitizedRowValues = [
|
|
78
76
|
scenario.id,
|
|
79
77
|
scenario.name,
|
|
80
78
|
...variables.map((variable) => variable.value || ''),
|
|
81
|
-
].map((val) => (0, utils_1.sanitizeCsvCellInput)(val
|
|
79
|
+
].map((val) => (0, utils_1.sanitizeCsvCellInput)(val ?? ''));
|
|
82
80
|
output.push(sanitizedRowValues);
|
|
83
81
|
});
|
|
84
82
|
return (0, sync_1.stringify)(output);
|
|
@@ -8,11 +8,10 @@ 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;
|
|
12
11
|
const output = parsed.output;
|
|
13
12
|
const limit = parsed.limit;
|
|
14
13
|
const workspaceId = await (0, util_1.getWorkspaceId)(parsed);
|
|
15
14
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
16
15
|
const queryResult = await apiClient.queryDataTables(workspaceId, limit);
|
|
17
|
-
(0, list_1.outputEntities)(
|
|
16
|
+
(0, list_1.outputEntities)(queryResult.dataTables ?? [], output);
|
|
18
17
|
}
|
|
@@ -25,11 +25,10 @@ exports.builder = (yargs) => {
|
|
|
25
25
|
};
|
|
26
26
|
exports.handler = (0, util_1.failWrapper)(dataTableScenarios);
|
|
27
27
|
async function dataTableScenarios(parsed) {
|
|
28
|
-
var _a;
|
|
29
28
|
const output = parsed.output;
|
|
30
29
|
const dataTableId = parsed.id;
|
|
31
30
|
const limit = parsed.limit;
|
|
32
31
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
33
32
|
const queryResult = await apiClient.queryScenarios(dataTableId, limit);
|
|
34
|
-
(0, list_1.outputEntities)(
|
|
33
|
+
(0, list_1.outputEntities)(queryResult.scenarios ?? [], output);
|
|
35
34
|
}
|
|
@@ -33,9 +33,8 @@ exports.builder = (yargs) => {
|
|
|
33
33
|
};
|
|
34
34
|
exports.handler = (0, util_1.failWrapper)(updateDataTable);
|
|
35
35
|
async function updateDataTable(parsed) {
|
|
36
|
-
var _a;
|
|
37
36
|
const { id: dataTableId, input } = parsed;
|
|
38
|
-
const format =
|
|
37
|
+
const format = parsed.format ?? (0, utils_1.inferFileFormat)(input);
|
|
39
38
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
40
39
|
const dataTable = await apiClient.getDataTable(dataTableId);
|
|
41
40
|
let scenarios;
|
|
@@ -53,23 +52,21 @@ async function updateDataTable(parsed) {
|
|
|
53
52
|
await apiClient.updateDataTable(dataTableId, request);
|
|
54
53
|
}
|
|
55
54
|
function buildUpdateRequest(scenarios, dataTable) {
|
|
56
|
-
var _a, _b, _c;
|
|
57
55
|
if (scenarios.length === 0 || !scenarios) {
|
|
58
56
|
throw Error('Must have at least 1 scenario in DataTable.');
|
|
59
57
|
}
|
|
60
58
|
const validationVariables = scenarios[0].variables;
|
|
61
59
|
scenarios.forEach((scenario) => {
|
|
62
|
-
|
|
63
|
-
if (scenario.id && !((_a = dataTable.scenario_ids) === null || _a === void 0 ? void 0 : _a.includes(scenario.id))) {
|
|
60
|
+
if (scenario.id && !dataTable.scenario_ids?.includes(scenario.id)) {
|
|
64
61
|
throw Error(`Scenario in input with ID ${scenario.id} does not exist in DataTable scenario_ids.`);
|
|
65
62
|
}
|
|
66
|
-
if (
|
|
63
|
+
if (scenario.variables?.length === 0 || !scenario.variables) {
|
|
67
64
|
throw Error('Must have at least 1 variable in a scenario.');
|
|
68
65
|
}
|
|
69
|
-
if (scenario.variables.length !==
|
|
66
|
+
if (scenario.variables.length !== validationVariables?.length) {
|
|
70
67
|
throw Error('All scenarios must have the same number of variables.');
|
|
71
68
|
}
|
|
72
|
-
|
|
69
|
+
scenario.variables?.forEach((variable, index) => {
|
|
73
70
|
if (!(0, domUtil_1.isValidUserVariableName)(variable.name)) {
|
|
74
71
|
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"`);
|
|
75
72
|
}
|
|
@@ -84,14 +81,17 @@ function buildUpdateRequest(scenarios, dataTable) {
|
|
|
84
81
|
acc[scenario.id] = scenario;
|
|
85
82
|
return acc;
|
|
86
83
|
}, {});
|
|
87
|
-
const updatedRows =
|
|
84
|
+
const updatedRows = dataTable.scenario_ids
|
|
85
|
+
?.filter((id) => parsedScenarioMap[id] !== undefined)
|
|
86
|
+
.map((id) => {
|
|
88
87
|
const variableRow = (0, utils_1.scenarioAsVariableRow)(parsedScenarioMap[id]);
|
|
89
88
|
return {
|
|
90
89
|
id: variableRow.id || '',
|
|
91
90
|
scenario_id: variableRow.scenario_id || '',
|
|
92
91
|
row: variableRow.row || [],
|
|
93
92
|
};
|
|
94
|
-
})
|
|
93
|
+
})
|
|
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 =
|
|
108
|
+
const deletedRowIds = dataTable.scenario_ids?.filter((id) => !updatedRowIds.includes(id)) ?? [];
|
|
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?.id,
|
|
118
|
+
table_id: scenario?.table_id,
|
|
119
|
+
created_time: scenario?.created_time,
|
|
120
|
+
created_by_id: scenario?.created_by_id,
|
|
121
|
+
last_updated_time: scenario?.last_updated_time,
|
|
122
|
+
last_updated_by_id: scenario?.last_updated_by_id,
|
|
123
|
+
organization_id: scenario?.workspace_id,
|
|
124
|
+
scenario_id: scenario?.name,
|
|
125
|
+
row: scenario?.variables,
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
exports.scenarioAsVariableRow = scenarioAsVariableRow;
|
|
@@ -15,13 +15,12 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
15
15
|
this.isSilent = !!isSilent;
|
|
16
16
|
}
|
|
17
17
|
async pollingFunction(mablApi, lastEntity, seedId) {
|
|
18
|
-
var _a, _b;
|
|
19
18
|
if (!seedId) {
|
|
20
19
|
throw new Error('event id must be passed');
|
|
21
20
|
}
|
|
22
21
|
const latestResults = await mablApi.getDeploymentResults(seedId);
|
|
23
22
|
if (this.exitOnFirstFailure) {
|
|
24
|
-
if (
|
|
23
|
+
if (latestResults.plan_execution_metrics?.failed ?? 0 > 0) {
|
|
25
24
|
this.exitOnFirstFailurePresenter(latestResults);
|
|
26
25
|
return {
|
|
27
26
|
newEntity: latestResults,
|
|
@@ -29,8 +28,8 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
|
-
const hasOutcomePayload =
|
|
33
|
-
Object.keys(latestResults
|
|
31
|
+
const hasOutcomePayload = latestResults?.event_status &&
|
|
32
|
+
Object.keys(latestResults?.event_status).length > 0;
|
|
34
33
|
const status = hasOutcomePayload
|
|
35
34
|
? awaitCompletion_1.PollingOutcomeType.Complete
|
|
36
35
|
: awaitCompletion_1.PollingOutcomeType.Running;
|
|
@@ -40,14 +39,13 @@ class AwaitDeploymentCompletion extends awaitCompletion_1.AwaitCompletion {
|
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
41
|
statusPresenter(lastEntity) {
|
|
43
|
-
var _a, _b, _c, _d, _e, _f;
|
|
44
42
|
if (this.isSilent) {
|
|
45
43
|
return;
|
|
46
44
|
}
|
|
47
45
|
const elapsedTimeString = (0, timeUtil_1.elapsedTimeDurationToString)(this.getElapsedMilliseconds());
|
|
48
|
-
const passed =
|
|
49
|
-
const failed =
|
|
50
|
-
const total =
|
|
46
|
+
const passed = lastEntity.plan_execution_metrics?.passed ?? 0;
|
|
47
|
+
const failed = lastEntity.plan_execution_metrics?.failed ?? 0;
|
|
48
|
+
const total = lastEntity.plan_execution_metrics?.total ?? 0;
|
|
51
49
|
const passedColor = passed === 0 ? 'gray' : 'green';
|
|
52
50
|
const failedColor = failed === 0 ? 'gray' : 'red';
|
|
53
51
|
let totalColor = 'gray';
|
|
@@ -189,7 +189,6 @@ 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;
|
|
193
192
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClientFromOptionalApiKey(parsed['api-key']);
|
|
194
193
|
if (parsed.output) {
|
|
195
194
|
parsed.silent = true;
|
|
@@ -204,7 +203,7 @@ async function createDeployment(parsed) {
|
|
|
204
203
|
const environmentOverride = parsed[constants_1.CommandArgOverrideEnvironmentId];
|
|
205
204
|
let deploymentIds;
|
|
206
205
|
if (environmentOverride) {
|
|
207
|
-
deploymentIds = (
|
|
206
|
+
deploymentIds = (await apiClient.queryDeploymentEntities(workspaceId, environmentOverride, applicationId)).deployments?.map((deployment) => deployment.id);
|
|
208
207
|
if (!deploymentIds || deploymentIds.length === 0) {
|
|
209
208
|
loggingProvider_1.logger.error(chalk.red.bold(`Application ${applicationId} is not defined in override environment ${environmentOverride}`));
|
|
210
209
|
process.exit(1);
|
|
@@ -242,7 +241,7 @@ async function createDeployment(parsed) {
|
|
|
242
241
|
}
|
|
243
242
|
const waiter = new awaitDeploymentCompletion_1.AwaitDeploymentCompletion(apiClient, parsed['fast-failure'], parsed.silent);
|
|
244
243
|
const pollingResult = await waiter.awaitCompletion(deploymentEvent.id);
|
|
245
|
-
const isSuccess =
|
|
244
|
+
const isSuccess = pollingResult?.newEntity?.event_status?.succeeded || false;
|
|
246
245
|
try {
|
|
247
246
|
await (0, codeInsights_1.maybeOutputToBitbucket)(pollingResult.newEntity, deploymentEvent.id, outputWebappLink);
|
|
248
247
|
}
|
|
@@ -250,7 +249,7 @@ async function createDeployment(parsed) {
|
|
|
250
249
|
loggingProvider_1.logger.info(chalk.yellow.bold('Unable to generate code insights due to BitBucket integration API error'));
|
|
251
250
|
loggingProvider_1.logger.info(`details: ${error}`);
|
|
252
251
|
}
|
|
253
|
-
const textOutput = printDeploymentEventResultOutput(deploymentEvent.id, outputWebappLink, parsed.output, pollingResult
|
|
252
|
+
const textOutput = printDeploymentEventResultOutput(deploymentEvent.id, outputWebappLink, parsed.output, pollingResult?.newEntity);
|
|
254
253
|
if (!isSuccess) {
|
|
255
254
|
process.exit(1);
|
|
256
255
|
}
|
|
@@ -272,20 +271,19 @@ function printDeploymentEventResultOutput(deploymentEventId, outputWebappLink, o
|
|
|
272
271
|
}
|
|
273
272
|
exports.printDeploymentEventResultOutput = printDeploymentEventResultOutput;
|
|
274
273
|
async function collectSourceControlMetadataIfEnabled(parsed) {
|
|
275
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
276
274
|
const userSuppliedRepositoryUrl = parsed['repository-url'];
|
|
277
275
|
if (await cliConfigProvider_1.CliConfigProvider.getConfigProperty(configKeys_1.configKeys.enableSourceControlMetadataCollection)) {
|
|
278
276
|
const buildInfo = await new scmContextProvider_1.ScmContextProvider(process.env).extractScmAndBuildInfo();
|
|
279
|
-
const sourceControlBranch =
|
|
280
|
-
const sourceControlTag =
|
|
277
|
+
const sourceControlBranch = buildInfo?.scmInfo?.branchName || buildInfo?.buildInfo?.branchName;
|
|
278
|
+
const sourceControlTag = buildInfo?.scmInfo?.tagName || buildInfo?.buildInfo?.tagName;
|
|
281
279
|
const sourceControlRepoUrl = userSuppliedRepositoryUrl ||
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const sourceControlRepoName =
|
|
280
|
+
buildInfo?.scmInfo?.repoUrl ||
|
|
281
|
+
buildInfo?.buildInfo?.repoUrl;
|
|
282
|
+
const sourceControlRepoName = buildInfo?.scmInfo?.repoName || buildInfo?.buildInfo?.repoName;
|
|
285
283
|
const revision = parsed.revision ||
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
buildInfo?.scmInfo?.commitSha ||
|
|
285
|
+
buildInfo?.buildInfo?.commitSha ||
|
|
286
|
+
buildInfo?.buildInfo?.revision;
|
|
289
287
|
return {
|
|
290
288
|
branchName: sourceControlBranch,
|
|
291
289
|
tag: sourceControlTag,
|
|
@@ -11,7 +11,6 @@ const timeUtil_1 = require("../../../util/timeUtil");
|
|
|
11
11
|
const chalk = require('chalk');
|
|
12
12
|
class ExecutionResultPresenter {
|
|
13
13
|
entityToString(results, columnWidth) {
|
|
14
|
-
var _a;
|
|
15
14
|
const columnLabels = [
|
|
16
15
|
'Plan Name',
|
|
17
16
|
'Test Name',
|
|
@@ -27,15 +26,14 @@ class ExecutionResultPresenter {
|
|
|
27
26
|
tableConfig.colWidths = Array(columnLabels.length - 1).fill(columnWidth);
|
|
28
27
|
}
|
|
29
28
|
const table = new cli_table3_1.default(tableConfig);
|
|
30
|
-
const finalExecutions =
|
|
29
|
+
const finalExecutions = results?.executions ?? [];
|
|
31
30
|
finalExecutions.forEach((summary) => {
|
|
32
|
-
|
|
33
|
-
const retryPrefix = ((_a = summary === null || summary === void 0 ? void 0 : summary.plan_execution) === null || _a === void 0 ? void 0 : _a.is_retry) ? '[Retry] ' : '';
|
|
31
|
+
const retryPrefix = summary?.plan_execution?.is_retry ? '[Retry] ' : '';
|
|
34
32
|
const planId = summary.plan.id;
|
|
35
|
-
const planName = retryPrefix + (
|
|
33
|
+
const planName = retryPrefix + (summary.plan?.name ?? '<plan name unavailable>');
|
|
36
34
|
const planRunStatus = summary.plan_execution.status;
|
|
37
35
|
const journeyMap = new Map();
|
|
38
|
-
|
|
36
|
+
summary?.journeys?.forEach((journeySummary) => journeyMap.set(journeySummary.id, journeySummary));
|
|
39
37
|
const statusChalk = this.mapPlanRunStatusToColor(planRunStatus);
|
|
40
38
|
table.push([
|
|
41
39
|
`${planName}`,
|
|
@@ -45,13 +43,12 @@ class ExecutionResultPresenter {
|
|
|
45
43
|
statusChalk(this.maybeCapitalize(planRunStatus.toString())),
|
|
46
44
|
summaryToElapsedTime(summary),
|
|
47
45
|
]);
|
|
48
|
-
|
|
49
|
-
var _a, _b, _c, _d;
|
|
46
|
+
summary?.journey_executions?.forEach((journeyRun) => {
|
|
50
47
|
const journeyId = journeyRun.journey_execution_id;
|
|
51
|
-
const journeyStatus = this.maybeCapitalize(
|
|
52
|
-
const journeyBrowser = this.maybeCapitalize(
|
|
48
|
+
const journeyStatus = this.maybeCapitalize(journeyRun.status?.toString() ?? '<status unavailable>');
|
|
49
|
+
const journeyBrowser = this.maybeCapitalize(journeyRun.browser_type ?? '<unknown browser>');
|
|
53
50
|
const journeySummary = journeyMap.get(journeyRun.journey_id);
|
|
54
|
-
const journeyName = `${retryPrefix}${
|
|
51
|
+
const journeyName = `${retryPrefix}${journeySummary?.name ?? '<test name >'}`;
|
|
55
52
|
const statusChalk = this.mapJourneyRunStatusToColor(journeyRun.status);
|
|
56
53
|
table.push([
|
|
57
54
|
'',
|
|
@@ -37,7 +37,6 @@ 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;
|
|
41
40
|
table.push([
|
|
42
41
|
{ rowSpan: 2, content: deployment.id, vAlign: 'center' },
|
|
43
42
|
{
|
|
@@ -50,19 +49,19 @@ function printDeployments(deployments, output) {
|
|
|
50
49
|
deployment.application_id || 'none',
|
|
51
50
|
{
|
|
52
51
|
rowSpan: 2,
|
|
53
|
-
content:
|
|
52
|
+
content: deployment.run_result?.journey_execution_metrics?.passed,
|
|
54
53
|
vAlign: 'center',
|
|
55
54
|
hAlign: 'center',
|
|
56
55
|
},
|
|
57
56
|
{
|
|
58
57
|
rowSpan: 2,
|
|
59
|
-
content:
|
|
58
|
+
content: deployment.run_result?.journey_execution_metrics?.failed,
|
|
60
59
|
vAlign: 'center',
|
|
61
60
|
hAlign: 'center',
|
|
62
61
|
},
|
|
63
62
|
{
|
|
64
63
|
rowSpan: 2,
|
|
65
|
-
content:
|
|
64
|
+
content: deployment.run_result?.journey_execution_metrics?.total,
|
|
66
65
|
vAlign: 'center',
|
|
67
66
|
hAlign: 'center',
|
|
68
67
|
},
|
|
@@ -29,14 +29,13 @@ exports.builder = (yargs) => {
|
|
|
29
29
|
};
|
|
30
30
|
exports.handler = (0, util_1.failWrapper)(getWatch);
|
|
31
31
|
async function getWatch(parsed) {
|
|
32
|
-
var _a, _b;
|
|
33
32
|
const deploymentId = parsed.id;
|
|
34
33
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
35
34
|
const deploymentEvent = await apiClient.getDeploymentEvent(deploymentId);
|
|
36
35
|
const outputWebappLink = (0, create_1.getDeploymentEventWebappUrl)(deploymentEvent);
|
|
37
36
|
const waiter = new awaitDeploymentCompletion_1.AwaitDeploymentCompletion(apiClient, parsed['fast-failure'], parsed.silent);
|
|
38
37
|
const pollingResult = await waiter.awaitCompletion(deploymentEvent.id);
|
|
39
|
-
const isSuccess =
|
|
38
|
+
const isSuccess = pollingResult?.newEntity?.event_status?.succeeded || false;
|
|
40
39
|
if (!isSuccess) {
|
|
41
40
|
process.exit(1);
|
|
42
41
|
}
|
|
@@ -98,7 +98,6 @@ function addUpdateEnvCommands(argv) {
|
|
|
98
98
|
}
|
|
99
99
|
exports.addUpdateEnvCommands = addUpdateEnvCommands;
|
|
100
100
|
async function createEnvironment(parsed) {
|
|
101
|
-
var _a;
|
|
102
101
|
let environment;
|
|
103
102
|
try {
|
|
104
103
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
@@ -121,7 +120,7 @@ async function createEnvironment(parsed) {
|
|
|
121
120
|
variables: parsed[constants_1.CommandArgVariables],
|
|
122
121
|
};
|
|
123
122
|
environment = await apiClient.createEnvironment(environment);
|
|
124
|
-
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(
|
|
123
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(environment.id ?? '')} CREATED`));
|
|
125
124
|
const applicationId = parsed[constants_1.CommandArgApplicationId];
|
|
126
125
|
if (applicationId) {
|
|
127
126
|
loggingProvider_1.logger.info('Associating URLs with environment');
|
|
@@ -18,12 +18,11 @@ exports.builder = (yargs) => {
|
|
|
18
18
|
};
|
|
19
19
|
exports.handler = (0, util_1.failWrapper)(deleteEnvironment);
|
|
20
20
|
async function deleteEnvironment(parsed) {
|
|
21
|
-
var _a;
|
|
22
21
|
let environment;
|
|
23
22
|
try {
|
|
24
23
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
25
24
|
environment = await apiClient.deleteEnvironment(parsed.id);
|
|
26
|
-
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(
|
|
25
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(environment.id ?? '')} DELETED`));
|
|
27
26
|
}
|
|
28
27
|
catch (error) {
|
|
29
28
|
throw new Error(`Error deleting environment: ${error}`);
|
|
@@ -21,7 +21,6 @@ exports.builder = (yargs) => {
|
|
|
21
21
|
};
|
|
22
22
|
exports.handler = (0, util_1.failWrapper)(updateEnvironment);
|
|
23
23
|
async function updateEnvironment(parsed) {
|
|
24
|
-
var _a;
|
|
25
24
|
let environment;
|
|
26
25
|
try {
|
|
27
26
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
@@ -37,7 +36,7 @@ async function updateEnvironment(parsed) {
|
|
|
37
36
|
variables: parsed[constants_1.CommandArgVariables],
|
|
38
37
|
};
|
|
39
38
|
environment = await apiClient.updateEnvironment(parsed[constants_1.CommandArgId], environment);
|
|
40
|
-
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(
|
|
39
|
+
loggingProvider_1.logger.info(chalk_1.default.green(`Environment ${chalk_1.default.bold(environment.id ?? '')} UPDATED`));
|
|
41
40
|
}
|
|
42
41
|
catch (error) {
|
|
43
42
|
throw new Error(`Error updating environment: ${error}`);
|
|
@@ -35,11 +35,10 @@ exports.builder = (yargs) => {
|
|
|
35
35
|
};
|
|
36
36
|
exports.handler = (0, util_1.failWrapper)(queryDeployments);
|
|
37
37
|
async function queryDeployments(parsed) {
|
|
38
|
-
var _a;
|
|
39
38
|
const apiClient = await mablApiClientFactory_1.MablApiClientFactory.createApiClient();
|
|
40
39
|
try {
|
|
41
40
|
const environment = await apiClient.getEnvironment(parsed.id);
|
|
42
|
-
const deploymentEntities = await apiClient.queryDeploymentEntities(
|
|
41
|
+
const deploymentEntities = await apiClient.queryDeploymentEntities(environment.organization_id ?? '', environment.id, parsed[constants_1.CommandArgApplicationId], parsed.limit);
|
|
43
42
|
(0, describe_1.outputEntity)(deploymentEntities.deployments, parsed.output);
|
|
44
43
|
}
|
|
45
44
|
catch (error) {
|