@ondc/automation-mock-runner 1.3.29 → 1.3.31

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.
@@ -44,6 +44,7 @@ export declare class MockRunner {
44
44
  id?: string | undefined;
45
45
  jsonSchema?: any;
46
46
  sampleData?: any;
47
+ oldInputs?: any;
47
48
  };
48
49
  formHtml?: string | undefined;
49
50
  };
@@ -122,6 +122,27 @@ function convertToFlowConfig(config) {
122
122
  ],
123
123
  };
124
124
  }
125
+ else if (step.api === "HTML_FORM") {
126
+ flowStep = {
127
+ key: step.action_id,
128
+ type: "HTML_FORM",
129
+ owner: step.owner,
130
+ description: step.description || "",
131
+ label: step.description || "FORM",
132
+ unsolicited: step.unsolicited,
133
+ pair: pair,
134
+ repeat: step.repeatCount || 1,
135
+ input: [
136
+ {
137
+ name: "form_submission_id",
138
+ label: "Enter form submission ID",
139
+ type: "HTML_FORM",
140
+ payloadField: "form_submission_id",
141
+ reference: `$.reference_data.${step.action_id}`,
142
+ },
143
+ ],
144
+ };
145
+ }
125
146
  else {
126
147
  flowStep = {
127
148
  key: step.action_id,
@@ -145,6 +166,9 @@ function convertToFlowConfig(config) {
145
166
  },
146
167
  ];
147
168
  }
169
+ if (step.mock.inputs?.oldInputs) {
170
+ flowStep.input = step.mock.inputs.oldInputs;
171
+ }
148
172
  flowConfig.sequence.push(flowStep);
149
173
  index++;
150
174
  }
@@ -216,6 +240,7 @@ async function buildConfigFromFlowConfig(payloads, flowConfig, domain, version,
216
240
  if (isFormStep) {
217
241
  // HTML_FORM is not yet fully implemented — fall back to dynamic_form default
218
242
  stepConfig = mockRunner.getDefaultStep(step.type, step.key, "dynamic_form");
243
+ stepConfig.mock.inputs.oldInputs = step.input;
219
244
  }
220
245
  else {
221
246
  stepConfig = mockRunner.getDefaultStep(step.type, step.key);
@@ -228,6 +253,7 @@ async function buildConfigFromFlowConfig(payloads, flowConfig, domain, version,
228
253
  }
229
254
  else {
230
255
  stepConfig.mock.inputs = {};
256
+ stepConfig.mock.inputs.oldInputs = step.input;
231
257
  }
232
258
  const stepPayloadIndex = payloads.findIndex((p) => p.context.action === step.type);
233
259
  if (stepPayloadIndex !== -1) {
@@ -30,6 +30,7 @@ export declare const MockConfigSchema: z.ZodObject<{
30
30
  id: z.ZodOptional<z.ZodString>;
31
31
  jsonSchema: z.ZodOptional<z.ZodAny>;
32
32
  sampleData: z.ZodOptional<z.ZodAny>;
33
+ oldInputs: z.ZodOptional<z.ZodAny>;
33
34
  }, z.core.$strip>;
34
35
  formHtml: z.ZodOptional<z.ZodBase64>;
35
36
  }, z.core.$strip>;
@@ -54,6 +55,7 @@ export declare const PlaygroundActionStepSchema: z.ZodObject<{
54
55
  id: z.ZodOptional<z.ZodString>;
55
56
  jsonSchema: z.ZodOptional<z.ZodAny>;
56
57
  sampleData: z.ZodOptional<z.ZodAny>;
58
+ oldInputs: z.ZodOptional<z.ZodAny>;
57
59
  }, z.core.$strip>;
58
60
  formHtml: z.ZodOptional<z.ZodBase64>;
59
61
  }, z.core.$strip>;
@@ -112,6 +114,7 @@ export declare const MockPlaygroundConfigSchema: z.ZodObject<{
112
114
  id: z.ZodOptional<z.ZodString>;
113
115
  jsonSchema: z.ZodOptional<z.ZodAny>;
114
116
  sampleData: z.ZodOptional<z.ZodAny>;
117
+ oldInputs: z.ZodOptional<z.ZodAny>;
115
118
  }, z.core.$strip>;
116
119
  formHtml: z.ZodOptional<z.ZodBase64>;
117
120
  }, z.core.$strip>;
@@ -31,6 +31,7 @@ exports.MockConfigSchema = zod_1.z.object({
31
31
  id: zod_1.z.string().min(1, "Input ID is required").optional(),
32
32
  jsonSchema: zod_1.z.any().optional(),
33
33
  sampleData: zod_1.z.any().optional(),
34
+ oldInputs: zod_1.z.any().optional(),
34
35
  }),
35
36
  formHtml: zod_1.z.base64().optional(),
36
37
  });
@@ -30,7 +30,8 @@ function validateGoodConfig(config) {
30
30
  config.steps.forEach((step, index) => {
31
31
  const { id, sampleData, jsonSchema } = step.mock.inputs;
32
32
  const label = `steps[${index}] (action_id: "${step.action_id}")`;
33
- if (step.mock.inputs !== undefined) {
33
+ if (step.mock.inputs !== undefined &&
34
+ Object.keys(step.mock.inputs).length > 0) {
34
35
  if (id === undefined || id === null) {
35
36
  errors.push(` • ${label}: inputs.id is required when inputs is defined`);
36
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ondc/automation-mock-runner",
3
- "version": "1.3.29",
3
+ "version": "1.3.31",
4
4
  "description": "A TypeScript library for ONDC automation mock runner",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",