@orpc/server 1.14.11 → 1.14.13

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 (78) hide show
  1. package/README.md +98 -52
  2. package/dist/adapters/aws-lambda/index.d.mts +46 -0
  3. package/dist/adapters/aws-lambda/index.d.ts +46 -0
  4. package/dist/adapters/aws-lambda/index.mjs +40 -0
  5. package/dist/adapters/bun-ws/index.d.mts +36 -0
  6. package/dist/adapters/bun-ws/index.d.ts +36 -0
  7. package/dist/adapters/bun-ws/index.mjs +47 -0
  8. package/dist/adapters/crossws/index.d.mts +21 -45
  9. package/dist/adapters/crossws/index.d.ts +21 -45
  10. package/dist/adapters/crossws/index.mjs +18 -40
  11. package/dist/adapters/fastify/index.d.mts +53 -0
  12. package/dist/adapters/fastify/index.d.ts +53 -0
  13. package/dist/adapters/fastify/index.mjs +52 -0
  14. package/dist/adapters/fetch/index.d.mts +96 -64
  15. package/dist/adapters/fetch/index.d.ts +96 -64
  16. package/dist/adapters/fetch/index.mjs +139 -34
  17. package/dist/adapters/message-port/index.d.mts +34 -49
  18. package/dist/adapters/message-port/index.d.ts +34 -49
  19. package/dist/adapters/message-port/index.mjs +37 -68
  20. package/dist/adapters/node/index.d.mts +71 -63
  21. package/dist/adapters/node/index.d.ts +71 -63
  22. package/dist/adapters/node/index.mjs +113 -36
  23. package/dist/adapters/standard/index.d.mts +18 -16
  24. package/dist/adapters/standard/index.d.ts +18 -16
  25. package/dist/adapters/standard/index.mjs +5 -5
  26. package/dist/adapters/standard-peer/index.d.mts +14 -12
  27. package/dist/adapters/standard-peer/index.d.ts +14 -12
  28. package/dist/adapters/standard-peer/index.mjs +21 -2
  29. package/dist/adapters/websocket/index.d.mts +38 -53
  30. package/dist/adapters/websocket/index.d.ts +38 -53
  31. package/dist/adapters/websocket/index.mjs +42 -59
  32. package/dist/adapters/ws/index.d.mts +31 -0
  33. package/dist/adapters/ws/index.d.ts +31 -0
  34. package/dist/adapters/ws/index.mjs +41 -0
  35. package/dist/helpers/index.d.mts +4 -4
  36. package/dist/helpers/index.d.ts +4 -4
  37. package/dist/helpers/index.mjs +5 -13
  38. package/dist/hibernation/index.d.mts +44 -0
  39. package/dist/hibernation/index.d.ts +44 -0
  40. package/dist/hibernation/index.mjs +65 -0
  41. package/dist/index.d.mts +770 -166
  42. package/dist/index.d.ts +770 -166
  43. package/dist/index.mjs +399 -306
  44. package/dist/plugins/index.d.mts +121 -214
  45. package/dist/plugins/index.d.ts +121 -214
  46. package/dist/plugins/index.mjs +214 -576
  47. package/dist/shared/server.7cEtMB30.d.ts +74 -0
  48. package/dist/shared/server.B8gYOD5g.d.mts +12 -0
  49. package/dist/shared/server.BqadksTP.d.mts +74 -0
  50. package/dist/shared/server.C8_sRzQB.d.mts +42 -0
  51. package/dist/shared/server.CMf4nKky.mjs +230 -0
  52. package/dist/shared/server.ChyoA9XY.d.ts +42 -0
  53. package/dist/shared/server.D8IXzfqT.d.ts +32 -0
  54. package/dist/shared/server.DEBcqOjg.mjs +418 -0
  55. package/dist/shared/{server.W91HSRkE.mjs → server.DZ5BIITo.mjs} +2 -2
  56. package/dist/shared/server.DzE6WeuY.d.mts +32 -0
  57. package/dist/shared/server.EfTOZ2Q7.d.ts +12 -0
  58. package/dist/shared/server.TEVCLCFC.mjs +39 -0
  59. package/dist/shared/server.qKsRrdxW.d.mts +193 -0
  60. package/dist/shared/server.qKsRrdxW.d.ts +193 -0
  61. package/package.json +56 -26
  62. package/dist/extensions/callable.d.mts +0 -10
  63. package/dist/extensions/callable.d.ts +0 -10
  64. package/dist/extensions/callable.mjs +0 -11
  65. package/dist/shared/server.15O7oC1p.d.mts +0 -61
  66. package/dist/shared/server.B4BnEWWm.d.mts +0 -67
  67. package/dist/shared/server.BhsVw7m7.d.ts +0 -104
  68. package/dist/shared/server.BoiFpNT7.mjs +0 -224
  69. package/dist/shared/server.COPVXhDG.mjs +0 -271
  70. package/dist/shared/server.CX4vUnDk.mjs +0 -11
  71. package/dist/shared/server.CcR4kgje.d.mts +0 -206
  72. package/dist/shared/server.CcR4kgje.d.ts +0 -206
  73. package/dist/shared/server.CnN50DHH.d.ts +0 -67
  74. package/dist/shared/server.DBs0rrf9.mjs +0 -41
  75. package/dist/shared/server.DDFizwfU.d.mts +0 -104
  76. package/dist/shared/server.D_QauotT.mjs +0 -30
  77. package/dist/shared/server.DofEOwf-.mjs +0 -237
  78. package/dist/shared/server.m3szVJGU.d.ts +0 -61
@@ -1,297 +1,204 @@
1
1
  import { Value, Promisable, ThrowableError } from '@orpc/shared';
2
- import { StandardLazyRequest, StandardHeaders } from '@standardserver/core';
3
- import { C as Context } from '../shared/server.CcR4kgje.mjs';
4
- import { e as StandardHandlerPlugin, f as StandardHandlerRoutingInterceptorOptions, a as StandardHandlerOptions, g as StandardHandlerInterceptorOptions } from '../shared/server.DDFizwfU.mjs';
5
- import '@orpc/client';
6
- import '@orpc/contract';
2
+ import { StandardRequest, StandardHeaders } from '@orpc/standard-server';
3
+ import { BatchResponseBodyItem } from '@orpc/standard-server/batch';
4
+ import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.qKsRrdxW.mjs';
5
+ import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.BqadksTP.mjs';
6
+ import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
7
+ import { ORPCError } from '@orpc/client';
7
8
 
8
- interface BatchHandlerPluginOptions<T extends Context> {
9
+ interface BatchHandlerOptions<T extends Context> {
9
10
  /**
10
11
  * The max size of the batch allowed.
11
12
  *
12
13
  * @default 10
13
14
  */
14
- maxSize?: Value<Promisable<number>, [options: StandardHandlerRoutingInterceptorOptions<T>]>;
15
+ maxSize?: Value<Promisable<number>, [StandardHandlerInterceptorOptions<T>]>;
15
16
  /**
16
- * Map each subrequest in the batch before it is processed.
17
+ * Map the request before processing it.
17
18
  *
18
- * @default merges the batch request headers into the subrequest and remove `orpc-batch` header to prevent nested batching
19
+ * @default merged back batch request headers into the request
19
20
  */
20
- mapSubrequest?: (subrequest: StandardLazyRequest, batchOptions: StandardHandlerRoutingInterceptorOptions<T>) => StandardLazyRequest;
21
+ mapRequestItem?(request: StandardRequest, batchOptions: StandardHandlerInterceptorOptions<T>): StandardRequest;
21
22
  /**
22
23
  * Success batch response status code.
23
24
  *
24
25
  * @default 207
25
26
  */
26
- successStatus?: Value<Promisable<number>, [batchOptions: StandardHandlerRoutingInterceptorOptions<T>]>;
27
+ successStatus?: Value<Promisable<number>, [responses: Promise<BatchResponseBodyItem>[], batchOptions: StandardHandlerInterceptorOptions<T>]>;
27
28
  /**
28
- * Success batch response headers.
29
+ * success batch response headers.
29
30
  *
30
31
  * @default {}
31
32
  */
32
- headers?: Value<Promisable<StandardHeaders>, [batchOptions: StandardHandlerRoutingInterceptorOptions<T>]>;
33
- /**
34
- * Keep-alive settings for streaming batch responses.
35
- *
36
- * When enabled, a zero-length length-prefixed frame is sent periodically while the
37
- * stream is idle (no message sent for `interval` ms). Clients ignore these frames.
38
- * Only applies to streaming mode.
39
- *
40
- * @default { enabled: true, interval: 15000 }
41
- */
42
- keepAlive?: undefined | {
43
- /**
44
- * If true, a keep-alive frame is sent periodically while the stream is idle.
45
- *
46
- * @default true
47
- */
48
- enabled: boolean;
49
- /**
50
- * Interval (in milliseconds) between keep-alive frames after the last message.
51
- *
52
- * @default 15000
53
- */
54
- interval?: number;
55
- };
33
+ headers?: Value<Promisable<StandardHeaders>, [responses: Promise<BatchResponseBodyItem>[], batchOptions: StandardHandlerInterceptorOptions<T>]>;
56
34
  }
35
+ /**
36
+ * The Batch Requests Plugin allows you to combine multiple requests and responses into a single batch,
37
+ * reducing the overhead of sending each one separately.
38
+ *
39
+ * @see {@link https://orpc.dev/docs/plugins/batch-requests Batch Requests Plugin Docs}
40
+ */
57
41
  declare class BatchHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
58
- name: string;
59
- /**
60
- * Run batch interceptors before OpenTelemetry interceptors
61
- * so each subrequest gets its own span instead of sharing one batch-level span.
62
- */
63
- after: string[];
64
42
  private readonly maxSize;
65
- private readonly mapSubrequest;
43
+ private readonly mapRequestItem;
66
44
  private readonly successStatus;
67
45
  private readonly headers;
68
- private readonly keepAliveEnabled;
69
- private readonly keepAliveInterval;
70
- constructor(options?: BatchHandlerPluginOptions<T>);
71
- init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
46
+ order: number;
47
+ constructor(options?: BatchHandlerOptions<T>);
48
+ init(options: StandardHandlerOptions<T>): void;
72
49
  }
73
50
 
74
- interface CORSHandlerPluginOptions<T extends Context> {
75
- /**
76
- * Configures the `Access-Control-Allow-Origin` header.
77
- * Can be a string, an array of allowed origins, or a function that returns the allowed origin(s).
78
- *
79
- * @default (origin) => origin
80
- */
81
- origin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerRoutingInterceptorOptions<T>]>;
82
- /**
83
- * Configures the `Timing-Allow-Origin` header.
84
- * Can be a string, an array of allowed origins, or a function that returns the allowed origin(s).
85
- *
86
- * @default undefined
87
- */
88
- timingOrigin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerRoutingInterceptorOptions<T>]>;
89
- /**
90
- * Configures the `Access-Control-Allow-Methods` header for preflight requests.
91
- *
92
- * @default ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH']
93
- */
51
+ interface CORSOptions<T extends Context> {
52
+ origin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerInterceptorOptions<T>]>;
53
+ timingOrigin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerInterceptorOptions<T>]>;
94
54
  allowMethods?: readonly string[];
95
- /**
96
- * Configures the `Access-Control-Allow-Headers` header for preflight requests.
97
- * Falls back to the request's `Access-Control-Request-Headers` if not set.
98
- *
99
- * @default undefined
100
- */
101
55
  allowHeaders?: readonly string[];
102
- /**
103
- * Configures the `Access-Control-Max-Age` header (in seconds) for preflight requests.
104
- *
105
- * @default undefined
106
- */
107
56
  maxAge?: number;
108
- /**
109
- * Configures the `Access-Control-Allow-Credentials` header.
110
- *
111
- * @default undefined
112
- */
113
57
  credentials?: boolean;
114
- /**
115
- * Configures the `Access-Control-Expose-Headers` header.
116
- *
117
- * @default undefined
118
- */
119
58
  exposeHeaders?: readonly string[];
120
59
  }
121
60
  /**
122
- * CORSHandlerPlugin is a plugin for oRPC that allows you to configure CORS for your API.
61
+ * CORSPlugin is a plugin for oRPC that allows you to configure CORS for your API.
123
62
  *
124
63
  * @see {@link https://orpc.dev/docs/plugins/cors CORS Plugin Docs}
125
64
  */
126
- declare class CORSHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
65
+ declare class CORSPlugin<T extends Context> implements StandardHandlerPlugin<T> {
127
66
  private readonly options;
128
- name: string;
129
- /**
130
- * - Do not create spans for CORS preflight requests.
131
- * - Run CORS interceptors before batch interceptors so headers are applied to
132
- * the actual response rather than sub-responses.
133
- */
134
- after: string[];
135
- constructor(options?: CORSHandlerPluginOptions<T>);
136
- init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
67
+ order: number;
68
+ constructor(options?: CORSOptions<T>);
69
+ init(options: StandardHandlerOptions<T>): void;
137
70
  }
138
71
 
72
+ interface RequestHeadersPluginContext {
73
+ reqHeaders?: Headers;
74
+ }
139
75
  /**
140
- * Adds basic Cross-Site Request Forgery (CSRF) protection to your oRPC application.
141
- * When a request includes cookies, it helps ensure the request originates from JavaScript
142
- * (for example, fetch/XHR) rather than from standard HTML forms or direct browser navigation.
76
+ * The Request Headers Plugin injects a `reqHeaders` instance into the context,
77
+ * allowing access to request headers in oRPC.
143
78
  *
144
- * @info This plugin is enabled by default for `RPCHandler` over HTTP.
79
+ * @see {@link https://orpc.dev/docs/plugins/request-headers Request Headers Plugin Docs}
145
80
  */
146
- declare class CSRFGuardHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
147
- name: string;
148
- init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
81
+ declare class RequestHeadersPlugin<T extends RequestHeadersPluginContext> implements StandardHandlerPlugin<T> {
82
+ init(options: StandardHandlerOptions<T>): void;
149
83
  }
150
84
 
151
- declare class RequestCompressionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
152
- name: string;
153
- /**
154
- * Should decompress the original batch request body instead of sub-requests.
155
- */
156
- after: string[];
157
- init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
158
- }
159
-
160
- interface RequestHeadersHandlerPluginContext {
161
- /**
162
- * Request headers as a Headers instance. This is injected by the Request Headers Plugin.
163
- */
164
- reqHeaders?: Headers | undefined;
85
+ interface ResponseHeadersPluginContext {
86
+ resHeaders?: Headers;
165
87
  }
166
88
  /**
167
- * The Request Headers Plugin injects a `reqHeaders` instance into the context,
168
- * allowing access to request headers in oRPC.
89
+ * The Response Headers Plugin allows you to set response headers in oRPC.
90
+ * It injects a resHeaders instance into the context, enabling you to modify response headers easily.
169
91
  *
170
- * @see {@link https://orpc.dev/docs/plugins/request-headers Request Headers Plugin Docs}
92
+ * @see {@link https://orpc.dev/docs/plugins/response-headers Response Headers Plugin Docs}
171
93
  */
172
- declare class RequestHeadersHandlerPlugin<T extends RequestHeadersHandlerPluginContext> implements StandardHandlerPlugin<T> {
173
- name: string;
174
- init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
94
+ declare class ResponseHeadersPlugin<T extends ResponseHeadersPluginContext> implements StandardHandlerPlugin<T> {
95
+ init(options: StandardHandlerOptions<T>): void;
175
96
  }
176
97
 
177
- interface RequestLimitHandlerPluginOptions {
98
+ interface experimental_RethrowHandlerPluginOptions<T extends Context> {
178
99
  /**
179
- * The maximum allowed request body size in bytes.
100
+ * Decide which errors should be rethrown.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const rethrowPlugin = new RethrowHandlerPlugin({
105
+ * filter: (error) => {
106
+ * // Rethrow all non-ORPCError errors
107
+ * return !(error instanceof ORPCError)
108
+ * }
109
+ * })
110
+ * ```
180
111
  */
181
- maxBodySize: number;
112
+ filter: Value<boolean, [error: ThrowableError, options: StandardHandlerInterceptorOptions<T>]>;
182
113
  }
183
114
  /**
184
- * Rejects requests whose body exceeds `maxBodySize`.
115
+ * The plugin allows you to catch and rethrow specific errors that occur during request handling.
116
+ * This is particularly useful when your framework has its own error handling mechanism
117
+ * (e.g., global exception filters in NestJS, error middleware in Express)
118
+ * and you want certain errors to be processed by that mechanism instead of being handled by the
119
+ * oRPC error handling flow.
185
120
  *
186
- * When used with the request compression plugin, the limit applies to the
187
- * decompressed payload rather than the compressed wire size.
188
- *
189
- * @see {@link https://orpc.dev/docs/plugins/request-limit Request Limit Plugin Docs}
121
+ * @see {@link https://orpc.dev/docs/plugins/rethrow-handler Rethrow Handler Plugin Docs}
190
122
  */
191
- declare class RequestLimitHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
192
- name: string;
193
- /**
194
- * Should limit the original batch request body instead of sub-requests.
195
- */
196
- after: string[];
197
- /**
198
- * Should limit the final body size instead of the compressed one.
199
- */
200
- before: string[];
201
- private readonly maxBodySize;
202
- constructor(options: RequestLimitHandlerPluginOptions);
203
- init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
123
+ declare class experimental_RethrowHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
124
+ private readonly filter;
125
+ CONTEXT_SYMBOL: symbol;
126
+ constructor(options: experimental_RethrowHandlerPluginOptions<T>);
127
+ init(options: StandardHandlerOptions<T>): void;
204
128
  }
205
129
 
206
- interface ResponseCompressionHandlerPluginOptions<_T extends Context> {
130
+ interface SimpleCsrfProtectionHandlerPluginOptions<T extends Context> {
207
131
  /**
208
- * The compression schemes to use for response compression.
209
- * Schemes are prioritized by their order in this array and
210
- * only applied if the client supports them (via Accept-Encoding).
132
+ * The name of the header to check.
211
133
  *
212
- * @default ['gzip', 'deflate']
134
+ * @default 'x-csrf-token'
213
135
  */
214
- encodings?: readonly ('gzip' | 'deflate' | 'deflate-raw')[];
136
+ headerName?: Value<Promisable<string>, [options: StandardHandlerInterceptorOptions<T>]>;
215
137
  /**
216
- * The minimum response size in bytes required to trigger compression.
217
- * Responses smaller than this threshold will not be compressed to avoid overhead.
218
- * If the response size cannot be determined, compression will still be applied.
138
+ * The value of the header to check.
139
+ *
140
+ * @default 'orpc'
219
141
  *
220
- * @default 1024 (1KB)
221
142
  */
222
- threshold?: number;
223
- }
224
- /**
225
- * Compresses response bodies based on the client's Accept-Encoding header.
226
- * Works at the standard handler level, so it supports all adapters.
227
- *
228
- * @see {@link https://orpc.dev/docs/plugins/response-compression Response Compression Plugin Docs}
229
- */
230
- declare class ResponseCompressionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
231
- name: string;
143
+ headerValue?: Value<Promisable<string>, [options: StandardHandlerInterceptorOptions<T>]>;
232
144
  /**
233
- * Compression should be done after batching, to compress the final response.
234
- * Compression should also be done after response headers are set, to access final headers like Content-Type and Cache-Control.
145
+ * Exclude a procedure from the plugin.
146
+ *
147
+ * @default false
148
+ *
235
149
  */
236
- after: string[];
237
- private readonly encodings;
238
- private readonly threshold;
239
- constructor(options?: ResponseCompressionHandlerPluginOptions<T>);
240
- init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
241
- }
242
-
243
- interface ResponseHeadersHandlerPluginContext {
150
+ exclude?: Value<Promisable<boolean>, [options: ProcedureClientInterceptorOptions<T, Record<never, never>, Meta>]>;
244
151
  /**
245
- * Response headers as a Headers instance. This is injected by the Response Headers Plugin.
246
- * When set before the response is sent, these headers will be included in the response. If not set, no additional headers will be added.
152
+ * The error thrown when the CSRF token is invalid.
153
+ *
154
+ * @default new ORPCError('CSRF_TOKEN_MISMATCH', {
155
+ * status: 403,
156
+ * message: 'Invalid CSRF token',
157
+ * })
247
158
  */
248
- resHeaders?: Headers | undefined;
159
+ error?: InstanceType<typeof ORPCError>;
249
160
  }
250
161
  /**
251
- * The Response Headers Plugin allows you to set response headers in oRPC.
252
- * It injects a resHeaders instance into the context, enabling you to modify response headers easily.
162
+ * This plugin adds basic Cross-Site Request Forgery (CSRF) protection to your oRPC application.
163
+ * It helps ensure that requests to your procedures originate from JavaScript code,
164
+ * not from other sources like standard HTML forms or direct browser navigation.
253
165
  *
254
- * @see {@link https://orpc.dev/docs/plugins/response-headers Response Headers Plugin Docs}
166
+ * @see {@link https://orpc.dev/docs/plugins/simple-csrf-protection Simple CSRF Protection Plugin Docs}
255
167
  */
256
- declare class ResponseHeadersHandlerPlugin<T extends ResponseHeadersHandlerPluginContext> implements StandardHandlerPlugin<T> {
257
- name: string;
258
- /**
259
- * Interceptors should run after batch interceptors so headers are applied to each sub-response.
260
- */
261
- before: string[];
262
- init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
168
+ declare class SimpleCsrfProtectionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
169
+ private readonly headerName;
170
+ private readonly headerValue;
171
+ private readonly exclude;
172
+ private readonly error;
173
+ constructor(options?: SimpleCsrfProtectionHandlerPluginOptions<T>);
174
+ order: number;
175
+ init(options: StandardHandlerOptions<T>): void;
263
176
  }
264
177
 
265
- interface RethrowHandlerPluginOptions<T extends Context> {
178
+ interface StrictGetMethodPluginOptions {
266
179
  /**
267
- * Decide which errors should be rethrown.
180
+ * The error thrown when a GET request is made to a procedure that doesn't allow GET.
268
181
  *
269
- * @example
270
- * ```ts
271
- * const rethrowPlugin = new RethrowHandlerPlugin({
272
- * filter: (error) => {
273
- * // Rethrow all non-ORPCError errors
274
- * return !(error instanceof ORPCError)
275
- * }
276
- * })
277
- * ```
182
+ * @default new ORPCError('METHOD_NOT_SUPPORTED')
278
183
  */
279
- filter: (error: ThrowableError, options: StandardHandlerInterceptorOptions<T>) => boolean;
184
+ error?: InstanceType<typeof ORPCError$1>;
280
185
  }
281
186
  /**
282
- * The plugin can bypass oRPC's built-in error handling
283
- * and rethrow matching errors directly to your framework's error handling mechanism
284
- * (e.g., NestJS exception filters, Express error middleware).
187
+ * This plugin enhances security by ensuring only procedures explicitly marked to accept GET requests
188
+ * can be called using the HTTP GET method for RPC Protocol. This helps prevent certain types of
189
+ * Cross-Site Request Forgery (CSRF) attacks.
285
190
  *
286
- * @see {@link https://orpc.dev/docs/plugins/rethrow Rethrow Plugin Documentation}
191
+ * @see {@link https://orpc.dev/docs/plugins/strict-get-method Strict Get Method Plugin Docs}
287
192
  */
288
- declare class RethrowHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
289
- name: string;
290
- private readonly filter;
291
- private readonly CONTEXT_SYMBOL;
292
- constructor(options: RethrowHandlerPluginOptions<T>);
293
- init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
193
+ declare class StrictGetMethodPlugin<T extends Context> implements StandardHandlerPlugin<T> {
194
+ private readonly error;
195
+ /**
196
+ * make sure execute before batch plugin to get real method
197
+ */
198
+ order: number;
199
+ constructor(options?: StrictGetMethodPluginOptions);
200
+ init(options: StandardHandlerOptions<T>): void;
294
201
  }
295
202
 
296
- export { BatchHandlerPlugin, CORSHandlerPlugin, CSRFGuardHandlerPlugin, RequestCompressionHandlerPlugin, RequestHeadersHandlerPlugin, RequestLimitHandlerPlugin, ResponseCompressionHandlerPlugin, ResponseHeadersHandlerPlugin, RethrowHandlerPlugin };
297
- export type { BatchHandlerPluginOptions, CORSHandlerPluginOptions, RequestHeadersHandlerPluginContext, RequestLimitHandlerPluginOptions, ResponseCompressionHandlerPluginOptions, ResponseHeadersHandlerPluginContext, RethrowHandlerPluginOptions };
203
+ export { BatchHandlerPlugin, CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin, StrictGetMethodPlugin, experimental_RethrowHandlerPlugin };
204
+ export type { BatchHandlerOptions, CORSOptions, RequestHeadersPluginContext, ResponseHeadersPluginContext, SimpleCsrfProtectionHandlerPluginOptions, StrictGetMethodPluginOptions, experimental_RethrowHandlerPluginOptions };