@orpc/server 2.0.0-beta.24 → 2.0.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/aws-lambda/index.d.mts +1 -12
- package/dist/adapters/aws-lambda/index.d.ts +1 -12
- package/dist/adapters/aws-lambda/index.mjs +2 -9
- package/dist/adapters/crossws/index.d.mts +1 -1
- package/dist/adapters/crossws/index.d.ts +1 -1
- package/dist/adapters/crossws/index.mjs +1 -1
- package/dist/adapters/fastify/index.d.mts +1 -12
- package/dist/adapters/fastify/index.d.ts +1 -12
- package/dist/adapters/fastify/index.mjs +2 -9
- package/dist/adapters/fetch/index.d.mts +1 -12
- package/dist/adapters/fetch/index.d.ts +1 -12
- package/dist/adapters/fetch/index.mjs +2 -9
- package/dist/adapters/message-port/index.d.mts +1 -1
- package/dist/adapters/message-port/index.d.ts +1 -1
- package/dist/adapters/message-port/index.mjs +1 -1
- package/dist/adapters/node/index.d.mts +1 -12
- package/dist/adapters/node/index.d.ts +1 -12
- package/dist/adapters/node/index.mjs +2 -9
- package/dist/adapters/standard/index.d.mts +1 -1
- package/dist/adapters/standard/index.d.ts +1 -1
- package/dist/adapters/standard/index.mjs +1 -1
- package/dist/adapters/websocket/index.d.mts +1 -1
- package/dist/adapters/websocket/index.d.ts +1 -1
- package/dist/adapters/websocket/index.mjs +1 -1
- package/dist/index.d.mts +260 -0
- package/dist/index.d.ts +260 -0
- package/dist/index.mjs +73 -0
- package/dist/plugins/index.d.mts +49 -11
- package/dist/plugins/index.d.ts +49 -11
- package/dist/plugins/index.mjs +75 -3
- package/dist/shared/{server.BUvC0G_8.d.ts → server.C2n16pp0.d.ts} +24 -2
- package/dist/shared/{server.DEGjTAPW.mjs → server.Cbv46U7N.mjs} +19 -3
- package/dist/shared/{server.zySQaS-n.d.mts → server.CkNnZ5F-.d.mts} +24 -2
- package/package.json +5 -4
- package/dist/shared/server.D_QauotT.mjs +0 -30
package/dist/index.d.ts
CHANGED
|
@@ -55,67 +55,327 @@ type UnlaziedRouter<T extends AnyRouter> = T extends AnyProcedure ? T : {
|
|
|
55
55
|
*/
|
|
56
56
|
declare function unlazyRouter<T extends AnyRouter>(router: T): Promise<UnlaziedRouter<T>>;
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* The builder variant returned after `.use` is called.
|
|
60
|
+
* `.$context` and `.$config` are no longer available once middleware is applied.
|
|
61
|
+
*
|
|
62
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
63
|
+
*/
|
|
58
64
|
interface BuilderWithMiddlewares<TInitialContext extends Context, TInjectedContext extends Context, TErrorMap extends ErrorMap> {
|
|
59
65
|
'~orpc': BuilderDefinition<InitialInputSchema, InitialOutputSchema, TErrorMap>;
|
|
66
|
+
/**
|
|
67
|
+
* Applies metadata plugins to procedures built from this builder.
|
|
68
|
+
*
|
|
69
|
+
* @see {@link https://orpc.dev/docs/metadata | Metadata}
|
|
70
|
+
*/
|
|
60
71
|
'meta'(...plugins: MetaPlugin<InitialInputSchema, InitialOutputSchema, TErrorMap>[]): BuilderWithMiddlewares<TInitialContext, TInjectedContext, TErrorMap>;
|
|
72
|
+
/**
|
|
73
|
+
* Defines typesafe errors that procedures built from this builder can throw
|
|
74
|
+
* via the `errors` utility in handlers and middleware.
|
|
75
|
+
*
|
|
76
|
+
* @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
|
|
77
|
+
*/
|
|
61
78
|
'errors'<T extends ErrorMap>(errors: T): BuilderWithMiddlewares<TInitialContext, TInjectedContext, MergedErrorMap<TErrorMap, T>>;
|
|
79
|
+
/**
|
|
80
|
+
* Applies a middleware that runs before the handler of every procedure
|
|
81
|
+
* built from this builder.
|
|
82
|
+
*
|
|
83
|
+
* @see {@link https://orpc.dev/docs/middleware | Middleware}
|
|
84
|
+
*/
|
|
62
85
|
'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>>;
|
|
86
|
+
/**
|
|
87
|
+
* Creates a standalone middleware that can be composed and applied to any
|
|
88
|
+
* compatible builder or procedure with `.use`.
|
|
89
|
+
*
|
|
90
|
+
* @see {@link https://orpc.dev/docs/middleware | Middleware}
|
|
91
|
+
*/
|
|
63
92
|
'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>;
|
|
93
|
+
/**
|
|
94
|
+
* Defines the input schema used to validate and type the procedure input.
|
|
95
|
+
*
|
|
96
|
+
* @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
|
|
97
|
+
*/
|
|
64
98
|
'input'<T extends AnySchema>(schema: T): BuilderWithInput<TInitialContext, TInjectedContext, T, TErrorMap>;
|
|
99
|
+
/**
|
|
100
|
+
* Defines the output schema used to validate and type the procedure output.
|
|
101
|
+
*
|
|
102
|
+
* @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
|
|
103
|
+
*/
|
|
65
104
|
'output'<T extends AnySchema>(schema: T): BuilderWithOutput<TInitialContext, TInjectedContext, T, TErrorMap>;
|
|
105
|
+
/**
|
|
106
|
+
* Defines the function that implements the procedure and completes the
|
|
107
|
+
* chain, returning a callable procedure.
|
|
108
|
+
*
|
|
109
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
110
|
+
*/
|
|
66
111
|
'handler'<T>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, Schema<Exclude<T, AnyORPCError>>, TErrorMap, Extract<T, AnyORPCError>>;
|
|
112
|
+
/**
|
|
113
|
+
* Applies the builder's middleware, errors, and metadata to every procedure
|
|
114
|
+
* in the given router.
|
|
115
|
+
*
|
|
116
|
+
* @see {@link https://orpc.dev/docs/router#extending-router | Router - Extending Router}
|
|
117
|
+
*/
|
|
67
118
|
'router'<T extends Router<MergedContext<TInitialContext, TInjectedContext>>>(router: T): AugmentedRouterWithMiddlewares<T, TInitialContext, TInjectedContext, TErrorMap>;
|
|
119
|
+
/**
|
|
120
|
+
* Like `.router`, but loads the router lazily on first access, which helps
|
|
121
|
+
* reduce startup time for large applications.
|
|
122
|
+
*
|
|
123
|
+
* @see {@link https://orpc.dev/docs/router#lazy-router | Router - Lazy Router}
|
|
124
|
+
*/
|
|
68
125
|
'lazy'<T extends Router<MergedContext<TInitialContext, TInjectedContext>>>(loader: () => Promise<{
|
|
69
126
|
default: T;
|
|
70
127
|
}>): Lazy<AugmentedRouterWithMiddlewares<T, TInitialContext, TInjectedContext, TErrorMap>>;
|
|
71
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* The builder variant returned after `.input` is called.
|
|
131
|
+
* Only procedure-level methods remain available once an input schema is defined.
|
|
132
|
+
*
|
|
133
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
134
|
+
*/
|
|
72
135
|
interface BuilderWithInput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TErrorMap extends ErrorMap> {
|
|
73
136
|
'~orpc': BuilderDefinition<TInputSchema, InitialOutputSchema, TErrorMap>;
|
|
137
|
+
/**
|
|
138
|
+
* Applies metadata plugins to procedures built from this builder.
|
|
139
|
+
*
|
|
140
|
+
* @see {@link https://orpc.dev/docs/metadata | Metadata}
|
|
141
|
+
*/
|
|
74
142
|
'meta'(...plugins: MetaPlugin<TInputSchema, InitialOutputSchema, TErrorMap>[]): BuilderWithInput<TInitialContext, TInjectedContext, TInputSchema, TErrorMap>;
|
|
143
|
+
/**
|
|
144
|
+
* Defines typesafe errors that procedures built from this builder can throw
|
|
145
|
+
* via the `errors` utility in handlers and middleware.
|
|
146
|
+
*
|
|
147
|
+
* @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
|
|
148
|
+
*/
|
|
75
149
|
'errors'<T extends ErrorMap>(errors: T): BuilderWithInput<TInitialContext, TInjectedContext, TInputSchema, MergedErrorMap<TErrorMap, T>>;
|
|
150
|
+
/**
|
|
151
|
+
* Applies a middleware that runs before the handler and can access the
|
|
152
|
+
* validated input.
|
|
153
|
+
*
|
|
154
|
+
* @see {@link https://orpc.dev/docs/middleware | Middleware}
|
|
155
|
+
*/
|
|
76
156
|
'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>>;
|
|
157
|
+
/**
|
|
158
|
+
* Adds an additional input schema, merged with the previously defined one.
|
|
159
|
+
*
|
|
160
|
+
* @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
|
|
161
|
+
*/
|
|
77
162
|
'input'<T extends AnySchema>(schema: T): BuilderWithInput<TInitialContext, TInjectedContext, MergedSchema<T, TInputSchema>, TErrorMap>;
|
|
163
|
+
/**
|
|
164
|
+
* Defines the output schema used to validate and type the procedure output.
|
|
165
|
+
*
|
|
166
|
+
* @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
|
|
167
|
+
*/
|
|
78
168
|
'output'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, T, TErrorMap>;
|
|
169
|
+
/**
|
|
170
|
+
* Defines the function that implements the procedure and completes the
|
|
171
|
+
* chain, returning a callable procedure.
|
|
172
|
+
*
|
|
173
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
174
|
+
*/
|
|
79
175
|
'handler'<T>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, Schema<Exclude<T, AnyORPCError>>, TErrorMap, Extract<T, AnyORPCError>>;
|
|
80
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* The builder variant returned after `.output` is called.
|
|
179
|
+
* Only procedure-level methods remain available once an output schema is defined.
|
|
180
|
+
*
|
|
181
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
182
|
+
*/
|
|
81
183
|
interface BuilderWithOutput<TInitialContext extends Context, TInjectedContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
|
|
82
184
|
'~orpc': BuilderDefinition<InitialInputSchema, TOutputSchema, TErrorMap>;
|
|
185
|
+
/**
|
|
186
|
+
* Applies metadata plugins to procedures built from this builder.
|
|
187
|
+
*
|
|
188
|
+
* @see {@link https://orpc.dev/docs/metadata | Metadata}
|
|
189
|
+
*/
|
|
83
190
|
'meta'(...plugins: MetaPlugin<InitialInputSchema, TOutputSchema, TErrorMap>[]): BuilderWithOutput<TInitialContext, TInjectedContext, TOutputSchema, TErrorMap>;
|
|
191
|
+
/**
|
|
192
|
+
* Defines typesafe errors that procedures built from this builder can throw
|
|
193
|
+
* via the `errors` utility in handlers and middleware.
|
|
194
|
+
*
|
|
195
|
+
* @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
|
|
196
|
+
*/
|
|
84
197
|
'errors'<T extends ErrorMap>(errors: T): BuilderWithOutput<TInitialContext, TInjectedContext, TOutputSchema, MergedErrorMap<TErrorMap, T>>;
|
|
198
|
+
/**
|
|
199
|
+
* Applies a middleware that runs before the handler and can access the
|
|
200
|
+
* typed output.
|
|
201
|
+
*
|
|
202
|
+
* @see {@link https://orpc.dev/docs/middleware | Middleware}
|
|
203
|
+
*/
|
|
85
204
|
'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>>;
|
|
205
|
+
/**
|
|
206
|
+
* Defines the input schema used to validate and type the procedure input.
|
|
207
|
+
*
|
|
208
|
+
* @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
|
|
209
|
+
*/
|
|
86
210
|
'input'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, T, TOutputSchema, TErrorMap>;
|
|
211
|
+
/**
|
|
212
|
+
* Adds an additional output schema, merged with the previously defined one.
|
|
213
|
+
*
|
|
214
|
+
* @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
|
|
215
|
+
*/
|
|
87
216
|
'output'<T extends AnySchema>(schema: T): BuilderWithOutput<TInitialContext, TInjectedContext, MergedSchema<T, TOutputSchema>, TErrorMap>;
|
|
217
|
+
/**
|
|
218
|
+
* Defines the function that implements the procedure and completes the
|
|
219
|
+
* chain, returning a callable procedure.
|
|
220
|
+
*
|
|
221
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
222
|
+
*/
|
|
88
223
|
'handler'<T extends InferSchemaInput<TOutputSchema> | AnyORPCError>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, InitialInputSchema, TOutputSchema, TErrorMap, Extract<T, AnyORPCError>>;
|
|
89
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* The builder variant returned after both `.input` and `.output` are called.
|
|
227
|
+
* Only procedure-level methods remain available.
|
|
228
|
+
*
|
|
229
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
230
|
+
*/
|
|
90
231
|
interface BuilderWithInputOutput<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
|
|
91
232
|
'~orpc': BuilderDefinition<TInputSchema, TOutputSchema, TErrorMap>;
|
|
233
|
+
/**
|
|
234
|
+
* Applies metadata plugins to procedures built from this builder.
|
|
235
|
+
*
|
|
236
|
+
* @see {@link https://orpc.dev/docs/metadata | Metadata}
|
|
237
|
+
*/
|
|
92
238
|
'meta'(...plugins: MetaPlugin<TInputSchema, TOutputSchema, TErrorMap>[]): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
|
|
239
|
+
/**
|
|
240
|
+
* Defines typesafe errors that procedures built from this builder can throw
|
|
241
|
+
* via the `errors` utility in handlers and middleware.
|
|
242
|
+
*
|
|
243
|
+
* @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
|
|
244
|
+
*/
|
|
93
245
|
'errors'<T extends ErrorMap>(errors: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, MergedErrorMap<TErrorMap, T>>;
|
|
246
|
+
/**
|
|
247
|
+
* Applies a middleware that runs before the handler and can access the
|
|
248
|
+
* validated input and typed output.
|
|
249
|
+
*
|
|
250
|
+
* @see {@link https://orpc.dev/docs/middleware | Middleware}
|
|
251
|
+
*/
|
|
94
252
|
'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>>;
|
|
253
|
+
/**
|
|
254
|
+
* Adds an additional input schema, merged with the previously defined one.
|
|
255
|
+
*
|
|
256
|
+
* @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
|
|
257
|
+
*/
|
|
95
258
|
'input'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, MergedSchema<T, TInputSchema>, TOutputSchema, TErrorMap>;
|
|
259
|
+
/**
|
|
260
|
+
* Adds an additional output schema, merged with the previously defined one.
|
|
261
|
+
*
|
|
262
|
+
* @see {@link https://orpc.dev/docs/procedure#multiple-schemas | Procedure - Multiple Schemas}
|
|
263
|
+
*/
|
|
96
264
|
'output'<T extends AnySchema>(schema: T): BuilderWithInputOutput<TInitialContext, TInjectedContext, TInputSchema, MergedSchema<T, TOutputSchema>, TErrorMap>;
|
|
265
|
+
/**
|
|
266
|
+
* Defines the function that implements the procedure and completes the
|
|
267
|
+
* chain, returning a callable procedure.
|
|
268
|
+
*
|
|
269
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
270
|
+
*/
|
|
97
271
|
'handler'<T extends InferSchemaInput<TOutputSchema> | AnyORPCError>(handler: ProcedureHandler<MergedContext<TInitialContext, TInjectedContext>, InferSchemaOutput<TInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, Extract<T, AnyORPCError>>;
|
|
98
272
|
}
|
|
99
273
|
|
|
274
|
+
/**
|
|
275
|
+
* The initial context type used when `.$context` is not called.
|
|
276
|
+
* Augment this interface with `declare module '@orpc/server'` to define
|
|
277
|
+
* a default initial context type globally.
|
|
278
|
+
*
|
|
279
|
+
* @see {@link https://orpc.dev/docs/context#default-initial-context | Context - Default Initial Context}
|
|
280
|
+
*/
|
|
100
281
|
interface DefaultInitialContext {
|
|
101
282
|
}
|
|
102
283
|
interface BuilderDefinition<TInputSchema extends AnySchema, TInjectedContext extends AnySchema, TErrorMap extends ErrorMap> extends ProcedureContractDefinition<TInputSchema, TInjectedContext, TErrorMap>, ProcedureConfig {
|
|
103
284
|
orderedMiddlewares: OrderedMiddleware[];
|
|
104
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* The procedure builder behind `os`. Chain its methods to gradually define
|
|
288
|
+
* context, middleware, errors, schemas, and finally a handler or router.
|
|
289
|
+
*
|
|
290
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
291
|
+
*/
|
|
105
292
|
declare class Builder<TInitialContext extends Context, TErrorMap extends ErrorMap> {
|
|
106
293
|
'~orpc': BuilderDefinition<InitialInputSchema, InitialOutputSchema, TErrorMap>;
|
|
294
|
+
/**
|
|
295
|
+
* Private constructor to prevent direct instantiation.
|
|
296
|
+
* Use the static `create` method to initialize a new instance with a safe initial definition.
|
|
297
|
+
*/
|
|
107
298
|
private constructor();
|
|
299
|
+
/**
|
|
300
|
+
* Creates a fresh builder with an empty definition.
|
|
301
|
+
* Prefer the exported `os` instance over calling this directly.
|
|
302
|
+
*
|
|
303
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
304
|
+
*/
|
|
108
305
|
static create<T extends Context = DefaultInitialContext>(): Builder<T & object, Record<never, never>>;
|
|
306
|
+
/**
|
|
307
|
+
* Declares the initial context type that must be provided when executing
|
|
308
|
+
* procedures built from this builder.
|
|
309
|
+
*
|
|
310
|
+
* @see {@link https://orpc.dev/docs/context#initial-context | Context - Initial Context}
|
|
311
|
+
*/
|
|
109
312
|
$context<T extends Context = DefaultInitialContext>(): Builder<T & object, TErrorMap>;
|
|
313
|
+
/**
|
|
314
|
+
* Overrides the procedure configuration, such as disabling runtime
|
|
315
|
+
* input/output validation.
|
|
316
|
+
*
|
|
317
|
+
* @see {@link https://orpc.dev/docs/advanced/validation-customization | Validation Customization}
|
|
318
|
+
*/
|
|
110
319
|
$config(config: ProcedureConfig): Builder<TInitialContext, TErrorMap>;
|
|
320
|
+
/**
|
|
321
|
+
* Applies metadata plugins to procedures built from this builder.
|
|
322
|
+
*
|
|
323
|
+
* @see {@link https://orpc.dev/docs/metadata | Metadata}
|
|
324
|
+
*/
|
|
111
325
|
meta(...plugins: MetaPlugin<InitialInputSchema, InitialOutputSchema, TErrorMap>[]): Builder<TInitialContext, TErrorMap>;
|
|
326
|
+
/**
|
|
327
|
+
* Defines typesafe errors that procedures built from this builder can throw
|
|
328
|
+
* via the `errors` utility in handlers and middleware.
|
|
329
|
+
*
|
|
330
|
+
* @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
|
|
331
|
+
*/
|
|
112
332
|
errors<U extends ErrorMap>(errors: U): Builder<TInitialContext, MergedErrorMap<TErrorMap, U>>;
|
|
333
|
+
/**
|
|
334
|
+
* Applies a middleware that runs before the handler of every procedure
|
|
335
|
+
* built from this builder.
|
|
336
|
+
*
|
|
337
|
+
* @see {@link https://orpc.dev/docs/middleware | Middleware}
|
|
338
|
+
*/
|
|
113
339
|
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>>;
|
|
340
|
+
/**
|
|
341
|
+
* Creates a standalone middleware that can be composed and applied to any
|
|
342
|
+
* compatible builder or procedure with `.use`.
|
|
343
|
+
*
|
|
344
|
+
* @see {@link https://orpc.dev/docs/middleware | Middleware}
|
|
345
|
+
*/
|
|
114
346
|
middleware<$OutContext extends IntersectPick<TInitialContext, $OutContext>, $Input, $Output = any>(middleware: Middleware<TInitialContext, $OutContext, $Input, $Output, TErrorMap>): DecoratedMiddleware<TInitialContext, $OutContext, $Input, $Output, TErrorMap>;
|
|
347
|
+
/**
|
|
348
|
+
* Defines the input schema used to validate and type the procedure input.
|
|
349
|
+
*
|
|
350
|
+
* @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
|
|
351
|
+
*/
|
|
115
352
|
input<$ extends AnySchema>(schema: $): BuilderWithInput<TInitialContext, object, $, TErrorMap>;
|
|
353
|
+
/**
|
|
354
|
+
* Defines the output schema used to validate and type the procedure output.
|
|
355
|
+
*
|
|
356
|
+
* @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
|
|
357
|
+
*/
|
|
116
358
|
output<$ extends AnySchema>(schema: $): BuilderWithOutput<TInitialContext, object, $, TErrorMap>;
|
|
359
|
+
/**
|
|
360
|
+
* Defines the function that implements the procedure and completes the
|
|
361
|
+
* chain, returning a callable procedure.
|
|
362
|
+
*
|
|
363
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
364
|
+
*/
|
|
117
365
|
handler<T>(handler: ProcedureHandler<TInitialContext, InferSchemaOutput<InitialInputSchema>, T, ORPCErrorConstructorMap<TErrorMap>>): DecoratedProcedure<TInitialContext, object, InitialInputSchema, Schema<Exclude<T, AnyORPCError>>, TErrorMap, Extract<T, AnyORPCError>>;
|
|
366
|
+
/**
|
|
367
|
+
* Applies the builder's middleware, errors, and metadata to every procedure
|
|
368
|
+
* in the given router.
|
|
369
|
+
*
|
|
370
|
+
* @see {@link https://orpc.dev/docs/router#extending-router | Router - Extending Router}
|
|
371
|
+
*/
|
|
118
372
|
router<T extends AnyRouter>(router: T): AugmentedRouter<T, TErrorMap>;
|
|
373
|
+
/**
|
|
374
|
+
* Like `.router`, but loads the router lazily on first access, which helps
|
|
375
|
+
* reduce startup time for large applications.
|
|
376
|
+
*
|
|
377
|
+
* @see {@link https://orpc.dev/docs/router#lazy-router | Router - Lazy Router}
|
|
378
|
+
*/
|
|
119
379
|
lazy<T extends AnyRouter>(loader: () => Promise<{
|
|
120
380
|
default: T;
|
|
121
381
|
}>): Lazy<AugmentedRouter<T, TErrorMap>>;
|
package/dist/index.mjs
CHANGED
|
@@ -86,9 +86,19 @@ function decorateMiddleware(middleware) {
|
|
|
86
86
|
|
|
87
87
|
class Builder {
|
|
88
88
|
"~orpc";
|
|
89
|
+
/**
|
|
90
|
+
* Private constructor to prevent direct instantiation.
|
|
91
|
+
* Use the static `create` method to initialize a new instance with a safe initial definition.
|
|
92
|
+
*/
|
|
89
93
|
constructor(definition) {
|
|
90
94
|
this["~orpc"] = definition;
|
|
91
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Creates a fresh builder with an empty definition.
|
|
98
|
+
* Prefer the exported `os` instance over calling this directly.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
101
|
+
*/
|
|
92
102
|
static create() {
|
|
93
103
|
return new Builder({
|
|
94
104
|
errorMap: {},
|
|
@@ -96,15 +106,32 @@ class Builder {
|
|
|
96
106
|
orderedMiddlewares: []
|
|
97
107
|
});
|
|
98
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Declares the initial context type that must be provided when executing
|
|
111
|
+
* procedures built from this builder.
|
|
112
|
+
*
|
|
113
|
+
* @see {@link https://orpc.dev/docs/context#initial-context | Context - Initial Context}
|
|
114
|
+
*/
|
|
99
115
|
$context() {
|
|
100
116
|
return this;
|
|
101
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Overrides the procedure configuration, such as disabling runtime
|
|
120
|
+
* input/output validation.
|
|
121
|
+
*
|
|
122
|
+
* @see {@link https://orpc.dev/docs/advanced/validation-customization | Validation Customization}
|
|
123
|
+
*/
|
|
102
124
|
$config(config) {
|
|
103
125
|
return new Builder({
|
|
104
126
|
...this["~orpc"],
|
|
105
127
|
...config
|
|
106
128
|
});
|
|
107
129
|
}
|
|
130
|
+
/**
|
|
131
|
+
* Applies metadata plugins to procedures built from this builder.
|
|
132
|
+
*
|
|
133
|
+
* @see {@link https://orpc.dev/docs/metadata | Metadata}
|
|
134
|
+
*/
|
|
108
135
|
meta(...plugins) {
|
|
109
136
|
const [meta, metaPlugins] = resolveMetaPlugins(
|
|
110
137
|
this["~orpc"].meta,
|
|
@@ -117,6 +144,12 @@ class Builder {
|
|
|
117
144
|
metaPlugins
|
|
118
145
|
});
|
|
119
146
|
}
|
|
147
|
+
/**
|
|
148
|
+
* Defines typesafe errors that procedures built from this builder can throw
|
|
149
|
+
* via the `errors` utility in handlers and middleware.
|
|
150
|
+
*
|
|
151
|
+
* @see {@link https://orpc.dev/docs/error-handling#typesafe-errors | Error Handling - Typesafe Errors}
|
|
152
|
+
*/
|
|
120
153
|
errors(errors) {
|
|
121
154
|
let builder = new Builder({
|
|
122
155
|
...this["~orpc"],
|
|
@@ -128,6 +161,12 @@ class Builder {
|
|
|
128
161
|
}
|
|
129
162
|
return builder;
|
|
130
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* Applies a middleware that runs before the handler of every procedure
|
|
166
|
+
* built from this builder.
|
|
167
|
+
*
|
|
168
|
+
* @see {@link https://orpc.dev/docs/middleware | Middleware}
|
|
169
|
+
*/
|
|
131
170
|
use(middleware) {
|
|
132
171
|
let builder = new Builder({
|
|
133
172
|
...this["~orpc"],
|
|
@@ -143,6 +182,12 @@ class Builder {
|
|
|
143
182
|
}
|
|
144
183
|
return builder;
|
|
145
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* Creates a standalone middleware that can be composed and applied to any
|
|
187
|
+
* compatible builder or procedure with `.use`.
|
|
188
|
+
*
|
|
189
|
+
* @see {@link https://orpc.dev/docs/middleware | Middleware}
|
|
190
|
+
*/
|
|
146
191
|
middleware(middleware) {
|
|
147
192
|
const allMiddlewares = [
|
|
148
193
|
...this["~orpc"].orderedMiddlewares.map(({ middleware: middleware2 }) => middleware2),
|
|
@@ -162,6 +207,11 @@ class Builder {
|
|
|
162
207
|
};
|
|
163
208
|
return current;
|
|
164
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Defines the input schema used to validate and type the procedure input.
|
|
212
|
+
*
|
|
213
|
+
* @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
|
|
214
|
+
*/
|
|
165
215
|
input(schema) {
|
|
166
216
|
let builder = new Builder({
|
|
167
217
|
...this["~orpc"],
|
|
@@ -173,6 +223,11 @@ class Builder {
|
|
|
173
223
|
}
|
|
174
224
|
return builder;
|
|
175
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Defines the output schema used to validate and type the procedure output.
|
|
228
|
+
*
|
|
229
|
+
* @see {@link https://orpc.dev/docs/procedure#inputoutput-validation | Procedure - Input/Output Validation}
|
|
230
|
+
*/
|
|
176
231
|
output(schema) {
|
|
177
232
|
let builder = new Builder({
|
|
178
233
|
...this["~orpc"],
|
|
@@ -184,6 +239,12 @@ class Builder {
|
|
|
184
239
|
}
|
|
185
240
|
return builder;
|
|
186
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Defines the function that implements the procedure and completes the
|
|
244
|
+
* chain, returning a callable procedure.
|
|
245
|
+
*
|
|
246
|
+
* @see {@link https://orpc.dev/docs/procedure | Procedure}
|
|
247
|
+
*/
|
|
187
248
|
handler(handler) {
|
|
188
249
|
let procedure = new DecoratedProcedure({
|
|
189
250
|
...this["~orpc"],
|
|
@@ -195,12 +256,24 @@ class Builder {
|
|
|
195
256
|
}
|
|
196
257
|
return procedure;
|
|
197
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Applies the builder's middleware, errors, and metadata to every procedure
|
|
261
|
+
* in the given router.
|
|
262
|
+
*
|
|
263
|
+
* @see {@link https://orpc.dev/docs/router#extending-router | Router - Extending Router}
|
|
264
|
+
*/
|
|
198
265
|
router(router) {
|
|
199
266
|
return augmentRouter(router, {
|
|
200
267
|
...this["~orpc"],
|
|
201
268
|
middlewares: this["~orpc"].orderedMiddlewares.map(({ middleware }) => middleware)
|
|
202
269
|
});
|
|
203
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Like `.router`, but loads the router lazily on first access, which helps
|
|
273
|
+
* reduce startup time for large applications.
|
|
274
|
+
*
|
|
275
|
+
* @see {@link https://orpc.dev/docs/router#lazy-router | Router - Lazy Router}
|
|
276
|
+
*/
|
|
204
277
|
lazy(loader) {
|
|
205
278
|
return new Lazy({
|
|
206
279
|
loader: async () => {
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Value, Promisable, ThrowableError } from '@orpc/shared';
|
|
2
|
-
import { StandardLazyRequest, StandardHeaders } from '@standardserver/core';
|
|
2
|
+
import { StandardLazyRequest, StandardHeaders, StandardMethod } from '@standardserver/core';
|
|
3
3
|
import { C as Context } from '../shared/server.CwrYlF72.mjs';
|
|
4
4
|
import { S as StandardHandlerPlugin, f as StandardHandlerRoutingInterceptorOptions, a as StandardHandlerOptions, g as StandardHandlerInterceptorOptions } from '../shared/server.JbCIPL4P.mjs';
|
|
5
5
|
export { R as RequestLimitHandlerPlugin, a as RequestLimitHandlerPluginOptions } from '../shared/server.D0Ipbmdv.mjs';
|
|
@@ -155,18 +155,39 @@ declare class CORSHandlerPlugin<T extends Context> implements StandardHandlerPlu
|
|
|
155
155
|
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
interface MethodOverrideHandlerPluginOptions {
|
|
159
|
+
/**
|
|
160
|
+
* The query parameter carrying the override method.
|
|
161
|
+
*
|
|
162
|
+
* @default 'method'
|
|
163
|
+
*/
|
|
164
|
+
param?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The methods a POST request may be overridden to.
|
|
167
|
+
*
|
|
168
|
+
* GET and HEAD are excluded by default because they switch input decoding
|
|
169
|
+
* from the request body to the query string and widen the CSRF surface.
|
|
170
|
+
*
|
|
171
|
+
* @default ['PUT', 'PATCH', 'DELETE']
|
|
172
|
+
*/
|
|
173
|
+
methods?: readonly StandardMethod[];
|
|
174
|
+
}
|
|
158
175
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
176
|
+
* Overrides the HTTP method of a POST request based on a query parameter,
|
|
177
|
+
* so HTML forms (which only support GET and POST) can invoke procedures
|
|
178
|
+
* routed as PUT, PATCH, or DELETE.
|
|
162
179
|
*
|
|
163
|
-
* @
|
|
164
|
-
* **Note**: This plugin is enabled by default for `RPCHandler` over HTTP.
|
|
165
|
-
*
|
|
166
|
-
* @see {@link https://orpc.dev/docs/plugins/csrf-guard | CSRF Guard Plugin}
|
|
180
|
+
* @see {@link https://orpc.dev/docs/plugins/method-override | Method Override Plugin}
|
|
167
181
|
*/
|
|
168
|
-
declare class
|
|
182
|
+
declare class MethodOverrideHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
169
183
|
name: string;
|
|
184
|
+
/**
|
|
185
|
+
* Should override batch sub-request methods, not the original batch request.
|
|
186
|
+
*/
|
|
187
|
+
before: string[];
|
|
188
|
+
private readonly param;
|
|
189
|
+
private readonly methods;
|
|
190
|
+
constructor(options?: MethodOverrideHandlerPluginOptions);
|
|
170
191
|
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
171
192
|
}
|
|
172
193
|
|
|
@@ -302,5 +323,22 @@ declare class RethrowHandlerPlugin<T extends Context> implements StandardHandler
|
|
|
302
323
|
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
303
324
|
}
|
|
304
325
|
|
|
305
|
-
|
|
306
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Adds basic Cross-Site Request Forgery (CSRF) protection to your oRPC application.
|
|
328
|
+
* When a request includes cookies, it helps ensure the request originates from JavaScript
|
|
329
|
+
* (for example, fetch/XHR) rather than from standard HTML forms or direct browser navigation.
|
|
330
|
+
*
|
|
331
|
+
* @remarks
|
|
332
|
+
* Unlike `SameSite` cookies, this protection also covers cross-site requests that
|
|
333
|
+
* still carry cookies, so it is the recommended safeguard when you enable the `GET`
|
|
334
|
+
* method on RPC handlers or rely on cookie-based authentication.
|
|
335
|
+
*
|
|
336
|
+
* @see {@link https://orpc.dev/docs/plugins/simple-csrf-protection | Simple CSRF Protection Plugin}
|
|
337
|
+
*/
|
|
338
|
+
declare class SimpleCsrfProtectionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
339
|
+
name: string;
|
|
340
|
+
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export { BATCH_CONTENT_TYPE, BatchHandlerPlugin, CORSHandlerPlugin, CORSHandlerPlugin as CORSPlugin, MethodOverrideHandlerPlugin, RequestCompressionHandlerPlugin, RequestHeadersHandlerPlugin, RequestHeadersHandlerPlugin as RequestHeadersPlugin, ResponseCompressionHandlerPlugin, ResponseHeadersHandlerPlugin, ResponseHeadersHandlerPlugin as ResponseHeadersPlugin, RethrowHandlerPlugin, SimpleCsrfProtectionHandlerPlugin };
|
|
344
|
+
export type { BatchHandlerPluginOptions, CORSHandlerPluginOptions, MethodOverrideHandlerPluginOptions, RequestHeadersHandlerPluginContext, RequestHeadersHandlerPluginContext as RequestHeadersPluginContext, ResponseCompressionHandlerPluginOptions, ResponseHeadersHandlerPluginContext, ResponseHeadersHandlerPluginContext as ResponseHeadersPluginContext, RethrowHandlerPluginOptions };
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Value, Promisable, ThrowableError } from '@orpc/shared';
|
|
2
|
-
import { StandardLazyRequest, StandardHeaders } from '@standardserver/core';
|
|
2
|
+
import { StandardLazyRequest, StandardHeaders, StandardMethod } from '@standardserver/core';
|
|
3
3
|
import { C as Context } from '../shared/server.CwrYlF72.js';
|
|
4
4
|
import { S as StandardHandlerPlugin, f as StandardHandlerRoutingInterceptorOptions, a as StandardHandlerOptions, g as StandardHandlerInterceptorOptions } from '../shared/server.DrN1Pj1-.js';
|
|
5
5
|
export { R as RequestLimitHandlerPlugin, a as RequestLimitHandlerPluginOptions } from '../shared/server.BhHrioCw.js';
|
|
@@ -155,18 +155,39 @@ declare class CORSHandlerPlugin<T extends Context> implements StandardHandlerPlu
|
|
|
155
155
|
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
interface MethodOverrideHandlerPluginOptions {
|
|
159
|
+
/**
|
|
160
|
+
* The query parameter carrying the override method.
|
|
161
|
+
*
|
|
162
|
+
* @default 'method'
|
|
163
|
+
*/
|
|
164
|
+
param?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The methods a POST request may be overridden to.
|
|
167
|
+
*
|
|
168
|
+
* GET and HEAD are excluded by default because they switch input decoding
|
|
169
|
+
* from the request body to the query string and widen the CSRF surface.
|
|
170
|
+
*
|
|
171
|
+
* @default ['PUT', 'PATCH', 'DELETE']
|
|
172
|
+
*/
|
|
173
|
+
methods?: readonly StandardMethod[];
|
|
174
|
+
}
|
|
158
175
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
176
|
+
* Overrides the HTTP method of a POST request based on a query parameter,
|
|
177
|
+
* so HTML forms (which only support GET and POST) can invoke procedures
|
|
178
|
+
* routed as PUT, PATCH, or DELETE.
|
|
162
179
|
*
|
|
163
|
-
* @
|
|
164
|
-
* **Note**: This plugin is enabled by default for `RPCHandler` over HTTP.
|
|
165
|
-
*
|
|
166
|
-
* @see {@link https://orpc.dev/docs/plugins/csrf-guard | CSRF Guard Plugin}
|
|
180
|
+
* @see {@link https://orpc.dev/docs/plugins/method-override | Method Override Plugin}
|
|
167
181
|
*/
|
|
168
|
-
declare class
|
|
182
|
+
declare class MethodOverrideHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
169
183
|
name: string;
|
|
184
|
+
/**
|
|
185
|
+
* Should override batch sub-request methods, not the original batch request.
|
|
186
|
+
*/
|
|
187
|
+
before: string[];
|
|
188
|
+
private readonly param;
|
|
189
|
+
private readonly methods;
|
|
190
|
+
constructor(options?: MethodOverrideHandlerPluginOptions);
|
|
170
191
|
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
171
192
|
}
|
|
172
193
|
|
|
@@ -302,5 +323,22 @@ declare class RethrowHandlerPlugin<T extends Context> implements StandardHandler
|
|
|
302
323
|
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
303
324
|
}
|
|
304
325
|
|
|
305
|
-
|
|
306
|
-
|
|
326
|
+
/**
|
|
327
|
+
* Adds basic Cross-Site Request Forgery (CSRF) protection to your oRPC application.
|
|
328
|
+
* When a request includes cookies, it helps ensure the request originates from JavaScript
|
|
329
|
+
* (for example, fetch/XHR) rather than from standard HTML forms or direct browser navigation.
|
|
330
|
+
*
|
|
331
|
+
* @remarks
|
|
332
|
+
* Unlike `SameSite` cookies, this protection also covers cross-site requests that
|
|
333
|
+
* still carry cookies, so it is the recommended safeguard when you enable the `GET`
|
|
334
|
+
* method on RPC handlers or rely on cookie-based authentication.
|
|
335
|
+
*
|
|
336
|
+
* @see {@link https://orpc.dev/docs/plugins/simple-csrf-protection | Simple CSRF Protection Plugin}
|
|
337
|
+
*/
|
|
338
|
+
declare class SimpleCsrfProtectionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
|
|
339
|
+
name: string;
|
|
340
|
+
init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export { BATCH_CONTENT_TYPE, BatchHandlerPlugin, CORSHandlerPlugin, CORSHandlerPlugin as CORSPlugin, MethodOverrideHandlerPlugin, RequestCompressionHandlerPlugin, RequestHeadersHandlerPlugin, RequestHeadersHandlerPlugin as RequestHeadersPlugin, ResponseCompressionHandlerPlugin, ResponseHeadersHandlerPlugin, ResponseHeadersHandlerPlugin as ResponseHeadersPlugin, RethrowHandlerPlugin, SimpleCsrfProtectionHandlerPlugin };
|
|
344
|
+
export type { BatchHandlerPluginOptions, CORSHandlerPluginOptions, MethodOverrideHandlerPluginOptions, RequestHeadersHandlerPluginContext, RequestHeadersHandlerPluginContext as RequestHeadersPluginContext, ResponseCompressionHandlerPluginOptions, ResponseHeadersHandlerPluginContext, ResponseHeadersHandlerPluginContext as ResponseHeadersPluginContext, RethrowHandlerPluginOptions };
|