@devbie/apits 1.0.1 → 1.0.2

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.
@@ -0,0 +1,44 @@
1
+ import { OpenAPIV3 } from "openapi-types";
2
+ import { Config, ExtendedInterface, Interface, SyntheticalConfig } from "../types.js";
3
+ interface OutputFileList {
4
+ [outputFilePath: string]: {
5
+ projectId: string;
6
+ categoryId: string;
7
+ syntheticalConfig: SyntheticalConfig;
8
+ content: string[];
9
+ };
10
+ }
11
+ export declare class Generator {
12
+ /** Generator configuration. */
13
+ private config;
14
+ constructor(config: Config);
15
+ /** Whether an input points to a remote http(s) resource. */
16
+ private static isHttpInput;
17
+ /**
18
+ * Derive a file base name from the input: hostname for URLs, file name
19
+ * without extension for local paths. Falls back to `api`.
20
+ */
21
+ static deriveName(input: string): string;
22
+ /** Parse a raw JSON / JSON5 / YAML document string. */
23
+ private parseSpecDocument;
24
+ /**
25
+ * Load the OpenAPI document from a remote URL or a local file.
26
+ * Both JSON (.json/.json5) and YAML (.yaml/.yml) are supported.
27
+ */
28
+ loadSpec(input: string): Promise<OpenAPIV3.Document>;
29
+ /**
30
+ * Generate all code from the OpenAPI document.
31
+ * @returns map of output file path to file contents
32
+ */
33
+ generate(): Promise<OutputFileList>;
34
+ /**
35
+ * Write all generated files to disk.
36
+ * @param outputFileList generated files
37
+ */
38
+ write(outputFileList: OutputFileList): Promise<void[]>;
39
+ /** Generate a request function name from the extended interface info. */
40
+ requestFunctionNameGen(extendedInterfaceInfo: ExtendedInterface): string;
41
+ /** Generate TypeScript code (types + request function) for a single API. */
42
+ generateInterfaceCode(syntheticalConfig: SyntheticalConfig, interfaceInfo: Interface): Promise<string>;
43
+ }
44
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Config } from "../types.js";
2
+ export default function writeRequestClient(config: Config): Promise<void>;
@@ -0,0 +1,44 @@
1
+ import { OpenAPIV3 } from "openapi-types";
2
+ import { Config, ExtendedInterface, Interface, SyntheticalConfig } from "../types.mjs";
3
+ interface OutputFileList {
4
+ [outputFilePath: string]: {
5
+ projectId: string;
6
+ categoryId: string;
7
+ syntheticalConfig: SyntheticalConfig;
8
+ content: string[];
9
+ };
10
+ }
11
+ export declare class Generator {
12
+ /** Generator configuration. */
13
+ private config;
14
+ constructor(config: Config);
15
+ /** Whether an input points to a remote http(s) resource. */
16
+ private static isHttpInput;
17
+ /**
18
+ * Derive a file base name from the input: hostname for URLs, file name
19
+ * without extension for local paths. Falls back to `api`.
20
+ */
21
+ static deriveName(input: string): string;
22
+ /** Parse a raw JSON / JSON5 / YAML document string. */
23
+ private parseSpecDocument;
24
+ /**
25
+ * Load the OpenAPI document from a remote URL or a local file.
26
+ * Both JSON (.json/.json5) and YAML (.yaml/.yml) are supported.
27
+ */
28
+ loadSpec(input: string): Promise<OpenAPIV3.Document>;
29
+ /**
30
+ * Generate all code from the OpenAPI document.
31
+ * @returns map of output file path to file contents
32
+ */
33
+ generate(): Promise<OutputFileList>;
34
+ /**
35
+ * Write all generated files to disk.
36
+ * @param outputFileList generated files
37
+ */
38
+ write(outputFileList: OutputFileList): Promise<void[]>;
39
+ /** Generate a request function name from the extended interface info. */
40
+ requestFunctionNameGen(extendedInterfaceInfo: ExtendedInterface): string;
41
+ /** Generate TypeScript code (types + request function) for a single API. */
42
+ generateInterfaceCode(syntheticalConfig: SyntheticalConfig, interfaceInfo: Interface): Promise<string>;
43
+ }
44
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Config } from "../types.mjs";
2
+ export default function writeRequestClient(config: Config): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devbie/apits",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "author": "zimv <zimudashiren@163.com>",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",