@hey-api/openapi-ts 0.90.3 → 0.90.5
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 +24 -3
- package/dist/clients/fetch/client.ts +7 -1
- package/dist/clients/ky/client.ts +7 -1
- package/dist/clients/next/client.ts +7 -1
- package/dist/{config-kLkHIaUr.d.mts → config-BCMpBYUB.d.mts} +105 -35
- package/dist/{config-Cmhj4J0r.d.cts → config-CtVXEKSL.d.cts} +105 -35
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +2 -2
- package/dist/internal.cjs +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.mts +1 -1
- package/dist/internal.mjs +1 -1
- package/dist/{openApi-Ci-wjGgv.mjs → openApi-B6J9qPwL.mjs} +312 -65
- package/dist/openApi-B6J9qPwL.mjs.map +1 -0
- package/dist/{openApi-BetJIgjU.cjs → openApi-BZ7m5ia5.cjs} +312 -65
- package/dist/openApi-BZ7m5ia5.cjs.map +1 -0
- package/dist/run.cjs +3 -3
- package/dist/run.mjs +3 -3
- package/dist/{src-CV7EsNIp.mjs → src-BehyjtZ7.mjs} +2 -2
- package/dist/src-BehyjtZ7.mjs.map +1 -0
- package/dist/{src-CJqsBn3S.cjs → src-BkOFTEi8.cjs} +2 -2
- package/dist/src-BkOFTEi8.cjs.map +1 -0
- package/package.json +3 -2
- package/dist/openApi-BetJIgjU.cjs.map +0 -1
- package/dist/openApi-Ci-wjGgv.mjs.map +0 -1
- package/dist/src-CJqsBn3S.cjs.map +0 -1
- package/dist/src-CV7EsNIp.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
8
|
-
<a href="https://
|
|
8
|
+
<a href="https://www.devtrends.dev/trends?c=v1.kZIBIg"><img src="https://api.devtrends.dev/badge/npm/%40hey-api%2Fopenapi-ts?period=month&style=flat&view=value" alt="DevTrends badge for @hey-api/openapi-ts" /></a>
|
|
9
|
+
<a href="https://www.devtrends.dev/trends?c=v1.kZIBIg&v=change"><img src="https://api.devtrends.dev/badge/npm/%40hey-api%2Fopenapi-ts?period=year&style=flat&view=change" alt="DevTrends badge for @hey-api/openapi-ts" /></a>
|
|
9
10
|
<a href="https://github.com/hey-api/openapi-ts/actions?query=branch%3Amain"><img src="https://github.com/hey-api/openapi-ts/actions/workflows/ci.yml/badge.svg?event=push&branch=main" alt="CI status" /></a>
|
|
10
|
-
<a href="https://github.com/hey-api/openapi-ts"
|
|
11
|
-
<a href="https://github.com/hey-api/openapi-ts/blob/main/LICENSE.md"
|
|
11
|
+
<a href="https://github.com/hey-api/openapi-ts"><img src="https://img.shields.io/github/stars/hey-api/openapi-ts?style=flat&logo=github&label=GitHub&color=54C82D" alt="GitHub stars" /></a>
|
|
12
|
+
<a href="https://github.com/hey-api/openapi-ts/blob/main/LICENSE.md"><img src="https://img.shields.io/github/license/hey-api/openapi-ts" alt="MIT License"></a>
|
|
12
13
|
</p>
|
|
13
14
|
|
|
14
15
|
<p align="center">
|
|
@@ -92,6 +93,26 @@ Hey API is sponsor-funded. If you rely on Hey API in production, consider becomi
|
|
|
92
93
|
<p></p>
|
|
93
94
|
</td>
|
|
94
95
|
</tr>
|
|
96
|
+
<tr>
|
|
97
|
+
<td align="center">
|
|
98
|
+
<p></p>
|
|
99
|
+
<p>
|
|
100
|
+
<a href="https://kutt.it/6vrYy9" target="_blank">
|
|
101
|
+
<picture height="50px">
|
|
102
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://heyapi.dev/assets/mintlify/logo-light.svg">
|
|
103
|
+
<img alt="Mintlify logo" height="50px" src="https://heyapi.dev/assets/mintlify/logo-dark.svg">
|
|
104
|
+
</picture>
|
|
105
|
+
</a>
|
|
106
|
+
<br/>
|
|
107
|
+
The intelligent knowledge platform.
|
|
108
|
+
<br/>
|
|
109
|
+
<a href="https://kutt.it/6vrYy9" style="text-decoration:none;" target="_blank">
|
|
110
|
+
mintlify.com
|
|
111
|
+
</a>
|
|
112
|
+
</p>
|
|
113
|
+
<p></p>
|
|
114
|
+
</td>
|
|
115
|
+
</tr>
|
|
95
116
|
</tbody>
|
|
96
117
|
</table>
|
|
97
118
|
|
|
@@ -180,10 +180,16 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
180
180
|
case 'arrayBuffer':
|
|
181
181
|
case 'blob':
|
|
182
182
|
case 'formData':
|
|
183
|
-
case 'json':
|
|
184
183
|
case 'text':
|
|
185
184
|
data = await response[parseAs]();
|
|
186
185
|
break;
|
|
186
|
+
case 'json': {
|
|
187
|
+
// Some servers return 200 with no Content-Length and empty body.
|
|
188
|
+
// response.json() would throw; read as text and parse if non-empty.
|
|
189
|
+
const text = await response.text();
|
|
190
|
+
data = text ? JSON.parse(text) : {};
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
187
193
|
case 'stream':
|
|
188
194
|
return opts.responseStyle === 'data'
|
|
189
195
|
? response.body
|
|
@@ -249,10 +249,16 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
249
249
|
case 'arrayBuffer':
|
|
250
250
|
case 'blob':
|
|
251
251
|
case 'formData':
|
|
252
|
-
case 'json':
|
|
253
252
|
case 'text':
|
|
254
253
|
data = await response[parseAs]();
|
|
255
254
|
break;
|
|
255
|
+
case 'json': {
|
|
256
|
+
// Some servers return 200 with no Content-Length and empty body.
|
|
257
|
+
// response.json() would throw; read as text and parse if non-empty.
|
|
258
|
+
const text = await response.text();
|
|
259
|
+
data = text ? JSON.parse(text) : {};
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
256
262
|
case 'stream':
|
|
257
263
|
return opts.responseStyle === 'data'
|
|
258
264
|
? response.body
|
|
@@ -142,10 +142,16 @@ export const createClient = (config: Config = {}): Client => {
|
|
|
142
142
|
case 'arrayBuffer':
|
|
143
143
|
case 'blob':
|
|
144
144
|
case 'formData':
|
|
145
|
-
case 'json':
|
|
146
145
|
case 'text':
|
|
147
146
|
data = await response[parseAs]();
|
|
148
147
|
break;
|
|
148
|
+
case 'json': {
|
|
149
|
+
// Some servers return 200 with no Content-Length and empty body.
|
|
150
|
+
// response.json() would throw; read as text and parse if non-empty.
|
|
151
|
+
const text = await response.text();
|
|
152
|
+
data = text ? JSON.parse(text) : {};
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
149
155
|
case 'stream':
|
|
150
156
|
return {
|
|
151
157
|
data: response.body,
|
|
@@ -3,32 +3,15 @@ import * as _hey_api_codegen_core0 from "@hey-api/codegen-core";
|
|
|
3
3
|
import { AnalysisContext, BindingKind, ExportModule, File, FromRef, IProject, ImportModule, Language, NameConflictResolver, Node, NodeName, NodeNameSanitizer, NodeRelationship, NodeScope, Project, Ref, Refs, RenderContext, Renderer, StructureLocation, Symbol, SymbolIdentifier, SymbolIn, SymbolMeta } from "@hey-api/codegen-core";
|
|
4
4
|
import ts from "typescript";
|
|
5
5
|
import { RangeOptions, SemVer } from "semver";
|
|
6
|
+
import { MaybeArray, MaybeFunc, MaybePromise } from "@hey-api/types";
|
|
6
7
|
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpRequest, HttpResponse } from "@angular/common/http";
|
|
7
8
|
import { Injector } from "@angular/core";
|
|
8
9
|
import { AxiosError, AxiosInstance, AxiosRequestHeaders, AxiosResponse, AxiosStatic, CreateAxiosDefaults } from "axios";
|
|
9
10
|
import { AsyncDataOptions, UseFetchOptions, useAsyncData, useFetch, useLazyAsyncData, useLazyFetch } from "nuxt/app";
|
|
10
11
|
import { Ref as Ref$1 } from "vue";
|
|
11
12
|
import { FetchOptions, ResponseType, ofetch } from "ofetch";
|
|
13
|
+
import { MaybeFunc as MaybeFunc$1 } from "~/types/utils";
|
|
12
14
|
|
|
13
|
-
//#region src/types/utils.d.ts
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Accepts a value, a function returning a value, or a function returning a promise of a value.
|
|
17
|
-
*/
|
|
18
|
-
type LazyOrAsync<T> = T | (() => MaybePromise<T>);
|
|
19
|
-
/**
|
|
20
|
-
* Accepts a value or a readonly array of values of type T.
|
|
21
|
-
*/
|
|
22
|
-
type MaybeArray$1<T> = T | ReadonlyArray<T>;
|
|
23
|
-
/**
|
|
24
|
-
* Accepts a value or a function returning a value.
|
|
25
|
-
*/
|
|
26
|
-
type MaybeFunc$1<T extends (...args: Array<any>) => any> = T | ReturnType<T>;
|
|
27
|
-
/**
|
|
28
|
-
* Accepts a value or a promise of a value.
|
|
29
|
-
*/
|
|
30
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
31
|
-
//#endregion
|
|
32
15
|
//#region src/utils/naming/types.d.ts
|
|
33
16
|
/**
|
|
34
17
|
* Available casing strategies.
|
|
@@ -39,7 +22,7 @@ type Casing = 'camelCase' | 'PascalCase' | 'preserve' | 'snake_case' | 'SCREAMIN
|
|
|
39
22
|
*
|
|
40
23
|
* Template supports `{{name}}` variable.
|
|
41
24
|
*/
|
|
42
|
-
type NameTransformer = MaybeFunc
|
|
25
|
+
type NameTransformer = MaybeFunc<(name: string) => string>;
|
|
43
26
|
/**
|
|
44
27
|
* Full naming configuration.
|
|
45
28
|
*/
|
|
@@ -175,7 +158,7 @@ type SourceConfig = FeatureToggle & {
|
|
|
175
158
|
//#endregion
|
|
176
159
|
//#region src/config/output/types.d.ts
|
|
177
160
|
type ImportFileExtensions = '.js' | '.ts';
|
|
178
|
-
type Header$1 = MaybeFunc
|
|
161
|
+
type Header$1 = MaybeFunc<(ctx: RenderContext) => MaybeArray<string> | null | undefined>;
|
|
179
162
|
type UserOutput = {
|
|
180
163
|
/**
|
|
181
164
|
* Defines casing of the output fields. By default, we preserve `input`
|
|
@@ -2739,7 +2722,7 @@ interface JsonSchemaDraft2020_12 extends ArrayKeywords, NumberKeywords, ObjectKe
|
|
|
2739
2722
|
/**
|
|
2740
2723
|
* If it is an array, it must be an array of strings, where each string is the name of one of the basic types, and each element is unique. In this case, the JSON snippet is valid if it matches any of the given types.
|
|
2741
2724
|
*/
|
|
2742
|
-
type?: MaybeArray
|
|
2725
|
+
type?: MaybeArray<JsonSchemaTypes$1>;
|
|
2743
2726
|
/**
|
|
2744
2727
|
* The boolean keywords `readOnly` and `writeOnly` are typically used in an API context. `readOnly` indicates that a value should not be modified. It could be used to indicate that a `PUT` request that changes a value would result in a `400 Bad Request` response. `writeOnly` indicates that a value may be set, but will remain hidden. In could be used to indicate you can set a value with a `PUT` request, but it would not be included when retrieving that record with a `GET` request.
|
|
2745
2728
|
*/
|
|
@@ -4273,14 +4256,6 @@ declare class TsDslContext {
|
|
|
4273
4256
|
declare const ctx: TsDslContext;
|
|
4274
4257
|
//#endregion
|
|
4275
4258
|
//#region src/ts-dsl/base.d.ts
|
|
4276
|
-
/**
|
|
4277
|
-
* Accepts a value or a readonly array of values of type T.
|
|
4278
|
-
*/
|
|
4279
|
-
type MaybeArray<T> = T | ReadonlyArray<T>;
|
|
4280
|
-
/**
|
|
4281
|
-
* Accepts a value or a function returning a value.
|
|
4282
|
-
*/
|
|
4283
|
-
type MaybeFunc<T extends (...args: Array<any>) => any> = T | ReturnType<T>;
|
|
4284
4259
|
declare abstract class TsDsl<T extends ts.Node = ts.Node> implements Node<T> {
|
|
4285
4260
|
analyze(_: AnalysisContext): void;
|
|
4286
4261
|
clone(): this;
|
|
@@ -13938,6 +13913,14 @@ type GetIntegerLimit = (format: string | undefined) => IntegerLimit | undefined;
|
|
|
13938
13913
|
//#endregion
|
|
13939
13914
|
//#region src/plugins/valibot/resolvers/types.d.ts
|
|
13940
13915
|
type Resolvers$1 = Plugin.Resolvers<{
|
|
13916
|
+
/**
|
|
13917
|
+
* Resolver for enum schemas.
|
|
13918
|
+
*
|
|
13919
|
+
* Allows customization of how enum types are rendered.
|
|
13920
|
+
*
|
|
13921
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
13922
|
+
*/
|
|
13923
|
+
enum?: (ctx: EnumResolverContext$1) => PipeResult | undefined;
|
|
13941
13924
|
/**
|
|
13942
13925
|
* Resolver for number schemas.
|
|
13943
13926
|
*
|
|
@@ -14014,6 +13997,41 @@ interface BaseContext$1 extends DollarTsDsl {
|
|
|
14014
13997
|
v: Symbol;
|
|
14015
13998
|
};
|
|
14016
13999
|
}
|
|
14000
|
+
interface EnumResolverContext$1 extends BaseContext$1 {
|
|
14001
|
+
/**
|
|
14002
|
+
* Nodes used to build different parts of the enum schema.
|
|
14003
|
+
*/
|
|
14004
|
+
nodes: {
|
|
14005
|
+
/**
|
|
14006
|
+
* Returns the base enum expression (v.picklist([...])).
|
|
14007
|
+
*/
|
|
14008
|
+
base: (ctx: EnumResolverContext$1) => PipeResult;
|
|
14009
|
+
/**
|
|
14010
|
+
* Returns parsed enum items with metadata about the enum members.
|
|
14011
|
+
*/
|
|
14012
|
+
items: (ctx: EnumResolverContext$1) => {
|
|
14013
|
+
/**
|
|
14014
|
+
* String literal values for use with v.picklist([...]).
|
|
14015
|
+
*/
|
|
14016
|
+
enumMembers: Array<ReturnType<typeof $.literal>>;
|
|
14017
|
+
/**
|
|
14018
|
+
* Whether the enum includes a null value.
|
|
14019
|
+
*/
|
|
14020
|
+
isNullable: boolean;
|
|
14021
|
+
};
|
|
14022
|
+
/**
|
|
14023
|
+
* Returns a nullable wrapper if the enum includes null, undefined otherwise.
|
|
14024
|
+
*/
|
|
14025
|
+
nullable: (ctx: EnumResolverContext$1) => PipeResult | undefined;
|
|
14026
|
+
};
|
|
14027
|
+
schema: SchemaWithType<'enum'>;
|
|
14028
|
+
/**
|
|
14029
|
+
* Utility functions for enum schema processing.
|
|
14030
|
+
*/
|
|
14031
|
+
utils: {
|
|
14032
|
+
state: Refs<PluginState$1>;
|
|
14033
|
+
};
|
|
14034
|
+
}
|
|
14017
14035
|
interface NumberResolverContext$1 extends BaseContext$1 {
|
|
14018
14036
|
/**
|
|
14019
14037
|
* Nodes used to build different parts of the number schema.
|
|
@@ -14309,6 +14327,14 @@ type Chain = ReturnType<typeof $.call | typeof $.expr>;
|
|
|
14309
14327
|
//#endregion
|
|
14310
14328
|
//#region src/plugins/zod/resolvers/types.d.ts
|
|
14311
14329
|
type Resolvers = Plugin.Resolvers<{
|
|
14330
|
+
/**
|
|
14331
|
+
* Resolver for enum schemas.
|
|
14332
|
+
*
|
|
14333
|
+
* Allows customization of how enum types are rendered.
|
|
14334
|
+
*
|
|
14335
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
14336
|
+
*/
|
|
14337
|
+
enum?: (ctx: EnumResolverContext) => Chain | undefined;
|
|
14312
14338
|
/**
|
|
14313
14339
|
* Resolver for number schemas.
|
|
14314
14340
|
*
|
|
@@ -14357,7 +14383,7 @@ type Resolvers = Plugin.Resolvers<{
|
|
|
14357
14383
|
response?: ValidatorResolver;
|
|
14358
14384
|
};
|
|
14359
14385
|
}>;
|
|
14360
|
-
type ValidatorResolver = (ctx: ValidatorResolverContext) => MaybeArray
|
|
14386
|
+
type ValidatorResolver = (ctx: ValidatorResolverContext) => MaybeArray<TsDsl<ts.Statement>> | null | undefined;
|
|
14361
14387
|
interface BaseContext extends DollarTsDsl {
|
|
14362
14388
|
/**
|
|
14363
14389
|
* Functions for working with chains.
|
|
@@ -14385,6 +14411,50 @@ interface BaseContext extends DollarTsDsl {
|
|
|
14385
14411
|
z: Symbol;
|
|
14386
14412
|
};
|
|
14387
14413
|
}
|
|
14414
|
+
interface EnumResolverContext extends BaseContext {
|
|
14415
|
+
/**
|
|
14416
|
+
* Nodes used to build different parts of the enum schema.
|
|
14417
|
+
*/
|
|
14418
|
+
nodes: {
|
|
14419
|
+
/**
|
|
14420
|
+
* Returns the base enum expression (z.enum([...]) or z.union([...]) for mixed types).
|
|
14421
|
+
*/
|
|
14422
|
+
base: (ctx: EnumResolverContext) => Chain;
|
|
14423
|
+
/**
|
|
14424
|
+
* Returns parsed enum items with metadata about the enum members.
|
|
14425
|
+
*/
|
|
14426
|
+
items: (ctx: EnumResolverContext) => {
|
|
14427
|
+
/**
|
|
14428
|
+
* Whether all enum items are strings (determines if z.enum can be used).
|
|
14429
|
+
*/
|
|
14430
|
+
allStrings: boolean;
|
|
14431
|
+
/**
|
|
14432
|
+
* String literal values for use with z.enum([...]).
|
|
14433
|
+
*/
|
|
14434
|
+
enumMembers: Array<ReturnType<typeof $.literal>>;
|
|
14435
|
+
/**
|
|
14436
|
+
* Whether the enum includes a null value.
|
|
14437
|
+
*/
|
|
14438
|
+
isNullable: boolean;
|
|
14439
|
+
/**
|
|
14440
|
+
* z.literal(...) expressions for each non-null enum value.
|
|
14441
|
+
*/
|
|
14442
|
+
literalMembers: Array<Chain>;
|
|
14443
|
+
};
|
|
14444
|
+
/**
|
|
14445
|
+
* Returns a nullable wrapper if the enum includes null, undefined otherwise.
|
|
14446
|
+
*/
|
|
14447
|
+
nullable: (ctx: EnumResolverContext) => Chain | undefined;
|
|
14448
|
+
};
|
|
14449
|
+
schema: SchemaWithType<'enum'>;
|
|
14450
|
+
/**
|
|
14451
|
+
* Utility functions for enum schema processing.
|
|
14452
|
+
*/
|
|
14453
|
+
utils: {
|
|
14454
|
+
ast: Partial<Omit<Ast, 'typeName'>>;
|
|
14455
|
+
state: Refs<PluginState>;
|
|
14456
|
+
};
|
|
14457
|
+
}
|
|
14388
14458
|
interface NumberResolverContext extends BaseContext {
|
|
14389
14459
|
/**
|
|
14390
14460
|
* Nodes used to build different parts of the number schema.
|
|
@@ -16341,7 +16411,7 @@ interface UserConfig {
|
|
|
16341
16411
|
* inputs. If you define an array of outputs with the same length, we will
|
|
16342
16412
|
* generate multiple outputs, one for each input.
|
|
16343
16413
|
*/
|
|
16344
|
-
input: MaybeArray
|
|
16414
|
+
input: MaybeArray<UserInput | Required<UserInput>['path']>;
|
|
16345
16415
|
/**
|
|
16346
16416
|
* Show an interactive error reporting tool when the program crashes? You
|
|
16347
16417
|
* generally want to keep this disabled (default).
|
|
@@ -16361,7 +16431,7 @@ interface UserConfig {
|
|
|
16361
16431
|
* If you define an array of outputs with the same length as inputs, we will
|
|
16362
16432
|
* generate multiple outputs, one for each input.
|
|
16363
16433
|
*/
|
|
16364
|
-
output: MaybeArray
|
|
16434
|
+
output: MaybeArray<string | UserOutput>;
|
|
16365
16435
|
/**
|
|
16366
16436
|
* Customize how the input is parsed and transformed before it's passed to
|
|
16367
16437
|
* plugins.
|
|
@@ -16401,5 +16471,5 @@ type Config = Omit<Required<UserConfig>, 'input' | 'logs' | 'output' | 'parser'
|
|
|
16401
16471
|
plugins: { [K in PluginNames]?: Plugin.Config<PluginConfigMap[K]> };
|
|
16402
16472
|
};
|
|
16403
16473
|
//#endregion
|
|
16404
|
-
export { keywords as A, IR as B, Client$5 as C, reserved as D, DollarTsDsl as E, TsDslContext as F,
|
|
16405
|
-
//# sourceMappingURL=config-
|
|
16474
|
+
export { keywords as A, IR as B, Client$5 as C, reserved as D, DollarTsDsl as E, TsDslContext as F, ctx as I, CallArgs as L, TsDsl as M, TypeTsDsl as N, TypeScriptRenderer as O, ExampleOptions as P, OperationPath as R, Client$4 as S, $ as T, Casing as V, Client as _, Plugin as a, Client$2 as b, OpenApiOperationObject as c, OpenApiResponseObject as d, OpenApiSchemaObject as f, ExpressionTransformer as g, TypeTransformer as h, DefinePlugin as i, MaybeTsDsl as j, regexp as k, OpenApiParameterObject as l, Logger as m, UserConfig as n, OpenApi as o, Context as p, Input as r, OpenApiMetaObject as s, Config as t, OpenApiRequestBodyObject as u, PluginHandler as v, Client$6 as w, Client$3 as x, Client$1 as y, OperationStrategy as z };
|
|
16475
|
+
//# sourceMappingURL=config-BCMpBYUB.d.mts.map
|
|
@@ -1,28 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
import * as _hey_api_codegen_core0 from "@hey-api/codegen-core";
|
|
3
3
|
import { AnalysisContext, BindingKind, ExportModule, File, FromRef, IProject, ImportModule, Language, NameConflictResolver, Node, NodeName, NodeNameSanitizer, NodeRelationship, NodeScope, Project, Ref, Refs, RenderContext, Renderer, StructureLocation, Symbol, SymbolIdentifier, SymbolIn, SymbolMeta } from "@hey-api/codegen-core";
|
|
4
|
+
import { MaybeArray, MaybeFunc, MaybePromise } from "@hey-api/types";
|
|
4
5
|
import ts from "typescript";
|
|
5
6
|
import { RangeOptions, SemVer } from "semver";
|
|
7
|
+
import { MaybeFunc as MaybeFunc$1 } from "~/types/utils";
|
|
6
8
|
|
|
7
|
-
//#region src/types/utils.d.ts
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Accepts a value, a function returning a value, or a function returning a promise of a value.
|
|
11
|
-
*/
|
|
12
|
-
type LazyOrAsync<T> = T | (() => MaybePromise<T>);
|
|
13
|
-
/**
|
|
14
|
-
* Accepts a value or a readonly array of values of type T.
|
|
15
|
-
*/
|
|
16
|
-
type MaybeArray$1<T> = T | ReadonlyArray<T>;
|
|
17
|
-
/**
|
|
18
|
-
* Accepts a value or a function returning a value.
|
|
19
|
-
*/
|
|
20
|
-
type MaybeFunc$1<T extends (...args: Array<any>) => any> = T | ReturnType<T>;
|
|
21
|
-
/**
|
|
22
|
-
* Accepts a value or a promise of a value.
|
|
23
|
-
*/
|
|
24
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
25
|
-
//#endregion
|
|
26
9
|
//#region src/utils/naming/types.d.ts
|
|
27
10
|
/**
|
|
28
11
|
* Available casing strategies.
|
|
@@ -33,7 +16,7 @@ type Casing = 'camelCase' | 'PascalCase' | 'preserve' | 'snake_case' | 'SCREAMIN
|
|
|
33
16
|
*
|
|
34
17
|
* Template supports `{{name}}` variable.
|
|
35
18
|
*/
|
|
36
|
-
type NameTransformer = MaybeFunc
|
|
19
|
+
type NameTransformer = MaybeFunc<(name: string) => string>;
|
|
37
20
|
/**
|
|
38
21
|
* Full naming configuration.
|
|
39
22
|
*/
|
|
@@ -169,7 +152,7 @@ type SourceConfig = FeatureToggle & {
|
|
|
169
152
|
//#endregion
|
|
170
153
|
//#region src/config/output/types.d.ts
|
|
171
154
|
type ImportFileExtensions = '.js' | '.ts';
|
|
172
|
-
type Header$1 = MaybeFunc
|
|
155
|
+
type Header$1 = MaybeFunc<(ctx: RenderContext) => MaybeArray<string> | null | undefined>;
|
|
173
156
|
type UserOutput = {
|
|
174
157
|
/**
|
|
175
158
|
* Defines casing of the output fields. By default, we preserve `input`
|
|
@@ -2733,7 +2716,7 @@ interface JsonSchemaDraft2020_12 extends ArrayKeywords, NumberKeywords, ObjectKe
|
|
|
2733
2716
|
/**
|
|
2734
2717
|
* If it is an array, it must be an array of strings, where each string is the name of one of the basic types, and each element is unique. In this case, the JSON snippet is valid if it matches any of the given types.
|
|
2735
2718
|
*/
|
|
2736
|
-
type?: MaybeArray
|
|
2719
|
+
type?: MaybeArray<JsonSchemaTypes$1>;
|
|
2737
2720
|
/**
|
|
2738
2721
|
* The boolean keywords `readOnly` and `writeOnly` are typically used in an API context. `readOnly` indicates that a value should not be modified. It could be used to indicate that a `PUT` request that changes a value would result in a `400 Bad Request` response. `writeOnly` indicates that a value may be set, but will remain hidden. In could be used to indicate you can set a value with a `PUT` request, but it would not be included when retrieving that record with a `GET` request.
|
|
2739
2722
|
*/
|
|
@@ -4267,14 +4250,6 @@ declare class TsDslContext {
|
|
|
4267
4250
|
declare const ctx: TsDslContext;
|
|
4268
4251
|
//#endregion
|
|
4269
4252
|
//#region src/ts-dsl/base.d.ts
|
|
4270
|
-
/**
|
|
4271
|
-
* Accepts a value or a readonly array of values of type T.
|
|
4272
|
-
*/
|
|
4273
|
-
type MaybeArray<T> = T | ReadonlyArray<T>;
|
|
4274
|
-
/**
|
|
4275
|
-
* Accepts a value or a function returning a value.
|
|
4276
|
-
*/
|
|
4277
|
-
type MaybeFunc<T extends (...args: Array<any>) => any> = T | ReturnType<T>;
|
|
4278
4253
|
declare abstract class TsDsl<T extends ts.Node = ts.Node> implements Node<T> {
|
|
4279
4254
|
analyze(_: AnalysisContext): void;
|
|
4280
4255
|
clone(): this;
|
|
@@ -13066,6 +13041,14 @@ type GetIntegerLimit = (format: string | undefined) => IntegerLimit | undefined;
|
|
|
13066
13041
|
//#endregion
|
|
13067
13042
|
//#region src/plugins/valibot/resolvers/types.d.ts
|
|
13068
13043
|
type Resolvers$1 = Plugin.Resolvers<{
|
|
13044
|
+
/**
|
|
13045
|
+
* Resolver for enum schemas.
|
|
13046
|
+
*
|
|
13047
|
+
* Allows customization of how enum types are rendered.
|
|
13048
|
+
*
|
|
13049
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
13050
|
+
*/
|
|
13051
|
+
enum?: (ctx: EnumResolverContext$1) => PipeResult | undefined;
|
|
13069
13052
|
/**
|
|
13070
13053
|
* Resolver for number schemas.
|
|
13071
13054
|
*
|
|
@@ -13142,6 +13125,41 @@ interface BaseContext$1 extends DollarTsDsl {
|
|
|
13142
13125
|
v: Symbol;
|
|
13143
13126
|
};
|
|
13144
13127
|
}
|
|
13128
|
+
interface EnumResolverContext$1 extends BaseContext$1 {
|
|
13129
|
+
/**
|
|
13130
|
+
* Nodes used to build different parts of the enum schema.
|
|
13131
|
+
*/
|
|
13132
|
+
nodes: {
|
|
13133
|
+
/**
|
|
13134
|
+
* Returns the base enum expression (v.picklist([...])).
|
|
13135
|
+
*/
|
|
13136
|
+
base: (ctx: EnumResolverContext$1) => PipeResult;
|
|
13137
|
+
/**
|
|
13138
|
+
* Returns parsed enum items with metadata about the enum members.
|
|
13139
|
+
*/
|
|
13140
|
+
items: (ctx: EnumResolverContext$1) => {
|
|
13141
|
+
/**
|
|
13142
|
+
* String literal values for use with v.picklist([...]).
|
|
13143
|
+
*/
|
|
13144
|
+
enumMembers: Array<ReturnType<typeof $.literal>>;
|
|
13145
|
+
/**
|
|
13146
|
+
* Whether the enum includes a null value.
|
|
13147
|
+
*/
|
|
13148
|
+
isNullable: boolean;
|
|
13149
|
+
};
|
|
13150
|
+
/**
|
|
13151
|
+
* Returns a nullable wrapper if the enum includes null, undefined otherwise.
|
|
13152
|
+
*/
|
|
13153
|
+
nullable: (ctx: EnumResolverContext$1) => PipeResult | undefined;
|
|
13154
|
+
};
|
|
13155
|
+
schema: SchemaWithType<'enum'>;
|
|
13156
|
+
/**
|
|
13157
|
+
* Utility functions for enum schema processing.
|
|
13158
|
+
*/
|
|
13159
|
+
utils: {
|
|
13160
|
+
state: Refs<PluginState$1>;
|
|
13161
|
+
};
|
|
13162
|
+
}
|
|
13145
13163
|
interface NumberResolverContext$1 extends BaseContext$1 {
|
|
13146
13164
|
/**
|
|
13147
13165
|
* Nodes used to build different parts of the number schema.
|
|
@@ -13437,6 +13455,14 @@ type Chain = ReturnType<typeof $.call | typeof $.expr>;
|
|
|
13437
13455
|
//#endregion
|
|
13438
13456
|
//#region src/plugins/zod/resolvers/types.d.ts
|
|
13439
13457
|
type Resolvers = Plugin.Resolvers<{
|
|
13458
|
+
/**
|
|
13459
|
+
* Resolver for enum schemas.
|
|
13460
|
+
*
|
|
13461
|
+
* Allows customization of how enum types are rendered.
|
|
13462
|
+
*
|
|
13463
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
13464
|
+
*/
|
|
13465
|
+
enum?: (ctx: EnumResolverContext) => Chain | undefined;
|
|
13440
13466
|
/**
|
|
13441
13467
|
* Resolver for number schemas.
|
|
13442
13468
|
*
|
|
@@ -13485,7 +13511,7 @@ type Resolvers = Plugin.Resolvers<{
|
|
|
13485
13511
|
response?: ValidatorResolver;
|
|
13486
13512
|
};
|
|
13487
13513
|
}>;
|
|
13488
|
-
type ValidatorResolver = (ctx: ValidatorResolverContext) => MaybeArray
|
|
13514
|
+
type ValidatorResolver = (ctx: ValidatorResolverContext) => MaybeArray<TsDsl<ts.Statement>> | null | undefined;
|
|
13489
13515
|
interface BaseContext extends DollarTsDsl {
|
|
13490
13516
|
/**
|
|
13491
13517
|
* Functions for working with chains.
|
|
@@ -13513,6 +13539,50 @@ interface BaseContext extends DollarTsDsl {
|
|
|
13513
13539
|
z: Symbol;
|
|
13514
13540
|
};
|
|
13515
13541
|
}
|
|
13542
|
+
interface EnumResolverContext extends BaseContext {
|
|
13543
|
+
/**
|
|
13544
|
+
* Nodes used to build different parts of the enum schema.
|
|
13545
|
+
*/
|
|
13546
|
+
nodes: {
|
|
13547
|
+
/**
|
|
13548
|
+
* Returns the base enum expression (z.enum([...]) or z.union([...]) for mixed types).
|
|
13549
|
+
*/
|
|
13550
|
+
base: (ctx: EnumResolverContext) => Chain;
|
|
13551
|
+
/**
|
|
13552
|
+
* Returns parsed enum items with metadata about the enum members.
|
|
13553
|
+
*/
|
|
13554
|
+
items: (ctx: EnumResolverContext) => {
|
|
13555
|
+
/**
|
|
13556
|
+
* Whether all enum items are strings (determines if z.enum can be used).
|
|
13557
|
+
*/
|
|
13558
|
+
allStrings: boolean;
|
|
13559
|
+
/**
|
|
13560
|
+
* String literal values for use with z.enum([...]).
|
|
13561
|
+
*/
|
|
13562
|
+
enumMembers: Array<ReturnType<typeof $.literal>>;
|
|
13563
|
+
/**
|
|
13564
|
+
* Whether the enum includes a null value.
|
|
13565
|
+
*/
|
|
13566
|
+
isNullable: boolean;
|
|
13567
|
+
/**
|
|
13568
|
+
* z.literal(...) expressions for each non-null enum value.
|
|
13569
|
+
*/
|
|
13570
|
+
literalMembers: Array<Chain>;
|
|
13571
|
+
};
|
|
13572
|
+
/**
|
|
13573
|
+
* Returns a nullable wrapper if the enum includes null, undefined otherwise.
|
|
13574
|
+
*/
|
|
13575
|
+
nullable: (ctx: EnumResolverContext) => Chain | undefined;
|
|
13576
|
+
};
|
|
13577
|
+
schema: SchemaWithType<'enum'>;
|
|
13578
|
+
/**
|
|
13579
|
+
* Utility functions for enum schema processing.
|
|
13580
|
+
*/
|
|
13581
|
+
utils: {
|
|
13582
|
+
ast: Partial<Omit<Ast, 'typeName'>>;
|
|
13583
|
+
state: Refs<PluginState>;
|
|
13584
|
+
};
|
|
13585
|
+
}
|
|
13516
13586
|
interface NumberResolverContext extends BaseContext {
|
|
13517
13587
|
/**
|
|
13518
13588
|
* Nodes used to build different parts of the number schema.
|
|
@@ -15469,7 +15539,7 @@ interface UserConfig {
|
|
|
15469
15539
|
* inputs. If you define an array of outputs with the same length, we will
|
|
15470
15540
|
* generate multiple outputs, one for each input.
|
|
15471
15541
|
*/
|
|
15472
|
-
input: MaybeArray
|
|
15542
|
+
input: MaybeArray<UserInput | Required<UserInput>['path']>;
|
|
15473
15543
|
/**
|
|
15474
15544
|
* Show an interactive error reporting tool when the program crashes? You
|
|
15475
15545
|
* generally want to keep this disabled (default).
|
|
@@ -15489,7 +15559,7 @@ interface UserConfig {
|
|
|
15489
15559
|
* If you define an array of outputs with the same length as inputs, we will
|
|
15490
15560
|
* generate multiple outputs, one for each input.
|
|
15491
15561
|
*/
|
|
15492
|
-
output: MaybeArray
|
|
15562
|
+
output: MaybeArray<string | UserOutput>;
|
|
15493
15563
|
/**
|
|
15494
15564
|
* Customize how the input is parsed and transformed before it's passed to
|
|
15495
15565
|
* plugins.
|
|
@@ -15529,5 +15599,5 @@ type Config = Omit<Required<UserConfig>, 'input' | 'logs' | 'output' | 'parser'
|
|
|
15529
15599
|
plugins: { [K in PluginNames]?: Plugin.Config<PluginConfigMap[K]> };
|
|
15530
15600
|
};
|
|
15531
15601
|
//#endregion
|
|
15532
|
-
export { ctx as A, regexp as C, TypeTsDsl as D, TsDsl as E, Casing as F,
|
|
15533
|
-
//# sourceMappingURL=config-
|
|
15602
|
+
export { ctx as A, regexp as C, TypeTsDsl as D, TsDsl as E, Casing as F, OperationPath as M, OperationStrategy as N, ExampleOptions as O, IR as P, TypeScriptRenderer as S, MaybeTsDsl as T, Client as _, Plugin as a, DollarTsDsl as b, OpenApiOperationObject as c, OpenApiResponseObject as d, OpenApiSchemaObject as f, ExpressionTransformer as g, TypeTransformer as h, DefinePlugin as i, CallArgs as j, TsDslContext as k, OpenApiParameterObject as l, Logger as m, UserConfig as n, OpenApi as o, Context as p, Input as r, OpenApiMetaObject as s, Config as t, OpenApiRequestBodyObject as u, PluginHandler as v, keywords as w, reserved as x, $ as y };
|
|
15603
|
+
//# sourceMappingURL=config-CtVXEKSL.d.cts.map
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
const require_openApi = require('./openApi-
|
|
3
|
-
const require_src = require('./src-
|
|
2
|
+
const require_openApi = require('./openApi-BZ7m5ia5.cjs');
|
|
3
|
+
const require_src = require('./src-BkOFTEi8.cjs');
|
|
4
4
|
|
|
5
5
|
exports.$ = require_openApi.$;
|
|
6
6
|
exports.Logger = require_src.Logger;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as ctx, C as regexp, D as TypeTsDsl, E as TsDsl, F as Casing,
|
|
2
|
+
import { A as ctx, C as regexp, D as TypeTsDsl, E as TsDsl, F as Casing, M as OperationPath, N as OperationStrategy, O as ExampleOptions, P as IR, S as TypeScriptRenderer, T as MaybeTsDsl, _ as Client$2, a as Plugin, b as DollarTsDsl, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as ExpressionTransformer, h as TypeTransformer, i as DefinePlugin, j as CallArgs, k as TsDslContext, l as OpenApiParameterObject, m as Logger, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as PluginHandler, w as keywords, x as reserved, y as $ } from "./config-CtVXEKSL.cjs";
|
|
3
|
+
import { LazyOrAsync, MaybeArray } from "@hey-api/types";
|
|
3
4
|
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpRequest, HttpResponse } from "@angular/common/http";
|
|
4
5
|
import { Injector } from "@angular/core";
|
|
5
6
|
import { AxiosError, AxiosInstance, AxiosRequestHeaders, AxiosResponse, AxiosStatic, CreateAxiosDefaults } from "axios";
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { A as keywords, B as IR, C as Client$1, D as reserved, E as DollarTsDsl, F as TsDslContext,
|
|
2
|
+
import { A as keywords, B as IR, C as Client$1, D as reserved, E as DollarTsDsl, F as TsDslContext, I as ctx, L as CallArgs, M as TsDsl, N as TypeTsDsl, O as TypeScriptRenderer, P as ExampleOptions, R as OperationPath, S as Client$3, T as $, V as Casing, _ as Client$2, a as Plugin, b as Client$5, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as ExpressionTransformer, h as TypeTransformer, i as DefinePlugin, j as MaybeTsDsl, k as regexp, l as OpenApiParameterObject, m as Logger, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as PluginHandler, w as Client, x as Client$4, y as Client$6, z as OperationStrategy } from "./config-BCMpBYUB.mjs";
|
|
3
3
|
import "@hey-api/codegen-core";
|
|
4
|
+
import { LazyOrAsync, MaybeArray } from "@hey-api/types";
|
|
4
5
|
|
|
5
6
|
//#region src/generate.d.ts
|
|
6
7
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { C as defaultPaginationKeywords, S as definePluginConfig, _ as regexp, a as defaultPlugins, b as OperationPath, c as clientDefaultConfig, d as $, f as TypeScriptRenderer, g as keywords, h as reserved, l as clientDefaultMeta, m as ctx, o as clientPluginHandler, p as TsDslContext, v as TsDsl, x as OperationStrategy } from "./openApi-
|
|
3
|
-
import { i as Logger, n as utils, r as createClient, t as defineConfig } from "./src-
|
|
2
|
+
import { C as defaultPaginationKeywords, S as definePluginConfig, _ as regexp, a as defaultPlugins, b as OperationPath, c as clientDefaultConfig, d as $, f as TypeScriptRenderer, g as keywords, h as reserved, l as clientDefaultMeta, m as ctx, o as clientPluginHandler, p as TsDslContext, v as TsDsl, x as OperationStrategy } from "./openApi-B6J9qPwL.mjs";
|
|
3
|
+
import { i as Logger, n as utils, r as createClient, t as defineConfig } from "./src-BehyjtZ7.mjs";
|
|
4
4
|
|
|
5
5
|
export { $, Logger, OperationPath, OperationStrategy, TsDsl, TsDslContext, TypeScriptRenderer, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, createClient, ctx, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, keywords, regexp, reserved, utils };
|
package/dist/internal.cjs
CHANGED
package/dist/internal.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { m as Logger, n as UserConfig, p as Context, r as Input, t as Config } from "./config-
|
|
2
|
+
import { m as Logger, n as UserConfig, p as Context, r as Input, t as Config } from "./config-CtVXEKSL.cjs";
|
|
3
3
|
import { getResolvedInput } from "@hey-api/json-schema-ref-parser";
|
|
4
4
|
|
|
5
5
|
//#region src/config/init.d.ts
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { m as Logger, n as UserConfig, p as Context, r as Input, t as Config } from "./config-
|
|
2
|
+
import { m as Logger, n as UserConfig, p as Context, r as Input, t as Config } from "./config-BCMpBYUB.mjs";
|
|
3
3
|
import { getResolvedInput } from "@hey-api/json-schema-ref-parser";
|
|
4
4
|
|
|
5
5
|
//#region src/config/init.d.ts
|
package/dist/internal.mjs
CHANGED