@mablhq/mabl-cli 2.82.10 → 2.82.12

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.
@@ -111,7 +111,7 @@ class MablStep extends MablAction_1.MablAction {
111
111
  toMablscript() {
112
112
  return '';
113
113
  }
114
- toLineDiffFormat() {
114
+ toLineDiffFormat(_omitStepId = false) {
115
115
  const lineDiffProperties = {
116
116
  annotation: this.annotation,
117
117
  disabled: this.isDisabled(),
@@ -80,11 +80,15 @@ class MablStepV2 extends MablStep_1.MablStep {
80
80
  getDescriptionForLogging() {
81
81
  return this.annotation?.description ?? this.getDescription();
82
82
  }
83
- toLineDiffFormat() {
83
+ toLineDiffFormat(omitStepId = false) {
84
+ const descriptor = { ...this.toStepDescriptor() };
85
+ if (omitStepId) {
86
+ delete descriptor.id;
87
+ }
84
88
  const lineDiffProperties = {
85
89
  annotation: this.annotation,
86
90
  disabled: this.isDisabled(),
87
- descriptor: this.toStepDescriptor(),
91
+ descriptor,
88
92
  };
89
93
  return this.stringify(lineDiffProperties);
90
94
  }
@@ -24,6 +24,12 @@ var DiffOperation;
24
24
  DiffOperation["EQUAL"] = "EQUAL";
25
25
  DiffOperation["INSERT"] = "INSERT";
26
26
  })(DiffOperation || (exports.DiffOperation = DiffOperation = {}));
27
+ function isLegacyFlow(flow) {
28
+ return !!flow.script && !flow.json_steps?.steps;
29
+ }
30
+ function hasAnyLegacyFlows(flows) {
31
+ return flows.some(isLegacyFlow);
32
+ }
27
33
  function lineModeDiff(text1, text2) {
28
34
  const dmp = new diffPatchMatch_1.default();
29
35
  const lineToCharDiff = dmp.diff_linesToChars(text1, text2);
@@ -155,9 +161,9 @@ function constructTestFlowsFromSteps(steps, flowType = mablApi_1.FlowTypeEnum.Ma
155
161
  }, output);
156
162
  return output;
157
163
  }
158
- function flattenTestFlowsIntoLineDiffingFormat(flows, flowConfig) {
164
+ function flattenTestFlowsIntoLineDiffingFormat(flows, flowConfig, omitStepId = false) {
159
165
  const flattenedSteps = flattenTestFlowsIntoSteps(flows, flowConfig);
160
- const diffingFormat = addTrailingNewline(flattenedSteps.map((step) => step.toLineDiffFormat()).join('\n'));
166
+ const diffingFormat = addTrailingNewline(flattenedSteps.map((step) => step.toLineDiffFormat(omitStepId)).join('\n'));
161
167
  return { flattenedSteps, diffingFormat };
162
168
  }
163
169
  function convertDiffingFormatIntoDiffingSteps(diffs, sourceSteps, targetSteps) {
@@ -193,16 +199,18 @@ function convertDiffingFormatIntoDiffingSteps(diffs, sourceSteps, targetSteps) {
193
199
  return stepDiffs;
194
200
  }
195
201
  function diffTests(test1Flows, test1FlowConfig, test2Flows, test2FlowConfig) {
196
- const { flattenedSteps: flattenedTest1Steps, diffingFormat: test1DiffingFormat, } = flattenTestFlowsIntoLineDiffingFormat(test1Flows, test1FlowConfig);
197
- const { flattenedSteps: flattenedTest2Steps, diffingFormat: test2DiffingFormat, } = flattenTestFlowsIntoLineDiffingFormat(test2Flows, test2FlowConfig);
202
+ const omitStepId = hasAnyLegacyFlows(test1Flows) || hasAnyLegacyFlows(test2Flows);
203
+ const { flattenedSteps: flattenedTest1Steps, diffingFormat: test1DiffingFormat, } = flattenTestFlowsIntoLineDiffingFormat(test1Flows, test1FlowConfig, omitStepId);
204
+ const { flattenedSteps: flattenedTest2Steps, diffingFormat: test2DiffingFormat, } = flattenTestFlowsIntoLineDiffingFormat(test2Flows, test2FlowConfig, omitStepId);
198
205
  const diffs = lineModeDiff(test1DiffingFormat, test2DiffingFormat);
199
206
  return convertDiffingFormatIntoDiffingSteps(diffs, flattenedTest1Steps, flattenedTest2Steps);
200
207
  }
201
208
  function diffFlows(flow1, flow2) {
209
+ const omitStepId = isLegacyFlow(flow1) || isLegacyFlow(flow2);
202
210
  const flow1Steps = parseFlowIntoStepList(flow1);
203
- const formattedFlow1Steps = addTrailingNewline(flow1Steps.map((step) => step.toLineDiffFormat()).join('\n'));
211
+ const formattedFlow1Steps = addTrailingNewline(flow1Steps.map((step) => step.toLineDiffFormat(omitStepId)).join('\n'));
204
212
  const flow2Steps = parseFlowIntoStepList(flow2);
205
- const formattedFlow2Steps = addTrailingNewline(flow2Steps.map((step) => step.toLineDiffFormat()).join('\n'));
213
+ const formattedFlow2Steps = addTrailingNewline(flow2Steps.map((step) => step.toLineDiffFormat(omitStepId)).join('\n'));
206
214
  const flattenedDiffs = lineModeDiff(formattedFlow1Steps, formattedFlow2Steps);
207
215
  const stepDiffs = convertDiffingFormatIntoDiffingSteps(flattenedDiffs, flow1Steps, flow2Steps);
208
216
  const parametersDiff = diffFlowVariables(flow1.parameters, flow2.parameters);
@@ -302,17 +302,6 @@ class AssertStep extends MablStepV2_1.MablStepV2 {
302
302
  }
303
303
  return `${primaryActionMablscriptPrefix}${this.conditionAction.toMablscript()}${assertAction}`;
304
304
  }
305
- toLineDiffFormat() {
306
- if (this.primaryAction instanceof MobileFindAction_1.MobileFindAction) {
307
- const lineDiffProperties = {
308
- annotation: this.annotation,
309
- disabled: this.isDisabled(),
310
- descriptor: this.toStepDescriptor(),
311
- };
312
- return this.stringify(lineDiffProperties);
313
- }
314
- return super.toLineDiffFormat();
315
- }
316
305
  getInputVariables() {
317
306
  return (0, MablAction_1.distinctStrings)([
318
307
  ...this.primaryAction.getInputVariables(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mablhq/mabl-cli",
3
- "version": "2.82.10",
3
+ "version": "2.82.12",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "The official mabl command line interface tool",
6
6
  "main": "index.js",