Skip to content

Commit

Permalink
Move the mask options types to QueryManager
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Aug 24, 2024
1 parent f16edfc commit aa2ed74
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 48 deletions.
40 changes: 0 additions & 40 deletions src/cache/core/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,46 +77,6 @@ export interface WatchFragmentOptions<TData, TVars> {
optimistic?: boolean;
}

export interface MaskFragmentOptions<TData> {
/**
* A GraphQL fragment document parsed into an AST with the `gql`
* template literal.
*
* @docGroup 1. Required options
*/
fragment: DocumentNode | TypedDocumentNode<TData>;
/**
* 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<TData> {
/**
* A GraphQL document parsed into an AST with the `gql` template literal.
*
* @docGroup 1. Required options
*/
document: DocumentNode | TypedDocumentNode<TData>;
/**
* The raw, unmasked data that should be masked.
*
* @docGroup 1. Required options
*/
data: TData;
}

/**
* Watched fragment results.
*/
Expand Down
2 changes: 0 additions & 2 deletions src/cache/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
18 changes: 12 additions & 6 deletions src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -111,6 +106,17 @@ import { Trie } from "@wry/trie";
import { AutoCleanedWeakCache, cacheSizes } from "../utilities/index.js";
import { maskFragment, maskOperation } from "./masking.js";

interface MaskFragmentOptions<TData> {
fragment: DocumentNode;
data: TData;
fragmentName?: string;
}

interface MaskOperationOptions<TData> {
document: DocumentNode;
data: TData;
}

export interface QueryManagerOptions<TStore> {
cache: ApolloCache<TStore>;
link: ApolloLink;
Expand Down

0 comments on commit aa2ed74

Please sign in to comment.