@ondc/automation-mock-runner 1.3.39 → 1.3.41
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/dist/lib/configHelper.js
CHANGED
|
@@ -101,6 +101,14 @@ function convertToFlowConfig(config) {
|
|
|
101
101
|
const pair = config.steps.find((s) => s.responseFor === step.action_id)?.action_id ||
|
|
102
102
|
null;
|
|
103
103
|
let flowStep = {};
|
|
104
|
+
const isFormStep = ["HTML_FORM", "DYNAMIC_FORM", "HTML_FORM_MULTI"];
|
|
105
|
+
// Check if previous step was a form step
|
|
106
|
+
const previousStep = index > 0 ? config.steps[index - 1] : null;
|
|
107
|
+
const isPreviousStepForm = previousStep !== null && isFormStep.includes(previousStep.api);
|
|
108
|
+
// Check if current step has no inputs
|
|
109
|
+
const hasNoInputs = step.mock.inputs === undefined ||
|
|
110
|
+
step.mock.inputs === null ||
|
|
111
|
+
Object.keys(step.mock.inputs).length === 0;
|
|
104
112
|
if (step.api === "dynamic_form") {
|
|
105
113
|
flowStep = {
|
|
106
114
|
key: step.action_id,
|
|
@@ -169,6 +177,10 @@ function convertToFlowConfig(config) {
|
|
|
169
177
|
if (step.mock.inputs?.oldInputs) {
|
|
170
178
|
flowStep.input = step.mock.inputs.oldInputs;
|
|
171
179
|
}
|
|
180
|
+
// Add force_proceed if previous step was a form and current step has no inputs
|
|
181
|
+
if (isPreviousStepForm && hasNoInputs) {
|
|
182
|
+
flowStep.force_proceed = true;
|
|
183
|
+
}
|
|
172
184
|
flowConfig.sequence.push(flowStep);
|
|
173
185
|
index++;
|
|
174
186
|
}
|
|
@@ -42,20 +42,24 @@ function validateGoodConfig(config) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
if (id !== undefined && step.mock.inputs.oldInputs === undefined) {
|
|
45
|
-
if (sampleData === undefined || sampleData === null) {
|
|
46
|
-
|
|
47
|
-
}
|
|
45
|
+
// if (sampleData === undefined || sampleData === null) {
|
|
46
|
+
// errors.push(
|
|
47
|
+
// ` • ${label}: inputs.sampleData is required when inputs.id is set`,
|
|
48
|
+
// );
|
|
49
|
+
// }
|
|
48
50
|
if (jsonSchema === undefined || jsonSchema === null) {
|
|
49
51
|
errors.push(` • ${label}: inputs.jsonSchema is required when inputs.id is set`);
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
if (sampleData != null && jsonSchema != null) {
|
|
53
|
-
const validate = ajv.compile(jsonSchema);
|
|
54
|
-
if (!validate(sampleData) && validate.errors) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
// const validate = ajv.compile(jsonSchema);
|
|
56
|
+
// if (!validate(sampleData) && validate.errors) {
|
|
57
|
+
// validate.errors.forEach((e) => {
|
|
58
|
+
// errors.push(
|
|
59
|
+
// ` • ${label}: inputs.sampleData${e.instancePath} ${e.message}`,
|
|
60
|
+
// );
|
|
61
|
+
// });
|
|
62
|
+
// }
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
if (errors.length > 0) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|