Pass request _meta to request handlers extra param
This commit is contained in:
parent
1317767645
commit
75eb1c431a
1 changed files with 18 additions and 10 deletions
|
|
@ -21,6 +21,7 @@ import {
|
|||
RequestId,
|
||||
Result,
|
||||
ServerCapabilities,
|
||||
RequestMeta,
|
||||
} from "../types.js";
|
||||
import { Transport, TransportSendOptions } from "./transport.js";
|
||||
import { AuthInfo } from "../server/auth/types.js";
|
||||
|
|
@ -115,6 +116,11 @@ export type RequestHandlerExtra<SendRequestT extends Request,
|
|||
*/
|
||||
sessionId?: string;
|
||||
|
||||
/**
|
||||
* Metadata from the original request.
|
||||
*/
|
||||
_meta?: RequestMeta;
|
||||
|
||||
/**
|
||||
* The JSON-RPC ID of the request being handled.
|
||||
* This can be useful for tracking or logging purposes.
|
||||
|
|
@ -361,6 +367,7 @@ export abstract class Protocol<
|
|||
const fullExtra: RequestHandlerExtra<SendRequestT, SendNotificationT> = {
|
||||
signal: abortController.signal,
|
||||
sessionId: this._transport?.sessionId,
|
||||
_meta: request.params?._meta,
|
||||
sendNotification:
|
||||
(notification) =>
|
||||
this.notification(notification, { relatedRequestId: request.id }),
|
||||
|
|
|
|||
Loading…
Reference in a new issue