@hey-api/openapi-ts 0.94.0 → 0.94.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1127 -310
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-PHWYaLgi.mjs → init-BZoKzIer.mjs} +3240 -1801
- package/dist/init-BZoKzIer.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +5 -4
- package/dist/run.mjs.map +1 -1
- package/dist/{src-1D7PrOtb.mjs → src-CSfoqA-f.mjs} +2 -2
- package/dist/{src-1D7PrOtb.mjs.map → src-CSfoqA-f.mjs.map} +1 -1
- package/package.json +5 -5
- package/dist/init-PHWYaLgi.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as UserConfig } from "./types-Ba27ofyy.mjs";
|
|
2
|
-
import { AnalysisContext, BindingKind, ExportModule, File, FromRef, ImportModule, Language, Logger, Node, NodeName as NodeName$1, NodeNameSanitizer, NodeRelationship, NodeScope, Ref,
|
|
3
|
-
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,
|
|
2
|
+
import { AnalysisContext, BindingKind, ExportModule, File, FromRef, ImportModule, Language, Logger, Node, NodeName as NodeName$1, NodeNameSanitizer, NodeRelationship, NodeScope, Ref, RenderContext, Renderer, Symbol } from "@hey-api/codegen-core";
|
|
3
|
+
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, SchemaVisitorContext, SchemaWithType, Walker, defaultPaginationKeywords, definePluginConfig, utils } from "@hey-api/shared";
|
|
4
4
|
import ts from "typescript";
|
|
5
5
|
import { AnyString, LazyOrAsync, MaybeArray, MaybeFunc } from "@hey-api/types";
|
|
6
6
|
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpRequest, HttpResponse } from "@angular/common/http";
|
|
@@ -705,7 +705,7 @@ declare class TypeIdxTsDsl extends Mixed$43 {
|
|
|
705
705
|
//#endregion
|
|
706
706
|
//#region src/ts-dsl/type/operator.d.ts
|
|
707
707
|
type Op = ts.SyntaxKind.KeyOfKeyword | ts.SyntaxKind.ReadonlyKeyword | ts.SyntaxKind.UniqueKeyword;
|
|
708
|
-
type Type$
|
|
708
|
+
type Type$3 = string | MaybeTsDsl<ts.TypeNode>;
|
|
709
709
|
type TypeOperatorCtor = () => TypeOperatorTsDsl;
|
|
710
710
|
declare const Mixed$42: abstract new () => TsDsl<ts.TypeOperatorNode>;
|
|
711
711
|
/**
|
|
@@ -724,23 +724,23 @@ declare class TypeOperatorTsDsl extends Mixed$42 {
|
|
|
724
724
|
readonly '~dsl' = "TypeOperatorTsDsl";
|
|
725
725
|
scope: NodeScope;
|
|
726
726
|
protected _op?: Op;
|
|
727
|
-
protected _type?: Type$
|
|
727
|
+
protected _type?: Type$3;
|
|
728
728
|
analyze(ctx: AnalysisContext): void;
|
|
729
729
|
/** Shorthand: builds `keyof T`. */
|
|
730
|
-
keyof(type: Type$
|
|
730
|
+
keyof(type: Type$3): this;
|
|
731
731
|
/** Sets the operator explicitly. */
|
|
732
732
|
operator(op: Op): this;
|
|
733
733
|
/** Shorthand: builds `readonly T`. */
|
|
734
|
-
readonly(type: Type$
|
|
734
|
+
readonly(type: Type$3): this;
|
|
735
735
|
/** Sets the target type of the operator. */
|
|
736
|
-
type(type: Type$
|
|
736
|
+
type(type: Type$3): this;
|
|
737
737
|
/** Shorthand: builds `unique T`. */
|
|
738
|
-
unique(type: Type$
|
|
738
|
+
unique(type: Type$3): this;
|
|
739
739
|
toAst(): ts.TypeOperatorNode;
|
|
740
740
|
/** Throws if required fields are not set. */
|
|
741
741
|
$validate(): asserts this is this & {
|
|
742
742
|
_op: Op;
|
|
743
|
-
_type: Type$
|
|
743
|
+
_type: Type$3;
|
|
744
744
|
};
|
|
745
745
|
private missingRequiredCalls;
|
|
746
746
|
}
|
|
@@ -1021,16 +1021,64 @@ declare class NoteTsDsl extends TsDsl<ts.Node> {
|
|
|
1021
1021
|
toAst(): any;
|
|
1022
1022
|
}
|
|
1023
1023
|
//#endregion
|
|
1024
|
+
//#region src/ts-dsl/mixins/value.d.ts
|
|
1025
|
+
type ValueExpr = string | MaybeTsDsl<ts.Expression>;
|
|
1026
|
+
interface ValueMethods extends Node {
|
|
1027
|
+
$value(): ts.Expression | undefined;
|
|
1028
|
+
/** Sets the initializer expression (e.g. `= expr`). */
|
|
1029
|
+
assign(expr: ValueExpr): this;
|
|
1030
|
+
}
|
|
1031
|
+
//#endregion
|
|
1032
|
+
//#region src/ts-dsl/mixins/pattern.d.ts
|
|
1033
|
+
interface PatternMethods extends Node {
|
|
1034
|
+
/** Renders the pattern into a `BindingName`. */
|
|
1035
|
+
$pattern(): ts.BindingName | undefined;
|
|
1036
|
+
/** Defines an array binding pattern. */
|
|
1037
|
+
array(...props: ReadonlyArray<string> | [ReadonlyArray<string>]): this;
|
|
1038
|
+
/** Defines an object binding pattern. */
|
|
1039
|
+
object(...props: ReadonlyArray<MaybeArray<string> | Record<string, string>>): this;
|
|
1040
|
+
/** Adds a spread element (e.g. `...args`, `...options`) to the pattern. */
|
|
1041
|
+
spread(name: string): this;
|
|
1042
|
+
}
|
|
1043
|
+
//#endregion
|
|
1044
|
+
//#region src/ts-dsl/mixins/decorator.d.ts
|
|
1045
|
+
interface DecoratorMethods extends Node {
|
|
1046
|
+
/** Renders the decorators into an array of `ts.Decorator`s. */
|
|
1047
|
+
$decorators(): ReadonlyArray<ts.Decorator>;
|
|
1048
|
+
/** Adds a decorator (e.g. `@sealed({ in: 'root' })`). */
|
|
1049
|
+
decorator(name: NodeName$1 | MaybeTsDsl<ts.Expression>, ...args: ReadonlyArray<string | MaybeTsDsl<ts.Expression>>): this;
|
|
1050
|
+
}
|
|
1051
|
+
//#endregion
|
|
1052
|
+
//#region src/ts-dsl/decl/param.d.ts
|
|
1053
|
+
type ParamName = NodeName$1 | ParamFn;
|
|
1054
|
+
type ParamFn = (p: ParamTsDsl) => void;
|
|
1055
|
+
type ParamCtor = (name: ParamName, fn?: ParamFn) => ParamTsDsl;
|
|
1056
|
+
declare const Mixed$37: MixinCtor<MixinCtor<MixinCtor<MixinCtor<abstract new () => TsDsl<ts.ParameterDeclaration>, ValueMethods>, PatternMethods>, OptionalMethods>, DecoratorMethods>;
|
|
1057
|
+
declare class ParamTsDsl extends Mixed$37 {
|
|
1058
|
+
readonly '~dsl' = "ParamTsDsl";
|
|
1059
|
+
protected _type?: TypeTsDsl;
|
|
1060
|
+
constructor(name: ParamName, fn?: ParamFn);
|
|
1061
|
+
analyze(ctx: AnalysisContext): void;
|
|
1062
|
+
/** Returns true when all required builder calls are present. */
|
|
1063
|
+
get isValid(): boolean;
|
|
1064
|
+
/** Sets the parameter type. */
|
|
1065
|
+
type(type: string | TypeTsDsl): this;
|
|
1066
|
+
toAst(): ts.ParameterDeclaration;
|
|
1067
|
+
$validate(): asserts this;
|
|
1068
|
+
private missingRequiredCalls;
|
|
1069
|
+
}
|
|
1070
|
+
//#endregion
|
|
1024
1071
|
//#region src/ts-dsl/type/param.d.ts
|
|
1025
1072
|
type TypeParamExpr = NodeName$1 | boolean | MaybeTsDsl<TypeTsDsl>;
|
|
1026
|
-
declare const Mixed$
|
|
1027
|
-
declare class TypeParamTsDsl extends Mixed$
|
|
1073
|
+
declare const Mixed$36: abstract new () => TsDsl<ts.TypeParameterDeclaration>;
|
|
1074
|
+
declare class TypeParamTsDsl extends Mixed$36 {
|
|
1028
1075
|
readonly '~dsl' = "TypeParamTsDsl";
|
|
1029
1076
|
scope: NodeScope;
|
|
1030
1077
|
protected constraint?: Ref<TypeParamExpr>;
|
|
1031
1078
|
protected defaultValue?: Ref<TypeParamExpr>;
|
|
1032
1079
|
constructor(name?: NodeName$1, fn?: (name: TypeParamTsDsl) => void);
|
|
1033
1080
|
analyze(ctx: AnalysisContext): void;
|
|
1081
|
+
/** Sets the parameter default value. */
|
|
1034
1082
|
default(value: TypeParamExpr): this;
|
|
1035
1083
|
extends(constraint: TypeParamExpr): this;
|
|
1036
1084
|
toAst(): ts.TypeParameterDeclaration;
|
|
@@ -1155,26 +1203,10 @@ interface DocMethods extends Node {
|
|
|
1155
1203
|
doc(lines?: DocLines, fn?: DocFn): this;
|
|
1156
1204
|
}
|
|
1157
1205
|
//#endregion
|
|
1158
|
-
//#region src/ts-dsl/mixins/decorator.d.ts
|
|
1159
|
-
interface DecoratorMethods extends Node {
|
|
1160
|
-
/** Renders the decorators into an array of `ts.Decorator`s. */
|
|
1161
|
-
$decorators(): ReadonlyArray<ts.Decorator>;
|
|
1162
|
-
/** Adds a decorator (e.g. `@sealed({ in: 'root' })`). */
|
|
1163
|
-
decorator(name: NodeName$1 | MaybeTsDsl<ts.Expression>, ...args: ReadonlyArray<string | MaybeTsDsl<ts.Expression>>): this;
|
|
1164
|
-
}
|
|
1165
|
-
//#endregion
|
|
1166
|
-
//#region src/ts-dsl/mixins/value.d.ts
|
|
1167
|
-
type ValueExpr = string | MaybeTsDsl<ts.Expression>;
|
|
1168
|
-
interface ValueMethods extends Node {
|
|
1169
|
-
$value(): ts.Expression | undefined;
|
|
1170
|
-
/** Sets the initializer expression (e.g. `= expr`). */
|
|
1171
|
-
assign(expr: ValueExpr): this;
|
|
1172
|
-
}
|
|
1173
|
-
//#endregion
|
|
1174
1206
|
//#region src/ts-dsl/decl/field.d.ts
|
|
1175
1207
|
type FieldType = NodeName$1 | TypeTsDsl;
|
|
1176
|
-
declare const Mixed$
|
|
1177
|
-
declare class FieldTsDsl extends Mixed$
|
|
1208
|
+
declare const Mixed$35: MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<MixinCtor<abstract new () => TsDsl<ts.PropertyDeclaration>, ValueMethods>, StaticMethods>, ReadonlyMethods>, PublicMethods>, ProtectedMethods>, PrivateMethods>, OptionalMethods>, DocMethods>, DecoratorMethods>;
|
|
1209
|
+
declare class FieldTsDsl extends Mixed$35 {
|
|
1178
1210
|
readonly '~dsl' = "FieldTsDsl";
|
|
1179
1211
|
readonly nameSanitizer: (name: string) => string;
|
|
1180
1212
|
protected _type?: TypeTsDsl;
|
|
@@ -1185,35 +1217,6 @@ declare class FieldTsDsl extends Mixed$36 {
|
|
|
1185
1217
|
toAst(): ts.PropertyDeclaration;
|
|
1186
1218
|
}
|
|
1187
1219
|
//#endregion
|
|
1188
|
-
//#region src/ts-dsl/mixins/pattern.d.ts
|
|
1189
|
-
interface PatternMethods extends Node {
|
|
1190
|
-
/** Renders the pattern into a `BindingName`. */
|
|
1191
|
-
$pattern(): ts.BindingName | undefined;
|
|
1192
|
-
/** Defines an array binding pattern. */
|
|
1193
|
-
array(...props: ReadonlyArray<string> | [ReadonlyArray<string>]): this;
|
|
1194
|
-
/** Defines an object binding pattern. */
|
|
1195
|
-
object(...props: ReadonlyArray<MaybeArray<string> | Record<string, string>>): this;
|
|
1196
|
-
/** Adds a spread element (e.g. `...args`, `...options`) to the pattern. */
|
|
1197
|
-
spread(name: string): this;
|
|
1198
|
-
}
|
|
1199
|
-
//#endregion
|
|
1200
|
-
//#region src/ts-dsl/decl/param.d.ts
|
|
1201
|
-
type ParamCtor = (name: NodeName$1 | ((p: ParamTsDsl) => void), fn?: (p: ParamTsDsl) => void) => ParamTsDsl;
|
|
1202
|
-
declare const Mixed$35: MixinCtor<MixinCtor<MixinCtor<MixinCtor<abstract new () => TsDsl<ts.ParameterDeclaration>, ValueMethods>, PatternMethods>, OptionalMethods>, DecoratorMethods>;
|
|
1203
|
-
declare class ParamTsDsl extends Mixed$35 {
|
|
1204
|
-
readonly '~dsl' = "ParamTsDsl";
|
|
1205
|
-
protected _type?: TypeTsDsl;
|
|
1206
|
-
constructor(name: NodeName$1 | ((p: ParamTsDsl) => void), fn?: (p: ParamTsDsl) => void);
|
|
1207
|
-
analyze(ctx: AnalysisContext): void;
|
|
1208
|
-
/** Returns true when all required builder calls are present. */
|
|
1209
|
-
get isValid(): boolean;
|
|
1210
|
-
/** Sets the parameter type. */
|
|
1211
|
-
type(type: string | TypeTsDsl): this;
|
|
1212
|
-
toAst(): ts.ParameterDeclaration;
|
|
1213
|
-
$validate(): asserts this;
|
|
1214
|
-
private missingRequiredCalls;
|
|
1215
|
-
}
|
|
1216
|
-
//#endregion
|
|
1217
1220
|
//#region src/ts-dsl/mixins/param.d.ts
|
|
1218
1221
|
interface ParamMethods extends Node {
|
|
1219
1222
|
/** Renders the parameters into an array of `ParameterDeclaration`s. */
|
|
@@ -1749,15 +1752,15 @@ declare class TypeAliasTsDsl extends Mixed$10 {
|
|
|
1749
1752
|
}
|
|
1750
1753
|
//#endregion
|
|
1751
1754
|
//#region src/ts-dsl/type/and.d.ts
|
|
1752
|
-
type Type$
|
|
1755
|
+
type Type$2 = NodeName$1 | ts.TypeNode | TypeTsDsl;
|
|
1753
1756
|
declare const Mixed$9: abstract new () => TsDsl<ts.IntersectionTypeNode>;
|
|
1754
1757
|
declare class TypeAndTsDsl extends Mixed$9 {
|
|
1755
1758
|
readonly '~dsl' = "TypeAndTsDsl";
|
|
1756
1759
|
scope: NodeScope;
|
|
1757
|
-
protected _types: Array<Ref<Type$
|
|
1758
|
-
constructor(...nodes: Array<Type$
|
|
1760
|
+
protected _types: Array<Ref<Type$2>>;
|
|
1761
|
+
constructor(...nodes: Array<Type$2>);
|
|
1759
1762
|
analyze(ctx: AnalysisContext): void;
|
|
1760
|
-
types(...nodes: Array<Type$
|
|
1763
|
+
types(...nodes: Array<Type$2>): this;
|
|
1761
1764
|
toAst(): ts.IntersectionTypeNode;
|
|
1762
1765
|
}
|
|
1763
1766
|
//#endregion
|
|
@@ -1779,8 +1782,8 @@ declare const Mixed$7: abstract new () => TsDsl<ts.LiteralTypeNode>;
|
|
|
1779
1782
|
declare class TypeLiteralTsDsl extends Mixed$7 {
|
|
1780
1783
|
readonly '~dsl' = "TypeLiteralTsDsl";
|
|
1781
1784
|
scope: NodeScope;
|
|
1782
|
-
protected value:
|
|
1783
|
-
constructor(value:
|
|
1785
|
+
protected value: LiteralValue;
|
|
1786
|
+
constructor(value: LiteralValue);
|
|
1784
1787
|
analyze(ctx: AnalysisContext): void;
|
|
1785
1788
|
toAst(): ts.LiteralTypeNode;
|
|
1786
1789
|
}
|
|
@@ -1893,15 +1896,15 @@ declare class TypeObjectTsDsl extends Mixed$3 {
|
|
|
1893
1896
|
}
|
|
1894
1897
|
//#endregion
|
|
1895
1898
|
//#region src/ts-dsl/type/or.d.ts
|
|
1896
|
-
type Type = NodeName$1 | ts.TypeNode | TypeTsDsl;
|
|
1899
|
+
type Type$1 = NodeName$1 | ts.TypeNode | TypeTsDsl;
|
|
1897
1900
|
declare const Mixed$2: abstract new () => TsDsl<ts.UnionTypeNode>;
|
|
1898
1901
|
declare class TypeOrTsDsl extends Mixed$2 {
|
|
1899
1902
|
readonly '~dsl' = "TypeOrTsDsl";
|
|
1900
1903
|
scope: NodeScope;
|
|
1901
|
-
protected _types: Array<Ref<Type>>;
|
|
1902
|
-
constructor(...nodes: Array<Type>);
|
|
1904
|
+
protected _types: Array<Ref<Type$1>>;
|
|
1905
|
+
constructor(...nodes: Array<Type$1>);
|
|
1903
1906
|
analyze(ctx: AnalysisContext): void;
|
|
1904
|
-
types(...nodes: Array<Type>): this;
|
|
1907
|
+
types(...nodes: Array<Type$1>): this;
|
|
1905
1908
|
toAst(): ts.UnionTypeNode;
|
|
1906
1909
|
}
|
|
1907
1910
|
//#endregion
|
|
@@ -2134,7 +2137,7 @@ declare const $: ((id: any) => ExprTsDsl) & {
|
|
|
2134
2137
|
/** Creates an object literal expression. */
|
|
2135
2138
|
object: (...args: ConstructorParameters<typeof ObjectTsDsl>) => ObjectTsDsl;
|
|
2136
2139
|
/** Creates a parameter declaration for functions or methods. */
|
|
2137
|
-
param: (name: any, fn?:
|
|
2140
|
+
param: (name: any, fn?: ParamFn | undefined) => ParamTsDsl;
|
|
2138
2141
|
/** Creates a pattern for destructuring or matching. */
|
|
2139
2142
|
pattern: () => PatternTsDsl;
|
|
2140
2143
|
/** Creates a prefix unary expression (e.g. `-x`, `!x`, `~x`). */
|
|
@@ -2191,7 +2194,7 @@ declare const $: ((id: any) => ExprTsDsl) & {
|
|
|
2191
2194
|
/** Creates an indexed-access type (e.g. `Foo<T>[K]`). */
|
|
2192
2195
|
idx: (base: string | ts.TypeNode | TsDsl<ts.TypeNode>, index: string | number | ts.TypeNode | TsDsl<ts.TypeNode>) => TypeIdxTsDsl;
|
|
2193
2196
|
/** Creates a literal type node (e.g. 'foo', 42, or true). */
|
|
2194
|
-
literal: (value:
|
|
2197
|
+
literal: (value: LiteralValue) => TypeLiteralTsDsl;
|
|
2195
2198
|
/** Creates a mapped type (e.g. `{ [K in keyof T]: U }`). */
|
|
2196
2199
|
mapped: (name?: any) => TypeMappedTsDsl;
|
|
2197
2200
|
/** Creates a type literal node (e.g. { foo: string }). */
|
|
@@ -3918,181 +3921,540 @@ type Config$12 = Plugin$1.Name<'@hey-api/transformers'> & Plugin$1.Hooks & Plugi
|
|
|
3918
3921
|
type HeyApiTransformersPlugin = DefinePlugin$1<UserConfig$14, Config$12>;
|
|
3919
3922
|
//#endregion
|
|
3920
3923
|
//#region src/plugins/@hey-api/typescript/shared/types.d.ts
|
|
3921
|
-
type
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
/**
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
}
|
|
3938
|
-
|
|
3939
|
-
|
|
3924
|
+
type Type = MaybeTsDsl<TypeTsDsl>;
|
|
3925
|
+
/**
|
|
3926
|
+
* Metadata that flows through schema walking.
|
|
3927
|
+
*/
|
|
3928
|
+
interface TypeScriptMeta {
|
|
3929
|
+
/** Default value from schema. */
|
|
3930
|
+
default?: unknown;
|
|
3931
|
+
/** Is this schema read-only? */
|
|
3932
|
+
readonly: boolean;
|
|
3933
|
+
}
|
|
3934
|
+
interface TypeScriptEnumData {
|
|
3935
|
+
items: Array<{
|
|
3936
|
+
key: string;
|
|
3937
|
+
schema: IR$1.SchemaObject;
|
|
3938
|
+
}>;
|
|
3939
|
+
mode: 'javascript' | 'typescript' | 'typescript-const' | 'type';
|
|
3940
|
+
}
|
|
3941
|
+
/**
|
|
3942
|
+
* Result from walking a schema node.
|
|
3943
|
+
*/
|
|
3944
|
+
interface TypeScriptResult {
|
|
3945
|
+
enumData?: TypeScriptEnumData;
|
|
3946
|
+
meta: TypeScriptMeta;
|
|
3947
|
+
type: Type;
|
|
3948
|
+
}
|
|
3940
3949
|
//#endregion
|
|
3941
3950
|
//#region src/plugins/@hey-api/typescript/api.d.ts
|
|
3942
3951
|
type IApi$3 = {
|
|
3943
|
-
schemaToType: (
|
|
3952
|
+
schemaToType: (plugin: HeyApiTypeScriptPlugin['Instance'], schema: IR$1.SchemaObject) => Type;
|
|
3944
3953
|
};
|
|
3945
3954
|
//#endregion
|
|
3946
|
-
//#region src/plugins/@hey-api/typescript/
|
|
3947
|
-
type
|
|
3948
|
-
type UserConfig$13 = Plugin$1.Name<'@hey-api/typescript'> & Plugin$1.Hooks & Plugin$1.UserComments & Plugin$1.UserExports & {
|
|
3955
|
+
//#region src/plugins/@hey-api/typescript/resolvers.d.ts
|
|
3956
|
+
type Resolvers$2 = Plugin$1.Resolvers<{
|
|
3949
3957
|
/**
|
|
3950
|
-
*
|
|
3958
|
+
* Resolver for array schemas.
|
|
3951
3959
|
*
|
|
3952
|
-
*
|
|
3960
|
+
* Allows customization of how array types are rendered.
|
|
3961
|
+
*
|
|
3962
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
3953
3963
|
*/
|
|
3954
|
-
|
|
3964
|
+
array?: (ctx: ArrayResolverContext$2) => Type | undefined;
|
|
3955
3965
|
/**
|
|
3956
|
-
*
|
|
3957
|
-
*
|
|
3958
|
-
* Controls generation of shared types that can be referenced across
|
|
3959
|
-
* requests and responses.
|
|
3966
|
+
* Resolver for boolean schemas.
|
|
3960
3967
|
*
|
|
3961
|
-
*
|
|
3962
|
-
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
3963
|
-
* - `object`: Full configuration object
|
|
3968
|
+
* Allows customization of how boolean types are rendered.
|
|
3964
3969
|
*
|
|
3965
|
-
*
|
|
3970
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
3966
3971
|
*/
|
|
3967
|
-
|
|
3968
|
-
/**
|
|
3969
|
-
* Casing convention for generated names.
|
|
3970
|
-
*
|
|
3971
|
-
* @default 'PascalCase'
|
|
3972
|
-
*/
|
|
3973
|
-
case?: Casing;
|
|
3974
|
-
/**
|
|
3975
|
-
* Naming pattern for generated names.
|
|
3976
|
-
*
|
|
3977
|
-
* @default '{{name}}'
|
|
3978
|
-
*/
|
|
3979
|
-
name?: NameTransformer;
|
|
3980
|
-
};
|
|
3972
|
+
boolean?: (ctx: BooleanResolverContext$2) => Type | undefined;
|
|
3981
3973
|
/**
|
|
3982
|
-
*
|
|
3974
|
+
* Resolver for enum schemas.
|
|
3983
3975
|
*
|
|
3984
|
-
*
|
|
3985
|
-
* TypeScript enums for runtime usage, interoperability, or integration with
|
|
3986
|
-
* other tools.
|
|
3976
|
+
* Allows customization of how enum types are rendered.
|
|
3987
3977
|
*
|
|
3988
|
-
*
|
|
3978
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
3989
3979
|
*/
|
|
3990
|
-
|
|
3991
|
-
/**
|
|
3992
|
-
* Casing convention for generated names.
|
|
3993
|
-
*
|
|
3994
|
-
* @default 'SCREAMING_SNAKE_CASE'
|
|
3995
|
-
*/
|
|
3996
|
-
case?: Casing;
|
|
3997
|
-
/**
|
|
3998
|
-
* When generating enums as JavaScript objects, they'll contain a null
|
|
3999
|
-
* value if they're nullable. This might be undesirable if you want to do
|
|
4000
|
-
* `Object.values(Foo)` and have all values be of the same type.
|
|
4001
|
-
*
|
|
4002
|
-
* This setting is disabled by default to preserve the source schemas.
|
|
4003
|
-
*
|
|
4004
|
-
* @default false
|
|
4005
|
-
*/
|
|
4006
|
-
constantsIgnoreNull?: boolean;
|
|
4007
|
-
/**
|
|
4008
|
-
* Whether this feature is enabled.
|
|
4009
|
-
*
|
|
4010
|
-
* @default true
|
|
4011
|
-
*/
|
|
4012
|
-
enabled?: boolean;
|
|
4013
|
-
/**
|
|
4014
|
-
* Specifies the output mode for generated enums.
|
|
4015
|
-
*
|
|
4016
|
-
* Can be:
|
|
4017
|
-
* - `javascript`: Generates JavaScript objects
|
|
4018
|
-
* - `typescript`: Generates TypeScript enums
|
|
4019
|
-
* - `typescript-const`: Generates TypeScript const enums
|
|
4020
|
-
*
|
|
4021
|
-
* @default 'javascript'
|
|
4022
|
-
*/
|
|
4023
|
-
mode?: EnumsType;
|
|
4024
|
-
};
|
|
3980
|
+
enum?: (ctx: EnumResolverContext$2) => Type | undefined;
|
|
4025
3981
|
/**
|
|
4026
|
-
*
|
|
4027
|
-
*
|
|
4028
|
-
* Controls generation of types for error response bodies and status codes.
|
|
3982
|
+
* Resolver for intersection schemas.
|
|
4029
3983
|
*
|
|
4030
|
-
*
|
|
4031
|
-
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
4032
|
-
* - `object`: Full configuration object
|
|
3984
|
+
* Allows customization of how intersection types are rendered.
|
|
4033
3985
|
*
|
|
4034
|
-
*
|
|
3986
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4035
3987
|
*/
|
|
4036
|
-
|
|
4037
|
-
/**
|
|
4038
|
-
* Casing convention for generated names.
|
|
4039
|
-
*
|
|
4040
|
-
* @default 'PascalCase'
|
|
4041
|
-
*/
|
|
4042
|
-
case?: Casing;
|
|
4043
|
-
/**
|
|
4044
|
-
* Naming pattern for generated names.
|
|
4045
|
-
*
|
|
4046
|
-
* @default '{{name}}Error'
|
|
4047
|
-
*/
|
|
4048
|
-
error?: NameTransformer;
|
|
4049
|
-
/**
|
|
4050
|
-
* Naming pattern for generated names.
|
|
4051
|
-
*
|
|
4052
|
-
* @default '{{name}}Errors'
|
|
4053
|
-
*/
|
|
4054
|
-
name?: NameTransformer;
|
|
4055
|
-
};
|
|
3988
|
+
intersection?: (ctx: IntersectionResolverContext$2) => Type | undefined;
|
|
4056
3989
|
/**
|
|
4057
|
-
*
|
|
3990
|
+
* Resolver for never schemas.
|
|
4058
3991
|
*
|
|
4059
|
-
*
|
|
4060
|
-
* parameters, and headers.
|
|
3992
|
+
* Allows customization of how never types are rendered.
|
|
4061
3993
|
*
|
|
4062
|
-
*
|
|
4063
|
-
|
|
4064
|
-
|
|
3994
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
3995
|
+
*/
|
|
3996
|
+
never?: (ctx: NeverResolverContext$2) => Type | undefined;
|
|
3997
|
+
/**
|
|
3998
|
+
* Resolver for null schemas.
|
|
4065
3999
|
*
|
|
4066
|
-
*
|
|
4000
|
+
* Allows customization of how null types are rendered.
|
|
4001
|
+
*
|
|
4002
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4067
4003
|
*/
|
|
4068
|
-
|
|
4069
|
-
/**
|
|
4070
|
-
* Casing convention for generated names.
|
|
4071
|
-
*
|
|
4072
|
-
* @default 'PascalCase'
|
|
4073
|
-
*/
|
|
4074
|
-
case?: Casing;
|
|
4075
|
-
/**
|
|
4076
|
-
* Naming pattern for generated names.
|
|
4077
|
-
*
|
|
4078
|
-
* @default '{{name}}Data'
|
|
4079
|
-
*/
|
|
4080
|
-
name?: NameTransformer;
|
|
4081
|
-
};
|
|
4004
|
+
null?: (ctx: NullResolverContext$2) => Type | undefined;
|
|
4082
4005
|
/**
|
|
4083
|
-
*
|
|
4006
|
+
* Resolver for number schemas.
|
|
4084
4007
|
*
|
|
4085
|
-
*
|
|
4008
|
+
* Allows customization of how number types are rendered.
|
|
4086
4009
|
*
|
|
4087
|
-
*
|
|
4088
|
-
|
|
4089
|
-
|
|
4010
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4011
|
+
*/
|
|
4012
|
+
number?: (ctx: NumberResolverContext$2) => Type | undefined;
|
|
4013
|
+
/**
|
|
4014
|
+
* Resolver for object schemas.
|
|
4090
4015
|
*
|
|
4091
|
-
*
|
|
4016
|
+
* Allows customization of how object types are rendered.
|
|
4017
|
+
*
|
|
4018
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4092
4019
|
*/
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4020
|
+
object?: (ctx: ObjectResolverContext$2) => Type | undefined;
|
|
4021
|
+
/**
|
|
4022
|
+
* Resolver for string schemas.
|
|
4023
|
+
*
|
|
4024
|
+
* Allows customization of how string types are rendered.
|
|
4025
|
+
*
|
|
4026
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4027
|
+
*/
|
|
4028
|
+
string?: (ctx: StringResolverContext$2) => Type | undefined;
|
|
4029
|
+
/**
|
|
4030
|
+
* Resolver for tuple schemas.
|
|
4031
|
+
*
|
|
4032
|
+
* Allows customization of how tuple types are rendered.
|
|
4033
|
+
*
|
|
4034
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4035
|
+
*/
|
|
4036
|
+
tuple?: (ctx: TupleResolverContext$2) => Type | undefined;
|
|
4037
|
+
/**
|
|
4038
|
+
* Resolver for undefined schemas.
|
|
4039
|
+
*
|
|
4040
|
+
* Allows customization of how undefined types are rendered.
|
|
4041
|
+
*
|
|
4042
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4043
|
+
*/
|
|
4044
|
+
undefined?: (ctx: UndefinedResolverContext$2) => Type | undefined;
|
|
4045
|
+
/**
|
|
4046
|
+
* Resolver for union schemas.
|
|
4047
|
+
*
|
|
4048
|
+
* Allows customization of how union types are rendered.
|
|
4049
|
+
*
|
|
4050
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4051
|
+
*/
|
|
4052
|
+
union?: (ctx: UnionResolverContext$2) => Type | undefined;
|
|
4053
|
+
/**
|
|
4054
|
+
* Resolver for unknown schemas.
|
|
4055
|
+
*
|
|
4056
|
+
* Allows customization of how unknown types are rendered.
|
|
4057
|
+
*
|
|
4058
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4059
|
+
*/
|
|
4060
|
+
unknown?: (ctx: UnknownResolverContext$2) => Type | undefined;
|
|
4061
|
+
/**
|
|
4062
|
+
* Resolver for void schemas.
|
|
4063
|
+
*
|
|
4064
|
+
* Allows customization of how void types are rendered.
|
|
4065
|
+
*
|
|
4066
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
4067
|
+
*/
|
|
4068
|
+
void?: (ctx: VoidResolverContext$2) => Type | undefined;
|
|
4069
|
+
}>;
|
|
4070
|
+
interface BaseContext$2 extends DollarTsDsl {
|
|
4071
|
+
/** The plugin instance. */
|
|
4072
|
+
plugin: HeyApiTypeScriptPlugin['Instance'];
|
|
4073
|
+
}
|
|
4074
|
+
interface ArrayResolverContext$2 extends BaseContext$2 {
|
|
4075
|
+
/**
|
|
4076
|
+
* Nodes used to build different parts of the result.
|
|
4077
|
+
*/
|
|
4078
|
+
nodes: {
|
|
4079
|
+
/**
|
|
4080
|
+
* Returns the base array type expression.
|
|
4081
|
+
*/
|
|
4082
|
+
base: (ctx: ArrayResolverContext$2) => Type;
|
|
4083
|
+
};
|
|
4084
|
+
schema: SchemaWithType<'array'>;
|
|
4085
|
+
walk: Walker<TypeScriptResult, HeyApiTypeScriptPlugin['Instance']>;
|
|
4086
|
+
walkerCtx: SchemaVisitorContext<HeyApiTypeScriptPlugin['Instance']>;
|
|
4087
|
+
}
|
|
4088
|
+
interface BooleanResolverContext$2 extends BaseContext$2 {
|
|
4089
|
+
/**
|
|
4090
|
+
* Nodes used to build different parts of the result.
|
|
4091
|
+
*/
|
|
4092
|
+
nodes: {
|
|
4093
|
+
/**
|
|
4094
|
+
* Returns the base boolean type expression.
|
|
4095
|
+
*/
|
|
4096
|
+
base: (ctx: BooleanResolverContext$2) => Type;
|
|
4097
|
+
/**
|
|
4098
|
+
* Returns the literal type for const values.
|
|
4099
|
+
*/
|
|
4100
|
+
const: (ctx: BooleanResolverContext$2) => Type | undefined;
|
|
4101
|
+
};
|
|
4102
|
+
schema: SchemaWithType<'boolean'>;
|
|
4103
|
+
}
|
|
4104
|
+
interface EnumResolverContext$2 extends BaseContext$2 {
|
|
4105
|
+
/**
|
|
4106
|
+
* Nodes used to build different parts of the result.
|
|
4107
|
+
*/
|
|
4108
|
+
nodes: {
|
|
4109
|
+
/**
|
|
4110
|
+
* Returns the base enum type expression.
|
|
4111
|
+
*/
|
|
4112
|
+
base: (ctx: EnumResolverContext$2) => Type;
|
|
4113
|
+
/**
|
|
4114
|
+
* Returns parsed enum items with metadata about the enum members.
|
|
4115
|
+
*/
|
|
4116
|
+
items: (ctx: EnumResolverContext$2) => {
|
|
4117
|
+
/**
|
|
4118
|
+
* String literal values for use with union types.
|
|
4119
|
+
*/
|
|
4120
|
+
enumMembers: Array<ReturnType<typeof $.type.literal>>;
|
|
4121
|
+
/**
|
|
4122
|
+
* Whether the enum includes a null value.
|
|
4123
|
+
*/
|
|
4124
|
+
isNullable: boolean;
|
|
4125
|
+
};
|
|
4126
|
+
};
|
|
4127
|
+
schema: SchemaWithType<'enum'>;
|
|
4128
|
+
}
|
|
4129
|
+
interface IntersectionResolverContext$2 extends BaseContext$2 {
|
|
4130
|
+
/**
|
|
4131
|
+
* The child results from walking intersection members.
|
|
4132
|
+
*/
|
|
4133
|
+
childResults: ReadonlyArray<TypeScriptResult>;
|
|
4134
|
+
/**
|
|
4135
|
+
* Nodes used to build different parts of the result.
|
|
4136
|
+
*/
|
|
4137
|
+
nodes: {
|
|
4138
|
+
/**
|
|
4139
|
+
* Returns the base intersection type expression.
|
|
4140
|
+
*/
|
|
4141
|
+
base: (ctx: IntersectionResolverContext$2) => Type;
|
|
4142
|
+
};
|
|
4143
|
+
/**
|
|
4144
|
+
* The parent schema containing the intersection.
|
|
4145
|
+
*/
|
|
4146
|
+
parentSchema: IR$1.SchemaObject;
|
|
4147
|
+
/**
|
|
4148
|
+
* The individual schemas being intersected.
|
|
4149
|
+
*/
|
|
4150
|
+
schemas: ReadonlyArray<IR$1.SchemaObject>;
|
|
4151
|
+
}
|
|
4152
|
+
interface NeverResolverContext$2 extends BaseContext$2 {
|
|
4153
|
+
/**
|
|
4154
|
+
* Nodes used to build different parts of the result.
|
|
4155
|
+
*/
|
|
4156
|
+
nodes: {
|
|
4157
|
+
/**
|
|
4158
|
+
* Returns the base never type expression.
|
|
4159
|
+
*/
|
|
4160
|
+
base: (ctx: NeverResolverContext$2) => Type;
|
|
4161
|
+
};
|
|
4162
|
+
schema: SchemaWithType<'never'>;
|
|
4163
|
+
}
|
|
4164
|
+
interface NullResolverContext$2 extends BaseContext$2 {
|
|
4165
|
+
/**
|
|
4166
|
+
* Nodes used to build different parts of the result.
|
|
4167
|
+
*/
|
|
4168
|
+
nodes: {
|
|
4169
|
+
/**
|
|
4170
|
+
* Returns the base null type expression.
|
|
4171
|
+
*/
|
|
4172
|
+
base: (ctx: NullResolverContext$2) => Type;
|
|
4173
|
+
};
|
|
4174
|
+
schema: SchemaWithType<'null'>;
|
|
4175
|
+
}
|
|
4176
|
+
interface NumberResolverContext$2 extends BaseContext$2 {
|
|
4177
|
+
/**
|
|
4178
|
+
* Nodes used to build different parts of the result.
|
|
4179
|
+
*/
|
|
4180
|
+
nodes: {
|
|
4181
|
+
/**
|
|
4182
|
+
* Returns the base number type expression.
|
|
4183
|
+
*/
|
|
4184
|
+
base: (ctx: NumberResolverContext$2) => Type;
|
|
4185
|
+
/**
|
|
4186
|
+
* Returns the literal type for const values.
|
|
4187
|
+
*/
|
|
4188
|
+
const: (ctx: NumberResolverContext$2) => Type | undefined;
|
|
4189
|
+
};
|
|
4190
|
+
schema: SchemaWithType<'integer' | 'number'>;
|
|
4191
|
+
}
|
|
4192
|
+
interface ObjectResolverContext$2 extends BaseContext$2 {
|
|
4193
|
+
/**
|
|
4194
|
+
* Nodes used to build different parts of the result.
|
|
4195
|
+
*/
|
|
4196
|
+
nodes: {
|
|
4197
|
+
/**
|
|
4198
|
+
* Returns the base object type expression.
|
|
4199
|
+
*/
|
|
4200
|
+
base: (ctx: ObjectResolverContext$2) => Type;
|
|
4201
|
+
/**
|
|
4202
|
+
* Returns the shape (properties) of the object type.
|
|
4203
|
+
*/
|
|
4204
|
+
shape: (ctx: ObjectResolverContext$2) => ReturnType<typeof $.type.object>;
|
|
4205
|
+
};
|
|
4206
|
+
schema: SchemaWithType<'object'>;
|
|
4207
|
+
walk: Walker<TypeScriptResult, HeyApiTypeScriptPlugin['Instance']>;
|
|
4208
|
+
walkerCtx: SchemaVisitorContext<HeyApiTypeScriptPlugin['Instance']>;
|
|
4209
|
+
}
|
|
4210
|
+
interface StringResolverContext$2 extends BaseContext$2 {
|
|
4211
|
+
/**
|
|
4212
|
+
* Nodes used to build different parts of the result.
|
|
4213
|
+
*/
|
|
4214
|
+
nodes: {
|
|
4215
|
+
/**
|
|
4216
|
+
* Returns the base string type expression.
|
|
4217
|
+
*/
|
|
4218
|
+
base: (ctx: StringResolverContext$2) => Type;
|
|
4219
|
+
/**
|
|
4220
|
+
* Returns the literal type for const values.
|
|
4221
|
+
*/
|
|
4222
|
+
const: (ctx: StringResolverContext$2) => Type | undefined;
|
|
4223
|
+
/**
|
|
4224
|
+
* Returns the format-specific type expression.
|
|
4225
|
+
*/
|
|
4226
|
+
format: (ctx: StringResolverContext$2) => Type | undefined;
|
|
4227
|
+
};
|
|
4228
|
+
schema: SchemaWithType<'string'>;
|
|
4229
|
+
}
|
|
4230
|
+
interface TupleResolverContext$2 extends BaseContext$2 {
|
|
4231
|
+
/**
|
|
4232
|
+
* Nodes used to build different parts of the result.
|
|
4233
|
+
*/
|
|
4234
|
+
nodes: {
|
|
4235
|
+
/**
|
|
4236
|
+
* Returns the base tuple type expression.
|
|
4237
|
+
*/
|
|
4238
|
+
base: (ctx: TupleResolverContext$2) => Type;
|
|
4239
|
+
/**
|
|
4240
|
+
* Returns the literal type for const tuple values.
|
|
4241
|
+
*/
|
|
4242
|
+
const: (ctx: TupleResolverContext$2) => Type | undefined;
|
|
4243
|
+
};
|
|
4244
|
+
schema: SchemaWithType<'tuple'>;
|
|
4245
|
+
walk: Walker<TypeScriptResult, HeyApiTypeScriptPlugin['Instance']>;
|
|
4246
|
+
walkerCtx: SchemaVisitorContext<HeyApiTypeScriptPlugin['Instance']>;
|
|
4247
|
+
}
|
|
4248
|
+
interface UnionResolverContext$2 extends BaseContext$2 {
|
|
4249
|
+
/**
|
|
4250
|
+
* The child results from walking union members.
|
|
4251
|
+
*/
|
|
4252
|
+
childResults: ReadonlyArray<TypeScriptResult>;
|
|
4253
|
+
/**
|
|
4254
|
+
* Nodes used to build different parts of the result.
|
|
4255
|
+
*/
|
|
4256
|
+
nodes: {
|
|
4257
|
+
/**
|
|
4258
|
+
* Returns the base union type expression.
|
|
4259
|
+
*/
|
|
4260
|
+
base: (ctx: UnionResolverContext$2) => Type;
|
|
4261
|
+
};
|
|
4262
|
+
/**
|
|
4263
|
+
* The parent schema containing the union.
|
|
4264
|
+
*/
|
|
4265
|
+
parentSchema: IR$1.SchemaObject;
|
|
4266
|
+
/**
|
|
4267
|
+
* The individual schemas being unioned.
|
|
4268
|
+
*/
|
|
4269
|
+
schemas: ReadonlyArray<IR$1.SchemaObject>;
|
|
4270
|
+
}
|
|
4271
|
+
interface UndefinedResolverContext$2 extends BaseContext$2 {
|
|
4272
|
+
/**
|
|
4273
|
+
* Nodes used to build different parts of the result.
|
|
4274
|
+
*/
|
|
4275
|
+
nodes: {
|
|
4276
|
+
/**
|
|
4277
|
+
* Returns the base undefined type expression.
|
|
4278
|
+
*/
|
|
4279
|
+
base: (ctx: UndefinedResolverContext$2) => Type;
|
|
4280
|
+
};
|
|
4281
|
+
schema: SchemaWithType<'undefined'>;
|
|
4282
|
+
}
|
|
4283
|
+
interface UnknownResolverContext$2 extends BaseContext$2 {
|
|
4284
|
+
/**
|
|
4285
|
+
* Nodes used to build different parts of the result.
|
|
4286
|
+
*/
|
|
4287
|
+
nodes: {
|
|
4288
|
+
/**
|
|
4289
|
+
* Returns the base unknown type expression.
|
|
4290
|
+
*/
|
|
4291
|
+
base: (ctx: UnknownResolverContext$2) => Type;
|
|
4292
|
+
};
|
|
4293
|
+
schema: SchemaWithType<'unknown'>;
|
|
4294
|
+
}
|
|
4295
|
+
interface VoidResolverContext$2 extends BaseContext$2 {
|
|
4296
|
+
/**
|
|
4297
|
+
* Nodes used to build different parts of the result.
|
|
4298
|
+
*/
|
|
4299
|
+
nodes: {
|
|
4300
|
+
/**
|
|
4301
|
+
* Returns the base void type expression.
|
|
4302
|
+
*/
|
|
4303
|
+
base: (ctx: VoidResolverContext$2) => Type;
|
|
4304
|
+
};
|
|
4305
|
+
schema: SchemaWithType<'void'>;
|
|
4306
|
+
}
|
|
4307
|
+
//#endregion
|
|
4308
|
+
//#region src/plugins/@hey-api/typescript/types.d.ts
|
|
4309
|
+
type EnumsType = 'javascript' | 'typescript' | 'typescript-const';
|
|
4310
|
+
type UserConfig$13 = Plugin$1.Name<'@hey-api/typescript'> & Plugin$1.Hooks & Plugin$1.UserComments & Plugin$1.UserExports & Resolvers$2 & {
|
|
4311
|
+
/**
|
|
4312
|
+
* Casing convention for generated names.
|
|
4313
|
+
*
|
|
4314
|
+
* @default 'PascalCase'
|
|
4315
|
+
*/
|
|
4316
|
+
case?: Exclude<Casing, 'SCREAMING_SNAKE_CASE'>;
|
|
4317
|
+
/**
|
|
4318
|
+
* Configuration for reusable schema definitions.
|
|
4319
|
+
*
|
|
4320
|
+
* Controls generation of shared types that can be referenced across
|
|
4321
|
+
* requests and responses.
|
|
4322
|
+
*
|
|
4323
|
+
* Can be:
|
|
4324
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
4325
|
+
* - `object`: Full configuration object
|
|
4326
|
+
*
|
|
4327
|
+
* @default '{{name}}'
|
|
4328
|
+
*/
|
|
4329
|
+
definitions?: NameTransformer | {
|
|
4330
|
+
/**
|
|
4331
|
+
* Casing convention for generated names.
|
|
4332
|
+
*
|
|
4333
|
+
* @default 'PascalCase'
|
|
4334
|
+
*/
|
|
4335
|
+
case?: Casing;
|
|
4336
|
+
/**
|
|
4337
|
+
* Naming pattern for generated names.
|
|
4338
|
+
*
|
|
4339
|
+
* @default '{{name}}'
|
|
4340
|
+
*/
|
|
4341
|
+
name?: NameTransformer;
|
|
4342
|
+
};
|
|
4343
|
+
/**
|
|
4344
|
+
* By default, enums are emitted as types to preserve runtime-free output.
|
|
4345
|
+
*
|
|
4346
|
+
* However, you may want to generate enums as JavaScript objects or
|
|
4347
|
+
* TypeScript enums for runtime usage, interoperability, or integration with
|
|
4348
|
+
* other tools.
|
|
4349
|
+
*
|
|
4350
|
+
* @default false
|
|
4351
|
+
*/
|
|
4352
|
+
enums?: boolean | EnumsType | {
|
|
4353
|
+
/**
|
|
4354
|
+
* Casing convention for generated names.
|
|
4355
|
+
*
|
|
4356
|
+
* @default 'SCREAMING_SNAKE_CASE'
|
|
4357
|
+
*/
|
|
4358
|
+
case?: Casing;
|
|
4359
|
+
/**
|
|
4360
|
+
* When generating enums as JavaScript objects, they'll contain a null
|
|
4361
|
+
* value if they're nullable. This might be undesirable if you want to do
|
|
4362
|
+
* `Object.values(Foo)` and have all values be of the same type.
|
|
4363
|
+
*
|
|
4364
|
+
* This setting is disabled by default to preserve the source schemas.
|
|
4365
|
+
*
|
|
4366
|
+
* @default false
|
|
4367
|
+
*/
|
|
4368
|
+
constantsIgnoreNull?: boolean;
|
|
4369
|
+
/**
|
|
4370
|
+
* Whether this feature is enabled.
|
|
4371
|
+
*
|
|
4372
|
+
* @default true
|
|
4373
|
+
*/
|
|
4374
|
+
enabled?: boolean;
|
|
4375
|
+
/**
|
|
4376
|
+
* Specifies the output mode for generated enums.
|
|
4377
|
+
*
|
|
4378
|
+
* Can be:
|
|
4379
|
+
* - `javascript`: Generates JavaScript objects
|
|
4380
|
+
* - `typescript`: Generates TypeScript enums
|
|
4381
|
+
* - `typescript-const`: Generates TypeScript const enums
|
|
4382
|
+
*
|
|
4383
|
+
* @default 'javascript'
|
|
4384
|
+
*/
|
|
4385
|
+
mode?: EnumsType;
|
|
4386
|
+
};
|
|
4387
|
+
/**
|
|
4388
|
+
* Configuration for error-specific types.
|
|
4389
|
+
*
|
|
4390
|
+
* Controls generation of types for error response bodies and status codes.
|
|
4391
|
+
*
|
|
4392
|
+
* Can be:
|
|
4393
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
4394
|
+
* - `object`: Full configuration object
|
|
4395
|
+
*
|
|
4396
|
+
* @default '{{name}}Errors'
|
|
4397
|
+
*/
|
|
4398
|
+
errors?: NameTransformer | {
|
|
4399
|
+
/**
|
|
4400
|
+
* Casing convention for generated names.
|
|
4401
|
+
*
|
|
4402
|
+
* @default 'PascalCase'
|
|
4403
|
+
*/
|
|
4404
|
+
case?: Casing;
|
|
4405
|
+
/**
|
|
4406
|
+
* Naming pattern for generated names.
|
|
4407
|
+
*
|
|
4408
|
+
* @default '{{name}}Error'
|
|
4409
|
+
*/
|
|
4410
|
+
error?: NameTransformer;
|
|
4411
|
+
/**
|
|
4412
|
+
* Naming pattern for generated names.
|
|
4413
|
+
*
|
|
4414
|
+
* @default '{{name}}Errors'
|
|
4415
|
+
*/
|
|
4416
|
+
name?: NameTransformer;
|
|
4417
|
+
};
|
|
4418
|
+
/**
|
|
4419
|
+
* Configuration for request-specific types.
|
|
4420
|
+
*
|
|
4421
|
+
* Controls generation of types for request bodies, query parameters, path
|
|
4422
|
+
* parameters, and headers.
|
|
4423
|
+
*
|
|
4424
|
+
* Can be:
|
|
4425
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
4426
|
+
* - `object`: Full configuration object
|
|
4427
|
+
*
|
|
4428
|
+
* @default '{{name}}Data'
|
|
4429
|
+
*/
|
|
4430
|
+
requests?: NameTransformer | {
|
|
4431
|
+
/**
|
|
4432
|
+
* Casing convention for generated names.
|
|
4433
|
+
*
|
|
4434
|
+
* @default 'PascalCase'
|
|
4435
|
+
*/
|
|
4436
|
+
case?: Casing;
|
|
4437
|
+
/**
|
|
4438
|
+
* Naming pattern for generated names.
|
|
4439
|
+
*
|
|
4440
|
+
* @default '{{name}}Data'
|
|
4441
|
+
*/
|
|
4442
|
+
name?: NameTransformer;
|
|
4443
|
+
};
|
|
4444
|
+
/**
|
|
4445
|
+
* Configuration for response-specific types.
|
|
4446
|
+
*
|
|
4447
|
+
* Controls generation of types for response bodies and status codes.
|
|
4448
|
+
*
|
|
4449
|
+
* Can be:
|
|
4450
|
+
* - `string` or `function`: Shorthand for `{ name: string | function }`
|
|
4451
|
+
* - `object`: Full configuration object
|
|
4452
|
+
*
|
|
4453
|
+
* @default '{{name}}Responses'
|
|
4454
|
+
*/
|
|
4455
|
+
responses?: NameTransformer | {
|
|
4456
|
+
/**
|
|
4457
|
+
* Casing convention for generated names.
|
|
4096
4458
|
*
|
|
4097
4459
|
* @default 'PascalCase'
|
|
4098
4460
|
*/
|
|
@@ -4152,7 +4514,7 @@ type UserConfig$13 = Plugin$1.Name<'@hey-api/typescript'> & Plugin$1.Hooks & Plu
|
|
|
4152
4514
|
payload?: NameTransformer;
|
|
4153
4515
|
};
|
|
4154
4516
|
};
|
|
4155
|
-
type Config$11 = Plugin$1.Name<'@hey-api/typescript'> & Plugin$1.Hooks & Plugin$1.Comments & Plugin$1.Exports & {
|
|
4517
|
+
type Config$11 = Plugin$1.Name<'@hey-api/typescript'> & Plugin$1.Hooks & Plugin$1.Comments & Plugin$1.Exports & Resolvers$2 & {
|
|
4156
4518
|
/**
|
|
4157
4519
|
* Casing convention for generated names.
|
|
4158
4520
|
*/
|
|
@@ -8020,8 +8382,7 @@ interface ValibotResult {
|
|
|
8020
8382
|
/**
|
|
8021
8383
|
* Finalized result after applyModifiers.
|
|
8022
8384
|
*/
|
|
8023
|
-
interface ValibotFinal {
|
|
8024
|
-
pipes: Pipes;
|
|
8385
|
+
interface ValibotFinal extends Pick<ValibotResult, 'pipes'> {
|
|
8025
8386
|
/** Type annotation for schemas requiring explicit typing (e.g., lazy). */
|
|
8026
8387
|
typeName?: string | ts.Identifier;
|
|
8027
8388
|
}
|
|
@@ -8048,6 +8409,22 @@ type GetIntegerLimit = (format: string | undefined) => IntegerLimit | undefined;
|
|
|
8048
8409
|
//#endregion
|
|
8049
8410
|
//#region src/plugins/valibot/resolvers.d.ts
|
|
8050
8411
|
type Resolvers$1 = Plugin$1.Resolvers<{
|
|
8412
|
+
/**
|
|
8413
|
+
* Resolver for array schemas.
|
|
8414
|
+
*
|
|
8415
|
+
* Allows customization of how array types are rendered.
|
|
8416
|
+
*
|
|
8417
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8418
|
+
*/
|
|
8419
|
+
array?: (ctx: ArrayResolverContext$1) => PipeResult;
|
|
8420
|
+
/**
|
|
8421
|
+
* Resolver for boolean schemas.
|
|
8422
|
+
*
|
|
8423
|
+
* Allows customization of how boolean types are rendered.
|
|
8424
|
+
*
|
|
8425
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8426
|
+
*/
|
|
8427
|
+
boolean?: (ctx: BooleanResolverContext$1) => PipeResult;
|
|
8051
8428
|
/**
|
|
8052
8429
|
* Resolver for enum schemas.
|
|
8053
8430
|
*
|
|
@@ -8056,6 +8433,30 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
8056
8433
|
* Returning `undefined` will execute the default resolver logic.
|
|
8057
8434
|
*/
|
|
8058
8435
|
enum?: (ctx: EnumResolverContext$1) => PipeResult;
|
|
8436
|
+
/**
|
|
8437
|
+
* Resolver for intersection schemas.
|
|
8438
|
+
*
|
|
8439
|
+
* Allows customization of how intersection types are rendered.
|
|
8440
|
+
*
|
|
8441
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8442
|
+
*/
|
|
8443
|
+
intersection?: (ctx: IntersectionResolverContext$1) => PipeResult;
|
|
8444
|
+
/**
|
|
8445
|
+
* Resolver for never schemas.
|
|
8446
|
+
*
|
|
8447
|
+
* Allows customization of how never types are rendered.
|
|
8448
|
+
*
|
|
8449
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8450
|
+
*/
|
|
8451
|
+
never?: (ctx: NeverResolverContext$1) => PipeResult;
|
|
8452
|
+
/**
|
|
8453
|
+
* Resolver for null schemas.
|
|
8454
|
+
*
|
|
8455
|
+
* Allows customization of how null types are rendered.
|
|
8456
|
+
*
|
|
8457
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8458
|
+
*/
|
|
8459
|
+
null?: (ctx: NullResolverContext$1) => PipeResult;
|
|
8059
8460
|
/**
|
|
8060
8461
|
* Resolver for number schemas.
|
|
8061
8462
|
*
|
|
@@ -8080,6 +8481,38 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
8080
8481
|
* Returning `undefined` will execute the default resolver logic.
|
|
8081
8482
|
*/
|
|
8082
8483
|
string?: (ctx: StringResolverContext$1) => PipeResult;
|
|
8484
|
+
/**
|
|
8485
|
+
* Resolver for tuple schemas.
|
|
8486
|
+
*
|
|
8487
|
+
* Allows customization of how tuple types are rendered.
|
|
8488
|
+
*
|
|
8489
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8490
|
+
*/
|
|
8491
|
+
tuple?: (ctx: TupleResolverContext$1) => PipeResult;
|
|
8492
|
+
/**
|
|
8493
|
+
* Resolver for undefined schemas.
|
|
8494
|
+
*
|
|
8495
|
+
* Allows customization of how undefined types are rendered.
|
|
8496
|
+
*
|
|
8497
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8498
|
+
*/
|
|
8499
|
+
undefined?: (ctx: UndefinedResolverContext$1) => PipeResult;
|
|
8500
|
+
/**
|
|
8501
|
+
* Resolver for union schemas.
|
|
8502
|
+
*
|
|
8503
|
+
* Allows customization of how union types are rendered.
|
|
8504
|
+
*
|
|
8505
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8506
|
+
*/
|
|
8507
|
+
union?: (ctx: UnionResolverContext$1) => PipeResult;
|
|
8508
|
+
/**
|
|
8509
|
+
* Resolver for unknown schemas.
|
|
8510
|
+
*
|
|
8511
|
+
* Allows customization of how unknown types are rendered.
|
|
8512
|
+
*
|
|
8513
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8514
|
+
*/
|
|
8515
|
+
unknown?: (ctx: UnknownResolverContext$1) => PipeResult;
|
|
8083
8516
|
/**
|
|
8084
8517
|
* Resolvers for request and response validators.
|
|
8085
8518
|
*
|
|
@@ -8103,6 +8536,14 @@ type Resolvers$1 = Plugin$1.Resolvers<{
|
|
|
8103
8536
|
*/
|
|
8104
8537
|
response?: ValidatorResolver$1;
|
|
8105
8538
|
};
|
|
8539
|
+
/**
|
|
8540
|
+
* Resolver for void schemas.
|
|
8541
|
+
*
|
|
8542
|
+
* Allows customization of how void types are rendered.
|
|
8543
|
+
*
|
|
8544
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
8545
|
+
*/
|
|
8546
|
+
void?: (ctx: VoidResolverContext$1) => PipeResult;
|
|
8106
8547
|
}>;
|
|
8107
8548
|
type ValidatorResolver$1 = (ctx: ValidatorResolverContext$1) => PipeResult | null | undefined;
|
|
8108
8549
|
interface BaseContext$1 extends DollarTsDsl {
|
|
@@ -8130,9 +8571,36 @@ interface BaseContext$1 extends DollarTsDsl {
|
|
|
8130
8571
|
v: Symbol;
|
|
8131
8572
|
};
|
|
8132
8573
|
}
|
|
8574
|
+
interface ArrayResolverContext$1 extends BaseContext$1 {
|
|
8575
|
+
applyModifiers: (result: ValibotResult, opts?: {
|
|
8576
|
+
optional?: boolean;
|
|
8577
|
+
}) => ValibotFinal;
|
|
8578
|
+
/**
|
|
8579
|
+
* Nodes used to build different parts of the result.
|
|
8580
|
+
*/
|
|
8581
|
+
nodes: {
|
|
8582
|
+
base: (ctx: ArrayResolverContext$1) => PipeResult;
|
|
8583
|
+
length: (ctx: ArrayResolverContext$1) => PipeResult;
|
|
8584
|
+
maxLength: (ctx: ArrayResolverContext$1) => PipeResult;
|
|
8585
|
+
minLength: (ctx: ArrayResolverContext$1) => PipeResult;
|
|
8586
|
+
};
|
|
8587
|
+
schema: SchemaWithType<'array'>;
|
|
8588
|
+
walk: Walker<ValibotResult, ValibotPlugin['Instance']>;
|
|
8589
|
+
walkerCtx: SchemaVisitorContext<ValibotPlugin['Instance']>;
|
|
8590
|
+
}
|
|
8591
|
+
interface BooleanResolverContext$1 extends BaseContext$1 {
|
|
8592
|
+
/**
|
|
8593
|
+
* Nodes used to build different parts of the result.
|
|
8594
|
+
*/
|
|
8595
|
+
nodes: {
|
|
8596
|
+
base: (ctx: BooleanResolverContext$1) => PipeResult;
|
|
8597
|
+
const: (ctx: BooleanResolverContext$1) => PipeResult;
|
|
8598
|
+
};
|
|
8599
|
+
schema: SchemaWithType<'boolean'>;
|
|
8600
|
+
}
|
|
8133
8601
|
interface EnumResolverContext$1 extends BaseContext$1 {
|
|
8134
8602
|
/**
|
|
8135
|
-
* Nodes used to build different parts of the
|
|
8603
|
+
* Nodes used to build different parts of the result.
|
|
8136
8604
|
*/
|
|
8137
8605
|
nodes: {
|
|
8138
8606
|
/**
|
|
@@ -8153,11 +8621,43 @@ interface EnumResolverContext$1 extends BaseContext$1 {
|
|
|
8153
8621
|
isNullable: boolean;
|
|
8154
8622
|
};
|
|
8155
8623
|
};
|
|
8156
|
-
schema: SchemaWithType<'enum'>;
|
|
8624
|
+
schema: SchemaWithType<'enum'>;
|
|
8625
|
+
}
|
|
8626
|
+
interface IntersectionResolverContext$1 extends BaseContext$1 {
|
|
8627
|
+
applyModifiers: (result: ValibotResult, opts?: {
|
|
8628
|
+
optional?: boolean;
|
|
8629
|
+
}) => ValibotFinal;
|
|
8630
|
+
childResults: Array<ValibotResult>;
|
|
8631
|
+
/**
|
|
8632
|
+
* Nodes used to build different parts of the result.
|
|
8633
|
+
*/
|
|
8634
|
+
nodes: {
|
|
8635
|
+
base: (ctx: IntersectionResolverContext$1) => PipeResult;
|
|
8636
|
+
};
|
|
8637
|
+
parentSchema: IR$1.SchemaObject;
|
|
8638
|
+
schema: IR$1.SchemaObject;
|
|
8639
|
+
}
|
|
8640
|
+
interface NeverResolverContext$1 extends BaseContext$1 {
|
|
8641
|
+
/**
|
|
8642
|
+
* Nodes used to build different parts of the result.
|
|
8643
|
+
*/
|
|
8644
|
+
nodes: {
|
|
8645
|
+
base: (ctx: NeverResolverContext$1) => PipeResult;
|
|
8646
|
+
};
|
|
8647
|
+
schema: SchemaWithType<'never'>;
|
|
8648
|
+
}
|
|
8649
|
+
interface NullResolverContext$1 extends BaseContext$1 {
|
|
8650
|
+
/**
|
|
8651
|
+
* Nodes used to build different parts of the result.
|
|
8652
|
+
*/
|
|
8653
|
+
nodes: {
|
|
8654
|
+
base: (ctx: NullResolverContext$1) => PipeResult;
|
|
8655
|
+
};
|
|
8656
|
+
schema: SchemaWithType<'null'>;
|
|
8157
8657
|
}
|
|
8158
8658
|
interface NumberResolverContext$1 extends BaseContext$1 {
|
|
8159
8659
|
/**
|
|
8160
|
-
* Nodes used to build different parts of the
|
|
8660
|
+
* Nodes used to build different parts of the result.
|
|
8161
8661
|
*/
|
|
8162
8662
|
nodes: {
|
|
8163
8663
|
base: (ctx: NumberResolverContext$1) => PipeResult;
|
|
@@ -8181,7 +8681,7 @@ interface ObjectResolverContext$1 extends BaseContext$1 {
|
|
|
8181
8681
|
optional?: boolean;
|
|
8182
8682
|
}) => ValibotFinal;
|
|
8183
8683
|
/**
|
|
8184
|
-
* Nodes used to build different parts of the
|
|
8684
|
+
* Nodes used to build different parts of the result.
|
|
8185
8685
|
*/
|
|
8186
8686
|
nodes: {
|
|
8187
8687
|
additionalProperties: (ctx: ObjectResolverContext$1) => Pipe | null | undefined;
|
|
@@ -8189,20 +8689,12 @@ interface ObjectResolverContext$1 extends BaseContext$1 {
|
|
|
8189
8689
|
shape: (ctx: ObjectResolverContext$1) => ReturnType<typeof $.object>;
|
|
8190
8690
|
};
|
|
8191
8691
|
schema: SchemaWithType<'object'>;
|
|
8192
|
-
/**
|
|
8193
|
-
* Utility functions for object schema processing.
|
|
8194
|
-
*/
|
|
8195
|
-
utils: {
|
|
8196
|
-
ast: Partial<{
|
|
8197
|
-
hasLazy: boolean;
|
|
8198
|
-
}>;
|
|
8199
|
-
};
|
|
8200
8692
|
walk: Walker<ValibotResult, ValibotPlugin['Instance']>;
|
|
8201
8693
|
walkerCtx: SchemaVisitorContext<ValibotPlugin['Instance']>;
|
|
8202
8694
|
}
|
|
8203
8695
|
interface StringResolverContext$1 extends BaseContext$1 {
|
|
8204
8696
|
/**
|
|
8205
|
-
* Nodes used to build different parts of the
|
|
8697
|
+
* Nodes used to build different parts of the result.
|
|
8206
8698
|
*/
|
|
8207
8699
|
nodes: {
|
|
8208
8700
|
base: (ctx: StringResolverContext$1) => PipeResult;
|
|
@@ -8215,6 +8707,54 @@ interface StringResolverContext$1 extends BaseContext$1 {
|
|
|
8215
8707
|
};
|
|
8216
8708
|
schema: SchemaWithType<'string'>;
|
|
8217
8709
|
}
|
|
8710
|
+
interface TupleResolverContext$1 extends BaseContext$1 {
|
|
8711
|
+
applyModifiers: (result: ValibotResult, opts?: {
|
|
8712
|
+
optional?: boolean;
|
|
8713
|
+
}) => ValibotFinal;
|
|
8714
|
+
/**
|
|
8715
|
+
* Nodes used to build different parts of the result.
|
|
8716
|
+
*/
|
|
8717
|
+
nodes: {
|
|
8718
|
+
base: (ctx: TupleResolverContext$1) => PipeResult;
|
|
8719
|
+
const: (ctx: TupleResolverContext$1) => PipeResult;
|
|
8720
|
+
};
|
|
8721
|
+
schema: SchemaWithType<'tuple'>;
|
|
8722
|
+
walk: Walker<ValibotResult, ValibotPlugin['Instance']>;
|
|
8723
|
+
walkerCtx: SchemaVisitorContext<ValibotPlugin['Instance']>;
|
|
8724
|
+
}
|
|
8725
|
+
interface UndefinedResolverContext$1 extends BaseContext$1 {
|
|
8726
|
+
/**
|
|
8727
|
+
* Nodes used to build different parts of the result.
|
|
8728
|
+
*/
|
|
8729
|
+
nodes: {
|
|
8730
|
+
base: (ctx: UndefinedResolverContext$1) => PipeResult;
|
|
8731
|
+
};
|
|
8732
|
+
schema: SchemaWithType<'undefined'>;
|
|
8733
|
+
}
|
|
8734
|
+
interface UnionResolverContext$1 extends BaseContext$1 {
|
|
8735
|
+
applyModifiers: (result: ValibotResult, opts?: {
|
|
8736
|
+
optional?: boolean;
|
|
8737
|
+
}) => ValibotFinal;
|
|
8738
|
+
childResults: Array<ValibotResult>;
|
|
8739
|
+
/**
|
|
8740
|
+
* Nodes used to build different parts of the result.
|
|
8741
|
+
*/
|
|
8742
|
+
nodes: {
|
|
8743
|
+
base: (ctx: UnionResolverContext$1) => PipeResult;
|
|
8744
|
+
};
|
|
8745
|
+
parentSchema: IR$1.SchemaObject;
|
|
8746
|
+
schema: IR$1.SchemaObject;
|
|
8747
|
+
schemas: ReadonlyArray<IR$1.SchemaObject>;
|
|
8748
|
+
}
|
|
8749
|
+
interface UnknownResolverContext$1 extends BaseContext$1 {
|
|
8750
|
+
/**
|
|
8751
|
+
* Nodes used to build different parts of the result.
|
|
8752
|
+
*/
|
|
8753
|
+
nodes: {
|
|
8754
|
+
base: (ctx: UnknownResolverContext$1) => PipeResult;
|
|
8755
|
+
};
|
|
8756
|
+
schema: SchemaWithType<'unknown'>;
|
|
8757
|
+
}
|
|
8218
8758
|
interface ValidatorResolverContext$1 extends BaseContext$1 {
|
|
8219
8759
|
operation: IR$1.OperationObject;
|
|
8220
8760
|
/**
|
|
@@ -8224,6 +8764,15 @@ interface ValidatorResolverContext$1 extends BaseContext$1 {
|
|
|
8224
8764
|
schema: Symbol;
|
|
8225
8765
|
};
|
|
8226
8766
|
}
|
|
8767
|
+
interface VoidResolverContext$1 extends BaseContext$1 {
|
|
8768
|
+
/**
|
|
8769
|
+
* Nodes used to build different parts of the result.
|
|
8770
|
+
*/
|
|
8771
|
+
nodes: {
|
|
8772
|
+
base: (ctx: VoidResolverContext$1) => PipeResult;
|
|
8773
|
+
};
|
|
8774
|
+
schema: SchemaWithType<'void'>;
|
|
8775
|
+
}
|
|
8227
8776
|
//#endregion
|
|
8228
8777
|
//#region src/plugins/valibot/types.d.ts
|
|
8229
8778
|
type UserConfig$2 = Plugin$1.Name<'valibot'> & Plugin$1.Hooks & Plugin$1.UserComments & Plugin$1.UserExports & Resolvers$1 & {
|
|
@@ -8404,56 +8953,54 @@ type Config$1 = Plugin$1.Name<'valibot'> & Plugin$1.Hooks & Plugin$1.Comments &
|
|
|
8404
8953
|
};
|
|
8405
8954
|
type ValibotPlugin = DefinePlugin$1<UserConfig$2, Config$1, IApi$1>;
|
|
8406
8955
|
//#endregion
|
|
8956
|
+
//#region src/plugins/zod/shared/chain.d.ts
|
|
8957
|
+
type Chain = ReturnType<typeof $.call | typeof $.expr>;
|
|
8958
|
+
type ChainResult = Chain | undefined;
|
|
8959
|
+
//#endregion
|
|
8407
8960
|
//#region src/plugins/zod/shared/types.d.ts
|
|
8408
|
-
type
|
|
8409
|
-
|
|
8410
|
-
expression: ReturnType<typeof $.expr | typeof $.call>;
|
|
8411
|
-
hasLazyExpression?: boolean;
|
|
8412
|
-
typeName?: string | ts.Identifier;
|
|
8413
|
-
};
|
|
8414
|
-
type IrSchemaToAstOptions = {
|
|
8961
|
+
type ValidatorArgs = {
|
|
8962
|
+
operation: IR$1.OperationObject;
|
|
8415
8963
|
/** The plugin instance. */
|
|
8416
8964
|
plugin: ZodPlugin['Instance'];
|
|
8417
|
-
/** The plugin state references. */
|
|
8418
|
-
state: Refs<PluginState>;
|
|
8419
|
-
walk: Walker<ZodSchemaResult, ZodPlugin['Instance']>;
|
|
8420
|
-
};
|
|
8421
|
-
type PluginState = Pick<Required<SymbolMeta>, 'path'> & Pick<Partial<SymbolMeta>, 'tags'> & {
|
|
8422
|
-
anyType?: string;
|
|
8423
|
-
hasLazyExpression: boolean;
|
|
8424
8965
|
};
|
|
8425
8966
|
type TypeOptions = {
|
|
8426
|
-
/** Configuration for TypeScript type generation from Zod schemas. */
|
|
8427
8967
|
types: {
|
|
8428
|
-
/** Configuration for `infer` types. */
|
|
8429
8968
|
infer: NamingOptions & FeatureToggle;
|
|
8430
8969
|
};
|
|
8431
8970
|
};
|
|
8432
|
-
type ValidatorArgs = {
|
|
8433
|
-
operation: IR$1.OperationObject;
|
|
8434
|
-
plugin: ZodPlugin['Instance'];
|
|
8435
|
-
};
|
|
8436
8971
|
/**
|
|
8437
|
-
*
|
|
8972
|
+
* Metadata that flows through schema walking.
|
|
8438
8973
|
*/
|
|
8439
|
-
interface
|
|
8440
|
-
/** Default value from schema
|
|
8974
|
+
interface ZodMeta {
|
|
8975
|
+
/** Default value from schema. */
|
|
8441
8976
|
default?: unknown;
|
|
8442
|
-
/**
|
|
8443
|
-
expression: {
|
|
8444
|
-
expression: ReturnType<typeof $.expr | typeof $.call>;
|
|
8445
|
-
};
|
|
8446
|
-
/** The original schema format (for BigInt coercion). */
|
|
8977
|
+
/** Original format (for BigInt coercion). */
|
|
8447
8978
|
format?: string;
|
|
8448
|
-
/** Whether any child contains a lazy
|
|
8449
|
-
|
|
8450
|
-
/** Whether
|
|
8451
|
-
isLazy
|
|
8979
|
+
/** Whether this or any child contains a lazy reference. */
|
|
8980
|
+
hasLazy: boolean;
|
|
8981
|
+
/** Whether this schema itself is emitted as lazy. */
|
|
8982
|
+
isLazy: boolean;
|
|
8983
|
+
/** Whether this schema resolves to an object shape. */
|
|
8984
|
+
isObject?: boolean;
|
|
8452
8985
|
/** Does this schema explicitly allow null? */
|
|
8453
8986
|
nullable: boolean;
|
|
8454
8987
|
/** Is this schema read-only? */
|
|
8455
8988
|
readonly: boolean;
|
|
8456
8989
|
}
|
|
8990
|
+
/**
|
|
8991
|
+
* Result from walking a schema node.
|
|
8992
|
+
*/
|
|
8993
|
+
interface ZodResult {
|
|
8994
|
+
expression: Chain;
|
|
8995
|
+
meta: ZodMeta;
|
|
8996
|
+
}
|
|
8997
|
+
/**
|
|
8998
|
+
* Finalized result after applyModifiers.
|
|
8999
|
+
*/
|
|
9000
|
+
interface ZodFinal extends Pick<ZodResult, 'expression'> {
|
|
9001
|
+
/** Type annotation for schemas requiring explicit typing (e.g., lazy). */
|
|
9002
|
+
typeName?: string | ts.Identifier;
|
|
9003
|
+
}
|
|
8457
9004
|
//#endregion
|
|
8458
9005
|
//#region src/plugins/zod/api.d.ts
|
|
8459
9006
|
type IApi = {
|
|
@@ -8461,11 +9008,24 @@ type IApi = {
|
|
|
8461
9008
|
createResponseValidator: (args: ValidatorArgs) => ReturnType<typeof $.func> | undefined;
|
|
8462
9009
|
};
|
|
8463
9010
|
//#endregion
|
|
8464
|
-
//#region src/plugins/zod/
|
|
8465
|
-
type Chain = ReturnType<typeof $.call | typeof $.expr>;
|
|
8466
|
-
//#endregion
|
|
8467
|
-
//#region src/plugins/zod/resolvers/types.d.ts
|
|
9011
|
+
//#region src/plugins/zod/resolvers.d.ts
|
|
8468
9012
|
type Resolvers = Plugin$1.Resolvers<{
|
|
9013
|
+
/**
|
|
9014
|
+
* Resolver for array schemas.
|
|
9015
|
+
*
|
|
9016
|
+
* Allows customization of how array types are rendered.
|
|
9017
|
+
*
|
|
9018
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9019
|
+
*/
|
|
9020
|
+
array?: (ctx: ArrayResolverContext) => ChainResult;
|
|
9021
|
+
/**
|
|
9022
|
+
* Resolver for boolean schemas.
|
|
9023
|
+
*
|
|
9024
|
+
* Allows customization of how boolean types are rendered.
|
|
9025
|
+
*
|
|
9026
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9027
|
+
*/
|
|
9028
|
+
boolean?: (ctx: BooleanResolverContext) => ChainResult;
|
|
8469
9029
|
/**
|
|
8470
9030
|
* Resolver for enum schemas.
|
|
8471
9031
|
*
|
|
@@ -8473,7 +9033,31 @@ type Resolvers = Plugin$1.Resolvers<{
|
|
|
8473
9033
|
*
|
|
8474
9034
|
* Returning `undefined` will execute the default resolver logic.
|
|
8475
9035
|
*/
|
|
8476
|
-
enum?: (ctx: EnumResolverContext) =>
|
|
9036
|
+
enum?: (ctx: EnumResolverContext) => ChainResult;
|
|
9037
|
+
/**
|
|
9038
|
+
* Resolver for intersection schemas.
|
|
9039
|
+
*
|
|
9040
|
+
* Allows customization of how intersection types are rendered.
|
|
9041
|
+
*
|
|
9042
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9043
|
+
*/
|
|
9044
|
+
intersection?: (ctx: IntersectionResolverContext) => ChainResult;
|
|
9045
|
+
/**
|
|
9046
|
+
* Resolver for never schemas.
|
|
9047
|
+
*
|
|
9048
|
+
* Allows customization of how never types are rendered.
|
|
9049
|
+
*
|
|
9050
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9051
|
+
*/
|
|
9052
|
+
never?: (ctx: NeverResolverContext) => ChainResult;
|
|
9053
|
+
/**
|
|
9054
|
+
* Resolver for null schemas.
|
|
9055
|
+
*
|
|
9056
|
+
* Allows customization of how null types are rendered.
|
|
9057
|
+
*
|
|
9058
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9059
|
+
*/
|
|
9060
|
+
null?: (ctx: NullResolverContext) => ChainResult;
|
|
8477
9061
|
/**
|
|
8478
9062
|
* Resolver for number schemas.
|
|
8479
9063
|
*
|
|
@@ -8481,7 +9065,7 @@ type Resolvers = Plugin$1.Resolvers<{
|
|
|
8481
9065
|
*
|
|
8482
9066
|
* Returning `undefined` will execute the default resolver logic.
|
|
8483
9067
|
*/
|
|
8484
|
-
number?: (ctx: NumberResolverContext) =>
|
|
9068
|
+
number?: (ctx: NumberResolverContext) => ChainResult;
|
|
8485
9069
|
/**
|
|
8486
9070
|
* Resolver for object schemas.
|
|
8487
9071
|
*
|
|
@@ -8489,7 +9073,7 @@ type Resolvers = Plugin$1.Resolvers<{
|
|
|
8489
9073
|
*
|
|
8490
9074
|
* Returning `undefined` will execute the default resolver logic.
|
|
8491
9075
|
*/
|
|
8492
|
-
object?: (ctx: ObjectResolverContext) =>
|
|
9076
|
+
object?: (ctx: ObjectResolverContext) => ChainResult;
|
|
8493
9077
|
/**
|
|
8494
9078
|
* Resolver for string schemas.
|
|
8495
9079
|
*
|
|
@@ -8497,7 +9081,39 @@ type Resolvers = Plugin$1.Resolvers<{
|
|
|
8497
9081
|
*
|
|
8498
9082
|
* Returning `undefined` will execute the default resolver logic.
|
|
8499
9083
|
*/
|
|
8500
|
-
string?: (ctx: StringResolverContext) =>
|
|
9084
|
+
string?: (ctx: StringResolverContext) => ChainResult;
|
|
9085
|
+
/**
|
|
9086
|
+
* Resolver for tuple schemas.
|
|
9087
|
+
*
|
|
9088
|
+
* Allows customization of how tuple types are rendered.
|
|
9089
|
+
*
|
|
9090
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9091
|
+
*/
|
|
9092
|
+
tuple?: (ctx: TupleResolverContext) => ChainResult;
|
|
9093
|
+
/**
|
|
9094
|
+
* Resolver for undefined schemas.
|
|
9095
|
+
*
|
|
9096
|
+
* Allows customization of how undefined types are rendered.
|
|
9097
|
+
*
|
|
9098
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9099
|
+
*/
|
|
9100
|
+
undefined?: (ctx: UndefinedResolverContext) => ChainResult;
|
|
9101
|
+
/**
|
|
9102
|
+
* Resolver for union schemas.
|
|
9103
|
+
*
|
|
9104
|
+
* Allows customization of how union types are rendered.
|
|
9105
|
+
*
|
|
9106
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9107
|
+
*/
|
|
9108
|
+
union?: (ctx: UnionResolverContext) => ChainResult;
|
|
9109
|
+
/**
|
|
9110
|
+
* Resolver for unknown schemas.
|
|
9111
|
+
*
|
|
9112
|
+
* Allows customization of how unknown types are rendered.
|
|
9113
|
+
*
|
|
9114
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9115
|
+
*/
|
|
9116
|
+
unknown?: (ctx: UnknownResolverContext) => ChainResult;
|
|
8501
9117
|
/**
|
|
8502
9118
|
* Resolvers for request and response validators.
|
|
8503
9119
|
*
|
|
@@ -8521,9 +9137,17 @@ type Resolvers = Plugin$1.Resolvers<{
|
|
|
8521
9137
|
*/
|
|
8522
9138
|
response?: ValidatorResolver;
|
|
8523
9139
|
};
|
|
9140
|
+
/**
|
|
9141
|
+
* Resolver for void schemas.
|
|
9142
|
+
*
|
|
9143
|
+
* Allows customization of how void types are rendered.
|
|
9144
|
+
*
|
|
9145
|
+
* Returning `undefined` will execute the default resolver logic.
|
|
9146
|
+
*/
|
|
9147
|
+
void?: (ctx: VoidResolverContext) => ChainResult;
|
|
8524
9148
|
}>;
|
|
8525
9149
|
type ValidatorResolver = (ctx: ValidatorResolverContext) => MaybeArray<TsDsl<ts.Statement>> | null | undefined;
|
|
8526
|
-
|
|
9150
|
+
interface BaseContext extends DollarTsDsl {
|
|
8527
9151
|
/**
|
|
8528
9152
|
* Functions for working with chains.
|
|
8529
9153
|
*/
|
|
@@ -8531,28 +9155,79 @@ type BaseContext = DollarTsDsl & Pick<IrSchemaToAstOptions, 'plugin'> & {
|
|
|
8531
9155
|
/**
|
|
8532
9156
|
* The current chain.
|
|
8533
9157
|
*
|
|
8534
|
-
* In Zod, this represents a chain of
|
|
8535
|
-
*
|
|
9158
|
+
* In Zod, this represents a chain of method calls being assembled
|
|
9159
|
+
* to form a schema definition (e.g., `z.string().min(1).max(10)`).
|
|
8536
9160
|
*
|
|
8537
|
-
* Each
|
|
9161
|
+
* Each method can be extended, modified, or replaced to customize
|
|
8538
9162
|
* the resulting schema.
|
|
8539
9163
|
*/
|
|
8540
9164
|
current: Chain;
|
|
8541
9165
|
};
|
|
9166
|
+
/** The plugin instance. */
|
|
9167
|
+
plugin: ZodPlugin['Instance'];
|
|
8542
9168
|
/**
|
|
8543
9169
|
* Provides access to commonly used symbols within the plugin.
|
|
8544
9170
|
*/
|
|
8545
9171
|
symbols: {
|
|
8546
9172
|
z: Symbol;
|
|
8547
9173
|
};
|
|
8548
|
-
}
|
|
9174
|
+
}
|
|
9175
|
+
interface ArrayResolverContext extends BaseContext {
|
|
9176
|
+
applyModifiers: (result: ZodResult, opts?: {
|
|
9177
|
+
optional?: boolean;
|
|
9178
|
+
}) => ZodFinal;
|
|
9179
|
+
/**
|
|
9180
|
+
* Child results from processing array items.
|
|
9181
|
+
*/
|
|
9182
|
+
childResults: Array<ZodResult>;
|
|
9183
|
+
/**
|
|
9184
|
+
* Nodes used to build different parts of the result.
|
|
9185
|
+
*/
|
|
9186
|
+
nodes: {
|
|
9187
|
+
/**
|
|
9188
|
+
* Returns the base array expression (z.array(...)).
|
|
9189
|
+
*/
|
|
9190
|
+
base: (ctx: ArrayResolverContext) => Chain;
|
|
9191
|
+
/**
|
|
9192
|
+
* Returns a length constraint (when minItems === maxItems), if applicable.
|
|
9193
|
+
*/
|
|
9194
|
+
length: (ctx: ArrayResolverContext) => ChainResult;
|
|
9195
|
+
/**
|
|
9196
|
+
* Returns a maxItems constraint, if applicable.
|
|
9197
|
+
*/
|
|
9198
|
+
maxLength: (ctx: ArrayResolverContext) => ChainResult;
|
|
9199
|
+
/**
|
|
9200
|
+
* Returns a minItems constraint, if applicable.
|
|
9201
|
+
*/
|
|
9202
|
+
minLength: (ctx: ArrayResolverContext) => ChainResult;
|
|
9203
|
+
};
|
|
9204
|
+
schema: SchemaWithType<'array'>;
|
|
9205
|
+
walk: Walker<ZodResult, ZodPlugin['Instance']>;
|
|
9206
|
+
walkerCtx: SchemaVisitorContext<ZodPlugin['Instance']>;
|
|
9207
|
+
}
|
|
9208
|
+
interface BooleanResolverContext extends BaseContext {
|
|
9209
|
+
/**
|
|
9210
|
+
* Nodes used to build different parts of the result.
|
|
9211
|
+
*/
|
|
9212
|
+
nodes: {
|
|
9213
|
+
/**
|
|
9214
|
+
* Returns the base boolean expression (z.boolean()).
|
|
9215
|
+
*/
|
|
9216
|
+
base: (ctx: BooleanResolverContext) => Chain;
|
|
9217
|
+
/**
|
|
9218
|
+
* Returns a literal expression for the const value, if present.
|
|
9219
|
+
*/
|
|
9220
|
+
const: (ctx: BooleanResolverContext) => ChainResult;
|
|
9221
|
+
};
|
|
9222
|
+
schema: SchemaWithType<'boolean'>;
|
|
9223
|
+
}
|
|
8549
9224
|
interface EnumResolverContext extends BaseContext {
|
|
8550
9225
|
/**
|
|
8551
|
-
* Nodes used to build different parts of the
|
|
9226
|
+
* Nodes used to build different parts of the result.
|
|
8552
9227
|
*/
|
|
8553
9228
|
nodes: {
|
|
8554
9229
|
/**
|
|
8555
|
-
* Returns the base enum expression (z.enum([...]) or z.union([...])
|
|
9230
|
+
* Returns the base enum expression (z.enum([...]) or z.union([...])).
|
|
8556
9231
|
*/
|
|
8557
9232
|
base: (ctx: EnumResolverContext) => Chain;
|
|
8558
9233
|
/**
|
|
@@ -8560,7 +9235,7 @@ interface EnumResolverContext extends BaseContext {
|
|
|
8560
9235
|
*/
|
|
8561
9236
|
items: (ctx: EnumResolverContext) => {
|
|
8562
9237
|
/**
|
|
8563
|
-
* Whether all enum
|
|
9238
|
+
* Whether all enum members are strings.
|
|
8564
9239
|
*/
|
|
8565
9240
|
allStrings: boolean;
|
|
8566
9241
|
/**
|
|
@@ -8572,84 +9247,214 @@ interface EnumResolverContext extends BaseContext {
|
|
|
8572
9247
|
*/
|
|
8573
9248
|
isNullable: boolean;
|
|
8574
9249
|
/**
|
|
8575
|
-
*
|
|
9250
|
+
* Zod literal expressions for each enum member.
|
|
8576
9251
|
*/
|
|
8577
9252
|
literalMembers: Array<Chain>;
|
|
8578
9253
|
};
|
|
8579
9254
|
};
|
|
8580
9255
|
schema: SchemaWithType<'enum'>;
|
|
9256
|
+
}
|
|
9257
|
+
interface IntersectionResolverContext extends BaseContext {
|
|
9258
|
+
childResults: Array<ZodResult>;
|
|
8581
9259
|
/**
|
|
8582
|
-
*
|
|
9260
|
+
* Nodes used to build different parts of the result.
|
|
8583
9261
|
*/
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
9262
|
+
nodes: {
|
|
9263
|
+
/**
|
|
9264
|
+
* Returns the base intersection expression.
|
|
9265
|
+
*/
|
|
9266
|
+
base: (ctx: IntersectionResolverContext) => Chain;
|
|
9267
|
+
};
|
|
9268
|
+
parentSchema: IR$1.SchemaObject;
|
|
9269
|
+
schema: IR$1.SchemaObject;
|
|
9270
|
+
walk: Walker<ZodResult, ZodPlugin['Instance']>;
|
|
9271
|
+
walkerCtx: SchemaVisitorContext<ZodPlugin['Instance']>;
|
|
9272
|
+
}
|
|
9273
|
+
interface NeverResolverContext extends BaseContext {
|
|
9274
|
+
/**
|
|
9275
|
+
* Nodes used to build different parts of the result.
|
|
9276
|
+
*/
|
|
9277
|
+
nodes: {
|
|
9278
|
+
/**
|
|
9279
|
+
* Returns the base never expression (z.never()).
|
|
9280
|
+
*/
|
|
9281
|
+
base: (ctx: NeverResolverContext) => Chain;
|
|
8587
9282
|
};
|
|
9283
|
+
schema: SchemaWithType<'never'>;
|
|
9284
|
+
}
|
|
9285
|
+
interface NullResolverContext extends BaseContext {
|
|
9286
|
+
/**
|
|
9287
|
+
* Nodes used to build different parts of the result.
|
|
9288
|
+
*/
|
|
9289
|
+
nodes: {
|
|
9290
|
+
/**
|
|
9291
|
+
* Returns the base null expression (z.null()).
|
|
9292
|
+
*/
|
|
9293
|
+
base: (ctx: NullResolverContext) => Chain;
|
|
9294
|
+
};
|
|
9295
|
+
schema: SchemaWithType<'null'>;
|
|
8588
9296
|
}
|
|
8589
9297
|
interface NumberResolverContext extends BaseContext {
|
|
8590
9298
|
/**
|
|
8591
|
-
* Nodes used to build different parts of the
|
|
9299
|
+
* Nodes used to build different parts of the result.
|
|
8592
9300
|
*/
|
|
8593
9301
|
nodes: {
|
|
9302
|
+
/**
|
|
9303
|
+
* Returns the base number expression (z.number() or z.coerce.number()).
|
|
9304
|
+
*/
|
|
8594
9305
|
base: (ctx: NumberResolverContext) => Chain;
|
|
8595
|
-
|
|
8596
|
-
|
|
8597
|
-
|
|
9306
|
+
/**
|
|
9307
|
+
* Returns a literal expression for the const value, if present.
|
|
9308
|
+
*/
|
|
9309
|
+
const: (ctx: NumberResolverContext) => ChainResult;
|
|
9310
|
+
/**
|
|
9311
|
+
* Returns the maximum value constraint.
|
|
9312
|
+
*/
|
|
9313
|
+
max: (ctx: NumberResolverContext) => ChainResult;
|
|
9314
|
+
/**
|
|
9315
|
+
* Returns the minimum value constraint.
|
|
9316
|
+
*/
|
|
9317
|
+
min: (ctx: NumberResolverContext) => ChainResult;
|
|
8598
9318
|
};
|
|
8599
9319
|
schema: SchemaWithType<'integer' | 'number'>;
|
|
8600
9320
|
/**
|
|
8601
9321
|
* Utility functions for number schema processing.
|
|
8602
9322
|
*/
|
|
8603
9323
|
utils: {
|
|
8604
|
-
ast: Partial<Omit<Ast, 'typeName'>>;
|
|
8605
9324
|
getIntegerLimit: GetIntegerLimit;
|
|
8606
9325
|
maybeBigInt: MaybeBigInt;
|
|
8607
9326
|
shouldCoerceToBigInt: ShouldCoerceToBigInt;
|
|
8608
|
-
state: Refs<PluginState>;
|
|
8609
9327
|
};
|
|
8610
9328
|
}
|
|
8611
9329
|
interface ObjectResolverContext extends BaseContext {
|
|
8612
|
-
|
|
9330
|
+
/**
|
|
9331
|
+
* Child results from processing object properties.
|
|
9332
|
+
* Used for metadata composition.
|
|
9333
|
+
*/
|
|
9334
|
+
_childResults: Array<ZodResult>;
|
|
9335
|
+
applyModifiers: (result: ZodResult, opts: {
|
|
8613
9336
|
optional?: boolean;
|
|
8614
|
-
}) =>
|
|
9337
|
+
}) => ZodFinal;
|
|
8615
9338
|
/**
|
|
8616
|
-
* Nodes used to build different parts of the
|
|
9339
|
+
* Nodes used to build different parts of the result.
|
|
8617
9340
|
*/
|
|
8618
9341
|
nodes: {
|
|
8619
9342
|
/**
|
|
8620
|
-
*
|
|
8621
|
-
* to indicate no additional properties are allowed.
|
|
9343
|
+
* Returns the additional properties expression, if any.
|
|
8622
9344
|
*/
|
|
8623
9345
|
additionalProperties: (ctx: ObjectResolverContext) => Chain | null | undefined;
|
|
9346
|
+
/**
|
|
9347
|
+
* Returns the base object expression (z.object({...}) or z.record(...)).
|
|
9348
|
+
*/
|
|
8624
9349
|
base: (ctx: ObjectResolverContext) => Chain;
|
|
9350
|
+
/**
|
|
9351
|
+
* Returns the object shape (property definitions).
|
|
9352
|
+
*/
|
|
8625
9353
|
shape: (ctx: ObjectResolverContext) => ReturnType<typeof $.object>;
|
|
8626
9354
|
};
|
|
8627
9355
|
schema: SchemaWithType<'object'>;
|
|
8628
|
-
|
|
8629
|
-
* Utility functions for object schema processing.
|
|
8630
|
-
*/
|
|
8631
|
-
utils: {
|
|
8632
|
-
ast: Partial<Omit<Ast, 'typeName'>>;
|
|
8633
|
-
state: Refs<PluginState>;
|
|
8634
|
-
};
|
|
8635
|
-
walk: Walker<ZodSchemaResult, ZodPlugin['Instance']>;
|
|
9356
|
+
walk: Walker<ZodResult, ZodPlugin['Instance']>;
|
|
8636
9357
|
walkerCtx: SchemaVisitorContext<ZodPlugin['Instance']>;
|
|
8637
9358
|
}
|
|
8638
9359
|
interface StringResolverContext extends BaseContext {
|
|
8639
9360
|
/**
|
|
8640
|
-
* Nodes used to build different parts of the
|
|
9361
|
+
* Nodes used to build different parts of the result.
|
|
8641
9362
|
*/
|
|
8642
9363
|
nodes: {
|
|
9364
|
+
/**
|
|
9365
|
+
* Returns the base string expression (z.string()).
|
|
9366
|
+
*/
|
|
8643
9367
|
base: (ctx: StringResolverContext) => Chain;
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
9368
|
+
/**
|
|
9369
|
+
* Returns a literal expression for the const value, if present.
|
|
9370
|
+
*/
|
|
9371
|
+
const: (ctx: StringResolverContext) => ChainResult;
|
|
9372
|
+
/**
|
|
9373
|
+
* Returns a format validation expression, if applicable.
|
|
9374
|
+
*/
|
|
9375
|
+
format: (ctx: StringResolverContext) => ChainResult;
|
|
9376
|
+
/**
|
|
9377
|
+
* Returns a length constraint (when min === max), if applicable.
|
|
9378
|
+
*/
|
|
9379
|
+
length: (ctx: StringResolverContext) => ChainResult;
|
|
9380
|
+
/**
|
|
9381
|
+
* Returns a maxLength constraint, if applicable.
|
|
9382
|
+
*/
|
|
9383
|
+
maxLength: (ctx: StringResolverContext) => ChainResult;
|
|
9384
|
+
/**
|
|
9385
|
+
* Returns a minLength constraint, if applicable.
|
|
9386
|
+
*/
|
|
9387
|
+
minLength: (ctx: StringResolverContext) => ChainResult;
|
|
9388
|
+
/**
|
|
9389
|
+
* Returns a pattern (regex) constraint, if applicable.
|
|
9390
|
+
*/
|
|
9391
|
+
pattern: (ctx: StringResolverContext) => ChainResult;
|
|
8650
9392
|
};
|
|
8651
9393
|
schema: SchemaWithType<'string'>;
|
|
8652
9394
|
}
|
|
9395
|
+
interface TupleResolverContext extends BaseContext {
|
|
9396
|
+
applyModifiers: (result: ZodResult, opts?: {
|
|
9397
|
+
optional?: boolean;
|
|
9398
|
+
}) => ZodFinal;
|
|
9399
|
+
childResults: Array<ZodResult>;
|
|
9400
|
+
/**
|
|
9401
|
+
* Nodes used to build different parts of the result.
|
|
9402
|
+
*/
|
|
9403
|
+
nodes: {
|
|
9404
|
+
/**
|
|
9405
|
+
* Returns the base tuple expression (z.tuple([...])).
|
|
9406
|
+
*/
|
|
9407
|
+
base: (ctx: TupleResolverContext) => Chain;
|
|
9408
|
+
/**
|
|
9409
|
+
* Returns a literal expression for the const value, if present.
|
|
9410
|
+
*/
|
|
9411
|
+
const: (ctx: TupleResolverContext) => ChainResult;
|
|
9412
|
+
};
|
|
9413
|
+
schema: SchemaWithType<'tuple'>;
|
|
9414
|
+
walk: Walker<ZodResult, ZodPlugin['Instance']>;
|
|
9415
|
+
walkerCtx: SchemaVisitorContext<ZodPlugin['Instance']>;
|
|
9416
|
+
}
|
|
9417
|
+
interface UndefinedResolverContext extends BaseContext {
|
|
9418
|
+
/**
|
|
9419
|
+
* Nodes used to build different parts of the result.
|
|
9420
|
+
*/
|
|
9421
|
+
nodes: {
|
|
9422
|
+
/**
|
|
9423
|
+
* Returns the base undefined expression (z.undefined()).
|
|
9424
|
+
*/
|
|
9425
|
+
base: (ctx: UndefinedResolverContext) => Chain;
|
|
9426
|
+
};
|
|
9427
|
+
schema: SchemaWithType<'undefined'>;
|
|
9428
|
+
}
|
|
9429
|
+
interface UnionResolverContext extends BaseContext {
|
|
9430
|
+
childResults: Array<ZodResult>;
|
|
9431
|
+
/**
|
|
9432
|
+
* Nodes used to build different parts of the result.
|
|
9433
|
+
*/
|
|
9434
|
+
nodes: {
|
|
9435
|
+
/**
|
|
9436
|
+
* Returns the base union expression.
|
|
9437
|
+
*/
|
|
9438
|
+
base: (ctx: UnionResolverContext) => Chain;
|
|
9439
|
+
};
|
|
9440
|
+
parentSchema: IR$1.SchemaObject;
|
|
9441
|
+
schema: IR$1.SchemaObject;
|
|
9442
|
+
schemas: ReadonlyArray<IR$1.SchemaObject>;
|
|
9443
|
+
walk: Walker<ZodResult, ZodPlugin['Instance']>;
|
|
9444
|
+
walkerCtx: SchemaVisitorContext<ZodPlugin['Instance']>;
|
|
9445
|
+
}
|
|
9446
|
+
interface UnknownResolverContext extends BaseContext {
|
|
9447
|
+
/**
|
|
9448
|
+
* Nodes used to build different parts of the result.
|
|
9449
|
+
*/
|
|
9450
|
+
nodes: {
|
|
9451
|
+
/**
|
|
9452
|
+
* Returns the base unknown expression (z.unknown()).
|
|
9453
|
+
*/
|
|
9454
|
+
base: (ctx: UnknownResolverContext) => Chain;
|
|
9455
|
+
};
|
|
9456
|
+
schema: SchemaWithType<'unknown'>;
|
|
9457
|
+
}
|
|
8653
9458
|
interface ValidatorResolverContext extends BaseContext {
|
|
8654
9459
|
operation: IR$1.OperationObject;
|
|
8655
9460
|
/**
|
|
@@ -8659,6 +9464,18 @@ interface ValidatorResolverContext extends BaseContext {
|
|
|
8659
9464
|
schema: Symbol;
|
|
8660
9465
|
};
|
|
8661
9466
|
}
|
|
9467
|
+
interface VoidResolverContext extends BaseContext {
|
|
9468
|
+
/**
|
|
9469
|
+
* Nodes used to build different parts of the result.
|
|
9470
|
+
*/
|
|
9471
|
+
nodes: {
|
|
9472
|
+
/**
|
|
9473
|
+
* Returns the base void expression (z.void()).
|
|
9474
|
+
*/
|
|
9475
|
+
base: (ctx: VoidResolverContext) => Chain;
|
|
9476
|
+
};
|
|
9477
|
+
schema: SchemaWithType<'void'>;
|
|
9478
|
+
}
|
|
8662
9479
|
//#endregion
|
|
8663
9480
|
//#region src/plugins/zod/types.d.ts
|
|
8664
9481
|
type UserConfig$1 = Plugin$1.Name<'zod'> & Plugin$1.Hooks & Plugin$1.UserComments & Plugin$1.UserExports & Resolvers & {
|