UNPKG

2.33 kBTypeScriptView Raw
1import type { GraphQLError, DocumentNode } from 'graphql';
2import type { GraphQLRequestContextDidResolveOperation, GraphQLRequestContext, GraphQLRequestContextWillSendResponse } from 'apollo-server-types';
3import type { Logger } from '@apollo/utils.logger';
4import type { fetch, RequestAgent } from 'apollo-server-env';
5import type { Trace } from 'apollo-reporting-protobuf';
6export interface ApolloServerPluginUsageReportingOptions<TContext> {
7 sendVariableValues?: VariableValueOptions;
8 sendHeaders?: SendValuesBaseOptions;
9 rewriteError?: (err: GraphQLError) => GraphQLError | null;
10 fieldLevelInstrumentation?: number | ((request: GraphQLRequestContextDidResolveOperation<TContext>) => Promise<number | boolean>);
11 includeRequest?: (request: GraphQLRequestContextDidResolveOperation<TContext> | GraphQLRequestContextWillSendResponse<TContext>) => Promise<boolean>;
12 generateClientInfo?: GenerateClientInfo<TContext>;
13 overrideReportedSchema?: string;
14 sendUnexecutableOperationDocuments?: boolean;
15 experimental_sendOperationAsTrace?: (trace: Trace, statsReportKey: string) => boolean;
16 sendReportsImmediately?: boolean;
17 requestAgent?: RequestAgent | false;
18 fetcher?: typeof fetch;
19 reportIntervalMs?: number;
20 maxUncompressedReportSize?: number;
21 maxAttempts?: number;
22 minimumRetryDelayMs?: number;
23 requestTimeoutMs?: number;
24 logger?: Logger;
25 reportErrorFunction?: (err: Error) => void;
26 endpointUrl?: string;
27 debugPrintReports?: boolean;
28 calculateSignature?: (ast: DocumentNode, operationName: string) => string;
29 internal_includeTracesContributingToStats?: boolean;
30}
31export declare type SendValuesBaseOptions = {
32 onlyNames: Array<String>;
33} | {
34 exceptNames: Array<String>;
35} | {
36 all: true;
37} | {
38 none: true;
39};
40declare type VariableValueTransformOptions = {
41 variables: Record<string, any>;
42 operationString?: string;
43};
44export declare type VariableValueOptions = {
45 transform: (options: VariableValueTransformOptions) => Record<string, any>;
46} | SendValuesBaseOptions;
47export interface ClientInfo {
48 clientName?: string;
49 clientVersion?: string;
50}
51export declare type GenerateClientInfo<TContext> = (requestContext: GraphQLRequestContext<TContext>) => ClientInfo;
52export {};
53//# sourceMappingURL=options.d.ts.map
\No newline at end of file