vovk 3.0.0-draft.370 → 3.0.0-draft.371

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.
@@ -59,16 +59,10 @@ function generateTypeScriptCode({ handlerName, rpcName, packageName, queryValida
59
59
  }
60
60
  return formSample;
61
61
  };
62
- const getBody = (schema) => {
63
- if (schema['x-isForm']) {
64
- return 'form';
65
- }
66
- return getTsFormSample(schema);
67
- };
68
62
  const tsArgs = hasArg
69
63
  ? `{
70
64
  ${[
71
- bodyValidation ? ` body: ${getBody(bodyValidation)},` : null,
65
+ bodyValidation ? ` body: ${bodyValidation['x-isForm'] ? 'form' : getTsSample(bodyValidation)},` : null,
72
66
  queryValidation ? ` query: ${getTsSample(queryValidation)},` : null,
73
67
  paramsValidation ? ` params: ${getTsSample(paramsValidation)},` : null,
74
68
  ]
@@ -77,7 +71,7 @@ ${[
77
71
  }`
78
72
  : '';
79
73
  const TS_CODE = `import { ${rpcName} } from '${packageName}';
80
-
74
+ ${bodyValidation?.['x-isForm'] ? getTsFormSample(bodyValidation) : ''}
81
75
  ${iterationValidation ? 'using' : 'const'} response = await ${rpcName}.${handlerName}(${tsArgs});
82
76
  ${outputValidation
83
77
  ? `
@@ -59,16 +59,10 @@ function generateTypeScriptCode({ handlerName, rpcName, packageName, queryValida
59
59
  }
60
60
  return formSample;
61
61
  };
62
- const getBody = (schema) => {
63
- if (schema['x-isForm']) {
64
- return 'form';
65
- }
66
- return getTsFormSample(schema);
67
- };
68
62
  const tsArgs = hasArg
69
63
  ? `{
70
64
  ${[
71
- bodyValidation ? ` body: ${getBody(bodyValidation)},` : null,
65
+ bodyValidation ? ` body: ${bodyValidation['x-isForm'] ? 'form' : getTsSample(bodyValidation)},` : null,
72
66
  queryValidation ? ` query: ${getTsSample(queryValidation)},` : null,
73
67
  paramsValidation ? ` params: ${getTsSample(paramsValidation)},` : null,
74
68
  ]
@@ -77,7 +71,7 @@ ${[
77
71
  }`
78
72
  : '';
79
73
  const TS_CODE = `import { ${rpcName} } from '${packageName}';
80
-
74
+ ${bodyValidation?.['x-isForm'] ? getTsFormSample(bodyValidation) : ''}
81
75
  ${iterationValidation ? 'using' : 'const'} response = await ${rpcName}.${handlerName}(${tsArgs});
82
76
  ${outputValidation
83
77
  ? `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.370",
3
+ "version": "3.0.0-draft.371",
4
4
  "main": "./cjs/index.js",
5
5
  "module": "./mjs/index.js",
6
6
  "types": "./mjs/index.d.ts",