zova-cli-set-front 1.2.100 → 1.2.101

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1760,7 +1760,7 @@ export const OpenApiBaseURL = (sys: ZovaSys) => {
1760
1760
  const contentOptions2 = contentOptions.length > 0 ? `options${_q(contentOptionsQuestion)}: {\n${contentOptions.join('\n')}\n} & IApiActionOptions,` : `options${_q(contentOptionsQuestion)}: IApiActionOptions,`;
1761
1761
  // content: request body
1762
1762
  let contentRequestBody = '';
1763
- if (!['get', 'delete'].includes(pathInfo.method)) {
1763
+ if (pathInfo.method !== 'get' && (pathInfo.method !== 'delete' || nameRequestBody)) {
1764
1764
  if (!nameRequestBody) {
1765
1765
  contentRequestBody = `body${_q(contentOptionsQuestion)}: undefined,`;
1766
1766
  } else {
@@ -1776,15 +1776,19 @@ export const OpenApiBaseURL = (sys: ZovaSys) => {
1776
1776
  // content: comment
1777
1777
  const contentComments = pathInfo.comments && pathInfo.comments.length > 0 ? `/*${pathInfo.comments.join()}*/\n` : '';
1778
1778
  // content: body
1779
- const contentBodyParams = isUpload ? 'this.$formData(body)' : 'body';
1779
+ const contentBodyParams = isUpload ? nameRequestBodyQuestion ? 'body ? this.$formData(body) : undefined' : 'this.$formData(body)' : 'body';
1780
+ const contentConfig = pathInfo.method === 'delete' && contentRequestBody ? `{
1781
+ ...this.$configPrepare(OpenApiBaseURL(this.sys), options${contentAuthToken}),
1782
+ data: ${contentBodyParams},
1783
+ }` : `this.$configPrepare(OpenApiBaseURL(this.sys), options${contentAuthToken})`;
1780
1784
  // content: signature
1781
1785
  const contentSignature = `${contentComments}${nodeActionInfo.action}(
1782
1786
  ${contentRequestBody}
1783
1787
  ${contentOptions2}
1784
1788
  ) {
1785
1789
  return this.$fetch.${pathInfo.method}<any, ${nameResponseBody}>(
1786
- ${contentPathTranslate} ${contentRequestBody ? `${contentBodyParams},` : ''}
1787
- this.$configPrepare(OpenApiBaseURL(this.sys), options${contentAuthToken}),
1790
+ ${contentPathTranslate} ${contentRequestBody && pathInfo.method !== 'delete' ? `${contentBodyParams},` : ''}
1791
+ ${contentConfig},
1788
1792
  );
1789
1793
  }\n`;
1790
1794
  return [contentTypes.join('\n'), contentSignature, nodeActionInfo.action, nameRequestPath, pathInfo.method];
@@ -3355,6 +3359,7 @@ class CliToolsMetadata extends BeanCliBase {
3355
3359
  content = `// eslint-disable\n${content}`;
3356
3360
  }
3357
3361
  // save
3362
+ content = content.replace(/[^\S\r\n]+$/gm, '');
3358
3363
  await fse.writeFile(metaIndexFile, content);
3359
3364
  // locales
3360
3365
  await this._generateLocales(modulePath, contentLocales1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-cli-set-front",
3
- "version": "1.2.100",
4
- "gitHead": "c408492ce774644ac8a2530702db916986f52151",
3
+ "version": "1.2.101",
4
+ "gitHead": "eb85d771ef75776a439e56df3af8be6a3a36c1c2",
5
5
  "description": "zova cli-set-front",
6
6
  "keywords": [
7
7
  "framework",