@gct-paas/cli 0.1.4-dev.2 → 0.1.4-dev.3
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/hbs-temp/api-config.ts.hbs +20 -0
- package/hbs-temp/apis/{{api}}.service.d.ts.hbs +19 -0
- package/hbs-temp/index.d.ts.hbs +9 -0
- package/package.json +3 -2
- package/hbs-temp/index.ts.hbs +0 -9
- package/hbs-temp/{{api}}.service.ts.hbs +0 -37
- /package/hbs-temp/{entities.ts.hbs → entities.d.ts.hbs} +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
+
export const apiConfig: any[] = [
|
|
3
|
+
{{#each entities as |entity|}}
|
|
4
|
+
{
|
|
5
|
+
name: '{{camelCase entity.entityName}}',
|
|
6
|
+
entityName: '{{entity.entityName}}',
|
|
7
|
+
apis: [
|
|
8
|
+
{{#each methods as |method|}}
|
|
9
|
+
{
|
|
10
|
+
mode: '{{ method.mode }}',
|
|
11
|
+
method: '{{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}',
|
|
12
|
+
path: '{{#eq method.name '{id}'}}{{else}}{{method.model.requestPath}}{{/eq}}',
|
|
13
|
+
hasQuery: {{#gt method.queries.length 0}}true{{else}}false{{/gt}},
|
|
14
|
+
hasData: {{#if method.requestEntity}}true{{else}}false{{/if}}
|
|
15
|
+
},
|
|
16
|
+
{{/each}}
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
{{/each}}
|
|
20
|
+
]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{{#gt entityRefs.length 0}}
|
|
2
|
+
import type { {{formatImport entityRefs}} } from '../entities';
|
|
3
|
+
|
|
4
|
+
{{/gt}}
|
|
5
|
+
{{#each methods as |method|}}
|
|
6
|
+
{{#gt method.queries.length 0}}
|
|
7
|
+
export interface {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}Query {
|
|
8
|
+
{{#each method.queries as |query|}}
|
|
9
|
+
{{camelCase query.name}}{{#if query.required}}{{else}}?{{/if}}: {{#if query.items}}{{formatJsType query.items.type}}{{else}}{{formatJsType query.type}}{{/if}}; // {{query.description}}
|
|
10
|
+
{{/each}}
|
|
11
|
+
}
|
|
12
|
+
{{/gt}}
|
|
13
|
+
{{/each}}
|
|
14
|
+
export interface {{pascalCase (camelCase entityName) }}Service {
|
|
15
|
+
{{#each methods as |method|}}
|
|
16
|
+
// {{ method.model.summary }}
|
|
17
|
+
{{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}({{#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?: Record<string, string>): Promise<IHttpResponse<{{#if method.responseEntity}}{{formatImportItem method.responseEntity.title}}{{else}}unknown{{/if}}>>;
|
|
18
|
+
{{/each}}
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{{#each entities as |entity|}}
|
|
2
|
+
import type { {{pascalCase (camelCase entity.entityName) }}Service } from './apis/{{entity.entityName}}.service';
|
|
3
|
+
{{/each}}
|
|
4
|
+
|
|
5
|
+
export interface ApiManage {
|
|
6
|
+
{{#each entities as |entity|}}
|
|
7
|
+
readonly {{camelCase entity.entityName}}: {{pascalCase (camelCase entity.entityName)}}Service;
|
|
8
|
+
{{/each}}
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/cli",
|
|
3
|
-
"version": "0.1.4-dev.
|
|
3
|
+
"version": "0.1.4-dev.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台核心包",
|
|
6
6
|
"bin": {
|
|
@@ -65,5 +65,6 @@
|
|
|
65
65
|
"tsx": "^4.20.4",
|
|
66
66
|
"typescript": "^5.8.2",
|
|
67
67
|
"unbuild": "^3.5.0"
|
|
68
|
-
}
|
|
68
|
+
},
|
|
69
|
+
"gitHead": "caa65b07a6bbfb27d41911da2f5459567db38b1d"
|
|
69
70
|
}
|
package/hbs-temp/index.ts.hbs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
{{#each entities as |entity|}}
|
|
2
|
-
import { {{pascalCase (camelCase entity.entityName) }}Service } from './{{entity.entityName}}.service';
|
|
3
|
-
{{/each}}
|
|
4
|
-
|
|
5
|
-
export class ApiManage {
|
|
6
|
-
{{#each entities as |entity|}}
|
|
7
|
-
{{camelCase entity.entityName}}: {{pascalCase (camelCase entity.entityName)}}Service = new {{pascalCase (camelCase entity.entityName)}}Service();
|
|
8
|
-
{{/each}}
|
|
9
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { IHttpResponse } from '@gct-paas/base';
|
|
2
|
-
{{#eq tag 'apaas'}}
|
|
3
|
-
import { APaasBaseService } from '../base/apaas-base.service';
|
|
4
|
-
{{/eq}}
|
|
5
|
-
{{#eq tag 'ipaas'}}
|
|
6
|
-
import { IPaasBaseService } from '../base/ipaas-base.service';
|
|
7
|
-
{{/eq}}
|
|
8
|
-
{{#eq tag 'platform'}}
|
|
9
|
-
import { PlatformBaseService } from '../base/platform-base.service';
|
|
10
|
-
{{/eq}}
|
|
11
|
-
{{#eq tag 'rag'}}
|
|
12
|
-
import { RagBaseService } from '../base/rag-base.service';
|
|
13
|
-
{{/eq}}
|
|
14
|
-
{{#gt entityRefs.length 0}}
|
|
15
|
-
import type { {{formatImport entityRefs}} } from './entities';
|
|
16
|
-
|
|
17
|
-
{{/gt}}
|
|
18
|
-
{{#each methods as |method|}}
|
|
19
|
-
{{#gt method.queries.length 0}}
|
|
20
|
-
export interface {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}Query {
|
|
21
|
-
{{#each method.queries as |query|}}
|
|
22
|
-
{{camelCase query.name}}{{#if query.required}}{{else}}?{{/if}}: {{#if query.items}}{{formatJsType query.items.type}}{{else}}{{formatJsType query.type}}{{/if}}; // {{query.description}}
|
|
23
|
-
{{/each}}
|
|
24
|
-
}
|
|
25
|
-
{{/gt}}
|
|
26
|
-
{{/each}}
|
|
27
|
-
export class {{pascalCase (camelCase entityName) }}Service extends {{#eq tag 'apaas'}}APaasBaseService{{/eq}}{{#eq tag 'platform'}}PlatformBaseService{{/eq}}{{#eq tag 'rag'}}RagBaseService{{/eq}}{{#eq tag 'ipaas'}}IPaasBaseService{{/eq}} {
|
|
28
|
-
constructor() {
|
|
29
|
-
super('{{ entityName }}');
|
|
30
|
-
}
|
|
31
|
-
{{#each methods as |method|}}
|
|
32
|
-
// {{ method.model.summary }}
|
|
33
|
-
async {{ method.mode }}{{#if method.name}}{{pascalCase (camelCase method.name) }}{{/if}}({{#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: Record<string, string> = {}): Promise<IHttpResponse<{{#if method.responseEntity}}{{formatImportItem method.responseEntity.title}}{{else}}unknown{{/if}}>> {
|
|
34
|
-
return this._{{ method.mode }}('{{#eq method.name '{id}'}}{{else}}{{method.model.requestPath}}{{/eq}}'{{#if method.requestEntity}}, data{{else}}, null{{/if}}{{#gt method.queries.length 0}}, query{{else}}, null{{/gt}}, config);
|
|
35
|
-
}
|
|
36
|
-
{{/each}}
|
|
37
|
-
}
|
|
File without changes
|