UNPKG

1.28 kBTypeScriptView Raw
1import { GraphQLResolveInfo } from "graphql";
2declare type HighResolutionTime = [number, number];
3declare const traceHRStartTime: unique symbol;
4declare const traceWallStartTime: unique symbol;
5export declare const apolloTracingContext: unique symbol;
6export interface ApolloTracingContext {
7 [traceHRStartTime]: HighResolutionTime;
8 [traceWallStartTime]: Date;
9 version: 1;
10 startTime: string;
11 endTime: string;
12 duration: number;
13 execution: {
14 parsing?: {
15 startOffset: number;
16 duration: number;
17 };
18 validation?: {
19 startOffset: number;
20 duration: number;
21 };
22 resolvers: ApolloTracingResolverStats[];
23 };
24}
25export interface ApolloTracingResolverStats {
26 path: (string | number)[];
27 parentType: string;
28 fieldName: string;
29 returnType: string;
30 startOffset: number;
31 duration: number;
32}
33export declare function apolloTracingGraphQLMiddleware(resolve: Function, parent: any, args: any, context: {
34 [apolloTracingContext]: ApolloTracingContext;
35}, info: GraphQLResolveInfo): Promise<any>;
36export declare function startTracingContext(): ApolloTracingContext;
37export declare function endTracingContext(context: ApolloTracingContext): void;
38export {};