@orpc/server 2.0.0-beta.49 → 2.0.0-beta.50

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 (139) hide show
  1. package/dist/adapters/aws-lambda/handler.d.ts +17 -15
  2. package/dist/adapters/aws-lambda/handler.js +23 -23
  3. package/dist/adapters/aws-lambda/index.d.ts +4 -16
  4. package/dist/adapters/aws-lambda/index.js +2 -2
  5. package/dist/adapters/aws-lambda/rpc-handler.d.ts +9 -9
  6. package/dist/adapters/aws-lambda/rpc-handler.js +20 -17
  7. package/dist/adapters/crossws/handler.d.ts +44 -42
  8. package/dist/adapters/crossws/handler.js +53 -60
  9. package/dist/adapters/crossws/index.d.ts +3 -2
  10. package/dist/adapters/crossws/index.js +2 -2
  11. package/dist/adapters/crossws/rpc-handler.d.ts +10 -10
  12. package/dist/adapters/crossws/rpc-handler.js +17 -14
  13. package/dist/adapters/fastify/handler.d.ts +17 -15
  14. package/dist/adapters/fastify/handler.js +20 -20
  15. package/dist/adapters/fastify/index.d.ts +3 -2
  16. package/dist/adapters/fastify/index.js +2 -2
  17. package/dist/adapters/fastify/rpc-handler.d.ts +9 -9
  18. package/dist/adapters/fastify/rpc-handler.js +16 -13
  19. package/dist/adapters/fetch/handler.d.ts +19 -17
  20. package/dist/adapters/fetch/handler.js +22 -22
  21. package/dist/adapters/fetch/index.d.ts +4 -7
  22. package/dist/adapters/fetch/index.js +3 -7
  23. package/dist/adapters/fetch/rpc-handler.d.ts +9 -9
  24. package/dist/adapters/fetch/rpc-handler.js +18 -15
  25. package/dist/adapters/message-port/handler.d.ts +58 -60
  26. package/dist/adapters/message-port/handler.js +72 -86
  27. package/dist/adapters/message-port/index.d.ts +3 -2
  28. package/dist/adapters/message-port/index.js +2 -2
  29. package/dist/adapters/message-port/rpc-handler.d.ts +9 -9
  30. package/dist/adapters/message-port/rpc-handler.js +17 -14
  31. package/dist/adapters/node/handler.d.ts +17 -15
  32. package/dist/adapters/node/handler.js +20 -20
  33. package/dist/adapters/node/index.d.ts +4 -7
  34. package/dist/adapters/node/index.js +3 -7
  35. package/dist/adapters/node/rpc-handler.d.ts +9 -9
  36. package/dist/adapters/node/rpc-handler.js +17 -14
  37. package/dist/adapters/standard/codec.d.ts +13 -13
  38. package/dist/adapters/standard/handler.d.ts +49 -49
  39. package/dist/adapters/standard/handler.js +205 -205
  40. package/dist/adapters/standard/index.d.ts +7 -6
  41. package/dist/adapters/standard/index.js +4 -5
  42. package/dist/adapters/standard/plugin.d.ts +25 -31
  43. package/dist/adapters/standard/plugin.js +14 -16
  44. package/dist/adapters/standard/rpc-handler-codec.d.ts +39 -43
  45. package/dist/adapters/standard/rpc-handler-codec.js +50 -51
  46. package/dist/adapters/standard/rpc-matcher.d.ts +40 -40
  47. package/dist/adapters/standard/rpc-matcher.js +103 -149
  48. package/dist/adapters/standard/utils.d.ts +8 -8
  49. package/dist/adapters/standard/utils.js +7 -5
  50. package/dist/adapters/standard-peer/index.d.ts +2 -1
  51. package/dist/adapters/standard-peer/index.js +1 -1
  52. package/dist/adapters/standard-peer/utils.d.ts +6 -4
  53. package/dist/adapters/standard-peer/utils.js +12 -6
  54. package/dist/adapters/websocket/handler.d.ts +52 -50
  55. package/dist/adapters/websocket/handler.js +75 -85
  56. package/dist/adapters/websocket/index.d.ts +3 -2
  57. package/dist/adapters/websocket/index.js +2 -2
  58. package/dist/adapters/websocket/rpc-handler.d.ts +9 -9
  59. package/dist/adapters/websocket/rpc-handler.js +17 -14
  60. package/dist/builder-variants.d.ts +195 -195
  61. package/dist/builder.d.ts +103 -104
  62. package/dist/builder.js +198 -224
  63. package/dist/constants.d.ts +1 -1
  64. package/dist/constants.js +4 -2
  65. package/dist/context.d.ts +3 -3
  66. package/dist/extensions/callable.d.ts +11 -11
  67. package/dist/extensions/callable.js +6 -5
  68. package/dist/helpers/base64url.d.ts +1 -1
  69. package/dist/helpers/base64url.js +44 -49
  70. package/dist/helpers/cookie.d.ts +10 -11
  71. package/dist/helpers/cookie.js +56 -63
  72. package/dist/helpers/encryption.d.ts +1 -1
  73. package/dist/helpers/encryption.js +80 -70
  74. package/dist/helpers/index.d.ts +5 -4
  75. package/dist/helpers/index.js +4 -4
  76. package/dist/helpers/signing.d.ts +1 -1
  77. package/dist/helpers/signing.js +72 -82
  78. package/dist/implementer-procedure.d.ts +12 -13
  79. package/dist/implementer-procedure.js +37 -44
  80. package/dist/implementer-router.d.ts +30 -36
  81. package/dist/implementer-router.js +92 -111
  82. package/dist/implementer.d.ts +8 -8
  83. package/dist/implementer.js +28 -35
  84. package/dist/index.d.ts +22 -61
  85. package/dist/index.js +16 -48
  86. package/dist/lazy.d.ts +14 -14
  87. package/dist/lazy.js +19 -30
  88. package/dist/middleware-decorated.d.ts +8 -9
  89. package/dist/middleware-decorated.js +66 -70
  90. package/dist/middleware.d.ts +34 -34
  91. package/dist/plugins/batch.d.ts +75 -75
  92. package/dist/plugins/batch.js +345 -379
  93. package/dist/plugins/cors.d.ts +60 -64
  94. package/dist/plugins/cors.js +118 -111
  95. package/dist/plugins/get-method-csrf-protection.d.ts +8 -6
  96. package/dist/plugins/get-method-csrf-protection.js +47 -63
  97. package/dist/plugins/head-method.d.ts +11 -9
  98. package/dist/plugins/head-method.js +97 -94
  99. package/dist/plugins/index.d.ts +15 -39
  100. package/dist/plugins/index.js +14 -29
  101. package/dist/plugins/method-override.d.ts +30 -28
  102. package/dist/plugins/method-override.js +53 -49
  103. package/dist/plugins/request-compression.d.ts +11 -9
  104. package/dist/plugins/request-compression.js +52 -79
  105. package/dist/plugins/request-headers.d.ts +10 -8
  106. package/dist/plugins/request-headers.js +27 -29
  107. package/dist/plugins/request-limit.d.ts +21 -19
  108. package/dist/plugins/request-limit.js +60 -67
  109. package/dist/plugins/response-compression.d.ts +42 -39
  110. package/dist/plugins/response-compression.js +150 -202
  111. package/dist/plugins/response-headers.d.ts +15 -13
  112. package/dist/plugins/response-headers.js +43 -46
  113. package/dist/plugins/rethrow.d.ts +25 -23
  114. package/dist/plugins/rethrow.js +46 -58
  115. package/dist/plugins/signal-sync.d.ts +7 -5
  116. package/dist/plugins/signal-sync.js +71 -86
  117. package/dist/plugins/timeout.d.ts +29 -27
  118. package/dist/plugins/timeout.js +61 -58
  119. package/dist/procedure-client.d.ts +14 -15
  120. package/dist/procedure-client.js +149 -166
  121. package/dist/procedure-decorated.d.ts +9 -9
  122. package/dist/procedure-decorated.js +36 -44
  123. package/dist/procedure-utils.d.ts +10 -30
  124. package/dist/procedure-utils.js +39 -40
  125. package/dist/procedure.d.ts +60 -60
  126. package/dist/procedure.js +18 -24
  127. package/dist/router-client.d.ts +9 -11
  128. package/dist/router-client.js +33 -41
  129. package/dist/router-hidden.js +10 -12
  130. package/dist/router-utils.d.ts +13 -30
  131. package/dist/router-utils.js +146 -191
  132. package/dist/router.d.ts +12 -26
  133. package/package.json +10 -10
  134. package/dist/adapters/standard/codec.js +0 -1
  135. package/dist/builder-variants.js +0 -1
  136. package/dist/context.js +0 -1
  137. package/dist/middleware.js +0 -1
  138. package/dist/router-hidden.d.ts +0 -5
  139. package/dist/router.js +0 -1
@@ -1,14 +1,14 @@
1
- import type { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, InitialInputSchema, InitialOutputSchema, MergedErrorMap, MergedSchema, MetaPlugin, ORPCErrorConstructorMap, Schema } from '@orpc/contract';
2
- import type { IntersectPick } from '@orpc/shared';
3
- import type { BuilderDefinition } from './builder.ts';
4
- import type { Context, MergedContext, MergedInitialContext } from './context.ts';
5
- import type { Lazy } from './lazy.ts';
6
- import type { DecoratedMiddleware } from './middleware-decorated.ts';
7
- import type { Middleware } from './middleware.ts';
8
- import type { DecoratedProcedure } from './procedure-decorated.ts';
9
- import type { ProcedureHandler } from './procedure.ts';
10
- import type { AugmentedRouterWithMiddlewares } from './router-utils.ts';
11
- import type { Router } from './router.ts';
1
+ import { BuilderDefinition } from "./builder.js";
2
+ import { Context, MergedContext, MergedInitialContext } from "./context.js";
3
+ import { Lazy } from "./lazy.js";
4
+ import { Middleware } from "./middleware.js";
5
+ import { DecoratedMiddleware } from "./middleware-decorated.js";
6
+ import { ProcedureHandler } from "./procedure.js";
7
+ import { DecoratedProcedure } from "./procedure-decorated.js";
8
+ import { Router } from "./router.js";
9
+ import { AugmentedRouterWithMiddlewares } from "./router-utils.js";
10
+ import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, InitialInputSchema, InitialOutputSchema, MergedErrorMap, MergedSchema, MetaPlugin, ORPCErrorConstructorMap, Schema } from "@orpc/contract";
11
+ import { IntersectPick } from "@orpc/shared";
12
12
  /**
13
13
  * The builder variant returned after `.use` is called.
14
14
  * `.$context` and `.$config` are no longer available once middleware is applied.
@@ -16,69 +16,69 @@ import type { Router } from './router.ts';
16
16
  * @see {@link https://orpc.dev/docs/procedure | Procedure}
17
17
  */
18
18
  export interface BuilderWithMiddlewares<TInitialContext extends Context, TInjectedContext extends Context, TErrorMap extends ErrorMap> {
19
- '~orpc': BuilderDefinition<InitialInputSchema, InitialOutputSchema, TErrorMap>;
20
- /**
21
- * Applies metadata plugins to procedures built from this builder.
22
- *
23
- * @see {@link https://orpc.dev/docs/metadata | Metadata}
24
- */
25
- 'meta'(...plugins: MetaPlugin<InitialInputSchema, InitialOutputSchema, TErrorMap>[]): BuilderWithMiddlewares<TInitialContext, TInjectedContext, TErrorMap>;
26
- /**
27
- * Defines typesafe errors that procedures built from this builder can throw
28
- * via the `errors` utility in handlers and middleware.
29
- *
30
- * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
31
- */
32
- 'errors'<T extends ErrorMap>(errors: T): BuilderWithMiddlewares<TInitialContext, TInjectedContext, MergedErrorMap<TErrorMap, T>>;
33
- /**
34
- * Applies a middleware that runs before the handler of every procedure
35
- * built from this builder.
36
- *
37
- * @see {@link https://orpc.dev/docs/middleware | Middleware}
38
- */
39
- 'use'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<InitialInputSchema>, InferSchemaInput<InitialOutputSchema>, $ErrorMap>): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, MergedErrorMap<$ErrorMap, TErrorMap>>;
40
- /**
41
- * Creates a standalone middleware that can be composed and applied to any
42
- * compatible builder or procedure with `.use`.
43
- *
44
- * @see {@link https://orpc.dev/docs/middleware | Middleware}
45
- */
46
- 'middleware'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $Input, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $Output = any>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, $Input, $Output, TErrorMap>): DecoratedMiddleware<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, $Input, $Output, TErrorMap>;
47
- /**
48
- * Defines the input schema used to validate and type the procedure input.
49
- *
50
- * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
51
- */
52
- 'input'<T extends AnySchema>(schema: T): BuilderWithInput<TInitialContext, TInjectedContext, T, TErrorMap>;
53
- /**
54
- * Defines the output schema used to validate and type the procedure output.
55
- *
56
- * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
57
- */
58
- 'output'<T extends AnySchema>(schema: T): BuilderWithOutput<TInitialContext, TInjectedContext, T, TErrorMap>;
59
- /**
60
- * Defines the function that implements the procedure and completes the
61
- * chain, returning a callable procedure.
62
- *
63
- * @see {@link https://orpc.dev/docs/procedure | Procedure}
64
- */
65
- 'handler'<T>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, Schema<T>, TErrorMap>;
66
- /**
67
- * Applies the builder's middleware, errors, and metadata to every procedure
68
- * in the given router.
69
- *
70
- * @see {@link https://orpc.dev/docs/router#extending-router | Router - Extending Router}
71
- */
72
- 'router'<T extends Router<MergedContext<TInitialContext, TInjectedContext>>>(router: T): AugmentedRouterWithMiddlewares<T, TInitialContext, TInjectedContext, TErrorMap>;
73
- /**
74
- * Like `.router`, but loads the router lazily on first access, which helps
75
- * reduce startup time for large applications.
76
- *
77
- * @see {@link https://orpc.dev/docs/router#lazy-router | Router - Lazy Router}
78
- */
79
- 'lazy'<T extends Router<MergedContext<TInitialContext, TInjectedContext>>>(loader: () => Promise<{
80
- default: T;
81
- }>): Lazy<AugmentedRouterWithMiddlewares<T, TInitialContext, TInjectedContext, TErrorMap>>;
19
+ "~orpc": BuilderDefinition<InitialInputSchema, InitialOutputSchema, TErrorMap>;
20
+ /**
21
+ * Applies metadata plugins to procedures built from this builder.
22
+ *
23
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
24
+ */
25
+ "meta"(...plugins: MetaPlugin<InitialInputSchema, InitialOutputSchema, TErrorMap>[]): BuilderWithMiddlewares<TInitialContext, TInjectedContext, TErrorMap>;
26
+ /**
27
+ * Defines typesafe errors that procedures built from this builder can throw
28
+ * via the `errors` utility in handlers and middleware.
29
+ *
30
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
31
+ */
32
+ "errors"<T extends ErrorMap>(errors: T): BuilderWithMiddlewares<TInitialContext, TInjectedContext, MergedErrorMap<TErrorMap, T>>;
33
+ /**
34
+ * Applies a middleware that runs before the handler of every procedure
35
+ * built from this builder.
36
+ *
37
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
38
+ */
39
+ "use"<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<InitialInputSchema>, InferSchemaInput<InitialOutputSchema>, $ErrorMap>): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, MergedErrorMap<$ErrorMap, TErrorMap>>;
40
+ /**
41
+ * Creates a standalone middleware that can be composed and applied to any
42
+ * compatible builder or procedure with `.use`.
43
+ *
44
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
45
+ */
46
+ "middleware"<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $Input, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $Output = any>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, $Input, $Output, TErrorMap>): DecoratedMiddleware<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, $Input, $Output, TErrorMap>;
47
+ /**
48
+ * Defines the input schema used to validate and type the procedure input.
49
+ *
50
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
51
+ */
52
+ "input"<T extends AnySchema>(schema: T): BuilderWithInput<TInitialContext, TInjectedContext, T, TErrorMap>;
53
+ /**
54
+ * Defines the output schema used to validate and type the procedure output.
55
+ *
56
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
57
+ */
58
+ "output"<T extends AnySchema>(schema: T): BuilderWithOutput<TInitialContext, TInjectedContext, T, TErrorMap>;
59
+ /**
60
+ * Defines the function that implements the procedure and completes the
61
+ * chain, returning a callable procedure.
62
+ *
63
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
64
+ */
65
+ "handler"<T>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, Schema<T>, TErrorMap>;
66
+ /**
67
+ * Applies the builder's middleware, errors, and metadata to every procedure
68
+ * in the given router.
69
+ *
70
+ * @see {@link https://orpc.dev/docs/router#extending-router | Router - Extending Router}
71
+ */
72
+ "router"<T extends Router<MergedContext<TInitialContext, TInjectedContext>>>(router: T): AugmentedRouterWithMiddlewares<T, TInitialContext, TInjectedContext, TErrorMap>;
73
+ /**
74
+ * Like `.router`, but loads the router lazily on first access, which helps
75
+ * reduce startup time for large applications.
76
+ *
77
+ * @see {@link https://orpc.dev/docs/router#lazy-router | Router - Lazy Router}
78
+ */
79
+ "lazy"<T extends Router<MergedContext<TInitialContext, TInjectedContext>>>(loader: () => Promise<{
80
+ default: T;
81
+ }>): Lazy<AugmentedRouterWithMiddlewares<T, TInitialContext, TInjectedContext, TErrorMap>>;
82
82
  }
83
83
  /**
84
84
  * The builder variant returned after `.input` is called.
@@ -87,46 +87,46 @@ export interface BuilderWithMiddlewares<TInitialContext extends Context, TInject
87
87
  * @see {@link https://orpc.dev/docs/procedure | Procedure}
88
88
  */
89
89
  export interface BuilderWithInput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TErrorMap extends ErrorMap> {
90
- '~orpc': BuilderDefinition<TInputSchema, InitialOutputSchema, TErrorMap>;
91
- /**
92
- * Applies metadata plugins to procedures built from this builder.
93
- *
94
- * @see {@link https://orpc.dev/docs/metadata | Metadata}
95
- */
96
- 'meta'(...plugins: MetaPlugin<TInputSchema, InitialOutputSchema, TErrorMap>[]): BuilderWithInput<TInitialContext, TInjectedContext, TInputSchema, TErrorMap>;
97
- /**
98
- * Defines typesafe errors that procedures built from this builder can throw
99
- * via the `errors` utility in handlers and middleware.
100
- *
101
- * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
102
- */
103
- 'errors'<T extends ErrorMap>(errors: T): BuilderWithInput<TInitialContext, TInjectedContext, TInputSchema, MergedErrorMap<TErrorMap, T>>;
104
- /**
105
- * Applies a middleware that runs before the handler and can access the
106
- * validated input.
107
- *
108
- * @see {@link https://orpc.dev/docs/middleware | Middleware}
109
- */
110
- 'use'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<InitialOutputSchema>, $ErrorMap>): BuilderWithInput<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, TInputSchema, MergedErrorMap<$ErrorMap, TErrorMap>>;
111
- /**
112
- * Adds an additional input schema, merged with the previously defined one.
113
- *
114
- * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
115
- */
116
- 'input'<T extends AnySchema>(schema: T): BuilderWithInput<TInitialContext, TInjectedContext, MergedSchema<T, TInputSchema>, TErrorMap>;
117
- /**
118
- * Defines the output schema used to validate and type the procedure output.
119
- *
120
- * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
121
- */
122
- 'output'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, T, TErrorMap>;
123
- /**
124
- * Defines the function that implements the procedure and completes the
125
- * chain, returning a callable procedure.
126
- *
127
- * @see {@link https://orpc.dev/docs/procedure | Procedure}
128
- */
129
- 'handler'<T>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, Schema<T>, TErrorMap>;
90
+ "~orpc": BuilderDefinition<TInputSchema, InitialOutputSchema, TErrorMap>;
91
+ /**
92
+ * Applies metadata plugins to procedures built from this builder.
93
+ *
94
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
95
+ */
96
+ "meta"(...plugins: MetaPlugin<TInputSchema, InitialOutputSchema, TErrorMap>[]): BuilderWithInput<TInitialContext, TInjectedContext, TInputSchema, TErrorMap>;
97
+ /**
98
+ * Defines typesafe errors that procedures built from this builder can throw
99
+ * via the `errors` utility in handlers and middleware.
100
+ *
101
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
102
+ */
103
+ "errors"<T extends ErrorMap>(errors: T): BuilderWithInput<TInitialContext, TInjectedContext, TInputSchema, MergedErrorMap<TErrorMap, T>>;
104
+ /**
105
+ * Applies a middleware that runs before the handler and can access the
106
+ * validated input.
107
+ *
108
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
109
+ */
110
+ "use"<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<InitialOutputSchema>, $ErrorMap>): BuilderWithInput<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, TInputSchema, MergedErrorMap<$ErrorMap, TErrorMap>>;
111
+ /**
112
+ * Adds an additional input schema, merged with the previously defined one.
113
+ *
114
+ * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
115
+ */
116
+ "input"<T extends AnySchema>(schema: T): BuilderWithInput<TInitialContext, TInjectedContext, MergedSchema<T, TInputSchema>, TErrorMap>;
117
+ /**
118
+ * Defines the output schema used to validate and type the procedure output.
119
+ *
120
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
121
+ */
122
+ "output"<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, T, TErrorMap>;
123
+ /**
124
+ * Defines the function that implements the procedure and completes the
125
+ * chain, returning a callable procedure.
126
+ *
127
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
128
+ */
129
+ "handler"<T>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, Schema<T>, TErrorMap>;
130
130
  }
131
131
  /**
132
132
  * The builder variant returned after `.output` is called.
@@ -135,46 +135,46 @@ export interface BuilderWithInput<TInitialContext extends Context, TInjectedCont
135
135
  * @see {@link https://orpc.dev/docs/procedure | Procedure}
136
136
  */
137
137
  export interface BuilderWithOutput<TInitialContext extends Context, TInjectedContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
138
- '~orpc': BuilderDefinition<InitialInputSchema, TOutputSchema, TErrorMap>;
139
- /**
140
- * Applies metadata plugins to procedures built from this builder.
141
- *
142
- * @see {@link https://orpc.dev/docs/metadata | Metadata}
143
- */
144
- 'meta'(...plugins: MetaPlugin<InitialInputSchema, TOutputSchema, TErrorMap>[]): BuilderWithOutput<TInitialContext, TInjectedContext, TOutputSchema, TErrorMap>;
145
- /**
146
- * Defines typesafe errors that procedures built from this builder can throw
147
- * via the `errors` utility in handlers and middleware.
148
- *
149
- * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
150
- */
151
- 'errors'<T extends ErrorMap>(errors: T): BuilderWithOutput<TInitialContext, TInjectedContext, TOutputSchema, MergedErrorMap<TErrorMap, T>>;
152
- /**
153
- * Applies a middleware that runs before the handler and can access the
154
- * typed output.
155
- *
156
- * @see {@link https://orpc.dev/docs/middleware | Middleware}
157
- */
158
- 'use'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<InitialInputSchema>, InferSchemaInput<TOutputSchema>, $ErrorMap>): BuilderWithOutput<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, TOutputSchema, MergedErrorMap<$ErrorMap, TErrorMap>>;
159
- /**
160
- * Defines the input schema used to validate and type the procedure input.
161
- *
162
- * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
163
- */
164
- 'input'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, T, TOutputSchema, TErrorMap>;
165
- /**
166
- * Adds an additional output schema, merged with the previously defined one.
167
- *
168
- * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
169
- */
170
- 'output'<T extends AnySchema>(schema: T): BuilderWithOutput<TInitialContext, TInjectedContext, MergedSchema<T, TOutputSchema>, TErrorMap>;
171
- /**
172
- * Defines the function that implements the procedure and completes the
173
- * chain, returning a callable procedure.
174
- *
175
- * @see {@link https://orpc.dev/docs/procedure | Procedure}
176
- */
177
- 'handler'<T extends InferSchemaInput<TOutputSchema>>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, TOutputSchema, TErrorMap>;
138
+ "~orpc": BuilderDefinition<InitialInputSchema, TOutputSchema, TErrorMap>;
139
+ /**
140
+ * Applies metadata plugins to procedures built from this builder.
141
+ *
142
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
143
+ */
144
+ "meta"(...plugins: MetaPlugin<InitialInputSchema, TOutputSchema, TErrorMap>[]): BuilderWithOutput<TInitialContext, TInjectedContext, TOutputSchema, TErrorMap>;
145
+ /**
146
+ * Defines typesafe errors that procedures built from this builder can throw
147
+ * via the `errors` utility in handlers and middleware.
148
+ *
149
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
150
+ */
151
+ "errors"<T extends ErrorMap>(errors: T): BuilderWithOutput<TInitialContext, TInjectedContext, TOutputSchema, MergedErrorMap<TErrorMap, T>>;
152
+ /**
153
+ * Applies a middleware that runs before the handler and can access the
154
+ * typed output.
155
+ *
156
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
157
+ */
158
+ "use"<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<InitialInputSchema>, InferSchemaInput<TOutputSchema>, $ErrorMap>): BuilderWithOutput<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, TOutputSchema, MergedErrorMap<$ErrorMap, TErrorMap>>;
159
+ /**
160
+ * Defines the input schema used to validate and type the procedure input.
161
+ *
162
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
163
+ */
164
+ "input"<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, T, TOutputSchema, TErrorMap>;
165
+ /**
166
+ * Adds an additional output schema, merged with the previously defined one.
167
+ *
168
+ * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
169
+ */
170
+ "output"<T extends AnySchema>(schema: T): BuilderWithOutput<TInitialContext, TInjectedContext, MergedSchema<T, TOutputSchema>, TErrorMap>;
171
+ /**
172
+ * Defines the function that implements the procedure and completes the
173
+ * chain, returning a callable procedure.
174
+ *
175
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
176
+ */
177
+ "handler"<T extends InferSchemaInput<TOutputSchema>>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, TOutputSchema, TErrorMap>;
178
178
  }
179
179
  /**
180
180
  * The builder variant returned after both `.input` and `.output` are called.
@@ -183,44 +183,44 @@ export interface BuilderWithOutput<TInitialContext extends Context, TInjectedCon
183
183
  * @see {@link https://orpc.dev/docs/procedure | Procedure}
184
184
  */
185
185
  export interface BuilderWithInputOutput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
186
- '~orpc': BuilderDefinition<TInputSchema, TOutputSchema, TErrorMap>;
187
- /**
188
- * Applies metadata plugins to procedures built from this builder.
189
- *
190
- * @see {@link https://orpc.dev/docs/metadata | Metadata}
191
- */
192
- 'meta'(...plugins: MetaPlugin<TInputSchema, TOutputSchema, TErrorMap>[]): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
193
- /**
194
- * Defines typesafe errors that procedures built from this builder can throw
195
- * via the `errors` utility in handlers and middleware.
196
- *
197
- * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
198
- */
199
- 'errors'<T extends ErrorMap>(errors: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, T>>;
200
- /**
201
- * Applies a middleware that runs before the handler and can access the
202
- * validated input and typed output.
203
- *
204
- * @see {@link https://orpc.dev/docs/middleware | Middleware}
205
- */
206
- 'use'<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, $ErrorMap>): BuilderWithInputOutput<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, TInputSchema, TOutputSchema, MergedErrorMap<$ErrorMap, TErrorMap>>;
207
- /**
208
- * Adds an additional input schema, merged with the previously defined one.
209
- *
210
- * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
211
- */
212
- 'input'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, MergedSchema<T, TInputSchema>, TOutputSchema, TErrorMap>;
213
- /**
214
- * Adds an additional output schema, merged with the previously defined one.
215
- *
216
- * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
217
- */
218
- 'output'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, MergedSchema<T, TOutputSchema>, TErrorMap>;
219
- /**
220
- * Defines the function that implements the procedure and completes the
221
- * chain, returning a callable procedure.
222
- *
223
- * @see {@link https://orpc.dev/docs/procedure | Procedure}
224
- */
225
- 'handler'<T extends InferSchemaInput<TOutputSchema>>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
226
- }
186
+ "~orpc": BuilderDefinition<TInputSchema, TOutputSchema, TErrorMap>;
187
+ /**
188
+ * Applies metadata plugins to procedures built from this builder.
189
+ *
190
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
191
+ */
192
+ "meta"(...plugins: MetaPlugin<TInputSchema, TOutputSchema, TErrorMap>[]): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
193
+ /**
194
+ * Defines typesafe errors that procedures built from this builder can throw
195
+ * via the `errors` utility in handlers and middleware.
196
+ *
197
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
198
+ */
199
+ "errors"<T extends ErrorMap>(errors: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, T>>;
200
+ /**
201
+ * Applies a middleware that runs before the handler and can access the
202
+ * validated input and typed output.
203
+ *
204
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
205
+ */
206
+ "use"<$OutContext extends IntersectPick<MergedContext<TInitialContext, TInjectedContext>, $OutContext>, $InContext extends Context = MergedContext<TInitialContext, TInjectedContext>, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | MergedContext<TInitialContext, TInjectedContext>, $OutContext, InferSchemaOutput<TInputSchema>, InferSchemaInput<TOutputSchema>, $ErrorMap>): BuilderWithInputOutput<MergedInitialContext<TInitialContext, TInjectedContext, $InContext>, MergedContext<TInjectedContext, $OutContext>, TInputSchema, TOutputSchema, MergedErrorMap<$ErrorMap, TErrorMap>>;
207
+ /**
208
+ * Adds an additional input schema, merged with the previously defined one.
209
+ *
210
+ * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
211
+ */
212
+ "input"<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, MergedSchema<T, TInputSchema>, TOutputSchema, TErrorMap>;
213
+ /**
214
+ * Adds an additional output schema, merged with the previously defined one.
215
+ *
216
+ * @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
217
+ */
218
+ "output"<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, MergedSchema<T, TOutputSchema>, TErrorMap>;
219
+ /**
220
+ * Defines the function that implements the procedure and completes the
221
+ * chain, returning a callable procedure.
222
+ *
223
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
224
+ */
225
+ "handler"<T extends InferSchemaInput<TOutputSchema>>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
226
+ }