@ondc/automation-mock-runner 1.3.8 → 1.3.9
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 +1 -0
- package/dist/lib/configHelper.d.ts +1 -0
- package/dist/lib/configHelper.js +9 -2
- package/dist/lib/constants/function-registry.js +3 -3
- package/dist/lib/types/mock-config.d.ts +2 -0
- package/dist/lib/types/mock-config.js +1 -0
- package/dist/test/helper-config.test.js +2 -2
- package/package.json +1 -1
package/dist/lib/MockRunner.d.ts
CHANGED
package/dist/lib/configHelper.js
CHANGED
|
@@ -18,9 +18,9 @@ function createInitialMockConfig(domain, version, flowId) {
|
|
|
18
18
|
transaction_data: {
|
|
19
19
|
transaction_id: (0, uuid_1.v4)(),
|
|
20
20
|
latest_timestamp: new Date(0).toISOString(),
|
|
21
|
-
bap_id: "
|
|
21
|
+
bap_id: "bap.example.com",
|
|
22
22
|
bap_uri: "https://bap.example.com",
|
|
23
|
-
bpp_id: "
|
|
23
|
+
bpp_id: "bpp.example.com",
|
|
24
24
|
bpp_uri: "https://bpp.example.com",
|
|
25
25
|
},
|
|
26
26
|
steps: [],
|
|
@@ -34,6 +34,13 @@ const defaultHelpers = `/*
|
|
|
34
34
|
these are appended below the generate function for each step.
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
|
+
const createFormURL = (domain,formId, sessionData) => {
|
|
38
|
+
const baseURL = sessionData.mockBaseUrl;
|
|
39
|
+
const transactionId = sessionData.transactionId[0];
|
|
40
|
+
const sessionId = sessionData.sessionId;
|
|
41
|
+
return \`\${baseURL}/forms/\${domain}/\${formId}/?transaction_id=\${transactionId}&session_id=\${sessionId}\`;
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
// Generates a UUID v4
|
|
38
45
|
function uuidv4() {
|
|
39
46
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
@@ -157,10 +157,11 @@ function getDefaultForm() {
|
|
|
157
157
|
<head>
|
|
158
158
|
<meta charset="UTF-8">
|
|
159
159
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
160
|
-
<title>
|
|
160
|
+
<title>ENTER FORM TITLE HERE</title>
|
|
161
161
|
</head>
|
|
162
162
|
|
|
163
163
|
<body>
|
|
164
|
+
<!-- note: update the form id here and don't change the actionUrl template -->
|
|
164
165
|
<form id="additionalDetailsForm" method="POST" action="<%= actionUrl %>">
|
|
165
166
|
<label for="name">Name</label>
|
|
166
167
|
<input type="text" id="name" name="name" />
|
|
@@ -194,8 +195,7 @@ function getDefaultForm() {
|
|
|
194
195
|
|
|
195
196
|
<label for="passportNumber">Passport Number</label>
|
|
196
197
|
<input type="text" id="passportNumber" name="passportNumber" />
|
|
197
|
-
|
|
198
|
-
<input type="hidden" id="transactionId" name="transactionId" value="cf7bb367-c820-4bc9-9be8-f548e0bbf222">
|
|
198
|
+
<!-- note: do not remove the submit button-->
|
|
199
199
|
<input type="submit" value="Submit">
|
|
200
200
|
</form>
|
|
201
201
|
</body>
|
|
@@ -54,6 +54,7 @@ export declare const PlaygroundActionStepSchema: z.ZodObject<{
|
|
|
54
54
|
}, z.core.$strip>;
|
|
55
55
|
export declare const TransactionHistoryItemSchema: z.ZodObject<{
|
|
56
56
|
action_id: z.ZodString;
|
|
57
|
+
action: z.ZodOptional<z.ZodString>;
|
|
57
58
|
payload: z.ZodAny;
|
|
58
59
|
saved_info: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
59
60
|
}, z.core.$strip>;
|
|
@@ -97,6 +98,7 @@ export declare const MockPlaygroundConfigSchema: z.ZodObject<{
|
|
|
97
98
|
}, z.core.$strip>>;
|
|
98
99
|
transaction_history: z.ZodArray<z.ZodObject<{
|
|
99
100
|
action_id: z.ZodString;
|
|
101
|
+
action: z.ZodOptional<z.ZodString>;
|
|
100
102
|
payload: z.ZodAny;
|
|
101
103
|
saved_info: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
102
104
|
}, z.core.$strip>>;
|
|
@@ -45,6 +45,7 @@ exports.PlaygroundActionStepSchema = zod_1.z.object({
|
|
|
45
45
|
});
|
|
46
46
|
exports.TransactionHistoryItemSchema = zod_1.z.object({
|
|
47
47
|
action_id: zod_1.z.string().min(1, "Action ID is required"),
|
|
48
|
+
action: zod_1.z.string().optional(),
|
|
48
49
|
payload: zod_1.z.any(),
|
|
49
50
|
saved_info: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
50
51
|
});
|
|
@@ -449,9 +449,9 @@ describe("configHelper", () => {
|
|
|
449
449
|
expect(result.transaction_data).toEqual({
|
|
450
450
|
transaction_id: "test-uuid-1234",
|
|
451
451
|
latest_timestamp: "1970-01-01T00:00:00.000Z",
|
|
452
|
-
bap_id: "
|
|
452
|
+
bap_id: "bap.example.com",
|
|
453
453
|
bap_uri: "https://bap.example.com",
|
|
454
|
-
bpp_id: "
|
|
454
|
+
bpp_id: "bpp.example.com",
|
|
455
455
|
bpp_uri: "https://bpp.example.com",
|
|
456
456
|
});
|
|
457
457
|
});
|