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