From aa2ed747945ae6e952e4ca4945983f86ef554d7d Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Fri, 23 Aug 2024 22:46:38 -0600 Subject: [PATCH] Move the mask options types to QueryManager --- src/cache/core/cache.ts | 40 ---------------------------------------- src/cache/index.ts | 2 -- src/core/QueryManager.ts | 18 ++++++++++++------ 3 files changed, 12 insertions(+), 48 deletions(-) diff --git a/src/cache/core/cache.ts b/src/cache/core/cache.ts index 5a9b2ddaeb6..d8ce265787a 100644 --- a/src/cache/core/cache.ts +++ b/src/cache/core/cache.ts @@ -77,46 +77,6 @@ export interface WatchFragmentOptions { optimistic?: boolean; } -export interface MaskFragmentOptions { - /** - * A GraphQL fragment document parsed into an AST with the `gql` - * template literal. - * - * @docGroup 1. Required options - */ - fragment: DocumentNode | TypedDocumentNode; - /** - * The raw, unmasked data that should be masked. - * - * @docGroup 1. Required options - */ - data: TData; - /** - * The name of the fragment defined in the fragment document. - * - * Required if the fragment document includes more than one fragment, - * optional otherwise. - * - * @docGroup 2. Cache options - */ - fragmentName?: string; -} - -export interface MaskOperationOptions { - /** - * A GraphQL document parsed into an AST with the `gql` template literal. - * - * @docGroup 1. Required options - */ - document: DocumentNode | TypedDocumentNode; - /** - * The raw, unmasked data that should be masked. - * - * @docGroup 1. Required options - */ - data: TData; -} - /** * Watched fragment results. */ diff --git a/src/cache/index.ts b/src/cache/index.ts index 3d94d2975ab..1f55d8c16df 100644 --- a/src/cache/index.ts +++ b/src/cache/index.ts @@ -4,8 +4,6 @@ export type { Transaction, WatchFragmentOptions, WatchFragmentResult, - MaskFragmentOptions, - MaskOperationOptions, } from "./core/cache.js"; export { ApolloCache } from "./core/cache.js"; export { Cache } from "./core/types/Cache.js"; diff --git a/src/core/QueryManager.ts b/src/core/QueryManager.ts index 032a2da560e..da601fca5b1 100644 --- a/src/core/QueryManager.ts +++ b/src/core/QueryManager.ts @@ -14,12 +14,7 @@ import { isExecutionPatchResult, removeDirectivesFromDocument, } from "../utilities/index.js"; -import type { - Cache, - ApolloCache, - MaskFragmentOptions, - MaskOperationOptions, -} from "../cache/index.js"; +import type { Cache, ApolloCache } from "../cache/index.js"; import { canonicalStringify } from "../cache/index.js"; import type { @@ -111,6 +106,17 @@ import { Trie } from "@wry/trie"; import { AutoCleanedWeakCache, cacheSizes } from "../utilities/index.js"; import { maskFragment, maskOperation } from "./masking.js"; +interface MaskFragmentOptions { + fragment: DocumentNode; + data: TData; + fragmentName?: string; +} + +interface MaskOperationOptions { + document: DocumentNode; + data: TData; +} + export interface QueryManagerOptions { cache: ApolloCache; link: ApolloLink;