@mablhq/mabl-cli 1.58.25 → 1.59.5
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 +54 -43
- package/api/mablApiClientFactory.js +1 -1
- package/auth/OktaClient.js +2 -1
- package/browserEngines/chromiumBrowserEngine.js +2 -2
- 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/cloudMonitoringPerformanceMetrics.js +28 -56
- package/browserTestMonitoring/distributions.js +1 -6
- package/browserTestMonitoring/metricsRecorder.js +47 -30
- 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 +5 -4
- package/commands/plans/plans_cmds/describe.js +2 -1
- package/commands/tests/mobileEmulationUtil.js +7 -5
- package/commands/tests/testsUtil.js +46 -42
- 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 +34 -15
- package/commands/tests/tests_cmds/run.js +11 -11
- 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 +32 -16
- 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/mablApi/index.js +1 -1
- 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 +3 -3
- 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
|
@@ -69,6 +69,11 @@ class CloudMonitoringPerformanceMetrics {
|
|
|
69
69
|
...this.generateCommonInstrumentNames('test'),
|
|
70
70
|
executionTime: this.generateInstrumentName('test', 'execution', 'time'),
|
|
71
71
|
runnerCount: this.generateCountInstrumentName('test', 'runner'),
|
|
72
|
+
firstContentfulPaintFailCount: this.generateCWVFailCountInstrumentName('test', 'firstContentfulPaint'),
|
|
73
|
+
largestContentfulPaintFailCount: this.generateCWVFailCountInstrumentName('test', 'largestContentfulPaint'),
|
|
74
|
+
cumulativeLayoutShiftFailCount: this.generateCWVFailCountInstrumentName('test', 'cumulativeLayoutShift'),
|
|
75
|
+
timeToFirstByteFailCount: this.generateCWVFailCountInstrumentName('test', 'timeToFirstByte'),
|
|
76
|
+
domContentLoadedFailCount: this.generateCWVFailCountInstrumentName('test', 'domContentLoaded'),
|
|
72
77
|
};
|
|
73
78
|
}
|
|
74
79
|
initializeOpenTelemetry() {
|
|
@@ -105,26 +110,6 @@ class CloudMonitoringPerformanceMetrics {
|
|
|
105
110
|
aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(distributions_1.DCLBucketBoundaries, true),
|
|
106
111
|
instrumentName: this.stepMetricsInstrumentNames.domContentLoaded,
|
|
107
112
|
}),
|
|
108
|
-
firstContentfulPaintCategory: new sdk_metrics_1.View({
|
|
109
|
-
aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(distributions_1.FCPCategoryBucketBoundaries, false),
|
|
110
|
-
instrumentName: this.stepMetricsInstrumentNames.firstContentfulPaintCategory,
|
|
111
|
-
}),
|
|
112
|
-
largestContentfulPaintCategory: new sdk_metrics_1.View({
|
|
113
|
-
aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(distributions_1.LCPCategoryBucketBoundaries, false),
|
|
114
|
-
instrumentName: this.stepMetricsInstrumentNames.largestContentfulPaintCategory,
|
|
115
|
-
}),
|
|
116
|
-
cumulativeLayoutShiftCategory: new sdk_metrics_1.View({
|
|
117
|
-
aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(distributions_1.CLSCategoryBucketBoundaries, false),
|
|
118
|
-
instrumentName: this.stepMetricsInstrumentNames.cumulativeLayoutShiftCategory,
|
|
119
|
-
}),
|
|
120
|
-
timeToFirstByteCategory: new sdk_metrics_1.View({
|
|
121
|
-
aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(distributions_1.TTFBCategoryBucketBoundaries, false),
|
|
122
|
-
instrumentName: this.stepMetricsInstrumentNames.timeToFirstByteCategory,
|
|
123
|
-
}),
|
|
124
|
-
domContentLoadedCategory: new sdk_metrics_1.View({
|
|
125
|
-
aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(distributions_1.DCLCategoryBucketBoundaries, false),
|
|
126
|
-
instrumentName: this.stepMetricsInstrumentNames.domContentLoadedCategory,
|
|
127
|
-
}),
|
|
128
113
|
};
|
|
129
114
|
const TestMetricsViews = {
|
|
130
115
|
executionCount: new sdk_metrics_1.View({
|
|
@@ -147,25 +132,25 @@ class CloudMonitoringPerformanceMetrics {
|
|
|
147
132
|
aggregation: new sdk_metrics_1.LastValueAggregation(),
|
|
148
133
|
instrumentName: this.testMetricsInstrumentNames.runnerCount,
|
|
149
134
|
}),
|
|
150
|
-
|
|
151
|
-
aggregation: new sdk_metrics_1.
|
|
152
|
-
instrumentName: this.
|
|
135
|
+
firstContentfulPaintFailCount: new sdk_metrics_1.View({
|
|
136
|
+
aggregation: new sdk_metrics_1.SumAggregation(),
|
|
137
|
+
instrumentName: this.testMetricsInstrumentNames.firstContentfulPaintFailCount,
|
|
153
138
|
}),
|
|
154
|
-
|
|
155
|
-
aggregation: new sdk_metrics_1.
|
|
156
|
-
instrumentName: this.
|
|
139
|
+
largestContentfulPaintFailCount: new sdk_metrics_1.View({
|
|
140
|
+
aggregation: new sdk_metrics_1.SumAggregation(),
|
|
141
|
+
instrumentName: this.testMetricsInstrumentNames.largestContentfulPaintFailCount,
|
|
157
142
|
}),
|
|
158
|
-
|
|
159
|
-
aggregation: new sdk_metrics_1.
|
|
160
|
-
instrumentName: this.
|
|
143
|
+
cumulativeLayoutShiftFailCount: new sdk_metrics_1.View({
|
|
144
|
+
aggregation: new sdk_metrics_1.SumAggregation(),
|
|
145
|
+
instrumentName: this.testMetricsInstrumentNames.cumulativeLayoutShiftFailCount,
|
|
161
146
|
}),
|
|
162
|
-
|
|
163
|
-
aggregation: new sdk_metrics_1.
|
|
164
|
-
instrumentName: this.
|
|
147
|
+
timeToFirstByteFailCount: new sdk_metrics_1.View({
|
|
148
|
+
aggregation: new sdk_metrics_1.SumAggregation(),
|
|
149
|
+
instrumentName: this.testMetricsInstrumentNames.timeToFirstByteFailCount,
|
|
165
150
|
}),
|
|
166
|
-
|
|
167
|
-
aggregation: new sdk_metrics_1.
|
|
168
|
-
instrumentName: this.
|
|
151
|
+
domContentLoadedFailCount: new sdk_metrics_1.View({
|
|
152
|
+
aggregation: new sdk_metrics_1.SumAggregation(),
|
|
153
|
+
instrumentName: this.testMetricsInstrumentNames.domContentLoadedFailCount,
|
|
169
154
|
}),
|
|
170
155
|
};
|
|
171
156
|
const meterProvider = new sdk_metrics_1.MeterProvider({
|
|
@@ -200,11 +185,6 @@ class CloudMonitoringPerformanceMetrics {
|
|
|
200
185
|
cumulativeLayoutShift: this.initializeStepTimeHistogram('cumulativeLayoutShift'),
|
|
201
186
|
timeToFirstByte: this.initializeStepTimeHistogram('timeToFirstByte'),
|
|
202
187
|
domContentLoaded: this.initializeStepTimeHistogram('domContentLoaded'),
|
|
203
|
-
firstContentfulPaintCategory: this.initializeStepTimeHistogram('firstContentfulPaintCategory'),
|
|
204
|
-
largestContentfulPaintCategory: this.initializeStepTimeHistogram('largestContentfulPaintCategory'),
|
|
205
|
-
cumulativeLayoutShiftCategory: this.initializeStepTimeHistogram('cumulativeLayoutShiftCategory'),
|
|
206
|
-
timeToFirstByteCategory: this.initializeStepTimeHistogram('timeToFirstByteCategory'),
|
|
207
|
-
domContentLoadedCategory: this.initializeStepTimeHistogram('domContentLoadedCategory'),
|
|
208
188
|
};
|
|
209
189
|
}
|
|
210
190
|
initializeTestMetrics() {
|
|
@@ -214,11 +194,11 @@ class CloudMonitoringPerformanceMetrics {
|
|
|
214
194
|
failCount: this.initializeTestCount('failCount'),
|
|
215
195
|
passCount: this.initializeTestCount('passCount'),
|
|
216
196
|
runnerCount: this.initializeTestCount('runnerCount'),
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
197
|
+
firstContentfulPaintFailCount: this.initializeTestCount('firstContentfulPaintFailCount'),
|
|
198
|
+
largestContentfulPaintFailCount: this.initializeTestCount('largestContentfulPaintFailCount'),
|
|
199
|
+
cumulativeLayoutShiftFailCount: this.initializeTestCount('cumulativeLayoutShiftFailCount'),
|
|
200
|
+
timeToFirstByteFailCount: this.initializeTestCount('timeToFirstByteFailCount'),
|
|
201
|
+
domContentLoadedFailCount: this.initializeTestCount('domContentLoadedFailCount'),
|
|
222
202
|
};
|
|
223
203
|
}
|
|
224
204
|
initializeStepCount(instrumentName) {
|
|
@@ -240,10 +220,7 @@ class CloudMonitoringPerformanceMetrics {
|
|
|
240
220
|
}
|
|
241
221
|
initializeTimeHistogram(instrumentName) {
|
|
242
222
|
const histogram = this.meter.createHistogram(instrumentName, {
|
|
243
|
-
unit: instrumentName ===
|
|
244
|
-
this.stepMetricsInstrumentNames.cumulativeLayoutShift ||
|
|
245
|
-
instrumentName ===
|
|
246
|
-
this.stepMetricsInstrumentNames.cumulativeLayoutShiftCategory
|
|
223
|
+
unit: instrumentName === this.stepMetricsInstrumentNames.cumulativeLayoutShift
|
|
247
224
|
? undefined
|
|
248
225
|
: 'ms',
|
|
249
226
|
});
|
|
@@ -254,11 +231,6 @@ class CloudMonitoringPerformanceMetrics {
|
|
|
254
231
|
executionCount: this.generateCountInstrumentName(granularity, 'execution'),
|
|
255
232
|
failCount: this.generateResultInstrumentName(granularity, 'fail'),
|
|
256
233
|
passCount: this.generateResultInstrumentName(granularity, 'pass'),
|
|
257
|
-
firstContentfulPaintCategory: this.generateCWVCategoryInstrumentName(granularity, 'firstContentfulPaint'),
|
|
258
|
-
largestContentfulPaintCategory: this.generateCWVCategoryInstrumentName(granularity, 'largestContentfulPaint'),
|
|
259
|
-
cumulativeLayoutShiftCategory: this.generateCWVCategoryInstrumentName(granularity, 'cumulativeLayoutShift'),
|
|
260
|
-
timeToFirstByteCategory: this.generateCWVCategoryInstrumentName(granularity, 'timeToFirstByte'),
|
|
261
|
-
domContentLoadedCategory: this.generateCWVCategoryInstrumentName(granularity, 'domContentLoaded'),
|
|
262
234
|
};
|
|
263
235
|
}
|
|
264
236
|
generateCountInstrumentName(granularity, type) {
|
|
@@ -267,8 +239,8 @@ class CloudMonitoringPerformanceMetrics {
|
|
|
267
239
|
generateResultInstrumentName(granularity, type) {
|
|
268
240
|
return this.generateInstrumentName(granularity, 'result', type);
|
|
269
241
|
}
|
|
270
|
-
|
|
271
|
-
return this.generateInstrumentName(granularity, type, '
|
|
242
|
+
generateCWVFailCountInstrumentName(granularity, type) {
|
|
243
|
+
return this.generateInstrumentName(granularity, type, 'failCount');
|
|
272
244
|
}
|
|
273
245
|
generateInstrumentName(granularity, ...path) {
|
|
274
246
|
return `${METRIC_NAME_PREFIX}/${granularity}/${path.join('/')}`;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateBucketBoundaries = exports.
|
|
3
|
+
exports.generateBucketBoundaries = exports.DCLBucketBoundaries = exports.TTFBBucketBoundaries = exports.CLSBucketBoundaries = exports.LCPBucketBoundaries = exports.FCPBucketBoundaries = exports.ElapsedExecutionTimeBucketBoundaries = void 0;
|
|
4
4
|
exports.ElapsedExecutionTimeBucketBoundaries = generateBucketBoundaries({ limit: 60000, width: 1000 }, { limit: 300000, width: 5000 }, { limit: 3600000, width: 60000 });
|
|
5
5
|
exports.FCPBucketBoundaries = generateBucketBoundaries({ limit: 1800, width: 25 }, { limit: 3000, width: 50 }, { limit: 6000, width: 100 }, { limit: 30000, width: 500 }, { limit: 50000, width: 1000 });
|
|
6
|
-
exports.FCPCategoryBucketBoundaries = [1800.01, 3000.01];
|
|
7
6
|
exports.LCPBucketBoundaries = generateBucketBoundaries({ limit: 1500, width: 25 }, { limit: 2500, width: 50 }, { limit: 4000, width: 75 }, { limit: 8000, width: 250 }, { limit: 30000, width: 500 }, { limit: 60000, width: 1000 });
|
|
8
|
-
exports.LCPCategoryBucketBoundaries = [2500.01, 4000.01];
|
|
9
7
|
exports.CLSBucketBoundaries = generateBucketBoundaries({ limit: 0.1, width: 0.001 }, { limit: 0.25, width: 0.0025 }, { limit: 0.5, width: 0.01 }, { limit: 1, width: 0.05 });
|
|
10
|
-
exports.CLSCategoryBucketBoundaries = [0.1001, 0.2501];
|
|
11
8
|
exports.TTFBBucketBoundaries = generateBucketBoundaries({ limit: 1000, width: 25 }, { limit: 2000, width: 50 }, { limit: 5000, width: 75 }, { limit: 10000, width: 250 }, { limit: 30000, width: 500 }, { limit: 60000, width: 1000 });
|
|
12
|
-
exports.TTFBCategoryBucketBoundaries = [800.01, 1800.01];
|
|
13
9
|
exports.DCLBucketBoundaries = generateBucketBoundaries({ limit: 1000, width: 25 }, { limit: 2000, width: 50 }, { limit: 5000, width: 75 }, { limit: 10000, width: 250 }, { limit: 30000, width: 500 }, { limit: 60000, width: 1000 });
|
|
14
|
-
exports.DCLCategoryBucketBoundaries = [1000.01, 2000.01];
|
|
15
10
|
function generateBucketBoundaries(...rules) {
|
|
16
11
|
if (!rules.length) {
|
|
17
12
|
throw new Error('At least one rule must be specified');
|
|
@@ -4,15 +4,17 @@ exports.MetricsRecorder = void 0;
|
|
|
4
4
|
const cloudMonitoringPerformanceMetrics_1 = require("./cloudMonitoringPerformanceMetrics");
|
|
5
5
|
const Executor_1 = require("../execution/Executor");
|
|
6
6
|
const TestResult_1 = require("../core/execution/TestResult");
|
|
7
|
+
const pureUtil_1 = require("../util/pureUtil");
|
|
7
8
|
class MetricsRecorder {
|
|
8
|
-
constructor(projectId, testMetricLabels, metricsFactory = (projectId, runnerId) => new cloudMonitoringPerformanceMetrics_1.CloudMonitoringPerformanceMetrics(projectId, runnerId)) {
|
|
9
|
+
constructor(projectId, testMetricLabels, metricsFactory = (projectId, runnerId) => new cloudMonitoringPerformanceMetrics_1.CloudMonitoringPerformanceMetrics(projectId, runnerId), cwvFailureCriteria) {
|
|
9
10
|
this.testMetricLabels = testMetricLabels;
|
|
11
|
+
this.cwvFailureCriteria = cwvFailureCriteria;
|
|
10
12
|
this.metrics = metricsFactory(projectId, testMetricLabels.runner_id);
|
|
11
13
|
}
|
|
12
14
|
async stop() {
|
|
13
15
|
await this.metrics.shutdown();
|
|
14
16
|
}
|
|
15
|
-
recordTestMetricsForResult(testResult,
|
|
17
|
+
recordTestMetricsForResult(testResult, navigationInfo) {
|
|
16
18
|
const testElapsedTimeMillis = testResult.endTime - testResult.startTime;
|
|
17
19
|
const testPassed = testResult.status === TestResult_1.TestResultStatus.passed;
|
|
18
20
|
this.recordTestMetrics({
|
|
@@ -21,14 +23,44 @@ class MetricsRecorder {
|
|
|
21
23
|
failCount: testPassed ? 0 : 1,
|
|
22
24
|
passCount: testPassed ? 1 : 0,
|
|
23
25
|
runnerCount: 1,
|
|
24
|
-
|
|
25
|
-
largestContentfulPaintCategory: metric.find((metric) => metric.name === 'LCP')?.value,
|
|
26
|
-
cumulativeLayoutShiftCategory: metric.find((metric) => metric.name === 'CLS')?.value,
|
|
27
|
-
timeToFirstByteCategory: metric.find((metric) => metric.name === 'TTFB')
|
|
28
|
-
?.value,
|
|
29
|
-
domContentLoadedCategory: metric.find((metric) => metric.name === 'domContentLoadedEventEnd')?.value,
|
|
26
|
+
...this.getCWVFailCounts(navigationInfo),
|
|
30
27
|
});
|
|
31
28
|
}
|
|
29
|
+
getCWVFailCounts(navigationInfo) {
|
|
30
|
+
var _a;
|
|
31
|
+
if (!this.cwvFailureCriteria) {
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
const { relevantStepIds, metricConfiguration } = this.cwvFailureCriteria;
|
|
35
|
+
const relevantNavigationInfo = (_a = relevantStepIds === null || relevantStepIds === void 0 ? void 0 : relevantStepIds.map((stepId) => navigationInfo.get(stepId)).filter(pureUtil_1.isDefined)) !== null && _a !== void 0 ? _a : Array.from(navigationInfo.values());
|
|
36
|
+
const relevantMetric = relevantNavigationInfo.flatMap((navigationInfo) => navigationInfo.metric);
|
|
37
|
+
return metricConfiguration
|
|
38
|
+
.map((configuration) => {
|
|
39
|
+
const { name, threshold } = configuration;
|
|
40
|
+
const hasTestFailed = relevantMetric
|
|
41
|
+
.filter((metric) => metric.name === name)
|
|
42
|
+
.some((metric) => metric.value > threshold);
|
|
43
|
+
return {
|
|
44
|
+
[this.metricNameToTestMeasurementName(name)]: hasTestFailed ? 1 : 0,
|
|
45
|
+
};
|
|
46
|
+
})
|
|
47
|
+
.reduce((measurements, measurement) => Object.assign(measurements, measurement), {});
|
|
48
|
+
}
|
|
49
|
+
metricNameToTestMeasurementName(name) {
|
|
50
|
+
switch (name) {
|
|
51
|
+
case 'FCP':
|
|
52
|
+
return 'firstContentfulPaintFailCount';
|
|
53
|
+
case 'LCP':
|
|
54
|
+
return 'largestContentfulPaintFailCount';
|
|
55
|
+
case 'CLS':
|
|
56
|
+
return 'cumulativeLayoutShiftFailCount';
|
|
57
|
+
case 'TTFB':
|
|
58
|
+
return 'timeToFirstByteFailCount';
|
|
59
|
+
default:
|
|
60
|
+
case 'domContentLoadedEventEnd':
|
|
61
|
+
return 'domContentLoadedFailCount';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
32
64
|
recordStepMetricsForResult(result) {
|
|
33
65
|
const labels = {
|
|
34
66
|
...this.testMetricLabels,
|
|
@@ -45,36 +77,21 @@ class MetricsRecorder {
|
|
|
45
77
|
...this.testMetricLabels,
|
|
46
78
|
step_id: stepId,
|
|
47
79
|
};
|
|
48
|
-
this.recordStepMetrics(labels, this.
|
|
80
|
+
this.recordStepMetrics(labels, this.transformCWVStepMetricToStepMeasurement(metric));
|
|
49
81
|
}
|
|
50
|
-
|
|
82
|
+
transformCWVStepMetricToStepMeasurement(metric) {
|
|
51
83
|
const { name, value } = metric;
|
|
52
84
|
switch (name) {
|
|
53
85
|
case 'FCP':
|
|
54
|
-
return {
|
|
55
|
-
firstContentfulPaint: value,
|
|
56
|
-
firstContentfulPaintCategory: value,
|
|
57
|
-
};
|
|
86
|
+
return { firstContentfulPaint: value };
|
|
58
87
|
case 'LCP':
|
|
59
|
-
return {
|
|
60
|
-
largestContentfulPaint: value,
|
|
61
|
-
largestContentfulPaintCategory: value,
|
|
62
|
-
};
|
|
88
|
+
return { largestContentfulPaint: value };
|
|
63
89
|
case 'CLS':
|
|
64
|
-
return {
|
|
65
|
-
cumulativeLayoutShift: value,
|
|
66
|
-
cumulativeLayoutShiftCategory: value,
|
|
67
|
-
};
|
|
90
|
+
return { cumulativeLayoutShift: value };
|
|
68
91
|
case 'TTFB':
|
|
69
|
-
return {
|
|
70
|
-
timeToFirstByte: value,
|
|
71
|
-
timeToFirstByteCategory: value,
|
|
72
|
-
};
|
|
92
|
+
return { timeToFirstByte: value };
|
|
73
93
|
case 'domContentLoadedEventEnd':
|
|
74
|
-
return {
|
|
75
|
-
domContentLoaded: value,
|
|
76
|
-
domContentLoadedCategory: value,
|
|
77
|
-
};
|
|
94
|
+
return { domContentLoaded: value };
|
|
78
95
|
default:
|
|
79
96
|
return {};
|
|
80
97
|
}
|
|
@@ -27,8 +27,9 @@ function printBranchRunningInfo(branchName) {
|
|
|
27
27
|
}
|
|
28
28
|
exports.printBranchRunningInfo = printBranchRunningInfo;
|
|
29
29
|
function crossCheckBranchWithTest(branchName, test) {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
var _a, _b;
|
|
31
|
+
if (((_a = test.source_control_tags) === null || _a === void 0 ? void 0 : _a[branchName]) === undefined &&
|
|
32
|
+
((_b = test.source_control_tags) === null || _b === void 0 ? void 0 : _b[constants_1.DefaultBranchName]) === undefined) {
|
|
32
33
|
loggingProvider_1.logger.info(chalk.red('ERROR: Test does not exist on the branch:', chalk.magenta(branchName), 'Use the --mabl-branch flag to specify a branch'));
|
|
33
34
|
process.exit(1);
|
|
34
35
|
}
|
|
@@ -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;
|