ondc-code-generator 0.6.11 → 0.6.20
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.
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
* @param payload - The JSON payload to validate.
|
|
21
21
|
* @param config - Partial {@link ValidationConfig}. Merged with defaults.
|
|
22
22
|
* @param externalData - Extra data accessible to rules (we set `_SELF` to the normalized payload).
|
|
23
|
-
* @returns {@link validationOutput}
|
|
23
|
+
* @returns {@link Promise<validationOutput>}
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```ts
|
|
27
27
|
* import { performL1_validations } from "@your/pkg";
|
|
28
28
|
*
|
|
29
|
-
* const out = performL1_validations("search", payload, { onlyInvalid: false });
|
|
29
|
+
* const out = await performL1_validations("search", payload, { onlyInvalid: false });
|
|
30
30
|
* // e.g. out[0] => { testName, valid, code, description?, _debugInfo? }
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
@@ -241,7 +241,7 @@ export class TypescriptGenerator extends CodeGenerator {
|
|
|
241
241
|
importsCode += `\nimport StorageInterface from "./interfaces/storage-interface";`;
|
|
242
242
|
const masterTemplate = readFileSync(path.resolve(__dirname, "./templates/index.mustache"), "utf-8");
|
|
243
243
|
const masterFunction = `
|
|
244
|
-
export function perform${functionName}(action: string, payload: any, config?: Partial<ValidationConfig>, externalData: any = {}) {
|
|
244
|
+
export async function perform${functionName}(action: string, payload: any, config?: Partial<ValidationConfig>, externalData: any = {}) {
|
|
245
245
|
const completeConfig: ValidationConfig = {
|
|
246
246
|
...{ onlyInvalid: true, standardLogs: false, hideParentErrors: true, stateFullValidations: false, _debug: false },
|
|
247
247
|
...config,
|
|
@@ -261,7 +261,7 @@ export class TypescriptGenerator extends CodeGenerator {
|
|
|
261
261
|
externalData._SELF = normalizedPayload;
|
|
262
262
|
if (completeConfig.stateFullValidations) {
|
|
263
263
|
externalData = {
|
|
264
|
-
...perform${functionName}Load(action, completeConfig.uniqueKey!, completeConfig.store!),
|
|
264
|
+
...await perform${functionName}Load(action, completeConfig.uniqueKey!, completeConfig.store!),
|
|
265
265
|
...externalData,
|
|
266
266
|
};
|
|
267
267
|
}
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|