apitally
Version:
Simple API monitoring & analytics for REST APIs built with Express, Fastify, NestJS, AdonisJS, Hono, H3, Elysia, Hapi, and Koa.
90 lines (87 loc) • 2.4 kB
text/typescript
import { Logger } from './logging.cjs';
import { RequestLoggingConfig } from './requestLogger.cjs';
import 'winston';
import 'node:buffer';
import 'node:http';
import './tempGzipFile.cjs';
type ApitallyConfig = {
clientId: string;
env?: string;
requestLogging?: Partial<RequestLoggingConfig>;
appVersion?: string;
logger?: Logger;
/** @deprecated Use requestLogging instead */
requestLoggingConfig?: Partial<RequestLoggingConfig>;
};
type ApitallyConsumer = {
identifier: string;
name?: string | null;
group?: string | null;
};
type PathInfo = {
method: string;
path: string;
};
type StartupData = {
paths: PathInfo[];
versions: Record<string, string>;
client: string;
};
type StartupPayload = {
instance_uuid: string;
message_uuid: string;
} & StartupData;
type ConsumerMethodPath = {
consumer?: string | null;
method: string;
path: string;
};
type RequestInfo = ConsumerMethodPath & {
statusCode: number;
responseTime: number;
requestSize?: string | number | null;
responseSize?: string | number | null;
};
type RequestsItem = ConsumerMethodPath & {
status_code: number;
request_count: number;
request_size_sum: number;
response_size_sum: number;
response_times: Record<number, number>;
request_sizes: Record<number, number>;
response_sizes: Record<number, number>;
};
type ValidationError = {
loc: string;
msg: string;
type: string;
};
type ValidationErrorsItem = ConsumerMethodPath & {
loc: Array<string>;
msg: string;
type: string;
error_count: number;
};
type ServerError = {
type: string;
msg: string;
traceback: string;
};
type ServerErrorsItem = ConsumerMethodPath & {
type: string;
msg: string;
traceback: string;
sentry_event_id: string | null;
error_count: number;
};
type ConsumerItem = ApitallyConsumer;
type SyncPayload = {
timestamp: number;
instance_uuid: string;
message_uuid: string;
requests: Array<RequestsItem>;
validation_errors: Array<ValidationErrorsItem>;
server_errors: Array<ServerErrorsItem>;
consumers: Array<ConsumerItem>;
};
export type { ApitallyConfig, ApitallyConsumer, ConsumerItem, ConsumerMethodPath, PathInfo, RequestInfo, RequestsItem, ServerError, ServerErrorsItem, StartupData, StartupPayload, SyncPayload, ValidationError, ValidationErrorsItem };