@ondc/automation-mock-runner 1.3.23 → 1.3.26
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 +9 -0
- package/dist/lib/configHelper.d.ts +9 -0
- package/dist/lib/configHelper.js +3 -0
- package/dist/lib/types/mock-config.d.ts +24 -0
- package/dist/lib/types/mock-config.js +11 -0
- package/dist/lib/utils/validateConfig.js +1 -1
- package/dist/test/helper-config.test.js +3 -0
- package/package.json +2 -1
package/dist/lib/MockRunner.d.ts
CHANGED
|
@@ -15,6 +15,9 @@ export declare class MockRunner {
|
|
|
15
15
|
version: string;
|
|
16
16
|
flowId: string;
|
|
17
17
|
config_version?: string | undefined;
|
|
18
|
+
description?: string | undefined;
|
|
19
|
+
use_case_id?: string | undefined;
|
|
20
|
+
flowName?: string | undefined;
|
|
18
21
|
};
|
|
19
22
|
transaction_data: {
|
|
20
23
|
transaction_id: string;
|
|
@@ -45,6 +48,12 @@ export declare class MockRunner {
|
|
|
45
48
|
formHtml?: string | undefined;
|
|
46
49
|
};
|
|
47
50
|
repeatCount?: number | null | undefined;
|
|
51
|
+
examples?: {
|
|
52
|
+
name: string;
|
|
53
|
+
payload: any;
|
|
54
|
+
type: "request" | "response";
|
|
55
|
+
description?: string | undefined;
|
|
56
|
+
}[] | undefined;
|
|
48
57
|
}[];
|
|
49
58
|
transaction_history: {
|
|
50
59
|
action_id: string;
|
|
@@ -42,6 +42,9 @@ export declare function generatePlaygroundConfigFromFlowConfig(payloads: Payload
|
|
|
42
42
|
version: string;
|
|
43
43
|
flowId: string;
|
|
44
44
|
config_version?: string | undefined;
|
|
45
|
+
description?: string | undefined;
|
|
46
|
+
use_case_id?: string | undefined;
|
|
47
|
+
flowName?: string | undefined;
|
|
45
48
|
};
|
|
46
49
|
transaction_data: {
|
|
47
50
|
transaction_id: string;
|
|
@@ -72,6 +75,12 @@ export declare function generatePlaygroundConfigFromFlowConfig(payloads: Payload
|
|
|
72
75
|
formHtml?: string | undefined;
|
|
73
76
|
};
|
|
74
77
|
repeatCount?: number | null | undefined;
|
|
78
|
+
examples?: {
|
|
79
|
+
name: string;
|
|
80
|
+
payload: any;
|
|
81
|
+
type: "request" | "response";
|
|
82
|
+
description?: string | undefined;
|
|
83
|
+
}[] | undefined;
|
|
75
84
|
}[];
|
|
76
85
|
transaction_history: {
|
|
77
86
|
action_id: string;
|
package/dist/lib/configHelper.js
CHANGED
|
@@ -8,6 +8,9 @@ export declare const MetaSchema: z.ZodObject<{
|
|
|
8
8
|
version: z.ZodString;
|
|
9
9
|
flowId: z.ZodString;
|
|
10
10
|
config_version: z.ZodOptional<z.ZodString>;
|
|
11
|
+
description: z.ZodOptional<z.ZodString>;
|
|
12
|
+
use_case_id: z.ZodOptional<z.ZodString>;
|
|
13
|
+
flowName: z.ZodOptional<z.ZodString>;
|
|
11
14
|
}, z.core.$strip>;
|
|
12
15
|
export declare const TransactionDataSchema: z.ZodObject<{
|
|
13
16
|
transaction_id: z.ZodString;
|
|
@@ -54,6 +57,15 @@ export declare const PlaygroundActionStepSchema: z.ZodObject<{
|
|
|
54
57
|
}, z.core.$strip>;
|
|
55
58
|
formHtml: z.ZodOptional<z.ZodBase64>;
|
|
56
59
|
}, z.core.$strip>;
|
|
60
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
61
|
+
name: z.ZodString;
|
|
62
|
+
description: z.ZodOptional<z.ZodString>;
|
|
63
|
+
payload: z.ZodAny;
|
|
64
|
+
type: z.ZodEnum<{
|
|
65
|
+
request: "request";
|
|
66
|
+
response: "response";
|
|
67
|
+
}>;
|
|
68
|
+
}, z.core.$strip>>>;
|
|
57
69
|
}, z.core.$strip>;
|
|
58
70
|
export declare const TransactionHistoryItemSchema: z.ZodObject<{
|
|
59
71
|
action_id: z.ZodString;
|
|
@@ -67,6 +79,9 @@ export declare const MockPlaygroundConfigSchema: z.ZodObject<{
|
|
|
67
79
|
version: z.ZodString;
|
|
68
80
|
flowId: z.ZodString;
|
|
69
81
|
config_version: z.ZodOptional<z.ZodString>;
|
|
82
|
+
description: z.ZodOptional<z.ZodString>;
|
|
83
|
+
use_case_id: z.ZodOptional<z.ZodString>;
|
|
84
|
+
flowName: z.ZodOptional<z.ZodString>;
|
|
70
85
|
}, z.core.$strip>;
|
|
71
86
|
transaction_data: z.ZodObject<{
|
|
72
87
|
transaction_id: z.ZodString;
|
|
@@ -100,6 +115,15 @@ export declare const MockPlaygroundConfigSchema: z.ZodObject<{
|
|
|
100
115
|
}, z.core.$strip>;
|
|
101
116
|
formHtml: z.ZodOptional<z.ZodBase64>;
|
|
102
117
|
}, z.core.$strip>;
|
|
118
|
+
examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
description: z.ZodOptional<z.ZodString>;
|
|
121
|
+
payload: z.ZodAny;
|
|
122
|
+
type: z.ZodEnum<{
|
|
123
|
+
request: "request";
|
|
124
|
+
response: "response";
|
|
125
|
+
}>;
|
|
126
|
+
}, z.core.$strip>>>;
|
|
103
127
|
}, z.core.$strip>>;
|
|
104
128
|
transaction_history: z.ZodArray<z.ZodObject<{
|
|
105
129
|
action_id: z.ZodString;
|
|
@@ -9,6 +9,9 @@ exports.MetaSchema = zod_1.z.object({
|
|
|
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
11
|
config_version: zod_1.z.string().optional(),
|
|
12
|
+
description: zod_1.z.string().optional(),
|
|
13
|
+
use_case_id: zod_1.z.string().optional(),
|
|
14
|
+
flowName: zod_1.z.string().optional(),
|
|
12
15
|
});
|
|
13
16
|
exports.TransactionDataSchema = zod_1.z.object({
|
|
14
17
|
transaction_id: zod_1.z.string().min(1, "Transaction ID is required"),
|
|
@@ -44,6 +47,14 @@ exports.PlaygroundActionStepSchema = zod_1.z.object({
|
|
|
44
47
|
.optional()
|
|
45
48
|
.nullable(),
|
|
46
49
|
mock: exports.MockConfigSchema,
|
|
50
|
+
examples: zod_1.z
|
|
51
|
+
.array(zod_1.z.object({
|
|
52
|
+
name: zod_1.z.string().min(1, "Example name is required"),
|
|
53
|
+
description: zod_1.z.string().optional(),
|
|
54
|
+
payload: zod_1.z.any(),
|
|
55
|
+
type: zod_1.z.enum(["request", "response"]),
|
|
56
|
+
}))
|
|
57
|
+
.optional(),
|
|
47
58
|
});
|
|
48
59
|
exports.TransactionHistoryItemSchema = zod_1.z.object({
|
|
49
60
|
action_id: zod_1.z.string().min(1, "Action ID is required"),
|
|
@@ -54,7 +54,7 @@ function validateGoodConfig(config) {
|
|
|
54
54
|
const valid = validate(sampleData);
|
|
55
55
|
if (!valid && validate.errors) {
|
|
56
56
|
validate.errors.forEach((e) => {
|
|
57
|
-
errors.push(`steps[${index}] (action_id: "${step.action_id}"): inputs.sampleData${e.
|
|
57
|
+
errors.push(`steps[${index}] (action_id: "${step.action_id}"): inputs.sampleData${e.instancePath} ${e.message}`);
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -438,6 +438,9 @@ describe("configHelper", () => {
|
|
|
438
438
|
domain: "ONDC:TRV14",
|
|
439
439
|
version: "2.0.0",
|
|
440
440
|
flowId: "test-flow",
|
|
441
|
+
config_version: "0.0.0001",
|
|
442
|
+
description: "",
|
|
443
|
+
use_case_id: "",
|
|
441
444
|
});
|
|
442
445
|
});
|
|
443
446
|
it("should generate a UUID for transaction_id", () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ondc/automation-mock-runner",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.26",
|
|
4
4
|
"description": "A TypeScript library for ONDC automation mock runner",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"dependencies": {
|
|
77
77
|
"acorn": "^8.15.0",
|
|
78
78
|
"acorn-walk": "^8.3.4",
|
|
79
|
+
"ajv": "^8.18.0",
|
|
79
80
|
"base-64": "^1.0.0",
|
|
80
81
|
"jsonpath": "^1.1.1",
|
|
81
82
|
"terser": "^5.44.1",
|