@orpc/server 2.0.0-beta.5 → 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 (171) hide show
  1. package/README.md +137 -102
  2. package/dist/adapters/aws-lambda/handler.d.ts +27 -0
  3. package/dist/adapters/aws-lambda/handler.js +24 -0
  4. package/dist/adapters/aws-lambda/index.d.ts +4 -0
  5. package/dist/adapters/aws-lambda/index.js +2 -0
  6. package/dist/adapters/aws-lambda/rpc-handler.d.ts +19 -0
  7. package/dist/adapters/aws-lambda/rpc-handler.js +21 -0
  8. package/dist/adapters/crossws/handler.d.ts +47 -0
  9. package/dist/adapters/crossws/handler.js +53 -0
  10. package/dist/adapters/crossws/index.d.ts +3 -54
  11. package/dist/adapters/crossws/index.js +2 -0
  12. package/dist/adapters/crossws/rpc-handler.d.ts +16 -0
  13. package/dist/adapters/crossws/rpc-handler.js +18 -0
  14. package/dist/adapters/fastify/handler.d.ts +23 -0
  15. package/dist/adapters/fastify/handler.js +20 -0
  16. package/dist/adapters/fastify/index.d.ts +3 -0
  17. package/dist/adapters/fastify/index.js +2 -0
  18. package/dist/adapters/fastify/rpc-handler.d.ts +15 -0
  19. package/dist/adapters/fastify/rpc-handler.js +17 -0
  20. package/dist/adapters/fetch/handler.d.ts +25 -0
  21. package/dist/adapters/fetch/handler.js +22 -0
  22. package/dist/adapters/fetch/index.d.ts +4 -140
  23. package/dist/adapters/fetch/index.js +3 -0
  24. package/dist/adapters/fetch/rpc-handler.d.ts +17 -0
  25. package/dist/adapters/fetch/rpc-handler.js +19 -0
  26. package/dist/adapters/message-port/handler.d.ts +62 -0
  27. package/dist/adapters/message-port/handler.js +72 -0
  28. package/dist/adapters/message-port/index.d.ts +3 -74
  29. package/dist/adapters/message-port/index.js +2 -0
  30. package/dist/adapters/message-port/rpc-handler.d.ts +16 -0
  31. package/dist/adapters/message-port/rpc-handler.js +18 -0
  32. package/dist/adapters/node/handler.d.ts +23 -0
  33. package/dist/adapters/node/handler.js +20 -0
  34. package/dist/adapters/node/index.d.ts +4 -121
  35. package/dist/adapters/node/index.js +3 -0
  36. package/dist/adapters/node/rpc-handler.d.ts +16 -0
  37. package/dist/adapters/node/rpc-handler.js +18 -0
  38. package/dist/adapters/standard/codec.d.ts +16 -0
  39. package/dist/adapters/standard/handler.d.ts +68 -0
  40. package/dist/adapters/standard/handler.js +205 -0
  41. package/dist/adapters/standard/index.d.ts +7 -19
  42. package/dist/adapters/standard/index.js +4 -0
  43. package/dist/adapters/standard/plugin.d.ts +26 -0
  44. package/dist/adapters/standard/plugin.js +14 -0
  45. package/dist/adapters/standard/rpc-handler-codec.d.ts +42 -0
  46. package/dist/adapters/standard/rpc-handler-codec.js +50 -0
  47. package/dist/adapters/standard/rpc-matcher.d.ts +53 -0
  48. package/dist/adapters/standard/rpc-matcher.js +106 -0
  49. package/dist/adapters/standard/utils.d.ts +10 -0
  50. package/dist/adapters/standard/utils.js +8 -0
  51. package/dist/adapters/standard-peer/index.d.ts +2 -16
  52. package/dist/adapters/standard-peer/index.js +1 -0
  53. package/dist/adapters/standard-peer/utils.d.ts +6 -0
  54. package/dist/adapters/standard-peer/utils.js +13 -0
  55. package/dist/adapters/websocket/handler.d.ts +61 -0
  56. package/dist/adapters/websocket/handler.js +75 -0
  57. package/dist/adapters/websocket/index.d.ts +3 -61
  58. package/dist/adapters/websocket/index.js +2 -0
  59. package/dist/adapters/websocket/rpc-handler.d.ts +16 -0
  60. package/dist/adapters/websocket/rpc-handler.js +18 -0
  61. package/dist/builder-variants.d.ts +226 -0
  62. package/dist/builder.d.ts +126 -0
  63. package/dist/builder.js +200 -0
  64. package/dist/constants.d.ts +2 -0
  65. package/dist/constants.js +4 -0
  66. package/dist/context.d.ts +6 -0
  67. package/dist/extensions/callable.d.ts +11 -10
  68. package/dist/extensions/callable.js +8 -0
  69. package/dist/helpers/base64url.d.ts +31 -0
  70. package/dist/helpers/base64url.js +48 -0
  71. package/dist/helpers/cookie.d.ts +50 -0
  72. package/dist/helpers/cookie.js +62 -0
  73. package/dist/helpers/encryption.d.ts +28 -0
  74. package/dist/helpers/encryption.js +90 -0
  75. package/dist/helpers/index.d.ts +5 -149
  76. package/dist/helpers/index.js +4 -0
  77. package/dist/helpers/signing.d.ts +50 -0
  78. package/dist/helpers/signing.js +78 -0
  79. package/dist/implementer-procedure.d.ts +15 -0
  80. package/dist/implementer-procedure.js +37 -0
  81. package/dist/implementer-router.d.ts +34 -0
  82. package/dist/implementer-router.js +98 -0
  83. package/dist/implementer.d.ts +16 -0
  84. package/dist/implementer.js +30 -0
  85. package/dist/index.d.ts +22 -196
  86. package/dist/index.js +16 -0
  87. package/dist/lazy.d.ts +20 -0
  88. package/dist/lazy.js +20 -0
  89. package/dist/middleware-decorated.d.ts +9 -0
  90. package/dist/middleware-decorated.js +67 -0
  91. package/dist/middleware.d.ts +54 -0
  92. package/dist/plugins/batch.d.ts +102 -0
  93. package/dist/plugins/batch.js +371 -0
  94. package/dist/plugins/cors.d.ts +69 -0
  95. package/dist/plugins/cors.js +119 -0
  96. package/dist/plugins/get-method-csrf-protection.d.ts +25 -0
  97. package/dist/plugins/get-method-csrf-protection.js +48 -0
  98. package/dist/plugins/head-method.d.ts +25 -0
  99. package/dist/plugins/head-method.js +107 -0
  100. package/dist/plugins/index.d.ts +15 -197
  101. package/dist/plugins/index.js +14 -0
  102. package/dist/plugins/method-override.d.ts +40 -0
  103. package/dist/plugins/method-override.js +54 -0
  104. package/dist/plugins/request-compression.d.ts +18 -0
  105. package/dist/plugins/request-compression.js +55 -0
  106. package/dist/plugins/request-headers.d.ts +24 -0
  107. package/dist/plugins/request-headers.js +28 -0
  108. package/dist/plugins/request-limit.d.ts +32 -0
  109. package/dist/plugins/request-limit.js +61 -0
  110. package/dist/plugins/response-compression.d.ts +62 -0
  111. package/dist/plugins/response-compression.js +157 -0
  112. package/dist/plugins/response-headers.d.ts +32 -0
  113. package/dist/plugins/response-headers.js +44 -0
  114. package/dist/plugins/rethrow.d.ts +35 -0
  115. package/dist/plugins/rethrow.js +47 -0
  116. package/dist/plugins/signal-sync.d.ts +15 -0
  117. package/dist/plugins/signal-sync.js +76 -0
  118. package/dist/plugins/timeout.d.ts +39 -0
  119. package/dist/plugins/timeout.js +62 -0
  120. package/dist/procedure-client.d.ts +18 -0
  121. package/dist/procedure-client.js +158 -0
  122. package/dist/procedure-decorated.d.ts +10 -0
  123. package/dist/procedure-decorated.js +36 -0
  124. package/dist/procedure-utils.d.ts +21 -0
  125. package/dist/procedure-utils.js +48 -0
  126. package/dist/procedure.d.ts +72 -0
  127. package/dist/procedure.js +18 -0
  128. package/dist/router-client.d.ts +21 -0
  129. package/dist/router-client.js +35 -0
  130. package/dist/router-hidden.js +12 -0
  131. package/dist/router-utils.d.ts +31 -0
  132. package/dist/router-utils.js +157 -0
  133. package/dist/router.d.ts +58 -0
  134. package/package.json +95 -63
  135. package/dist/adapters/crossws/index.d.mts +0 -54
  136. package/dist/adapters/crossws/index.mjs +0 -64
  137. package/dist/adapters/fetch/index.d.mts +0 -140
  138. package/dist/adapters/fetch/index.mjs +0 -204
  139. package/dist/adapters/message-port/index.d.mts +0 -74
  140. package/dist/adapters/message-port/index.mjs +0 -90
  141. package/dist/adapters/node/index.d.mts +0 -121
  142. package/dist/adapters/node/index.mjs +0 -179
  143. package/dist/adapters/standard/index.d.mts +0 -19
  144. package/dist/adapters/standard/index.mjs +0 -8
  145. package/dist/adapters/standard-peer/index.d.mts +0 -16
  146. package/dist/adapters/standard-peer/index.mjs +0 -2
  147. package/dist/adapters/websocket/index.d.mts +0 -61
  148. package/dist/adapters/websocket/index.mjs +0 -76
  149. package/dist/extensions/callable.d.mts +0 -10
  150. package/dist/extensions/callable.mjs +0 -11
  151. package/dist/helpers/index.d.mts +0 -149
  152. package/dist/helpers/index.mjs +0 -198
  153. package/dist/index.d.mts +0 -196
  154. package/dist/index.mjs +0 -385
  155. package/dist/plugins/index.d.mts +0 -197
  156. package/dist/plugins/index.mjs +0 -357
  157. package/dist/shared/server.BL22TloH.d.mts +0 -184
  158. package/dist/shared/server.BL22TloH.d.ts +0 -184
  159. package/dist/shared/server.BsNNjG5J.d.mts +0 -61
  160. package/dist/shared/server.BwHnWUuN.mjs +0 -222
  161. package/dist/shared/server.CX4vUnDk.mjs +0 -11
  162. package/dist/shared/server.Cj5lgPuG.d.mts +0 -66
  163. package/dist/shared/server.CjOb6ItT.mjs +0 -41
  164. package/dist/shared/server.CrlKQucM.mjs +0 -233
  165. package/dist/shared/server.DBANIheG.d.ts +0 -104
  166. package/dist/shared/server.DJIkub_t.d.mts +0 -104
  167. package/dist/shared/server.D_QauotT.mjs +0 -30
  168. package/dist/shared/server.GDpX6Df8.mjs +0 -271
  169. package/dist/shared/server.Pa0F03f_.d.ts +0 -61
  170. package/dist/shared/server.W91HSRkE.mjs +0 -9
  171. package/dist/shared/server.d_2NS3g5.d.ts +0 -66
@@ -0,0 +1,226 @@
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
+ /**
13
+ * The builder variant returned after `.use` is called.
14
+ * `.$context` and `.$config` are no longer available once middleware is applied.
15
+ *
16
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
17
+ */
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>>;
82
+ }
83
+ /**
84
+ * The builder variant returned after `.input` is called.
85
+ * Only procedure-level methods remain available once an input schema is defined.
86
+ *
87
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
88
+ */
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>;
130
+ }
131
+ /**
132
+ * The builder variant returned after `.output` is called.
133
+ * Only procedure-level methods remain available once an output schema is defined.
134
+ *
135
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
136
+ */
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>;
178
+ }
179
+ /**
180
+ * The builder variant returned after both `.input` and `.output` are called.
181
+ * Only procedure-level methods remain available.
182
+ *
183
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
184
+ */
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
+ }
@@ -0,0 +1,126 @@
1
+ import { BuilderWithInput, BuilderWithMiddlewares, BuilderWithOutput } from "./builder-variants.js";
2
+ import { Context, 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 { OrderedMiddleware, ProcedureConfig, ProcedureHandler } from "./procedure.js";
7
+ import { DecoratedProcedure } from "./procedure-decorated.js";
8
+ import { AnyRouter } from "./router.js";
9
+ import { AugmentedRouter } from "./router-utils.js";
10
+ import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, InitialInputSchema, InitialOutputSchema, MergedErrorMap, MetaPlugin, ORPCErrorConstructorMap, ProcedureContractDefinition, Schema } from "@orpc/contract";
11
+ import { IntersectPick } from "@orpc/shared";
12
+ /**
13
+ * The initial context type used when `.$context` is not called.
14
+ * Augment this interface with `declare module '@orpc/server'` to define
15
+ * a default initial context type globally.
16
+ *
17
+ * @see {@link https://orpc.dev/docs/context#default-initial-context | Context - Default Initial Context}
18
+ */
19
+ export interface DefaultInitialContext {}
20
+ export interface BuilderDefinition<TInputSchema extends AnySchema, TInjectedContext extends AnySchema, TErrorMap extends ErrorMap> extends ProcedureContractDefinition<TInputSchema, TInjectedContext, TErrorMap>, ProcedureConfig {
21
+ orderedMiddlewares: OrderedMiddleware[];
22
+ }
23
+ /**
24
+ * The procedure builder behind `os`. Chain its methods to gradually define
25
+ * context, middleware, errors, schemas, and finally a handler or router.
26
+ *
27
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
28
+ */
29
+ export declare class Builder<TInitialContext extends Context, TErrorMap extends ErrorMap> {
30
+ "~orpc": BuilderDefinition<InitialInputSchema, InitialOutputSchema, TErrorMap>;
31
+ /**
32
+ * Private constructor to prevent direct instantiation.
33
+ * Use the static `create` method to initialize a new instance with a safe initial definition.
34
+ */
35
+ private "constructor"();
36
+ /**
37
+ * Creates a fresh builder with an empty definition.
38
+ * Prefer the exported `os` instance over calling this directly.
39
+ *
40
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
41
+ */
42
+ static "create"<T extends Context = DefaultInitialContext>(): Builder<T & object, Record<never, never>>;
43
+ /**
44
+ * Declares the initial context type that must be provided when executing
45
+ * procedures built from this builder.
46
+ *
47
+ * @see {@link https://orpc.dev/docs/context#initial-context | Context - Initial Context}
48
+ */
49
+ "$context"<T extends Context = DefaultInitialContext>(): Builder<T & object, TErrorMap>;
50
+ /**
51
+ * Overrides the procedure configuration, such as disabling runtime
52
+ * input/output validation.
53
+ *
54
+ * @see {@link https://orpc.dev/docs/recipes/validation-customization | Validation Customization}
55
+ */
56
+ "$config"(config: ProcedureConfig): Builder<TInitialContext, TErrorMap>;
57
+ /**
58
+ * Applies metadata plugins to procedures built from this builder.
59
+ *
60
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
61
+ */
62
+ "meta"(...plugins: MetaPlugin<InitialInputSchema, InitialOutputSchema, TErrorMap>[]): Builder<TInitialContext, TErrorMap>;
63
+ /**
64
+ * Defines typesafe errors that procedures built from this builder can throw
65
+ * via the `errors` utility in handlers and middleware.
66
+ *
67
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
68
+ */
69
+ "errors"<U extends ErrorMap>(errors: U): Builder<TInitialContext, MergedErrorMap<TErrorMap, U>>;
70
+ /**
71
+ * Applies a middleware that runs before the handler of every procedure
72
+ * built from this builder.
73
+ *
74
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
75
+ */
76
+ "use"<$OutContext extends IntersectPick<TInitialContext, $OutContext>, $InContext extends Context = TInitialContext, $ErrorMap extends ErrorMap = TErrorMap>(middleware: Middleware<$InContext | TInitialContext, $OutContext, InferSchemaOutput<InitialInputSchema>, InferSchemaInput<InitialOutputSchema>, $ErrorMap>): BuilderWithMiddlewares<MergedInitialContext<TInitialContext, object, $InContext>, $OutContext, MergedErrorMap<$ErrorMap, TErrorMap>>;
77
+ /**
78
+ * Creates a standalone middleware that can be composed and applied to any
79
+ * compatible builder or procedure with `.use`.
80
+ *
81
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
82
+ */
83
+ "middleware"<$OutContext extends IntersectPick<TInitialContext, $OutContext>, $Input, $Output = any>(middleware: Middleware<TInitialContext, $OutContext, $Input, $Output, TErrorMap>): DecoratedMiddleware<TInitialContext, $OutContext, $Input, $Output, TErrorMap>;
84
+ /**
85
+ * Defines the input schema used to validate and type the procedure input.
86
+ *
87
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
88
+ */
89
+ "input"<$ extends AnySchema>(schema: $): BuilderWithInput<TInitialContext, object, $, TErrorMap>;
90
+ /**
91
+ * Defines the output schema used to validate and type the procedure output.
92
+ *
93
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
94
+ */
95
+ "output"<$ extends AnySchema>(schema: $): BuilderWithOutput<TInitialContext, object, $, TErrorMap>;
96
+ /**
97
+ * Defines the function that implements the procedure and completes the
98
+ * chain, returning a callable procedure.
99
+ *
100
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
101
+ */
102
+ "handler"<T>(handler: ProcedureHandler<TInitialContext, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, object, InitialInputSchema, Schema<T>, TErrorMap>;
103
+ /**
104
+ * Applies the builder's middleware, errors, and metadata to every procedure
105
+ * in the given router.
106
+ *
107
+ * @see {@link https://orpc.dev/docs/router#extending-router | Router - Extending Router}
108
+ */
109
+ "router"<T extends AnyRouter>(router: T): AugmentedRouter<T, TErrorMap>;
110
+ /**
111
+ * Like `.router`, but loads the router lazily on first access, which helps
112
+ * reduce startup time for large applications.
113
+ *
114
+ * @see {@link https://orpc.dev/docs/router#lazy-router | Router - Lazy Router}
115
+ */
116
+ "lazy"<T extends AnyRouter>(loader: () => Promise<{
117
+ default: T;
118
+ }>): Lazy<AugmentedRouter<T, TErrorMap>>;
119
+ }
120
+ /**
121
+ * The oRPC procedure builder. Chain methods like `.input`, `.use`, and `.handler`
122
+ * to define procedures, then compose them into routers.
123
+ *
124
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
125
+ */
126
+ export declare const os: Builder<DefaultInitialContext & object, Record<never, never>>;
@@ -0,0 +1,200 @@
1
+ import { Lazy } from "./lazy.js";
2
+ import { decorateMiddleware } from "./middleware-decorated.js";
3
+ import { DecoratedProcedure } from "./procedure-decorated.js";
4
+ import { augmentRouter } from "./router-utils.js";
5
+ import { getHiddenMetaPlugins, mergeErrorMap, resolveMetaPlugins } from "@orpc/contract";
6
+ import { toArray } from "@orpc/shared";
7
+ // src/builder.ts
8
+ /**
9
+ * The procedure builder behind `os`. Chain its methods to gradually define
10
+ * context, middleware, errors, schemas, and finally a handler or router.
11
+ *
12
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
13
+ */
14
+ var Builder = class Builder {
15
+ "~orpc";
16
+ /**
17
+ * Private constructor to prevent direct instantiation.
18
+ * Use the static `create` method to initialize a new instance with a safe initial definition.
19
+ */
20
+ "constructor"(definition) {
21
+ this["~orpc"] = definition;
22
+ }
23
+ /**
24
+ * Creates a fresh builder with an empty definition.
25
+ * Prefer the exported `os` instance over calling this directly.
26
+ *
27
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
28
+ */
29
+ static "create"() {
30
+ return new Builder({
31
+ errorMap: {},
32
+ meta: {},
33
+ orderedMiddlewares: []
34
+ });
35
+ }
36
+ /**
37
+ * Declares the initial context type that must be provided when executing
38
+ * procedures built from this builder.
39
+ *
40
+ * @see {@link https://orpc.dev/docs/context#initial-context | Context - Initial Context}
41
+ */
42
+ "$context"() {
43
+ return this;
44
+ }
45
+ /**
46
+ * Overrides the procedure configuration, such as disabling runtime
47
+ * input/output validation.
48
+ *
49
+ * @see {@link https://orpc.dev/docs/recipes/validation-customization | Validation Customization}
50
+ */
51
+ "$config"(config) {
52
+ return new Builder({
53
+ ...this["~orpc"],
54
+ ...config
55
+ });
56
+ }
57
+ /**
58
+ * Applies metadata plugins to procedures built from this builder.
59
+ *
60
+ * @see {@link https://orpc.dev/docs/metadata | Metadata}
61
+ */
62
+ "meta"(...plugins) {
63
+ const [meta, metaPlugins] = resolveMetaPlugins(this["~orpc"].meta, this["~orpc"].metaPlugins, plugins);
64
+ return new Builder({
65
+ ...this["~orpc"],
66
+ meta,
67
+ metaPlugins
68
+ });
69
+ }
70
+ /**
71
+ * Defines typesafe errors that procedures built from this builder can throw
72
+ * via the `errors` utility in handlers and middleware.
73
+ *
74
+ * @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
75
+ */
76
+ "errors"(errors) {
77
+ let builder = new Builder({
78
+ ...this["~orpc"],
79
+ errorMap: mergeErrorMap(this["~orpc"].errorMap, errors)
80
+ });
81
+ const plugins = getHiddenMetaPlugins(errors);
82
+ if (plugins) builder = builder.meta(...plugins);
83
+ return builder;
84
+ }
85
+ /**
86
+ * Applies a middleware that runs before the handler of every procedure
87
+ * built from this builder.
88
+ *
89
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
90
+ */
91
+ "use"(middleware) {
92
+ let builder = new Builder({
93
+ ...this["~orpc"],
94
+ errorMap: mergeErrorMap(middleware["~orpc"]?.errorMap ?? {}, this["~orpc"].errorMap),
95
+ orderedMiddlewares: [...this["~orpc"].orderedMiddlewares, {
96
+ middleware,
97
+ inputSchemasLengthAtUse: this["~orpc"].inputSchemas?.length,
98
+ outputSchemasLengthAtUse: this["~orpc"].outputSchemas?.length
99
+ }]
100
+ });
101
+ if (middleware["~orpc"]?.metaPlugins) builder = builder.meta(...middleware["~orpc"]?.metaPlugins);
102
+ return builder;
103
+ }
104
+ /**
105
+ * Creates a standalone middleware that can be composed and applied to any
106
+ * compatible builder or procedure with `.use`.
107
+ *
108
+ * @see {@link https://orpc.dev/docs/middleware | Middleware}
109
+ */
110
+ "middleware"(middleware) {
111
+ const allMiddlewares = [...this["~orpc"].orderedMiddlewares.map(({ middleware }) => middleware), middleware];
112
+ let current = decorateMiddleware(allMiddlewares.shift());
113
+ for (const mid of allMiddlewares) current = current.use(mid);
114
+ current["~orpc"] = {
115
+ ...current["~orpc"],
116
+ errorMap: this["~orpc"].errorMap,
117
+ metaPlugins: [...toArray(this["~orpc"].metaPlugins), ...toArray(middleware["~orpc"]?.metaPlugins)]
118
+ };
119
+ return current;
120
+ }
121
+ /**
122
+ * Defines the input schema used to validate and type the procedure input.
123
+ *
124
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
125
+ */
126
+ "input"(schema) {
127
+ let builder = new Builder({
128
+ ...this["~orpc"],
129
+ inputSchemas: [...toArray(this["~orpc"].inputSchemas), schema]
130
+ });
131
+ const plugins = getHiddenMetaPlugins(schema);
132
+ if (plugins) builder = builder.meta(...plugins);
133
+ return builder;
134
+ }
135
+ /**
136
+ * Defines the output schema used to validate and type the procedure output.
137
+ *
138
+ * @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
139
+ */
140
+ "output"(schema) {
141
+ let builder = new Builder({
142
+ ...this["~orpc"],
143
+ outputSchemas: [...toArray(this["~orpc"].outputSchemas), schema]
144
+ });
145
+ const plugins = getHiddenMetaPlugins(schema);
146
+ if (plugins) builder = builder.meta(...plugins);
147
+ return builder;
148
+ }
149
+ /**
150
+ * Defines the function that implements the procedure and completes the
151
+ * chain, returning a callable procedure.
152
+ *
153
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
154
+ */
155
+ "handler"(handler) {
156
+ let procedure = new DecoratedProcedure({
157
+ ...this["~orpc"],
158
+ handler
159
+ });
160
+ const plugins = getHiddenMetaPlugins(handler);
161
+ if (plugins) procedure = procedure.meta(...plugins);
162
+ return procedure;
163
+ }
164
+ /**
165
+ * Applies the builder's middleware, errors, and metadata to every procedure
166
+ * in the given router.
167
+ *
168
+ * @see {@link https://orpc.dev/docs/router#extending-router | Router - Extending Router}
169
+ */
170
+ "router"(router) {
171
+ return augmentRouter(router, {
172
+ ...this["~orpc"],
173
+ middlewares: this["~orpc"].orderedMiddlewares.map(({ middleware }) => middleware)
174
+ });
175
+ }
176
+ /**
177
+ * Like `.router`, but loads the router lazily on first access, which helps
178
+ * reduce startup time for large applications.
179
+ *
180
+ * @see {@link https://orpc.dev/docs/router#lazy-router | Router - Lazy Router}
181
+ */
182
+ "lazy"(loader) {
183
+ return new Lazy({
184
+ loader: async () => {
185
+ const { default: router } = await loader();
186
+ return { default: this.router(router) };
187
+ },
188
+ meta: this["~orpc"].meta,
189
+ metaPlugins: this["~orpc"].metaPlugins
190
+ });
191
+ }
192
+ };
193
+ /**
194
+ * The oRPC procedure builder. Chain methods like `.input`, `.use`, and `.handler`
195
+ * to define procedures, then compose them into routers.
196
+ *
197
+ * @see {@link https://orpc.dev/docs/procedure | Procedure}
198
+ */
199
+ const os = /* @__PURE__ */ Builder.create();
200
+ export { Builder, os };
@@ -0,0 +1,2 @@
1
+ export declare const DEFAULT_SUCCESS_STATUS = 200;
2
+ export declare const DEFAULT_ERROR_STATUS = 400;
@@ -0,0 +1,4 @@
1
+ // src/constants.ts
2
+ const DEFAULT_SUCCESS_STATUS = 200;
3
+ const DEFAULT_ERROR_STATUS = 400;
4
+ export { DEFAULT_ERROR_STATUS, DEFAULT_SUCCESS_STATUS };
@@ -0,0 +1,6 @@
1
+ import { DistributiveOmit } from "@orpc/shared";
2
+ export interface Context {
3
+ [key: PropertyKey]: any;
4
+ }
5
+ export type MergedInitialContext<TInitial extends Context, TOutContext extends Context, TInContext extends Context> = TInContext extends any ? Exclude<keyof TInContext, keyof TInitial | keyof TOutContext> extends never ? TInitial : TInitial & DistributiveOmit<TInContext, keyof TInitial | keyof TOutContext> : never;
6
+ export type MergedContext<TCurrent extends Context, TOutContext extends Context> = keyof TOutContext extends never ? TCurrent : DistributiveOmit<TCurrent, keyof TOutContext> & TOutContext;
@@ -1,10 +1,11 @@
1
- import { AnyORPCError, ClientContext } from '@orpc/client';
2
- import { AnySchema, ErrorMap } from '@orpc/contract';
3
- import { MaybeOptionalOptions } from '@orpc/shared';
4
- import { C as Context, P as ProcedureClientOptions, a as Procedure, b as ProcedureClient } from '../shared/server.BL22TloH.js';
5
-
6
- declare module "../index" {
7
- interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> {
8
- callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<ProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TReturnedError, TClientContext>>): Procedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError> & ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>;
9
- }
10
- }
1
+ import { Context } from "../context.js";
2
+ import { Procedure } from "../procedure.js";
3
+ import { ProcedureClient, ProcedureClientOptions } from "../procedure-client.js";
4
+ import { AnySchema, ErrorMap } from "@orpc/contract";
5
+ import { MaybeOptionalOptions } from "@orpc/shared";
6
+ import { ClientContext } from "@orpc/client";
7
+ declare module "@orpc/server" {
8
+ interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
9
+ callable<TClientContext extends ClientContext>(...rest: MaybeOptionalOptions<ProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TClientContext>>): Procedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap> & ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ import { createProcedureClient } from "../procedure-client.js";
2
+ import { DecoratedProcedure } from "../procedure-decorated.js";
3
+ // src/extensions/callable.ts
4
+ DecoratedProcedure.prototype.callable = function callable(...rest) {
5
+ const callable = createProcedureClient(this, ...rest);
6
+ callable["~orpc"] = this["~orpc"];
7
+ return callable;
8
+ };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Encodes a Uint8Array to base64url format
3
+ * Base64url is URL-safe and doesn't use padding
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const text = "Hello World"
8
+ * const encoded = encodeBase64url(new TextEncoder().encode(text))
9
+ * const decoded = decodeBase64url(encoded)
10
+ * expect(new TextDecoder().decode(decoded)).toEqual(text)
11
+ * ```
12
+ *
13
+ * @see {@link https://orpc.dev/docs/helpers/base64url | Base64Url Helpers}
14
+ */
15
+ export declare function encodeBase64url(data: Uint8Array): string;
16
+ /**
17
+ * Decodes a base64url string to Uint8Array
18
+ * Only accepts canonical, unpadded base64url (the form produced by `encodeBase64url`),
19
+ * returns undefined for anything else, including padded or standard base64 input
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const text = "Hello World"
24
+ * const encoded = encodeBase64url(new TextEncoder().encode(text))
25
+ * const decoded = decodeBase64url(encoded)
26
+ * expect(new TextDecoder().decode(decoded)).toEqual(text)
27
+ * ```
28
+ *
29
+ * @see {@link https://orpc.dev/docs/helpers/base64url | Base64Url Helpers}
30
+ */
31
+ export declare function decodeBase64url(base64url: string | undefined | null): Uint8Array<ArrayBuffer> | undefined;