1 | import type { DocumentNode } from "graphql";
|
2 | export type DocumentTransformCacheKey = ReadonlyArray<unknown>;
|
3 | type TransformFn = (document: DocumentNode) => DocumentNode;
|
4 | interface DocumentTransformOptions {
|
5 | |
6 |
|
7 |
|
8 |
|
9 |
|
10 | cache?: boolean;
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | getCacheKey?: (document: DocumentNode) => DocumentTransformCacheKey | undefined;
|
19 | }
|
20 | export declare class DocumentTransform {
|
21 | private readonly transform;
|
22 | private cached;
|
23 | private readonly resultCache;
|
24 | private getCacheKey;
|
25 | static identity(): DocumentTransform;
|
26 | static split(predicate: (document: DocumentNode) => boolean, left: DocumentTransform, right?: DocumentTransform): DocumentTransform & {
|
27 | left: DocumentTransform;
|
28 | right: DocumentTransform;
|
29 | };
|
30 | constructor(transform: TransformFn, options?: DocumentTransformOptions);
|
31 | /**
|
32 | * Resets the internal cache of this transform, if it has one.
|
33 | */
|
34 | resetCache(): void;
|
35 | private performWork;
|
36 | transformDocument(document: DocumentNode): DocumentNode;
|
37 | concat(otherTransform: DocumentTransform): DocumentTransform;
|
38 | /**
|
39 | * @internal
|
40 | * Used to iterate through all transforms that are concatenations or `split` links.
|
41 | */
|
42 | readonly left?: DocumentTransform;
|
43 | /**
|
44 | * @internal
|
45 | * Used to iterate through all transforms that are concatenations or `split` links.
|
46 | */
|
47 | readonly right?: DocumentTransform;
|
48 | }
|
49 | export {};
|
50 |
|
\ | No newline at end of file |