@hey-api/openapi-ts 0.92.4 → 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/types.ts +1 -0
- 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/index.d.mts +120 -89
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-BxMu9GWq.mjs → init-BVQKw3ZX.mjs} +1877 -1397
- package/dist/init-BVQKw3ZX.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +3 -3
- package/dist/{src-BqiDMJko.mjs → src-BD5OAshH.mjs} +8 -4
- package/dist/src-BD5OAshH.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/init-BxMu9GWq.mjs.map +0 -1
- package/dist/src-BqiDMJko.mjs.map +0 -1
package/dist/clients/ky/types.ts
CHANGED
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, SchemaExtractor,
|
|
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
|
*
|
|
@@ -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
|
*
|
|
@@ -3925,9 +3925,9 @@ type IrSchemaToAstOptions$1 = {
|
|
|
3925
3925
|
/** Optional schema extractor function. */
|
|
3926
3926
|
schemaExtractor?: SchemaExtractor;
|
|
3927
3927
|
/** The plugin state references. */
|
|
3928
|
-
state: Refs<PluginState$
|
|
3928
|
+
state: Refs<PluginState$1>;
|
|
3929
3929
|
};
|
|
3930
|
-
type PluginState$
|
|
3930
|
+
type PluginState$1 = Pick<Required<SymbolMeta>, 'path'> & Pick<Partial<SymbolMeta>, 'tags'>;
|
|
3931
3931
|
//#endregion
|
|
3932
3932
|
//#region src/plugins/@hey-api/typescript/v1/plugin.d.ts
|
|
3933
3933
|
declare function irSchemaToAst({
|
|
@@ -7384,47 +7384,56 @@ type SwrPlugin = DefinePlugin$1<UserConfig$3, Config$2>;
|
|
|
7384
7384
|
//#region src/plugins/valibot/shared/pipes.d.ts
|
|
7385
7385
|
type Pipe = ReturnType<typeof $.call | typeof $.expr>;
|
|
7386
7386
|
type Pipes = Array<Pipe>;
|
|
7387
|
-
type PipeResult = Pipes | Pipe;
|
|
7388
|
-
type PushPipes = (target: Pipes, pipes: PipeResult) => Pipes;
|
|
7389
|
-
type PipesToNode = (pipes: PipeResult, plugin: ValibotPlugin['Instance']) => Pipe;
|
|
7387
|
+
type PipeResult = Pipes | Pipe | undefined;
|
|
7390
7388
|
interface PipesUtils {
|
|
7391
7389
|
/**
|
|
7392
|
-
*
|
|
7390
|
+
* Pushes a pipe result onto a pipes array.
|
|
7391
|
+
*
|
|
7392
|
+
* Handles single pipes, arrays of pipes, and undefined.
|
|
7393
7393
|
*/
|
|
7394
|
-
push:
|
|
7394
|
+
push: (target: Pipes, result: PipeResult) => Pipes;
|
|
7395
7395
|
/**
|
|
7396
|
-
*
|
|
7396
|
+
* Converts a pipes array to a single node expression.
|
|
7397
7397
|
*/
|
|
7398
|
-
toNode:
|
|
7398
|
+
toNode: (pipes: Pipes | Pipe, plugin: ValibotPlugin['Instance']) => Pipe;
|
|
7399
7399
|
}
|
|
7400
7400
|
//#endregion
|
|
7401
|
-
//#region src/plugins/valibot/shared/processor.d.ts
|
|
7402
|
-
type ProcessorContext = Pick<IrSchemaToAstOptions, 'plugin'> & SchemaProcessorContext & {
|
|
7403
|
-
naming: NamingConfig;
|
|
7404
|
-
schema: IR$1.SchemaObject;
|
|
7405
|
-
};
|
|
7406
|
-
//#endregion
|
|
7407
7401
|
//#region src/plugins/valibot/shared/types.d.ts
|
|
7408
|
-
type Ast$1 = {
|
|
7409
|
-
hasLazyExpression?: boolean;
|
|
7410
|
-
pipes: Pipes;
|
|
7411
|
-
typeName?: string | ts.Identifier;
|
|
7412
|
-
};
|
|
7413
|
-
type IrSchemaToAstOptions = {
|
|
7414
|
-
/** The plugin instance. */
|
|
7415
|
-
plugin: ValibotPlugin['Instance'];
|
|
7416
|
-
/** Optional schema extractor function. */
|
|
7417
|
-
schemaExtractor?: SchemaExtractor<ProcessorContext>;
|
|
7418
|
-
/** The plugin state references. */
|
|
7419
|
-
state: Refs<PluginState$1>;
|
|
7420
|
-
};
|
|
7421
|
-
type PluginState$1 = Pick<Required<SymbolMeta>, 'path'> & Pick<Partial<SymbolMeta>, 'tags'> & {
|
|
7422
|
-
hasLazyExpression: boolean;
|
|
7423
|
-
};
|
|
7424
7402
|
type ValidatorArgs$1 = {
|
|
7425
7403
|
operation: IR$1.OperationObject;
|
|
7404
|
+
/** The plugin instance. */
|
|
7426
7405
|
plugin: ValibotPlugin['Instance'];
|
|
7427
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
|
+
}
|
|
7428
7437
|
//#endregion
|
|
7429
7438
|
//#region src/plugins/valibot/api.d.ts
|
|
7430
7439
|
type IApi$1 = {
|
|
@@ -7446,7 +7455,7 @@ interface IntegerLimit {
|
|
|
7446
7455
|
}
|
|
7447
7456
|
type GetIntegerLimit = (format: string | undefined) => IntegerLimit | undefined;
|
|
7448
7457
|
//#endregion
|
|
7449
|
-
//#region src/plugins/valibot/resolvers
|
|
7458
|
+
//#region src/plugins/valibot/resolvers.d.ts
|
|
7450
7459
|
type Resolvers$1 = Plugin$1.Resolvers<{
|
|
7451
7460
|
/**
|
|
7452
7461
|
* Resolver for enum schemas.
|
|
@@ -7455,7 +7464,7 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
7455
7464
|
*
|
|
7456
7465
|
* Returning `undefined` will execute the default resolver logic.
|
|
7457
7466
|
*/
|
|
7458
|
-
enum?: (ctx: EnumResolverContext$1) => PipeResult
|
|
7467
|
+
enum?: (ctx: EnumResolverContext$1) => PipeResult;
|
|
7459
7468
|
/**
|
|
7460
7469
|
* Resolver for number schemas.
|
|
7461
7470
|
*
|
|
@@ -7463,7 +7472,7 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
7463
7472
|
*
|
|
7464
7473
|
* Returning `undefined` will execute the default resolver logic.
|
|
7465
7474
|
*/
|
|
7466
|
-
number?: (ctx: NumberResolverContext$1) => PipeResult
|
|
7475
|
+
number?: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7467
7476
|
/**
|
|
7468
7477
|
* Resolver for object schemas.
|
|
7469
7478
|
*
|
|
@@ -7471,7 +7480,7 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
7471
7480
|
*
|
|
7472
7481
|
* Returning `undefined` will execute the default resolver logic.
|
|
7473
7482
|
*/
|
|
7474
|
-
object?: (ctx: ObjectResolverContext$1) => PipeResult
|
|
7483
|
+
object?: (ctx: ObjectResolverContext$1) => PipeResult;
|
|
7475
7484
|
/**
|
|
7476
7485
|
* Resolver for string schemas.
|
|
7477
7486
|
*
|
|
@@ -7479,7 +7488,7 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
7479
7488
|
*
|
|
7480
7489
|
* Returning `undefined` will execute the default resolver logic.
|
|
7481
7490
|
*/
|
|
7482
|
-
string?: (ctx: StringResolverContext$1) => PipeResult
|
|
7491
|
+
string?: (ctx: StringResolverContext$1) => PipeResult;
|
|
7483
7492
|
/**
|
|
7484
7493
|
* Resolvers for request and response validators.
|
|
7485
7494
|
*
|
|
@@ -7505,7 +7514,7 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
7505
7514
|
};
|
|
7506
7515
|
}>;
|
|
7507
7516
|
type ValidatorResolver$1 = (ctx: ValidatorResolverContext$1) => PipeResult | null | undefined;
|
|
7508
|
-
|
|
7517
|
+
interface BaseContext$1 extends DollarTsDsl {
|
|
7509
7518
|
/**
|
|
7510
7519
|
* Functions for working with pipes.
|
|
7511
7520
|
*/
|
|
@@ -7521,16 +7530,18 @@ type BaseContext$1 = DollarTsDsl & Pick<IrSchemaToAstOptions, 'plugin' | 'schema
|
|
|
7521
7530
|
*/
|
|
7522
7531
|
current: Pipes;
|
|
7523
7532
|
};
|
|
7533
|
+
/** The plugin instance. */
|
|
7534
|
+
plugin: ValibotPlugin['Instance'];
|
|
7524
7535
|
/**
|
|
7525
7536
|
* Provides access to commonly used symbols within the plugin.
|
|
7526
7537
|
*/
|
|
7527
7538
|
symbols: {
|
|
7528
7539
|
v: Symbol;
|
|
7529
7540
|
};
|
|
7530
|
-
}
|
|
7541
|
+
}
|
|
7531
7542
|
interface EnumResolverContext$1 extends BaseContext$1 {
|
|
7532
7543
|
/**
|
|
7533
|
-
* Nodes used to build different parts of the
|
|
7544
|
+
* Nodes used to build different parts of the schema.
|
|
7534
7545
|
*/
|
|
7535
7546
|
nodes: {
|
|
7536
7547
|
/**
|
|
@@ -7550,28 +7561,18 @@ interface EnumResolverContext$1 extends BaseContext$1 {
|
|
|
7550
7561
|
*/
|
|
7551
7562
|
isNullable: boolean;
|
|
7552
7563
|
};
|
|
7553
|
-
/**
|
|
7554
|
-
* Returns a nullable wrapper if the enum includes null, undefined otherwise.
|
|
7555
|
-
*/
|
|
7556
|
-
nullable: (ctx: EnumResolverContext$1) => PipeResult | undefined;
|
|
7557
7564
|
};
|
|
7558
7565
|
schema: SchemaWithType<'enum'>;
|
|
7559
|
-
/**
|
|
7560
|
-
* Utility functions for enum schema processing.
|
|
7561
|
-
*/
|
|
7562
|
-
utils: {
|
|
7563
|
-
state: Refs<PluginState$1>;
|
|
7564
|
-
};
|
|
7565
7566
|
}
|
|
7566
7567
|
interface NumberResolverContext$1 extends BaseContext$1 {
|
|
7567
7568
|
/**
|
|
7568
|
-
* Nodes used to build different parts of the
|
|
7569
|
+
* Nodes used to build different parts of the schema.
|
|
7569
7570
|
*/
|
|
7570
7571
|
nodes: {
|
|
7571
7572
|
base: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7572
|
-
const: (ctx: NumberResolverContext$1) => PipeResult
|
|
7573
|
-
max: (ctx: NumberResolverContext$1) => PipeResult
|
|
7574
|
-
min: (ctx: NumberResolverContext$1) => PipeResult
|
|
7573
|
+
const: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7574
|
+
max: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7575
|
+
min: (ctx: NumberResolverContext$1) => PipeResult;
|
|
7575
7576
|
};
|
|
7576
7577
|
schema: SchemaWithType<'integer' | 'number'>;
|
|
7577
7578
|
/**
|
|
@@ -7584,16 +7585,16 @@ interface NumberResolverContext$1 extends BaseContext$1 {
|
|
|
7584
7585
|
};
|
|
7585
7586
|
}
|
|
7586
7587
|
interface ObjectResolverContext$1 extends BaseContext$1 {
|
|
7588
|
+
_childResults: Array<ValibotResult>;
|
|
7589
|
+
applyModifiers: (result: ValibotResult, opts: {
|
|
7590
|
+
optional?: boolean;
|
|
7591
|
+
}) => ValibotFinal;
|
|
7587
7592
|
/**
|
|
7588
|
-
* Nodes used to build different parts of the
|
|
7593
|
+
* Nodes used to build different parts of the schema.
|
|
7589
7594
|
*/
|
|
7590
7595
|
nodes: {
|
|
7591
|
-
/**
|
|
7592
|
-
* If `additionalProperties` is `false` or `{ type: 'never' }`, returns `null`
|
|
7593
|
-
* to indicate no additional properties are allowed.
|
|
7594
|
-
*/
|
|
7595
7596
|
additionalProperties: (ctx: ObjectResolverContext$1) => Pipe | null | undefined;
|
|
7596
|
-
base: (ctx: ObjectResolverContext$1) =>
|
|
7597
|
+
base: (ctx: ObjectResolverContext$1) => Pipes | Pipe;
|
|
7597
7598
|
shape: (ctx: ObjectResolverContext$1) => ReturnType<typeof $.object>;
|
|
7598
7599
|
};
|
|
7599
7600
|
schema: SchemaWithType<'object'>;
|
|
@@ -7601,22 +7602,25 @@ interface ObjectResolverContext$1 extends BaseContext$1 {
|
|
|
7601
7602
|
* Utility functions for object schema processing.
|
|
7602
7603
|
*/
|
|
7603
7604
|
utils: {
|
|
7604
|
-
ast: Partial<
|
|
7605
|
-
|
|
7605
|
+
ast: Partial<{
|
|
7606
|
+
hasLazy: boolean;
|
|
7607
|
+
}>;
|
|
7606
7608
|
};
|
|
7609
|
+
walk: Walker<ValibotResult, ValibotPlugin['Instance']>;
|
|
7610
|
+
walkerCtx: SchemaVisitorContext<ValibotPlugin['Instance']>;
|
|
7607
7611
|
}
|
|
7608
7612
|
interface StringResolverContext$1 extends BaseContext$1 {
|
|
7609
7613
|
/**
|
|
7610
|
-
* Nodes used to build different parts of the
|
|
7614
|
+
* Nodes used to build different parts of the schema.
|
|
7611
7615
|
*/
|
|
7612
7616
|
nodes: {
|
|
7613
7617
|
base: (ctx: StringResolverContext$1) => PipeResult;
|
|
7614
|
-
const: (ctx: StringResolverContext$1) => PipeResult
|
|
7615
|
-
format: (ctx: StringResolverContext$1) => PipeResult
|
|
7616
|
-
length: (ctx: StringResolverContext$1) => PipeResult
|
|
7617
|
-
maxLength: (ctx: StringResolverContext$1) => PipeResult
|
|
7618
|
-
minLength: (ctx: StringResolverContext$1) => PipeResult
|
|
7619
|
-
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;
|
|
7620
7624
|
};
|
|
7621
7625
|
schema: SchemaWithType<'string'>;
|
|
7622
7626
|
}
|
|
@@ -7796,11 +7800,20 @@ type ValibotPlugin = DefinePlugin$1<UserConfig$2, Config$1, IApi$1>;
|
|
|
7796
7800
|
//#endregion
|
|
7797
7801
|
//#region src/plugins/zod/shared/types.d.ts
|
|
7798
7802
|
type Ast = {
|
|
7803
|
+
anyType?: string;
|
|
7799
7804
|
expression: ReturnType<typeof $.expr | typeof $.call>;
|
|
7800
7805
|
hasLazyExpression?: boolean;
|
|
7801
7806
|
typeName?: string | ts.Identifier;
|
|
7802
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
|
+
};
|
|
7803
7815
|
type PluginState = Pick<Required<SymbolMeta>, 'path'> & Pick<Partial<SymbolMeta>, 'tags'> & {
|
|
7816
|
+
anyType?: string;
|
|
7804
7817
|
hasLazyExpression: boolean;
|
|
7805
7818
|
};
|
|
7806
7819
|
type TypeOptions = {
|
|
@@ -7814,6 +7827,27 @@ type ValidatorArgs = {
|
|
|
7814
7827
|
operation: IR$1.OperationObject;
|
|
7815
7828
|
plugin: ZodPlugin['Instance'];
|
|
7816
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
|
+
}
|
|
7817
7851
|
//#endregion
|
|
7818
7852
|
//#region src/plugins/zod/api.d.ts
|
|
7819
7853
|
type IApi = {
|
|
@@ -7883,7 +7917,7 @@ type Resolvers = Plugin$1.Resolvers<{
|
|
|
7883
7917
|
};
|
|
7884
7918
|
}>;
|
|
7885
7919
|
type ValidatorResolver = (ctx: ValidatorResolverContext) => MaybeArray<TsDsl<ts.Statement>> | null | undefined;
|
|
7886
|
-
|
|
7920
|
+
type BaseContext = DollarTsDsl & Pick<IrSchemaToAstOptions, 'plugin'> & {
|
|
7887
7921
|
/**
|
|
7888
7922
|
* Functions for working with chains.
|
|
7889
7923
|
*/
|
|
@@ -7899,17 +7933,13 @@ interface BaseContext extends DollarTsDsl {
|
|
|
7899
7933
|
*/
|
|
7900
7934
|
current: Chain;
|
|
7901
7935
|
};
|
|
7902
|
-
/**
|
|
7903
|
-
* The plugin instance.
|
|
7904
|
-
*/
|
|
7905
|
-
plugin: ZodPlugin['Instance'];
|
|
7906
7936
|
/**
|
|
7907
7937
|
* Provides access to commonly used symbols within the plugin.
|
|
7908
7938
|
*/
|
|
7909
7939
|
symbols: {
|
|
7910
7940
|
z: Symbol;
|
|
7911
7941
|
};
|
|
7912
|
-
}
|
|
7942
|
+
};
|
|
7913
7943
|
interface EnumResolverContext extends BaseContext {
|
|
7914
7944
|
/**
|
|
7915
7945
|
* Nodes used to build different parts of the enum schema.
|
|
@@ -7940,10 +7970,6 @@ interface EnumResolverContext extends BaseContext {
|
|
|
7940
7970
|
*/
|
|
7941
7971
|
literalMembers: Array<Chain>;
|
|
7942
7972
|
};
|
|
7943
|
-
/**
|
|
7944
|
-
* Returns a nullable wrapper if the enum includes null, undefined otherwise.
|
|
7945
|
-
*/
|
|
7946
|
-
nullable: (ctx: EnumResolverContext) => Chain | undefined;
|
|
7947
7973
|
};
|
|
7948
7974
|
schema: SchemaWithType<'enum'>;
|
|
7949
7975
|
/**
|
|
@@ -7977,6 +8003,9 @@ interface NumberResolverContext extends BaseContext {
|
|
|
7977
8003
|
};
|
|
7978
8004
|
}
|
|
7979
8005
|
interface ObjectResolverContext extends BaseContext {
|
|
8006
|
+
applyModifiers: (result: ZodSchemaResult, opts: {
|
|
8007
|
+
optional?: boolean;
|
|
8008
|
+
}) => Ast;
|
|
7980
8009
|
/**
|
|
7981
8010
|
* Nodes used to build different parts of the object schema.
|
|
7982
8011
|
*/
|
|
@@ -7997,6 +8026,8 @@ interface ObjectResolverContext extends BaseContext {
|
|
|
7997
8026
|
ast: Partial<Omit<Ast, 'typeName'>>;
|
|
7998
8027
|
state: Refs<PluginState>;
|
|
7999
8028
|
};
|
|
8029
|
+
walk: Walker<ZodSchemaResult, ZodPlugin['Instance']>;
|
|
8030
|
+
walkerCtx: SchemaVisitorContext<ZodPlugin['Instance']>;
|
|
8000
8031
|
}
|
|
8001
8032
|
interface StringResolverContext extends BaseContext {
|
|
8002
8033
|
/**
|