@gct-paas/cli 0.1.5-dev.7 → 0.1.5-dev.8

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.
@@ -9,33 +9,42 @@ class HelperFormatJsType extends _helperBase.HelperBase {
9
9
  constructor() {
10
10
  super("formatJsType");
11
11
  }
12
- onExecute(param, cfg) {
13
- if (!param) {
12
+ onExecute(config) {
13
+ if (!config) {
14
14
  return "unknown";
15
15
  }
16
- if (param === "array") {
16
+ const {
17
+ type,
18
+ items: cfg,
19
+ originalRef
20
+ } = config;
21
+ const fieldType = type || originalRef;
22
+ if (!fieldType) {
23
+ return "unknown";
24
+ }
25
+ if (fieldType === "array") {
17
26
  if (cfg) {
18
- let type = cfg.type || cfg.originalRef;
19
- if (type) {
20
- if (type === "integer") {
21
- type = "number";
22
- } else if (type.startsWith("Triple\xAB")) {
23
- type = "unknown";
27
+ let type2 = cfg.type || cfg.originalRef;
28
+ if (type2) {
29
+ if (type2 === "integer") {
30
+ type2 = "number";
31
+ } else if (type2.startsWith("Triple\xAB")) {
32
+ type2 = type2.replace("Triple\xAB", "ITripleObject<").replace("\xBB", ">");
24
33
  }
25
34
  } else {
26
- type = "unknown";
35
+ type2 = "unknown";
27
36
  }
28
- return type + "[]";
37
+ return type2 + "[]";
29
38
  }
30
39
  return "unknown[]";
31
40
  }
32
- if (param === "integer") {
41
+ if (fieldType === "integer") {
33
42
  return "number";
34
43
  }
35
- if (param === "object") {
36
- return "Record<string, unknown>";
44
+ if (fieldType === "object") {
45
+ return "IObject";
37
46
  }
38
- return param;
47
+ return fieldType;
39
48
  }
40
49
  }
41
50
  exports.HelperFormatJsType = HelperFormatJsType;
@@ -10,5 +10,5 @@ import { HelperBase } from '../helper-base';
10
10
  */
11
11
  export declare class HelperFormatJsType extends HelperBase {
12
12
  constructor();
13
- onExecute(param: string, cfg?: IObject): string;
13
+ onExecute(config: IObject): string;
14
14
  }
@@ -10,5 +10,5 @@ import { HelperBase } from '../helper-base';
10
10
  */
11
11
  export declare class HelperFormatJsType extends HelperBase {
12
12
  constructor();
13
- onExecute(param: string, cfg?: IObject): string;
13
+ onExecute(config: IObject): string;
14
14
  }
@@ -3,32 +3,37 @@ export class HelperFormatJsType extends HelperBase {
3
3
  constructor() {
4
4
  super("formatJsType");
5
5
  }
6
- onExecute(param, cfg) {
7
- if (!param) {
6
+ onExecute(config) {
7
+ if (!config) {
8
8
  return "unknown";
9
9
  }
10
- if (param === "array") {
10
+ const { type, items: cfg, originalRef } = config;
11
+ const fieldType = type || originalRef;
12
+ if (!fieldType) {
13
+ return "unknown";
14
+ }
15
+ if (fieldType === "array") {
11
16
  if (cfg) {
12
- let type = cfg.type || cfg.originalRef;
13
- if (type) {
14
- if (type === "integer") {
15
- type = "number";
16
- } else if (type.startsWith("Triple\xAB")) {
17
- type = "unknown";
17
+ let type2 = cfg.type || cfg.originalRef;
18
+ if (type2) {
19
+ if (type2 === "integer") {
20
+ type2 = "number";
21
+ } else if (type2.startsWith("Triple\xAB")) {
22
+ type2 = type2.replace("Triple\xAB", "ITripleObject<").replace("\xBB", ">");
18
23
  }
19
24
  } else {
20
- type = "unknown";
25
+ type2 = "unknown";
21
26
  }
22
- return type + "[]";
27
+ return type2 + "[]";
23
28
  }
24
29
  return "unknown[]";
25
30
  }
26
- if (param === "integer") {
31
+ if (fieldType === "integer") {
27
32
  return "number";
28
33
  }
29
- if (param === "object") {
30
- return "Record<string, unknown>";
34
+ if (fieldType === "object") {
35
+ return "IObject";
31
36
  }
32
- return param;
37
+ return fieldType;
33
38
  }
34
39
  }
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1
2
  import type { AxiosRequestConfig } from 'axios';
2
3
  {{#gt entityRefs.length 0}}
3
4
  import type { {{formatImport entityRefs}} } from '../entities';
@@ -13,9 +14,9 @@ export interface {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase met
13
14
  */
14
15
  {{/neq}}
15
16
  {{#eq query.name "requestParam"}}
16
- [key: string]: unknown;
17
+ [key: any]: any;
17
18
  {{else}}
18
- {{camelCase query.name}}{{#if query.required}}{{else}}?{{/if}}: {{#if query.items}}{{formatJsType query.items.type}}{{else}}{{formatJsType query.type}}{{/if}};
19
+ {{camelCase query.name}}{{#if query.required}}{{else}}?{{/if}}: {{#if query.items}}{{formatJsType query}}{{else}}{{formatJsType query}}{{/if}};
19
20
  {{/eq}}
20
21
  {{/each}}
21
22
  }
@@ -33,6 +34,6 @@ export interface {{pascalCase (camelCase entityName) }}Service {
33
34
  /**
34
35
  * {{ method.model.summary }}
35
36
  */
36
- {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}({{#gt method.pathParams.length 0}}path: {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}PathParams, {{/gt}}{{#gt method.queries.length 0}}query: {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}Query, {{/gt}}{{#if method.requestEntity}}data: {{method.requestEntity.title}}, {{/if}}config?: Partial<AxiosRequestConfig>): Promise<{{#if method.responseEntity}}{{formatImportItem method.responseEntity.title}}{{else}}unknown{{/if}}>;
37
+ {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}({{#gt method.pathParams.length 0}}path: {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}PathParams, {{/gt}}{{#gt method.queries.length 0}}query: {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}Query, {{/gt}}{{#if method.requestEntity}}data: {{method.requestEntity.title}}, {{/if}}config?: Partial<AxiosRequestConfig>): Promise<{{#if method.responseEntity}}{{formatImportItem method.responseEntity.title}}{{else}}any{{/if}}>;
37
38
  {{/each}}
38
39
  }
@@ -7,9 +7,9 @@ export interface {{ entity.title }} {
7
7
  /**
8
8
  * {{ property.description }}
9
9
  *
10
- * @type {{{formatJsType property.type property.items }}}
10
+ * @type {{{formatJsType property }}}
11
11
  */
12
- {{ key }}{{#if property.required}}{{else}}?{{/if}}: {{formatJsType property.type property.items }};
12
+ {{ key }}{{#if property.required}}{{else}}?{{/if}}: {{formatJsType property }};
13
13
  {{/each}}
14
14
  {{else}}
15
15
  // 暂无属性
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/cli",
3
- "version": "0.1.5-dev.7",
3
+ "version": "0.1.5-dev.8",
4
4
  "type": "module",
5
5
  "description": "paas 平台核心包",
6
6
  "bin": {