@hey-api/openapi-ts 0.92.3 → 0.93.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/clients/angular/client.ts +2 -1
- package/dist/clients/angular/types.ts +4 -2
- package/dist/clients/axios/types.ts +1 -0
- package/dist/clients/fetch/types.ts +1 -0
- package/dist/clients/ky/types.ts +1 -0
- package/dist/clients/next/types.ts +1 -0
- package/dist/clients/nuxt/client.ts +4 -4
- package/dist/index.d.mts +163 -242
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-W7OZahc5.mjs → init-BVQKw3ZX.mjs} +2276 -1988
- package/dist/init-BVQKw3ZX.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +3 -3
- package/dist/{src-BbXkGzWZ.mjs → src-BD5OAshH.mjs} +8 -4
- package/dist/src-BD5OAshH.mjs.map +1 -0
- package/package.json +13 -18
- package/dist/init-W7OZahc5.mjs.map +0 -1
- package/dist/src-BbXkGzWZ.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as UserConfig } from "./types-Ba27ofyy.mjs";
|
|
2
2
|
import * as _hey_api_codegen_core0 from "@hey-api/codegen-core";
|
|
3
3
|
import { AnalysisContext, BindingKind, ExportModule, File, FromRef, ImportModule, Language, Logger, Logger as Logger$1, Node, NodeName, NodeNameSanitizer, NodeRelationship, NodeScope, Ref, Refs, RenderContext, Renderer, Symbol, SymbolMeta } from "@hey-api/codegen-core";
|
|
4
|
-
import { Casing, Context, DefinePlugin, DefinePlugin as DefinePlugin$1, FeatureToggle, IR, IR as IR$1, LinguistLanguages, NameTransformer, NamingConfig, NamingOptions, NamingRule, OpenApi, OpenApiMetaObject, OpenApiOperationObject, OpenApiParameterObject, OpenApiRequestBodyObject, OpenApiResponseObject, OpenApiSchemaObject, OpenApiV2_0_XTypes, OpenApiV3_0_XTypes, OpenApiV3_1_XTypes, OperationPath, OperationPathStrategy, OperationStrategy, OperationsStrategy, Plugin, Plugin as Plugin$1, SchemaWithType, defaultPaginationKeywords, definePluginConfig, utils } from "@hey-api/shared";
|
|
4
|
+
import { Casing, Context, DefinePlugin, DefinePlugin as DefinePlugin$1, FeatureToggle, IR, IR as IR$1, LinguistLanguages, NameTransformer, NamingConfig, NamingOptions, NamingRule, OpenApi, OpenApiMetaObject, OpenApiOperationObject, OpenApiParameterObject, OpenApiRequestBodyObject, OpenApiResponseObject, OpenApiSchemaObject, OpenApiV2_0_XTypes, OpenApiV3_0_XTypes, OpenApiV3_1_XTypes, OperationPath, OperationPathStrategy, OperationStrategy, OperationsStrategy, Plugin, Plugin as Plugin$1, SchemaExtractor, SchemaVisitorContext, SchemaWithType, Walker, defaultPaginationKeywords, definePluginConfig, utils } from "@hey-api/shared";
|
|
5
5
|
import ts from "typescript";
|
|
6
6
|
import { AnyString, LazyOrAsync, MaybeArray, MaybeFunc } from "@hey-api/types";
|
|
7
7
|
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpRequest, HttpResponse } from "@angular/common/http";
|
|
@@ -807,14 +807,14 @@ interface ExprMethods extends Node {
|
|
|
807
807
|
}
|
|
808
808
|
//#endregion
|
|
809
809
|
//#region src/ts-dsl/expr/call.d.ts
|
|
810
|
-
type CallArgs = ReadonlyArray<
|
|
811
|
-
type
|
|
812
|
-
type CallCtor = (
|
|
810
|
+
type CallArgs = ReadonlyArray<CallCallee | undefined>;
|
|
811
|
+
type CallCallee = NodeName | MaybeTsDsl<ts.Expression>;
|
|
812
|
+
type CallCtor = (callee: CallCallee, ...args: CallArgs) => CallTsDsl;
|
|
813
813
|
declare const Mixed$40: MixinCtor<MixinCtor<MixinCtor<MixinCtor<abstract new () => TsDsl<ts.CallExpression>, TypeArgsMethods>, ExprMethods>, AsMethods>, ArgsMethods>;
|
|
814
814
|
declare class CallTsDsl extends Mixed$40 {
|
|
815
815
|
readonly '~dsl' = "CallTsDsl";
|
|
816
|
-
protected
|
|
817
|
-
constructor(
|
|
816
|
+
protected _callee: Ref<CallCallee>;
|
|
817
|
+
constructor(callee: CallCallee, ...args: CallArgs);
|
|
818
818
|
analyze(ctx: AnalysisContext): void;
|
|
819
819
|
toAst(): ts.CallExpression;
|
|
820
820
|
}
|
|
@@ -2075,7 +2075,7 @@ declare const $: ((id: ts.Expression | TsDsl<ts.Expression> | _hey_api_codegen_c
|
|
|
2075
2075
|
/** Creates a statement block (`{ ... }`). */
|
|
2076
2076
|
block: (...args: ConstructorParameters<typeof BlockTsDsl>) => BlockTsDsl;
|
|
2077
2077
|
/** Creates a function or method call expression (e.g. `fn(arg)`). */
|
|
2078
|
-
call: (
|
|
2078
|
+
call: (callee: CallCallee, ...args: (CallCallee | undefined)[]) => CallTsDsl;
|
|
2079
2079
|
/** Creates a class declaration or expression. */
|
|
2080
2080
|
class: (name: _hey_api_codegen_core0.NodeName) => ClassTsDsl;
|
|
2081
2081
|
/** Creates a constant variable declaration (`const`). */
|
|
@@ -2573,7 +2573,7 @@ interface Config$18<T extends ClientOptions$5 = ClientOptions$5> extends Omit<Re
|
|
|
2573
2573
|
interface RequestOptions$5<TData = unknown, TResponseStyle extends ResponseStyle$2 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$18<{
|
|
2574
2574
|
responseStyle: TResponseStyle;
|
|
2575
2575
|
throwOnError: ThrowOnError;
|
|
2576
|
-
}>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
2576
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
2577
2577
|
/**
|
|
2578
2578
|
* Any body that you want to add to your request.
|
|
2579
2579
|
*
|
|
@@ -2620,7 +2620,7 @@ interface ClientOptions$5 {
|
|
|
2620
2620
|
type MethodFn$5 = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$2 = 'fields'>(options: Omit<RequestOptions$5<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult$5<TData, TError, ThrowOnError, TResponseStyle>;
|
|
2621
2621
|
type SseFn$5 = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$2 = 'fields'>(options: Omit<RequestOptions$5<TData, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData, TError>>;
|
|
2622
2622
|
type RequestFn$5 = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$2 = 'fields'>(options: Omit<RequestOptions$5<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions$5<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult$5<TData, TError, ThrowOnError, TResponseStyle>;
|
|
2623
|
-
type RequestOptionsFn = <ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$2 = 'fields'>(options: RequestOptions$5<
|
|
2623
|
+
type RequestOptionsFn = <T, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle$2 = 'fields'>(options: RequestOptions$5<T, TResponseStyle, ThrowOnError>) => HttpRequest<T>;
|
|
2624
2624
|
type BuildUrlFn$5 = <TData extends {
|
|
2625
2625
|
body?: unknown;
|
|
2626
2626
|
path?: Record<string, unknown>;
|
|
@@ -2670,7 +2670,7 @@ interface Config$17<T extends ClientOptions$4 = ClientOptions$4> extends Omit<Cr
|
|
|
2670
2670
|
}
|
|
2671
2671
|
interface RequestOptions$4<TData = unknown, ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$17<{
|
|
2672
2672
|
throwOnError: ThrowOnError;
|
|
2673
|
-
}>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
2673
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
2674
2674
|
/**
|
|
2675
2675
|
* Any body that you want to add to your request.
|
|
2676
2676
|
*
|
|
@@ -2793,7 +2793,7 @@ interface Config$16<T extends ClientOptions$3 = ClientOptions$3> extends Omit<Re
|
|
|
2793
2793
|
interface RequestOptions$3<TData = unknown, TResponseStyle extends ResponseStyle$1 = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$16<{
|
|
2794
2794
|
responseStyle: TResponseStyle;
|
|
2795
2795
|
throwOnError: ThrowOnError;
|
|
2796
|
-
}>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
2796
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
2797
2797
|
/**
|
|
2798
2798
|
* Any body that you want to add to your request.
|
|
2799
2799
|
*
|
|
@@ -2913,7 +2913,7 @@ interface Config$15<T extends ClientOptions$2 = ClientOptions$2> extends Omit<Re
|
|
|
2913
2913
|
}
|
|
2914
2914
|
interface RequestOptions$2<TData = unknown, ThrowOnError extends boolean = boolean, Url extends string = string> extends Config$15<{
|
|
2915
2915
|
throwOnError: ThrowOnError;
|
|
2916
|
-
}>, Pick<ServerSentEventsOptions<TData>, 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
2916
|
+
}>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
|
|
2917
2917
|
/**
|
|
2918
2918
|
* Any body that you want to add to your request.
|
|
2919
2919
|
*
|
|
@@ -3919,20 +3919,25 @@ type Config$11 = Plugin$1.Name<'@hey-api/transformers'> & Plugin$1.Hooks & Plugi
|
|
|
3919
3919
|
type HeyApiTransformersPlugin = DefinePlugin$1<UserConfig$13, Config$11>;
|
|
3920
3920
|
//#endregion
|
|
3921
3921
|
//#region src/plugins/@hey-api/typescript/shared/types.d.ts
|
|
3922
|
-
type IrSchemaToAstOptions = {
|
|
3922
|
+
type IrSchemaToAstOptions$1 = {
|
|
3923
|
+
/** The plugin instance. */
|
|
3923
3924
|
plugin: HeyApiTypeScriptPlugin['Instance'];
|
|
3924
|
-
|
|
3925
|
+
/** Optional schema extractor function. */
|
|
3926
|
+
schemaExtractor?: SchemaExtractor;
|
|
3927
|
+
/** The plugin state references. */
|
|
3928
|
+
state: Refs<PluginState$1>;
|
|
3925
3929
|
};
|
|
3926
|
-
type PluginState$
|
|
3930
|
+
type PluginState$1 = Pick<Required<SymbolMeta>, 'path'> & Pick<Partial<SymbolMeta>, 'tags'>;
|
|
3927
3931
|
//#endregion
|
|
3928
3932
|
//#region src/plugins/@hey-api/typescript/v1/plugin.d.ts
|
|
3929
|
-
declare
|
|
3933
|
+
declare function irSchemaToAst({
|
|
3930
3934
|
plugin,
|
|
3931
3935
|
schema,
|
|
3936
|
+
schemaExtractor,
|
|
3932
3937
|
state
|
|
3933
|
-
}: IrSchemaToAstOptions & {
|
|
3938
|
+
}: IrSchemaToAstOptions$1 & {
|
|
3934
3939
|
schema: IR$1.SchemaObject;
|
|
3935
|
-
})
|
|
3940
|
+
}): MaybeTsDsl<TypeTsDsl>;
|
|
3936
3941
|
//#endregion
|
|
3937
3942
|
//#region src/plugins/@hey-api/typescript/api.d.ts
|
|
3938
3943
|
type IApi$3 = {
|
|
@@ -7379,33 +7384,56 @@ type SwrPlugin = DefinePlugin$1<UserConfig$3, Config$2>;
|
|
|
7379
7384
|
//#region src/plugins/valibot/shared/pipes.d.ts
|
|
7380
7385
|
type Pipe = ReturnType<typeof $.call | typeof $.expr>;
|
|
7381
7386
|
type Pipes = Array<Pipe>;
|
|
7382
|
-
type PipeResult = Pipes | Pipe;
|
|
7383
|
-
type PushPipes = (target: Pipes, pipes: PipeResult) => Pipes;
|
|
7384
|
-
type PipesToNode = (pipes: PipeResult, plugin: ValibotPlugin['Instance']) => Pipe;
|
|
7387
|
+
type PipeResult = Pipes | Pipe | undefined;
|
|
7385
7388
|
interface PipesUtils {
|
|
7386
7389
|
/**
|
|
7387
|
-
*
|
|
7390
|
+
* Pushes a pipe result onto a pipes array.
|
|
7391
|
+
*
|
|
7392
|
+
* Handles single pipes, arrays of pipes, and undefined.
|
|
7388
7393
|
*/
|
|
7389
|
-
push:
|
|
7394
|
+
push: (target: Pipes, result: PipeResult) => Pipes;
|
|
7390
7395
|
/**
|
|
7391
|
-
*
|
|
7396
|
+
* Converts a pipes array to a single node expression.
|
|
7392
7397
|
*/
|
|
7393
|
-
toNode:
|
|
7398
|
+
toNode: (pipes: Pipes | Pipe, plugin: ValibotPlugin['Instance']) => Pipe;
|
|
7394
7399
|
}
|
|
7395
7400
|
//#endregion
|
|
7396
7401
|
//#region src/plugins/valibot/shared/types.d.ts
|
|
7397
|
-
type Ast$1 = {
|
|
7398
|
-
hasLazyExpression?: boolean;
|
|
7399
|
-
pipes: Pipes;
|
|
7400
|
-
typeName?: string | ts.Identifier;
|
|
7401
|
-
};
|
|
7402
|
-
type PluginState$1 = Pick<Required<SymbolMeta>, 'path'> & Pick<Partial<SymbolMeta>, 'tags'> & {
|
|
7403
|
-
hasLazyExpression: boolean;
|
|
7404
|
-
};
|
|
7405
7402
|
type ValidatorArgs$1 = {
|
|
7406
7403
|
operation: IR$1.OperationObject;
|
|
7404
|
+
/** The plugin instance. */
|
|
7407
7405
|
plugin: ValibotPlugin['Instance'];
|
|
7408
7406
|
};
|
|
7407
|
+
/**
|
|
7408
|
+
* Metadata that flows through schema walking.
|
|
7409
|
+
*/
|
|
7410
|
+
interface ValibotMeta {
|
|
7411
|
+
/** Default value from schema. */
|
|
7412
|
+
default?: unknown;
|
|
7413
|
+
/** Original format (for BigInt coercion). */
|
|
7414
|
+
format?: string;
|
|
7415
|
+
/** Whether this or any child contains a lazy reference. */
|
|
7416
|
+
hasLazy: boolean;
|
|
7417
|
+
/** Does this schema explicitly allow null? */
|
|
7418
|
+
nullable: boolean;
|
|
7419
|
+
/** Is this schema read-only? */
|
|
7420
|
+
readonly: boolean;
|
|
7421
|
+
}
|
|
7422
|
+
/**
|
|
7423
|
+
* Result from walking a schema node.
|
|
7424
|
+
*/
|
|
7425
|
+
interface ValibotResult {
|
|
7426
|
+
meta: ValibotMeta;
|
|
7427
|
+
pipes: Pipes;
|
|
7428
|
+
}
|
|
7429
|
+
/**
|
|
7430
|
+
* Finalized result after applyModifiers.
|
|
7431
|
+
*/
|
|
7432
|
+
interface ValibotFinal {
|
|
7433
|
+
pipes: Pipes;
|
|
7434
|
+
/** Type annotation for schemas requiring explicit typing (e.g., lazy). */
|
|
7435
|
+
typeName?: string | ts.Identifier;
|
|
7436
|
+
}
|
|
7409
7437
|
//#endregion
|
|
7410
7438
|
//#region src/plugins/valibot/api.d.ts
|
|
7411
7439
|
type IApi$1 = {
|
|
@@ -7427,7 +7455,7 @@ interface IntegerLimit {
|
|
|
7427
7455
|
}
|
|
7428
7456
|
type GetIntegerLimit = (format: string | undefined) => IntegerLimit | undefined;
|
|
7429
7457
|
//#endregion
|
|
7430
|
-
//#region src/plugins/valibot/resolvers
|
|
7458
|
+
//#region src/plugins/valibot/resolvers.d.ts
|
|
7431
7459
|
type Resolvers$1 = Plugin$1.Resolvers<{
|
|
7432
7460
|
/**
|
|
7433
7461
|
* Resolver for enum schemas.
|
|
@@ -7436,7 +7464,7 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
7436
7464
|
*
|
|
7437
7465
|
* Returning `undefined` will execute the default resolver logic.
|
|
7438
7466
|
*/
|
|
7439
|
-
enum?: (ctx: EnumResolverContext$1) => PipeResult
|
|
7467
|
+
enum?: (ctx: EnumResolverContext$1) => PipeResult;
|
|
7440
7468
|
/**
|
|
7441
7469
|
* Resolver for number schemas.
|
|
7442
7470
|
*
|
|
@@ -7444,7 +7472,7 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
7444
7472
|
*
|
|
7445
7473
|
* Returning `undefined` will execute the default resolver logic.
|
|
7446
7474
|
*/
|
|
7447
|
-
number?: (ctx: NumberResolverContext$1) => PipeResult
|
|
7475
|
+
number?: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7448
7476
|
/**
|
|
7449
7477
|
* Resolver for object schemas.
|
|
7450
7478
|
*
|
|
@@ -7452,7 +7480,7 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
7452
7480
|
*
|
|
7453
7481
|
* Returning `undefined` will execute the default resolver logic.
|
|
7454
7482
|
*/
|
|
7455
|
-
object?: (ctx: ObjectResolverContext$1) => PipeResult
|
|
7483
|
+
object?: (ctx: ObjectResolverContext$1) => PipeResult;
|
|
7456
7484
|
/**
|
|
7457
7485
|
* Resolver for string schemas.
|
|
7458
7486
|
*
|
|
@@ -7460,7 +7488,7 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
7460
7488
|
*
|
|
7461
7489
|
* Returning `undefined` will execute the default resolver logic.
|
|
7462
7490
|
*/
|
|
7463
|
-
string?: (ctx: StringResolverContext$1) => PipeResult
|
|
7491
|
+
string?: (ctx: StringResolverContext$1) => PipeResult;
|
|
7464
7492
|
/**
|
|
7465
7493
|
* Resolvers for request and response validators.
|
|
7466
7494
|
*
|
|
@@ -7502,9 +7530,7 @@ interface BaseContext$1 extends DollarTsDsl {
|
|
|
7502
7530
|
*/
|
|
7503
7531
|
current: Pipes;
|
|
7504
7532
|
};
|
|
7505
|
-
/**
|
|
7506
|
-
* The plugin instance.
|
|
7507
|
-
*/
|
|
7533
|
+
/** The plugin instance. */
|
|
7508
7534
|
plugin: ValibotPlugin['Instance'];
|
|
7509
7535
|
/**
|
|
7510
7536
|
* Provides access to commonly used symbols within the plugin.
|
|
@@ -7515,7 +7541,7 @@ interface BaseContext$1 extends DollarTsDsl {
|
|
|
7515
7541
|
}
|
|
7516
7542
|
interface EnumResolverContext$1 extends BaseContext$1 {
|
|
7517
7543
|
/**
|
|
7518
|
-
* Nodes used to build different parts of the
|
|
7544
|
+
* Nodes used to build different parts of the schema.
|
|
7519
7545
|
*/
|
|
7520
7546
|
nodes: {
|
|
7521
7547
|
/**
|
|
@@ -7535,28 +7561,18 @@ interface EnumResolverContext$1 extends BaseContext$1 {
|
|
|
7535
7561
|
*/
|
|
7536
7562
|
isNullable: boolean;
|
|
7537
7563
|
};
|
|
7538
|
-
/**
|
|
7539
|
-
* Returns a nullable wrapper if the enum includes null, undefined otherwise.
|
|
7540
|
-
*/
|
|
7541
|
-
nullable: (ctx: EnumResolverContext$1) => PipeResult | undefined;
|
|
7542
7564
|
};
|
|
7543
7565
|
schema: SchemaWithType<'enum'>;
|
|
7544
|
-
/**
|
|
7545
|
-
* Utility functions for enum schema processing.
|
|
7546
|
-
*/
|
|
7547
|
-
utils: {
|
|
7548
|
-
state: Refs<PluginState$1>;
|
|
7549
|
-
};
|
|
7550
7566
|
}
|
|
7551
7567
|
interface NumberResolverContext$1 extends BaseContext$1 {
|
|
7552
7568
|
/**
|
|
7553
|
-
* Nodes used to build different parts of the
|
|
7569
|
+
* Nodes used to build different parts of the schema.
|
|
7554
7570
|
*/
|
|
7555
7571
|
nodes: {
|
|
7556
7572
|
base: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7557
|
-
const: (ctx: NumberResolverContext$1) => PipeResult
|
|
7558
|
-
max: (ctx: NumberResolverContext$1) => PipeResult
|
|
7559
|
-
min: (ctx: NumberResolverContext$1) => PipeResult
|
|
7573
|
+
const: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7574
|
+
max: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7575
|
+
min: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7560
7576
|
};
|
|
7561
7577
|
schema: SchemaWithType<'integer' | 'number'>;
|
|
7562
7578
|
/**
|
|
@@ -7569,16 +7585,16 @@ interface NumberResolverContext$1 extends BaseContext$1 {
|
|
|
7569
7585
|
};
|
|
7570
7586
|
}
|
|
7571
7587
|
interface ObjectResolverContext$1 extends BaseContext$1 {
|
|
7588
|
+
_childResults: Array<ValibotResult>;
|
|
7589
|
+
applyModifiers: (result: ValibotResult, opts: {
|
|
7590
|
+
optional?: boolean;
|
|
7591
|
+
}) => ValibotFinal;
|
|
7572
7592
|
/**
|
|
7573
|
-
* Nodes used to build different parts of the
|
|
7593
|
+
* Nodes used to build different parts of the schema.
|
|
7574
7594
|
*/
|
|
7575
7595
|
nodes: {
|
|
7576
|
-
/**
|
|
7577
|
-
* If `additionalProperties` is `false` or `{ type: 'never' }`, returns `null`
|
|
7578
|
-
* to indicate no additional properties are allowed.
|
|
7579
|
-
*/
|
|
7580
7596
|
additionalProperties: (ctx: ObjectResolverContext$1) => Pipe | null | undefined;
|
|
7581
|
-
base: (ctx: ObjectResolverContext$1) =>
|
|
7597
|
+
base: (ctx: ObjectResolverContext$1) => Pipes | Pipe;
|
|
7582
7598
|
shape: (ctx: ObjectResolverContext$1) => ReturnType<typeof $.object>;
|
|
7583
7599
|
};
|
|
7584
7600
|
schema: SchemaWithType<'object'>;
|
|
@@ -7586,22 +7602,25 @@ interface ObjectResolverContext$1 extends BaseContext$1 {
|
|
|
7586
7602
|
* Utility functions for object schema processing.
|
|
7587
7603
|
*/
|
|
7588
7604
|
utils: {
|
|
7589
|
-
ast: Partial<
|
|
7590
|
-
|
|
7605
|
+
ast: Partial<{
|
|
7606
|
+
hasLazy: boolean;
|
|
7607
|
+
}>;
|
|
7591
7608
|
};
|
|
7609
|
+
walk: Walker<ValibotResult, ValibotPlugin['Instance']>;
|
|
7610
|
+
walkerCtx: SchemaVisitorContext<ValibotPlugin['Instance']>;
|
|
7592
7611
|
}
|
|
7593
7612
|
interface StringResolverContext$1 extends BaseContext$1 {
|
|
7594
7613
|
/**
|
|
7595
|
-
* Nodes used to build different parts of the
|
|
7614
|
+
* Nodes used to build different parts of the schema.
|
|
7596
7615
|
*/
|
|
7597
7616
|
nodes: {
|
|
7598
7617
|
base: (ctx: StringResolverContext$1) => PipeResult;
|
|
7599
|
-
const: (ctx: StringResolverContext$1) => PipeResult
|
|
7600
|
-
format: (ctx: StringResolverContext$1) => PipeResult
|
|
7601
|
-
length: (ctx: StringResolverContext$1) => PipeResult
|
|
7602
|
-
maxLength: (ctx: StringResolverContext$1) => PipeResult
|
|
7603
|
-
minLength: (ctx: StringResolverContext$1) => PipeResult
|
|
7604
|
-
pattern: (ctx: StringResolverContext$1) => PipeResult
|
|
7618
|
+
const: (ctx: StringResolverContext$1) => PipeResult;
|
|
7619
|
+
format: (ctx: StringResolverContext$1) => PipeResult;
|
|
7620
|
+
length: (ctx: StringResolverContext$1) => PipeResult;
|
|
7621
|
+
maxLength: (ctx: StringResolverContext$1) => PipeResult;
|
|
7622
|
+
minLength: (ctx: StringResolverContext$1) => PipeResult;
|
|
7623
|
+
pattern: (ctx: StringResolverContext$1) => PipeResult;
|
|
7605
7624
|
};
|
|
7606
7625
|
schema: SchemaWithType<'string'>;
|
|
7607
7626
|
}
|
|
@@ -7633,6 +7652,8 @@ type UserConfig$2 = Plugin$1.Name<'valibot'> & Plugin$1.Hooks & Plugin$1.UserCom
|
|
|
7633
7652
|
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
7634
7653
|
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
7635
7654
|
* - `object`: Full configuration object
|
|
7655
|
+
*
|
|
7656
|
+
* @default true
|
|
7636
7657
|
*/
|
|
7637
7658
|
definitions?: boolean | NameTransformer | {
|
|
7638
7659
|
/**
|
|
@@ -7672,6 +7693,8 @@ type UserConfig$2 = Plugin$1.Name<'valibot'> & Plugin$1.Hooks & Plugin$1.UserCom
|
|
|
7672
7693
|
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
7673
7694
|
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
7674
7695
|
* - `object`: Full configuration object
|
|
7696
|
+
*
|
|
7697
|
+
* @default true
|
|
7675
7698
|
*/
|
|
7676
7699
|
requests?: boolean | NameTransformer | {
|
|
7677
7700
|
/**
|
|
@@ -7703,6 +7726,8 @@ type UserConfig$2 = Plugin$1.Name<'valibot'> & Plugin$1.Hooks & Plugin$1.UserCom
|
|
|
7703
7726
|
* - `boolean`: Shorthand for `{ enabled: boolean }`
|
|
7704
7727
|
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
7705
7728
|
* - `object`: Full configuration object
|
|
7729
|
+
*
|
|
7730
|
+
* @default true
|
|
7706
7731
|
*/
|
|
7707
7732
|
responses?: boolean | NameTransformer | {
|
|
7708
7733
|
/**
|
|
@@ -7758,61 +7783,71 @@ type UserConfig$2 = Plugin$1.Name<'valibot'> & Plugin$1.Hooks & Plugin$1.UserCom
|
|
|
7758
7783
|
};
|
|
7759
7784
|
};
|
|
7760
7785
|
type Config$1 = Plugin$1.Name<'valibot'> & Plugin$1.Hooks & Plugin$1.Comments & Plugin$1.Exports & Resolvers$1 & {
|
|
7761
|
-
/**
|
|
7762
|
-
* Casing convention for generated names.
|
|
7763
|
-
*/
|
|
7786
|
+
/** Casing convention for generated names. */
|
|
7764
7787
|
case: Casing;
|
|
7765
|
-
/**
|
|
7766
|
-
* Configuration for reusable schema definitions.
|
|
7767
|
-
*
|
|
7768
|
-
* Controls generation of shared Valibot schemas that can be referenced
|
|
7769
|
-
* across requests and responses.
|
|
7770
|
-
*/
|
|
7788
|
+
/** Configuration for reusable schema definitions. */
|
|
7771
7789
|
definitions: NamingOptions & FeatureToggle;
|
|
7772
|
-
/**
|
|
7773
|
-
* Enable Valibot metadata support? It's often useful to associate a schema
|
|
7774
|
-
* with some additional metadata for documentation, code generation, AI
|
|
7775
|
-
* structured outputs, form validation, and other purposes.
|
|
7776
|
-
*
|
|
7777
|
-
* @default false
|
|
7778
|
-
*/
|
|
7790
|
+
/** Enable Valibot metadata support? */
|
|
7779
7791
|
metadata: boolean;
|
|
7780
|
-
/**
|
|
7781
|
-
* Configuration for request-specific Valibot schemas.
|
|
7782
|
-
*
|
|
7783
|
-
* Controls generation of Valibot schemas for request bodies, query
|
|
7784
|
-
* parameters, path parameters, and headers.
|
|
7785
|
-
*/
|
|
7792
|
+
/** Configuration for request-specific Valibot schemas. */
|
|
7786
7793
|
requests: NamingOptions & FeatureToggle;
|
|
7787
|
-
/**
|
|
7788
|
-
* Configuration for response-specific Valibot schemas.
|
|
7789
|
-
*
|
|
7790
|
-
* Controls generation of Valibot schemas for response bodies, error
|
|
7791
|
-
* responses, and status codes.
|
|
7792
|
-
*/
|
|
7794
|
+
/** Configuration for response-specific Valibot schemas. */
|
|
7793
7795
|
responses: NamingOptions & FeatureToggle;
|
|
7794
|
-
/**
|
|
7795
|
-
* Configuration for webhook-specific Valibot schemas.
|
|
7796
|
-
*
|
|
7797
|
-
* Controls generation of Valibot schemas for webhook payloads.
|
|
7798
|
-
*/
|
|
7796
|
+
/** Configuration for webhook-specific Valibot schemas. */
|
|
7799
7797
|
webhooks: NamingOptions & FeatureToggle;
|
|
7800
7798
|
};
|
|
7801
7799
|
type ValibotPlugin = DefinePlugin$1<UserConfig$2, Config$1, IApi$1>;
|
|
7802
7800
|
//#endregion
|
|
7803
7801
|
//#region src/plugins/zod/shared/types.d.ts
|
|
7804
7802
|
type Ast = {
|
|
7803
|
+
anyType?: string;
|
|
7805
7804
|
expression: ReturnType<typeof $.expr | typeof $.call>;
|
|
7806
7805
|
hasLazyExpression?: boolean;
|
|
7807
7806
|
typeName?: string | ts.Identifier;
|
|
7808
7807
|
};
|
|
7808
|
+
type IrSchemaToAstOptions = {
|
|
7809
|
+
/** The plugin instance. */
|
|
7810
|
+
plugin: ZodPlugin['Instance'];
|
|
7811
|
+
/** The plugin state references. */
|
|
7812
|
+
state: Refs<PluginState>;
|
|
7813
|
+
walk: Walker<ZodSchemaResult, ZodPlugin['Instance']>;
|
|
7814
|
+
};
|
|
7809
7815
|
type PluginState = Pick<Required<SymbolMeta>, 'path'> & Pick<Partial<SymbolMeta>, 'tags'> & {
|
|
7816
|
+
anyType?: string;
|
|
7810
7817
|
hasLazyExpression: boolean;
|
|
7811
7818
|
};
|
|
7819
|
+
type TypeOptions = {
|
|
7820
|
+
/** Configuration for TypeScript type generation from Zod schemas. */
|
|
7821
|
+
types: {
|
|
7822
|
+
/** Configuration for `infer` types. */
|
|
7823
|
+
infer: NamingOptions & FeatureToggle;
|
|
7824
|
+
};
|
|
7825
|
+
};
|
|
7812
7826
|
type ValidatorArgs = {
|
|
7813
7827
|
operation: IR$1.OperationObject;
|
|
7814
7828
|
plugin: ZodPlugin['Instance'];
|
|
7815
7829
|
};
|
|
7830
|
+
/**
|
|
7831
|
+
* The result from schema walking.
|
|
7832
|
+
*/
|
|
7833
|
+
interface ZodSchemaResult {
|
|
7834
|
+
/** Default value from schema, if any. */
|
|
7835
|
+
default?: unknown;
|
|
7836
|
+
/** The Zod expression AST. */
|
|
7837
|
+
expression: {
|
|
7838
|
+
expression: ReturnType<typeof $.expr | typeof $.call>;
|
|
7839
|
+
};
|
|
7840
|
+
/** The original schema format (for BigInt coercion). */
|
|
7841
|
+
format?: string;
|
|
7842
|
+
/** Whether any child contains a lazy expression. */
|
|
7843
|
+
hasLazyExpression?: boolean;
|
|
7844
|
+
/** Whether THIS result is itself lazy (not just inherited). */
|
|
7845
|
+
isLazy?: boolean;
|
|
7846
|
+
/** Does this schema explicitly allow null? */
|
|
7847
|
+
nullable: boolean;
|
|
7848
|
+
/** Is this schema read-only? */
|
|
7849
|
+
readonly: boolean;
|
|
7850
|
+
}
|
|
7816
7851
|
//#endregion
|
|
7817
7852
|
//#region src/plugins/zod/api.d.ts
|
|
7818
7853
|
type IApi = {
|
|
@@ -7882,7 +7917,7 @@ type Resolvers = Plugin$1.Resolvers<{
|
|
|
7882
7917
|
};
|
|
7883
7918
|
}>;
|
|
7884
7919
|
type ValidatorResolver = (ctx: ValidatorResolverContext) => MaybeArray<TsDsl<ts.Statement>> | null | undefined;
|
|
7885
|
-
|
|
7920
|
+
type BaseContext = DollarTsDsl & Pick<IrSchemaToAstOptions, 'plugin'> & {
|
|
7886
7921
|
/**
|
|
7887
7922
|
* Functions for working with chains.
|
|
7888
7923
|
*/
|
|
@@ -7898,17 +7933,13 @@ interface BaseContext extends DollarTsDsl {
|
|
|
7898
7933
|
*/
|
|
7899
7934
|
current: Chain;
|
|
7900
7935
|
};
|
|
7901
|
-
/**
|
|
7902
|
-
* The plugin instance.
|
|
7903
|
-
*/
|
|
7904
|
-
plugin: ZodPlugin['Instance'];
|
|
7905
7936
|
/**
|
|
7906
7937
|
* Provides access to commonly used symbols within the plugin.
|
|
7907
7938
|
*/
|
|
7908
7939
|
symbols: {
|
|
7909
7940
|
z: Symbol;
|
|
7910
7941
|
};
|
|
7911
|
-
}
|
|
7942
|
+
};
|
|
7912
7943
|
interface EnumResolverContext extends BaseContext {
|
|
7913
7944
|
/**
|
|
7914
7945
|
* Nodes used to build different parts of the enum schema.
|
|
@@ -7939,10 +7970,6 @@ interface EnumResolverContext extends BaseContext {
|
|
|
7939
7970
|
*/
|
|
7940
7971
|
literalMembers: Array<Chain>;
|
|
7941
7972
|
};
|
|
7942
|
-
/**
|
|
7943
|
-
* Returns a nullable wrapper if the enum includes null, undefined otherwise.
|
|
7944
|
-
*/
|
|
7945
|
-
nullable: (ctx: EnumResolverContext) => Chain | undefined;
|
|
7946
7973
|
};
|
|
7947
7974
|
schema: SchemaWithType<'enum'>;
|
|
7948
7975
|
/**
|
|
@@ -7976,6 +8003,9 @@ interface NumberResolverContext extends BaseContext {
|
|
|
7976
8003
|
};
|
|
7977
8004
|
}
|
|
7978
8005
|
interface ObjectResolverContext extends BaseContext {
|
|
8006
|
+
applyModifiers: (result: ZodSchemaResult, opts: {
|
|
8007
|
+
optional?: boolean;
|
|
8008
|
+
}) => Ast;
|
|
7979
8009
|
/**
|
|
7980
8010
|
* Nodes used to build different parts of the object schema.
|
|
7981
8011
|
*/
|
|
@@ -7996,6 +8026,8 @@ interface ObjectResolverContext extends BaseContext {
|
|
|
7996
8026
|
ast: Partial<Omit<Ast, 'typeName'>>;
|
|
7997
8027
|
state: Refs<PluginState>;
|
|
7998
8028
|
};
|
|
8029
|
+
walk: Walker<ZodSchemaResult, ZodPlugin['Instance']>;
|
|
8030
|
+
walkerCtx: SchemaVisitorContext<ZodPlugin['Instance']>;
|
|
7999
8031
|
}
|
|
8000
8032
|
interface StringResolverContext extends BaseContext {
|
|
8001
8033
|
/**
|
|
@@ -8387,146 +8419,35 @@ type UserConfig$1 = Plugin$1.Name<'zod'> & Plugin$1.Hooks & Plugin$1.UserComment
|
|
|
8387
8419
|
};
|
|
8388
8420
|
};
|
|
8389
8421
|
type Config = Plugin$1.Name<'zod'> & Plugin$1.Hooks & Plugin$1.Comments & Plugin$1.Exports & Resolvers & {
|
|
8390
|
-
/**
|
|
8391
|
-
* Casing convention for generated names.
|
|
8392
|
-
*/
|
|
8422
|
+
/** Casing convention for generated names. */
|
|
8393
8423
|
case: Casing;
|
|
8394
|
-
/**
|
|
8395
|
-
* The compatibility version to target for generated output.
|
|
8396
|
-
*
|
|
8397
|
-
* Can be:
|
|
8398
|
-
* - `4`: [Zod 4](https://zod.dev/packages/zod) (default).
|
|
8399
|
-
* - `3`: [Zod 3](https://v3.zod.dev/).
|
|
8400
|
-
* - `'mini'`: [Zod Mini](https://zod.dev/packages/mini).
|
|
8401
|
-
*
|
|
8402
|
-
* @default 4
|
|
8403
|
-
*/
|
|
8424
|
+
/** The compatibility version to target for generated output. */
|
|
8404
8425
|
compatibilityVersion: 3 | 4 | 'mini';
|
|
8405
|
-
/**
|
|
8406
|
-
* Configuration for date handling in generated Zod schemas.
|
|
8407
|
-
*
|
|
8408
|
-
* Controls how date values are processed and validated using Zod's
|
|
8409
|
-
* date validation features.
|
|
8410
|
-
*/
|
|
8426
|
+
/** Configuration for date handling in generated Zod schemas. */
|
|
8411
8427
|
dates: {
|
|
8412
|
-
/**
|
|
8413
|
-
* Whether to allow unqualified (timezone-less) datetimes:
|
|
8414
|
-
*
|
|
8415
|
-
* When enabled, Zod will accept datetime strings without timezone information.
|
|
8416
|
-
* When disabled, Zod will require timezone information in datetime strings.
|
|
8417
|
-
*
|
|
8418
|
-
* @default false
|
|
8419
|
-
*/
|
|
8428
|
+
/** Whether to allow unqualified (timezone-less) datetimes. */
|
|
8420
8429
|
local: boolean;
|
|
8421
|
-
/**
|
|
8422
|
-
* Whether to include timezone offset information when handling dates.
|
|
8423
|
-
*
|
|
8424
|
-
* When enabled, date strings will preserve timezone information.
|
|
8425
|
-
* When disabled, dates will be treated as local time.
|
|
8426
|
-
*
|
|
8427
|
-
* @default false
|
|
8428
|
-
*/
|
|
8430
|
+
/** Whether to include timezone offset information when handling dates. */
|
|
8429
8431
|
offset: boolean;
|
|
8430
8432
|
};
|
|
8431
|
-
/**
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
* Controls generation of shared Zod schemas that can be referenced across
|
|
8435
|
-
* requests and responses.
|
|
8436
|
-
*/
|
|
8437
|
-
definitions: NamingOptions & FeatureToggle & {
|
|
8438
|
-
/**
|
|
8439
|
-
* Configuration for TypeScript type generation from Zod schemas.
|
|
8440
|
-
*
|
|
8441
|
-
* Controls generation of TypeScript types based on the generated Zod schemas.
|
|
8442
|
-
*/
|
|
8443
|
-
types: {
|
|
8444
|
-
/**
|
|
8445
|
-
* Configuration for `infer` types.
|
|
8446
|
-
*/
|
|
8447
|
-
infer: NamingOptions & FeatureToggle;
|
|
8448
|
-
};
|
|
8449
|
-
};
|
|
8450
|
-
/**
|
|
8451
|
-
* Enable Zod metadata support? It's often useful to associate a schema with
|
|
8452
|
-
* some additional metadata for documentation, code generation, AI
|
|
8453
|
-
* structured outputs, form validation, and other purposes.
|
|
8454
|
-
*
|
|
8455
|
-
* @default false
|
|
8456
|
-
*/
|
|
8433
|
+
/** Configuration for reusable schema definitions. */
|
|
8434
|
+
definitions: NamingOptions & FeatureToggle & TypeOptions;
|
|
8435
|
+
/** Enable Zod metadata support? */
|
|
8457
8436
|
metadata: boolean;
|
|
8458
|
-
/**
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
*/
|
|
8464
|
-
requests: NamingOptions & FeatureToggle & {
|
|
8465
|
-
/**
|
|
8466
|
-
* Configuration for TypeScript type generation from Zod schemas.
|
|
8467
|
-
*
|
|
8468
|
-
* Controls generation of TypeScript types based on the generated Zod schemas.
|
|
8469
|
-
*/
|
|
8470
|
-
types: {
|
|
8471
|
-
/**
|
|
8472
|
-
* Configuration for `infer` types.
|
|
8473
|
-
*/
|
|
8474
|
-
infer: NamingOptions & FeatureToggle;
|
|
8475
|
-
};
|
|
8476
|
-
};
|
|
8477
|
-
/**
|
|
8478
|
-
* Configuration for response-specific Zod schemas.
|
|
8479
|
-
*
|
|
8480
|
-
* Controls generation of Zod schemas for response bodies, error responses,
|
|
8481
|
-
* and status codes.
|
|
8482
|
-
*/
|
|
8483
|
-
responses: NamingOptions & FeatureToggle & {
|
|
8484
|
-
/**
|
|
8485
|
-
* Configuration for TypeScript type generation from Zod schemas.
|
|
8486
|
-
*
|
|
8487
|
-
* Controls generation of TypeScript types based on the generated Zod schemas.
|
|
8488
|
-
*/
|
|
8489
|
-
types: {
|
|
8490
|
-
/**
|
|
8491
|
-
* Configuration for `infer` types.
|
|
8492
|
-
*/
|
|
8493
|
-
infer: NamingOptions & FeatureToggle;
|
|
8494
|
-
};
|
|
8495
|
-
};
|
|
8496
|
-
/**
|
|
8497
|
-
* Configuration for TypeScript type generation from Zod schemas.
|
|
8498
|
-
*
|
|
8499
|
-
* Controls generation of TypeScript types based on the generated Zod schemas.
|
|
8500
|
-
*/
|
|
8437
|
+
/** Configuration for request-specific Zod schemas. */
|
|
8438
|
+
requests: NamingOptions & FeatureToggle & TypeOptions;
|
|
8439
|
+
/** Configuration for response-specific Zod schemas. */
|
|
8440
|
+
responses: NamingOptions & FeatureToggle & TypeOptions;
|
|
8441
|
+
/** Configuration for TypeScript type generation from Zod schemas. */
|
|
8501
8442
|
types: {
|
|
8502
|
-
/**
|
|
8503
|
-
* Configuration for `infer` types.
|
|
8504
|
-
*/
|
|
8443
|
+
/** Configuration for `infer` types. */
|
|
8505
8444
|
infer: FeatureToggle & {
|
|
8506
|
-
/**
|
|
8507
|
-
* Casing convention for generated names.
|
|
8508
|
-
*/
|
|
8445
|
+
/** Casing convention for generated names. */
|
|
8509
8446
|
case: Casing;
|
|
8510
8447
|
};
|
|
8511
8448
|
};
|
|
8512
|
-
/**
|
|
8513
|
-
|
|
8514
|
-
*
|
|
8515
|
-
* Controls generation of Zod schemas for webhook payloads.
|
|
8516
|
-
*/
|
|
8517
|
-
webhooks: NamingOptions & FeatureToggle & {
|
|
8518
|
-
/**
|
|
8519
|
-
* Configuration for TypeScript type generation from Zod schemas.
|
|
8520
|
-
*
|
|
8521
|
-
* Controls generation of TypeScript types based on the generated Zod schemas.
|
|
8522
|
-
*/
|
|
8523
|
-
types: {
|
|
8524
|
-
/**
|
|
8525
|
-
* Configuration for `infer` types.
|
|
8526
|
-
*/
|
|
8527
|
-
infer: NamingOptions & FeatureToggle;
|
|
8528
|
-
};
|
|
8529
|
-
};
|
|
8449
|
+
/** Configuration for webhook-specific Zod schemas. */
|
|
8450
|
+
webhooks: NamingOptions & FeatureToggle & TypeOptions;
|
|
8530
8451
|
};
|
|
8531
8452
|
type ZodPlugin = DefinePlugin$1<UserConfig$1, Config, IApi>;
|
|
8532
8453
|
//#endregion
|