@temporary-name/server 1.9.3-alpha.021f5c8fe9793dff332b025dce560e804c45a7b1
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/LICENSE +21 -0
- package/README.md +31 -0
- package/dist/adapters/aws-lambda/index.d.mts +30 -0
- package/dist/adapters/aws-lambda/index.d.ts +30 -0
- package/dist/adapters/aws-lambda/index.mjs +30 -0
- package/dist/adapters/fetch/index.d.mts +108 -0
- package/dist/adapters/fetch/index.d.ts +108 -0
- package/dist/adapters/fetch/index.mjs +171 -0
- package/dist/adapters/node/index.d.mts +83 -0
- package/dist/adapters/node/index.d.ts +83 -0
- package/dist/adapters/node/index.mjs +136 -0
- package/dist/adapters/standard/index.d.mts +42 -0
- package/dist/adapters/standard/index.d.ts +42 -0
- package/dist/adapters/standard/index.mjs +8 -0
- package/dist/helpers/index.d.mts +149 -0
- package/dist/helpers/index.d.ts +149 -0
- package/dist/helpers/index.mjs +168 -0
- package/dist/index.d.mts +1324 -0
- package/dist/index.d.ts +1324 -0
- package/dist/index.mjs +2199 -0
- package/dist/openapi/index.d.mts +220 -0
- package/dist/openapi/index.d.ts +220 -0
- package/dist/openapi/index.mjs +776 -0
- package/dist/plugins/index.d.mts +160 -0
- package/dist/plugins/index.d.ts +160 -0
- package/dist/plugins/index.mjs +288 -0
- package/dist/shared/server.BEHw7Eyx.mjs +247 -0
- package/dist/shared/server.BKSOrA6h.d.mts +192 -0
- package/dist/shared/server.BKSOrA6h.d.ts +192 -0
- package/dist/shared/server.BZtKt8i8.mjs +201 -0
- package/dist/shared/server.BeuTpcmO.d.mts +23 -0
- package/dist/shared/server.C1fnTLq0.d.mts +57 -0
- package/dist/shared/server.CMTfy2UB.mjs +293 -0
- package/dist/shared/server.CQyYNJ1H.d.ts +57 -0
- package/dist/shared/server.SLLuK6_v.d.ts +23 -0
- package/package.json +95 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1324 @@
|
|
|
1
|
+
import { AnySchema, ErrorMap, Meta, MergedErrorMap, Route, InferSchemaOutput, InferSchemaInput, EnhanceRouteOptions, AnyContractRouter, AnyContractProcedure, ContractProcedure, Schema, ContractRouter, ContractProcedureDef, InferContractRouterErrorMap, InferContractRouterMeta, ErrorFromErrorMap } from '@temporary-name/contract';
|
|
2
|
+
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@temporary-name/contract';
|
|
3
|
+
import { IntersectPick, ClientContext, MaybeOptionalOptions, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
|
|
4
|
+
export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, ORPCError, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, safe, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
|
|
5
|
+
import { C as Context, P as Procedure, M as Middleware, O as ORPCErrorConstructorMap, a as MergedInitialContext, b as MergedCurrentContext, c as MapInputMiddleware, d as CreateProcedureClientOptions, e as ProcedureClient, A as AnyMiddleware, L as Lazyable, f as AnyRouter, g as Lazy, h as AnyProcedure, i as ProcedureHandler, R as Router, I as InferRouterInitialContext } from './shared/server.BKSOrA6h.js';
|
|
6
|
+
export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, n as LAZY_SYMBOL, o as LazyMeta, v as MiddlewareNextFn, t as MiddlewareNextFnOptions, x as MiddlewareOptions, w as MiddlewareOutputFn, s as MiddlewareResult, k as ORPCErrorConstructorMapItem, j as ORPCErrorConstructorMapItemOptions, E as ProcedureClientInterceptorOptions, B as ProcedureDef, z as ProcedureHandlerOptions, l as createORPCErrorConstructorMap, F as createProcedureClient, r as getLazyMeta, q as isLazy, D as isProcedure, p as lazy, m as mergeCurrentContext, y as middlewareOutputFn, u as unlazy } from './shared/server.BKSOrA6h.js';
|
|
7
|
+
import * as core from 'zod/v4/core';
|
|
8
|
+
import { $ZodError, util } from 'zod/v4/core';
|
|
9
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
10
|
+
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
11
|
+
|
|
12
|
+
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
13
|
+
/**
|
|
14
|
+
* Adds type-safe custom errors.
|
|
15
|
+
* The provided errors are spared-merged with any existing errors.
|
|
16
|
+
*
|
|
17
|
+
* @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
18
|
+
*/
|
|
19
|
+
errors<U extends ErrorMap>(errors: U): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta>;
|
|
20
|
+
/**
|
|
21
|
+
* Sets or updates the metadata.
|
|
22
|
+
* The provided metadata is spared-merged with any existing metadata.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
25
|
+
*/
|
|
26
|
+
meta(meta: TMeta): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
27
|
+
/**
|
|
28
|
+
* Sets or updates the route definition.
|
|
29
|
+
* The provided route is spared-merged with any existing route.
|
|
30
|
+
* This option is typically relevant when integrating with OpenAPI.
|
|
31
|
+
*
|
|
32
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
33
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
34
|
+
*/
|
|
35
|
+
route(route: Route): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
36
|
+
/**
|
|
37
|
+
* Uses a middleware to modify the context or improve the pipeline.
|
|
38
|
+
*
|
|
39
|
+
* @info Supports both normal middleware and inline middleware implementations.
|
|
40
|
+
* @info Pass second argument to map the input.
|
|
41
|
+
* @note The current context must be satisfy middleware dependent-context
|
|
42
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
43
|
+
*/
|
|
44
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
45
|
+
/**
|
|
46
|
+
* Uses a middleware to modify the context or improve the pipeline.
|
|
47
|
+
*
|
|
48
|
+
* @info Supports both normal middleware and inline middleware implementations.
|
|
49
|
+
* @info Pass second argument to map the input.
|
|
50
|
+
* @note The current context must be satisfy middleware dependent-context
|
|
51
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
52
|
+
*/
|
|
53
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferSchemaOutput<TInputSchema>, UInput>): DecoratedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
54
|
+
/**
|
|
55
|
+
* Make this procedure callable (works like a function while still being a procedure).
|
|
56
|
+
*
|
|
57
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
58
|
+
*/
|
|
59
|
+
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta> & ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare function getRouter<T extends Lazyable<AnyRouter | undefined>>(router: T, path: readonly string[]): T extends Lazy<any> ? Lazy<AnyRouter | undefined> : Lazyable<AnyRouter | undefined>;
|
|
63
|
+
type AccessibleLazyRouter<T extends Lazyable<AnyRouter | undefined>> = T extends Lazy<infer U extends AnyRouter | undefined | Lazy<AnyRouter | undefined>> ? AccessibleLazyRouter<U> : T extends AnyProcedure | undefined ? Lazy<T> : Lazy<T> & {
|
|
64
|
+
[K in keyof T]: T[K] extends Lazyable<AnyRouter> ? AccessibleLazyRouter<T[K]> : never;
|
|
65
|
+
};
|
|
66
|
+
declare function createAccessibleLazyRouter<T extends Lazy<AnyRouter | undefined>>(lazied: T): AccessibleLazyRouter<T>;
|
|
67
|
+
type EnhancedRouter<T extends Lazyable<AnyRouter>, TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap> = T extends Lazy<infer U extends AnyRouter> ? AccessibleLazyRouter<EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>> : T extends (Procedure<infer UInitialContext, infer UCurrentContext, infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta>) ? Procedure<MergedInitialContext<TInitialContext, UInitialContext, TCurrentContext>, UCurrentContext, UInputSchema, UOutputSchema, MergedErrorMap<TErrorMap, UErrorMap>, UMeta> : {
|
|
68
|
+
[K in keyof T]: T[K] extends Lazyable<AnyRouter> ? EnhancedRouter<T[K], TInitialContext, TCurrentContext, TErrorMap> : never;
|
|
69
|
+
};
|
|
70
|
+
interface EnhanceRouterOptions<TErrorMap extends ErrorMap> extends EnhanceRouteOptions {
|
|
71
|
+
middlewares: readonly AnyMiddleware[];
|
|
72
|
+
errorMap: TErrorMap;
|
|
73
|
+
dedupeLeadingMiddlewares: boolean;
|
|
74
|
+
}
|
|
75
|
+
declare function enhanceRouter<T extends Lazyable<AnyRouter>, TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap>(router: T, options: EnhanceRouterOptions<TErrorMap>): EnhancedRouter<T, TInitialContext, TCurrentContext, TErrorMap>;
|
|
76
|
+
interface TraverseContractProceduresOptions {
|
|
77
|
+
router: AnyContractRouter | AnyRouter;
|
|
78
|
+
path: readonly string[];
|
|
79
|
+
}
|
|
80
|
+
interface TraverseContractProcedureCallbackOptions {
|
|
81
|
+
contract: AnyContractProcedure | AnyProcedure;
|
|
82
|
+
path: readonly string[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @deprecated Use `TraverseContractProcedureCallbackOptions` instead.
|
|
86
|
+
*/
|
|
87
|
+
type ContractProcedureCallbackOptions = TraverseContractProcedureCallbackOptions;
|
|
88
|
+
interface LazyTraverseContractProceduresOptions {
|
|
89
|
+
router: Lazy<AnyRouter>;
|
|
90
|
+
path: readonly string[];
|
|
91
|
+
}
|
|
92
|
+
declare function traverseContractProcedures(options: TraverseContractProceduresOptions, callback: (options: TraverseContractProcedureCallbackOptions) => void, lazyOptions?: LazyTraverseContractProceduresOptions[]): LazyTraverseContractProceduresOptions[];
|
|
93
|
+
declare function resolveContractProcedures(options: TraverseContractProceduresOptions, callback: (options: TraverseContractProcedureCallbackOptions) => void): Promise<void>;
|
|
94
|
+
type UnlaziedRouter<T extends AnyRouter> = T extends AnyProcedure ? T : {
|
|
95
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? UnlaziedRouter<U> : never;
|
|
96
|
+
};
|
|
97
|
+
declare function unlazyRouter<T extends AnyRouter>(router: T): Promise<UnlaziedRouter<T>>;
|
|
98
|
+
|
|
99
|
+
declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ContractProcedure<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
100
|
+
/**
|
|
101
|
+
* This property holds the defined options.
|
|
102
|
+
*/
|
|
103
|
+
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
104
|
+
constructor(def: BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>);
|
|
105
|
+
/**
|
|
106
|
+
* Adds type-safe custom errors to the contract.
|
|
107
|
+
* The provided errors are spared-merged with any existing errors in the contract.
|
|
108
|
+
*
|
|
109
|
+
* @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
110
|
+
*/
|
|
111
|
+
errors<U extends ErrorMap>(errors: U): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
|
|
112
|
+
/**
|
|
113
|
+
* Sets or updates the metadata for the contract.
|
|
114
|
+
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
115
|
+
*
|
|
116
|
+
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
117
|
+
*/
|
|
118
|
+
meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
119
|
+
/**
|
|
120
|
+
* Sets or updates the route definition for the contract.
|
|
121
|
+
* The provided route is spared-merged with any existing route in the contract.
|
|
122
|
+
* This option is typically relevant when integrating with OpenAPI.
|
|
123
|
+
*
|
|
124
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
125
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
126
|
+
*/
|
|
127
|
+
route(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
128
|
+
/**
|
|
129
|
+
* Defines the input validation schema.
|
|
130
|
+
*
|
|
131
|
+
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Input Validation Docs}
|
|
132
|
+
*/
|
|
133
|
+
input<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, USchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
134
|
+
/**
|
|
135
|
+
* Defines the output validation schema.
|
|
136
|
+
*
|
|
137
|
+
* @see {@link https://orpc.unnoq.com/docs/procedure#input-output-validation Output Validation Docs}
|
|
138
|
+
*/
|
|
139
|
+
output<USchema extends AnySchema>(schema: USchema): ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, USchema, TErrorMap, TMeta, TGateName>;
|
|
140
|
+
/**
|
|
141
|
+
* Uses a middleware to modify the context or improve the pipeline.
|
|
142
|
+
*
|
|
143
|
+
* @info Supports both normal middleware and inline middleware implementations.
|
|
144
|
+
* @note The current context must be satisfy middleware dependent-context
|
|
145
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
146
|
+
*/
|
|
147
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
148
|
+
useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
|
|
149
|
+
isGateEnabled: typeof isGateEnabled;
|
|
150
|
+
}>, TInputSchema, TOutputSchema, TErrorMap, TMeta, TInferredGateName>;
|
|
151
|
+
/**
|
|
152
|
+
* Defines the handler of the procedure.
|
|
153
|
+
*
|
|
154
|
+
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
155
|
+
*/
|
|
156
|
+
handler<UFuncOutput>(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, UFuncOutput, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TInputSchema, Schema<UFuncOutput, UFuncOutput>, TErrorMap, TMeta>;
|
|
157
|
+
}
|
|
158
|
+
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ProcedureBuilder<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName> {
|
|
159
|
+
/**
|
|
160
|
+
* Prefixes all procedures in the router.
|
|
161
|
+
* The provided prefix is post-appended to any existing router prefix.
|
|
162
|
+
*
|
|
163
|
+
* @note This option does not affect procedures that do not define a path in their route definition.
|
|
164
|
+
*
|
|
165
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
166
|
+
*/
|
|
167
|
+
prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
168
|
+
/**
|
|
169
|
+
* Adds tags to all procedures in the router.
|
|
170
|
+
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
171
|
+
*
|
|
172
|
+
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
173
|
+
*/
|
|
174
|
+
tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
|
|
175
|
+
/**
|
|
176
|
+
* Applies all of the previously defined options to the specified router.
|
|
177
|
+
*
|
|
178
|
+
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
179
|
+
*/
|
|
180
|
+
router<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>;
|
|
181
|
+
/**
|
|
182
|
+
* Create a lazy router
|
|
183
|
+
* And applies all of the previously defined options to the specified router.
|
|
184
|
+
*
|
|
185
|
+
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
186
|
+
*/
|
|
187
|
+
lazyRoute<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(loader: () => Promise<{
|
|
188
|
+
default: U;
|
|
189
|
+
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, TErrorMap>;
|
|
190
|
+
}
|
|
191
|
+
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, any, TErrorMap, TMeta, any>, 'prefix' | 'tag' | 'router' | 'lazyRoute'> {
|
|
192
|
+
/**
|
|
193
|
+
* This property holds the defined options.
|
|
194
|
+
*/
|
|
195
|
+
'~orpc': EnhanceRouterOptions<TErrorMap>;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> extends Middleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta> {
|
|
199
|
+
/**
|
|
200
|
+
* Change the expected input type by providing a map function.
|
|
201
|
+
*/
|
|
202
|
+
mapInput<UInput>(map: MapInputMiddleware<UInput, TInput>): DecoratedMiddleware<TInContext, TOutContext, UInput, TOutput, TErrorConstructorMap, TMeta>;
|
|
203
|
+
/**
|
|
204
|
+
* Concatenates two middlewares.
|
|
205
|
+
*
|
|
206
|
+
* @info Pass second argument to map the input.
|
|
207
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware#concatenation Middleware Concatenation Docs}
|
|
208
|
+
*/
|
|
209
|
+
concat<UOutContext extends IntersectPick<MergedCurrentContext<TInContext, TOutContext>, UOutContext>, UInput extends TInput, UInContext extends Context = MergedCurrentContext<TInContext, TOutContext>>(middleware: Middleware<UInContext | MergedCurrentContext<TInContext, TOutContext>, UOutContext, UInput, TOutput, TErrorConstructorMap, TMeta>): DecoratedMiddleware<MergedInitialContext<TInContext, UInContext, MergedCurrentContext<TInContext, TOutContext>>, MergedCurrentContext<TOutContext, UOutContext>, UInput, TOutput, TErrorConstructorMap, TMeta>;
|
|
210
|
+
/**
|
|
211
|
+
* Concatenates two middlewares.
|
|
212
|
+
*
|
|
213
|
+
* @info Pass second argument to map the input.
|
|
214
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware#concatenation Middleware Concatenation Docs}
|
|
215
|
+
*/
|
|
216
|
+
concat<UOutContext extends IntersectPick<MergedCurrentContext<TInContext, TOutContext>, UOutContext>, UInput extends TInput, UMappedInput, UInContext extends Context = MergedCurrentContext<TInContext, TOutContext>>(middleware: Middleware<UInContext | MergedCurrentContext<TInContext, TOutContext>, UOutContext, UMappedInput, TOutput, TErrorConstructorMap, TMeta>, mapInput: MapInputMiddleware<UInput, UMappedInput>): DecoratedMiddleware<MergedInitialContext<TInContext, UInContext, MergedCurrentContext<TInContext, TOutContext>>, MergedCurrentContext<TOutContext, UOutContext>, UInput, TOutput, TErrorConstructorMap, TMeta>;
|
|
217
|
+
}
|
|
218
|
+
declare function decorateMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta>(middleware: Middleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta>): DecoratedMiddleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta>;
|
|
219
|
+
|
|
220
|
+
/** An Error-like class used to store Zod validation issues. */
|
|
221
|
+
interface ZodError<T = unknown> extends $ZodError<T> {
|
|
222
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
223
|
+
format(): core.$ZodFormattedError<T>;
|
|
224
|
+
format<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFormattedError<T, U>;
|
|
225
|
+
/** @deprecated Use the `z.treeifyError(err)` function instead. */
|
|
226
|
+
flatten(): core.$ZodFlattenedError<T>;
|
|
227
|
+
flatten<U>(mapper: (issue: core.$ZodIssue) => U): core.$ZodFlattenedError<T, U>;
|
|
228
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
229
|
+
addIssue(issue: core.$ZodIssue): void;
|
|
230
|
+
/** @deprecated Push directly to `.issues` instead. */
|
|
231
|
+
addIssues(issues: core.$ZodIssue[]): void;
|
|
232
|
+
/** @deprecated Check `err.issues.length === 0` instead. */
|
|
233
|
+
isEmpty: boolean;
|
|
234
|
+
}
|
|
235
|
+
declare const ZodError: core.$constructor<ZodError>;
|
|
236
|
+
|
|
237
|
+
type ZodSafeParseResult<T> = ZodSafeParseSuccess<T> | ZodSafeParseError<T>;
|
|
238
|
+
type ZodSafeParseSuccess<T> = {
|
|
239
|
+
success: true;
|
|
240
|
+
data: T;
|
|
241
|
+
error?: never;
|
|
242
|
+
};
|
|
243
|
+
type ZodSafeParseError<T> = {
|
|
244
|
+
success: false;
|
|
245
|
+
data?: never;
|
|
246
|
+
error: ZodError<T>;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
type IsGateEnabled = (gate: string) => boolean;
|
|
250
|
+
declare const gatingContext: AsyncLocalStorage<IsGateEnabled>;
|
|
251
|
+
declare function isGateIssueRaw(issue: core.$ZodRawIssue): boolean;
|
|
252
|
+
declare function isGateIssue(issue: core.$ZodIssue): boolean;
|
|
253
|
+
interface $ZodGateDef<T extends core.SomeType = core.$ZodType> extends core.$ZodOptionalDef<T> {
|
|
254
|
+
gateName: string;
|
|
255
|
+
}
|
|
256
|
+
interface $ZodGateInternals<T extends core.SomeType = core.$ZodType> extends core.$ZodOptionalInternals<T> {
|
|
257
|
+
def: $ZodGateDef<T>;
|
|
258
|
+
}
|
|
259
|
+
interface $ZodGate<T extends core.SomeType = core.$ZodType> extends core.$ZodType {
|
|
260
|
+
_zod: $ZodGateInternals<T>;
|
|
261
|
+
}
|
|
262
|
+
declare const $ZodGate: core.$constructor<$ZodGate>;
|
|
263
|
+
interface ZodGate<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<$ZodGateInternals<T>, K>, $ZodGate<T> {
|
|
264
|
+
unwrap(): T;
|
|
265
|
+
}
|
|
266
|
+
declare const ZodGate: core.$constructor<ZodGate>;
|
|
267
|
+
declare function gate<T extends core.SomeType, K extends KrustyInternals>(innerType: T, gateName: K['gateNames']): ZodGate<T, K>;
|
|
268
|
+
|
|
269
|
+
type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
|
|
270
|
+
[K in keyof Ext]: K extends keyof Base ? core.output<Ext[K]> extends core.output<Base[K]> ? core.input<Ext[K]> extends core.input<Base[K]> ? Ext[K] : never : never : Ext[K];
|
|
271
|
+
};
|
|
272
|
+
interface ZodObject<
|
|
273
|
+
/** @ts-expect-error Cast variance */
|
|
274
|
+
out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$strip, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodObjectInternals<Shape, Config>, K>, core.$ZodObject<Shape, Config> {
|
|
275
|
+
shape: Shape;
|
|
276
|
+
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>, K>;
|
|
277
|
+
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
278
|
+
catchall<T extends core.SomeType>(schema: T): ZodObject<Shape, core.$catchall<T>, K>;
|
|
279
|
+
/** @deprecated Use `z.looseObject()` or `.loose()` instead. */
|
|
280
|
+
passthrough(): ZodObject<Shape, core.$loose, K>;
|
|
281
|
+
/** Consider `z.looseObject(A.shape)` instead */
|
|
282
|
+
loose(): ZodObject<Shape, core.$loose, K>;
|
|
283
|
+
/** Consider `z.strictObject(A.shape)` instead */
|
|
284
|
+
strict(): ZodObject<Shape, core.$strict, K>;
|
|
285
|
+
/** This is the default behavior. This method call is likely unnecessary. */
|
|
286
|
+
strip(): ZodObject<Shape, core.$strip, K>;
|
|
287
|
+
extend<U extends core.$ZodLooseShape>(shape: U): ZodObject<util.Extend<Shape, U>, Config, K>;
|
|
288
|
+
safeExtend<U extends core.$ZodLooseShape>(shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, core.SomeType>>): ZodObject<util.Extend<Shape, U>, Config, K>;
|
|
289
|
+
/**
|
|
290
|
+
* @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
|
|
291
|
+
*/
|
|
292
|
+
merge<U extends ZodObject>(other: U): ZodObject<util.Extend<Shape, U['shape']>, U['_zod']['config'], K>;
|
|
293
|
+
pick<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config, K>;
|
|
294
|
+
omit<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config, K>;
|
|
295
|
+
partial(): ZodObject<{
|
|
296
|
+
[k in keyof Shape]: ZodOptional<Shape[k], K>;
|
|
297
|
+
}, Config, K>;
|
|
298
|
+
partial<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<{
|
|
299
|
+
[k in keyof Shape]: k extends keyof M ? ZodOptional<Shape[k], K> : Shape[k];
|
|
300
|
+
}, Config, K>;
|
|
301
|
+
required(): ZodObject<{
|
|
302
|
+
[k in keyof Shape]: ZodNonOptional<Shape[k], K>;
|
|
303
|
+
}, Config, K>;
|
|
304
|
+
required<M extends util.Mask<keyof Shape>>(mask: M): ZodObject<{
|
|
305
|
+
[k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k], K> : Shape[k];
|
|
306
|
+
}, Config, K>;
|
|
307
|
+
}
|
|
308
|
+
declare const ZodObject: core.$constructor<ZodObject>;
|
|
309
|
+
declare function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>, K extends KrustyInternals = KrustyInternals>(shape?: T, params?: string | core.$ZodObjectParams): ZodObject<util.Writeable<T>, core.$strip, K>;
|
|
310
|
+
declare function strictObject<T extends core.$ZodLooseShape, K extends KrustyInternals>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$strict, K>;
|
|
311
|
+
declare function looseObject<T extends core.$ZodLooseShape, K extends KrustyInternals>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$loose, K>;
|
|
312
|
+
|
|
313
|
+
interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[], K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodUnionInternals<T>, K>, core.$ZodUnion<T> {
|
|
314
|
+
options: T;
|
|
315
|
+
}
|
|
316
|
+
declare const ZodUnion: core.$constructor<ZodUnion>;
|
|
317
|
+
declare function union<const T extends readonly core.SomeType[], K extends KrustyInternals>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T, K>;
|
|
318
|
+
interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$ZodType[], Disc extends string = string, K extends KrustyInternals = KrustyInternals> extends ZodUnion<Options, K>, core.$ZodDiscriminatedUnion<Options, Disc> {
|
|
319
|
+
_zod: core.$ZodDiscriminatedUnionInternals<Options, Disc>;
|
|
320
|
+
def: core.$ZodDiscriminatedUnionDef<Options, Disc>;
|
|
321
|
+
}
|
|
322
|
+
declare const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion>;
|
|
323
|
+
declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string, K extends KrustyInternals = KrustyInternals>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types, Disc, K>;
|
|
324
|
+
|
|
325
|
+
interface KrustyInternals<GateNames extends string = string> {
|
|
326
|
+
gateNames: GateNames;
|
|
327
|
+
}
|
|
328
|
+
interface _KrustyType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals, out KInternals extends KrustyInternals = KrustyInternals> extends KrustyType<any, any, Internals, KInternals> {
|
|
329
|
+
}
|
|
330
|
+
interface KrustyType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>, KInternals extends KrustyInternals = KrustyInternals> extends core.$ZodType<Output, Input, Internals> {
|
|
331
|
+
def: Internals['def'];
|
|
332
|
+
type: Internals['def']['type'];
|
|
333
|
+
check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
|
|
334
|
+
clone(def?: Internals['def'], params?: {
|
|
335
|
+
parent: boolean;
|
|
336
|
+
}): this;
|
|
337
|
+
register<R extends core.$ZodRegistry>(registry: R, ...meta: this extends R['_schema'] ? undefined extends R['_meta'] ? [
|
|
338
|
+
core.$replace<R['_meta'], this>?
|
|
339
|
+
] : [core.$replace<R['_meta'], this>] : ['Incompatible schema']): this;
|
|
340
|
+
brand<T extends PropertyKey = PropertyKey>(value?: T): PropertyKey extends T ? this : core.$ZodBranded<this, T>;
|
|
341
|
+
parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
|
|
342
|
+
safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): ZodSafeParseResult<core.output<this>>;
|
|
343
|
+
parseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
|
|
344
|
+
safeParseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<ZodSafeParseResult<core.output<this>>>;
|
|
345
|
+
spa: (data: unknown, params?: core.ParseContext<core.$ZodIssue>) => Promise<ZodSafeParseResult<core.output<this>>>;
|
|
346
|
+
encode(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): core.input<this>;
|
|
347
|
+
decode(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
|
|
348
|
+
encodeAsync(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<core.input<this>>;
|
|
349
|
+
decodeAsync(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
|
|
350
|
+
safeEncode(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): ZodSafeParseResult<core.input<this>>;
|
|
351
|
+
safeDecode(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): ZodSafeParseResult<core.output<this>>;
|
|
352
|
+
safeEncodeAsync(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<ZodSafeParseResult<core.input<this>>>;
|
|
353
|
+
safeDecodeAsync(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<ZodSafeParseResult<core.output<this>>>;
|
|
354
|
+
refine(check: (arg: core.output<this>) => unknown | Promise<unknown>, params?: string | core.$ZodCustomParams): this;
|
|
355
|
+
superRefine(refinement: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => void | Promise<void>): this;
|
|
356
|
+
overwrite(fn: (x: core.output<this>) => core.output<this>): this;
|
|
357
|
+
gate(gateName: KInternals['gateNames']): ZodGate<this, KInternals>;
|
|
358
|
+
optional(): ZodOptional<this, KInternals>;
|
|
359
|
+
nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this, KInternals>;
|
|
360
|
+
nullable(): ZodNullable<this, KInternals>;
|
|
361
|
+
nullish(): ZodOptional<ZodNullable<this, KInternals>, KInternals>;
|
|
362
|
+
default(def: util.NoUndefined<core.output<this>>): ZodDefault<this, KInternals>;
|
|
363
|
+
default(def: () => util.NoUndefined<core.output<this>>): ZodDefault<this, KInternals>;
|
|
364
|
+
prefault(def: () => core.input<this>): ZodPrefault<this, KInternals>;
|
|
365
|
+
prefault(def: core.input<this>): ZodPrefault<this, KInternals>;
|
|
366
|
+
array(): ZodArray<this, KInternals>;
|
|
367
|
+
or<T extends core.SomeType>(option: T): ZodUnion<[this, T], KInternals>;
|
|
368
|
+
and<T extends core.SomeType>(incoming: T): ZodIntersection<this, T, KInternals>;
|
|
369
|
+
transform<NewOut>(transform: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>, KInternals>;
|
|
370
|
+
catch(def: core.output<this>): ZodCatch<this, KInternals>;
|
|
371
|
+
catch(def: (ctx: core.$ZodCatchCtx) => core.output<this>): ZodCatch<this, KInternals>;
|
|
372
|
+
pipe<T extends core.$ZodType<any, core.output<this>>>(target: T | core.$ZodType<any, core.output<this>>): ZodPipe<this, T, KInternals>;
|
|
373
|
+
readonly(): ZodReadonly<this, KInternals>;
|
|
374
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
|
|
375
|
+
describe(description: string): this;
|
|
376
|
+
description?: string;
|
|
377
|
+
/** Returns the metadata associated with this instance in `z.globalRegistry` */
|
|
378
|
+
meta(): core.$replace<core.GlobalMeta, this> | undefined;
|
|
379
|
+
/** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
|
|
380
|
+
meta(data: core.$replace<core.GlobalMeta, this>): this;
|
|
381
|
+
}
|
|
382
|
+
declare const KrustyType: core.$constructor<KrustyType>;
|
|
383
|
+
interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
384
|
+
format: string | null;
|
|
385
|
+
minLength: number | null;
|
|
386
|
+
maxLength: number | null;
|
|
387
|
+
regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
|
|
388
|
+
includes(value: string, params?: core.$ZodCheckIncludesParams): this;
|
|
389
|
+
startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
|
|
390
|
+
endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
|
|
391
|
+
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
392
|
+
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
393
|
+
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
394
|
+
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
395
|
+
lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;
|
|
396
|
+
uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;
|
|
397
|
+
trim(): this;
|
|
398
|
+
normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD' | (string & {})): this;
|
|
399
|
+
toLowerCase(): this;
|
|
400
|
+
toUpperCase(): this;
|
|
401
|
+
}
|
|
402
|
+
/** @internal */
|
|
403
|
+
declare const _ZodString: core.$constructor<_ZodString>;
|
|
404
|
+
interface ZodString<K extends KrustyInternals = KrustyInternals> extends _ZodString<core.$ZodStringInternals<string>, K> {
|
|
405
|
+
/** @deprecated Use `z.email()` instead. */
|
|
406
|
+
email(params?: string | core.$ZodCheckEmailParams): this;
|
|
407
|
+
/** @deprecated Use `z.url()` instead. */
|
|
408
|
+
url(params?: string | core.$ZodCheckURLParams): this;
|
|
409
|
+
/** @deprecated Use `z.jwt()` instead. */
|
|
410
|
+
jwt(params?: string | core.$ZodCheckJWTParams): this;
|
|
411
|
+
/** @deprecated Use `z.emoji()` instead. */
|
|
412
|
+
emoji(params?: string | core.$ZodCheckEmojiParams): this;
|
|
413
|
+
/** @deprecated Use `z.guid()` instead. */
|
|
414
|
+
guid(params?: string | core.$ZodCheckGUIDParams): this;
|
|
415
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
416
|
+
uuid(params?: string | core.$ZodCheckUUIDParams): this;
|
|
417
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
418
|
+
uuidv4(params?: string | core.$ZodCheckUUIDParams): this;
|
|
419
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
420
|
+
uuidv6(params?: string | core.$ZodCheckUUIDParams): this;
|
|
421
|
+
/** @deprecated Use `z.uuid()` instead. */
|
|
422
|
+
uuidv7(params?: string | core.$ZodCheckUUIDParams): this;
|
|
423
|
+
/** @deprecated Use `z.nanoid()` instead. */
|
|
424
|
+
nanoid(params?: string | core.$ZodCheckNanoIDParams): this;
|
|
425
|
+
/** @deprecated Use `z.guid()` instead. */
|
|
426
|
+
guid(params?: string | core.$ZodCheckGUIDParams): this;
|
|
427
|
+
/** @deprecated Use `z.cuid()` instead. */
|
|
428
|
+
cuid(params?: string | core.$ZodCheckCUIDParams): this;
|
|
429
|
+
/** @deprecated Use `z.cuid2()` instead. */
|
|
430
|
+
cuid2(params?: string | core.$ZodCheckCUID2Params): this;
|
|
431
|
+
/** @deprecated Use `z.ulid()` instead. */
|
|
432
|
+
ulid(params?: string | core.$ZodCheckULIDParams): this;
|
|
433
|
+
/** @deprecated Use `z.base64()` instead. */
|
|
434
|
+
base64(params?: string | core.$ZodCheckBase64Params): this;
|
|
435
|
+
/** @deprecated Use `z.base64url()` instead. */
|
|
436
|
+
base64url(params?: string | core.$ZodCheckBase64URLParams): this;
|
|
437
|
+
/** @deprecated Use `z.xid()` instead. */
|
|
438
|
+
xid(params?: string | core.$ZodCheckXIDParams): this;
|
|
439
|
+
/** @deprecated Use `z.ksuid()` instead. */
|
|
440
|
+
ksuid(params?: string | core.$ZodCheckKSUIDParams): this;
|
|
441
|
+
/** @deprecated Use `z.ipv4()` instead. */
|
|
442
|
+
ipv4(params?: string | core.$ZodCheckIPv4Params): this;
|
|
443
|
+
/** @deprecated Use `z.ipv6()` instead. */
|
|
444
|
+
ipv6(params?: string | core.$ZodCheckIPv6Params): this;
|
|
445
|
+
/** @deprecated Use `z.cidrv4()` instead. */
|
|
446
|
+
cidrv4(params?: string | core.$ZodCheckCIDRv4Params): this;
|
|
447
|
+
/** @deprecated Use `z.cidrv6()` instead. */
|
|
448
|
+
cidrv6(params?: string | core.$ZodCheckCIDRv6Params): this;
|
|
449
|
+
/** @deprecated Use `z.e164()` instead. */
|
|
450
|
+
e164(params?: string | core.$ZodCheckE164Params): this;
|
|
451
|
+
/** @deprecated Use `z.iso.datetime()` instead. */
|
|
452
|
+
datetime(params?: string | core.$ZodCheckISODateTimeParams): this;
|
|
453
|
+
/** @deprecated Use `z.iso.date()` instead. */
|
|
454
|
+
date(params?: string | core.$ZodCheckISODateParams): this;
|
|
455
|
+
/** @deprecated Use `z.iso.time()` instead. */
|
|
456
|
+
time(params?: string | core.$ZodCheckISOTimeParams): this;
|
|
457
|
+
/** @deprecated Use `z.iso.duration()` instead. */
|
|
458
|
+
duration(params?: string | core.$ZodCheckISODurationParams): this;
|
|
459
|
+
}
|
|
460
|
+
declare const ZodString: core.$constructor<ZodString>;
|
|
461
|
+
declare function string(params?: string | core.$ZodStringParams): ZodString;
|
|
462
|
+
declare function string<T extends string>(params?: string | core.$ZodStringParams): core.$ZodType<T, T>;
|
|
463
|
+
interface ZodStringFormat<Format extends string = string, K extends KrustyInternals = KrustyInternals> extends _ZodString<core.$ZodStringFormatInternals<Format>, K> {
|
|
464
|
+
}
|
|
465
|
+
declare const ZodStringFormat: core.$constructor<ZodStringFormat>;
|
|
466
|
+
interface ZodEmail<K extends KrustyInternals = KrustyInternals> extends ZodStringFormat<'email', K> {
|
|
467
|
+
_zod: core.$ZodEmailInternals;
|
|
468
|
+
}
|
|
469
|
+
declare const ZodEmail: core.$constructor<ZodEmail>;
|
|
470
|
+
declare function email(params?: string | core.$ZodEmailParams): ZodEmail;
|
|
471
|
+
interface ZodGUID<K extends KrustyInternals = KrustyInternals> extends ZodStringFormat<'guid', K> {
|
|
472
|
+
_zod: core.$ZodGUIDInternals;
|
|
473
|
+
}
|
|
474
|
+
declare const ZodGUID: core.$constructor<ZodGUID>;
|
|
475
|
+
declare function guid(params?: string | core.$ZodGUIDParams): ZodGUID;
|
|
476
|
+
interface ZodUUID<K extends KrustyInternals = KrustyInternals> extends ZodStringFormat<'uuid', K> {
|
|
477
|
+
_zod: core.$ZodUUIDInternals;
|
|
478
|
+
}
|
|
479
|
+
declare const ZodUUID: core.$constructor<ZodUUID>;
|
|
480
|
+
declare function uuid(params?: string | core.$ZodUUIDParams): ZodUUID;
|
|
481
|
+
declare function uuidv4(params?: string | core.$ZodUUIDv4Params): ZodUUID;
|
|
482
|
+
declare function uuidv6(params?: string | core.$ZodUUIDv6Params): ZodUUID;
|
|
483
|
+
declare function uuidv7(params?: string | core.$ZodUUIDv7Params): ZodUUID;
|
|
484
|
+
interface ZodURL extends ZodStringFormat<'url'> {
|
|
485
|
+
_zod: core.$ZodURLInternals;
|
|
486
|
+
}
|
|
487
|
+
declare const ZodURL: core.$constructor<ZodURL>;
|
|
488
|
+
declare function url(params?: string | core.$ZodURLParams): ZodURL;
|
|
489
|
+
declare function httpUrl(params?: string | Omit<core.$ZodURLParams, 'protocol' | 'hostname'>): ZodURL;
|
|
490
|
+
interface ZodEmoji extends ZodStringFormat<'emoji'> {
|
|
491
|
+
_zod: core.$ZodEmojiInternals;
|
|
492
|
+
}
|
|
493
|
+
declare const ZodEmoji: core.$constructor<ZodEmoji>;
|
|
494
|
+
declare function emoji(params?: string | core.$ZodEmojiParams): ZodEmoji;
|
|
495
|
+
interface ZodNanoID extends ZodStringFormat<'nanoid'> {
|
|
496
|
+
_zod: core.$ZodNanoIDInternals;
|
|
497
|
+
}
|
|
498
|
+
declare const ZodNanoID: core.$constructor<ZodNanoID>;
|
|
499
|
+
declare function nanoid(params?: string | core.$ZodNanoIDParams): ZodNanoID;
|
|
500
|
+
interface ZodCUID extends ZodStringFormat<'cuid'> {
|
|
501
|
+
_zod: core.$ZodCUIDInternals;
|
|
502
|
+
}
|
|
503
|
+
declare const ZodCUID: core.$constructor<ZodCUID>;
|
|
504
|
+
declare function cuid(params?: string | core.$ZodCUIDParams): ZodCUID;
|
|
505
|
+
interface ZodCUID2 extends ZodStringFormat<'cuid2'> {
|
|
506
|
+
_zod: core.$ZodCUID2Internals;
|
|
507
|
+
}
|
|
508
|
+
declare const ZodCUID2: core.$constructor<ZodCUID2>;
|
|
509
|
+
declare function cuid2(params?: string | core.$ZodCUID2Params): ZodCUID2;
|
|
510
|
+
interface ZodULID extends ZodStringFormat<'ulid'> {
|
|
511
|
+
_zod: core.$ZodULIDInternals;
|
|
512
|
+
}
|
|
513
|
+
declare const ZodULID: core.$constructor<ZodULID>;
|
|
514
|
+
declare function ulid(params?: string | core.$ZodULIDParams): ZodULID;
|
|
515
|
+
interface ZodXID extends ZodStringFormat<'xid'> {
|
|
516
|
+
_zod: core.$ZodXIDInternals;
|
|
517
|
+
}
|
|
518
|
+
declare const ZodXID: core.$constructor<ZodXID>;
|
|
519
|
+
declare function xid(params?: string | core.$ZodXIDParams): ZodXID;
|
|
520
|
+
interface ZodKSUID extends ZodStringFormat<'ksuid'> {
|
|
521
|
+
_zod: core.$ZodKSUIDInternals;
|
|
522
|
+
}
|
|
523
|
+
declare const ZodKSUID: core.$constructor<ZodKSUID>;
|
|
524
|
+
declare function ksuid(params?: string | core.$ZodKSUIDParams): ZodKSUID;
|
|
525
|
+
interface ZodIPv4 extends ZodStringFormat<'ipv4'> {
|
|
526
|
+
_zod: core.$ZodIPv4Internals;
|
|
527
|
+
}
|
|
528
|
+
declare const ZodIPv4: core.$constructor<ZodIPv4>;
|
|
529
|
+
declare function ipv4(params?: string | core.$ZodIPv4Params): ZodIPv4;
|
|
530
|
+
interface ZodIPv6 extends ZodStringFormat<'ipv6'> {
|
|
531
|
+
_zod: core.$ZodIPv6Internals;
|
|
532
|
+
}
|
|
533
|
+
declare const ZodIPv6: core.$constructor<ZodIPv6>;
|
|
534
|
+
declare function ipv6(params?: string | core.$ZodIPv6Params): ZodIPv6;
|
|
535
|
+
interface ZodCIDRv4 extends ZodStringFormat<'cidrv4'> {
|
|
536
|
+
_zod: core.$ZodCIDRv4Internals;
|
|
537
|
+
}
|
|
538
|
+
declare const ZodCIDRv4: core.$constructor<ZodCIDRv4>;
|
|
539
|
+
declare function cidrv4(params?: string | core.$ZodCIDRv4Params): ZodCIDRv4;
|
|
540
|
+
interface ZodCIDRv6 extends ZodStringFormat<'cidrv6'> {
|
|
541
|
+
_zod: core.$ZodCIDRv6Internals;
|
|
542
|
+
}
|
|
543
|
+
declare const ZodCIDRv6: core.$constructor<ZodCIDRv6>;
|
|
544
|
+
declare function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodCIDRv6;
|
|
545
|
+
interface ZodBase64 extends ZodStringFormat<'base64'> {
|
|
546
|
+
_zod: core.$ZodBase64Internals;
|
|
547
|
+
}
|
|
548
|
+
declare const ZodBase64: core.$constructor<ZodBase64>;
|
|
549
|
+
declare function base64(params?: string | core.$ZodBase64Params): ZodBase64;
|
|
550
|
+
interface ZodBase64URL extends ZodStringFormat<'base64url'> {
|
|
551
|
+
_zod: core.$ZodBase64URLInternals;
|
|
552
|
+
}
|
|
553
|
+
declare const ZodBase64URL: core.$constructor<ZodBase64URL>;
|
|
554
|
+
declare function base64url(params?: string | core.$ZodBase64URLParams): ZodBase64URL;
|
|
555
|
+
interface ZodE164 extends ZodStringFormat<'e164'> {
|
|
556
|
+
_zod: core.$ZodE164Internals;
|
|
557
|
+
}
|
|
558
|
+
declare const ZodE164: core.$constructor<ZodE164>;
|
|
559
|
+
declare function e164(params?: string | core.$ZodE164Params): ZodE164;
|
|
560
|
+
interface ZodJWT extends ZodStringFormat<'jwt'> {
|
|
561
|
+
_zod: core.$ZodJWTInternals;
|
|
562
|
+
}
|
|
563
|
+
declare const ZodJWT: core.$constructor<ZodJWT>;
|
|
564
|
+
declare function jwt(params?: string | core.$ZodJWTParams): ZodJWT;
|
|
565
|
+
interface ZodCustomStringFormat<Format extends string = string> extends ZodStringFormat<Format>, core.$ZodCustomStringFormat<Format> {
|
|
566
|
+
_zod: core.$ZodCustomStringFormatInternals<Format>;
|
|
567
|
+
}
|
|
568
|
+
declare const ZodCustomStringFormat: core.$constructor<ZodCustomStringFormat>;
|
|
569
|
+
declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<Format>;
|
|
570
|
+
declare function hostname(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<'hostname'>;
|
|
571
|
+
declare function hex(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<'hex'>;
|
|
572
|
+
declare function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = 'hex'>(alg: Alg, params?: {
|
|
573
|
+
enc?: Enc;
|
|
574
|
+
} & core.$ZodStringFormatParams): ZodCustomStringFormat<`${Alg}_${Enc}`>;
|
|
575
|
+
interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals, K extends KrustyInternals = KrustyInternals> extends _KrustyType<Internals, K> {
|
|
576
|
+
gt(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
577
|
+
/** Identical to .min() */
|
|
578
|
+
gte(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
579
|
+
min(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
580
|
+
lt(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
581
|
+
/** Identical to .max() */
|
|
582
|
+
lte(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
583
|
+
max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
|
|
584
|
+
/** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
|
|
585
|
+
int(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
586
|
+
/** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
|
|
587
|
+
safe(params?: string | core.$ZodCheckNumberFormatParams): this;
|
|
588
|
+
positive(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
589
|
+
nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
590
|
+
negative(params?: string | core.$ZodCheckLessThanParams): this;
|
|
591
|
+
nonpositive(params?: string | core.$ZodCheckLessThanParams): this;
|
|
592
|
+
multipleOf(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
593
|
+
/** @deprecated Use `.multipleOf()` instead. */
|
|
594
|
+
step(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
595
|
+
/** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
|
|
596
|
+
finite(params?: unknown): this;
|
|
597
|
+
minValue: number | null;
|
|
598
|
+
maxValue: number | null;
|
|
599
|
+
/** @deprecated Check the `format` property instead. */
|
|
600
|
+
isInt: boolean;
|
|
601
|
+
/** @deprecated Number schemas no longer accept infinite values, so this always returns `true`. */
|
|
602
|
+
isFinite: boolean;
|
|
603
|
+
format: string | null;
|
|
604
|
+
}
|
|
605
|
+
interface ZodNumber<K extends KrustyInternals = KrustyInternals> extends _ZodNumber<core.$ZodNumberInternals<number>, K> {
|
|
606
|
+
}
|
|
607
|
+
declare const ZodNumber: core.$constructor<ZodNumber>;
|
|
608
|
+
declare function number(params?: string | core.$ZodNumberParams): ZodNumber;
|
|
609
|
+
interface ZodNumberFormat extends ZodNumber {
|
|
610
|
+
_zod: core.$ZodNumberFormatInternals;
|
|
611
|
+
}
|
|
612
|
+
declare const ZodNumberFormat: core.$constructor<ZodNumberFormat>;
|
|
613
|
+
interface ZodInt extends ZodNumberFormat {
|
|
614
|
+
}
|
|
615
|
+
declare function int(params?: string | core.$ZodCheckNumberFormatParams): ZodInt;
|
|
616
|
+
interface ZodFloat32 extends ZodNumberFormat {
|
|
617
|
+
}
|
|
618
|
+
declare function float32(params?: string | core.$ZodCheckNumberFormatParams): ZodFloat32;
|
|
619
|
+
interface ZodFloat64 extends ZodNumberFormat {
|
|
620
|
+
}
|
|
621
|
+
declare function float64(params?: string | core.$ZodCheckNumberFormatParams): ZodFloat64;
|
|
622
|
+
interface ZodInt32 extends ZodNumberFormat {
|
|
623
|
+
}
|
|
624
|
+
declare function int32(params?: string | core.$ZodCheckNumberFormatParams): ZodInt32;
|
|
625
|
+
interface ZodUInt32 extends ZodNumberFormat {
|
|
626
|
+
}
|
|
627
|
+
declare function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodUInt32;
|
|
628
|
+
interface _ZodBoolean<T extends core.$ZodBooleanInternals = core.$ZodBooleanInternals, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
629
|
+
}
|
|
630
|
+
interface ZodBoolean<K extends KrustyInternals = KrustyInternals> extends _ZodBoolean<core.$ZodBooleanInternals<boolean>, K> {
|
|
631
|
+
}
|
|
632
|
+
declare const ZodBoolean: core.$constructor<ZodBoolean>;
|
|
633
|
+
declare function boolean(params?: string | core.$ZodBooleanParams): ZodBoolean;
|
|
634
|
+
interface _ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigIntInternals, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
635
|
+
gte(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
636
|
+
/** Alias of `.gte()` */
|
|
637
|
+
min(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
638
|
+
gt(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
639
|
+
/** Alias of `.lte()` */
|
|
640
|
+
lte(value: bigint, params?: string | core.$ZodCheckLessThanParams): this;
|
|
641
|
+
max(value: bigint, params?: string | core.$ZodCheckLessThanParams): this;
|
|
642
|
+
lt(value: bigint, params?: string | core.$ZodCheckLessThanParams): this;
|
|
643
|
+
positive(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
644
|
+
negative(params?: string | core.$ZodCheckLessThanParams): this;
|
|
645
|
+
nonpositive(params?: string | core.$ZodCheckLessThanParams): this;
|
|
646
|
+
nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
647
|
+
multipleOf(value: bigint, params?: string | core.$ZodCheckMultipleOfParams): this;
|
|
648
|
+
minValue: bigint | null;
|
|
649
|
+
maxValue: bigint | null;
|
|
650
|
+
format: string | null;
|
|
651
|
+
}
|
|
652
|
+
interface ZodBigInt<K extends KrustyInternals = KrustyInternals> extends _ZodBigInt<core.$ZodBigIntInternals<bigint>, K> {
|
|
653
|
+
}
|
|
654
|
+
declare const ZodBigInt: core.$constructor<ZodBigInt>;
|
|
655
|
+
declare function bigint(params?: string | core.$ZodBigIntParams): ZodBigInt;
|
|
656
|
+
interface ZodBigIntFormat extends ZodBigInt {
|
|
657
|
+
_zod: core.$ZodBigIntFormatInternals;
|
|
658
|
+
}
|
|
659
|
+
declare const ZodBigIntFormat: core.$constructor<ZodBigIntFormat>;
|
|
660
|
+
declare function int64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
|
661
|
+
declare function uint64(params?: string | core.$ZodBigIntFormatParams): ZodBigIntFormat;
|
|
662
|
+
interface ZodSymbol<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodSymbolInternals, K> {
|
|
663
|
+
}
|
|
664
|
+
declare const ZodSymbol: core.$constructor<ZodSymbol>;
|
|
665
|
+
declare function symbol(params?: string | core.$ZodSymbolParams): ZodSymbol;
|
|
666
|
+
interface ZodUndefined<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodUndefinedInternals, K> {
|
|
667
|
+
}
|
|
668
|
+
declare const ZodUndefined: core.$constructor<ZodUndefined>;
|
|
669
|
+
declare function _undefined(params?: string | core.$ZodUndefinedParams): ZodUndefined;
|
|
670
|
+
|
|
671
|
+
interface ZodNull<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNullInternals, K> {
|
|
672
|
+
}
|
|
673
|
+
declare const ZodNull: core.$constructor<ZodNull>;
|
|
674
|
+
declare function _null(params?: string | core.$ZodNullParams): ZodNull;
|
|
675
|
+
|
|
676
|
+
interface ZodAny<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodAnyInternals, K> {
|
|
677
|
+
}
|
|
678
|
+
declare const ZodAny: core.$constructor<ZodAny>;
|
|
679
|
+
declare function any(): ZodAny;
|
|
680
|
+
interface ZodUnknown<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodUnknownInternals, K> {
|
|
681
|
+
}
|
|
682
|
+
declare const ZodUnknown: core.$constructor<ZodUnknown>;
|
|
683
|
+
declare function unknown(): ZodUnknown;
|
|
684
|
+
interface ZodNever<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNeverInternals, K> {
|
|
685
|
+
}
|
|
686
|
+
declare const ZodNever: core.$constructor<ZodNever>;
|
|
687
|
+
declare function never(params?: string | core.$ZodNeverParams): ZodNever;
|
|
688
|
+
interface ZodVoid<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodVoidInternals, K> {
|
|
689
|
+
}
|
|
690
|
+
declare const ZodVoid: core.$constructor<ZodVoid>;
|
|
691
|
+
declare function _void(params?: string | core.$ZodVoidParams): ZodVoid;
|
|
692
|
+
|
|
693
|
+
interface _ZodDate<T extends core.$ZodDateInternals = core.$ZodDateInternals, K extends KrustyInternals = KrustyInternals> extends _KrustyType<T, K> {
|
|
694
|
+
min(value: number | Date, params?: string | core.$ZodCheckGreaterThanParams): this;
|
|
695
|
+
max(value: number | Date, params?: string | core.$ZodCheckLessThanParams): this;
|
|
696
|
+
/** @deprecated Not recommended. */
|
|
697
|
+
minDate: Date | null;
|
|
698
|
+
/** @deprecated Not recommended. */
|
|
699
|
+
maxDate: Date | null;
|
|
700
|
+
}
|
|
701
|
+
interface ZodDate<K extends KrustyInternals = KrustyInternals> extends _ZodDate<core.$ZodDateInternals<Date>, K> {
|
|
702
|
+
}
|
|
703
|
+
declare const ZodDate: core.$constructor<ZodDate>;
|
|
704
|
+
declare function date(params?: string | core.$ZodDateParams): ZodDate;
|
|
705
|
+
interface ZodArray<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodArrayInternals<T>, K>, core.$ZodArray<T> {
|
|
706
|
+
element: T;
|
|
707
|
+
min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
|
|
708
|
+
nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
|
|
709
|
+
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
710
|
+
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
711
|
+
unwrap(): T;
|
|
712
|
+
}
|
|
713
|
+
declare const ZodArray: core.$constructor<ZodArray>;
|
|
714
|
+
declare function array<T extends core.SomeType, K extends KrustyInternals>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T, K>;
|
|
715
|
+
declare function keyof<T extends ZodObject, K extends KrustyInternals>(schema: T): ZodEnum<util.KeysEnum<T['_zod']['output']>, K>;
|
|
716
|
+
interface ZodIntersection<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodIntersectionInternals<A, B>, K>, core.$ZodIntersection<A, B> {
|
|
717
|
+
}
|
|
718
|
+
declare const ZodIntersection: core.$constructor<ZodIntersection>;
|
|
719
|
+
declare function intersection<T extends core.SomeType, U extends core.SomeType, K extends KrustyInternals>(left: T, right: U): ZodIntersection<T, U, K>;
|
|
720
|
+
interface ZodTuple<T extends util.TupleItems = readonly core.$ZodType[], Rest extends core.SomeType | null = core.$ZodType | null, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodTupleInternals<T, Rest>, K>, core.$ZodTuple<T, Rest> {
|
|
721
|
+
rest<Rest extends core.SomeType = core.$ZodType>(rest: Rest): ZodTuple<T, Rest, K>;
|
|
722
|
+
}
|
|
723
|
+
declare const ZodTuple: core.$constructor<ZodTuple>;
|
|
724
|
+
declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], K extends KrustyInternals>(items: T, params?: string | core.$ZodTupleParams): ZodTuple<T, null, K>;
|
|
725
|
+
declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], Rest extends core.SomeType, K extends KrustyInternals>(items: T, rest: Rest, params?: string | core.$ZodTupleParams): ZodTuple<T, Rest, K>;
|
|
726
|
+
declare function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null, KrustyInternals>;
|
|
727
|
+
interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodRecordInternals<Key, Value>, K>, core.$ZodRecord<Key, Value> {
|
|
728
|
+
keyType: Key;
|
|
729
|
+
valueType: Value;
|
|
730
|
+
}
|
|
731
|
+
declare const ZodRecord: core.$constructor<ZodRecord>;
|
|
732
|
+
declare function record<Key extends core.$ZodRecordKey, Value extends core.SomeType, K extends KrustyInternals>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key, Value, K>;
|
|
733
|
+
declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key & core.$partial, Value>;
|
|
734
|
+
interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodMapInternals<Key, Value>, K>, core.$ZodMap<Key, Value> {
|
|
735
|
+
keyType: Key;
|
|
736
|
+
valueType: Value;
|
|
737
|
+
}
|
|
738
|
+
declare const ZodMap: core.$constructor<ZodMap>;
|
|
739
|
+
declare function map<Key extends core.SomeType, Value extends core.SomeType, K extends KrustyInternals>(keyType: Key, valueType: Value, params?: string | core.$ZodMapParams): ZodMap<Key, Value, K>;
|
|
740
|
+
interface ZodSet<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodSetInternals<T>, K>, core.$ZodSet<T> {
|
|
741
|
+
min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
742
|
+
nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
|
|
743
|
+
max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
744
|
+
size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
|
|
745
|
+
}
|
|
746
|
+
declare const ZodSet: core.$constructor<ZodSet>;
|
|
747
|
+
declare function set<Value extends core.SomeType, K extends KrustyInternals>(valueType: Value, params?: string | core.$ZodSetParams): ZodSet<Value, K>;
|
|
748
|
+
interface ZodEnum<
|
|
749
|
+
/** @ts-expect-error Cast variance */
|
|
750
|
+
out T extends util.EnumLike = util.EnumLike, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodEnumInternals<T>, K>, core.$ZodEnum<T> {
|
|
751
|
+
enum: T;
|
|
752
|
+
options: Array<T[keyof T]>;
|
|
753
|
+
extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>, K>;
|
|
754
|
+
exclude<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Omit<T, U[number]>>, K>;
|
|
755
|
+
}
|
|
756
|
+
declare const ZodEnum: core.$constructor<ZodEnum>;
|
|
757
|
+
declare function _enum<const T extends readonly string[], K extends KrustyInternals>(values: T, params?: string | core.$ZodEnumParams): ZodEnum<util.ToEnum<T[number]>, K>;
|
|
758
|
+
declare function _enum<const T extends util.EnumLike, K extends KrustyInternals>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T, K>;
|
|
759
|
+
|
|
760
|
+
/** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
|
|
761
|
+
*
|
|
762
|
+
* ```ts
|
|
763
|
+
* enum Colors { red, green, blue }
|
|
764
|
+
* z.enum(Colors);
|
|
765
|
+
* ```
|
|
766
|
+
*/
|
|
767
|
+
declare function nativeEnum<T extends util.EnumLike, K extends KrustyInternals>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T, K>;
|
|
768
|
+
interface ZodLiteral<T extends util.Literal = util.Literal, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodLiteralInternals<T>, K>, core.$ZodLiteral<T> {
|
|
769
|
+
values: Set<T>;
|
|
770
|
+
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
771
|
+
value: T;
|
|
772
|
+
}
|
|
773
|
+
declare const ZodLiteral: core.$constructor<ZodLiteral>;
|
|
774
|
+
declare function literal<const T extends ReadonlyArray<util.Literal>, K extends KrustyInternals>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T[number], K>;
|
|
775
|
+
declare function literal<const T extends util.Literal, K extends KrustyInternals>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T, K>;
|
|
776
|
+
interface ZodFile<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodFileInternals, K>, core.$ZodFile {
|
|
777
|
+
min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
778
|
+
max(size: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
779
|
+
mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
|
|
780
|
+
}
|
|
781
|
+
declare const ZodFile: core.$constructor<ZodFile>;
|
|
782
|
+
declare function file(params?: string | core.$ZodFileParams): ZodFile;
|
|
783
|
+
interface ZodTransform<O = unknown, I = unknown, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodTransformInternals<O, I>, K>, core.$ZodTransform<O, I> {
|
|
784
|
+
}
|
|
785
|
+
declare const ZodTransform: core.$constructor<ZodTransform>;
|
|
786
|
+
declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O): ZodTransform<Awaited<O>, I>;
|
|
787
|
+
interface ZodOptional<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodOptionalInternals<T>, K>, core.$ZodOptional<T> {
|
|
788
|
+
unwrap(): T;
|
|
789
|
+
}
|
|
790
|
+
declare const ZodOptional: core.$constructor<ZodOptional>;
|
|
791
|
+
declare function optional<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodOptional<T, K>;
|
|
792
|
+
interface ZodNullable<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNullableInternals<T>, K>, core.$ZodNullable<T> {
|
|
793
|
+
unwrap(): T;
|
|
794
|
+
}
|
|
795
|
+
declare const ZodNullable: core.$constructor<ZodNullable>;
|
|
796
|
+
declare function nullable<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodNullable<T, K>;
|
|
797
|
+
declare function nullish<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodOptional<ZodNullable<T, K>, K>;
|
|
798
|
+
interface ZodDefault<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodDefaultInternals<T>, K>, core.$ZodDefault<T> {
|
|
799
|
+
unwrap(): T;
|
|
800
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
801
|
+
removeDefault(): T;
|
|
802
|
+
}
|
|
803
|
+
declare const ZodDefault: core.$constructor<ZodDefault>;
|
|
804
|
+
declare function _default<T extends core.SomeType, K extends KrustyInternals>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)): ZodDefault<T, K>;
|
|
805
|
+
interface ZodPrefault<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodPrefaultInternals<T>, K>, core.$ZodPrefault<T> {
|
|
806
|
+
unwrap(): T;
|
|
807
|
+
}
|
|
808
|
+
declare const ZodPrefault: core.$constructor<ZodPrefault>;
|
|
809
|
+
declare function prefault<T extends core.SomeType, K extends KrustyInternals>(innerType: T, defaultValue: core.input<T> | (() => core.input<T>)): ZodPrefault<T, K>;
|
|
810
|
+
interface ZodNonOptional<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNonOptionalInternals<T>, K>, core.$ZodNonOptional<T> {
|
|
811
|
+
unwrap(): T;
|
|
812
|
+
}
|
|
813
|
+
declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
|
|
814
|
+
declare function nonoptional<T extends core.SomeType, K extends KrustyInternals>(innerType: T, params?: string | core.$ZodNonOptionalParams): ZodNonOptional<T, K>;
|
|
815
|
+
interface ZodSuccess<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodSuccessInternals<T>, K>, core.$ZodSuccess<T> {
|
|
816
|
+
unwrap(): T;
|
|
817
|
+
}
|
|
818
|
+
declare const ZodSuccess: core.$constructor<ZodSuccess>;
|
|
819
|
+
declare function success<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodSuccess<T, K>;
|
|
820
|
+
interface ZodCatch<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodCatchInternals<T>, K>, core.$ZodCatch<T> {
|
|
821
|
+
unwrap(): T;
|
|
822
|
+
/** @deprecated Use `.unwrap()` instead. */
|
|
823
|
+
removeCatch(): T;
|
|
824
|
+
}
|
|
825
|
+
declare const ZodCatch: core.$constructor<ZodCatch>;
|
|
826
|
+
declare function _catch<T extends core.SomeType, K extends KrustyInternals>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)): ZodCatch<T, K>;
|
|
827
|
+
|
|
828
|
+
interface ZodNaN<K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodNaNInternals, K>, core.$ZodNaN {
|
|
829
|
+
}
|
|
830
|
+
declare const ZodNaN: core.$constructor<ZodNaN>;
|
|
831
|
+
declare function nan(params?: string | core.$ZodNaNParams): ZodNaN;
|
|
832
|
+
interface ZodPipe<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodPipeInternals<A, B>, K>, core.$ZodPipe<A, B> {
|
|
833
|
+
in: A;
|
|
834
|
+
out: B;
|
|
835
|
+
}
|
|
836
|
+
declare const ZodPipe: core.$constructor<ZodPipe>;
|
|
837
|
+
declare function pipe<const A extends core.SomeType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>, K extends KrustyInternals = KrustyInternals>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodPipe<A, B, K>;
|
|
838
|
+
interface ZodCodec<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends ZodPipe<A, B, K>, core.$ZodCodec<A, B> {
|
|
839
|
+
_zod: core.$ZodCodecInternals<A, B>;
|
|
840
|
+
def: core.$ZodCodecDef<A, B>;
|
|
841
|
+
}
|
|
842
|
+
declare const ZodCodec: core.$constructor<ZodCodec>;
|
|
843
|
+
declare function codec<const A extends core.SomeType, B extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals>(in_: A, out: B, params: {
|
|
844
|
+
decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.util.MaybeAsync<core.input<B>>;
|
|
845
|
+
encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.util.MaybeAsync<core.output<A>>;
|
|
846
|
+
}): ZodCodec<A, B, K>;
|
|
847
|
+
interface ZodReadonly<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodReadonlyInternals<T>, K>, core.$ZodReadonly<T> {
|
|
848
|
+
unwrap(): T;
|
|
849
|
+
}
|
|
850
|
+
declare const ZodReadonly: core.$constructor<ZodReadonly>;
|
|
851
|
+
declare function readonly<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodReadonly<T, K>;
|
|
852
|
+
interface ZodTemplateLiteral<Template extends string = string, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodTemplateLiteralInternals<Template>, K>, core.$ZodTemplateLiteral<Template> {
|
|
853
|
+
}
|
|
854
|
+
declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
|
|
855
|
+
declare function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart[], K extends KrustyInternals>(parts: Parts, params?: string | core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>, K>;
|
|
856
|
+
interface ZodLazy<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodLazyInternals<T>, K>, core.$ZodLazy<T> {
|
|
857
|
+
unwrap(): T;
|
|
858
|
+
}
|
|
859
|
+
declare const ZodLazy: core.$constructor<ZodLazy>;
|
|
860
|
+
declare function lazy<T extends core.SomeType, K extends KrustyInternals>(getter: () => T): ZodLazy<T, K>;
|
|
861
|
+
interface ZodPromise<T extends core.SomeType = core.$ZodType, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodPromiseInternals<T>, K>, core.$ZodPromise<T> {
|
|
862
|
+
unwrap(): T;
|
|
863
|
+
}
|
|
864
|
+
declare const ZodPromise: core.$constructor<ZodPromise>;
|
|
865
|
+
declare function promise<T extends core.SomeType, K extends KrustyInternals>(innerType: T): ZodPromise<T, K>;
|
|
866
|
+
interface ZodFunction<Args extends core.$ZodFunctionIn = core.$ZodFunctionIn, Returns extends core.$ZodFunctionOut = core.$ZodFunctionOut, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodFunctionInternals<Args, Returns>, K>, core.$ZodFunction<Args, Returns> {
|
|
867
|
+
_def: core.$ZodFunctionDef<Args, Returns>;
|
|
868
|
+
_input: core.$InferInnerFunctionType<Args, Returns>;
|
|
869
|
+
_output: core.$InferOuterFunctionType<Args, Returns>;
|
|
870
|
+
input<const Items extends util.TupleItems, const Rest extends core.$ZodFunctionOut = core.$ZodFunctionOut>(args: Items, rest?: Rest): ZodFunction<core.$ZodTuple<Items, Rest>, Returns, K>;
|
|
871
|
+
input<NewArgs extends core.$ZodFunctionIn>(args: NewArgs): ZodFunction<NewArgs, Returns, K>;
|
|
872
|
+
input(...args: any[]): ZodFunction<any, Returns, K>;
|
|
873
|
+
output<NewReturns extends core.$ZodType>(output: NewReturns): ZodFunction<Args, NewReturns, K>;
|
|
874
|
+
}
|
|
875
|
+
declare const ZodFunction: core.$constructor<ZodFunction>;
|
|
876
|
+
declare function _function(): ZodFunction;
|
|
877
|
+
declare function _function<const In extends ReadonlyArray<core.$ZodType>, K extends KrustyInternals>(params: {
|
|
878
|
+
input: In;
|
|
879
|
+
}): ZodFunction<ZodTuple<In, null, K>, core.$ZodFunctionOut, K>;
|
|
880
|
+
declare function _function<const In extends ReadonlyArray<core.$ZodType>, const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut, K extends KrustyInternals = KrustyInternals>(params: {
|
|
881
|
+
input: In;
|
|
882
|
+
output: Out;
|
|
883
|
+
}): ZodFunction<ZodTuple<In, null, K>, Out, K>;
|
|
884
|
+
declare function _function<const In extends core.$ZodFunctionIn = core.$ZodFunctionIn, K extends KrustyInternals = KrustyInternals>(params: {
|
|
885
|
+
input: In;
|
|
886
|
+
}): ZodFunction<In, core.$ZodFunctionOut, K>;
|
|
887
|
+
declare function _function<const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut, K extends KrustyInternals = KrustyInternals>(params: {
|
|
888
|
+
output: Out;
|
|
889
|
+
}): ZodFunction<core.$ZodFunctionIn, Out, K>;
|
|
890
|
+
declare function _function<In extends core.$ZodFunctionIn = core.$ZodFunctionIn, Out extends core.$ZodType = core.$ZodType, K extends KrustyInternals = KrustyInternals>(params?: {
|
|
891
|
+
input: In;
|
|
892
|
+
output: Out;
|
|
893
|
+
}): ZodFunction<In, Out, K>;
|
|
894
|
+
|
|
895
|
+
interface ZodCustom<O = unknown, I = unknown, K extends KrustyInternals = KrustyInternals> extends _KrustyType<core.$ZodCustomInternals<O, I>, K>, core.$ZodCustom<O, I> {
|
|
896
|
+
}
|
|
897
|
+
declare const ZodCustom: core.$constructor<ZodCustom>;
|
|
898
|
+
declare function check<O = unknown>(fn: core.CheckFn<O>): core.$ZodCheck<O>;
|
|
899
|
+
declare function custom<O, K extends KrustyInternals>(fn?: (data: unknown) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodCustom<O, O, K>;
|
|
900
|
+
declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
901
|
+
declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>): core.$ZodCheck<T>;
|
|
902
|
+
type ZodInstanceOfParams = core.Params<ZodCustom, core.$ZodIssueCustom, 'type' | 'check' | 'checks' | 'fn' | 'abort' | 'error' | 'params' | 'path'>;
|
|
903
|
+
declare function _instanceof<T extends typeof util.Class, K extends KrustyInternals>(cls: T, params?: ZodInstanceOfParams): ZodCustom<InstanceType<T>, InstanceType<T>, K>;
|
|
904
|
+
|
|
905
|
+
declare const stringbool: <K extends KrustyInternals = KrustyInternals>(_params?: string | core.$ZodStringBoolParams) => ZodCodec<ZodString, ZodBoolean, K>;
|
|
906
|
+
type _ZodJSONSchema<K extends KrustyInternals = KrustyInternals> = ZodUnion<[
|
|
907
|
+
ZodString,
|
|
908
|
+
ZodNumber,
|
|
909
|
+
ZodBoolean,
|
|
910
|
+
ZodNull,
|
|
911
|
+
ZodArray<ZodJSONSchema, K>,
|
|
912
|
+
ZodRecord<ZodString, ZodJSONSchema, K>
|
|
913
|
+
], K>;
|
|
914
|
+
type _ZodJSONSchemaInternals = _ZodJSONSchema['_zod'];
|
|
915
|
+
interface ZodJSONSchemaInternals extends _ZodJSONSchemaInternals {
|
|
916
|
+
output: util.JSONType;
|
|
917
|
+
input: util.JSONType;
|
|
918
|
+
}
|
|
919
|
+
interface ZodJSONSchema<K extends KrustyInternals = KrustyInternals> extends _ZodJSONSchema<K> {
|
|
920
|
+
_zod: ZodJSONSchemaInternals;
|
|
921
|
+
}
|
|
922
|
+
declare function json<K extends KrustyInternals = KrustyInternals>(params?: string | core.$ZodCustomParams): ZodJSONSchema<K>;
|
|
923
|
+
declare function preprocess<A, U extends core.SomeType, B = unknown, K extends KrustyInternals = KrustyInternals>(fn: (arg: B, ctx: core.$RefinementCtx) => A, schema: U): ZodPipe<ZodTransform<A, B>, U, K>;
|
|
924
|
+
|
|
925
|
+
declare const fullSchema__$ZodGate: typeof $ZodGate;
|
|
926
|
+
type fullSchema__$ZodGateDef<T extends core.SomeType = core.$ZodType> = $ZodGateDef<T>;
|
|
927
|
+
type fullSchema__$ZodGateInternals<T extends core.SomeType = core.$ZodType> = $ZodGateInternals<T>;
|
|
928
|
+
type fullSchema__IsGateEnabled = IsGateEnabled;
|
|
929
|
+
type fullSchema__KrustyInternals<GateNames extends string = string> = KrustyInternals<GateNames>;
|
|
930
|
+
declare const fullSchema__KrustyType: typeof KrustyType;
|
|
931
|
+
type fullSchema__SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = SafeExtendShape<Base, Ext>;
|
|
932
|
+
declare const fullSchema__ZodAny: typeof ZodAny;
|
|
933
|
+
declare const fullSchema__ZodArray: typeof ZodArray;
|
|
934
|
+
declare const fullSchema__ZodBase64: typeof ZodBase64;
|
|
935
|
+
declare const fullSchema__ZodBase64URL: typeof ZodBase64URL;
|
|
936
|
+
declare const fullSchema__ZodBigInt: typeof ZodBigInt;
|
|
937
|
+
declare const fullSchema__ZodBigIntFormat: typeof ZodBigIntFormat;
|
|
938
|
+
declare const fullSchema__ZodBoolean: typeof ZodBoolean;
|
|
939
|
+
declare const fullSchema__ZodCIDRv4: typeof ZodCIDRv4;
|
|
940
|
+
declare const fullSchema__ZodCIDRv6: typeof ZodCIDRv6;
|
|
941
|
+
declare const fullSchema__ZodCUID: typeof ZodCUID;
|
|
942
|
+
declare const fullSchema__ZodCUID2: typeof ZodCUID2;
|
|
943
|
+
declare const fullSchema__ZodCatch: typeof ZodCatch;
|
|
944
|
+
declare const fullSchema__ZodCodec: typeof ZodCodec;
|
|
945
|
+
declare const fullSchema__ZodCustom: typeof ZodCustom;
|
|
946
|
+
declare const fullSchema__ZodCustomStringFormat: typeof ZodCustomStringFormat;
|
|
947
|
+
declare const fullSchema__ZodDate: typeof ZodDate;
|
|
948
|
+
declare const fullSchema__ZodDefault: typeof ZodDefault;
|
|
949
|
+
declare const fullSchema__ZodDiscriminatedUnion: typeof ZodDiscriminatedUnion;
|
|
950
|
+
declare const fullSchema__ZodE164: typeof ZodE164;
|
|
951
|
+
declare const fullSchema__ZodEmail: typeof ZodEmail;
|
|
952
|
+
declare const fullSchema__ZodEmoji: typeof ZodEmoji;
|
|
953
|
+
declare const fullSchema__ZodEnum: typeof ZodEnum;
|
|
954
|
+
declare const fullSchema__ZodFile: typeof ZodFile;
|
|
955
|
+
type fullSchema__ZodFloat32 = ZodFloat32;
|
|
956
|
+
type fullSchema__ZodFloat64 = ZodFloat64;
|
|
957
|
+
declare const fullSchema__ZodFunction: typeof ZodFunction;
|
|
958
|
+
declare const fullSchema__ZodGUID: typeof ZodGUID;
|
|
959
|
+
declare const fullSchema__ZodGate: typeof ZodGate;
|
|
960
|
+
declare const fullSchema__ZodIPv4: typeof ZodIPv4;
|
|
961
|
+
declare const fullSchema__ZodIPv6: typeof ZodIPv6;
|
|
962
|
+
type fullSchema__ZodInt = ZodInt;
|
|
963
|
+
type fullSchema__ZodInt32 = ZodInt32;
|
|
964
|
+
declare const fullSchema__ZodIntersection: typeof ZodIntersection;
|
|
965
|
+
type fullSchema__ZodJSONSchema<K extends KrustyInternals = KrustyInternals> = ZodJSONSchema<K>;
|
|
966
|
+
type fullSchema__ZodJSONSchemaInternals = ZodJSONSchemaInternals;
|
|
967
|
+
declare const fullSchema__ZodJWT: typeof ZodJWT;
|
|
968
|
+
declare const fullSchema__ZodKSUID: typeof ZodKSUID;
|
|
969
|
+
declare const fullSchema__ZodLazy: typeof ZodLazy;
|
|
970
|
+
declare const fullSchema__ZodLiteral: typeof ZodLiteral;
|
|
971
|
+
declare const fullSchema__ZodMap: typeof ZodMap;
|
|
972
|
+
declare const fullSchema__ZodNaN: typeof ZodNaN;
|
|
973
|
+
declare const fullSchema__ZodNanoID: typeof ZodNanoID;
|
|
974
|
+
declare const fullSchema__ZodNever: typeof ZodNever;
|
|
975
|
+
declare const fullSchema__ZodNonOptional: typeof ZodNonOptional;
|
|
976
|
+
declare const fullSchema__ZodNull: typeof ZodNull;
|
|
977
|
+
declare const fullSchema__ZodNullable: typeof ZodNullable;
|
|
978
|
+
declare const fullSchema__ZodNumber: typeof ZodNumber;
|
|
979
|
+
declare const fullSchema__ZodNumberFormat: typeof ZodNumberFormat;
|
|
980
|
+
declare const fullSchema__ZodObject: typeof ZodObject;
|
|
981
|
+
declare const fullSchema__ZodOptional: typeof ZodOptional;
|
|
982
|
+
declare const fullSchema__ZodPipe: typeof ZodPipe;
|
|
983
|
+
declare const fullSchema__ZodPrefault: typeof ZodPrefault;
|
|
984
|
+
declare const fullSchema__ZodPromise: typeof ZodPromise;
|
|
985
|
+
declare const fullSchema__ZodReadonly: typeof ZodReadonly;
|
|
986
|
+
declare const fullSchema__ZodRecord: typeof ZodRecord;
|
|
987
|
+
declare const fullSchema__ZodSet: typeof ZodSet;
|
|
988
|
+
declare const fullSchema__ZodString: typeof ZodString;
|
|
989
|
+
declare const fullSchema__ZodStringFormat: typeof ZodStringFormat;
|
|
990
|
+
declare const fullSchema__ZodSuccess: typeof ZodSuccess;
|
|
991
|
+
declare const fullSchema__ZodSymbol: typeof ZodSymbol;
|
|
992
|
+
declare const fullSchema__ZodTemplateLiteral: typeof ZodTemplateLiteral;
|
|
993
|
+
declare const fullSchema__ZodTransform: typeof ZodTransform;
|
|
994
|
+
declare const fullSchema__ZodTuple: typeof ZodTuple;
|
|
995
|
+
type fullSchema__ZodUInt32 = ZodUInt32;
|
|
996
|
+
declare const fullSchema__ZodULID: typeof ZodULID;
|
|
997
|
+
declare const fullSchema__ZodURL: typeof ZodURL;
|
|
998
|
+
declare const fullSchema__ZodUUID: typeof ZodUUID;
|
|
999
|
+
declare const fullSchema__ZodUndefined: typeof ZodUndefined;
|
|
1000
|
+
declare const fullSchema__ZodUnion: typeof ZodUnion;
|
|
1001
|
+
declare const fullSchema__ZodUnknown: typeof ZodUnknown;
|
|
1002
|
+
declare const fullSchema__ZodVoid: typeof ZodVoid;
|
|
1003
|
+
declare const fullSchema__ZodXID: typeof ZodXID;
|
|
1004
|
+
type fullSchema___KrustyType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals, out KInternals extends KrustyInternals = KrustyInternals> = _KrustyType<Internals, KInternals>;
|
|
1005
|
+
type fullSchema___ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigIntInternals, K extends KrustyInternals = KrustyInternals> = _ZodBigInt<T, K>;
|
|
1006
|
+
type fullSchema___ZodBoolean<T extends core.$ZodBooleanInternals = core.$ZodBooleanInternals, K extends KrustyInternals = KrustyInternals> = _ZodBoolean<T, K>;
|
|
1007
|
+
type fullSchema___ZodDate<T extends core.$ZodDateInternals = core.$ZodDateInternals, K extends KrustyInternals = KrustyInternals> = _ZodDate<T, K>;
|
|
1008
|
+
type fullSchema___ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals, K extends KrustyInternals = KrustyInternals> = _ZodNumber<Internals, K>;
|
|
1009
|
+
declare const fullSchema___ZodString: typeof _ZodString;
|
|
1010
|
+
declare const fullSchema___default: typeof _default;
|
|
1011
|
+
declare const fullSchema___function: typeof _function;
|
|
1012
|
+
declare const fullSchema__any: typeof any;
|
|
1013
|
+
declare const fullSchema__array: typeof array;
|
|
1014
|
+
declare const fullSchema__base64: typeof base64;
|
|
1015
|
+
declare const fullSchema__base64url: typeof base64url;
|
|
1016
|
+
declare const fullSchema__bigint: typeof bigint;
|
|
1017
|
+
declare const fullSchema__boolean: typeof boolean;
|
|
1018
|
+
declare const fullSchema__check: typeof check;
|
|
1019
|
+
declare const fullSchema__cidrv4: typeof cidrv4;
|
|
1020
|
+
declare const fullSchema__cidrv6: typeof cidrv6;
|
|
1021
|
+
declare const fullSchema__codec: typeof codec;
|
|
1022
|
+
declare const fullSchema__cuid: typeof cuid;
|
|
1023
|
+
declare const fullSchema__cuid2: typeof cuid2;
|
|
1024
|
+
declare const fullSchema__custom: typeof custom;
|
|
1025
|
+
declare const fullSchema__date: typeof date;
|
|
1026
|
+
declare const fullSchema__discriminatedUnion: typeof discriminatedUnion;
|
|
1027
|
+
declare const fullSchema__e164: typeof e164;
|
|
1028
|
+
declare const fullSchema__email: typeof email;
|
|
1029
|
+
declare const fullSchema__emoji: typeof emoji;
|
|
1030
|
+
declare const fullSchema__file: typeof file;
|
|
1031
|
+
declare const fullSchema__float32: typeof float32;
|
|
1032
|
+
declare const fullSchema__float64: typeof float64;
|
|
1033
|
+
declare const fullSchema__gate: typeof gate;
|
|
1034
|
+
declare const fullSchema__gatingContext: typeof gatingContext;
|
|
1035
|
+
declare const fullSchema__guid: typeof guid;
|
|
1036
|
+
declare const fullSchema__hash: typeof hash;
|
|
1037
|
+
declare const fullSchema__hex: typeof hex;
|
|
1038
|
+
declare const fullSchema__hostname: typeof hostname;
|
|
1039
|
+
declare const fullSchema__httpUrl: typeof httpUrl;
|
|
1040
|
+
declare const fullSchema__int: typeof int;
|
|
1041
|
+
declare const fullSchema__int32: typeof int32;
|
|
1042
|
+
declare const fullSchema__int64: typeof int64;
|
|
1043
|
+
declare const fullSchema__intersection: typeof intersection;
|
|
1044
|
+
declare const fullSchema__ipv4: typeof ipv4;
|
|
1045
|
+
declare const fullSchema__ipv6: typeof ipv6;
|
|
1046
|
+
declare const fullSchema__isGateIssue: typeof isGateIssue;
|
|
1047
|
+
declare const fullSchema__isGateIssueRaw: typeof isGateIssueRaw;
|
|
1048
|
+
declare const fullSchema__json: typeof json;
|
|
1049
|
+
declare const fullSchema__jwt: typeof jwt;
|
|
1050
|
+
declare const fullSchema__keyof: typeof keyof;
|
|
1051
|
+
declare const fullSchema__ksuid: typeof ksuid;
|
|
1052
|
+
declare const fullSchema__lazy: typeof lazy;
|
|
1053
|
+
declare const fullSchema__literal: typeof literal;
|
|
1054
|
+
declare const fullSchema__looseObject: typeof looseObject;
|
|
1055
|
+
declare const fullSchema__map: typeof map;
|
|
1056
|
+
declare const fullSchema__nan: typeof nan;
|
|
1057
|
+
declare const fullSchema__nanoid: typeof nanoid;
|
|
1058
|
+
declare const fullSchema__nativeEnum: typeof nativeEnum;
|
|
1059
|
+
declare const fullSchema__never: typeof never;
|
|
1060
|
+
declare const fullSchema__nonoptional: typeof nonoptional;
|
|
1061
|
+
declare const fullSchema__nullable: typeof nullable;
|
|
1062
|
+
declare const fullSchema__nullish: typeof nullish;
|
|
1063
|
+
declare const fullSchema__number: typeof number;
|
|
1064
|
+
declare const fullSchema__object: typeof object;
|
|
1065
|
+
declare const fullSchema__optional: typeof optional;
|
|
1066
|
+
declare const fullSchema__partialRecord: typeof partialRecord;
|
|
1067
|
+
declare const fullSchema__pipe: typeof pipe;
|
|
1068
|
+
declare const fullSchema__prefault: typeof prefault;
|
|
1069
|
+
declare const fullSchema__preprocess: typeof preprocess;
|
|
1070
|
+
declare const fullSchema__promise: typeof promise;
|
|
1071
|
+
declare const fullSchema__readonly: typeof readonly;
|
|
1072
|
+
declare const fullSchema__record: typeof record;
|
|
1073
|
+
declare const fullSchema__refine: typeof refine;
|
|
1074
|
+
declare const fullSchema__set: typeof set;
|
|
1075
|
+
declare const fullSchema__strictObject: typeof strictObject;
|
|
1076
|
+
declare const fullSchema__string: typeof string;
|
|
1077
|
+
declare const fullSchema__stringFormat: typeof stringFormat;
|
|
1078
|
+
declare const fullSchema__stringbool: typeof stringbool;
|
|
1079
|
+
declare const fullSchema__success: typeof success;
|
|
1080
|
+
declare const fullSchema__superRefine: typeof superRefine;
|
|
1081
|
+
declare const fullSchema__symbol: typeof symbol;
|
|
1082
|
+
declare const fullSchema__templateLiteral: typeof templateLiteral;
|
|
1083
|
+
declare const fullSchema__transform: typeof transform;
|
|
1084
|
+
declare const fullSchema__tuple: typeof tuple;
|
|
1085
|
+
declare const fullSchema__uint32: typeof uint32;
|
|
1086
|
+
declare const fullSchema__uint64: typeof uint64;
|
|
1087
|
+
declare const fullSchema__ulid: typeof ulid;
|
|
1088
|
+
declare const fullSchema__union: typeof union;
|
|
1089
|
+
declare const fullSchema__unknown: typeof unknown;
|
|
1090
|
+
declare const fullSchema__url: typeof url;
|
|
1091
|
+
declare const fullSchema__uuid: typeof uuid;
|
|
1092
|
+
declare const fullSchema__uuidv4: typeof uuidv4;
|
|
1093
|
+
declare const fullSchema__uuidv6: typeof uuidv6;
|
|
1094
|
+
declare const fullSchema__uuidv7: typeof uuidv7;
|
|
1095
|
+
declare const fullSchema__xid: typeof xid;
|
|
1096
|
+
declare namespace fullSchema_ {
|
|
1097
|
+
export { fullSchema__$ZodGate as $ZodGate, fullSchema__KrustyType as KrustyType, fullSchema__ZodAny as ZodAny, fullSchema__ZodArray as ZodArray, fullSchema__ZodBase64 as ZodBase64, fullSchema__ZodBase64URL as ZodBase64URL, fullSchema__ZodBigInt as ZodBigInt, fullSchema__ZodBigIntFormat as ZodBigIntFormat, fullSchema__ZodBoolean as ZodBoolean, fullSchema__ZodCIDRv4 as ZodCIDRv4, fullSchema__ZodCIDRv6 as ZodCIDRv6, fullSchema__ZodCUID as ZodCUID, fullSchema__ZodCUID2 as ZodCUID2, fullSchema__ZodCatch as ZodCatch, fullSchema__ZodCodec as ZodCodec, fullSchema__ZodCustom as ZodCustom, fullSchema__ZodCustomStringFormat as ZodCustomStringFormat, fullSchema__ZodDate as ZodDate, fullSchema__ZodDefault as ZodDefault, fullSchema__ZodDiscriminatedUnion as ZodDiscriminatedUnion, fullSchema__ZodE164 as ZodE164, fullSchema__ZodEmail as ZodEmail, fullSchema__ZodEmoji as ZodEmoji, fullSchema__ZodEnum as ZodEnum, fullSchema__ZodFile as ZodFile, fullSchema__ZodFunction as ZodFunction, fullSchema__ZodGUID as ZodGUID, fullSchema__ZodGate as ZodGate, fullSchema__ZodIPv4 as ZodIPv4, fullSchema__ZodIPv6 as ZodIPv6, fullSchema__ZodIntersection as ZodIntersection, fullSchema__ZodJWT as ZodJWT, fullSchema__ZodKSUID as ZodKSUID, fullSchema__ZodLazy as ZodLazy, fullSchema__ZodLiteral as ZodLiteral, fullSchema__ZodMap as ZodMap, fullSchema__ZodNaN as ZodNaN, fullSchema__ZodNanoID as ZodNanoID, fullSchema__ZodNever as ZodNever, fullSchema__ZodNonOptional as ZodNonOptional, fullSchema__ZodNull as ZodNull, fullSchema__ZodNullable as ZodNullable, fullSchema__ZodNumber as ZodNumber, fullSchema__ZodNumberFormat as ZodNumberFormat, fullSchema__ZodObject as ZodObject, fullSchema__ZodOptional as ZodOptional, fullSchema__ZodPipe as ZodPipe, fullSchema__ZodPrefault as ZodPrefault, fullSchema__ZodPromise as ZodPromise, fullSchema__ZodReadonly as ZodReadonly, fullSchema__ZodRecord as ZodRecord, fullSchema__ZodSet as ZodSet, fullSchema__ZodString as ZodString, fullSchema__ZodStringFormat as ZodStringFormat, fullSchema__ZodSuccess as ZodSuccess, fullSchema__ZodSymbol as ZodSymbol, fullSchema__ZodTemplateLiteral as ZodTemplateLiteral, fullSchema__ZodTransform as ZodTransform, fullSchema__ZodTuple as ZodTuple, fullSchema__ZodULID as ZodULID, fullSchema__ZodURL as ZodURL, fullSchema__ZodUUID as ZodUUID, fullSchema__ZodUndefined as ZodUndefined, fullSchema__ZodUnion as ZodUnion, fullSchema__ZodUnknown as ZodUnknown, fullSchema__ZodVoid as ZodVoid, fullSchema__ZodXID as ZodXID, fullSchema___ZodString as _ZodString, fullSchema___default as _default, fullSchema___function as _function, fullSchema__any as any, fullSchema__array as array, fullSchema__base64 as base64, fullSchema__base64url as base64url, fullSchema__bigint as bigint, fullSchema__boolean as boolean, _catch as catch, fullSchema__check as check, fullSchema__cidrv4 as cidrv4, fullSchema__cidrv6 as cidrv6, fullSchema__codec as codec, fullSchema__cuid as cuid, fullSchema__cuid2 as cuid2, fullSchema__custom as custom, fullSchema__date as date, fullSchema__discriminatedUnion as discriminatedUnion, fullSchema__e164 as e164, fullSchema__email as email, fullSchema__emoji as emoji, _enum as enum, fullSchema__file as file, fullSchema__float32 as float32, fullSchema__float64 as float64, _function as function, fullSchema__gate as gate, fullSchema__gatingContext as gatingContext, fullSchema__guid as guid, fullSchema__hash as hash, fullSchema__hex as hex, fullSchema__hostname as hostname, fullSchema__httpUrl as httpUrl, _instanceof as instanceof, fullSchema__int as int, fullSchema__int32 as int32, fullSchema__int64 as int64, fullSchema__intersection as intersection, fullSchema__ipv4 as ipv4, fullSchema__ipv6 as ipv6, fullSchema__isGateIssue as isGateIssue, fullSchema__isGateIssueRaw as isGateIssueRaw, fullSchema__json as json, fullSchema__jwt as jwt, fullSchema__keyof as keyof, fullSchema__ksuid as ksuid, fullSchema__lazy as lazy, fullSchema__literal as literal, fullSchema__looseObject as looseObject, fullSchema__map as map, fullSchema__nan as nan, fullSchema__nanoid as nanoid, fullSchema__nativeEnum as nativeEnum, fullSchema__never as never, fullSchema__nonoptional as nonoptional, _null as null, fullSchema__nullable as nullable, fullSchema__nullish as nullish, fullSchema__number as number, fullSchema__object as object, fullSchema__optional as optional, fullSchema__partialRecord as partialRecord, fullSchema__pipe as pipe, fullSchema__prefault as prefault, fullSchema__preprocess as preprocess, fullSchema__promise as promise, fullSchema__readonly as readonly, fullSchema__record as record, fullSchema__refine as refine, fullSchema__set as set, fullSchema__strictObject as strictObject, fullSchema__string as string, fullSchema__stringFormat as stringFormat, fullSchema__stringbool as stringbool, fullSchema__success as success, fullSchema__superRefine as superRefine, fullSchema__symbol as symbol, fullSchema__templateLiteral as templateLiteral, fullSchema__transform as transform, fullSchema__tuple as tuple, fullSchema__uint32 as uint32, fullSchema__uint64 as uint64, fullSchema__ulid as ulid, _undefined as undefined, fullSchema__union as union, fullSchema__unknown as unknown, fullSchema__url as url, fullSchema__uuid as uuid, fullSchema__uuidv4 as uuidv4, fullSchema__uuidv6 as uuidv6, fullSchema__uuidv7 as uuidv7, _void as void, fullSchema__xid as xid };
|
|
1098
|
+
export type { fullSchema__$ZodGateDef as $ZodGateDef, fullSchema__$ZodGateInternals as $ZodGateInternals, fullSchema__IsGateEnabled as IsGateEnabled, fullSchema__KrustyInternals as KrustyInternals, fullSchema__SafeExtendShape as SafeExtendShape, fullSchema__ZodFloat32 as ZodFloat32, fullSchema__ZodFloat64 as ZodFloat64, fullSchema__ZodInt as ZodInt, fullSchema__ZodInt32 as ZodInt32, fullSchema__ZodJSONSchema as ZodJSONSchema, fullSchema__ZodJSONSchemaInternals as ZodJSONSchemaInternals, fullSchema__ZodUInt32 as ZodUInt32, fullSchema___KrustyType as _KrustyType, fullSchema___ZodBigInt as _ZodBigInt, fullSchema___ZodBoolean as _ZodBoolean, fullSchema___ZodDate as _ZodDate, fullSchema___ZodNumber as _ZodNumber };
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
declare const fullSchema: typeof fullSchema_;
|
|
1102
|
+
declare const miniSchema: {
|
|
1103
|
+
array: typeof array;
|
|
1104
|
+
boolean: typeof boolean;
|
|
1105
|
+
date: typeof date;
|
|
1106
|
+
number: typeof number;
|
|
1107
|
+
int: typeof int;
|
|
1108
|
+
string: typeof string;
|
|
1109
|
+
literal: typeof literal;
|
|
1110
|
+
enum: typeof _enum;
|
|
1111
|
+
union: typeof union;
|
|
1112
|
+
discriminatedUnion: typeof discriminatedUnion;
|
|
1113
|
+
null: typeof _null;
|
|
1114
|
+
record: typeof record;
|
|
1115
|
+
file: typeof file;
|
|
1116
|
+
object: typeof object;
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
interface BuilderDef<TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta>, EnhanceRouterOptions<TErrorMap> {
|
|
1120
|
+
middlewares: readonly AnyMiddleware[];
|
|
1121
|
+
inputValidationIndex: number;
|
|
1122
|
+
outputValidationIndex: number;
|
|
1123
|
+
}
|
|
1124
|
+
declare class Builder<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends BuilderWithMiddlewares<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName> {
|
|
1125
|
+
/**
|
|
1126
|
+
* Set or override the initial context.
|
|
1127
|
+
*
|
|
1128
|
+
* @see {@link https://orpc.unnoq.com/docs/context Context Docs}
|
|
1129
|
+
*/
|
|
1130
|
+
$context<U extends Context>(): Builder<U & Record<never, never>, U, TInputSchema, TOutputSchema, TErrorMap, TMeta, TGateName>;
|
|
1131
|
+
/**
|
|
1132
|
+
* Creates a middleware.
|
|
1133
|
+
*
|
|
1134
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
1135
|
+
*/
|
|
1136
|
+
middleware<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
|
|
1137
|
+
middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, any, TMeta>;
|
|
1138
|
+
}
|
|
1139
|
+
type ApiBuilder<TMeta extends Meta> = Builder<Record<never, never>, Record<never, never>, Schema<unknown, unknown>, Schema<unknown, unknown>, Record<never, never>, TMeta, never> & typeof miniSchema & {
|
|
1140
|
+
z: typeof fullSchema;
|
|
1141
|
+
};
|
|
1142
|
+
interface ApiBuilderOpts<TMeta extends Meta> {
|
|
1143
|
+
meta?: TMeta;
|
|
1144
|
+
}
|
|
1145
|
+
declare function createApiBuilder<TMeta extends Meta = Record<never, never>>(opts?: ApiBuilderOpts<TMeta>): ApiBuilder<TMeta>;
|
|
1146
|
+
declare const os: ApiBuilder<Record<never, never>>;
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Like `DecoratedProcedure`, but removed all method that can change the contract.
|
|
1150
|
+
*/
|
|
1151
|
+
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
|
1152
|
+
/**
|
|
1153
|
+
* Uses a middleware to modify the context or improve the pipeline.
|
|
1154
|
+
*
|
|
1155
|
+
* @info Supports both normal middleware and inline middleware implementations.
|
|
1156
|
+
* @info Pass second argument to map the input.
|
|
1157
|
+
* @note The current context must be satisfy middleware dependent-context
|
|
1158
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
1159
|
+
*/
|
|
1160
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
1161
|
+
/**
|
|
1162
|
+
* Uses a middleware to modify the context or improve the pipeline.
|
|
1163
|
+
*
|
|
1164
|
+
* @info Supports both normal middleware and inline middleware implementations.
|
|
1165
|
+
* @info Pass second argument to map the input.
|
|
1166
|
+
* @note The current context must be satisfy middleware dependent-context
|
|
1167
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
1168
|
+
*/
|
|
1169
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferSchemaOutput<TInputSchema>, UInput>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
1170
|
+
/**
|
|
1171
|
+
* Make this procedure callable (works like a function while still being a procedure).
|
|
1172
|
+
*
|
|
1173
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
1174
|
+
*/
|
|
1175
|
+
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ImplementedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta> & ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Like `ProcedureBuilderWithoutHandler`, but removed all method that can change the contract.
|
|
1179
|
+
*/
|
|
1180
|
+
interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
|
1181
|
+
'~orpc': BuilderDef<TInputSchema, TOutputSchema, TErrorMap, TMeta, string>;
|
|
1182
|
+
/**
|
|
1183
|
+
* Uses a middleware to modify the context or improve the pipeline.
|
|
1184
|
+
*
|
|
1185
|
+
* @info Supports both normal middleware and inline middleware implementations.
|
|
1186
|
+
* @info Pass second argument to map the input.
|
|
1187
|
+
* @note The current context must be satisfy middleware dependent-context
|
|
1188
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
1189
|
+
*/
|
|
1190
|
+
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
1191
|
+
/**
|
|
1192
|
+
* Uses a middleware to modify the context or improve the pipeline.
|
|
1193
|
+
*
|
|
1194
|
+
* @info Supports both normal middleware and inline middleware implementations.
|
|
1195
|
+
* @info Pass second argument to map the input.
|
|
1196
|
+
* @note The current context must be satisfy middleware dependent-context
|
|
1197
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
1198
|
+
*/
|
|
1199
|
+
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TOutputSchema>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferSchemaOutput<TInputSchema>, UInput>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
1200
|
+
/**
|
|
1201
|
+
* Defines the handler of the procedure.
|
|
1202
|
+
*
|
|
1203
|
+
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
1204
|
+
*/
|
|
1205
|
+
'handler'(handler: ProcedureHandler<TCurrentContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, TErrorMap, TMeta>): ImplementedProcedure<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
|
1209
|
+
/**
|
|
1210
|
+
* Uses a middleware to modify the context or improve the pipeline.
|
|
1211
|
+
*
|
|
1212
|
+
* @info Supports both normal middleware and inline middleware implementations.
|
|
1213
|
+
* @note The current context must be satisfy middleware dependent-context
|
|
1214
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
1215
|
+
*/
|
|
1216
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<InferContractRouterErrorMap<T>>, InferContractRouterMeta<T>>): ImplementerInternalWithMiddlewares<T, MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>>;
|
|
1217
|
+
/**
|
|
1218
|
+
* Applies all of the previously defined options to the specified router.
|
|
1219
|
+
* And enforces the router match the contract.
|
|
1220
|
+
*
|
|
1221
|
+
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
1222
|
+
*/
|
|
1223
|
+
router<U extends Router<T, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Create a lazy router
|
|
1226
|
+
* And applies all of the previously defined options to the specified router.
|
|
1227
|
+
* And enforces the router match the contract.
|
|
1228
|
+
*
|
|
1229
|
+
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
1230
|
+
*/
|
|
1231
|
+
lazyRoute<U extends Router<T, TInitialContext>>(loader: () => Promise<{
|
|
1232
|
+
default: U;
|
|
1233
|
+
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
1234
|
+
}
|
|
1235
|
+
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, UInputSchema, UOutputSchema, UErrorMap, UMeta> : RouterImplementerWithMiddlewares<TContract, TInitialContext, TCurrentContext> & {
|
|
1236
|
+
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternalWithMiddlewares<TContract[K], TInitialContext, TCurrentContext> : never;
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1239
|
+
interface RouterImplementer<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
|
|
1240
|
+
/**
|
|
1241
|
+
* Creates a middleware.
|
|
1242
|
+
*
|
|
1243
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
1244
|
+
*/
|
|
1245
|
+
middleware<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
|
|
1246
|
+
middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<InferContractRouterErrorMap<T>>, InferContractRouterMeta<T>>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, any, InferContractRouterMeta<T>>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Uses a middleware to modify the context or improve the pipeline.
|
|
1249
|
+
*
|
|
1250
|
+
* @info Supports both normal middleware and inline middleware implementations.
|
|
1251
|
+
* @note The current context must be satisfy middleware dependent-context
|
|
1252
|
+
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
1253
|
+
*/
|
|
1254
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<InferContractRouterErrorMap<T>>, InferContractRouterMeta<T>>): ImplementerInternalWithMiddlewares<T, MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>>;
|
|
1255
|
+
/**
|
|
1256
|
+
* Applies all of the previously defined options to the specified router.
|
|
1257
|
+
* And enforces the router match the contract.
|
|
1258
|
+
*
|
|
1259
|
+
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
1260
|
+
*/
|
|
1261
|
+
router<U extends Router<T, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
1262
|
+
/**
|
|
1263
|
+
* Create a lazy router
|
|
1264
|
+
* And applies all of the previously defined options to the specified router.
|
|
1265
|
+
* And enforces the router match the contract.
|
|
1266
|
+
*
|
|
1267
|
+
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
1268
|
+
*/
|
|
1269
|
+
lazyRoute<U extends Router<T, TCurrentContext>>(loader: () => Promise<{
|
|
1270
|
+
default: U;
|
|
1271
|
+
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
1272
|
+
}
|
|
1273
|
+
type ImplementerInternal<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, UInputSchema, UOutputSchema, UErrorMap, UMeta> : RouterImplementer<TContract, TInitialContext, TCurrentContext> & {
|
|
1274
|
+
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternal<TContract[K], TInitialContext, TCurrentContext> : never;
|
|
1275
|
+
};
|
|
1276
|
+
declare function implementerInternal<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context>(contract: T, middlewares: AnyMiddleware[]): ImplementerInternal<T, TInitialContext, TCurrentContext>;
|
|
1277
|
+
type Implementer<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = {
|
|
1278
|
+
/**
|
|
1279
|
+
* Set or override the initial context.
|
|
1280
|
+
*
|
|
1281
|
+
* @see {@link https://orpc.unnoq.com/docs/context Context Docs}
|
|
1282
|
+
*/
|
|
1283
|
+
$context<U extends Context>(): Implementer<TContract, U & Record<never, never>, U>;
|
|
1284
|
+
} & ImplementerInternal<TContract, TInitialContext, TCurrentContext>;
|
|
1285
|
+
declare function implement<T extends AnyContractRouter, TContext extends Context = Record<never, never>>(contract: T): Implementer<T, TContext, TContext>;
|
|
1286
|
+
|
|
1287
|
+
declare function isStartWithMiddlewares(middlewares: readonly AnyMiddleware[], compare: readonly AnyMiddleware[]): boolean;
|
|
1288
|
+
declare function mergeMiddlewares(first: readonly AnyMiddleware[], second: readonly AnyMiddleware[], options: {
|
|
1289
|
+
dedupeLeading: boolean;
|
|
1290
|
+
}): readonly AnyMiddleware[];
|
|
1291
|
+
declare function addMiddleware(middlewares: readonly AnyMiddleware[], addition: AnyMiddleware): AnyMiddleware[];
|
|
1292
|
+
|
|
1293
|
+
declare function createAssertedLazyProcedure(lazied: Lazy<any>): Lazy<AnyProcedure>;
|
|
1294
|
+
/**
|
|
1295
|
+
* Create a new procedure that ensure the contract is applied to the procedure.
|
|
1296
|
+
*/
|
|
1297
|
+
declare function createContractedProcedure(procedure: AnyProcedure, contract: AnyContractProcedure): AnyProcedure;
|
|
1298
|
+
/**
|
|
1299
|
+
* Directly call a procedure without creating a client.
|
|
1300
|
+
*
|
|
1301
|
+
* @example
|
|
1302
|
+
* ```ts
|
|
1303
|
+
* const output = await call(getting, 'input')
|
|
1304
|
+
* const output = await call(getting, 'input', { context: { db: 'postgres' } })
|
|
1305
|
+
* ```
|
|
1306
|
+
*
|
|
1307
|
+
*/
|
|
1308
|
+
declare function call<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, input: InferSchemaInput<TInputSchema>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
|
1309
|
+
|
|
1310
|
+
type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer UInputSchema, infer UOutputSchema, infer UErrorMap, any> ? ProcedureClient<TClientContext, UInputSchema, UOutputSchema, UErrorMap> : {
|
|
1311
|
+
[K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
|
|
1312
|
+
};
|
|
1313
|
+
/**
|
|
1314
|
+
* Create Server-side client from a router.
|
|
1315
|
+
*
|
|
1316
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
1317
|
+
*/
|
|
1318
|
+
declare function createRouterClient<T extends AnyRouter, TClientContext extends ClientContext>(router: Lazyable<T | undefined>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<InferRouterInitialContext<T>, Schema<unknown, unknown>, ErrorMap, Meta, TClientContext>>): RouterClient<T, TClientContext>;
|
|
1319
|
+
|
|
1320
|
+
declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router: T, contract: AnyContractRouter): T;
|
|
1321
|
+
declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
|
|
1322
|
+
|
|
1323
|
+
export { AnyMiddleware, AnyProcedure, AnyRouter, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createAccessibleLazyRouter, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, enhanceRouter, getHiddenRouterContract, getRouter, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, resolveContractProcedures, setHiddenRouterContract, traverseContractProcedures, unlazyRouter };
|
|
1324
|
+
export type { AccessibleLazyRouter, ApiBuilder, BuilderDef, ContractProcedureCallbackOptions, DecoratedMiddleware, EnhanceRouterOptions, EnhancedRouter, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, LazyTraverseContractProceduresOptions, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares, TraverseContractProcedureCallbackOptions, TraverseContractProceduresOptions, UnlaziedRouter };
|