diff --git a/packages/node/src/integrations/tracing/hapi/index.ts b/packages/node/src/integrations/tracing/hapi/index.ts index 2d951142275e..1303464c5374 100644 --- a/packages/node/src/integrations/tracing/hapi/index.ts +++ b/packages/node/src/integrations/tracing/hapi/index.ts @@ -15,7 +15,7 @@ import { logger } from '@sentry/utils'; import { DEBUG_BUILD } from '../../../debug-build'; import { generateInstrumentOnce } from '../../../otel/instrument'; import { ensureIsWrapped } from '../../../utils/ensureIsWrapped'; -import type { RequestEvent, Server } from './types'; +import type { Request, RequestEvent, Server } from './types'; const INTEGRATION_NAME = 'Hapi'; @@ -61,7 +61,7 @@ export const hapiErrorPlugin = { register: async function (serverArg: Record) { const server = serverArg as unknown as Server; - server.events.on('request', (request, event) => { + server.events.on('request', (request: Request, event: RequestEvent) => { if (getIsolationScope() !== getDefaultIsolationScope()) { const route = request.route; if (route && route.path) { diff --git a/packages/node/src/integrations/tracing/hapi/types.ts b/packages/node/src/integrations/tracing/hapi/types.ts index 4da83f672076..db3404499148 100644 --- a/packages/node/src/integrations/tracing/hapi/types.ts +++ b/packages/node/src/integrations/tracing/hapi/types.ts @@ -103,38 +103,6 @@ export interface Listener { export type Tags = { [tag: string]: boolean }; -type Dependencies = - | string - | string[] - | { - [key: string]: string; - }; - -interface PluginNameVersion { - name: string; - version?: string | undefined; -} - -interface PluginPackage { - pkg: any; -} - -interface PluginBase { - register: (server: Server, options: T) => void | Promise; - multiple?: boolean | undefined; - dependencies?: Dependencies | undefined; - requirements?: - | { - node?: string | undefined; - hapi?: string | undefined; - } - | undefined; - - once?: boolean | undefined; -} - -type Plugin = PluginBase & (PluginNameVersion | PluginPackage); - interface UserCredentials {} interface AppCredentials {} @@ -205,7 +173,7 @@ interface RequestRoute { }; } -interface Request extends Podium { +export interface Request extends Podium { app: ApplicationState; readonly auth: RequestAuth; events: RequestEvents; @@ -232,16 +200,6 @@ interface ResponseToolkit { readonly continue: symbol; } -interface ServerEventCriteria { - name: T; - channels?: string | string[] | undefined; - clone?: boolean | undefined; - count?: number | undefined; - filter?: string | string[] | { tags: string | string[]; all?: boolean | undefined } | undefined; - spread?: boolean | undefined; - tags?: boolean | undefined; -} - export interface RequestEvent { timestamp: string; tags: string[]; @@ -250,26 +208,15 @@ export interface RequestEvent { error: object; } -type RequestEventHandler = (request: Request, event: RequestEvent, tags: { [key: string]: true }) => void; interface ServerEvents { - on(criteria: 'request' | ServerEventCriteria<'request'>, listener: RequestEventHandler): void; + on(criteria: any, listener: any): void; } -type RouteRequestExtType = - | 'onPreAuth' - | 'onCredentials' - | 'onPostAuth' - | 'onPreHandler' - | 'onPostHandler' - | 'onPreResponse'; - -type ServerRequestExtType = RouteRequestExtType | 'onRequest'; - export type Server = Record & { events: ServerEvents; - ext(event: ServerRequestExtType, method: Lifecycle.Method, options?: Record): void; + register: any; + ext(event: any, method: Lifecycle.Method, options?: Record): void; initialize(): Promise; - register(plugins: Plugin | Array>, options?: Record): Promise; start(): Promise; };