apitally
Version:
Simple API monitoring & analytics for REST APIs built with Express, Fastify, NestJS, AdonisJS, Hono, H3, Elysia, Hapi, and Koa.
37 lines (34 loc) • 1.32 kB
text/typescript
import { ApitallyConsumer, ApitallyConfig } from '../common/types.cjs';
import { Server, Request } from '@hapi/hapi';
import { LogRecord } from '../common/requestLogger.cjs';
import '../common/logging.cjs';
import 'winston';
import 'node:buffer';
import 'node:http';
import '../common/tempGzipFile.cjs';
declare const START_TIME_SYMBOL: unique symbol;
declare const REQUEST_BODY_SYMBOL: unique symbol;
declare const REQUEST_SIZE_SYMBOL: unique symbol;
declare const RESPONSE_BODY_SYMBOL: unique symbol;
declare const RESPONSE_SIZE_SYMBOL: unique symbol;
declare const LOGS_SYMBOL: unique symbol;
declare module "@hapi/hapi" {
interface Request {
[START_TIME_SYMBOL]?: number;
[REQUEST_BODY_SYMBOL]?: Buffer;
[REQUEST_SIZE_SYMBOL]?: number;
[RESPONSE_BODY_SYMBOL]?: Buffer;
[RESPONSE_SIZE_SYMBOL]?: number;
[LOGS_SYMBOL]?: LogRecord[];
apitallyConsumer?: ApitallyConsumer | string;
}
interface ResponseObject {
readonly contentType: string | null;
}
}
declare function apitallyPlugin(config: ApitallyConfig): {
name: string;
register: (server: Server) => Promise<void>;
};
declare function setConsumer(request: Request, consumer: ApitallyConsumer | string | null | undefined): void;
export { apitallyPlugin as default, setConsumer };