@ondc/automation-mock-runner 1.3.51 → 1.3.53

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.
@@ -74,6 +74,37 @@ export declare class MockRunner {
74
74
  }[];
75
75
  validationLib: string;
76
76
  helperLib: string;
77
+ extra_steps?: {
78
+ steps: {
79
+ api: string;
80
+ action_id: string;
81
+ owner: "BAP" | "BPP";
82
+ responseFor: string | null;
83
+ unsolicited: boolean;
84
+ description: string;
85
+ mock: {
86
+ generate: string;
87
+ validate: string;
88
+ requirements: string;
89
+ defaultPayload: any;
90
+ saveData: Record<string, string>;
91
+ inputs: {
92
+ id?: string | undefined;
93
+ jsonSchema?: any;
94
+ sampleData?: any;
95
+ oldInputs?: any;
96
+ };
97
+ formHtml?: string | undefined;
98
+ };
99
+ repeatCount?: number | null | undefined;
100
+ examples?: {
101
+ name: string;
102
+ payload: any;
103
+ type: "request" | "response";
104
+ description?: string | undefined;
105
+ }[] | undefined;
106
+ }[];
107
+ } | undefined;
77
108
  };
78
109
  validateConfig(): {
79
110
  success: boolean;
@@ -617,11 +617,19 @@ class MockRunner {
617
617
  }
618
618
  static encodeBase64(input) {
619
619
  const bytes = new TextEncoder().encode(input);
620
- return btoa(String.fromCharCode(...bytes));
620
+ const CHUNK = 0x8000;
621
+ let binary = "";
622
+ for (let i = 0; i < bytes.length; i += CHUNK) {
623
+ binary += String.fromCharCode.apply(null, bytes.subarray(i, i + CHUNK));
624
+ }
625
+ return btoa(binary);
621
626
  }
622
627
  static decodeBase64(encoded) {
623
628
  const binaryString = atob(encoded);
624
- const bytes = new Uint8Array([...binaryString].map((char) => char.charCodeAt(0)));
629
+ const bytes = new Uint8Array(binaryString.length);
630
+ for (let i = 0; i < binaryString.length; i++) {
631
+ bytes[i] = binaryString.charCodeAt(i);
632
+ }
625
633
  return new TextDecoder().decode(bytes);
626
634
  }
627
635
  static resolveBaseActionId(actionId) {
@@ -130,6 +130,43 @@ export declare const MockPlaygroundConfigSchema: z.ZodObject<{
130
130
  }>;
131
131
  }, z.core.$strip>>>;
132
132
  }, z.core.$strip>>;
133
+ extra_steps: z.ZodOptional<z.ZodObject<{
134
+ steps: z.ZodArray<z.ZodObject<{
135
+ api: z.ZodString;
136
+ action_id: z.ZodString;
137
+ owner: z.ZodEnum<{
138
+ BAP: "BAP";
139
+ BPP: "BPP";
140
+ }>;
141
+ responseFor: z.ZodNullable<z.ZodString>;
142
+ unsolicited: z.ZodBoolean;
143
+ description: z.ZodString;
144
+ repeatCount: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
145
+ mock: z.ZodObject<{
146
+ generate: z.ZodBase64;
147
+ validate: z.ZodBase64;
148
+ requirements: z.ZodBase64;
149
+ defaultPayload: z.ZodAny;
150
+ saveData: z.ZodRecord<z.ZodString, z.ZodString>;
151
+ inputs: z.ZodObject<{
152
+ id: z.ZodOptional<z.ZodString>;
153
+ jsonSchema: z.ZodOptional<z.ZodAny>;
154
+ sampleData: z.ZodOptional<z.ZodAny>;
155
+ oldInputs: z.ZodOptional<z.ZodAny>;
156
+ }, z.core.$strip>;
157
+ formHtml: z.ZodOptional<z.ZodBase64>;
158
+ }, z.core.$strip>;
159
+ examples: z.ZodOptional<z.ZodArray<z.ZodObject<{
160
+ name: z.ZodString;
161
+ description: z.ZodOptional<z.ZodString>;
162
+ payload: z.ZodAny;
163
+ type: z.ZodEnum<{
164
+ request: "request";
165
+ response: "response";
166
+ }>;
167
+ }, z.core.$strip>>>;
168
+ }, z.core.$strip>>;
169
+ }, z.core.$strip>>;
133
170
  transaction_history: z.ZodArray<z.ZodObject<{
134
171
  action_id: z.ZodString;
135
172
  action: z.ZodOptional<z.ZodString>;
@@ -68,6 +68,11 @@ exports.MockPlaygroundConfigSchema = zod_1.z.object({
68
68
  meta: exports.MetaSchema,
69
69
  transaction_data: exports.TransactionDataSchema,
70
70
  steps: zod_1.z.array(exports.PlaygroundActionStepSchema),
71
+ extra_steps: zod_1.z
72
+ .object({
73
+ steps: zod_1.z.array(exports.PlaygroundActionStepSchema),
74
+ })
75
+ .optional(),
71
76
  transaction_history: zod_1.z.array(exports.TransactionHistoryItemSchema),
72
77
  validationLib: zod_1.z.string(),
73
78
  helperLib: zod_1.z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ondc/automation-mock-runner",
3
- "version": "1.3.51",
3
+ "version": "1.3.53",
4
4
  "description": "A TypeScript library for ONDC automation mock runner",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",