@temporary-name/server 1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244 → 1.9.3-alpha.fb7e3a67f82deaeffad5063e136b2f3c03c4b5b3

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