@gopowerteam/request-generate 0.2.3 → 0.3.0
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/chunk-C0xms8kb.cjs +34 -0
- package/dist/index.cjs +1105 -0
- package/dist/index.d.cts +739 -0
- package/dist/index.d.mts +739 -0
- package/dist/index.mjs +937 -1040
- package/dist/vite-plugin/index.cjs +238 -0
- package/dist/vite-plugin/index.d.cts +13 -0
- package/dist/vite-plugin/index.d.mts +14 -0
- package/dist/vite-plugin/index.mjs +118 -118
- package/package.json +29 -29
- package/dist/chunk-WF3XBEPN.mjs +0 -18
- package/dist/chunk-XXPGZHWZ.js +0 -10
- package/dist/index.d.ts +0 -165
- package/dist/index.js +0 -1203
- package/dist/vite-plugin/index.d.ts +0 -13
- package/dist/vite-plugin/index.js +0 -233
- /package/dist/templates/{export-model.hbs → templates/export-model.hbs} +0 -0
- /package/dist/templates/{export-service.hbs → templates/export-service.hbs} +0 -0
- /package/dist/templates/{partials → templates/partials}/export-description.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-header.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-model-field.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-model-import.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-model-type.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-operation-params-body.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-operation-params-path.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-operation-params-query.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-operation-response.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-schema-type.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-service-class.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-service-import.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-service-namespace-type.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-service-namespace.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/export-service-operation.hbs +0 -0
- /package/dist/templates/{partials → templates/partials}/is-required.hbs +0 -0
package/dist/index.d.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { OpenAPIV2, OpenAPIV3 } from 'openapi-types';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 生成全局选项
|
|
5
|
-
*/
|
|
6
|
-
interface GenerateOptions {
|
|
7
|
-
// 网关地址
|
|
8
|
-
gateway: string
|
|
9
|
-
// OpenAPI地址
|
|
10
|
-
openapi: string
|
|
11
|
-
// 输出目录
|
|
12
|
-
output: string
|
|
13
|
-
// 输出Model路径
|
|
14
|
-
exportModels: boolean
|
|
15
|
-
// 开启日志输出
|
|
16
|
-
logger?: boolean
|
|
17
|
-
// 输出Model路径
|
|
18
|
-
exportServices?: {
|
|
19
|
-
serviceResolve?: (options: {
|
|
20
|
-
path: string
|
|
21
|
-
method: string
|
|
22
|
-
object: OpenAPIV2.OperationObject | OpenAPIV3.OperationObject
|
|
23
|
-
tags: OpenAPIV2.TagObject[]
|
|
24
|
-
}) => string
|
|
25
|
-
operationResolve?: (options: {
|
|
26
|
-
path: string
|
|
27
|
-
method: string
|
|
28
|
-
object: OpenAPIV2.OperationObject | OpenAPIV3.OperationObject
|
|
29
|
-
}) => string
|
|
30
|
-
excludeQueryParams?: string[]
|
|
31
|
-
responseType?: 'promise' | 'observable'
|
|
32
|
-
}
|
|
33
|
-
// 多应用列表
|
|
34
|
-
applications?: Record<string, ApplicationConfig>
|
|
35
|
-
// 追加service
|
|
36
|
-
appendService?: boolean
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
type ApplicationConfig =
|
|
40
|
-
| {
|
|
41
|
-
key: string
|
|
42
|
-
openapi: string
|
|
43
|
-
}
|
|
44
|
-
| string
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* 生成应用选项
|
|
48
|
-
*/
|
|
49
|
-
type GenerateApplicationOptions = Pick<
|
|
50
|
-
GenerateOptions,
|
|
51
|
-
'exportModels' | 'output'
|
|
52
|
-
> & {
|
|
53
|
-
// 服务名称
|
|
54
|
-
name?: string
|
|
55
|
-
// 应用名称
|
|
56
|
-
application?: string
|
|
57
|
-
// OPENAPI地址
|
|
58
|
-
input: string
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
declare class Download {
|
|
62
|
-
static options: GenerateOptions;
|
|
63
|
-
static startup(options: GenerateOptions): Promise<void>;
|
|
64
|
-
static downloadOpenAPIFile(option: GenerateApplicationOptions): Promise<unknown>;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
declare enum OpenAPIVersion {
|
|
68
|
-
V2 = 2,
|
|
69
|
-
V3 = 3
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
declare class Field {
|
|
73
|
-
name: string;
|
|
74
|
-
required: boolean;
|
|
75
|
-
type: string;
|
|
76
|
-
ref?: string;
|
|
77
|
-
enums?: string[];
|
|
78
|
-
description?: string;
|
|
79
|
-
imports?: string[];
|
|
80
|
-
constructor(name: string, required: boolean);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
declare class Model {
|
|
84
|
-
name: string;
|
|
85
|
-
fields: Field[];
|
|
86
|
-
imports: string[];
|
|
87
|
-
constructor(name: string);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
declare class OperationParameter {
|
|
91
|
-
in: 'path' | 'query' | 'body';
|
|
92
|
-
name: string;
|
|
93
|
-
type: string;
|
|
94
|
-
ref?: string;
|
|
95
|
-
enums?: string[];
|
|
96
|
-
description?: string;
|
|
97
|
-
required?: boolean;
|
|
98
|
-
imports: string[];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
declare class Operation {
|
|
102
|
-
name: string;
|
|
103
|
-
method: string;
|
|
104
|
-
path: string;
|
|
105
|
-
description?: string;
|
|
106
|
-
responseRef: string;
|
|
107
|
-
responseType: 'promise' | 'observable';
|
|
108
|
-
parametersPath: OperationParameter[];
|
|
109
|
-
parametersQuery: OperationParameter[];
|
|
110
|
-
parametersBody?: OperationParameter;
|
|
111
|
-
imports: string[];
|
|
112
|
-
constructor(name: string, method: string, path: string);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
declare class Service {
|
|
116
|
-
constructor(name: string);
|
|
117
|
-
name: string;
|
|
118
|
-
application?: string;
|
|
119
|
-
imports: string[];
|
|
120
|
-
operations: Operation[];
|
|
121
|
-
responseType: 'promise' | 'observable';
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
interface GenerateClient {
|
|
125
|
-
// 模型列表
|
|
126
|
-
models: Model[]
|
|
127
|
-
// 服务列表
|
|
128
|
-
services: Service[]
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
type UnkownVersionDocument = OpenAPIV3.Document & OpenAPIV2.Document;
|
|
132
|
-
declare class Generate {
|
|
133
|
-
static options: GenerateOptions;
|
|
134
|
-
/**
|
|
135
|
-
* 生成入口
|
|
136
|
-
* @param options
|
|
137
|
-
* @returns Promise<void>
|
|
138
|
-
*/
|
|
139
|
-
static startup(options: GenerateOptions): Promise<void>;
|
|
140
|
-
static getApiDocument(input: string): Promise<UnkownVersionDocument>;
|
|
141
|
-
/**
|
|
142
|
-
* 生成应用
|
|
143
|
-
*/
|
|
144
|
-
static generateApplicationClient(options: GenerateApplicationOptions): Promise<GenerateClient>;
|
|
145
|
-
/**
|
|
146
|
-
* 生成对象信息
|
|
147
|
-
* @param document
|
|
148
|
-
* @param version
|
|
149
|
-
* @returns GenerateClient
|
|
150
|
-
*/
|
|
151
|
-
static generateClient(document: UnkownVersionDocument, version: OpenAPIVersion): GenerateClient;
|
|
152
|
-
/**
|
|
153
|
-
* 写入Client对象
|
|
154
|
-
* @param client
|
|
155
|
-
* @param options
|
|
156
|
-
*/
|
|
157
|
-
static writeClient(client: GenerateClient, options: GenerateApplicationOptions): void;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
declare function defineConfig(config: GenerateOptions): GenerateOptions;
|
|
161
|
-
|
|
162
|
-
declare const generate: typeof Generate.startup;
|
|
163
|
-
declare const download: typeof Download.startup;
|
|
164
|
-
|
|
165
|
-
export { GenerateOptions, defineConfig, download, generate };
|