UNPKG

apitally

Version:

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

28 lines (25 loc) 1.01 kB
import { ApitallyConsumer, ApitallyConfig } from '../common/types.js'; import * as h3 from 'h3'; import { H3Event } from 'h3'; import { SpanHandle } from '../common/spanCollector.js'; import '../common/logging.js'; import 'winston'; import '../common/requestLogger.js'; import 'node:buffer'; import 'node:http'; import '../common/tempGzipFile.js'; import '@opentelemetry/sdk-trace-base'; declare const REQUEST_TIMESTAMP_SYMBOL: unique symbol; declare const REQUEST_BODY_SYMBOL: unique symbol; declare const SPAN_HANDLE_SYMBOL: unique symbol; declare module "h3" { interface H3EventContext { apitallyConsumer?: ApitallyConsumer | string; [REQUEST_TIMESTAMP_SYMBOL]?: number; [REQUEST_BODY_SYMBOL]?: Buffer; [SPAN_HANDLE_SYMBOL]?: SpanHandle; } } declare const apitallyPlugin: (options: ApitallyConfig) => h3.H3Plugin; declare function setConsumer(event: H3Event, consumer: ApitallyConsumer | string | null | undefined): void; export { apitallyPlugin, setConsumer };