@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.
- package/dist/core/handlebars/helpers/format-js-type/format-js-type.cjs +24 -15
- package/dist/core/handlebars/helpers/format-js-type/format-js-type.d.ts +1 -1
- package/es/core/handlebars/helpers/format-js-type/format-js-type.d.ts +1 -1
- package/es/core/handlebars/helpers/format-js-type/format-js-type.mjs +20 -15
- package/hbs-temp/apis/{{api}}.service.d.ts.hbs +4 -3
- package/hbs-temp/entities.d.ts.hbs +2 -2
- package/package.json +1 -1
|
@@ -9,33 +9,42 @@ class HelperFormatJsType extends _helperBase.HelperBase {
|
|
|
9
9
|
constructor() {
|
|
10
10
|
super("formatJsType");
|
|
11
11
|
}
|
|
12
|
-
onExecute(
|
|
13
|
-
if (!
|
|
12
|
+
onExecute(config) {
|
|
13
|
+
if (!config) {
|
|
14
14
|
return "unknown";
|
|
15
15
|
}
|
|
16
|
-
|
|
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
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
} else if (
|
|
23
|
-
|
|
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
|
-
|
|
35
|
+
type2 = "unknown";
|
|
27
36
|
}
|
|
28
|
-
return
|
|
37
|
+
return type2 + "[]";
|
|
29
38
|
}
|
|
30
39
|
return "unknown[]";
|
|
31
40
|
}
|
|
32
|
-
if (
|
|
41
|
+
if (fieldType === "integer") {
|
|
33
42
|
return "number";
|
|
34
43
|
}
|
|
35
|
-
if (
|
|
36
|
-
return "
|
|
44
|
+
if (fieldType === "object") {
|
|
45
|
+
return "IObject";
|
|
37
46
|
}
|
|
38
|
-
return
|
|
47
|
+
return fieldType;
|
|
39
48
|
}
|
|
40
49
|
}
|
|
41
50
|
exports.HelperFormatJsType = HelperFormatJsType;
|
|
@@ -3,32 +3,37 @@ export class HelperFormatJsType extends HelperBase {
|
|
|
3
3
|
constructor() {
|
|
4
4
|
super("formatJsType");
|
|
5
5
|
}
|
|
6
|
-
onExecute(
|
|
7
|
-
if (!
|
|
6
|
+
onExecute(config) {
|
|
7
|
+
if (!config) {
|
|
8
8
|
return "unknown";
|
|
9
9
|
}
|
|
10
|
-
|
|
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
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
} else if (
|
|
17
|
-
|
|
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
|
-
|
|
25
|
+
type2 = "unknown";
|
|
21
26
|
}
|
|
22
|
-
return
|
|
27
|
+
return type2 + "[]";
|
|
23
28
|
}
|
|
24
29
|
return "unknown[]";
|
|
25
30
|
}
|
|
26
|
-
if (
|
|
31
|
+
if (fieldType === "integer") {
|
|
27
32
|
return "number";
|
|
28
33
|
}
|
|
29
|
-
if (
|
|
30
|
-
return "
|
|
34
|
+
if (fieldType === "object") {
|
|
35
|
+
return "IObject";
|
|
31
36
|
}
|
|
32
|
-
return
|
|
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:
|
|
17
|
+
[key: any]: any;
|
|
17
18
|
{{else}}
|
|
18
|
-
{{camelCase query.name}}{{#if query.required}}{{else}}?{{/if}}: {{#if query.items}}{{formatJsType query
|
|
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}}
|
|
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
|
|
10
|
+
* @type {{{formatJsType property }}}
|
|
11
11
|
*/
|
|
12
|
-
{{ key }}{{#if property.required}}{{else}}?{{/if}}: {{formatJsType property
|
|
12
|
+
{{ key }}{{#if property.required}}{{else}}?{{/if}}: {{formatJsType property }};
|
|
13
13
|
{{/each}}
|
|
14
14
|
{{else}}
|
|
15
15
|
// 暂无属性
|