@blimu/codegen 0.1.0 → 0.1.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 +0 -1
- package/dist/generator/typescript/templates/package.json.hbs +5 -2
- package/dist/generator/typescript/templates/schema.ts.hbs +51 -27
- package/dist/generator/typescript/templates/schema.zod.ts.hbs +16 -0
- package/dist/generator/typescript/templates/service.ts.hbs +6 -0
- package/dist/generator/typescript/templates/tsconfig.json.hbs +1 -2
- package/dist/index.d.mts +33 -25
- package/dist/index.d.ts +33 -25
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +1 -1
- package/dist/main.js +4 -4
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -135,7 +135,6 @@ const config = await loadConfig("./chunkflow-codegen.config.mjs");
|
|
|
135
135
|
- `postCommand` (optional): Commands to run after SDK generation
|
|
136
136
|
- `defaultBaseURL` (optional): Default base URL for the client
|
|
137
137
|
- `exclude` (optional): Array of file paths to exclude from generation
|
|
138
|
-
- `typeAugmentation` (optional): Options for type augmentation generators
|
|
139
138
|
|
|
140
139
|
## License
|
|
141
140
|
|
|
@@ -40,9 +40,12 @@
|
|
|
40
40
|
"prepublishOnly": "npm run build && npm run typecheck || true"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
|
|
43
|
+
{{#each (getAllDependencies Client)}}
|
|
44
|
+
"{{@key}}": "{{this}}"{{#unless @last}},{{/unless}}
|
|
45
|
+
{{/each}}
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
|
-
"tsup": "^8.5.1"
|
|
48
|
+
"tsup": "^8.5.1"{{#if Client.devDependencies}}{{#each Client.devDependencies}},
|
|
49
|
+
"{{@key}}": "{{this}}"{{/each}}{{/if}}
|
|
47
50
|
}
|
|
48
51
|
}
|
|
@@ -1,51 +1,75 @@
|
|
|
1
1
|
// Generated types from OpenAPI components.schemas
|
|
2
2
|
|
|
3
|
+
{{! Generate import statements for predefined types actually used in this schema file }}
|
|
4
|
+
{{#if (getSchemaPredefinedTypes)}}
|
|
5
|
+
{{#each (groupByPackage (getSchemaPredefinedTypes))}}
|
|
6
|
+
import type { {{joinTypes this.types}} } from '{{this.package}}';
|
|
7
|
+
{{/each}}
|
|
8
|
+
{{/if}}
|
|
9
|
+
|
|
3
10
|
export type Enum<T> = T[keyof T];
|
|
4
11
|
|
|
5
|
-
{{
|
|
6
|
-
{{
|
|
7
|
-
{{
|
|
8
|
-
{{
|
|
12
|
+
{{! Enums: const objects + union types }}
|
|
13
|
+
{{#if (gt (len IR.modelDefs) 0)}}
|
|
14
|
+
{{#each IR.modelDefs}}
|
|
15
|
+
{{#if (eq this.schema.kind "enum")}}
|
|
9
16
|
export const {{this.name}} = {
|
|
10
|
-
{{
|
|
17
|
+
{{#each this.schema.enumValues as |v|}}
|
|
11
18
|
"{{v}}": {{#if (or (eq v "true") (eq v "false"))}}{{v}}{{else if (reMatch "^-?[0-9]+(\\.[0-9]+)?$" v)}}{{v}}{{else}}"{{v}}"{{/if}},
|
|
12
|
-
{{
|
|
19
|
+
{{/each}}
|
|
13
20
|
} as const;
|
|
14
21
|
|
|
15
22
|
export type {{this.name}} = Enum<typeof {{this.name}}>;
|
|
16
23
|
|
|
17
|
-
{{
|
|
18
|
-
{{
|
|
24
|
+
{{/if}}
|
|
25
|
+
{{/each}}
|
|
19
26
|
|
|
20
|
-
{{
|
|
21
|
-
{{
|
|
22
|
-
|
|
27
|
+
{{! Simple types: generate as regular type exports (not in namespace) }}
|
|
28
|
+
{{! Skip predefined types - they are imported instead }}
|
|
29
|
+
{{#each IR.modelDefs}}
|
|
30
|
+
{{#if (or (eq this.schema.kind "string") (eq this.schema.kind "number") (eq this.schema.kind "integer") (eq this.schema.kind "boolean") (eq this.schema.kind "null"))}}
|
|
31
|
+
{{#unless (isPredefinedType this.name)}}
|
|
32
|
+
{{#if this.annotations.description}}
|
|
23
33
|
/**
|
|
24
34
|
* {{decodeHtml (replace this.annotations.description "*/" "*\\/")}}
|
|
25
35
|
*/
|
|
26
|
-
{{
|
|
27
|
-
{{
|
|
36
|
+
{{/if}}
|
|
37
|
+
export type {{this.name}} = {{tsTypeStripNs this.schema}};
|
|
38
|
+
{{/unless}}
|
|
39
|
+
{{/if}}
|
|
40
|
+
{{/each}}
|
|
41
|
+
|
|
42
|
+
{{! Objects and other named models: render interfaces/types from structured IR }}
|
|
43
|
+
{{#each IR.modelDefs}}
|
|
44
|
+
{{#unless (or (eq this.schema.kind "string") (eq this.schema.kind "number") (eq this.schema.kind "integer") (eq this.schema.kind "boolean") (eq this.schema.kind "null"))}}
|
|
45
|
+
{{#if this.annotations.description}}
|
|
46
|
+
/**
|
|
47
|
+
* {{decodeHtml (replace this.annotations.description "*/" "*\\/")}}
|
|
48
|
+
*/
|
|
49
|
+
{{/if}}
|
|
50
|
+
{{#if (eq this.schema.kind "object")}}
|
|
28
51
|
export interface {{this.name}} {
|
|
29
|
-
{{
|
|
30
|
-
{{
|
|
52
|
+
{{#each this.schema.properties}}
|
|
53
|
+
{{#if this.annotations.description}}
|
|
31
54
|
/** {{decodeHtml (replace this.annotations.description "*/" "*\\/")}} */
|
|
32
|
-
{{
|
|
55
|
+
{{/if}}
|
|
33
56
|
{{quotePropName this.name}}{{#unless this.required}}?{{/unless}}: {{tsTypeStripNs this.type}};
|
|
34
|
-
{{
|
|
57
|
+
{{/each}}
|
|
35
58
|
}
|
|
36
59
|
|
|
37
|
-
{{
|
|
60
|
+
{{else if (eq this.schema.kind "ref")}}
|
|
38
61
|
export type {{this.name}} = {{tsTypeStripNs this.schema}};
|
|
39
62
|
|
|
40
|
-
{{
|
|
63
|
+
{{else if (or (eq this.schema.kind "oneOf") (eq this.schema.kind "anyOf") (eq this.schema.kind "allOf"))}}
|
|
41
64
|
export type {{this.name}} = {{tsTypeStripNs this.schema}};
|
|
42
65
|
|
|
43
|
-
{{
|
|
66
|
+
{{else if (eq this.schema.kind "array")}}
|
|
44
67
|
export type {{this.name}} = {{tsTypeStripNs this.schema}};
|
|
45
68
|
|
|
46
|
-
{{
|
|
47
|
-
{{
|
|
48
|
-
{{
|
|
69
|
+
{{/if}}
|
|
70
|
+
{{/unless}}
|
|
71
|
+
{{/each}}
|
|
72
|
+
{{/if}}
|
|
49
73
|
|
|
50
74
|
{{#if IR.services}}
|
|
51
75
|
|
|
@@ -62,12 +86,12 @@ export type Enum<T> = T[keyof T];
|
|
|
62
86
|
{{~/if~}}
|
|
63
87
|
*/
|
|
64
88
|
export interface {{pascal ../tag}}{{pascal (methodName this)}}Query {
|
|
65
|
-
{{
|
|
66
|
-
{{
|
|
89
|
+
{{#each this.queryParams}}
|
|
90
|
+
{{#if this.description}}
|
|
67
91
|
/** {{decodeHtml (replace this.description "*/" "*\\/")}} */
|
|
68
|
-
{{
|
|
92
|
+
{{/if}}
|
|
69
93
|
{{quotePropName this.name}}{{#unless this.required}}?{{/unless}}: {{tsTypeStripNs this.schema}};
|
|
70
|
-
{{
|
|
94
|
+
{{/each}}
|
|
71
95
|
}
|
|
72
96
|
|
|
73
97
|
{{/if}}
|
|
@@ -4,8 +4,23 @@
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import * as Schema from "./schema";
|
|
6
6
|
|
|
7
|
+
{{! Simple types: generate as regular Zod schema exports (not in namespace) }}
|
|
8
|
+
{{#each IR.modelDefs}}
|
|
9
|
+
{{#if (or (eq this.schema.kind "string") (eq this.schema.kind "number") (eq this.schema.kind "integer") (eq this.schema.kind "boolean") (eq this.schema.kind "null"))}}
|
|
10
|
+
/**
|
|
11
|
+
* Zod schema for {{this.name}}
|
|
12
|
+
{{#if this.annotations.description}}
|
|
13
|
+
* {{decodeHtml (replace this.annotations.description "*/" "*\\/")}}
|
|
14
|
+
{{/if}}
|
|
15
|
+
*/
|
|
16
|
+
export const {{this.name}}Schema = {{zodSchema this.schema}};
|
|
17
|
+
{{/if}}
|
|
18
|
+
{{/each}}
|
|
19
|
+
|
|
20
|
+
{{! Objects and other named models: render Zod schemas from structured IR }}
|
|
7
21
|
{{#if (gt (len IR.modelDefs) 0)}}
|
|
8
22
|
{{~#each IR.modelDefs}}
|
|
23
|
+
{{~#unless (or (eq this.schema.kind "string") (eq this.schema.kind "number") (eq this.schema.kind "integer") (eq this.schema.kind "boolean") (eq this.schema.kind "null"))}}
|
|
9
24
|
{{~#if (eq this.schema.kind "enum")~}}
|
|
10
25
|
/**
|
|
11
26
|
* Zod schema for {{this.name}}
|
|
@@ -95,6 +110,7 @@ export const {{this.name}}Schema = z.array({{#if this.schema.items}}{{zodSchema
|
|
|
95
110
|
export const {{this.name}}Schema = {{zodSchema this.schema}};
|
|
96
111
|
|
|
97
112
|
{{~/if~}}
|
|
113
|
+
{{~/unless~}}
|
|
98
114
|
{{~/each~}}
|
|
99
115
|
{{~/if~}}
|
|
100
116
|
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { CoreClient } from "../client";
|
|
2
2
|
import * as Schema from "../schema";
|
|
3
|
+
{{! Generate import statements for predefined types used in this specific service }}
|
|
4
|
+
{{#if (getServicePredefinedTypes Service)}}
|
|
5
|
+
{{#each (groupByPackage (getServicePredefinedTypes Service))}}
|
|
6
|
+
import type { {{joinTypes this.types}} } from '{{this.package}}';
|
|
7
|
+
{{/each}}
|
|
8
|
+
{{/if}}
|
|
3
9
|
|
|
4
10
|
export class {{serviceName Service.tag}} {
|
|
5
11
|
constructor(private core: CoreClient) {}
|
|
@@ -7,14 +7,13 @@
|
|
|
7
7
|
"isolatedModules": true,
|
|
8
8
|
"declaration": true,
|
|
9
9
|
"removeComments": true,
|
|
10
|
-
"emitDecoratorMetadata": true,
|
|
11
|
-
"experimentalDecorators": true,
|
|
12
10
|
"allowSyntheticDefaultImports": true,
|
|
13
11
|
"target": "ES2023",
|
|
14
12
|
"sourceMap": true,
|
|
15
13
|
"outDir": "./dist",
|
|
16
14
|
"baseUrl": "./src",
|
|
17
15
|
"incremental": true,
|
|
16
|
+
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo",
|
|
18
17
|
"skipLibCheck": true,
|
|
19
18
|
"strictNullChecks": true,
|
|
20
19
|
"forceConsistentCasingInFileNames": true,
|
package/dist/index.d.mts
CHANGED
|
@@ -2,12 +2,12 @@ import { z } from 'zod';
|
|
|
2
2
|
import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
3
3
|
|
|
4
4
|
type OperationIdParser = (operationId: string, method: string, path: string) => string | Promise<string>;
|
|
5
|
-
declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
outputFileName: z.ZodOptional<z.ZodString>;
|
|
5
|
+
declare const PredefinedTypeSchema: z.ZodObject<{
|
|
6
|
+
type: z.ZodString;
|
|
7
|
+
package: z.ZodString;
|
|
8
|
+
importPath: z.ZodOptional<z.ZodString>;
|
|
10
9
|
}, z.core.$strip>;
|
|
10
|
+
type PredefinedType = z.infer<typeof PredefinedTypeSchema>;
|
|
11
11
|
declare const TYPESCRIPT_TEMPLATE_NAMES: readonly ["client.ts.hbs", "index.ts.hbs", "package.json.hbs", "README.md.hbs", "schema.ts.hbs", "schema.zod.ts.hbs", "service.ts.hbs", "tsconfig.json.hbs", "utils.ts.hbs"];
|
|
12
12
|
type TypeScriptTemplateName = (typeof TYPESCRIPT_TEMPLATE_NAMES)[number];
|
|
13
13
|
declare const TypeScriptClientSchema: z.ZodObject<{
|
|
@@ -20,16 +20,17 @@ declare const TypeScriptClientSchema: z.ZodObject<{
|
|
|
20
20
|
postCommand: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
21
|
defaultBaseURL: z.ZodOptional<z.ZodString>;
|
|
22
22
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
-
typeAugmentation: z.ZodOptional<z.ZodObject<{
|
|
24
|
-
moduleName: z.ZodOptional<z.ZodString>;
|
|
25
|
-
namespace: z.ZodOptional<z.ZodString>;
|
|
26
|
-
typeNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
-
outputFileName: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strip>>;
|
|
29
23
|
type: z.ZodLiteral<"typescript">;
|
|
30
24
|
packageName: z.ZodString;
|
|
31
25
|
moduleName: z.ZodOptional<z.ZodString>;
|
|
32
26
|
includeQueryKeys: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
predefinedTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
28
|
+
type: z.ZodString;
|
|
29
|
+
package: z.ZodString;
|
|
30
|
+
importPath: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>>>;
|
|
32
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
33
|
+
devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
33
34
|
templates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
34
35
|
}, z.core.$strip>;
|
|
35
36
|
declare const ClientSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -42,16 +43,17 @@ declare const ClientSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
42
43
|
postCommand: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
44
|
defaultBaseURL: z.ZodOptional<z.ZodString>;
|
|
44
45
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
-
typeAugmentation: z.ZodOptional<z.ZodObject<{
|
|
46
|
-
moduleName: z.ZodOptional<z.ZodString>;
|
|
47
|
-
namespace: z.ZodOptional<z.ZodString>;
|
|
48
|
-
typeNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
-
outputFileName: z.ZodOptional<z.ZodString>;
|
|
50
|
-
}, z.core.$strip>>;
|
|
51
46
|
type: z.ZodLiteral<"typescript">;
|
|
52
47
|
packageName: z.ZodString;
|
|
53
48
|
moduleName: z.ZodOptional<z.ZodString>;
|
|
54
49
|
includeQueryKeys: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
predefinedTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
|
+
type: z.ZodString;
|
|
52
|
+
package: z.ZodString;
|
|
53
|
+
importPath: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>>>;
|
|
55
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
56
|
+
devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
55
57
|
templates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
56
58
|
}, z.core.$strip>], "type">;
|
|
57
59
|
declare const ConfigSchema: z.ZodObject<{
|
|
@@ -67,23 +69,23 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
67
69
|
postCommand: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
70
|
defaultBaseURL: z.ZodOptional<z.ZodString>;
|
|
69
71
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
-
typeAugmentation: z.ZodOptional<z.ZodObject<{
|
|
71
|
-
moduleName: z.ZodOptional<z.ZodString>;
|
|
72
|
-
namespace: z.ZodOptional<z.ZodString>;
|
|
73
|
-
typeNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
-
outputFileName: z.ZodOptional<z.ZodString>;
|
|
75
|
-
}, z.core.$strip>>;
|
|
76
72
|
type: z.ZodLiteral<"typescript">;
|
|
77
73
|
packageName: z.ZodString;
|
|
78
74
|
moduleName: z.ZodOptional<z.ZodString>;
|
|
79
75
|
includeQueryKeys: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
predefinedTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
+
type: z.ZodString;
|
|
78
|
+
package: z.ZodString;
|
|
79
|
+
importPath: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strip>>>;
|
|
81
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
82
|
+
devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
80
83
|
templates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
81
84
|
}, z.core.$strip>], "type">>;
|
|
82
85
|
}, z.core.$strip>;
|
|
83
86
|
type Config = z.infer<typeof ConfigSchema>;
|
|
84
87
|
type Client = z.infer<typeof ClientSchema>;
|
|
85
88
|
type TypeScriptClient = z.infer<typeof TypeScriptClientSchema>;
|
|
86
|
-
type TypeAugmentationOptions = z.infer<typeof TypeAugmentationOptionsSchema>;
|
|
87
89
|
|
|
88
90
|
declare class ConfigService {
|
|
89
91
|
private readonly logger;
|
|
@@ -143,6 +145,7 @@ interface IR {
|
|
|
143
145
|
models: IRModel[];
|
|
144
146
|
securitySchemes: IRSecurityScheme[];
|
|
145
147
|
modelDefs: IRModelDef[];
|
|
148
|
+
openApiDocument?: any;
|
|
146
149
|
}
|
|
147
150
|
interface IRParam {
|
|
148
151
|
name: string;
|
|
@@ -245,6 +248,10 @@ declare class IrBuilderService {
|
|
|
245
248
|
private firstAllowedTag;
|
|
246
249
|
private collectSecuritySchemes;
|
|
247
250
|
private collectParams;
|
|
251
|
+
private findMatchingComponentSchema;
|
|
252
|
+
private compareSchemas;
|
|
253
|
+
private extractModelNameFromSchema;
|
|
254
|
+
private generateTypeName;
|
|
248
255
|
private extractRequestBodyWithTypes;
|
|
249
256
|
private extractRequestBody;
|
|
250
257
|
private extractResponseWithTypes;
|
|
@@ -302,8 +309,9 @@ declare class OpenApiModule {
|
|
|
302
309
|
|
|
303
310
|
interface GenerateOptions {
|
|
304
311
|
client?: string;
|
|
312
|
+
baseDir?: string;
|
|
305
313
|
}
|
|
306
314
|
declare function generate(configOrPath: Config | string, options?: GenerateOptions): Promise<void>;
|
|
307
315
|
declare function loadConfig(configPath: string): Promise<Config>;
|
|
308
316
|
|
|
309
|
-
export { type Client, ClientSchema, type Config, ConfigModule, ConfigSchema, ConfigService, type GenerateOptions, type Generator, GeneratorModule, GeneratorService, type IR, type IRAnnotations, type IRDiscriminator, type IRField, type IRModel, type IRModelDef, type IROperation, type IRParam, type IRRequestBody, type IRResponse, type IRSchema, IRSchemaKind, type IRSecurityScheme, type IRService, OpenApiModule, OpenApiService, type OperationIdParser,
|
|
317
|
+
export { type Client, ClientSchema, type Config, ConfigModule, ConfigSchema, ConfigService, type GenerateOptions, type Generator, GeneratorModule, GeneratorService, type IR, type IRAnnotations, type IRDiscriminator, type IRField, type IRModel, type IRModelDef, type IROperation, type IRParam, type IRRequestBody, type IRResponse, type IRSchema, IRSchemaKind, type IRSecurityScheme, type IRService, OpenApiModule, OpenApiService, type OperationIdParser, type PredefinedType, PredefinedTypeSchema, TYPESCRIPT_TEMPLATE_NAMES, type TypeScriptClient, TypeScriptClientSchema, type TypeScriptTemplateName, defineConfig, generate, loadConfig, loadMjsConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { z } from 'zod';
|
|
|
2
2
|
import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
3
3
|
|
|
4
4
|
type OperationIdParser = (operationId: string, method: string, path: string) => string | Promise<string>;
|
|
5
|
-
declare const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
outputFileName: z.ZodOptional<z.ZodString>;
|
|
5
|
+
declare const PredefinedTypeSchema: z.ZodObject<{
|
|
6
|
+
type: z.ZodString;
|
|
7
|
+
package: z.ZodString;
|
|
8
|
+
importPath: z.ZodOptional<z.ZodString>;
|
|
10
9
|
}, z.core.$strip>;
|
|
10
|
+
type PredefinedType = z.infer<typeof PredefinedTypeSchema>;
|
|
11
11
|
declare const TYPESCRIPT_TEMPLATE_NAMES: readonly ["client.ts.hbs", "index.ts.hbs", "package.json.hbs", "README.md.hbs", "schema.ts.hbs", "schema.zod.ts.hbs", "service.ts.hbs", "tsconfig.json.hbs", "utils.ts.hbs"];
|
|
12
12
|
type TypeScriptTemplateName = (typeof TYPESCRIPT_TEMPLATE_NAMES)[number];
|
|
13
13
|
declare const TypeScriptClientSchema: z.ZodObject<{
|
|
@@ -20,16 +20,17 @@ declare const TypeScriptClientSchema: z.ZodObject<{
|
|
|
20
20
|
postCommand: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
21
|
defaultBaseURL: z.ZodOptional<z.ZodString>;
|
|
22
22
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
-
typeAugmentation: z.ZodOptional<z.ZodObject<{
|
|
24
|
-
moduleName: z.ZodOptional<z.ZodString>;
|
|
25
|
-
namespace: z.ZodOptional<z.ZodString>;
|
|
26
|
-
typeNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
27
|
-
outputFileName: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strip>>;
|
|
29
23
|
type: z.ZodLiteral<"typescript">;
|
|
30
24
|
packageName: z.ZodString;
|
|
31
25
|
moduleName: z.ZodOptional<z.ZodString>;
|
|
32
26
|
includeQueryKeys: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
predefinedTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
28
|
+
type: z.ZodString;
|
|
29
|
+
package: z.ZodString;
|
|
30
|
+
importPath: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>>>;
|
|
32
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
33
|
+
devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
33
34
|
templates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
34
35
|
}, z.core.$strip>;
|
|
35
36
|
declare const ClientSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -42,16 +43,17 @@ declare const ClientSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
42
43
|
postCommand: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
44
|
defaultBaseURL: z.ZodOptional<z.ZodString>;
|
|
44
45
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
-
typeAugmentation: z.ZodOptional<z.ZodObject<{
|
|
46
|
-
moduleName: z.ZodOptional<z.ZodString>;
|
|
47
|
-
namespace: z.ZodOptional<z.ZodString>;
|
|
48
|
-
typeNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
-
outputFileName: z.ZodOptional<z.ZodString>;
|
|
50
|
-
}, z.core.$strip>>;
|
|
51
46
|
type: z.ZodLiteral<"typescript">;
|
|
52
47
|
packageName: z.ZodString;
|
|
53
48
|
moduleName: z.ZodOptional<z.ZodString>;
|
|
54
49
|
includeQueryKeys: z.ZodOptional<z.ZodBoolean>;
|
|
50
|
+
predefinedTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
51
|
+
type: z.ZodString;
|
|
52
|
+
package: z.ZodString;
|
|
53
|
+
importPath: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>>>;
|
|
55
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
56
|
+
devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
55
57
|
templates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
56
58
|
}, z.core.$strip>], "type">;
|
|
57
59
|
declare const ConfigSchema: z.ZodObject<{
|
|
@@ -67,23 +69,23 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
67
69
|
postCommand: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
70
|
defaultBaseURL: z.ZodOptional<z.ZodString>;
|
|
69
71
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
-
typeAugmentation: z.ZodOptional<z.ZodObject<{
|
|
71
|
-
moduleName: z.ZodOptional<z.ZodString>;
|
|
72
|
-
namespace: z.ZodOptional<z.ZodString>;
|
|
73
|
-
typeNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
-
outputFileName: z.ZodOptional<z.ZodString>;
|
|
75
|
-
}, z.core.$strip>>;
|
|
76
72
|
type: z.ZodLiteral<"typescript">;
|
|
77
73
|
packageName: z.ZodString;
|
|
78
74
|
moduleName: z.ZodOptional<z.ZodString>;
|
|
79
75
|
includeQueryKeys: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
+
predefinedTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
+
type: z.ZodString;
|
|
78
|
+
package: z.ZodString;
|
|
79
|
+
importPath: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$strip>>>;
|
|
81
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
82
|
+
devDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
80
83
|
templates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
81
84
|
}, z.core.$strip>], "type">>;
|
|
82
85
|
}, z.core.$strip>;
|
|
83
86
|
type Config = z.infer<typeof ConfigSchema>;
|
|
84
87
|
type Client = z.infer<typeof ClientSchema>;
|
|
85
88
|
type TypeScriptClient = z.infer<typeof TypeScriptClientSchema>;
|
|
86
|
-
type TypeAugmentationOptions = z.infer<typeof TypeAugmentationOptionsSchema>;
|
|
87
89
|
|
|
88
90
|
declare class ConfigService {
|
|
89
91
|
private readonly logger;
|
|
@@ -143,6 +145,7 @@ interface IR {
|
|
|
143
145
|
models: IRModel[];
|
|
144
146
|
securitySchemes: IRSecurityScheme[];
|
|
145
147
|
modelDefs: IRModelDef[];
|
|
148
|
+
openApiDocument?: any;
|
|
146
149
|
}
|
|
147
150
|
interface IRParam {
|
|
148
151
|
name: string;
|
|
@@ -245,6 +248,10 @@ declare class IrBuilderService {
|
|
|
245
248
|
private firstAllowedTag;
|
|
246
249
|
private collectSecuritySchemes;
|
|
247
250
|
private collectParams;
|
|
251
|
+
private findMatchingComponentSchema;
|
|
252
|
+
private compareSchemas;
|
|
253
|
+
private extractModelNameFromSchema;
|
|
254
|
+
private generateTypeName;
|
|
248
255
|
private extractRequestBodyWithTypes;
|
|
249
256
|
private extractRequestBody;
|
|
250
257
|
private extractResponseWithTypes;
|
|
@@ -302,8 +309,9 @@ declare class OpenApiModule {
|
|
|
302
309
|
|
|
303
310
|
interface GenerateOptions {
|
|
304
311
|
client?: string;
|
|
312
|
+
baseDir?: string;
|
|
305
313
|
}
|
|
306
314
|
declare function generate(configOrPath: Config | string, options?: GenerateOptions): Promise<void>;
|
|
307
315
|
declare function loadConfig(configPath: string): Promise<Config>;
|
|
308
316
|
|
|
309
|
-
export { type Client, ClientSchema, type Config, ConfigModule, ConfigSchema, ConfigService, type GenerateOptions, type Generator, GeneratorModule, GeneratorService, type IR, type IRAnnotations, type IRDiscriminator, type IRField, type IRModel, type IRModelDef, type IROperation, type IRParam, type IRRequestBody, type IRResponse, type IRSchema, IRSchemaKind, type IRSecurityScheme, type IRService, OpenApiModule, OpenApiService, type OperationIdParser,
|
|
317
|
+
export { type Client, ClientSchema, type Config, ConfigModule, ConfigSchema, ConfigService, type GenerateOptions, type Generator, GeneratorModule, GeneratorService, type IR, type IRAnnotations, type IRDiscriminator, type IRField, type IRModel, type IRModelDef, type IROperation, type IRParam, type IRRequestBody, type IRResponse, type IRSchema, IRSchemaKind, type IRSecurityScheme, type IRService, OpenApiModule, OpenApiService, type OperationIdParser, type PredefinedType, PredefinedTypeSchema, TYPESCRIPT_TEMPLATE_NAMES, type TypeScriptClient, TypeScriptClientSchema, type TypeScriptTemplateName, defineConfig, generate, loadConfig, loadMjsConfig };
|