@temporary-name/server 1.9.3-alpha.5dc8b200530586870ac736830d4584e0333cfd05 → 1.9.3-alpha.62d88f5cf3908d4411b5278f1824b69334da8072

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.
Files changed (42) hide show
  1. package/dist/adapters/aws-lambda/index.d.mts +5 -6
  2. package/dist/adapters/aws-lambda/index.d.ts +5 -6
  3. package/dist/adapters/aws-lambda/index.mjs +5 -6
  4. package/dist/adapters/fetch/index.d.mts +8 -85
  5. package/dist/adapters/fetch/index.d.ts +8 -85
  6. package/dist/adapters/fetch/index.mjs +17 -157
  7. package/dist/adapters/node/index.d.mts +9 -63
  8. package/dist/adapters/node/index.d.ts +9 -63
  9. package/dist/adapters/node/index.mjs +15 -122
  10. package/dist/{adapters/standard → handler}/index.d.mts +5 -7
  11. package/dist/{adapters/standard → handler}/index.d.ts +5 -7
  12. package/dist/handler/index.mjs +8 -0
  13. package/dist/index.d.mts +355 -208
  14. package/dist/index.d.ts +355 -208
  15. package/dist/index.mjs +421 -207
  16. package/dist/openapi/index.d.mts +18 -53
  17. package/dist/openapi/index.d.ts +18 -53
  18. package/dist/openapi/index.mjs +391 -368
  19. package/dist/shared/server.Blt424vz.mjs +523 -0
  20. package/dist/shared/server.Bmxjwleq.d.ts +39 -0
  21. package/dist/shared/server.BnAF9pfn.mjs +339 -0
  22. package/dist/shared/server.CCWAen7P.mjs +156 -0
  23. package/dist/shared/server.CjPiuQYH.d.mts +51 -0
  24. package/dist/shared/server.CjPiuQYH.d.ts +51 -0
  25. package/dist/shared/server.DLyn62VH.d.mts +39 -0
  26. package/dist/shared/server.DpIhEnBO.d.mts +515 -0
  27. package/dist/shared/server.DpIhEnBO.d.ts +515 -0
  28. package/dist/shared/server.MJ43MXYj.mjs +432 -0
  29. package/package.json +13 -19
  30. package/dist/adapters/standard/index.mjs +0 -9
  31. package/dist/plugins/index.d.mts +0 -84
  32. package/dist/plugins/index.d.ts +0 -84
  33. package/dist/plugins/index.mjs +0 -116
  34. package/dist/shared/server.B-meye9-.d.ts +0 -55
  35. package/dist/shared/server.Ba0Z2fNc.mjs +0 -254
  36. package/dist/shared/server.DkYpsO6W.d.mts +0 -251
  37. package/dist/shared/server.DkYpsO6W.d.ts +0 -251
  38. package/dist/shared/server.DwNnHUZP.d.ts +0 -23
  39. package/dist/shared/server.I-tTl_ce.d.mts +0 -23
  40. package/dist/shared/server.JtIZ8YG7.mjs +0 -237
  41. package/dist/shared/server.miXh-9wo.mjs +0 -416
  42. package/dist/shared/server.vLcMd_kA.d.mts +0 -55
package/dist/index.d.ts CHANGED
@@ -1,48 +1,61 @@
1
- import { Schemas, ErrorMap, Meta, ContractProcedure, MergedErrorMap, AnyShape, MergedSchemas, WrapShape, UnionToIntersection, AnySchema, Route, InferHandlerInputs, InferSchemaInput, ContractRouter, ContractProcedureDef, InitialSchemas, AnyContractRouter, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure, InferProcedureClientInputs, InferSchemaOutput, ErrorFromErrorMap, Schema } from '@temporary-name/contract';
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, OptionalIfEmpty, HTTPPath, ClientOptions, ClientPromiseResult } from '@temporary-name/shared';
4
- export { AsyncIteratorClass, ClientContext, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, HTTPMethod, HTTPPath, IntersectPick, ORPCError, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, isDefinedError, onError, onFinish, onStart, onSuccess, safe, streamToAsyncIteratorClass as streamToEventIterator } from '@temporary-name/shared';
5
- import { C as Context, P as Procedure, a as CreateProcedureClientOptions, b as ProcedureClient, M as Middleware, O as ORPCErrorConstructorMap, c as MergedInitialContext, d as MergedCurrentContext, A as AuthType, V as ValidatedAuthContext, e as AuthConfig, B as BuildContextWithAuth, f as ProcedureHandler, E as EnhanceRouterOptions, R as Router, g as EnhancedRouter, h as MapInputMiddleware, i as AnyMiddleware, T as TypedAuthConfig, L as Lazy, j as AnyProcedure, k as Lazyable, l as AnyRouter, I as InferRouterInitialContext } from './shared/server.DkYpsO6W.js';
6
- export { Z as AccessibleLazyRouter, a2 as ContractProcedureCallbackOptions, G as DefaultProcedureHandlerOptions, U as InferRouterCurrentContexts, S as InferRouterInitialContexts, W as InferRouterInputs, X as InferRouterOutputs, q as LAZY_SYMBOL, r as LazyMeta, a3 as LazyTraverseContractProceduresOptions, y as MiddlewareNextFn, D as MiddlewareOptions, z as MiddlewareOutputFn, x as MiddlewareResult, o as ORPCErrorConstructorMapItem, n as ORPCErrorConstructorMapItemOptions, N as ProcedureClientInterceptorOptions, J as ProcedureDef, H as ProcedureHandlerOptions, a1 as TraverseContractProcedureCallbackOptions, a0 as TraverseContractProceduresOptions, a6 as UnlaziedRouter, _ as createAccessibleLazyRouter, p as createORPCErrorConstructorMap, Q as createProcedureClient, $ as enhanceRouter, v as getLazyMeta, Y as getRouter, u as isLazy, K as isProcedure, t as lazy, s as lazyInternal, m as mergeCurrentContext, F as middlewareOutputFn, a5 as resolveContractProcedures, a4 as traverseContractProcedures, w as unlazy, a7 as unlazyRouter } from './shared/server.DkYpsO6W.js';
1
+ import * as z from '@temporary-name/zod';
7
2
  import { SchemaClass, core } from '@temporary-name/zod';
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.DpIhEnBO.js';
8
+ export { z as APIError, y as APIErrorStatic, av as AccessibleLazyRouter, ak as AnyContractDef, ao as AnyRouter, 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.DpIhEnBO.js';
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.js';
13
+ import { JSONSchema } from '@temporary-name/server/openapi';
8
14
  export { getEventMeta, withEventMeta } from '@temporary-name/standard-server';
9
15
 
10
- declare class DecoratedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> {
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, TSchemas['outputSchema'], TErrorMap, TMeta, TClientContext>>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> & ProcedureClient<TClientContext, TSchemas, TErrorMap>;
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, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ContractProcedure<TSchemas, TErrorMap, TMeta> {
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, TErrorMap, TMeta, TGateName>;
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
- }>, TErrorMap, TMeta, TGateName>;
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
- }>, TErrorMap, TMeta, TGateName>;
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, TErrorMap, TMeta, TGateName>;
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
- }>, TErrorMap, TMeta, TGateName>;
70
+ }>, TMeta, TGateName>;
58
71
  body<U extends AnySchema | AnyShape>(schema: U): ProcedureBuilder<TInitialContext, TCurrentContext, MergedSchemas<TSchemas, {
59
72
  bodySchema: WrapShape<U>;
60
- }>, TErrorMap, TMeta, TGateName>;
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
- }>, TErrorMap, TMeta, TGateName>;
81
+ }>, TMeta, TGateName>;
69
82
  /**
70
83
  * Uses a middleware to modify the context or improve the pipeline.
71
84
  *
@@ -73,19 +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>, UInContext extends Context = TCurrentContext>(middleware: Middleware<UInContext | TCurrentContext, UOutContext, unknown, unknown, ORPCErrorConstructorMap<TErrorMap>, TMeta>): ProcedureBuilder<MergedInitialContext<TInitialContext, UInContext, TCurrentContext>, MergedCurrentContext<TCurrentContext, UOutContext>, TSchemas, TErrorMap, TMeta, TGateName>;
77
- useAuth<const TAuthType extends AuthType & {}, TAuthContext extends ValidatedAuthContext = false>(type: TAuthType, ...rest: OptionalIfEmpty<AuthConfig<TAuthType, TAuthContext>>): ProcedureBuilder<TInitialContext, BuildContextWithAuth<TCurrentContext, TAuthContext>, TSchemas, TErrorMap, TMeta, TGateName>;
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>;
78
93
  useGating<const TInferredGateName extends string>(gates: TInferredGateName[], isGateEnabled: (gate: TInferredGateName, ctx: TCurrentContext) => boolean): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, Context, TCurrentContext>, MergedCurrentContext<TCurrentContext, {
79
94
  isGateEnabled: typeof isGateEnabled;
80
- }>, TSchemas, TErrorMap, TMeta, TInferredGateName>;
95
+ }>, TSchemas, TMeta, TInferredGateName>;
81
96
  /**
82
97
  * Defines the handler of the procedure.
83
98
  *
84
99
  * @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
85
100
  */
86
- handler(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
101
+ handler(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TMeta>): DecoratedProcedure<TInitialContext, TCurrentContext, TSchemas, TMeta>;
87
102
  }
88
- declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends ProcedureBuilder<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName> {
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> {
89
104
  /**
90
105
  * Prefixes all procedures in the router.
91
106
  * The provided prefix is post-appended to any existing router prefix.
@@ -94,206 +109,327 @@ declare class BuilderWithMiddlewares<TInitialContext extends Context, TCurrentCo
94
109
  *
95
110
  * @see {@link https://orpc.unnoq.com/docs/openapi/routing#route-prefixes OpenAPI Route Prefixes Docs}
96
111
  */
97
- prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName>;
112
+ prefix(prefix: HTTPPath): BuilderWithMiddlewares<TInitialContext, TCurrentContext, TSchemas, TMeta, TGateName>;
98
113
  /**
99
114
  * Adds tags to all procedures in the router.
100
115
  * This helpful when you want to group procedures together in the OpenAPI specification.
101
116
  *
102
117
  * @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification#operation-metadata OpenAPI Operation Metadata Docs}
103
118
  */
104
- tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TErrorMap, TMeta>;
119
+ tag(...tags: string[]): RouterBuilder<TInitialContext, TCurrentContext, TMeta>;
105
120
  /**
106
121
  * Applies all of the previously defined options to the specified router.
107
122
  *
108
123
  * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
109
124
  */
110
- router<U extends Router<ContractRouter<TMeta>, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, TErrorMap>;
125
+ router<U extends Router<TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext>;
111
126
  }
112
- interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, TErrorMap, TMeta, any>, 'prefix' | 'tag' | 'router'> {
127
+ interface RouterBuilder<TInitialContext extends Context, TCurrentContext extends Context, TMeta extends Meta> extends Pick<BuilderWithMiddlewares<TInitialContext, TCurrentContext, any, TMeta, any>, 'prefix' | 'tag' | 'router'> {
113
128
  /**
114
129
  * This property holds the defined options.
115
130
  */
116
- '~orpc': EnhanceRouterOptions<TErrorMap>;
131
+ '~orpc': EnhanceRouterOptions;
117
132
  }
118
133
 
119
- interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> extends Middleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta> {
134
+ interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TMeta extends Meta> extends Middleware<TInContext, TOutContext, TInput, TOutput, TMeta> {
120
135
  /**
121
136
  * Change the expected input type by providing a map function.
122
137
  */
123
- mapInput<UInput>(map: MapInputMiddleware<UInput, TInput>): DecoratedMiddleware<TInContext, TOutContext, UInput, TOutput, TErrorConstructorMap, TMeta>;
124
- /**
125
- * Concatenates two middlewares.
126
- *
127
- * @info Pass second argument to map the input.
128
- * @see {@link https://orpc.unnoq.com/docs/middleware#concatenation Middleware Concatenation Docs}
129
- */
130
- 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>;
131
- /**
132
- * Concatenates two middlewares.
133
- *
134
- * @info Pass second argument to map the input.
135
- * @see {@link https://orpc.unnoq.com/docs/middleware#concatenation Middleware Concatenation Docs}
136
- */
137
- 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>;
138
139
  }
139
- declare function decorateMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta>(middleware: Middleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta>): DecoratedMiddleware<TInContext, TOutContext, TInput, TOutput, TErrorConstructorMap, TMeta>;
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>;
140
141
 
141
- interface BuilderDef<TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TSchemas, TErrorMap, TMeta>, EnhanceRouterOptions<TErrorMap> {
142
- middlewares: readonly AnyMiddleware[];
143
- authConfigs: TypedAuthConfig[];
144
- inputValidationIndex: number;
145
- outputValidationIndex: number;
142
+ interface BuilderDef<TSchemas extends Schemas, TMeta extends Meta> extends ContractDef<TSchemas, TMeta>, EnhanceRouterOptions {
146
143
  }
147
- declare class Builder<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta, TGateName extends string> extends BuilderWithMiddlewares<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta, TGateName> {
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> {
148
145
  /**
149
146
  * Set or override the initial context.
150
147
  *
151
148
  * @see {@link https://orpc.unnoq.com/docs/context Context Docs}
152
149
  */
153
- $context<U extends Context>(): Builder<U, U, TSchemas, TErrorMap, TMeta, TGateName>;
150
+ $context<U extends Context>(): Builder<U, U, TSchemas, TMeta, TGateName>;
154
151
  /**
155
152
  * Creates a middleware.
156
153
  *
157
154
  * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
158
155
  */
159
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
160
- middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, any, TMeta>;
161
- }
162
- type ApiBuilder<TMeta extends Meta> = Builder<Record<never, never>, Record<never, never>, InitialSchemas, Record<never, never>, TMeta, never>;
163
- interface ApiBuilderOpts<TMeta extends Meta> {
164
- meta?: TMeta;
157
+ middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, TMeta>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, TMeta>;
165
158
  }
166
- declare function createApiBuilder<TMeta extends Meta = Record<never, never>>(opts?: ApiBuilderOpts<TMeta>): ApiBuilder<TMeta>;
167
- declare const os: ApiBuilder<Record<never, never>>;
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>;
168
165
 
169
- /**
170
- * Like `DecoratedProcedure`, but removed all method that can change the contract.
171
- */
172
- interface ImplementedProcedure<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> extends Procedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta> {
173
- /**
174
- * Uses a middleware to modify the context or improve the pipeline.
175
- *
176
- * @info Supports both normal middleware and inline middleware implementations.
177
- * @info Pass second argument to map the input.
178
- * @note The current context must be satisfy middleware dependent-context
179
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
180
- */
181
- 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>;
182
- /**
183
- * Uses a middleware to modify the context or improve the pipeline.
184
- *
185
- * @info Supports both normal middleware and inline middleware implementations.
186
- * @info Pass second argument to map the input.
187
- * @note The current context must be satisfy middleware dependent-context
188
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
189
- */
190
- 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>;
191
- /**
192
- * Make this procedure callable (works like a function while still being a procedure).
193
- *
194
- * @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
195
- */
196
- 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;
197
169
  }
198
170
  /**
199
- * Like `ProcedureBuilderWithoutHandler`, but removed all method that can change the contract.
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}
200
174
  */
201
- interface ProcedureImplementer<TInitialContext extends Context, TCurrentContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta> {
202
- '~orpc': BuilderDef<TSchemas, TErrorMap, TMeta>;
203
- /**
204
- * Uses a middleware to modify the context or improve the pipeline.
205
- *
206
- * @info Supports both normal middleware and inline middleware implementations.
207
- * @info Pass second argument to map the input.
208
- * @note The current context must be satisfy middleware dependent-context
209
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
210
- */
211
- '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>;
212
- /**
213
- * Uses a middleware to modify the context or improve the pipeline.
214
- *
215
- * @info Supports both normal middleware and inline middleware implementations.
216
- * @info Pass second argument to map the input.
217
- * @note The current context must be satisfy middleware dependent-context
218
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
219
- */
220
- '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>;
221
- /**
222
- * Defines the handler of the procedure.
223
- *
224
- * @see {@link https://orpc.unnoq.com/docs/procedure Procedure Docs}
225
- */
226
- 'handler'(handler: ProcedureHandler<TCurrentContext, InferHandlerInputs<TSchemas>, InferSchemaInput<TSchemas['outputSchema']>, TErrorMap, TMeta>): ImplementedProcedure<TInitialContext, TCurrentContext, TSchemas, TErrorMap, TMeta>;
227
- }
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;
228
177
 
229
- interface RouterImplementerWithMiddlewares<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
230
- /**
231
- * Uses a middleware to modify the context or improve the pipeline.
232
- *
233
- * @info Supports both normal middleware and inline middleware implementations.
234
- * @note The current context must be satisfy middleware dependent-context
235
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
236
- */
237
- 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>>;
238
- /**
239
- * Applies all of the previously defined options to the specified router.
240
- * And enforces the router match the contract.
241
- *
242
- * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
243
- */
244
- 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"
245
186
  }
246
- 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> & {
247
- [K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternalWithMiddlewares<TContract[K], TInitialContext, TCurrentContext> : never;
248
- };
249
187
 
250
- interface RouterImplementer<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> {
251
- /**
252
- * Creates a middleware.
253
- *
254
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
255
- */
256
- middleware<UOutContext extends IntersectPick<TCurrentContext, UOutContext>, TInput, TOutput = any>(// = any here is important to make middleware can be used in any output by default
257
- middleware: Middleware<TInitialContext, UOutContext, TInput, TOutput, ORPCErrorConstructorMap<InferContractRouterErrorMap<T>>, InferContractRouterMeta<T>>): DecoratedMiddleware<TInitialContext, UOutContext, TInput, TOutput, any, InferContractRouterMeta<T>>;
258
- /**
259
- * Uses a middleware to modify the context or improve the pipeline.
260
- *
261
- * @info Supports both normal middleware and inline middleware implementations.
262
- * @note The current context must be satisfy middleware dependent-context
263
- * @see {@link https://orpc.unnoq.com/docs/middleware Middleware Docs}
264
- */
265
- 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>>;
266
- /**
267
- * Applies all of the previously defined options to the specified router.
268
- * And enforces the router match the contract.
269
- *
270
- * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
271
- */
272
- router<U extends Router<T, TCurrentContext>>(router: U): EnhancedRouter<U, TInitialContext, TCurrentContext, Record<never, never>>;
273
- /**
274
- * Create a lazy router
275
- * And applies all of the previously defined options to the specified router.
276
- * And enforces the router match the contract.
277
- *
278
- * @see {@link https://orpc.unnoq.com/docs/router#extending-router Extending Router Docs}
279
- */
280
- lazyRoute<U extends Router<T, TCurrentContext>>(loader: () => Promise<{
281
- default: U;
282
- }>): 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;
283
194
  }
284
- type ImplementerInternal<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = TContract extends ContractProcedure<infer USchemas, infer UErrorMap, infer UMeta> ? ProcedureImplementer<TInitialContext, TCurrentContext, USchemas, UErrorMap, UMeta> : RouterImplementer<TContract, TInitialContext, TCurrentContext> & {
285
- [K in keyof TContract]: TContract[K] extends AnyContractRouter ? ImplementerInternal<TContract[K], TInitialContext, TCurrentContext> : never;
286
- };
287
- declare function implementerInternal<T extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context>(contract: T, middlewares: AnyMiddleware[]): ImplementerInternal<T, TInitialContext, TCurrentContext>;
288
- type Implementer<TContract extends AnyContractRouter, TInitialContext extends Context, TCurrentContext extends Context> = {
289
- /**
290
- * Set or override the initial context.
291
- *
292
- * @see {@link https://orpc.unnoq.com/docs/context Context Docs}
293
- */
294
- $context<U extends Context>(): Implementer<TContract, U, U>;
295
- } & ImplementerInternal<TContract, TInitialContext, TCurrentContext>;
296
- declare function implement<T extends AnyContractRouter, TContext extends Context = Record<never, never>>(contract: T): Implementer<T, TContext, TContext>;
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>>>;
297
433
 
298
434
  declare function isStartWithMiddlewares(middlewares: readonly AnyMiddleware[], compare: readonly AnyMiddleware[]): boolean;
299
435
  declare function mergeMiddlewares(first: readonly AnyMiddleware[], second: readonly AnyMiddleware[], options: {
@@ -302,10 +438,6 @@ declare function mergeMiddlewares(first: readonly AnyMiddleware[], second: reado
302
438
  declare function addMiddleware(middlewares: readonly AnyMiddleware[], addition: AnyMiddleware): AnyMiddleware[];
303
439
 
304
440
  declare function createAssertedLazyProcedure(lazied: Lazy<any>): Lazy<AnyProcedure>;
305
- /**
306
- * Create a new procedure that ensure the contract is applied to the procedure.
307
- */
308
- declare function createContractedProcedure(procedure: AnyProcedure, contract: AnyContractProcedure): AnyProcedure;
309
441
  /**
310
442
  * Directly call a procedure without creating a client.
311
443
  *
@@ -316,20 +448,35 @@ declare function createContractedProcedure(procedure: AnyProcedure, contract: An
316
448
  * ```
317
449
  *
318
450
  */
319
- declare function call<TInitialContext extends Context, TSchemas extends Schemas, TErrorMap extends ErrorMap, TMeta extends Meta>(procedure: Lazyable<Procedure<TInitialContext, any, TSchemas, TErrorMap, TMeta>>, input: InferProcedureClientInputs<TSchemas>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TSchemas['outputSchema'], TErrorMap, TMeta, Record<never, never>> & Omit<ClientOptions<Record<never, never>>, 'context'>>): ClientPromiseResult<InferSchemaOutput<TSchemas['outputSchema']>, ErrorFromErrorMap<TErrorMap>>;
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']>>;
320
452
 
321
- type RouterClient<TRouter extends AnyRouter, TClientContext extends ClientContext = Record<never, never>> = TRouter extends Procedure<any, any, infer USchemas, infer UErrorMap, any> ? ProcedureClient<TClientContext, USchemas, UErrorMap> : {
322
- [K in keyof TRouter]: TRouter[K] extends Lazyable<infer U extends AnyRouter> ? RouterClient<U, TClientContext> : never;
323
- };
453
+ declare function isSchemaIssue(issue: unknown): issue is SchemaIssue;
454
+
455
+ type HTTPEndpoint = `${HTTPMethod} ${HTTPPath}`;
456
+ declare const endpointRegex: RegExp;
324
457
  /**
325
- * Create Server-side client from a router.
326
- *
327
- * @see {@link https://orpc.unnoq.com/docs/client/server-side Server-side Client Docs}
458
+ * @internal
328
459
  */
329
- declare function createRouterClient<T extends AnyRouter, TClientContext extends ClientContext>(router: Lazyable<T | undefined>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<InferRouterInitialContext<T>, Schema<unknown, unknown>, ErrorMap, Meta, TClientContext>>): RouterClient<T, TClientContext>;
330
-
331
- declare function setHiddenRouterContract<T extends Lazyable<AnyRouter>>(router: T, contract: AnyContractRouter): T;
332
- declare function getHiddenRouterContract(router: Lazyable<AnyRouter | AnyContractRouter>): AnyContractRouter | undefined;
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
+ };
333
480
 
334
- export { AnyMiddleware, AnyProcedure, AnyRouter, BuildContextWithAuth, Builder, BuilderWithMiddlewares, Context, CreateProcedureClientOptions, DecoratedProcedure, EnhanceRouterOptions, EnhancedRouter, InferRouterInitialContext, Lazy, Lazyable, MapInputMiddleware, MergedCurrentContext, MergedInitialContext, Middleware, ORPCErrorConstructorMap, Procedure, ProcedureBuilder, ProcedureClient, ProcedureHandler, Router, addMiddleware, call, createApiBuilder, createAssertedLazyProcedure, createContractedProcedure, createRouterClient, decorateMiddleware, getHiddenRouterContract, implement, implementerInternal, isStartWithMiddlewares, mergeMiddlewares, os, setHiddenRouterContract };
335
- export type { ApiBuilder, BuilderDef, DecoratedMiddleware, ImplementedProcedure, Implementer, ImplementerInternal, ImplementerInternalWithMiddlewares, ProcedureImplementer, RouterBuilder, RouterClient, RouterImplementer, RouterImplementerWithMiddlewares };
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 };