open-api-typescript-request-generator 0.0.1
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/README.md +26 -0
- package/bin/apits-gener +4 -0
- package/es/Generator.d.ts +43 -0
- package/es/Generator.js +892 -0
- package/es/cli.d.ts +19 -0
- package/es/cli.js +547 -0
- package/es/console.d.ts +48 -0
- package/es/console.js +151 -0
- package/es/constants.d.ts +22 -0
- package/es/constants.js +39 -0
- package/es/dependenciesHandler.d.ts +16 -0
- package/es/dependenciesHandler.js +270 -0
- package/es/genIndex.d.ts +23 -0
- package/es/genIndex.js +354 -0
- package/es/genRequest.d.ts +3 -0
- package/es/genRequest.js +216 -0
- package/es/getOutputPath.d.ts +5 -0
- package/es/getOutputPath.js +28 -0
- package/es/helpers.d.ts +63 -0
- package/es/helpers.js +458 -0
- package/es/index.d.ts +2 -0
- package/es/index.js +34 -0
- package/es/requestYapiData.d.ts +157 -0
- package/es/requestYapiData.js +1010 -0
- package/es/responseDataJsonSchemaHandler.d.ts +11 -0
- package/es/responseDataJsonSchemaHandler.js +193 -0
- package/es/server/mock.d.ts +1 -0
- package/es/server/mock.js +7 -0
- package/es/server/swaggerJsonToYApiData.d.ts +10 -0
- package/es/server/swaggerJsonToYApiData.js +614 -0
- package/es/spinner.d.ts +15 -0
- package/es/spinner.js +58 -0
- package/es/types.d.ts +736 -0
- package/es/types.js +143 -0
- package/es/utils.d.ts +97 -0
- package/es/utils.js +783 -0
- package/lib/Generator.d.ts +43 -0
- package/lib/Generator.js +892 -0
- package/lib/cli.d.ts +19 -0
- package/lib/cli.js +547 -0
- package/lib/console.d.ts +48 -0
- package/lib/console.js +151 -0
- package/lib/constants.d.ts +22 -0
- package/lib/constants.js +39 -0
- package/lib/dependenciesHandler.d.ts +16 -0
- package/lib/dependenciesHandler.js +270 -0
- package/lib/genIndex.d.ts +23 -0
- package/lib/genIndex.js +354 -0
- package/lib/genRequest.d.ts +3 -0
- package/lib/genRequest.js +216 -0
- package/lib/getOutputPath.d.ts +5 -0
- package/lib/getOutputPath.js +28 -0
- package/lib/helpers.d.ts +63 -0
- package/lib/helpers.js +458 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +34 -0
- package/lib/requestYapiData.d.ts +157 -0
- package/lib/requestYapiData.js +1010 -0
- package/lib/responseDataJsonSchemaHandler.d.ts +11 -0
- package/lib/responseDataJsonSchemaHandler.js +193 -0
- package/lib/server/mock.d.ts +1 -0
- package/lib/server/mock.js +7 -0
- package/lib/server/swaggerJsonToYApiData.d.ts +10 -0
- package/lib/server/swaggerJsonToYApiData.js +614 -0
- package/lib/spinner.d.ts +15 -0
- package/lib/spinner.js +58 -0
- package/lib/types.d.ts +736 -0
- package/lib/types.js +143 -0
- package/lib/utils.d.ts +97 -0
- package/lib/utils.js +783 -0
- package/package.json +106 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
import { OpenAPIV3 } from 'openapi-types';
|
2
|
+
import { Config, ExtendedInterface, Interface, SyntheticalConfig, GeneratorOptions } from './types';
|
3
|
+
interface OutputFileList {
|
4
|
+
[outputFilePath: string]: {
|
5
|
+
projectId: string;
|
6
|
+
categoryId: string;
|
7
|
+
syntheticalConfig: SyntheticalConfig;
|
8
|
+
content: string[];
|
9
|
+
outputResponseDataJsonSchemaFilePath: string;
|
10
|
+
responseDataJsonSchemaContent: string[];
|
11
|
+
requestFunctionFilePath: string;
|
12
|
+
requestHookMakerFilePath: string;
|
13
|
+
};
|
14
|
+
}
|
15
|
+
export declare class Generator {
|
16
|
+
private options;
|
17
|
+
/** 配置 */
|
18
|
+
private config;
|
19
|
+
private disposes;
|
20
|
+
constructor(config: Config, options?: GeneratorOptions);
|
21
|
+
getOpenApiV3Json(url: string): Promise<OpenAPIV3.Document>;
|
22
|
+
/**
|
23
|
+
* 生成代码
|
24
|
+
* @returns
|
25
|
+
*/
|
26
|
+
generate(): Promise<OutputFileList>;
|
27
|
+
/**
|
28
|
+
* 写入文件
|
29
|
+
* @param outputFileList
|
30
|
+
* @returns
|
31
|
+
*/
|
32
|
+
write(outputFileList: OutputFileList): Promise<void[]>;
|
33
|
+
tsc(file: string): Promise<void>;
|
34
|
+
/** 请求函数名生成 */
|
35
|
+
requestFunctionNameGen(extendedInterfaceInfo: ExtendedInterface): string;
|
36
|
+
/** 生成接口代码 */
|
37
|
+
generateInterfaceCode(syntheticalConfig: SyntheticalConfig, interfaceInfo: Interface): Promise<{
|
38
|
+
code: string;
|
39
|
+
responseDataJsonSchema: string;
|
40
|
+
}>;
|
41
|
+
destroy(): Promise<any[]>;
|
42
|
+
}
|
43
|
+
export {};
|