@orpc/server 2.0.0-beta.26 → 2.0.0-beta.28

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 (41) hide show
  1. package/README.md +38 -76
  2. package/dist/adapters/aws-lambda/index.d.mts +4 -4
  3. package/dist/adapters/aws-lambda/index.d.ts +4 -4
  4. package/dist/adapters/aws-lambda/index.mjs +3 -3
  5. package/dist/adapters/crossws/index.d.mts +4 -4
  6. package/dist/adapters/crossws/index.d.ts +4 -4
  7. package/dist/adapters/crossws/index.mjs +3 -3
  8. package/dist/adapters/fastify/index.d.mts +4 -4
  9. package/dist/adapters/fastify/index.d.ts +4 -4
  10. package/dist/adapters/fastify/index.mjs +3 -3
  11. package/dist/adapters/fetch/index.d.mts +4 -4
  12. package/dist/adapters/fetch/index.d.ts +4 -4
  13. package/dist/adapters/fetch/index.mjs +3 -3
  14. package/dist/adapters/message-port/index.d.mts +4 -4
  15. package/dist/adapters/message-port/index.d.ts +4 -4
  16. package/dist/adapters/message-port/index.mjs +3 -3
  17. package/dist/adapters/node/index.d.mts +4 -4
  18. package/dist/adapters/node/index.d.ts +4 -4
  19. package/dist/adapters/node/index.mjs +3 -3
  20. package/dist/adapters/standard/index.d.mts +2 -2
  21. package/dist/adapters/standard/index.d.ts +2 -2
  22. package/dist/adapters/standard/index.mjs +3 -3
  23. package/dist/adapters/standard-peer/index.d.mts +2 -2
  24. package/dist/adapters/standard-peer/index.d.ts +2 -2
  25. package/dist/adapters/websocket/index.d.mts +4 -4
  26. package/dist/adapters/websocket/index.d.ts +4 -4
  27. package/dist/adapters/websocket/index.mjs +3 -3
  28. package/dist/extensions/callable.d.mts +1 -1
  29. package/dist/extensions/callable.d.ts +1 -1
  30. package/dist/extensions/callable.mjs +2 -2
  31. package/dist/index.d.mts +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.mjs +5 -5
  34. package/dist/plugins/index.d.mts +57 -17
  35. package/dist/plugins/index.d.ts +57 -17
  36. package/dist/plugins/index.mjs +114 -43
  37. package/dist/shared/{server.7T18Khvf.mjs → server.CkButhNT.mjs} +7 -2
  38. package/dist/shared/{server.Cbv46U7N.mjs → server.D9VprDph.mjs} +2 -2
  39. package/dist/shared/{server.DgunZU0v.mjs → server.Dh77P3ii.mjs} +1 -1
  40. package/dist/shared/{server.B2pXdfpL.mjs → server.eCTV8Vpp.mjs} +1 -1
  41. package/package.json +11 -11
@@ -1,8 +1,8 @@
1
- export { C as CompositeStandardHandlerPlugin, O as OtelHandlerPlugin, R as RPCHandlerCodec, a as RPCMatcher, b as RPC_DEFAULT_ALLOW_METHODS, S as StandardHandler } from '../../shared/server.Cbv46U7N.mjs';
1
+ export { C as CompositeStandardHandlerPlugin, O as OtelHandlerPlugin, R as RPCHandlerCodec, a as RPCMatcher, b as RPC_DEFAULT_ALLOW_METHODS, S as StandardHandler } from '../../shared/server.D9VprDph.mjs';
2
2
  export { r as resolveFriendlyStandardHandlerHandleOptions } from '../../shared/server.W91HSRkE.mjs';
3
3
  import '@orpc/client';
4
4
  import '@orpc/shared';
5
5
  import '@standardserver/core';
6
- import '../../shared/server.7T18Khvf.mjs';
6
+ import '../../shared/server.CkButhNT.mjs';
7
7
  import '@orpc/contract';
8
- import '../../shared/server.DgunZU0v.mjs';
8
+ import '../../shared/server.Dh77P3ii.mjs';
@@ -1,7 +1,7 @@
1
1
  import { Value, Promisable } from '@orpc/shared';
2
2
  import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
3
- import { C as Context } from '../../shared/server.CwrYlF72.mjs';
4
- import { c as StandardHandlerHandleOptions, b as StandardHandler } from '../../shared/server.JbCIPL4P.mjs';
3
+ import { Context } from '../../index.mjs';
4
+ import { StandardHandlerHandleOptions, StandardHandler } from '../standard/index.mjs';
5
5
  import '@orpc/client';
6
6
  import '@orpc/contract';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { Value, Promisable } from '@orpc/shared';
2
2
  import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
3
- import { C as Context } from '../../shared/server.CwrYlF72.js';
4
- import { c as StandardHandlerHandleOptions, b as StandardHandler } from '../../shared/server.DrN1Pj1-.js';
3
+ import { Context } from '../../index.js';
4
+ import { StandardHandlerHandleOptions, StandardHandler } from '../standard/index.js';
5
5
  import '@orpc/client';
6
6
  import '@orpc/contract';
7
7
 
@@ -1,10 +1,10 @@
1
1
  import { Arrayable, MaybeOptionalOptions } from '@orpc/shared';
2
2
  import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
3
- import { C as Context } from '../../shared/server.CwrYlF72.mjs';
4
- import { b as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.JbCIPL4P.mjs';
3
+ import { Context } from '../../index.mjs';
4
+ import { StandardHandler, StandardHandlerOptions } from '../standard/index.mjs';
5
5
  import { StandardPeerRequestHandlerOptions } from '../standard-peer/index.mjs';
6
- import { R as Router } from '../../shared/server.Dm0os-OP.mjs';
7
- import { R as RPCHandlerCodecOptions } from '../../shared/server.CkNnZ5F-.mjs';
6
+ import { Router } from '../../index.mjs';
7
+ import { RPCHandlerCodecOptions } from '../standard/index.mjs';
8
8
  import '@orpc/client';
9
9
  import '@orpc/contract';
10
10
  import '@standardserver/core';
@@ -1,10 +1,10 @@
1
1
  import { Arrayable, MaybeOptionalOptions } from '@orpc/shared';
2
2
  import { EncodePeerMessageOptions, DecodePeerMessageOptions } from '@standardserver/peer';
3
- import { C as Context } from '../../shared/server.CwrYlF72.js';
4
- import { b as StandardHandler, a as StandardHandlerOptions } from '../../shared/server.DrN1Pj1-.js';
3
+ import { Context } from '../../index.js';
4
+ import { StandardHandler, StandardHandlerOptions } from '../standard/index.js';
5
5
  import { StandardPeerRequestHandlerOptions } from '../standard-peer/index.js';
6
- import { R as Router } from '../../shared/server.DtfwuV6U.js';
7
- import { R as RPCHandlerCodecOptions } from '../../shared/server.C2n16pp0.js';
6
+ import { Router } from '../../index.js';
7
+ import { RPCHandlerCodecOptions } from '../standard/index.js';
8
8
  import '@orpc/client';
9
9
  import '@orpc/contract';
10
10
  import '@standardserver/core';
@@ -1,12 +1,12 @@
1
1
  import { toStringOrBytes, resolveMaybeOptionalOptions, sequential, loadBytes } from '@orpc/shared';
2
2
  import { ServerPeer, encodePeerMessage, decodePeerMessage, isClientPeerSendMessage } from '@standardserver/peer';
3
3
  import { c as createStandardPeerRequestHandler } from '../../shared/server.CX4vUnDk.mjs';
4
- import { R as RPCHandlerCodec, S as StandardHandler } from '../../shared/server.Cbv46U7N.mjs';
4
+ import { R as RPCHandlerCodec, S as StandardHandler } from '../../shared/server.D9VprDph.mjs';
5
5
  import '@orpc/client';
6
6
  import '@standardserver/core';
7
- import '../../shared/server.7T18Khvf.mjs';
7
+ import '../../shared/server.CkButhNT.mjs';
8
8
  import '@orpc/contract';
9
- import '../../shared/server.DgunZU0v.mjs';
9
+ import '../../shared/server.Dh77P3ii.mjs';
10
10
 
11
11
  class WebSocketHandler {
12
12
  constructor(handler, options = {}) {
@@ -1,7 +1,7 @@
1
1
  import { AnyORPCError, ClientContext } from '@orpc/client';
2
2
  import { AnySchema, ErrorMap } from '@orpc/contract';
3
3
  import { MaybeOptionalOptions } from '@orpc/shared';
4
- import { C as Context, P as ProcedureClientOptions, a as Procedure, b as ProcedureClient } from '../shared/server.CwrYlF72.mjs';
4
+ import { Context, ProcedureClientOptions, Procedure, ProcedureClient } from '../index.mjs';
5
5
 
6
6
  declare module '@orpc/server' {
7
7
  interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> {
@@ -1,7 +1,7 @@
1
1
  import { AnyORPCError, ClientContext } from '@orpc/client';
2
2
  import { AnySchema, ErrorMap } from '@orpc/contract';
3
3
  import { MaybeOptionalOptions } from '@orpc/shared';
4
- import { C as Context, P as ProcedureClientOptions, a as Procedure, b as ProcedureClient } from '../shared/server.CwrYlF72.js';
4
+ import { Context, ProcedureClientOptions, Procedure, ProcedureClient } from '../index.js';
5
5
 
6
6
  declare module '@orpc/server' {
7
7
  interface DecoratedProcedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> {
@@ -1,5 +1,5 @@
1
- import { c as createProcedureClient } from '../shared/server.7T18Khvf.mjs';
2
- import { D as DecoratedProcedure } from '../shared/server.B2pXdfpL.mjs';
1
+ import { c as createProcedureClient } from '../shared/server.CkButhNT.mjs';
2
+ import { D as DecoratedProcedure } from '../shared/server.eCTV8Vpp.mjs';
3
3
  import '@orpc/client';
4
4
  import '@orpc/contract';
5
5
  import '@orpc/shared';
package/dist/index.d.mts CHANGED
@@ -8,7 +8,7 @@ import { C as Context, d as Middleware, M as MergedContext, e as MergedInitialCo
8
8
  export { j as LazyDefinition, k as MiddlewareDefinition, l as MiddlewareDone, m as MiddlewareDoneOptions, n as MiddlewareNext, o as MiddlewareNextOptions, p as MiddlewareOptions, q as MiddlewareResult, c as ProcedureClientInterceptor, r as ProcedureClientInterceptorOptions, s as ProcedureDefinition, t as ProcedureHandlerOptions, u as createProcedureClient, v as unlazy } from './shared/server.CwrYlF72.mjs';
9
9
  import { A as AnyRouter, R as Router, C as ContractedRouter, I as InferRouterInitialContext } from './shared/server.Dm0os-OP.mjs';
10
10
  export { a as InferRouterCurrentContexts, b as InferRouterError, c as InferRouterErrors, a as InferRouterFinalContexts, d as InferRouterInitialContexts, e as InferRouterInputs, f as InferRouterOutputs } from './shared/server.Dm0os-OP.mjs';
11
- export { ErrorEvent, EventMeta, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
11
+ export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
12
12
 
13
13
  interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorMap extends ErrorMap> extends Middleware<TInContext, TOutContext, TInput, TOutput, TErrorMap> {
14
14
  adaptInput<T>(adapt: (input: T) => TInput): DecoratedMiddleware<TInContext, TOutContext, T, TOutput, TErrorMap>;
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ import { C as Context, d as Middleware, M as MergedContext, e as MergedInitialCo
8
8
  export { j as LazyDefinition, k as MiddlewareDefinition, l as MiddlewareDone, m as MiddlewareDoneOptions, n as MiddlewareNext, o as MiddlewareNextOptions, p as MiddlewareOptions, q as MiddlewareResult, c as ProcedureClientInterceptor, r as ProcedureClientInterceptorOptions, s as ProcedureDefinition, t as ProcedureHandlerOptions, u as createProcedureClient, v as unlazy } from './shared/server.CwrYlF72.js';
9
9
  import { A as AnyRouter, R as Router, C as ContractedRouter, I as InferRouterInitialContext } from './shared/server.DtfwuV6U.js';
10
10
  export { a as InferRouterCurrentContexts, b as InferRouterError, c as InferRouterErrors, a as InferRouterFinalContexts, d as InferRouterInitialContexts, e as InferRouterInputs, f as InferRouterOutputs } from './shared/server.DtfwuV6U.js';
11
- export { ErrorEvent, EventMeta, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
11
+ export { ErrorEvent, EventMeta, StandardBody, StandardBodyHint, StandardHeaders, StandardLazyRequest, StandardLazyResponse, StandardMethod, StandardRequest, StandardResponse, StandardUrl, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
12
12
 
13
13
  interface DecoratedMiddleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorMap extends ErrorMap> extends Middleware<TInContext, TOutContext, TInput, TOutput, TErrorMap> {
14
14
  adaptInput<T>(adapt: (input: T) => TInput): DecoratedMiddleware<TInContext, TOutContext, T, TOutput, TErrorMap>;
package/dist/index.mjs CHANGED
@@ -2,11 +2,11 @@ import { mergeErrorMap, resolveMetaPlugins, getHiddenMetaPlugins, ProcedureContr
2
2
  export { ValidationError, asyncIteratorObject, defineMeta, error, eventIterator, reconcileORPCError, type } from '@orpc/contract';
3
3
  import { toArray, bindMethods, isTypescriptObject, resolveMaybeOptionalOptions } from '@orpc/shared';
4
4
  export { AsyncIteratorClass, asyncIteratorToStream, asyncIteratorToUnproxiedDataStream, asyncIteratorToStream as eventIteratorToStream, asyncIteratorToUnproxiedDataStream as eventIteratorToUnproxiedDataStream, onAsyncIteratorObjectError, onError, onFinish, onReadableStreamError, onStart, onSuccess, streamToAsyncIteratorObject, streamToAsyncIteratorObject as streamToEventIterator } from '@orpc/shared';
5
- import { L as Lazy, P as Procedure, c as createProcedureClient } from './shared/server.7T18Khvf.mjs';
6
- export { u as unlazy } from './shared/server.7T18Khvf.mjs';
7
- import { D as DecoratedProcedure } from './shared/server.B2pXdfpL.mjs';
8
- import { b as augmentRouter, d as augmentImplementedRouter, e as withHiddenRouterContract, f as createGuardedProcedureLazy, g as getRouter } from './shared/server.DgunZU0v.mjs';
9
- export { a as DEFAULT_ERROR_STATUS, D as DEFAULT_SUCCESS_STATUS, h as call, c as createContractProcedure, i as getHiddenRouterContract, u as unlazyRouter, j as walkProcedureContractsAsync, w as walkProcedureContractsSync } from './shared/server.DgunZU0v.mjs';
5
+ import { L as Lazy, P as Procedure, c as createProcedureClient } from './shared/server.CkButhNT.mjs';
6
+ export { u as unlazy } from './shared/server.CkButhNT.mjs';
7
+ import { D as DecoratedProcedure } from './shared/server.eCTV8Vpp.mjs';
8
+ import { b as augmentRouter, d as augmentImplementedRouter, e as withHiddenRouterContract, f as createGuardedProcedureLazy, g as getRouter } from './shared/server.Dh77P3ii.mjs';
9
+ export { a as DEFAULT_ERROR_STATUS, D as DEFAULT_SUCCESS_STATUS, h as call, c as createContractProcedure, i as getHiddenRouterContract, u as unlazyRouter, j as walkProcedureContractsAsync, w as walkProcedureContractsSync } from './shared/server.Dh77P3ii.mjs';
10
10
  import { RECURSIVE_CLIENT_UNWRAP_KEYS } from '@orpc/client';
11
11
  export { COMMON_ERROR_STATUS_MAP, ORPCError, RPCJsonSerializer, RPCSerializer, cloneORPCError, isDefinedError, isInferableError, safe, toORPCError } from '@orpc/client';
12
12
  export { ErrorEvent, getEventMeta, unwrapEvent, withEventMeta } from '@standardserver/core';
@@ -1,7 +1,7 @@
1
1
  import { Value, Promisable, ThrowableError } from '@orpc/shared';
2
2
  import { StandardLazyRequest, StandardHeaders, StandardMethod } from '@standardserver/core';
3
- import { C as Context } from '../shared/server.CwrYlF72.mjs';
4
- import { S as StandardHandlerPlugin, f as StandardHandlerRoutingInterceptorOptions, a as StandardHandlerOptions, g as StandardHandlerInterceptorOptions } from '../shared/server.JbCIPL4P.mjs';
3
+ import { Context } from '../index.mjs';
4
+ import { StandardHandlerPlugin, StandardHandlerRoutingInterceptorOptions, StandardHandlerOptions, StandardHandlerInterceptorOptions } from '../adapters/standard/index.mjs';
5
5
  export { R as RequestLimitHandlerPlugin, a as RequestLimitHandlerPluginOptions } from '../shared/server.D0Ipbmdv.mjs';
6
6
  import '@orpc/client';
7
7
  import '@orpc/contract';
@@ -96,18 +96,18 @@ interface CORSHandlerPluginOptions<T extends Context> {
96
96
  *
97
97
  * @default (origin) => origin
98
98
  */
99
- origin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerRoutingInterceptorOptions<T>]>;
99
+ origin?: Value<string | readonly string[] | null | undefined, [origin: string | undefined, options: StandardHandlerRoutingInterceptorOptions<T>]>;
100
100
  /**
101
101
  * Configures the `Timing-Allow-Origin` header.
102
102
  * Can be a string, an array of allowed origins, or a function that returns the allowed origin(s).
103
103
  *
104
104
  * @default undefined
105
105
  */
106
- timingOrigin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerRoutingInterceptorOptions<T>]>;
106
+ timingOrigin?: Value<string | readonly string[] | null | undefined, [origin: string | undefined, options: StandardHandlerRoutingInterceptorOptions<T>]>;
107
107
  /**
108
108
  * Configures the `Access-Control-Allow-Methods` header for preflight requests.
109
109
  *
110
- * @default ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH']
110
+ * @default ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH', 'QUERY']
111
111
  */
112
112
  allowMethods?: readonly string[];
113
113
  /**
@@ -155,6 +155,28 @@ declare class CORSHandlerPlugin<T extends Context> implements StandardHandlerPlu
155
155
  init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
156
156
  }
157
157
 
158
+ /**
159
+ * Adds Cross-Site Request Forgery (CSRF) protection that makes the safe `GET` method as
160
+ * secure as unsafe ones such as `POST`. It rejects `GET` requests arriving as top-level
161
+ * navigations initiated cross-site or from outside the browser, the only context where
162
+ * another site can make a browser attach `SameSite=Lax` cookies to a safe-method request.
163
+ *
164
+ * @remarks
165
+ * **Note**: Requests browsers send without `SameSite=Lax` cookies, such as cross-site `fetch`
166
+ * and `<img>`, pass through, so procedures stay reachable from other sites. This safeguard
167
+ * requires authentication cookies explicitly marked `SameSite=Lax` or `SameSite=Strict`,
168
+ * since browsers may attach other cookies to the requests that pass.
169
+ *
170
+ * @see {@link https://orpc.dev/docs/plugins/get-method-csrf-protection | GET Method CSRF Protection Plugin}
171
+ */
172
+ declare class GetMethodCsrfProtectionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
173
+ name: string;
174
+ /** Judge the real request, before batch splits it into client-authored sub-requests. */
175
+ after: string[];
176
+ init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
177
+ private isAllowed;
178
+ }
179
+
158
180
  interface MethodOverrideHandlerPluginOptions {
159
181
  /**
160
182
  * The query parameter carrying the override method.
@@ -323,22 +345,40 @@ declare class RethrowHandlerPlugin<T extends Context> implements StandardHandler
323
345
  init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
324
346
  }
325
347
 
348
+ interface TimeoutHandlerPluginOptions<T extends Context> {
349
+ /**
350
+ * Timeout in milliseconds before the request signal is aborted.
351
+ * This only covers producing the response, use `streamingTimeout`
352
+ * to limit streaming response bodies.
353
+ * Use `null` or `undefined` to disable the timeout.
354
+ */
355
+ timeout: Value<number | null | undefined, [options: StandardHandlerInterceptorOptions<T>]>;
356
+ /**
357
+ * Timeout in milliseconds for the full duration of a streaming response body
358
+ * (async iterator object or readable stream), measured from when the response is produced.
359
+ * When exceeded, the request signal is aborted and the body ends
360
+ * once its producer honors the signal.
361
+ * Usually higher than `timeout`.
362
+ * Use `null` or `undefined` to disable the timeout.
363
+ *
364
+ * @default undefined (streaming responses run without limit)
365
+ */
366
+ streamingTimeout?: Value<number | null | undefined, [options: StandardHandlerInterceptorOptions<T>]>;
367
+ }
326
368
  /**
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.
369
+ * The Timeout Handler Plugin aborts the request signal with an `AbortError`
370
+ * when handling exceeds a configured timeout. It only aborts the signal,
371
+ * the procedure must honor it to stop early and produce the response.
335
372
  *
336
- * @see {@link https://orpc.dev/docs/plugins/simple-csrf-protection | Simple CSRF Protection Plugin}
373
+ * @see {@link https://orpc.dev/docs/plugins/timeout | Timeout Plugin}
337
374
  */
338
- declare class SimpleCsrfProtectionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
375
+ declare class TimeoutHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
376
+ private readonly timeout;
377
+ private readonly streamingTimeout;
339
378
  name: string;
379
+ constructor(options: NoInfer<TimeoutHandlerPluginOptions<T>>);
340
380
  init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
341
381
  }
342
382
 
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 };
383
+ export { BATCH_CONTENT_TYPE, BatchHandlerPlugin, CORSHandlerPlugin, CORSHandlerPlugin as CORSPlugin, GetMethodCsrfProtectionHandlerPlugin, MethodOverrideHandlerPlugin, RequestCompressionHandlerPlugin, RequestHeadersHandlerPlugin, RequestHeadersHandlerPlugin as RequestHeadersPlugin, ResponseCompressionHandlerPlugin, ResponseHeadersHandlerPlugin, ResponseHeadersHandlerPlugin as ResponseHeadersPlugin, RethrowHandlerPlugin, TimeoutHandlerPlugin };
384
+ export type { BatchHandlerPluginOptions, CORSHandlerPluginOptions, MethodOverrideHandlerPluginOptions, RequestHeadersHandlerPluginContext, RequestHeadersHandlerPluginContext as RequestHeadersPluginContext, ResponseCompressionHandlerPluginOptions, ResponseHeadersHandlerPluginContext, ResponseHeadersHandlerPluginContext as ResponseHeadersPluginContext, RethrowHandlerPluginOptions, TimeoutHandlerPluginOptions };
@@ -1,7 +1,7 @@
1
1
  import { Value, Promisable, ThrowableError } from '@orpc/shared';
2
2
  import { StandardLazyRequest, StandardHeaders, StandardMethod } from '@standardserver/core';
3
- import { C as Context } from '../shared/server.CwrYlF72.js';
4
- import { S as StandardHandlerPlugin, f as StandardHandlerRoutingInterceptorOptions, a as StandardHandlerOptions, g as StandardHandlerInterceptorOptions } from '../shared/server.DrN1Pj1-.js';
3
+ import { Context } from '../index.js';
4
+ import { StandardHandlerPlugin, StandardHandlerRoutingInterceptorOptions, StandardHandlerOptions, StandardHandlerInterceptorOptions } from '../adapters/standard/index.js';
5
5
  export { R as RequestLimitHandlerPlugin, a as RequestLimitHandlerPluginOptions } from '../shared/server.BhHrioCw.js';
6
6
  import '@orpc/client';
7
7
  import '@orpc/contract';
@@ -96,18 +96,18 @@ interface CORSHandlerPluginOptions<T extends Context> {
96
96
  *
97
97
  * @default (origin) => origin
98
98
  */
99
- origin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerRoutingInterceptorOptions<T>]>;
99
+ origin?: Value<string | readonly string[] | null | undefined, [origin: string | undefined, options: StandardHandlerRoutingInterceptorOptions<T>]>;
100
100
  /**
101
101
  * Configures the `Timing-Allow-Origin` header.
102
102
  * Can be a string, an array of allowed origins, or a function that returns the allowed origin(s).
103
103
  *
104
104
  * @default undefined
105
105
  */
106
- timingOrigin?: Value<Promisable<string | readonly string[] | null | undefined>, [origin: string, options: StandardHandlerRoutingInterceptorOptions<T>]>;
106
+ timingOrigin?: Value<string | readonly string[] | null | undefined, [origin: string | undefined, options: StandardHandlerRoutingInterceptorOptions<T>]>;
107
107
  /**
108
108
  * Configures the `Access-Control-Allow-Methods` header for preflight requests.
109
109
  *
110
- * @default ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH']
110
+ * @default ['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH', 'QUERY']
111
111
  */
112
112
  allowMethods?: readonly string[];
113
113
  /**
@@ -155,6 +155,28 @@ declare class CORSHandlerPlugin<T extends Context> implements StandardHandlerPlu
155
155
  init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
156
156
  }
157
157
 
158
+ /**
159
+ * Adds Cross-Site Request Forgery (CSRF) protection that makes the safe `GET` method as
160
+ * secure as unsafe ones such as `POST`. It rejects `GET` requests arriving as top-level
161
+ * navigations initiated cross-site or from outside the browser, the only context where
162
+ * another site can make a browser attach `SameSite=Lax` cookies to a safe-method request.
163
+ *
164
+ * @remarks
165
+ * **Note**: Requests browsers send without `SameSite=Lax` cookies, such as cross-site `fetch`
166
+ * and `<img>`, pass through, so procedures stay reachable from other sites. This safeguard
167
+ * requires authentication cookies explicitly marked `SameSite=Lax` or `SameSite=Strict`,
168
+ * since browsers may attach other cookies to the requests that pass.
169
+ *
170
+ * @see {@link https://orpc.dev/docs/plugins/get-method-csrf-protection | GET Method CSRF Protection Plugin}
171
+ */
172
+ declare class GetMethodCsrfProtectionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
173
+ name: string;
174
+ /** Judge the real request, before batch splits it into client-authored sub-requests. */
175
+ after: string[];
176
+ init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
177
+ private isAllowed;
178
+ }
179
+
158
180
  interface MethodOverrideHandlerPluginOptions {
159
181
  /**
160
182
  * The query parameter carrying the override method.
@@ -323,22 +345,40 @@ declare class RethrowHandlerPlugin<T extends Context> implements StandardHandler
323
345
  init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
324
346
  }
325
347
 
348
+ interface TimeoutHandlerPluginOptions<T extends Context> {
349
+ /**
350
+ * Timeout in milliseconds before the request signal is aborted.
351
+ * This only covers producing the response, use `streamingTimeout`
352
+ * to limit streaming response bodies.
353
+ * Use `null` or `undefined` to disable the timeout.
354
+ */
355
+ timeout: Value<number | null | undefined, [options: StandardHandlerInterceptorOptions<T>]>;
356
+ /**
357
+ * Timeout in milliseconds for the full duration of a streaming response body
358
+ * (async iterator object or readable stream), measured from when the response is produced.
359
+ * When exceeded, the request signal is aborted and the body ends
360
+ * once its producer honors the signal.
361
+ * Usually higher than `timeout`.
362
+ * Use `null` or `undefined` to disable the timeout.
363
+ *
364
+ * @default undefined (streaming responses run without limit)
365
+ */
366
+ streamingTimeout?: Value<number | null | undefined, [options: StandardHandlerInterceptorOptions<T>]>;
367
+ }
326
368
  /**
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.
369
+ * The Timeout Handler Plugin aborts the request signal with an `AbortError`
370
+ * when handling exceeds a configured timeout. It only aborts the signal,
371
+ * the procedure must honor it to stop early and produce the response.
335
372
  *
336
- * @see {@link https://orpc.dev/docs/plugins/simple-csrf-protection | Simple CSRF Protection Plugin}
373
+ * @see {@link https://orpc.dev/docs/plugins/timeout | Timeout Plugin}
337
374
  */
338
- declare class SimpleCsrfProtectionHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
375
+ declare class TimeoutHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
376
+ private readonly timeout;
377
+ private readonly streamingTimeout;
339
378
  name: string;
379
+ constructor(options: NoInfer<TimeoutHandlerPluginOptions<T>>);
340
380
  init(options: StandardHandlerOptions<T>): StandardHandlerOptions<T>;
341
381
  }
342
382
 
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 };
383
+ export { BATCH_CONTENT_TYPE, BatchHandlerPlugin, CORSHandlerPlugin, CORSHandlerPlugin as CORSPlugin, GetMethodCsrfProtectionHandlerPlugin, MethodOverrideHandlerPlugin, RequestCompressionHandlerPlugin, RequestHeadersHandlerPlugin, RequestHeadersHandlerPlugin as RequestHeadersPlugin, ResponseCompressionHandlerPlugin, ResponseHeadersHandlerPlugin, ResponseHeadersHandlerPlugin as ResponseHeadersPlugin, RethrowHandlerPlugin, TimeoutHandlerPlugin };
384
+ export type { BatchHandlerPluginOptions, CORSHandlerPluginOptions, MethodOverrideHandlerPluginOptions, RequestHeadersHandlerPluginContext, RequestHeadersHandlerPluginContext as RequestHeadersPluginContext, ResponseCompressionHandlerPluginOptions, ResponseHeadersHandlerPluginContext, ResponseHeadersHandlerPluginContext as ResponseHeadersPluginContext, RethrowHandlerPluginOptions, TimeoutHandlerPluginOptions };