@hey-api/openapi-ts 0.73.0 → 0.74.0
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/dist/chunk-WELTPW5K.js +39 -0
- package/dist/chunk-WELTPW5K.js.map +1 -0
- package/dist/index.cjs +166 -166
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -5
- package/dist/index.d.ts +18 -5
- package/dist/index.js +9 -9
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +10 -10
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +2 -2
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +1 -1
- package/dist/{types.d-CAqtwzfv.d.cts → types.d-jQzOw4mx.d.cts} +283 -84
- package/dist/{types.d-CAqtwzfv.d.ts → types.d-jQzOw4mx.d.ts} +283 -84
- package/package.json +1 -1
- package/dist/chunk-QUDCWAFW.js +0 -39
- package/dist/chunk-QUDCWAFW.js.map +0 -1
package/dist/internal.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSONSchema } from '@hey-api/json-schema-ref-parser';
|
|
2
|
-
import { e as Config, I as IR, W as WatchValues } from './types.d-
|
|
3
|
-
export { i as initConfigs } from './types.d-
|
|
2
|
+
import { e as Config, I as IR, W as WatchValues } from './types.d-jQzOw4mx.cjs';
|
|
3
|
+
export { i as initConfigs } from './types.d-jQzOw4mx.cjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'typescript';
|
|
6
6
|
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSONSchema } from '@hey-api/json-schema-ref-parser';
|
|
2
|
-
import { e as Config, I as IR, W as WatchValues } from './types.d-
|
|
3
|
-
export { i as initConfigs } from './types.d-
|
|
2
|
+
import { e as Config, I as IR, W as WatchValues } from './types.d-jQzOw4mx.js';
|
|
3
|
+
export { i as initConfigs } from './types.d-jQzOw4mx.js';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'typescript';
|
|
6
6
|
|
package/dist/internal.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {createRequire}from'module';export{r as getSpec,
|
|
1
|
+
import {createRequire}from'module';export{r as getSpec,I as initConfigs,B as parseOpenApiSpec}from'./chunk-WELTPW5K.js';createRequire(import.meta.url);//# sourceMappingURL=internal.js.map
|
|
2
2
|
//# sourceMappingURL=internal.js.map
|
|
@@ -3295,6 +3295,48 @@ interface OpenApi$2 {
|
|
|
3295
3295
|
|
|
3296
3296
|
type OpenApi$1 = OpenApi$3 | OpenApi$2;
|
|
3297
3297
|
|
|
3298
|
+
interface Operation extends Omit<Operation$1, 'tags'> {
|
|
3299
|
+
service: string;
|
|
3300
|
+
}
|
|
3301
|
+
|
|
3302
|
+
interface Service extends Pick<Model, '$refs' | 'imports' | 'name'> {
|
|
3303
|
+
operations: Operation[];
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
interface Client$1 extends Omit<Client$2, 'operations'> {
|
|
3307
|
+
services: Service[];
|
|
3308
|
+
}
|
|
3309
|
+
|
|
3310
|
+
type ExtractWithDiscriminator<T, Discriminator> = T extends Discriminator
|
|
3311
|
+
? T
|
|
3312
|
+
: never;
|
|
3313
|
+
|
|
3314
|
+
/**
|
|
3315
|
+
* Accepts an array of elements union and attempts to extract only objects.
|
|
3316
|
+
* For example, Array<string | number | { id: string }> would result in
|
|
3317
|
+
* Array<{ id: string }>.
|
|
3318
|
+
*/
|
|
3319
|
+
type ExtractArrayOfObjects<T, Discriminator> =
|
|
3320
|
+
T extends Array<infer U>
|
|
3321
|
+
? Array<ExtractWithDiscriminator<U, Discriminator>>
|
|
3322
|
+
: T extends ReadonlyArray<infer U>
|
|
3323
|
+
? ReadonlyArray<ExtractWithDiscriminator<U, Discriminator>>
|
|
3324
|
+
: never;
|
|
3325
|
+
|
|
3326
|
+
type Files = Record<string, TypeScriptFile>;
|
|
3327
|
+
|
|
3328
|
+
/**
|
|
3329
|
+
* Transforms an array of objects into an optional object map.
|
|
3330
|
+
* For example, Array<{ id: string }> would result in
|
|
3331
|
+
* { [key: string]?: { id: string } }
|
|
3332
|
+
*/
|
|
3333
|
+
type ArrayOfObjectsToObjectMap<
|
|
3334
|
+
T extends ReadonlyArray<Record<string, any>>,
|
|
3335
|
+
D extends keyof T[number],
|
|
3336
|
+
> = {
|
|
3337
|
+
[K in T[number][D]]?: Extract<T[number], Record<D, K>>;
|
|
3338
|
+
};
|
|
3339
|
+
|
|
3298
3340
|
interface JsonSchemaDraft4 extends EnumExtensions {
|
|
3299
3341
|
/**
|
|
3300
3342
|
* A schema can reference another schema using the `$ref` keyword. The value of `$ref` is a URI-reference that is resolved against the schema's {@link https://json-schema.org/understanding-json-schema/structuring#base-uri Base URI}. When evaluating a `$ref`, an implementation uses the resolved identifier to retrieve the referenced schema and applies that schema to the {@link https://json-schema.org/learn/glossary#instance instance}.
|
|
@@ -6397,52 +6439,41 @@ declare namespace OpenApiSchemaObject {
|
|
|
6397
6439
|
export type V3_1_X = OpenApiV3_1_XTypes['SchemaObject'];
|
|
6398
6440
|
}
|
|
6399
6441
|
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6409
|
-
|
|
6442
|
+
declare class PluginInstance<PluginConfig extends BaseConfig = BaseConfig> {
|
|
6443
|
+
config: Plugin.Config<PluginConfig>['config'];
|
|
6444
|
+
context: IR.Context;
|
|
6445
|
+
dependencies: Required<Plugin.Config<PluginConfig>>['dependencies'];
|
|
6446
|
+
private handler;
|
|
6447
|
+
name: Plugin.Config<PluginConfig>['name'];
|
|
6448
|
+
output: Required<PluginConfig>['output'];
|
|
6449
|
+
constructor(props: Pick<Required<Plugin.Config<PluginConfig>>, 'config' | 'dependencies' | 'handler'> & Pick<Required<PluginConfig>, 'output'> & {
|
|
6450
|
+
context: IR.Context<OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X>;
|
|
6451
|
+
name: string;
|
|
6452
|
+
});
|
|
6453
|
+
createFile(file: IR.ContextFile): TypeScriptFile;
|
|
6454
|
+
/**
|
|
6455
|
+
* Retrieves a registered plugin instance by its name from the context. This
|
|
6456
|
+
* allows plugins to access other plugins that have been registered in the
|
|
6457
|
+
* same context, enabling cross-plugin communication and dependencies.
|
|
6458
|
+
*
|
|
6459
|
+
* @param name Plugin name as defined in the configuration.
|
|
6460
|
+
* @returns The plugin instance if found, undefined otherwise.
|
|
6461
|
+
*/
|
|
6462
|
+
getPlugin<T extends keyof Config['plugins']>(name: T): IR.Context['plugins'][T];
|
|
6463
|
+
/**
|
|
6464
|
+
* Executes plugin's handler function.
|
|
6465
|
+
*/
|
|
6466
|
+
run(): Promise<void>;
|
|
6467
|
+
/**
|
|
6468
|
+
* Subscribe to an input parser event.
|
|
6469
|
+
*
|
|
6470
|
+
* @param event Event type from the parser.
|
|
6471
|
+
* @param callbackFn Function to execute on event.
|
|
6472
|
+
* @returns void
|
|
6473
|
+
*/
|
|
6474
|
+
subscribe<T extends keyof IR.ContextEvents>(event: T, callbackFn: IR.ContextEvents[T]): void;
|
|
6410
6475
|
}
|
|
6411
6476
|
|
|
6412
|
-
type ExtractWithDiscriminator<T, Discriminator> = T extends Discriminator
|
|
6413
|
-
? T
|
|
6414
|
-
: never;
|
|
6415
|
-
|
|
6416
|
-
/**
|
|
6417
|
-
* Accepts an array of elements union and attempts to extract only objects.
|
|
6418
|
-
* For example, Array<string | number | { id: string }> would result in
|
|
6419
|
-
* Array<{ id: string }>.
|
|
6420
|
-
*/
|
|
6421
|
-
type ExtractArrayOfObjects<T, Discriminator> =
|
|
6422
|
-
T extends Array<infer U>
|
|
6423
|
-
? Array<ExtractWithDiscriminator<U, Discriminator>>
|
|
6424
|
-
: T extends ReadonlyArray<infer U>
|
|
6425
|
-
? ReadonlyArray<ExtractWithDiscriminator<U, Discriminator>>
|
|
6426
|
-
: never;
|
|
6427
|
-
|
|
6428
|
-
type Files = Record<string, TypeScriptFile>;
|
|
6429
|
-
|
|
6430
|
-
/**
|
|
6431
|
-
* Transforms an array of objects into an optional object map.
|
|
6432
|
-
* For example, Array<{ id: string }> would result in
|
|
6433
|
-
* { [key: string]?: { id: string } }
|
|
6434
|
-
*/
|
|
6435
|
-
type ArrayOfObjectsToObjectMap<
|
|
6436
|
-
T extends ReadonlyArray<Record<string, any>>,
|
|
6437
|
-
D extends keyof T[number],
|
|
6438
|
-
> = {
|
|
6439
|
-
[K in T[number][D]]?: Extract<T[number], Record<D, K>>;
|
|
6440
|
-
};
|
|
6441
|
-
|
|
6442
|
-
type OmitUnderscoreKeys<T> = {
|
|
6443
|
-
[K in keyof T as K extends `_${string}` ? never : K]: T[K];
|
|
6444
|
-
};
|
|
6445
|
-
|
|
6446
6477
|
type PluginClientNames =
|
|
6447
6478
|
| '@hey-api/client-axios'
|
|
6448
6479
|
| '@hey-api/client-fetch'
|
|
@@ -6474,13 +6505,38 @@ type AnyPluginName = PluginNames | (string & {});
|
|
|
6474
6505
|
|
|
6475
6506
|
type PluginTag = 'client' | 'transformer' | 'validator';
|
|
6476
6507
|
|
|
6508
|
+
type ObjectType<T> =
|
|
6509
|
+
Extract<T, Record<string, any>> extends never
|
|
6510
|
+
? Record<string, any>
|
|
6511
|
+
: Extract<T, Record<string, any>>;
|
|
6512
|
+
|
|
6477
6513
|
interface PluginContext {
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6514
|
+
pluginByTag: <T extends AnyPluginName | boolean = AnyPluginName>(
|
|
6515
|
+
tag: PluginTag,
|
|
6516
|
+
props?: {
|
|
6517
|
+
defaultPlugin?: Exclude<T, boolean>;
|
|
6518
|
+
errorMessage?: string;
|
|
6519
|
+
},
|
|
6520
|
+
) => Exclude<T, boolean> | undefined;
|
|
6521
|
+
valueToObject: <
|
|
6522
|
+
T extends undefined | string | boolean | number | Record<string, any>,
|
|
6523
|
+
>(args: {
|
|
6524
|
+
defaultValue: ObjectType<T>;
|
|
6525
|
+
mappers: {
|
|
6526
|
+
boolean: T extends boolean
|
|
6527
|
+
? (value: boolean) => Partial<ObjectType<T>>
|
|
6528
|
+
: never;
|
|
6529
|
+
number: T extends number
|
|
6530
|
+
? (value: number) => Partial<ObjectType<T>>
|
|
6531
|
+
: never;
|
|
6532
|
+
string: T extends string
|
|
6533
|
+
? (value: string) => Partial<ObjectType<T>>
|
|
6534
|
+
: never;
|
|
6535
|
+
} extends infer U
|
|
6536
|
+
? { [K in keyof U as U[K] extends never ? never : K]: U[K] }
|
|
6537
|
+
: never;
|
|
6538
|
+
value: T;
|
|
6539
|
+
}) => ObjectType<T>;
|
|
6484
6540
|
}
|
|
6485
6541
|
|
|
6486
6542
|
interface BaseConfig {
|
|
@@ -6493,42 +6549,63 @@ interface BaseConfig {
|
|
|
6493
6549
|
output?: string;
|
|
6494
6550
|
}
|
|
6495
6551
|
|
|
6496
|
-
interface Meta<
|
|
6552
|
+
interface Meta<
|
|
6553
|
+
Config extends BaseConfig,
|
|
6554
|
+
ResolvedConfig extends BaseConfig = Config,
|
|
6555
|
+
> {
|
|
6497
6556
|
/**
|
|
6498
6557
|
* Dependency plugins will be always processed, regardless of whether user
|
|
6499
6558
|
* explicitly defines them in their `plugins` config.
|
|
6500
6559
|
*/
|
|
6501
|
-
|
|
6560
|
+
dependencies?: ReadonlyArray<AnyPluginName>;
|
|
6502
6561
|
/**
|
|
6503
|
-
*
|
|
6504
|
-
*
|
|
6562
|
+
* Resolves static configuration values into their runtime equivalents. For
|
|
6563
|
+
* example, when `validator` is set to `true`, it figures out which plugin
|
|
6505
6564
|
* should be used for validation.
|
|
6506
6565
|
*/
|
|
6507
|
-
|
|
6508
|
-
|
|
6566
|
+
resolveConfig?: (
|
|
6567
|
+
plugin: Omit<Plugin.Config<Config, ResolvedConfig>, 'dependencies'> & {
|
|
6568
|
+
dependencies: Set<AnyPluginName>;
|
|
6569
|
+
},
|
|
6509
6570
|
context: PluginContext,
|
|
6510
6571
|
) => void;
|
|
6511
6572
|
/**
|
|
6512
|
-
* Optional tags can be used to help with deciding plugin order and
|
|
6573
|
+
* Optional tags can be used to help with deciding plugin order and resolving
|
|
6513
6574
|
* plugin configuration options.
|
|
6514
6575
|
*/
|
|
6515
|
-
|
|
6576
|
+
tags?: ReadonlyArray<PluginTag>;
|
|
6516
6577
|
}
|
|
6517
6578
|
|
|
6518
6579
|
/**
|
|
6519
6580
|
* Public Plugin API.
|
|
6520
6581
|
*/
|
|
6521
6582
|
declare namespace Plugin {
|
|
6522
|
-
export type Config<
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6583
|
+
export type Config<
|
|
6584
|
+
Config extends BaseConfig,
|
|
6585
|
+
ResolvedConfig extends BaseConfig = Config,
|
|
6586
|
+
> = Pick<Config, 'name' | 'output'> &
|
|
6587
|
+
Meta<Config, ResolvedConfig> & {
|
|
6588
|
+
config: Omit<Config, 'name' | 'output'>;
|
|
6589
|
+
handler: Plugin.Handler<
|
|
6590
|
+
Omit<ResolvedConfig, 'name'> & {
|
|
6591
|
+
name: any;
|
|
6592
|
+
}
|
|
6593
|
+
>;
|
|
6594
|
+
handlerLegacy: Plugin.LegacyHandler<
|
|
6595
|
+
Omit<ResolvedConfig, 'name'> & {
|
|
6596
|
+
name: any;
|
|
6597
|
+
}
|
|
6598
|
+
>;
|
|
6527
6599
|
};
|
|
6528
6600
|
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6601
|
+
/** @deprecated - use `definePluginConfig()` instead */
|
|
6602
|
+
export type DefineConfig<
|
|
6603
|
+
Config extends BaseConfig,
|
|
6604
|
+
ResolvedConfig extends BaseConfig = Config,
|
|
6605
|
+
> = (config?: Plugin.UserConfig<Omit<Config, 'name'>>) => Omit<
|
|
6606
|
+
Plugin.Config<Config, ResolvedConfig>,
|
|
6607
|
+
'name'
|
|
6608
|
+
> & {
|
|
6532
6609
|
/**
|
|
6533
6610
|
* Cast name to `any` so it doesn't throw type error in `plugins` array.
|
|
6534
6611
|
* We could allow any `string` as plugin `name` in the object syntax, but
|
|
@@ -6542,12 +6619,10 @@ declare namespace Plugin {
|
|
|
6542
6619
|
* Plugin implementation for experimental parser.
|
|
6543
6620
|
*/
|
|
6544
6621
|
export type Handler<Config extends BaseConfig, ReturnType = void> = (args: {
|
|
6545
|
-
context: IR.Context<OpenApi.V2_0_X | OpenApi.V3_0_X | OpenApi.V3_1_X>;
|
|
6546
6622
|
plugin: Plugin.Instance<Config>;
|
|
6547
6623
|
}) => ReturnType;
|
|
6548
6624
|
|
|
6549
|
-
export type Instance<Config extends BaseConfig> =
|
|
6550
|
-
Pick<Required<BaseConfig>, 'exportFromIndex' | 'output'>;
|
|
6625
|
+
export type Instance<Config extends BaseConfig> = PluginInstance<Config>;
|
|
6551
6626
|
|
|
6552
6627
|
/**
|
|
6553
6628
|
* Plugin implementation for legacy parser.
|
|
@@ -6598,10 +6673,7 @@ interface Config$j
|
|
|
6598
6673
|
Client.Config {}
|
|
6599
6674
|
|
|
6600
6675
|
type PluginHandler<ReturnType = void> = Plugin.Handler<
|
|
6601
|
-
|
|
6602
|
-
Config$i | Config$l | Config$k | Config$j,
|
|
6603
|
-
'name'
|
|
6604
|
-
>,
|
|
6676
|
+
Config$i | Config$l | Config$k | Config$j,
|
|
6605
6677
|
ReturnType
|
|
6606
6678
|
>;
|
|
6607
6679
|
|
|
@@ -7281,16 +7353,52 @@ interface Config$2 extends Plugin.Name<'valibot'> {
|
|
|
7281
7353
|
output?: string;
|
|
7282
7354
|
}
|
|
7283
7355
|
|
|
7284
|
-
// import type { IR } from '../../ir/types';
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
7356
|
interface Config$1 extends Plugin.Name<'zod'> {
|
|
7357
|
+
/**
|
|
7358
|
+
* The casing convention to use for generated names.
|
|
7359
|
+
*
|
|
7360
|
+
* @default 'camelCase'
|
|
7361
|
+
*/
|
|
7362
|
+
case?: StringCase;
|
|
7288
7363
|
/**
|
|
7289
7364
|
* Add comments from input to the generated Zod schemas?
|
|
7290
7365
|
*
|
|
7291
7366
|
* @default true
|
|
7292
7367
|
*/
|
|
7293
7368
|
comments?: boolean;
|
|
7369
|
+
/**
|
|
7370
|
+
* Configuration for reusable schema definitions. Controls generation of
|
|
7371
|
+
* shared Zod schemas that can be referenced across requests and responses.
|
|
7372
|
+
*
|
|
7373
|
+
* Can be:
|
|
7374
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
7375
|
+
* - `string`: Shorthand for `{ enabled: true; name: string }`
|
|
7376
|
+
* - `object`: Full configuration object
|
|
7377
|
+
*/
|
|
7378
|
+
definitions?:
|
|
7379
|
+
| boolean
|
|
7380
|
+
| string
|
|
7381
|
+
| {
|
|
7382
|
+
/**
|
|
7383
|
+
* The casing convention to use for generated names.
|
|
7384
|
+
*
|
|
7385
|
+
* @default 'camelCase'
|
|
7386
|
+
*/
|
|
7387
|
+
case?: StringCase;
|
|
7388
|
+
/**
|
|
7389
|
+
* Whether to generate Zod schemas for reusable definitions.
|
|
7390
|
+
*
|
|
7391
|
+
* @default true
|
|
7392
|
+
*/
|
|
7393
|
+
enabled?: boolean;
|
|
7394
|
+
/**
|
|
7395
|
+
* Custom naming pattern for generated schema names. The name variable is
|
|
7396
|
+
* obtained from the schema name.
|
|
7397
|
+
*
|
|
7398
|
+
* @default 'z{{name}}'
|
|
7399
|
+
*/
|
|
7400
|
+
name?: string | ((name: string) => string);
|
|
7401
|
+
};
|
|
7294
7402
|
/**
|
|
7295
7403
|
* Should the exports from the generated files be re-exported in the index
|
|
7296
7404
|
* barrel file?
|
|
@@ -7306,17 +7414,78 @@ interface Config$1 extends Plugin.Name<'zod'> {
|
|
|
7306
7414
|
* @default false
|
|
7307
7415
|
*/
|
|
7308
7416
|
metadata?: boolean;
|
|
7309
|
-
/**
|
|
7310
|
-
* Customise the Zod schema name. By default, `z{{name}}` is used,
|
|
7311
|
-
* where `name` is a definition name or an operation name.
|
|
7312
|
-
*/
|
|
7313
|
-
// nameBuilder?: (model: IR.OperationObject | IR.SchemaObject) => string;
|
|
7314
7417
|
/**
|
|
7315
7418
|
* Name of the generated file.
|
|
7316
7419
|
*
|
|
7317
7420
|
* @default 'zod'
|
|
7318
7421
|
*/
|
|
7319
7422
|
output?: string;
|
|
7423
|
+
/**
|
|
7424
|
+
* Configuration for request-specific Zod schemas.
|
|
7425
|
+
* Controls generation of Zod schemas for request bodies, query parameters, path parameters, and headers.
|
|
7426
|
+
*
|
|
7427
|
+
* Can be:
|
|
7428
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
7429
|
+
* - `string`: Shorthand for `{ enabled: true; name: string }`
|
|
7430
|
+
* - `object`: Full configuration object
|
|
7431
|
+
*/
|
|
7432
|
+
requests?:
|
|
7433
|
+
| boolean
|
|
7434
|
+
| string
|
|
7435
|
+
| {
|
|
7436
|
+
/**
|
|
7437
|
+
* The casing convention to use for generated names.
|
|
7438
|
+
*
|
|
7439
|
+
* @default 'camelCase'
|
|
7440
|
+
*/
|
|
7441
|
+
case?: StringCase;
|
|
7442
|
+
/**
|
|
7443
|
+
* Whether to generate Zod schemas for request definitions.
|
|
7444
|
+
*
|
|
7445
|
+
* @default true
|
|
7446
|
+
*/
|
|
7447
|
+
enabled?: boolean;
|
|
7448
|
+
/**
|
|
7449
|
+
* Custom naming pattern for generated schema names. The name variable is
|
|
7450
|
+
* obtained from the operation name.
|
|
7451
|
+
*
|
|
7452
|
+
* @default 'z{{name}}Data'
|
|
7453
|
+
*/
|
|
7454
|
+
name?: string | ((name: string) => string);
|
|
7455
|
+
};
|
|
7456
|
+
/**
|
|
7457
|
+
* Configuration for response-specific Zod schemas.
|
|
7458
|
+
* Controls generation of Zod schemas for response bodies, error responses, and status codes.
|
|
7459
|
+
*
|
|
7460
|
+
* Can be:
|
|
7461
|
+
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
7462
|
+
* - `string`: Shorthand for `{ enabled: true; name: string }`
|
|
7463
|
+
* - `object`: Full configuration object
|
|
7464
|
+
*/
|
|
7465
|
+
responses?:
|
|
7466
|
+
| boolean
|
|
7467
|
+
| string
|
|
7468
|
+
| {
|
|
7469
|
+
/**
|
|
7470
|
+
* The casing convention to use for generated names.
|
|
7471
|
+
*
|
|
7472
|
+
* @default 'camelCase'
|
|
7473
|
+
*/
|
|
7474
|
+
case?: StringCase;
|
|
7475
|
+
/**
|
|
7476
|
+
* Whether to generate Zod schemas for response definitions.
|
|
7477
|
+
*
|
|
7478
|
+
* @default true
|
|
7479
|
+
*/
|
|
7480
|
+
enabled?: boolean;
|
|
7481
|
+
/**
|
|
7482
|
+
* Custom naming pattern for generated schema names. The name variable is
|
|
7483
|
+
* obtained from the operation name.
|
|
7484
|
+
*
|
|
7485
|
+
* @default 'z{{name}}Response'
|
|
7486
|
+
*/
|
|
7487
|
+
name?: string | ((name: string) => string);
|
|
7488
|
+
};
|
|
7320
7489
|
}
|
|
7321
7490
|
|
|
7322
7491
|
/**
|
|
@@ -7966,6 +8135,7 @@ declare class TypeScriptFile {
|
|
|
7966
8135
|
get exportFromIndex(): boolean;
|
|
7967
8136
|
get id(): string;
|
|
7968
8137
|
identifier(args: Pick<EnsureUniqueIdentifierData, '$ref' | 'count' | 'create' | 'nameTransformer'> & {
|
|
8138
|
+
case?: StringCase;
|
|
7969
8139
|
namespace: Namespace;
|
|
7970
8140
|
}): Identifier;
|
|
7971
8141
|
/**
|
|
@@ -8000,10 +8170,18 @@ interface EnsureUniqueIdentifierData {
|
|
|
8000
8170
|
/**
|
|
8001
8171
|
* Transforms name obtained from `$ref` before it's passed to `stringCase()`.
|
|
8002
8172
|
*/
|
|
8003
|
-
nameTransformer?: (name: string) => string;
|
|
8173
|
+
nameTransformer?: ((name: string) => string) | string;
|
|
8004
8174
|
namespace: Namespace;
|
|
8005
8175
|
}
|
|
8006
8176
|
|
|
8177
|
+
type ExtractConfig<T> = T extends {
|
|
8178
|
+
config: infer C;
|
|
8179
|
+
} ? C & {
|
|
8180
|
+
name: string;
|
|
8181
|
+
} : never;
|
|
8182
|
+
type PluginInstanceMap = {
|
|
8183
|
+
[K in keyof Config['plugins']]?: PluginInstance<ExtractConfig<Config['plugins'][K]>>;
|
|
8184
|
+
};
|
|
8007
8185
|
interface ContextFile {
|
|
8008
8186
|
/**
|
|
8009
8187
|
* Should the exports from this file be re-exported in the index barrel file?
|
|
@@ -8019,6 +8197,7 @@ interface ContextFile {
|
|
|
8019
8197
|
identifierCase?: StringCase;
|
|
8020
8198
|
/**
|
|
8021
8199
|
* Relative file path to the output path.
|
|
8200
|
+
*
|
|
8022
8201
|
* @example
|
|
8023
8202
|
* 'bar/foo.ts'
|
|
8024
8203
|
*/
|
|
@@ -8071,6 +8250,12 @@ declare class IRContext<Spec extends Record<string, any> = any> {
|
|
|
8071
8250
|
* Intermediate representation model obtained from `spec`.
|
|
8072
8251
|
*/
|
|
8073
8252
|
ir: IR.Model;
|
|
8253
|
+
/**
|
|
8254
|
+
* A map of registered plugin instances, keyed by plugin name. Plugins are
|
|
8255
|
+
* registered through the `registerPlugin` method and can be accessed by
|
|
8256
|
+
* their configured name from the config.
|
|
8257
|
+
*/
|
|
8258
|
+
plugins: PluginInstanceMap;
|
|
8074
8259
|
/**
|
|
8075
8260
|
* Resolved specification from `input`.
|
|
8076
8261
|
*/
|
|
@@ -8102,6 +8287,18 @@ declare class IRContext<Spec extends Record<string, any> = any> {
|
|
|
8102
8287
|
* Returns a specific file by ID from `files`.
|
|
8103
8288
|
*/
|
|
8104
8289
|
file({ id }: Pick<ContextFile, 'id'>): TypeScriptFile | undefined;
|
|
8290
|
+
/**
|
|
8291
|
+
* Registers a new plugin to the global context.
|
|
8292
|
+
*
|
|
8293
|
+
* @param name Plugin name.
|
|
8294
|
+
* @returns Registered plugin instance.
|
|
8295
|
+
*/
|
|
8296
|
+
private registerPlugin;
|
|
8297
|
+
/**
|
|
8298
|
+
* Generator that iterates through plugin order and registers each plugin.
|
|
8299
|
+
* Yields the registered plugin instance for each plugin name.
|
|
8300
|
+
*/
|
|
8301
|
+
registerPlugins(): Generator<PluginInstance>;
|
|
8105
8302
|
resolveIrRef<T>($ref: string): T;
|
|
8106
8303
|
/**
|
|
8107
8304
|
* Returns a resolved reference from `spec`.
|
|
@@ -8110,7 +8307,7 @@ declare class IRContext<Spec extends Record<string, any> = any> {
|
|
|
8110
8307
|
/**
|
|
8111
8308
|
* Register a new `event` listener.
|
|
8112
8309
|
*/
|
|
8113
|
-
subscribe<T extends keyof Events>(event: T, callbackFn: Events[T], pluginName
|
|
8310
|
+
subscribe<T extends keyof Events>(event: T, callbackFn: Events[T], pluginName: string): void;
|
|
8114
8311
|
}
|
|
8115
8312
|
|
|
8116
8313
|
type IRMediaType = 'form-data' | 'json' | 'text' | 'url-search-params' | 'octet-stream';
|
|
@@ -8326,6 +8523,8 @@ declare namespace IR {
|
|
|
8326
8523
|
export type BodyObject = IRBodyObject;
|
|
8327
8524
|
export type ComponentsObject = IRComponentsObject;
|
|
8328
8525
|
export type Context<Spec extends Record<string, any> = any> = IRContext<Spec>;
|
|
8526
|
+
export type ContextEvents = Events;
|
|
8527
|
+
export type ContextFile = ContextFile;
|
|
8329
8528
|
export type Model = IRModel;
|
|
8330
8529
|
export type OperationObject = IROperationObject;
|
|
8331
8530
|
export type ParameterObject = IRParameterObject;
|
|
@@ -8374,4 +8573,4 @@ interface WatchValues {
|
|
|
8374
8573
|
lastValue?: string;
|
|
8375
8574
|
}
|
|
8376
8575
|
|
|
8377
|
-
export { type Client$1 as C, IR as I, LegacyIR as L, OpenApi as O, type PluginHandler as P, type StringCase as S, type UserConfig as U, type WatchValues as W,
|
|
8576
|
+
export { type BaseConfig as B, type Client$1 as C, IR as I, LegacyIR as L, OpenApi as O, type PluginHandler as P, type StringCase as S, type UserConfig as U, type WatchValues as W, Plugin as a, OpenApiSchemaObject as b, Client as c, defaultPlugins as d, type Config as e, initConfigs as i };
|