UNPKG

apitally

Version:

Simple API monitoring & analytics for REST APIs built with Express, Fastify, NestJS, AdonisJS, Hono, H3, Elysia, Hapi, and Koa.

31 lines (27 loc) 1.15 kB
import { ApitallyConsumer, ApitallyConfig } from '../common/types.cjs'; import { FastifyError, FastifyPluginAsync, FastifyRequest } from 'fastify'; import { AsyncResource } from 'node:async_hooks'; import { LogRecord } from '../common/requestLogger.cjs'; import '../common/logging.cjs'; import 'winston'; import 'node:buffer'; import 'node:http'; import '../common/tempGzipFile.cjs'; declare const LOGS_SYMBOL: unique symbol; declare const ASYNC_RESOURCE_SYMBOL: unique symbol; declare module "fastify" { interface FastifyReply { payload: any; serverError?: FastifyError; } interface FastifyRequest { apitallyConsumer?: ApitallyConsumer | string | null; consumerIdentifier?: ApitallyConsumer | string | null; [LOGS_SYMBOL]?: LogRecord[]; [ASYNC_RESOURCE_SYMBOL]?: AsyncResource; } } declare const apitallyPlugin: FastifyPluginAsync<ApitallyConfig>; declare function setConsumer(request: FastifyRequest, consumer: ApitallyConsumer | string | null | undefined): void; declare const _default: FastifyPluginAsync<ApitallyConfig>; export { apitallyPlugin, _default as default, setConsumer };