@temporary-name/server 1.9.3-alpha.21b0289906d115f2f3db137ea407a6d8d50b5ad6 → 1.9.3-alpha.25c9bb040aec8c367ea668ebd2fedbdb6ee024ff
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/aws-lambda/index.d.mts +5 -6
- package/dist/adapters/aws-lambda/index.d.ts +5 -6
- package/dist/adapters/aws-lambda/index.mjs +5 -6
- package/dist/adapters/fetch/index.d.mts +8 -85
- package/dist/adapters/fetch/index.d.ts +8 -85
- package/dist/adapters/fetch/index.mjs +17 -157
- package/dist/adapters/node/index.d.mts +9 -63
- package/dist/adapters/node/index.d.ts +9 -63
- package/dist/adapters/node/index.mjs +15 -122
- package/dist/handler/index.d.mts +28 -0
- package/dist/handler/index.d.ts +28 -0
- package/dist/handler/index.mjs +8 -0
- package/dist/helpers/index.mjs +3 -29
- package/dist/index.d.mts +355 -206
- package/dist/index.d.ts +355 -206
- package/dist/index.mjs +465 -163
- package/dist/openapi/index.d.mts +18 -53
- package/dist/openapi/index.d.ts +18 -53
- package/dist/openapi/index.mjs +391 -368
- package/dist/shared/server.0XttqWC4.mjs +339 -0
- package/dist/shared/server.BT6UIZKq.mjs +432 -0
- package/dist/shared/server.C1RJffw4.mjs +30 -0
- package/dist/shared/server.CDPDcFfG.d.ts +39 -0
- package/dist/shared/server.CjPiuQYH.d.mts +51 -0
- package/dist/shared/server.CjPiuQYH.d.ts +51 -0
- package/dist/shared/server.CqRXKroQ.mjs +156 -0
- package/dist/shared/server.gacqwfQ1.mjs +523 -0
- package/dist/shared/server.pPvU6DyC.d.mts +39 -0
- package/dist/shared/server.yrTiAhAF.d.mts +515 -0
- package/dist/shared/server.yrTiAhAF.d.ts +515 -0
- package/package.json +13 -31
- package/dist/adapters/standard/index.d.mts +0 -30
- package/dist/adapters/standard/index.d.ts +0 -30
- package/dist/adapters/standard/index.mjs +0 -9
- package/dist/plugins/index.d.mts +0 -159
- package/dist/plugins/index.d.ts +0 -159
- package/dist/plugins/index.mjs +0 -288
- package/dist/shared/server.7aL9gcoU.d.mts +0 -23
- package/dist/shared/server.BL2R5jcp.d.mts +0 -228
- package/dist/shared/server.BL2R5jcp.d.ts +0 -228
- package/dist/shared/server.CttFCjkj.mjs +0 -255
- package/dist/shared/server.D6Qs_UcF.d.mts +0 -55
- package/dist/shared/server.DFptr1Nz.d.ts +0 -23
- package/dist/shared/server.DmGicgbG.mjs +0 -413
- package/dist/shared/server.DpoO_ER_.d.ts +0 -55
- package/dist/shared/server.JtIZ8YG7.mjs +0 -237
package/dist/index.d.mts
CHANGED
|
@@ -1,48 +1,61 @@
|
|
|
1
|
-
import
|
|
2
|
-
export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, validateORPCError } from '@temporary-name/contract';
|
|
3
|
-
import { ClientContext, MaybeOptionalOptions, HTTPEndpoint, IntersectPick, 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';
|
|
1
|
+
import * as z from '@temporary-name/zod';
|
|
5
2
|
import { SchemaClass, core } from '@temporary-name/zod';
|
|
6
|
-
import
|
|
7
|
-
|
|
3
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
4
|
+
import { $input, $output } from 'zod/v4/core';
|
|
5
|
+
import { ClientContext, Value, Promisable, Client, MaybeOptionalOptions, HTTPEndpoint as HTTPEndpoint$1, IntersectPick, HTTPPath, AsyncIteratorClass, ClientOptions, HTTPMethod } from '@temporary-name/shared';
|
|
6
|
+
export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
|
|
7
|
+
import { C as Context, S as Schemas, I as InferProcedureClientInputs, a as InferSchemaOutput, M as Meta, L as Lazyable, P as Procedure, b as Contract, A as AnyShape, c as MergedSchemas, W as WrapShape, U as UnionToIntersection, d as AnySchema, R as Route, e as Middleware, f as MergedCurrentContext, g as MergedInitialContext, E as ErrorMap, V as ValidatedAuthContext, h as AuthConfig, B as BuildContextWithAuth, i as ProcedureHandler, j as InferHandlerInputs, k as InferSchemaInput, l as EnhanceRouterOptions, m as Router, n as EnhancedRouter, o as MapInputMiddleware, p as ContractDef, q as Schema, r as AnyMiddleware, s as Lazy, t as AnyProcedure, u as SchemaIssue } from './shared/server.yrTiAhAF.mjs';
|
|
8
|
+
export { av as AccessibleLazyRouter, ak as AnyContractDef, ao as AnyRouter, z as ApiError, y as ApiErrorStatic, a0 as BadGatewayError, D as BadRequestError, O as ConflictError, T as ContentTooLargeError, aA as ContractProcedureCallbackOptions, an as ContractRouter, G as ForbiddenError, a2 as GatewayTimeoutError, ar as InferRouterCurrentContexts, ap as InferRouterInitialContext, aq as InferRouterInitialContexts, as as InferRouterInputs, at as InferRouterOutputs, aI as InitialSchemas, _ as InternalServerError, a6 as LAZY_SYMBOL, a7 as LazyMeta, aB as LazyTraverseContractProceduresOptions, H as MethodNotAllowedError, af as MiddlewareNextFn, ah as MiddlewareOptions, ag as MiddlewareOutputFn, ae as MiddlewareResult, J as NotAcceptableError, N as NotFoundError, $ as NotImplementedError, Q as PreconditionFailedError, al as ProcedureDef, aj as ProcedureHandlerOptions, K as RequestTimeoutError, a1 as ServiceUnavailableError, Z as TooManyRequestsError, az as TraverseContractProcedureCallbackOptions, ay as TraverseContractProceduresOptions, aG as TypeRest, F as UnauthorizedError, aE as UnlaziedRouter, Y as UnprocessableContentError, X as UnsupportedMediaTypeError, x as ValidationError, w as ValidationErrorOptions, aw as createAccessibleLazyRouter, a5 as encodeError, ax as enhanceRouter, ab as getLazyMeta, au as getRouter, aH as initialSchemas, a3 as isApiErrorStatus, aa as isLazy, am as isProcedure, a9 as lazy, a8 as lazyInternal, v as mergeCurrentContext, ad as mergeMeta, ai as middlewareOutputFn, aD as resolveContractProcedures, a4 as toApiError, aC as traverseContractProcedures, ac as unlazy, aF as unlazyRouter } from './shared/server.yrTiAhAF.mjs';
|
|
9
|
+
import * as Draft07 from '@temporary-name/interop/json-schema-typed/draft-07';
|
|
10
|
+
import * as Draft2019 from '@temporary-name/interop/json-schema-typed/draft-2019-09';
|
|
11
|
+
import * as Draft2020 from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
12
|
+
export { a as ZodToJsonSchemaConverter, Z as ZodToJsonSchemaConverterOptions } from './shared/server.CjPiuQYH.mjs';
|
|
13
|
+
import { JSONSchema } from '@temporary-name/server/openapi';
|
|
8
14
|
export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
type ProcedureClient<TClientContext extends ClientContext, TSchemas extends Schemas> = Client<TClientContext, InferProcedureClientInputs<TSchemas>, InferSchemaOutput<TSchemas['outputSchema']>>;
|
|
17
|
+
type CreateProcedureClientOptions<TInitialContext extends Context, TClientContext extends ClientContext> = {
|
|
18
|
+
/**
|
|
19
|
+
* This is helpful for logging and analytics.
|
|
20
|
+
*/
|
|
21
|
+
path?: readonly string[];
|
|
22
|
+
} & (object extends TInitialContext ? {
|
|
23
|
+
context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
24
|
+
} : {
|
|
25
|
+
context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
|
|
26
|
+
});
|
|
27
|
+
/**
|
|
28
|
+
* Create Server-side client from a procedure.
|
|
29
|
+
*
|
|
30
|
+
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
31
|
+
*/
|
|
32
|
+
declare function createProcedureClient<TInitialContext extends Context, TSchemas extends Schemas, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TMeta>>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TClientContext>>): ProcedureClient<TClientContext, TSchemas>;
|
|
33
|
+
|
|
34
|
+
declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TSchemas, TMeta> {
|
|
11
35
|
/**
|
|
12
36
|
* Make this procedure callable (works like a function while still being a procedure).
|
|
13
37
|
*
|
|
14
38
|
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
15
39
|
*/
|
|
16
|
-
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext,
|
|
40
|
+
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TClientContext>>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TMeta> & ProcedureClient<TClientContext, TSchemas>;
|
|
17
41
|
}
|
|
18
42
|
|
|
19
|
-
declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas,
|
|
43
|
+
declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TMeta extends Meta, TGateName extends string> extends Contract<BuilderDef<TSchemas, TMeta>> {
|
|
20
44
|
z: SchemaClass<TGateName>;
|
|
21
|
-
|
|
22
|
-
* This property holds the defined options.
|
|
23
|
-
*/
|
|
24
|
-
'~orpc': BuilderDef<TSchemas, TErrorMap, TMeta>;
|
|
25
|
-
constructor(def: BuilderDef<TSchemas, TErrorMap, TMeta>);
|
|
26
|
-
/**
|
|
27
|
-
* Adds type-safe custom errors to the contract.
|
|
28
|
-
* The provided errors are spared-merged with any existing errors in the contract.
|
|
29
|
-
*
|
|
30
|
-
* @see {@link https://orpc.unnoq.com/docs/error-handling#type%E2%80%90safe-error-handling Type-Safe Error Handling Docs}
|
|
31
|
-
*/
|
|
32
|
-
errors<U extends ErrorMap>(errors: U): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, MergedErrorMap<TErrorMap, U>, TMeta, TGateName>;
|
|
45
|
+
constructor(def: BuilderDef<TSchemas, TMeta>);
|
|
33
46
|
/**
|
|
34
47
|
* Sets or updates the metadata for the contract.
|
|
35
48
|
* The provided metadata is spared-merged with any existing metadata in the contract.
|
|
36
49
|
*
|
|
37
50
|
* @see {@link https://orpc.unnoq.com/docs/metadata Metadata Docs}
|
|
38
51
|
*/
|
|
39
|
-
meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas,
|
|
52
|
+
meta(meta: TMeta): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TMeta, TGateName>;
|
|
40
53
|
endpoint<U extends AnyShape[]>(strings: TemplateStringsArray, ...values: [...U]): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
41
54
|
pathSchema: WrapShape<UnionToIntersection<U>>;
|
|
42
|
-
}>,
|
|
43
|
-
endpoint<U extends AnySchema | AnyShape = core.$ZodType<Record<string, never>, Record<string, never>>>(endpoint: HTTPEndpoint, schema?: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
55
|
+
}>, TMeta, TGateName>;
|
|
56
|
+
endpoint<U extends AnySchema | AnyShape = core.$ZodType<Record<string, never>, Record<string, never>>>(endpoint: HTTPEndpoint$1, schema?: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
44
57
|
pathSchema: WrapShape<U>;
|
|
45
|
-
}>,
|
|
58
|
+
}>, TMeta, TGateName>;
|
|
46
59
|
/**
|
|
47
60
|
* Sets or updates the route definition for the contract.
|
|
48
61
|
* The provided route is spared-merged with any existing route in the contract.
|
|
@@ -51,13 +64,13 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
51
64
|
* @see {@link https://orpc.unnoq.com/docs/openapi/routing OpenAPI Routing Docs}
|
|
52
65
|
* @see {@link https://orpc.unnoq.com/docs/openapi/input-output-structure OpenAPI Input/Output Structure Docs}
|
|
53
66
|
*/
|
|
54
|
-
endpointOpts(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas,
|
|
67
|
+
endpointOpts(route: Route): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TMeta, TGateName>;
|
|
55
68
|
query<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
56
69
|
querySchema: WrapShape<U>;
|
|
57
|
-
}>,
|
|
70
|
+
}>, TMeta, TGateName>;
|
|
58
71
|
body<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
59
72
|
bodySchema: WrapShape<U>;
|
|
60
|
-
}>,
|
|
73
|
+
}>, TMeta, TGateName>;
|
|
61
74
|
/**
|
|
62
75
|
* Defines the output validation schema.
|
|
63
76
|
*
|
|
@@ -65,7 +78,7 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
65
78
|
*/
|
|
66
79
|
output<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
|
|
67
80
|
outputSchema: WrapShape<U>;
|
|
68
|
-
}>,
|
|
81
|
+
}>, TMeta, TGateName>;
|
|
69
82
|
/**
|
|
70
83
|
* Uses a middleware to modify the context or improve the pipeline.
|
|
71
84
|
*
|
|
@@ -73,18 +86,21 @@ declare class ProcedureBuilder<TInitialContext extends Context, TCurrentContext
|
|
|
73
86
|
* @note The current context must be satisfy middleware dependent-context
|
|
74
87
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
75
88
|
*/
|
|
76
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext
|
|
89
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>>(middleware: Middleware<TCurrentContext, UOutContext, unknown, unknown, TMeta>): ProcedureBuilder<TInitialContext, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TMeta, TGateName>;
|
|
90
|
+
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext, UOutContext, unknown, unknown, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TMeta, TGateName>;
|
|
91
|
+
useErrors(errorMap: ErrorMap): ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TMeta, TGateName>;
|
|
92
|
+
useAuth<TAuthContext extends ValidatedAuthContext = false>(config: AuthConfig<TAuthContext, TCurrentContext, TMeta>): ProcedureBuilder<TInitialContext, BuildContextWithAuth<TCurrentContext, TAuthContext>, TSchemas, TMeta, TGateName>;
|
|
77
93
|
useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
|
|
78
94
|
isGateEnabled: typeof isGateEnabled;
|
|
79
|
-
}>, TSchemas,
|
|
95
|
+
}>, TSchemas, TMeta, TInferredGateName>;
|
|
80
96
|
/**
|
|
81
97
|
* Defines the handler of the procedure.
|
|
82
98
|
*
|
|
83
99
|
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
84
100
|
*/
|
|
85
|
-
handler(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>,
|
|
101
|
+
handler(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TMeta>;
|
|
86
102
|
}
|
|
87
|
-
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas,
|
|
103
|
+
declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TMeta extends Meta, TGateName extends string> extends ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TMeta, TGateName> {
|
|
88
104
|
/**
|
|
89
105
|
* Prefixes all procedures in the router.
|
|
90
106
|
* The provided prefix is post-appended to any existing router prefix.
|
|
@@ -93,205 +109,327 @@ declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentCo
|
|
|
93
109
|
*
|
|
94
110
|
* @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
|
|
95
111
|
*/
|
|
96
|
-
prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TSchemas,
|
|
112
|
+
prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TSchemas, TMeta, TGateName>;
|
|
97
113
|
/**
|
|
98
114
|
* Adds tags to all procedures in the router.
|
|
99
115
|
* This helpful when you want to group procedures together in the OpenAPI specification.
|
|
100
116
|
*
|
|
101
117
|
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
|
|
102
118
|
*/
|
|
103
|
-
tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext,
|
|
119
|
+
tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TMeta>;
|
|
104
120
|
/**
|
|
105
121
|
* Applies all of the previously defined options to the specified router.
|
|
106
122
|
*
|
|
107
123
|
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
108
124
|
*/
|
|
109
|
-
router<U extends Router<
|
|
125
|
+
router<U extends Router<TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext>;
|
|
110
126
|
}
|
|
111
|
-
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context,
|
|
127
|
+
interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, TMeta, any>, 'prefix' | 'tag' | 'router'> {
|
|
112
128
|
/**
|
|
113
129
|
* This property holds the defined options.
|
|
114
130
|
*/
|
|
115
|
-
'~orpc': EnhanceRouterOptions
|
|
131
|
+
'~orpc': EnhanceRouterOptions;
|
|
116
132
|
}
|
|
117
133
|
|
|
118
|
-
interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput,
|
|
134
|
+
interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TMeta extends Meta> extends Middleware<TInContext, TOutContext, TInput, TOutput, TMeta> {
|
|
119
135
|
/**
|
|
120
136
|
* Change the expected input type by providing a map function.
|
|
121
137
|
*/
|
|
122
|
-
mapInput<UInput>(map: MapInputMiddleware<UInput, TInput>): DecoratedMiddleware<TInContext, TOutContext, UInput, TOutput,
|
|
123
|
-
/**
|
|
124
|
-
* Concatenates two middlewares.
|
|
125
|
-
*
|
|
126
|
-
* @info Pass second argument to map the input.
|
|
127
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware#concatenation Middleware Concatenation Docs}
|
|
128
|
-
*/
|
|
129
|
-
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>;
|
|
130
|
-
/**
|
|
131
|
-
* Concatenates two middlewares.
|
|
132
|
-
*
|
|
133
|
-
* @info Pass second argument to map the input.
|
|
134
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware#concatenation Middleware Concatenation Docs}
|
|
135
|
-
*/
|
|
136
|
-
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>;
|
|
138
|
+
mapInput<UInput>(map: MapInputMiddleware<UInput, TInput>): DecoratedMiddleware<TInContext, TOutContext, UInput, TOutput, TMeta>;
|
|
137
139
|
}
|
|
138
|
-
declare function decorateMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput,
|
|
140
|
+
declare function decorateMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TMeta extends Meta>(middleware: Middleware<TInContext, TOutContext, TInput, TOutput, TMeta>): DecoratedMiddleware<TInContext, TOutContext, TInput, TOutput, TMeta>;
|
|
139
141
|
|
|
140
|
-
interface BuilderDef<TSchemas extends Schemas,
|
|
141
|
-
middlewares: readonly AnyMiddleware[];
|
|
142
|
-
inputValidationIndex: number;
|
|
143
|
-
outputValidationIndex: number;
|
|
142
|
+
interface BuilderDef<TSchemas extends Schemas, TMeta extends Meta> extends ContractDef<TSchemas, TMeta>, EnhanceRouterOptions {
|
|
144
143
|
}
|
|
145
|
-
declare class Builder<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas,
|
|
144
|
+
declare class Builder<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TMeta extends Meta, TGateName extends string> extends BuilderWithMiddlewares<TInitialContext, TCurrentContext, TSchemas, TMeta, TGateName> {
|
|
146
145
|
/**
|
|
147
146
|
* Set or override the initial context.
|
|
148
147
|
*
|
|
149
148
|
* @see {@link https://orpc.unnoq.com/docs/context Context Docs}
|
|
150
149
|
*/
|
|
151
|
-
$context<U extends Context>(): Builder<U, U, TSchemas,
|
|
150
|
+
$context<U extends Context>(): Builder<U, U, TSchemas, TMeta, TGateName>;
|
|
152
151
|
/**
|
|
153
152
|
* Creates a middleware.
|
|
154
153
|
*
|
|
155
154
|
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
156
155
|
*/
|
|
157
156
|
middleware<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
|
|
158
|
-
middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput,
|
|
159
|
-
}
|
|
160
|
-
type ApiBuilder<TMeta extends Meta> = Builder<Record<never, never>, Record<never, never>, InitialSchemas, Record<never, never>, TMeta, never>;
|
|
161
|
-
interface ApiBuilderOpts<TMeta extends Meta> {
|
|
162
|
-
meta?: TMeta;
|
|
157
|
+
middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, TMeta>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, TMeta>;
|
|
163
158
|
}
|
|
164
|
-
declare
|
|
165
|
-
|
|
159
|
+
declare const baseApi: Builder<{}, {}, {
|
|
160
|
+
pathSchema: z.KrustyObject<{}, zod_v4_core.$strict, z.KrustyInternals<string>>;
|
|
161
|
+
querySchema: z.KrustyObject<{}, zod_v4_core.$strict, z.KrustyInternals<string>>;
|
|
162
|
+
bodySchema: z.KrustyObject<{}, zod_v4_core.$strict, z.KrustyInternals<string>>;
|
|
163
|
+
outputSchema: z.KrustyUnknown<z.KrustyInternals<string>>;
|
|
164
|
+
}, Record<never, never>, never>;
|
|
166
165
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> {
|
|
171
|
-
/**
|
|
172
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
173
|
-
*
|
|
174
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
175
|
-
* @info Pass second argument to map the input.
|
|
176
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
177
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
178
|
-
*/
|
|
179
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
180
|
-
/**
|
|
181
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
182
|
-
*
|
|
183
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
184
|
-
* @info Pass second argument to map the input.
|
|
185
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
186
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
187
|
-
*/
|
|
188
|
-
use<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferHandlerInputs<TSchemas>, UInput>): ImplementedProcedure<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
189
|
-
/**
|
|
190
|
-
* Make this procedure callable (works like a function while still being a procedure).
|
|
191
|
-
*
|
|
192
|
-
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
193
|
-
*/
|
|
194
|
-
callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, TClientContext>>): ImplementedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> & ProcedureClient<TClientContext, TSchemas, TErrorMap>;
|
|
166
|
+
interface EventIteratorSchemaDetails {
|
|
167
|
+
yields: AnySchema;
|
|
168
|
+
returns?: AnySchema;
|
|
195
169
|
}
|
|
196
170
|
/**
|
|
197
|
-
*
|
|
171
|
+
* Define schema for an event iterator.
|
|
172
|
+
*
|
|
173
|
+
* @see {@link https://orpc.unnoq.com/docs/event-iterator#validate-event-iterator Validate Event Iterator Docs}
|
|
198
174
|
*/
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
203
|
-
*
|
|
204
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
205
|
-
* @info Pass second argument to map the input.
|
|
206
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
207
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
208
|
-
*/
|
|
209
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
210
|
-
/**
|
|
211
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
212
|
-
*
|
|
213
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
214
|
-
* @info Pass second argument to map the input.
|
|
215
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
216
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
217
|
-
*/
|
|
218
|
-
'use'<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, UInput, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, UInput, InferSchemaInput<TSchemas['outputSchema']>, ORPCErrorConstructorMap<TErrorMap>, TMeta>, mapInput: MapInputMiddleware<InferHandlerInputs<TSchemas>, UInput>): ProcedureImplementer<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta>;
|
|
219
|
-
/**
|
|
220
|
-
* Defines the handler of the procedure.
|
|
221
|
-
*
|
|
222
|
-
* @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
|
|
223
|
-
*/
|
|
224
|
-
'handler'(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): ImplementedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
|
|
225
|
-
}
|
|
175
|
+
declare function eventIterator<TYieldIn, TYieldOut, TReturnIn = unknown, TReturnOut = unknown>(yields: Schema<TYieldIn, TYieldOut>, returns?: Schema<TReturnIn, TReturnOut>): Schema<AsyncIteratorObject<TYieldIn, TReturnIn, void>, AsyncIteratorClass<TYieldOut, TReturnOut, void>>;
|
|
176
|
+
declare function getEventIteratorSchemaDetails(schema: AnySchema | undefined): undefined | EventIteratorSchemaDetails;
|
|
226
177
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
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>>;
|
|
236
|
-
/**
|
|
237
|
-
* Applies all of the previously defined options to the specified router.
|
|
238
|
-
* And enforces the router match the contract.
|
|
239
|
-
*
|
|
240
|
-
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
241
|
-
*/
|
|
242
|
-
router<U extends Router<T, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
178
|
+
type JsonSchema = Draft2020.JSONSchema | Draft2019.JSONSchema | Draft07.JSONSchema;
|
|
179
|
+
declare enum JsonSchemaXNativeType {
|
|
180
|
+
BigInt = "bigint",
|
|
181
|
+
RegExp = "regexp",
|
|
182
|
+
Date = "date",
|
|
183
|
+
Url = "url",
|
|
184
|
+
Set = "set",
|
|
185
|
+
Map = "map"
|
|
243
186
|
}
|
|
244
|
-
type ImplementerInternalWithMiddlewares<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer USchemas, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, USchemas, UErrorMap, UMeta> : RouterImplementerWithMiddlewares<TContract, TInitialContext, TCurrentContext> & {
|
|
245
|
-
[K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternalWithMiddlewares<TContract[K], TInitialContext, TCurrentContext> : never;
|
|
246
|
-
};
|
|
247
187
|
|
|
248
|
-
interface
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
middleware<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
|
|
255
|
-
middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<InferContractRouterErrorMap<T>>, InferContractRouterMeta<T>>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, any, InferContractRouterMeta<T>>;
|
|
256
|
-
/**
|
|
257
|
-
* Uses a middleware to modify the context or improve the pipeline.
|
|
258
|
-
*
|
|
259
|
-
* @info Supports both normal middleware and inline middleware implementations.
|
|
260
|
-
* @note The current context must be satisfy middleware dependent-context
|
|
261
|
-
* @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
|
|
262
|
-
*/
|
|
263
|
-
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>>;
|
|
264
|
-
/**
|
|
265
|
-
* Applies all of the previously defined options to the specified router.
|
|
266
|
-
* And enforces the router match the contract.
|
|
267
|
-
*
|
|
268
|
-
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
269
|
-
*/
|
|
270
|
-
router<U extends Router<T, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
271
|
-
/**
|
|
272
|
-
* Create a lazy router
|
|
273
|
-
* And applies all of the previously defined options to the specified router.
|
|
274
|
-
* And enforces the router match the contract.
|
|
275
|
-
*
|
|
276
|
-
* @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
|
|
277
|
-
*/
|
|
278
|
-
lazyRoute<U extends Router<T, TCurrentContext>>(loader: () => Promise<{
|
|
279
|
-
default: U;
|
|
280
|
-
}>): EnhancedRouter<Lazy<U>, TInitialContext, TCurrentContext, Record<never, never>>;
|
|
188
|
+
interface experimental_JsonSchemaCoerceOptions {
|
|
189
|
+
components?: Record<string, JsonSchema>;
|
|
190
|
+
}
|
|
191
|
+
declare class experimental_JsonSchemaCoercer {
|
|
192
|
+
#private;
|
|
193
|
+
coerce(schema: JsonSchema, value: unknown, options?: experimental_JsonSchemaCoerceOptions): unknown;
|
|
281
194
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Zod registry for customizing generated JSON schema, can use both for .input and .output
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```ts
|
|
201
|
+
* import { JSON_SCHEMA_REGISTRY } from '@temporary-name/zod/zod4'
|
|
202
|
+
*
|
|
203
|
+
* const user = z.object({
|
|
204
|
+
* name: z.string(),
|
|
205
|
+
* age: z.number(),
|
|
206
|
+
* })
|
|
207
|
+
*
|
|
208
|
+
* JSON_SCHEMA_REGISTRY.add(user, {
|
|
209
|
+
* examples: [{ name: 'John', age: 20 }],
|
|
210
|
+
* })
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
214
|
+
$anchor?: string;
|
|
215
|
+
$comment?: string;
|
|
216
|
+
$defs?: Record<string, JSONSchema>;
|
|
217
|
+
$dynamicAnchor?: string;
|
|
218
|
+
$dynamicRef?: string;
|
|
219
|
+
$id?: string;
|
|
220
|
+
$ref?: string;
|
|
221
|
+
$schema?: string;
|
|
222
|
+
$vocabulary?: Record<string, string>;
|
|
223
|
+
additionalItems?: JSONSchema;
|
|
224
|
+
additionalProperties?: JSONSchema;
|
|
225
|
+
allOf?: (JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
|
226
|
+
anyOf?: (JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
|
227
|
+
const?: typeof $input | typeof $output | undefined;
|
|
228
|
+
contains?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
|
229
|
+
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
230
|
+
contentMediaType?: string;
|
|
231
|
+
contentSchema?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
|
232
|
+
default?: typeof $input | typeof $output | undefined;
|
|
233
|
+
definitions?: Record<string, JSONSchema>;
|
|
234
|
+
dependencies?: Record<string, (string[] | readonly string[]) | JSONSchema>;
|
|
235
|
+
dependentRequired?: Record<string, string[] | readonly string[]>;
|
|
236
|
+
dependentSchemas?: Record<string, JSONSchema>;
|
|
237
|
+
deprecated?: boolean;
|
|
238
|
+
description?: string;
|
|
239
|
+
else?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
|
240
|
+
enum?: ((typeof $input | typeof $output)[] | readonly (typeof $input | typeof $output)[]) | undefined;
|
|
241
|
+
examples?: ((typeof $input | typeof $output)[] | readonly (typeof $input | typeof $output)[]) | undefined;
|
|
242
|
+
exclusiveMaximum?: number;
|
|
243
|
+
exclusiveMinimum?: number;
|
|
244
|
+
format?: string;
|
|
245
|
+
if?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
|
246
|
+
items?: JSONSchema;
|
|
247
|
+
maxContains?: number;
|
|
248
|
+
maximum?: number;
|
|
249
|
+
maxItems?: number;
|
|
250
|
+
maxLength?: number;
|
|
251
|
+
maxProperties?: number;
|
|
252
|
+
minContains?: number;
|
|
253
|
+
minimum?: number;
|
|
254
|
+
minItems?: number;
|
|
255
|
+
minLength?: number;
|
|
256
|
+
minProperties?: number;
|
|
257
|
+
multipleOf?: number;
|
|
258
|
+
not?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
|
259
|
+
oneOf?: (JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
|
260
|
+
pattern?: string;
|
|
261
|
+
patternProperties?: Record<string, JSONSchema>;
|
|
262
|
+
prefixItems?: (JSONSchema<any, JSONSchema.TypeValue>[] | readonly JSONSchema<any, JSONSchema.TypeValue>[]) | JSONSchema;
|
|
263
|
+
properties?: Record<string, JSONSchema>;
|
|
264
|
+
propertyNames?: JSONSchema;
|
|
265
|
+
readOnly?: boolean;
|
|
266
|
+
required?: string[] | readonly string[];
|
|
267
|
+
then?: JSONSchema<typeof $input | typeof $output, JSONSchema.TypeValue> | undefined;
|
|
268
|
+
title?: string;
|
|
269
|
+
type?: JSONSchema.TypeValue | undefined;
|
|
270
|
+
unevaluatedItems?: JSONSchema;
|
|
271
|
+
unevaluatedProperties?: JSONSchema;
|
|
272
|
+
uniqueItems?: boolean;
|
|
273
|
+
writeOnly?: boolean;
|
|
274
|
+
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
275
|
+
/**
|
|
276
|
+
* Zod registry for customizing generated JSON schema, only useful for .input
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* import { JSON_SCHEMA_INPUT_REGISTRY } from '@temporary-name/zod/zod4'
|
|
281
|
+
*
|
|
282
|
+
* const user = z.object({
|
|
283
|
+
* name: z.string(),
|
|
284
|
+
* age: z.string().transform(v => Number(v)),
|
|
285
|
+
* })
|
|
286
|
+
*
|
|
287
|
+
* JSON_SCHEMA_REGISTRY.add(user, {
|
|
288
|
+
* examples: [{ name: 'John', age: "20" }],
|
|
289
|
+
* })
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
293
|
+
$anchor?: string;
|
|
294
|
+
$comment?: string;
|
|
295
|
+
$defs?: Record<string, JSONSchema>;
|
|
296
|
+
$dynamicAnchor?: string;
|
|
297
|
+
$dynamicRef?: string;
|
|
298
|
+
$id?: string;
|
|
299
|
+
$ref?: string;
|
|
300
|
+
$schema?: string;
|
|
301
|
+
$vocabulary?: Record<string, string>;
|
|
302
|
+
additionalItems?: JSONSchema;
|
|
303
|
+
additionalProperties?: JSONSchema;
|
|
304
|
+
allOf?: (JSONSchema<typeof $input, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input, JSONSchema.TypeValue>[]) | undefined;
|
|
305
|
+
anyOf?: (JSONSchema<typeof $input, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input, JSONSchema.TypeValue>[]) | undefined;
|
|
306
|
+
const?: typeof $input | undefined;
|
|
307
|
+
contains?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
|
308
|
+
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
309
|
+
contentMediaType?: string;
|
|
310
|
+
contentSchema?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
|
311
|
+
default?: typeof $input | undefined;
|
|
312
|
+
definitions?: Record<string, JSONSchema>;
|
|
313
|
+
dependencies?: Record<string, (string[] | readonly string[]) | JSONSchema>;
|
|
314
|
+
dependentRequired?: Record<string, string[] | readonly string[]>;
|
|
315
|
+
dependentSchemas?: Record<string, JSONSchema>;
|
|
316
|
+
deprecated?: boolean;
|
|
317
|
+
description?: string;
|
|
318
|
+
else?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
|
319
|
+
enum?: ((typeof $input)[] | readonly (typeof $input)[]) | undefined;
|
|
320
|
+
examples?: ((typeof $input)[] | readonly (typeof $input)[]) | undefined;
|
|
321
|
+
exclusiveMaximum?: number;
|
|
322
|
+
exclusiveMinimum?: number;
|
|
323
|
+
format?: string;
|
|
324
|
+
if?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
|
325
|
+
items?: JSONSchema;
|
|
326
|
+
maxContains?: number;
|
|
327
|
+
maximum?: number;
|
|
328
|
+
maxItems?: number;
|
|
329
|
+
maxLength?: number;
|
|
330
|
+
maxProperties?: number;
|
|
331
|
+
minContains?: number;
|
|
332
|
+
minimum?: number;
|
|
333
|
+
minItems?: number;
|
|
334
|
+
minLength?: number;
|
|
335
|
+
minProperties?: number;
|
|
336
|
+
multipleOf?: number;
|
|
337
|
+
not?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
|
338
|
+
oneOf?: (JSONSchema<typeof $input, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $input, JSONSchema.TypeValue>[]) | undefined;
|
|
339
|
+
pattern?: string;
|
|
340
|
+
patternProperties?: Record<string, JSONSchema>;
|
|
341
|
+
prefixItems?: (JSONSchema<any, JSONSchema.TypeValue>[] | readonly JSONSchema<any, JSONSchema.TypeValue>[]) | JSONSchema;
|
|
342
|
+
properties?: Record<string, JSONSchema>;
|
|
343
|
+
propertyNames?: JSONSchema;
|
|
344
|
+
readOnly?: boolean;
|
|
345
|
+
required?: string[] | readonly string[];
|
|
346
|
+
then?: JSONSchema<typeof $input, JSONSchema.TypeValue> | undefined;
|
|
347
|
+
title?: string;
|
|
348
|
+
type?: JSONSchema.TypeValue | undefined;
|
|
349
|
+
unevaluatedItems?: JSONSchema;
|
|
350
|
+
unevaluatedProperties?: JSONSchema;
|
|
351
|
+
uniqueItems?: boolean;
|
|
352
|
+
writeOnly?: boolean;
|
|
353
|
+
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
354
|
+
/**
|
|
355
|
+
* Zod registry for customizing generated JSON schema, only useful for .input
|
|
356
|
+
*
|
|
357
|
+
* @example
|
|
358
|
+
* ```ts
|
|
359
|
+
* import { JSON_SCHEMA_OUTPUT_REGISTRY } from '@temporary-name/zod/zod4'
|
|
360
|
+
*
|
|
361
|
+
* const user = z.object({
|
|
362
|
+
* name: z.string(),
|
|
363
|
+
* age: z.string().transform(v => Number(v)),
|
|
364
|
+
* })
|
|
365
|
+
*
|
|
366
|
+
* JSON_SCHEMA_OUTPUT_REGISTRY.add(user, {
|
|
367
|
+
* examples: [{ name: 'John', age: 20 }],
|
|
368
|
+
* })
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
declare const JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
372
|
+
$anchor?: string;
|
|
373
|
+
$comment?: string;
|
|
374
|
+
$defs?: Record<string, JSONSchema>;
|
|
375
|
+
$dynamicAnchor?: string;
|
|
376
|
+
$dynamicRef?: string;
|
|
377
|
+
$id?: string;
|
|
378
|
+
$ref?: string;
|
|
379
|
+
$schema?: string;
|
|
380
|
+
$vocabulary?: Record<string, string>;
|
|
381
|
+
additionalItems?: JSONSchema;
|
|
382
|
+
additionalProperties?: JSONSchema;
|
|
383
|
+
allOf?: (JSONSchema<typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
|
384
|
+
anyOf?: (JSONSchema<typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
|
385
|
+
const?: typeof $output | undefined;
|
|
386
|
+
contains?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
|
387
|
+
contentEncoding?: "7bit" | "8bit" | "base64" | "binary" | "ietf-token" | "quoted-printable" | "x-token";
|
|
388
|
+
contentMediaType?: string;
|
|
389
|
+
contentSchema?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
|
390
|
+
default?: typeof $output | undefined;
|
|
391
|
+
definitions?: Record<string, JSONSchema>;
|
|
392
|
+
dependencies?: Record<string, (string[] | readonly string[]) | JSONSchema>;
|
|
393
|
+
dependentRequired?: Record<string, string[] | readonly string[]>;
|
|
394
|
+
dependentSchemas?: Record<string, JSONSchema>;
|
|
395
|
+
deprecated?: boolean;
|
|
396
|
+
description?: string;
|
|
397
|
+
else?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
|
398
|
+
enum?: ((typeof $output)[] | readonly (typeof $output)[]) | undefined;
|
|
399
|
+
examples?: ((typeof $output)[] | readonly (typeof $output)[]) | undefined;
|
|
400
|
+
exclusiveMaximum?: number;
|
|
401
|
+
exclusiveMinimum?: number;
|
|
402
|
+
format?: string;
|
|
403
|
+
if?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
|
404
|
+
items?: JSONSchema;
|
|
405
|
+
maxContains?: number;
|
|
406
|
+
maximum?: number;
|
|
407
|
+
maxItems?: number;
|
|
408
|
+
maxLength?: number;
|
|
409
|
+
maxProperties?: number;
|
|
410
|
+
minContains?: number;
|
|
411
|
+
minimum?: number;
|
|
412
|
+
minItems?: number;
|
|
413
|
+
minLength?: number;
|
|
414
|
+
minProperties?: number;
|
|
415
|
+
multipleOf?: number;
|
|
416
|
+
not?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
|
417
|
+
oneOf?: (JSONSchema<typeof $output, JSONSchema.TypeValue>[] | readonly JSONSchema<typeof $output, JSONSchema.TypeValue>[]) | undefined;
|
|
418
|
+
pattern?: string;
|
|
419
|
+
patternProperties?: Record<string, JSONSchema>;
|
|
420
|
+
prefixItems?: (JSONSchema<any, JSONSchema.TypeValue>[] | readonly JSONSchema<any, JSONSchema.TypeValue>[]) | JSONSchema;
|
|
421
|
+
properties?: Record<string, JSONSchema>;
|
|
422
|
+
propertyNames?: JSONSchema;
|
|
423
|
+
readOnly?: boolean;
|
|
424
|
+
required?: string[] | readonly string[];
|
|
425
|
+
then?: JSONSchema<typeof $output, JSONSchema.TypeValue> | undefined;
|
|
426
|
+
title?: string;
|
|
427
|
+
type?: JSONSchema.TypeValue | undefined;
|
|
428
|
+
unevaluatedItems?: JSONSchema;
|
|
429
|
+
unevaluatedProperties?: JSONSchema;
|
|
430
|
+
uniqueItems?: boolean;
|
|
431
|
+
writeOnly?: boolean;
|
|
432
|
+
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
295
433
|
|
|
296
434
|
declare function isStartWithMiddlewares(middlewares: readonly AnyMiddleware[], compare: readonly AnyMiddleware[]): boolean;
|
|
297
435
|
declare function mergeMiddlewares(first: readonly AnyMiddleware[], second: readonly AnyMiddleware[], options: {
|
|
@@ -300,10 +438,6 @@ declare function mergeMiddlewares(first: readonly AnyMiddleware[], second: reado
|
|
|
300
438
|
declare function addMiddleware(middlewares: readonly AnyMiddleware[], addition: AnyMiddleware): AnyMiddleware[];
|
|
301
439
|
|
|
302
440
|
declare function createAssertedLazyProcedure(lazied: Lazy<any>): Lazy<AnyProcedure>;
|
|
303
|
-
/**
|
|
304
|
-
* Create a new procedure that ensure the contract is applied to the procedure.
|
|
305
|
-
*/
|
|
306
|
-
declare function createContractedProcedure(procedure: AnyProcedure, contract: AnyContractProcedure): AnyProcedure;
|
|
307
441
|
/**
|
|
308
442
|
* Directly call a procedure without creating a client.
|
|
309
443
|
*
|
|
@@ -314,20 +448,35 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
|
|
|
314
448
|
* ```
|
|
315
449
|
*
|
|
316
450
|
*/
|
|
317
|
-
declare function call<TInitialContext extends Context, TSchemas extends Schemas,
|
|
451
|
+
declare function call<TInitialContext extends Context, TSchemas extends Schemas, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TMeta>>, input: InferProcedureClientInputs<TSchemas>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, {}> & Omit<ClientOptions<{}>, 'context'>>): Promise<InferSchemaOutput<TSchemas['outputSchema']>>;
|
|
318
452
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
453
|
+
declare function isSchemaIssue(issue: unknown): issue is SchemaIssue;
|
|
454
|
+
|
|
455
|
+
type HTTPEndpoint = `${HTTPMethod} ${HTTPPath}`;
|
|
456
|
+
declare const endpointRegex: RegExp;
|
|
322
457
|
/**
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
* @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
|
|
458
|
+
* @internal
|
|
326
459
|
*/
|
|
327
|
-
declare function
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
460
|
+
declare function isDevelopment(): boolean;
|
|
461
|
+
/**
|
|
462
|
+
* @internal
|
|
463
|
+
*/
|
|
464
|
+
declare function standardizeHTTPPath(path: HTTPPath): HTTPPath;
|
|
465
|
+
/**
|
|
466
|
+
* @internal
|
|
467
|
+
*/
|
|
468
|
+
declare function getDynamicParams(path: HTTPPath | undefined): {
|
|
469
|
+
raw: string;
|
|
470
|
+
name: string;
|
|
471
|
+
}[] | undefined;
|
|
472
|
+
/**
|
|
473
|
+
* @internal
|
|
474
|
+
*/
|
|
475
|
+
declare function parseEndpointDefinition(stringsOrEndpoint: TemplateStringsArray | HTTPEndpoint, values: AnyShape[] | [AnySchema | AnyShape] | []): {
|
|
476
|
+
method: HTTPMethod;
|
|
477
|
+
path: HTTPPath;
|
|
478
|
+
pathSchema: AnySchema;
|
|
479
|
+
};
|
|
331
480
|
|
|
332
|
-
export { AnyMiddleware, AnyProcedure,
|
|
333
|
-
export type {
|
|
481
|
+
export { AnyMiddleware, AnyProcedure, AnySchema, AnyShape, BuildContextWithAuth, Builder, BuilderWithMiddlewares, Context, Contract, ContractDef, DecoratedProcedure, EnhanceRouterOptions, EnhancedRouter, ErrorMap, InferHandlerInputs, InferProcedureClientInputs, InferSchemaInput, InferSchemaOutput, JSON_SCHEMA_INPUT_REGISTRY, JSON_SCHEMA_OUTPUT_REGISTRY, JSON_SCHEMA_REGISTRY, JsonSchemaXNativeType, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, MergedSchemas, Meta, Middleware, Procedure, ProcedureBuilder, ProcedureHandler, Router, Schema, SchemaIssue, Schemas, UnionToIntersection, WrapShape, addMiddleware, baseApi, call, createAssertedLazyProcedure, createProcedureClient, decorateMiddleware, endpointRegex, eventIterator, experimental_JsonSchemaCoercer, getDynamicParams, getEventIteratorSchemaDetails, isDevelopment, isSchemaIssue, isStartWithMiddlewares, mergeMiddlewares, parseEndpointDefinition, standardizeHTTPPath };
|
|
482
|
+
export type { BuilderDef, CreateProcedureClientOptions, DecoratedMiddleware, EventIteratorSchemaDetails, HTTPEndpoint, JsonSchema, ProcedureClient, RouterBuilder, experimental_JsonSchemaCoerceOptions };
|