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.
Files changed (71) hide show
  1. package/README.md +26 -0
  2. package/bin/apits-gener +4 -0
  3. package/es/Generator.d.ts +43 -0
  4. package/es/Generator.js +892 -0
  5. package/es/cli.d.ts +19 -0
  6. package/es/cli.js +547 -0
  7. package/es/console.d.ts +48 -0
  8. package/es/console.js +151 -0
  9. package/es/constants.d.ts +22 -0
  10. package/es/constants.js +39 -0
  11. package/es/dependenciesHandler.d.ts +16 -0
  12. package/es/dependenciesHandler.js +270 -0
  13. package/es/genIndex.d.ts +23 -0
  14. package/es/genIndex.js +354 -0
  15. package/es/genRequest.d.ts +3 -0
  16. package/es/genRequest.js +216 -0
  17. package/es/getOutputPath.d.ts +5 -0
  18. package/es/getOutputPath.js +28 -0
  19. package/es/helpers.d.ts +63 -0
  20. package/es/helpers.js +458 -0
  21. package/es/index.d.ts +2 -0
  22. package/es/index.js +34 -0
  23. package/es/requestYapiData.d.ts +157 -0
  24. package/es/requestYapiData.js +1010 -0
  25. package/es/responseDataJsonSchemaHandler.d.ts +11 -0
  26. package/es/responseDataJsonSchemaHandler.js +193 -0
  27. package/es/server/mock.d.ts +1 -0
  28. package/es/server/mock.js +7 -0
  29. package/es/server/swaggerJsonToYApiData.d.ts +10 -0
  30. package/es/server/swaggerJsonToYApiData.js +614 -0
  31. package/es/spinner.d.ts +15 -0
  32. package/es/spinner.js +58 -0
  33. package/es/types.d.ts +736 -0
  34. package/es/types.js +143 -0
  35. package/es/utils.d.ts +97 -0
  36. package/es/utils.js +783 -0
  37. package/lib/Generator.d.ts +43 -0
  38. package/lib/Generator.js +892 -0
  39. package/lib/cli.d.ts +19 -0
  40. package/lib/cli.js +547 -0
  41. package/lib/console.d.ts +48 -0
  42. package/lib/console.js +151 -0
  43. package/lib/constants.d.ts +22 -0
  44. package/lib/constants.js +39 -0
  45. package/lib/dependenciesHandler.d.ts +16 -0
  46. package/lib/dependenciesHandler.js +270 -0
  47. package/lib/genIndex.d.ts +23 -0
  48. package/lib/genIndex.js +354 -0
  49. package/lib/genRequest.d.ts +3 -0
  50. package/lib/genRequest.js +216 -0
  51. package/lib/getOutputPath.d.ts +5 -0
  52. package/lib/getOutputPath.js +28 -0
  53. package/lib/helpers.d.ts +63 -0
  54. package/lib/helpers.js +458 -0
  55. package/lib/index.d.ts +2 -0
  56. package/lib/index.js +34 -0
  57. package/lib/requestYapiData.d.ts +157 -0
  58. package/lib/requestYapiData.js +1010 -0
  59. package/lib/responseDataJsonSchemaHandler.d.ts +11 -0
  60. package/lib/responseDataJsonSchemaHandler.js +193 -0
  61. package/lib/server/mock.d.ts +1 -0
  62. package/lib/server/mock.js +7 -0
  63. package/lib/server/swaggerJsonToYApiData.d.ts +10 -0
  64. package/lib/server/swaggerJsonToYApiData.js +614 -0
  65. package/lib/spinner.d.ts +15 -0
  66. package/lib/spinner.js +58 -0
  67. package/lib/types.d.ts +736 -0
  68. package/lib/types.js +143 -0
  69. package/lib/utils.d.ts +97 -0
  70. package/lib/utils.js +783 -0
  71. 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 {};