@moccona/apicodegen 0.0.1 → 0.0.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/README.md +48 -0
- package/bin/{cli.cjs → cli.js} +411 -300
- package/npm/index.cjs +212 -108
- package/npm/index.cjs.map +1 -1
- package/npm/index.d.cts +10 -10
- package/npm/index.d.ts +10 -10
- package/npm/index.js +212 -108
- package/npm/index.js.map +1 -1
- package/npm/vite/index.d.ts +29 -0
- package/npm/vite/index.js +2276 -0
- package/npm/vite/index.js.map +1 -0
- package/package.json +27 -30
package/npm/index.d.cts
CHANGED
|
@@ -154,7 +154,7 @@ interface ProviderInitResult {
|
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* @file Adapter abstract class definition
|
|
157
|
-
* @author
|
|
157
|
+
* @author wp.l
|
|
158
158
|
* @description Base adapter implementation for various code generation tools
|
|
159
159
|
*/
|
|
160
160
|
|
|
@@ -200,7 +200,7 @@ declare abstract class Adapter {
|
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
* @file Base class implementation
|
|
203
|
-
* @author
|
|
203
|
+
* @author wp.l
|
|
204
204
|
* @description Base utility class providing common methods for code generation and API handling
|
|
205
205
|
*/
|
|
206
206
|
|
|
@@ -239,7 +239,7 @@ declare abstract class Base {
|
|
|
239
239
|
* @param [operationId] - Unique identifier for the operation.
|
|
240
240
|
* @returns - The generated function name.
|
|
241
241
|
*/
|
|
242
|
-
static pathToFnName(path: string, method?: string,
|
|
242
|
+
static pathToFnName(path: string, method?: string, _operationId?: string): string;
|
|
243
243
|
/**
|
|
244
244
|
* Normalizes a string by replacing special characters and avoiding TypeScript keywords.
|
|
245
245
|
* @param text - Input text to normalize.
|
|
@@ -314,13 +314,13 @@ declare abstract class Base {
|
|
|
314
314
|
* @param schema - The object to check.
|
|
315
315
|
* @returns - True if the object is a reference.
|
|
316
316
|
*/
|
|
317
|
-
static isRef(schema:
|
|
317
|
+
static isRef(schema: unknown): schema is ReferenceObject;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
/**
|
|
321
|
-
* @file
|
|
322
|
-
*
|
|
323
|
-
* and processing API documentation.
|
|
321
|
+
* @file Base class implementation
|
|
322
|
+
* @author wp.l
|
|
323
|
+
* @description This file defines the `Provider` abstract class, which serves as a base for providers responsible for parsing and processing API documentation.
|
|
324
324
|
*/
|
|
325
325
|
|
|
326
326
|
/**
|
|
@@ -488,7 +488,7 @@ declare class Generator {
|
|
|
488
488
|
* @param path - The base path string containing placeholders.
|
|
489
489
|
* @param parameters - Array of parameter objects defining the parameters.
|
|
490
490
|
* @param basePath - Optional base path to prepend (default: "").
|
|
491
|
-
* @returns A TypeScript template
|
|
491
|
+
* @returns A TypeScript template expressi
|
|
492
492
|
*/
|
|
493
493
|
static toUrlTemplate(path: string, parameters: ParameterObject[], basePath?: string): typescript.NoSubstitutionTemplateLiteral | typescript.TemplateExpression;
|
|
494
494
|
/**
|
|
@@ -507,7 +507,7 @@ declare class Generator {
|
|
|
507
507
|
static isBinarySchema(schema: SchemaObject): boolean;
|
|
508
508
|
static toRequestBodyTypeNode(schema: SchemaObject): ParameterDeclaration;
|
|
509
509
|
static toTypeNode(schema: SchemaObject): TypeNode;
|
|
510
|
-
static
|
|
510
|
+
static toDeclarationNodes(parameters: ParameterObject[]): ParameterDeclaration[];
|
|
511
511
|
static toFormDataStatement(parameters: ParameterObject[], requestBody?: SchemaObject): Statement[];
|
|
512
512
|
static bodyBlock(uri: string, method: string, parameters: ParameterObject[], requestBody: MediaTypeObject | undefined, response: MediaTypeObject | undefined, adapter: Adapter): Block;
|
|
513
513
|
static schemaToStatemets(parsedDoc: ProviderInitResult, adaptor: Adapter, options: Omit<ProviderInitOptions, "docURL" | "output" | "requestOptions">): Statement[];
|
|
@@ -530,7 +530,7 @@ type apiCodeGenPluginOptions = ProviderInitOptions & {
|
|
|
530
530
|
name: string;
|
|
531
531
|
proxy?: ServerOptions["proxy"];
|
|
532
532
|
};
|
|
533
|
-
declare const tsc: () => Promise<void>;
|
|
533
|
+
declare const tsc: (path: string) => Promise<void>;
|
|
534
534
|
declare function apiCodeGenPlugin(options: apiCodeGenPluginOptions[]): PluginOption;
|
|
535
535
|
|
|
536
536
|
export { Adapter, Adaptors, ArraySchemaType, type ArrayTypeSchemaObject, AxiosAdapter, Base, type CommentObject, type Comments, type EnumSchemaObject, FetchAdapter, type FetchDocRequestInit, Generator, HttpMethods, type JSONValue, type MediaTypeObject, MediaTypes, NonArraySchemaType, OpenAPIProvider, OpenAPIVersion, type OperationObject, ParameterIn, type ParameterObject, type PathObject, type PathsObject, Provider, type ProviderInitOptions, type ProviderInitResult, type ReferenceObject, type RequestBodyObject, type ResponsesObject, SchemaFormatType, type SchemaObject, SchemaType, type SingleTypeSchemaObject, SuccessHttpStatusCode, apiCodeGenPlugin, type apiCodeGenPluginOptions, codeGen, tsc };
|
package/npm/index.d.ts
CHANGED
|
@@ -154,7 +154,7 @@ interface ProviderInitResult {
|
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
156
|
* @file Adapter abstract class definition
|
|
157
|
-
* @author
|
|
157
|
+
* @author wp.l
|
|
158
158
|
* @description Base adapter implementation for various code generation tools
|
|
159
159
|
*/
|
|
160
160
|
|
|
@@ -200,7 +200,7 @@ declare abstract class Adapter {
|
|
|
200
200
|
|
|
201
201
|
/**
|
|
202
202
|
* @file Base class implementation
|
|
203
|
-
* @author
|
|
203
|
+
* @author wp.l
|
|
204
204
|
* @description Base utility class providing common methods for code generation and API handling
|
|
205
205
|
*/
|
|
206
206
|
|
|
@@ -239,7 +239,7 @@ declare abstract class Base {
|
|
|
239
239
|
* @param [operationId] - Unique identifier for the operation.
|
|
240
240
|
* @returns - The generated function name.
|
|
241
241
|
*/
|
|
242
|
-
static pathToFnName(path: string, method?: string,
|
|
242
|
+
static pathToFnName(path: string, method?: string, _operationId?: string): string;
|
|
243
243
|
/**
|
|
244
244
|
* Normalizes a string by replacing special characters and avoiding TypeScript keywords.
|
|
245
245
|
* @param text - Input text to normalize.
|
|
@@ -314,13 +314,13 @@ declare abstract class Base {
|
|
|
314
314
|
* @param schema - The object to check.
|
|
315
315
|
* @returns - True if the object is a reference.
|
|
316
316
|
*/
|
|
317
|
-
static isRef(schema:
|
|
317
|
+
static isRef(schema: unknown): schema is ReferenceObject;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
/**
|
|
321
|
-
* @file
|
|
322
|
-
*
|
|
323
|
-
* and processing API documentation.
|
|
321
|
+
* @file Base class implementation
|
|
322
|
+
* @author wp.l
|
|
323
|
+
* @description This file defines the `Provider` abstract class, which serves as a base for providers responsible for parsing and processing API documentation.
|
|
324
324
|
*/
|
|
325
325
|
|
|
326
326
|
/**
|
|
@@ -488,7 +488,7 @@ declare class Generator {
|
|
|
488
488
|
* @param path - The base path string containing placeholders.
|
|
489
489
|
* @param parameters - Array of parameter objects defining the parameters.
|
|
490
490
|
* @param basePath - Optional base path to prepend (default: "").
|
|
491
|
-
* @returns A TypeScript template
|
|
491
|
+
* @returns A TypeScript template expressi
|
|
492
492
|
*/
|
|
493
493
|
static toUrlTemplate(path: string, parameters: ParameterObject[], basePath?: string): typescript.NoSubstitutionTemplateLiteral | typescript.TemplateExpression;
|
|
494
494
|
/**
|
|
@@ -507,7 +507,7 @@ declare class Generator {
|
|
|
507
507
|
static isBinarySchema(schema: SchemaObject): boolean;
|
|
508
508
|
static toRequestBodyTypeNode(schema: SchemaObject): ParameterDeclaration;
|
|
509
509
|
static toTypeNode(schema: SchemaObject): TypeNode;
|
|
510
|
-
static
|
|
510
|
+
static toDeclarationNodes(parameters: ParameterObject[]): ParameterDeclaration[];
|
|
511
511
|
static toFormDataStatement(parameters: ParameterObject[], requestBody?: SchemaObject): Statement[];
|
|
512
512
|
static bodyBlock(uri: string, method: string, parameters: ParameterObject[], requestBody: MediaTypeObject | undefined, response: MediaTypeObject | undefined, adapter: Adapter): Block;
|
|
513
513
|
static schemaToStatemets(parsedDoc: ProviderInitResult, adaptor: Adapter, options: Omit<ProviderInitOptions, "docURL" | "output" | "requestOptions">): Statement[];
|
|
@@ -530,7 +530,7 @@ type apiCodeGenPluginOptions = ProviderInitOptions & {
|
|
|
530
530
|
name: string;
|
|
531
531
|
proxy?: ServerOptions["proxy"];
|
|
532
532
|
};
|
|
533
|
-
declare const tsc: () => Promise<void>;
|
|
533
|
+
declare const tsc: (path: string) => Promise<void>;
|
|
534
534
|
declare function apiCodeGenPlugin(options: apiCodeGenPluginOptions[]): PluginOption;
|
|
535
535
|
|
|
536
536
|
export { Adapter, Adaptors, ArraySchemaType, type ArrayTypeSchemaObject, AxiosAdapter, Base, type CommentObject, type Comments, type EnumSchemaObject, FetchAdapter, type FetchDocRequestInit, Generator, HttpMethods, type JSONValue, type MediaTypeObject, MediaTypes, NonArraySchemaType, OpenAPIProvider, OpenAPIVersion, type OperationObject, ParameterIn, type ParameterObject, type PathObject, type PathsObject, Provider, type ProviderInitOptions, type ProviderInitResult, type ReferenceObject, type RequestBodyObject, type ResponsesObject, SchemaFormatType, type SchemaObject, SchemaType, type SingleTypeSchemaObject, SuccessHttpStatusCode, apiCodeGenPlugin, type apiCodeGenPluginOptions, codeGen, tsc };
|