@ondc/automation-mock-runner 1.3.14 → 1.3.16
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/MockRunner.d.ts
CHANGED
package/dist/lib/configHelper.js
CHANGED
|
@@ -77,13 +77,13 @@ const isoDurToSec = (duration) => {
|
|
|
77
77
|
|
|
78
78
|
const setCityFromInputs = (payload, inputs) => {
|
|
79
79
|
if (!inputs) return "*";
|
|
80
|
-
|
|
80
|
+
let version = payload.context.version || payload.context.core_version || "2.0.0";
|
|
81
|
+
if (version.startsWith("1")) {
|
|
81
82
|
payload.context.city = inputs.city_code ?? "*";
|
|
82
83
|
} else {
|
|
83
84
|
payload.context.location.city.code = inputs.city_code ?? "*";
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
|
-
|
|
87
87
|
`;
|
|
88
88
|
function convertToFlowConfig(config) {
|
|
89
89
|
const flowConfig = {};
|
|
@@ -218,7 +218,7 @@ async function generatePlaygroundConfigFromFlowConfig(payloads, flowConfig) {
|
|
|
218
218
|
}
|
|
219
219
|
const stepConfig = mockRunner.getDefaultStep(step.type, step.key);
|
|
220
220
|
if (index === 0) {
|
|
221
|
-
stepConfig.mock.
|
|
221
|
+
stepConfig.mock.generate = MockRunner_1.MockRunner.encodeBase64(`async function generate(defaultPayload, sessionData) {
|
|
222
222
|
setCityFromInputs(defaultPayload, sessionData.user_inputs);
|
|
223
223
|
return defaultPayload;
|
|
224
224
|
}`);
|
|
@@ -232,6 +232,7 @@ async function generatePlaygroundConfigFromFlowConfig(payloads, flowConfig) {
|
|
|
232
232
|
stepConfig.responseFor = findResponseFor ? findResponseFor.key : null;
|
|
233
233
|
stepConfig.unsolicited = step.unsolicited;
|
|
234
234
|
config.steps.push(stepConfig);
|
|
235
|
+
index++;
|
|
235
236
|
}
|
|
236
237
|
return config;
|
|
237
238
|
}
|
|
@@ -7,6 +7,7 @@ export declare const MetaSchema: z.ZodObject<{
|
|
|
7
7
|
domain: z.ZodString;
|
|
8
8
|
version: z.ZodString;
|
|
9
9
|
flowId: z.ZodString;
|
|
10
|
+
config_version: z.ZodOptional<z.ZodString>;
|
|
10
11
|
}, z.core.$strip>;
|
|
11
12
|
export declare const TransactionDataSchema: z.ZodObject<{
|
|
12
13
|
transaction_id: z.ZodString;
|
|
@@ -63,6 +64,7 @@ export declare const MockPlaygroundConfigSchema: z.ZodObject<{
|
|
|
63
64
|
domain: z.ZodString;
|
|
64
65
|
version: z.ZodString;
|
|
65
66
|
flowId: z.ZodString;
|
|
67
|
+
config_version: z.ZodOptional<z.ZodString>;
|
|
66
68
|
}, z.core.$strip>;
|
|
67
69
|
transaction_data: z.ZodObject<{
|
|
68
70
|
transaction_id: z.ZodString;
|
|
@@ -8,6 +8,7 @@ exports.MetaSchema = zod_1.z.object({
|
|
|
8
8
|
domain: zod_1.z.string().min(1, "Domain is required"),
|
|
9
9
|
version: zod_1.z.string().min(1, "Version is required"),
|
|
10
10
|
flowId: zod_1.z.string().min(1, "Flow ID is required"),
|
|
11
|
+
config_version: zod_1.z.string().optional(),
|
|
11
12
|
});
|
|
12
13
|
exports.TransactionDataSchema = zod_1.z.object({
|
|
13
14
|
transaction_id: zod_1.z.string().min(1, "Transaction ID is required"),
|