apitally
Version:
Simple API monitoring & analytics for REST APIs built with Express, Fastify, NestJS, AdonisJS, Hono, H3, Elysia, Hapi, and Koa.
67 lines (64 loc) • 1.8 kB
TypeScript
import { ApitallyConfig, ApitallyConsumer } from '../common/types.js';
import { Elysia } from 'elysia';
import { ApitallyClient } from '../common/client.js';
import { CapturedResponse } from '../common/response.js';
import '../common/logging.js';
import 'winston';
import '../common/requestLogger.js';
import 'node:buffer';
import 'node:http';
import '../common/tempGzipFile.js';
import '../common/consumerRegistry.js';
import '../common/requestCounter.js';
import '../common/serverErrorCounter.js';
import '../common/validationErrorCounter.js';
declare const START_TIME_SYMBOL: unique symbol;
declare const REQUEST_BODY_SYMBOL: unique symbol;
declare const RESPONSE_SYMBOL: unique symbol;
declare const RESPONSE_PROMISE_SYMBOL: unique symbol;
declare const ERROR_SYMBOL: unique symbol;
declare const CLIENT_SYMBOL: unique symbol;
declare global {
interface Request {
[START_TIME_SYMBOL]?: number;
[REQUEST_BODY_SYMBOL]?: Buffer;
[RESPONSE_SYMBOL]?: Response;
[RESPONSE_PROMISE_SYMBOL]?: Promise<CapturedResponse>;
[ERROR_SYMBOL]?: Readonly<Error>;
[CLIENT_SYMBOL]?: ApitallyClient;
}
}
interface ApitallyContext {
consumer?: ApitallyConsumer | string;
}
declare function apitallyPlugin(config: ApitallyConfig): (app: Elysia) => Elysia<"", {
decorator: {
apitally: ApitallyContext;
};
store: {};
derive: {};
resolve: {};
}, {
typebox: {};
error: {};
}, {
schema: {};
standaloneSchema: {};
macro: {};
macroFn: {};
parser: {};
response: {};
}, {}, {
derive: {};
resolve: {};
schema: {};
standaloneSchema: {};
response: {};
}, {
derive: {};
resolve: {};
schema: {};
standaloneSchema: {};
response: {};
}>;
export { apitallyPlugin as default };